Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Licence adjustments #406

Merged
merged 9 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
## Description
## Why is this change proposed?

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.
## Description of Changes

Fixes #(issue)
## Pull Request Contribution Terms

## Type of change

Please delete options that are not relevant.

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing functionality to not work as expected)
- This change requires a documentation update

<!--
By submitting this pull request, you agree to the contribution terms defined in [CONTRIBUTING.md](https://github.com/ecotoneframework/ecotone-dev/blob/main/CONTRIBUTING.md).
-->
- [ ] I have read and agree to the contribution terms outlined in [CONTRIBUTING.md](https://github.com/ecotoneframework/ecotone-dev/blob/main/CONTRIBUTING.md).
dgafka marked this conversation as resolved.
Show resolved Hide resolved
32 changes: 32 additions & 0 deletions .github/workflows/contribution-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Check Contribution Terms Agreement

on:
pull_request:
types: [opened, edited]

jobs:
check-terms:
runs-on: ubuntu-latest
steps:
- name: Check for Contribution Agreement
uses: actions/github-script@v3
with:
script: |
const prBody = context.payload.pull_request.body;
if (!prBody.includes("[X] I have read and agree to the contribution terms")) {
core.setFailed("Contributor has not agreed to the contribution terms. Please provide set X in the checkbox to agree to the terms. `[X] I have read and agree to the contribution terms outlined in [CONTRIBUTING.md](https://github.com/ecotoneframework/ecotone-dev/blob/main/CONTRIBUTING.md)`");
}
check-files:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set Up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2

- name: Check for Contribution Files
shell: bash
run: |
php bin/check-files.php
4 changes: 2 additions & 2 deletions bin/add-licence.php → bin/add-apache-licence.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

$finder = new \Symfony\Component\Finder\Finder();

$files = $finder->files()->in(__DIR__ . "/../packages")->name("*.php");
$files = $finder->files()->in(__DIR__ . "/../packages/*/src")->name("*.php");

function addLicenceToFile(string $file)
{
$lines = file($file);
foreach ($lines as $index => $line) {
if (preg_match('/^\s*(abstract class|final class|class|interface)\s+/', $line)) {
if (preg_match('/^\s*(abstract class|final class|class|interface|trait)\s+/', $line)) {
array_splice($lines, $index, 0, [
<<<LICENCE
/**
Expand Down
37 changes: 37 additions & 0 deletions bin/add-enterprise-licence.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/*
* licence Apache-2.0
*/

require __DIR__ . "/../vendor/autoload.php";

$finder = new \Symfony\Component\Finder\Finder();

$files = $finder->files()->in(__DIR__ . "/../packages/*/src")->name("*.php");

function addLicenceToFile(string $file)
{
$lines = file($file);
foreach ($lines as $index => $line) {
if (preg_match('/^\s*(abstract class|final class|class|interface|trait)\s+/', $line)) {
array_splice($lines, $index, 0, [
<<<LICENCE
/**
* licence Enterprise
*/

LICENCE
]);
break;
}
}
file_put_contents($file, implode('', $lines));
}

foreach ($files as $file) {
$fileContent = file_get_contents($file->getRealPath());

if (! preg_match('/\*\s*(@licence|licence)\s+(Enterprise|Apache\-2\.0)\s*/', $fileContent, $matches)) {
addLicenceToFile($file);
}
}
18 changes: 18 additions & 0 deletions bin/check-licence.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
/*
* licence Apache-2.0
*/

require __DIR__ . "/../vendor/autoload.php";

$finder = new \Symfony\Component\Finder\Finder();

$files = $finder->files()->in(__DIR__ . "/../packages/*/src")->name("*.php");

foreach ($files as $file) {
$fileContent = file_get_contents($file->getRealPath());

if (! preg_match('/\*\s*(@licence|licence)\s+(Enterprise|Apache\-2\.0)\s*/', $fileContent, $matches)) {
throw new \RuntimeException("Missing licence in file: " . $file->getRealPath());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Test\Ecotone\Amqp\Fixture\DistributedCommandBus\Receiver\Event;

/**
* licence Apache-2.0
*/
final class TicketCreated
{
public function __construct(private string $ticket)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use Ecotone\Amqp\AmqpBackedMessageChannelBuilder;
use Ecotone\Messaging\Attribute\ServiceContext;

/**
* licence Apache-2.0
*/
final class TicketNotificationConfig
{
#[ServiceContext]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Ecotone\Modelling\Attribute\QueryHandler;
use Test\Ecotone\Amqp\Fixture\DistributedCommandBus\Receiver\Event\TicketCreated;

/**
* licence Apache-2.0
*/
final class TicketNotificationEventHandler
{
public const GET_TICKETS_NOTIFICATION_COUNT = 'getTicketsNotificationCount';
Expand Down
3 changes: 3 additions & 0 deletions packages/Dbal/tests/Fixture/FailingConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
use Doctrine\DBAL\Statement;
use Traversable;

/**
* licence Apache-2.0
*/
final class FailingConnection extends Connection
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Ecotone\Messaging\MessagingException;

/**
* licence Apache-2.0
*/
final class IncorrectPointcutException extends MessagingException
{
protected static function errorCode(): int
Expand Down
3 changes: 3 additions & 0 deletions packages/Ecotone/src/Modelling/WithAggregateEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
* @deprecated Use Ecotone\Modelling\WithEvents instead
* @TODO Ecotone 2.0 replace with WithEvents
*/
/**
* licence Apache-2.0
*/
trait WithAggregateEvents
{
private ?array $recordedEvents = null;
Expand Down
3 changes: 3 additions & 0 deletions packages/Ecotone/src/Modelling/WithAggregateVersioning.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use Ecotone\Modelling\Attribute\AggregateVersion;

/**
* licence Apache-2.0
*/
trait WithAggregateVersioning
{
#[AggregateVersion]
Expand Down
3 changes: 3 additions & 0 deletions packages/Ecotone/src/Modelling/WithEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* @package Ecotone\Modelling
* @author Dariusz Gafka <support@simplycodedsoftware.com>
*/
/**
* licence Apache-2.0
*/
trait WithEvents
{
private ?array $recordedEvents = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Attribute;

#[Attribute(Attribute::TARGET_PARAMETER)]
/**
* licence Apache-2.0
*/
class ParameterAttribute
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Attribute;

#[Attribute(Attribute::TARGET_PROPERTY)]
/**
* licence Apache-2.0
*/
class PropertyAttribute
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Test\Ecotone\AnnotationFinder\Fixture\Usage\Attribute\Annotation\ParameterAttribute;
use Test\Ecotone\AnnotationFinder\Fixture\Usage\Attribute\Annotation\PropertyAttribute;

/**
* licence Apache-2.0
*/
class ClassWithPromotedConstructorParameterAttribute
{
public function __construct(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
/**
* @internal
*/
/**
* licence Apache-2.0
*/
class AttributeResolverTest extends TestCase
{
public function test_it_can_resolve_property_attributes_on_promoted_constructor_parameters(): void
Expand Down
3 changes: 3 additions & 0 deletions packages/Ecotone/tests/Messaging/BaseEcotoneTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
/**
* @internal
*/
/**
* licence Apache-2.0
*/
abstract class BaseEcotoneTestCase extends TestCase
{
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Ecotone\Messaging\Attribute\Parameter\Header;
use PHPUnit\Framework\Assert;

/**
* licence Apache-2.0
*/
final class SimpleConsumptionDecider
{
public function __construct(private array $results, private string $expectedDynamicChannelName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use Ecotone\Messaging\Attribute\Enterprise;

#[Enterprise]
/**
* licence Apache-2.0
*/
class EnterpriseClassInterface
{
public function execute(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

use Ecotone\Messaging\Attribute\Enterprise;

/**
* licence Apache-2.0
*/
class EnterpriseMethodInterface
{
#[Enterprise]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

namespace Test\Ecotone\Messaging\Fixture\EnterpriseMode;

/**
* licence Apache-2.0
*/
class StandardInterface
{
public function execute(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Test\Ecotone\Messaging\Fixture\InterceptorsOrdering;

/**
* licence Apache-2.0
*/
class CreatedEvent
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use Ecotone\Messaging\Attribute\MessageGateway;

/**
* licence Apache-2.0
*/
interface Gateway
{
#[MessageGateway(requestChannel: 'serviceEndpointReturning')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Ecotone\Messaging\Attribute\Parameter\Reference;
use Ecotone\Messaging\Handler\Processor\MethodInvoker\MethodInvocation;

/**
* licence Apache-2.0
*/
class GatewayInterceptors
{
#[Around(pointcut: Gateway::class)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
use Ecotone\Modelling\WithEvents;

#[Aggregate]
/**
* licence Apache-2.0
*/
class InterceptorOrderingAggregate
{
use WithEvents;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use Ecotone\Messaging\Attribute\ServiceActivator;
use Ecotone\Modelling\Attribute\CommandHandler;

/**
* licence Apache-2.0
*/
class InterceptorOrderingCase
{
#[CommandHandler(routingKey: 'commandEndpointReturning')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use Ecotone\Messaging\Handler\Processor\MethodInvoker\MethodInvocation;
use Ecotone\Modelling\Attribute\EventHandler;

/**
* licence Apache-2.0
*/
class InterceptorOrderingInterceptors
{
#[After(precedence: -1, pointcut: InterceptorOrderingAggregate::class . '||' . InterceptorOrderingCase::class, changeHeaders: true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Test\Ecotone\Messaging\Fixture\InterceptorsOrdering;

/**
* licence Apache-2.0
*/
class InterceptorOrderingStack
{
private array $calls = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
use Ecotone\Messaging\Attribute\InternalHandler;
use Ecotone\Messaging\Attribute\Parameter\Reference;

/**
* licence Apache-2.0
*/
final class OutputHandler
{
#[InternalHandler(inputChannelName: 'internal-channel')]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
use Ecotone\Modelling\CommandBus;

#[Asynchronous('async')]
/**
* licence Apache-2.0
*/
interface AsyncCommandBus extends CommandBus
{
}
Loading
Loading