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

Composer plugin incompatible with newest composer #190

Closed
sagikazarmark opened this issue Apr 14, 2016 · 9 comments · Fixed by puli/composer-plugin#46
Closed

Composer plugin incompatible with newest composer #190

sagikazarmark opened this issue Apr 14, 2016 · 9 comments · Fixed by puli/composer-plugin#46

Comments

@sagikazarmark
Copy link

As of composer/composer@fd2f51c composer generates an autoload_static.php file and uses it above php 5.6 instead of the classmap. This makes the generated class unavailable on these platforms.

Unfortunately there is no nice workarounds to this as puli build runs AFTER the autoload files are generated.

If you use symfony, a possible workaround is to add a custom classmap to the autoloader in app/autoload.php:

// Temporary fix for Puli
$loader->addClassMap([
    'Puli\\GeneratedPuliFactory' => __DIR__.'/../.puli/GeneratedPuliFactory.php',
]);
@tgalopin
Copy link
Contributor

There is still a classmap that can be found using a small trick: https://github.com/symfony/symfony/pull/18533/files#diff-ec41b7a9f7c5b4c51f70679eb93504b8R101

However, as I'm not sure what the problem is in the Puli CLI with the newest version, that may not be enough.

@sagikazarmark sagikazarmark changed the title CLI incompatible with newest composer Composer plugin incompatible with newest composer Apr 14, 2016
@sagikazarmark
Copy link
Author

Yeah, that looks pretty good, though does not solve the problem. While in symfony it might (as basically it does something similar to mine hack above), in other applications it will still be an issue above 5.6.

The problem is NOT with the cli, I corrected the issue title, sorry.

The problem is that the composer plugin does not correctly register the generated factory: it is registered in the classmap, more importantly the GENERATED classmap autoloader, which is not used anymore above 5.6.0. Instead the autoload_static.php file is used.

@thewilkybarkid
Copy link

I'm looking to see if I can remove the manipulation of the generated Composer autoload files, so that Puli can work no matter what Composer's doing internally.

@sagikazarmark
Copy link
Author

Well, it's a composer plugin, so it's purpose is to integrate puli with composer. (But of course Puli works fine without composer as well)

@thewilkybarkid
Copy link

Of course, but it would be better to use public APIs as this has shown.

@zhangweiquan
Copy link

Hello. Is it possible to install puli/composer-plugin in windows?
Because I can't install it in my com.
Thanks

@helhum
Copy link

helhum commented Aug 9, 2016

I will start looking into that now

@helhum
Copy link

helhum commented Aug 9, 2016

@webmozart @thewilkybarkid

puli/composer-plugin#46
looks good ans works well with all composer versions.

I only removed the unnecessary writing of an empty autoload.php in my pull request
thewilkybarkid/puli-composer-plugin#2

Other than that, puli/composer-plugin#46 can be merged from my PoV

@JLepeltier
Copy link

On your composer file you can do :
"autoload": {
"classmap": [".puli/"]
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants