Open nmalaguti opened 9 years ago
This pushed my one step further: now the exception says I need to gradle installGrunt
. No way to add that as dependency of the integration test?
Hmm, the integration tests should automatically run installGrunt
as part of their run and create node_modules
folders in each of the test projects.
def result = runTasksSuccessfully('installGrunt', 'installGulp', ':example-app:build')
Can you look at build/test/com.palantir.bowerdeps.BowerDepsPluginIntegSpec/grunt-dependencies-added/
and let me know if there is a node_modules
folder with grunt
and grunt-cli
installed?
installGrunt
does not appear on the list of the valid top-level tasks.
Here's what I have in grunt-dependencies-added
after running gradle clean
and then gradle integrationTest
:
That's very odd. Are the gradle-node-plugin
and gradle-grunt-plugin
on the classpath in build/test/com.palantir.bowerdeps.BowerDepsPluginIntegSpec/grunt-dependencies-added/.gradle-test-kit/init.gradle
?
This is currently working on Travis CI and locally for me. I'll look into setting up FreeBSD to repro this.
Yes, both are there on the classpath. Somehow I feel it is not a FreeBSD-specific issue, it's more like a "polluted environment" issue.
Few observations:
grunt
globally installed and available via $PATH (removing the script as well as grunt
and grunt-cli
modules from my global node_modules
) - didn't helpbuild/integTest-results/TEST-com.palantir.bowerdeps.BowerDepsPluginMultiProjectIntegSpec.xml
that there is an actual npm
output hidden there:
-- npm install grunt
completes normally
-- npm install gulp
complete normally../../../../../../node_modules
, way below the plugin directory. I happen
to have some node_modules
directory below down there. (could this be an issue?)I have re-installed gulp
in that node_modules
directory and it ended up fine.
Here's the integTest-results/TEST-com.palantir.bowerdeps.BowerDepsPluginMultiProjectIntegSpec.xml
:
https://gist.github.com/7906a853a8f30f2b9230
So it seems to be there is some problem with locating correct node_modules
(similar to https://github.com/srs/gradle-node-plugin/issues/53) and others.
Well - that was it - installing in some directory which has no node_modules
below and with no grunt
or gulp
on the node global path (npm install -g
) the test finally worked!
So this PR worked for you? If so, I'll merge it in and update the README so developers know they need to have node installed locally in order to run the tests.
Well. not quite. To make it work I had to nuke all node_modules
directories on the filesystem up to the plugin path, because then npm install it there and the gradle-node plugin system tears apart.
I think it shouldn't work this way... Maybe just some path to check after the install is hardcoded?
I think that's an issue with the node/grunt/gulp plugins. I can look into having them search the parent directory tree for a node_modules folder, but I wouldn't want to handle that case in this plugin.
I think those plugins are not mature yet; I also do not need those (or even yours:) plugins, so I'd rather drop here at the moment. This patch is a great improvement; I think the upstream plugins should actually do the same. Somehow this "download binary/install/execute immediately" philosophy (a.k.a curl ... | sudo bash -
is going to backfire someday due to security.
Thanks for your involvement, at least I could refer to the problem on the gradle forum.
This should resolve #1.
Integration tests should use the globally installed version of node since the node plugin doesn't support installing correctly on all platforms.
Travis CI will use whatever version of nodejs is on the build nodes.