echocat / gradle-golang-plugin

Gradle plugin to build, test and do other stuff of Golang projects.
https://github.com/echocat/gradle-golang-plugin
Mozilla Public License 2.0
44 stars 8 forks source link

:prepareToolchain FAILED #10

Closed goostleek closed 8 years ago

goostleek commented 8 years ago

My gradle.build:

plugins {
    id 'org.echocat.golang' version '0.1.11'
}

group 'my.group'

golang {
    platforms = System.getProperty("platforms", "linux-amd64,windows-amd64,darwin-amd64")
    dependencies {
        build 'github.com/hyperledger/fabric/core/chaincode/shim'
        test 'github.com/stretchr/testify'
    }
    build {
        // Use temporary GOPATH to build everthing in
        useTemporaryGopath = true
    }
}

Executing gradle --stacktrace --info build results in:

$ gradle --stacktrace --info build
Initialized native services in: C:\Users\makl\.gradle\native
Connected to daemon DaemonInfo{pid=780, address=[87c7d97d-7b0a-40b5-a1b9-81b1f1ea7f3f port:51308, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1478520319176, context=DefaultDaemonContext[uid=ba140f47-56da-482d-9ee9-92c986971f7d,javaHome=C:\Program Files\Java\jdk1.8.0_102,daemonRegistryDir=C:\Users\makl\.gradle\daemon,pid=780,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]}. Dispatching request Build{id=8401748f-3965-49af-b0a9-96e84d606735.1, currentDir=C:\work\babb-blockchain}.
Received result org.gradle.launcher.daemon.protocol.BuildStarted@352c1b98 from daemon DaemonInfo{pid=780, address=[87c7d97d-7b0a-40b5-a1b9-81b1f1ea7f3f port:51308, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1478520319176, context=DefaultDaemonContext[uid=ba140f47-56da-482d-9ee9-92c986971f7d,javaHome=C:\Program Files\Java\jdk1.8.0_102,daemonRegistryDir=C:\Users\makl\.gradle\daemon,pid=780,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be starting).
The client will now receive all logging from the daemon (pid: 780). The daemon log file: C:\Users\makl\.gradle\daemon\3.1\daemon-780.out.log
Starting 6th build in daemon [uptime: 11 mins 1.964 secs, performance: 100%, no major garbage collections]
Executing build with daemon context: DefaultDaemonContext[uid=ba140f47-56da-482d-9ee9-92c986971f7d,javaHome=C:\Program Files\Java\jdk1.8.0_102,daemonRegistryDir=C:\Users\makl\.gradle\daemon,pid=780,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]
Starting Build
Settings evaluated using settings file 'C:\master\settings.gradle'.
Projects loaded. Root project using build file 'C:\work\babb-blockchain\build.gradle'.
Included projects: [root project 'babb-blockchain']
Evaluating root project 'babb-blockchain' using build file 'C:\work\babb-blockchain\build.gradle'.
Compiling build file 'C:\work\babb-blockchain\build.gradle' using SubsetScriptTransformer.
Compiling build file 'C:\work\babb-blockchain\build.gradle' using BuildScriptTransformer.
All projects evaluated.
Selected primary task 'build' from project :
Tasks to be executed: [task ':baseValidate', task ':validate', task ':prepareToolchain', task ':baseGetTools', task ':getTools', task ':basePrepareSources', task ':prepareSources', task ':baseTest', task ':test', task ':baseBuild', task ':build']
In-memory cache of C:\work\babb-blockchain\.gradle\3.1\taskArtifacts\fileHashes.bin: Size{0}, CacheStats{hitCount=0, missCount=0, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
In-memory cache of C:\work\babb-blockchain\.gradle\3.1\taskArtifacts\fileSnapshots.bin: Size{0}, CacheStats{hitCount=0, missCount=0, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
In-memory cache of C:\work\babb-blockchain\.gradle\3.1\taskArtifacts\taskArtifacts.bin: Size{0}, CacheStats{hitCount=0, missCount=0, loadSuccessCount=0, loadExceptionCount=0, totalLoadTime=0, evictionCount=0}
:baseValidate (Thread[Daemon worker Thread 5,5,main]) started.
:baseValidate
Executing task ':baseValidate' (up-to-date check took 0.001 secs) due to:
  Task has not declared any outputs.
Package:          my.group
Platforms:        linux-amd64, windows-amd64, darwin-amd64
Host:             windows-amd64
Go version:       go1.7.1
GOROOT:           C:\Users\makl\.go\sdk\go1.7.1
GOROOT_BOOTSTRAP: C:\Users\makl\.go\sdk\bootstrap
GOPATH:           C:\work\babb-blockchain\build\gopath
:baseValidate (Thread[Daemon worker Thread 5,5,main]) completed. Took 0.002 secs.
:validate (Thread[Daemon worker Thread 5,5,main]) started.
:validate
Executing task ':validate' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
:validate (Thread[Daemon worker Thread 5,5,main]) completed. Took 0.001 secs.
:prepareToolchain (Thread[Daemon worker Thread 5,5,main]) started.
:prepareToolchain
Executing task ':prepareToolchain' (up-to-date check took 0.0 secs) due to:
  Task has not declared any outputs.
go: cannot find GOROOT directory: c:\go
There was no go bootstrap found. Going to download it from https://storage.googleapis.com/golang/go1.7.1.windows-amd64.zip to C:\Users\makl\.go\sdk\bootstrap ...
go: cannot find GOROOT directory: c:\go
:prepareToolchain FAILED
:prepareToolchain (Thread[Daemon worker Thread 5,5,main]) completed. Took 1 mins 1.05 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':prepareToolchain'.
> Downloaded and extracted bootstrap to C:\Users\makl\.go\sdk\bootstrap but it could not be validated as working go installation.

* Try:
Run with --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':prepareToolchain'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:233)

        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)

        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:74)

        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:55)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:32)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:113)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
        at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:186)
        at org.gradle.internal.Factories$1.create(Factories.java:22)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:53)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:183)
        at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:33)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:112)
        at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:106)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:63)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:92)
        at org.gradle.launcher.exec.GradleBuildController.run(GradleBuildController.java:66)
        at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
        at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:79)
        at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:51)
        at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:59)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:47)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
        at org.gradle.util.Swapper.swap(Swapper.java:38)
        at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:60)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
        at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.HintGCAfterBuild.execute(HintGCAfterBuild.java:44)
        at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
        at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
        at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:293)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: java.lang.IllegalStateException: Downloaded and extracted bootstrap to C:\Users\makl\.go\sdk\bootstrap but it could not be validated as working go installation.
        at org.echocat.gradle.plugins.golang.tasks.PrepareToolchain.downloadBootstrapIfRequired(PrepareToolchain.java:241)
        at org.echocat.gradle.plugins.golang.tasks.PrepareToolchain.run(PrepareToolchain.java:42)
        at org.echocat.gradle.plugins.golang.tasks.GolangTaskSupport.runBare(GolangTaskSupport.java:99)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:136)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:129)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:118)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:623)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:606)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 68 more

BUILD FAILED

Total time: 1 mins 3.16 secs
Received result Failure[value=org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Execution failed for task ':prepareToolchain'.] from daemon DaemonInfo{pid=780, address=[87c7d97d-7b0a-40b5-a1b9-81b1f1ea7f3f port:51308, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], state=Idle, lastBusy=1478520319176, context=DefaultDaemonContext[uid=ba140f47-56da-482d-9ee9-92c986971f7d,javaHome=C:\Program Files\Java\jdk1.8.0_102,daemonRegistryDir=C:\Users\makl\.gradle\daemon,pid=780,idleTimeout=10800000,daemonOpts=-XX:MaxPermSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=windows-1252,-Duser.country=US,-Duser.language=en,-Duser.variant]} (build should be done).

I can see some inconsistency in GOROOT variable in the above log. The first occurrence of GOROOT is C:\Users\makl\.go\sdk\go1.7.1 but finally it complains:

go: cannot find GOROOT directory: c:\go
blaubaer commented 8 years ago

Hi @goostleek!

To verify your problem and to be ensure that this is not another existing problem: Could you please do the following 5 times:

  1. Delete C:\Users\makl\.go
  2. Run gradle --stacktrace --info build

Is there any try with a success or does every try fail?

Cheers, Gregor

goostleek commented 8 years ago

I removed C:\Users\makl\.go and killed the gradle daemon. It fails on every try. I can observe additional strange behaviour - the plugin does the download on each run. I can see it first removes all the downloaded content from C:\Users\makl\.go then downloads it again.

blaubaer commented 8 years ago

Ok thanks for input. I now try to reproduce it.

goostleek commented 8 years ago

I don't know if it helps but the downloaded GO SDK gives me the same error as the logs:

C:\Users\makl>C:\Users\makl\.go\sdk\bootstrap\bin\go.exe version
go: cannot find GOROOT directory: c:\go

So it seems the GO SDK requires GOROOT to be explicitly set.

blaubaer commented 8 years ago

Mhh... Good to know. Thanks!

goostleek commented 8 years ago

http://stackoverflow.com/a/31101257/2443502

blaubaer commented 8 years ago

Close this as duplicate of #10.

AlexanderIvakin commented 7 years ago

Hi, is this fixed or just closed? - I am observing the same issue with 0.1.15 on Windows 10 machine, while it works absolutely fine on Mac OS X.