node-gradle / gradle-node-plugin

Gradle plugin for integrating NodeJS in your build. :rocket:
Apache License 2.0
599 stars 117 forks source link

Configuration-cache broken with 8.1 on ARM devices Mac + Linux #271

Closed deepy closed 1 year ago

deepy commented 1 year ago

With 8.1 it's no longer allowed to run commands during the configuration phase in the way we used to In 8.0 this was seemingly allowed and was properly picked up by the configuration-cache report

cocorossello commented 1 year ago

I noticed that configuration cache does not work becaouse NodeVersionSource always changes. Is this the reason you reopened it?

May I suggest to skip the NodeVersionSource abstraction? Something like:

    private fun configureNodeSetupTask(nodeExtension: NodeExtension) {
        project.tasks.named<NodeSetupTask>(NodeSetupTask.NAME).configure {
            val nodeArchiveDependencyProvider = variantComputer.computeNodeArchiveDependency(nodeExtension.version)
            val archiveFileProvider = nodeArchiveDependencyProvider
                    .map { nodeArchiveDependency ->
                        resolveNodeArchiveFile(nodeArchiveDependency)
                    }
            nodeArchiveFile.set(project.layout.file(archiveFileProvider))
        }
    }
deepy commented 1 year ago

I'll have a closer look tonight, but the problem is that on ARM devices we need to run a command (right now only uname but for Mac it should be sysctl sysctl.proc_translated) And this needs to be done at configuration time as we need the platform specifics to declare a dependency

And running external processes during configuration has limitations when the configuration cache is enabled

deepy commented 1 year ago

It always changing is going to be addressed in the next release, currently having lots of discussion on how to best evolve the setup

deepy commented 1 year ago

5.0.0 is out and this should now be properly fixed