Open celcius112 opened 4 years ago
Maybe have a look at https://github.com/node-gradle/gradle-node-plugin which is an actively maintained fork of this project. :) More Info: https://github.com/srs/gradle-node-plugin/issues/315
oh that's good to know, thanks for the heads up ! Seems like there's already some work in progress for using the configuration avoidance API. I'll keep this issue open just in case though.
Since last year there's a new Gradle API for registering tasks called the 'Configuration Avoidance API'. This API was incubating from Gradle 4.9 to Gradle 5.1 inclusively, but since 5.0 has been quite stable.
This API basically lets us defined tasks configuration lazily so that they are configured only if needed. While a tasks.create("myEagerTask") would always launch myEagerTask configuration, a tasks.register("myLazyTask) would configure it only if necessary. For instance launching the simple ./gradlew help would configure myEagerTask even though they are not related, but will not configure myLazyTask. Similarly, launching ./gradlew myLazyTask will configure myLazyTask and myEagerTask.
The nodeplugin configures all tasks eagerly. Their configurations does not take too much time (a ./gradlew help --scan shows they are configured in 0.4sec), but little by little, by using other plugins that aren't using this new API, we end up with several unnecessary tasks configured eagerly. It is also worth noting that the create API will one day be deprecated.
Since this API is only usable after Gradle 4.9, using it might bring breaking changes to the users. I don't see a minimum version recommendation for the node plugin, so before proposing a PR I wanted to discuss a bit about it. I see two solutions: