? ? Pending

User tests: Successful: Unsuccessful:

avatar wilsonge
wilsonge
27 Jul 2019

Fixes running composer install --no-dev

This currently breaks the build script - see: https://build.joomla.org:8443/job/cms_packaging/job/nightly_build_40/431/console

To test just run composer install and composer install --no-dev. Before patch the latter fails. After patch both work

avatar wilsonge wilsonge - open - 27 Jul 2019
avatar wilsonge wilsonge - change - 27 Jul 2019
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Jul 2019
Category Unit Tests Repository Administration
avatar wilsonge wilsonge - change - 27 Jul 2019
The description was changed
avatar wilsonge wilsonge - edited - 27 Jul 2019
avatar joomla-cms-bot joomla-cms-bot - change - 27 Jul 2019
Category Unit Tests Repository Administration External Library Composer Change
avatar wilsonge wilsonge - change - 27 Jul 2019
Title
Composer dev mode
[4.0] Fix composer no-dev
avatar wilsonge wilsonge - edited - 27 Jul 2019
avatar wilsonge wilsonge - change - 27 Jul 2019
Title
[4.0] Fix composer no-dev
[4.0] Fix composer no-dev (and nightly generation)
avatar wilsonge wilsonge - edited - 27 Jul 2019
avatar wilsonge wilsonge - change - 27 Jul 2019
Labels Added: ? ?
avatar wilsonge wilsonge - change - 27 Jul 2019
Status Pending Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2019-07-27 23:33:32
Closed_By wilsonge
avatar wilsonge wilsonge - close - 27 Jul 2019
avatar wilsonge wilsonge - merge - 27 Jul 2019
avatar wilsonge
wilsonge - comment - 27 Jul 2019

Merging to fix nightly builds. Also got Hannes to code review from his phone as he introduced this code

avatar twister65
twister65 - comment - 28 Jul 2019

composer install --no-dev returns:

[ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards
sh: 1: [: -eq: unexpected operator
sh: 1: phpcs: not found
Script [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards handling the post-install-cmd event returned with error code 127

composer install --no-scripts succeeds.

avatar twister65
twister65 - comment - 28 Jul 2019

composer install --no-dev succeeds with the latest release of composer.

avatar brianteeman
brianteeman - comment - 28 Jul 2019

@twister65 doesnt work for me

composer install

Generating optimized autoload files
> [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards
'[' is not recognized as an internal or external command,
operable program or batch file.
Using config file: C:\htdocs\joomla-cms\libraries\vendor\squizlabs\php_codesniffer\CodeSniffer.con

composer install --no-dev

Generating optimized autoload files
> [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards
'[' is not recognized as an internal or external command,
operable program or batch file.
'phpcs' is not recognized as an internal or external command,
operable program or batch file.
Script [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards handling the post-install-cmd event returned with error code 1
avatar twister65
twister65 - comment - 28 Jul 2019

'[' is not recognized as an internal or external command,

I think you have an old version of composer, I had the same problem. I solved it by updating the composer.

avatar brianteeman
brianteeman - comment - 28 Jul 2019

PS C:\htdocs\joomla-cms> composer -V
Composer version 1.8.6 2019-06-11 15:03:05

avatar brianteeman
brianteeman - comment - 28 Jul 2019

I suspect it might be because I am on windows?

avatar twister65
twister65 - comment - 28 Jul 2019

Note: this does not work on windows, since it would need %COMPOSER_DEV_MODE%.

https://stackoverflow.com/questions/13087088/composer-run-scripts-only-in-dev-environment

avatar brianteeman
brianteeman - comment - 28 Jul 2019

:(

avatar infograf768
infograf768 - comment - 29 Jul 2019

Running composer install on the branch https://github.com/Hackwar/joomla-cms/tree/j4mailtemplates I get here (Macintosh)

Generating optimized autoload files
> [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards

Warning: Unsupported declare 'strict_types' in /Applications/MAMP/htdocs/joomla-cms-j4mailtemplates/libraries/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php on line 8

Parse error: parse error, expecting `'{'' in /Applications/MAMP/htdocs/joomla-cms-j4mailtemplates/libraries/vendor/zendframework/zend-diactoros/src/functions/create_uploaded_file.php on line 19
Script [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards handling the post-install-cmd event returned with error code 255
avatar brianteeman
brianteeman - comment - 29 Jul 2019

For now revert the change in this PR

avatar wilsonge
wilsonge - comment - 29 Jul 2019

Something unrelated is wrong with JMs code. @infograf768 is there any way your php version locally is less than PHP 7? Because that suggests your php version doesn't recognise strict_types.

I also have tested this right now on my MacBook and it works just fine (@brianteeman is right this is broken on windows and needs to be fixed there (reverting is good enough)). However this patch is fine on linux + mac

avatar wilsonge
wilsonge - comment - 29 Jul 2019

Screenshot 2019-07-29 at 09 54 21

My macbook using J4 right now

avatar infograf768
infograf768 - comment - 29 Jul 2019

Php: 7.3.1 on MAMP

avatar infograf768
infograf768 - comment - 29 Jul 2019

I now ran composer update on the same branch.
I get

imac-2:joomla-cms-j4mailtemplates mac$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 15 updates, 0 removals
  - Updating symfony/console (v4.3.2 => v4.3.3): Downloading (100%)         
  - Updating symfony/debug (v4.3.2 => v4.3.3): Downloading (100%)         
  - Updating symfony/options-resolver (v4.3.2 => v4.3.3): Loading from cache
  - Updating symfony/ldap (v4.3.2 => v4.3.3): Loading from cache
  - Updating symfony/web-link (v4.3.2 => v4.3.3): Loading from cache
  - Updating symfony/yaml (v4.3.2 => v4.3.3): Downloading (100%)         
  - Updating symfony/dom-crawler (v4.3.2 => v4.3.3): Loading from cache
  - Updating symfony/browser-kit (v4.3.2 => v4.3.3): Loading from cache
  - Updating symfony/css-selector (v4.3.2 => v4.3.3): Loading from cache
  - Updating symfony/event-dispatcher (v4.3.2 => v4.3.3): Downloading (100%)         
  - Updating symfony/finder (v4.3.2 => v4.3.3): Downloading (100%)         
  - Updating symfony/process (v4.3.2 => v4.3.3): Loading from cache
  - Updating symfony/filesystem (v4.3.2 => v4.3.3): Loading from cache
  - Updating symfony/stopwatch (v4.3.2 => v4.3.3): Loading from cache
  - Updating symfony/var-dumper (v4.3.2 => v4.3.3): Downloading (100%)         
Writing lock file
Generating optimized autoload files
avatar infograf768
infograf768 - comment - 29 Jul 2019

Then no error with composer install --no-dev

> [ $COMPOSER_DEV_MODE -eq 0 ] || phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards
avatar HLeithner
HLeithner - comment - 29 Jul 2019

@wilsonge doesn't work on windows not even when using bash...

avatar brianteeman
brianteeman - comment - 29 Jul 2019

Reason given here already #25720 (comment)

avatar wilsonge
wilsonge - comment - 29 Jul 2019

That's how composer works. I'm aware and I will fix it when I'm next sitting down to write code. I'm just making the point JM's issue is something totally different.

avatar HLeithner
HLeithner - comment - 29 Jul 2019

something like this works:

"php -r \"$ret=0; getenv('COMPOSER_DEV_MODE') !== '1' ?? system('phpcs --config-set installed_paths ../../joomla/cms-coding-standards/lib,../../joomla/coding-standards', $ret); exit($ret);\""
avatar wilsonge
wilsonge - comment - 29 Jul 2019

if you're using php you don't have to use getenv you can just create a php class for it and use the function (what i'm intending). I just need to configure out something better than calling system as a function. via the config class somehow https://github.com/squizlabs/PHP_CodeSniffer/blob/9ae59b2b73550d86710a08befeeef5e74d9fbdc9/src/Config.php#L747 - but i need time to sit down and figure that out

Add a Comment

Login with GitHub to post a comment