Skip to content

Commit

Permalink
"check-annotations" and "fix-annotations" are now optional parts of p…
Browse files Browse the repository at this point in the history
…hing targets "standards", "standards-diff", "standards-fix", and "standards-fix-diff"

- there is a new build property "check-and-fix-annotations" that allows project developers to skip the checks and fixes of annotations when they do not want to include them in their "standards-*" targets
- done in such a way to avoid possible BC breaks
  • Loading branch information
vitek-rostislav committed Sep 3, 2019
1 parent 6f7da10 commit 6802951
Showing 1 changed file with 36 additions and 13 deletions.
49 changes: 36 additions & 13 deletions packages/framework/build.xml
Expand Up @@ -2,6 +2,7 @@
<project name="shopsys_framework" default="list">

<property name="is-multidomain" value="true" description="This property is @deprecated, see 'domains-info-load' target instead."/>
<property name="check-and-fix-annotations" value="true"/>
<property name="path.app" value="${path.root}/app"/>
<property name="path.bin" value="${path.vendor}/bin"/>
<property name="path.bin-console" value="${path.root}/bin/console"/>
Expand Down Expand Up @@ -105,10 +106,21 @@
</target>

<target name="check-annotations" description="Checks whether annotations of extended classes in the project are ok. Reported problems can be fixed using 'fix-annotations' phing target">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:extended-classes:annotations"/>
</exec>
<if>
<istrue value="${check-and-fix-annotations}"/>
<then>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:extended-classes:annotations"/>
</exec>
</then>
<else>
<echo>
Annotations checks are turned off by configuration, see "check-and-fix-annotations" build property.
You are still able to run "shopsys:extended-classes:annotations" Symfony command directly.
</echo>
</else>
</if>
</target>

<target name="checks" depends="checks-internal,standards,tests" description="Runs internal checks, coding standards and runs unit, DB and smoke tests."/>
Expand Down Expand Up @@ -563,11 +575,22 @@
</target>

<target name="fix-annotations" description="Fixes and adds annotations in project classes to improve static analysis and DX with extended classes">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:extended-classes:annotations"/>
<arg value="--dry-run=0"/>
</exec>
<if>
<istrue value="${check-and-fix-annotations}"/>
<then>
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
<arg value="${path.bin-console}"/>
<arg value="shopsys:extended-classes:annotations"/>
<arg value="--dry-run=0"/>
</exec>
</then>
<else>
<echo>
Annotations fixes are turned off by configuration, see "check-and-fix-annotations" build property.
You are still able to run "shopsys:extended-classes:annotations" Symfony command directly.
</echo>
</else>
</if>
</target>

<target name="friendly-urls-generate" description="Generates friendly urls for supported entities when missing.">
Expand Down Expand Up @@ -715,13 +738,13 @@
</exec>
</target>

<target name="standards" depends="phplint,ecs,phpstan,twig-lint,yaml-standards,eslint-check" description="Checks coding standards."/>
<target name="standards" depends="phplint,ecs,check-annotations,phpstan,twig-lint,yaml-standards,eslint-check" description="Checks coding standards."/>

<target name="standards-diff" depends="phplint-diff,ecs-diff,phpstan,twig-lint-diff,yaml-standards,eslint-check-diff" description="Checks coding standards in changed files."/>
<target name="standards-diff" depends="phplint-diff,ecs-diff,check-annotations,phpstan,twig-lint-diff,yaml-standards,eslint-check-diff" description="Checks coding standards in changed files."/>

<target name="standards-fix" depends="ecs-fix,yaml-standards-fix,eslint-fix" description="Automatically fixes *some* coding standards violations in all files. Always run 'standards' to be sure there are no further violations."/>
<target name="standards-fix" depends="ecs-fix,fix-annotations,yaml-standards-fix,eslint-fix" description="Automatically fixes *some* coding standards violations in all files. Always run 'standards' to be sure there are no further violations."/>

<target name="standards-fix-diff" depends="ecs-fix-diff,yaml-standards-fix,eslint-fix-diff" description="Automatically fixes *some* coding standards violations in changed files. Always run 'standards' to be sure there are no further violations."/>
<target name="standards-fix-diff" depends="ecs-fix-diff,fix-annotations,yaml-standards-fix,eslint-fix-diff" description="Automatically fixes *some* coding standards violations in changed files. Always run 'standards' to be sure there are no further violations."/>

<target name="test-db-create" description="Creates test database for application with required configuration.">
<exec executable="${path.php.executable}" passthru="true" checkreturn="true">
Expand Down

0 comments on commit 6802951

Please sign in to comment.