typelead / gradle-eta

Gradle plugin for the Eta programming language
BSD 3-Clause "New" or "Revised" License
30 stars 7 forks source link

failure to build text-1.2.2.2 and text-1.2.3.1 #37

Open joshsh opened 6 years ago

joshsh commented 6 years ago

I encountered a build failure in a project with a text-1.2.3.1 dependency, and I was able to reproduce the problem by simply adding a text-1.2.2.2 dependency to the fatjar example:

plugins {
    id 'com.typelead.eta' version '0.8.0'
    id 'com.github.johnrengelman.shadow' version '2.0.3'
    id 'application'
}

eta {
    version = '0.8.6b2'
    etlasVersion = '1.5.0.0'
}

dependencies {
  compile eta('base:4.11.1.0')
  compile eta('text:1.2.2.2')
}

I encounter distinct errors the first time I run ./gradlew shadowJar --info (after clearing the Gradle cache) vs. the second time I run it. Output for both scenarios is below. Below these is a third run in which I have changed the text dependency to 1.2.3.1. First, the Gradle version:

$ ./gradlew --version

------------------------------------------------------------
Gradle 4.10.2
------------------------------------------------------------

Build time:   2018-09-19 18:10:15 UTC
Revision:     b4d8d5d170bb4ba516e88d7fe5647e2323d791dd

Kotlin DSL:   1.0-rc-6
Kotlin:       1.2.61
Groovy:       2.4.15
Ant:          Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM:          1.8.0_151 (Oracle Corporation 25.151-b12)
OS:           Mac OS X 10.14.1 x86_64

First run:

$ ./gradlew shadowJar --info
Initialized native services in: /Users/joshsh/.gradle/native
Found daemon DaemonInfo{pid=86469, address=[1f076ac0-d4b3-449a-98f0-39471d3ca92a port:61424, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1542118419460, context=DefaultDaemonContext[uid=bb8911a3-ab10-41b4-887e-d267125bf5c2,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home,daemonRegistryDir=/Users/joshsh/.gradle/daemon,pid=86469,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home,daemonRegistryDir=/Users/joshsh/.gradle/daemon,pid=15501,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=bb8911a3-ab10-41b4-887e-d267125bf5c2,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home,daemonRegistryDir=/Users/joshsh/.gradle/daemon,pid=86469,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]

  Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 85668). The daemon log file: /Users/joshsh/.gradle/daemon/4.10.2/daemon-85668.out.log
Starting 36th build in daemon [uptime: 3 hrs 53 mins 58.202 secs, performance: 100%, no major garbage collections]
Using 8 worker leases.
Starting Build
Settings evaluated using settings file '/private/tmp/eta/fatjar/settings.gradle'.
Projects loaded. Root project using build file '/private/tmp/eta/fatjar/build.gradle'.
Included projects: [root project 'fatjar']

> Configure project :
Evaluating root project 'fatjar' using build file '/private/tmp/eta/fatjar/build.gradle'.
Compiling build file '/private/tmp/eta/fatjar/build.gradle' using SubsetScriptTransformer.
Invalidating in-memory cache of /Users/joshsh/.gradle/caches/4.10.2/md-supplier/md-supplier.bin
Invalidating in-memory cache of /Users/joshsh/.gradle/caches/4.10.2/md-rule/md-rule.bin
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/commons-io/commons-io/2.5/commons-io-2.5.pom, /Users/joshsh/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.pom, /Users/joshsh/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/apache/commons/commons-parent/39/commons-parent-39.pom, /Users/joshsh/.m2/repository/org/apache/commons/commons-parent/39/commons-parent-39.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/codehaus/plexus/plexus/4.0/plexus-4.0.pom, /Users/joshsh/.m2/repository/org/codehaus/plexus/plexus/4.0/plexus-4.0.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/sonatype/forge/forge-parent/10/forge-parent-10.pom, /Users/joshsh/.m2/repository/org/sonatype/forge/forge-parent/10/forge-parent-10.pom]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/commons-io/commons-io/2.5/commons-io-2.5.jar, /Users/joshsh/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar]
Found locally available resource with matching checksum: [https://plugins.gradle.org/m2/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar, /Users/joshsh/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.24/plexus-utils-3.0.24.jar]
Compiling build file '/private/tmp/eta/fatjar/build.gradle' using BuildScriptTransformer.
All projects evaluated.
Selected primary task 'shadowJar' from project :
Tasks to be executed: [task ':setupEnvironmentEta', task ':resolveDependenciesEta', task ':installDependenciesEta', task ':compileJava', task ':compileEta', task ':processResources', task ':classes', task ':shadowJar']
:setupEnvironmentEta (Thread[Task worker for ':',5,main]) started.

> Task :setupEnvironmentEta
Task ':setupEnvironmentEta' is not up-to-date because:
  Task.upToDateWhen is false.
Downloading etlas from: http://cdnverify.eta-lang.org/eta-binaries/etlas-1.5.0.0/binaries/x86_64-osx/etlas ; caching to /Users/joshsh/.gradle/caches/etlas/1.5.0.0/etlas
Updating etlas packages via 'etlas update'.

> Task :setupEnvironmentEta FAILED
:setupEnvironmentEta (Thread[Task worker for ':',5,main]) completed. Took 17.521 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':setupEnvironmentEta'.
> No value has been specified for this provider.

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 26s
1 actionable task: 1 executed

Second run:

$ ./gradlew shadowJar --info
Initialized native services in: /Users/joshsh/.gradle/native
Found daemon DaemonInfo{pid=86469, address=[1f076ac0-d4b3-449a-98f0-39471d3ca92a port:61424, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1542081344579, context=DefaultDaemonContext[uid=bb8911a3-ab10-41b4-887e-d267125bf5c2,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home,daemonRegistryDir=/Users/joshsh/.gradle/daemon,pid=86469,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home,daemonRegistryDir=/Users/joshsh/.gradle/daemon,pid=15063,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=bb8911a3-ab10-41b4-887e-d267125bf5c2,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home,daemonRegistryDir=/Users/joshsh/.gradle/daemon,pid=86469,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]

  Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 85668). The daemon log file: /Users/joshsh/.gradle/daemon/4.10.2/daemon-85668.out.log
Starting 33rd build in daemon [uptime: 3 hrs 39 mins 3.205 secs, performance: 100%, no major garbage collections]
Using 8 worker leases.
Starting Build
Settings evaluated using settings file '/private/tmp/eta/fatjar/settings.gradle'.
Projects loaded. Root project using build file '/private/tmp/eta/fatjar/build.gradle'.
Included projects: [root project 'fatjar']

> Configure project :
Evaluating root project 'fatjar' using build file '/private/tmp/eta/fatjar/build.gradle'.
Compiling build file '/private/tmp/eta/fatjar/build.gradle' using SubsetScriptTransformer.
Compiling build file '/private/tmp/eta/fatjar/build.gradle' using BuildScriptTransformer.
All projects evaluated.
Selected primary task 'shadowJar' from project :
Tasks to be executed: [task ':setupEnvironmentEta', task ':resolveDependenciesEta', task ':installDependenciesEta', task ':compileJava', task ':compileEta', task ':processResources', task ':classes', task ':shadowJar']
:setupEnvironmentEta (Thread[Task worker for ':' Thread 2,5,main]) started.

> Task :setupEnvironmentEta UP-TO-DATE
Task ':setupEnvironmentEta' is not up-to-date because:
  Task.upToDateWhen is false.
Executing external command: [/Users/joshsh/.gradle/caches/etlas/1.5.0.0/etlas, select, --list, --installed] in workingDir: null
:setupEnvironmentEta (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.17 secs.
:resolveDependenciesEta (Thread[Task worker for ':' Thread 2,5,main]) started.

> Task :resolveDependenciesEta
Task ':resolveDependenciesEta' is not up-to-date because:
  Value of input property 'dependencies' has changed for task ':resolveDependenciesEta'
Executing external command: [/Users/joshsh/.gradle/caches/etlas/1.5.0.0/etlas, --select-eta=0.8.6b2, freeze] in workingDir: /private/tmp/eta/fatjar/build/eta-freeze

Resolving dependencies...
Wrote freeze file:
/private/tmp/eta/fatjar/build/eta-freeze/cabal.project.freeze
:resolveDependenciesEta (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 25.511 secs.
:installDependenciesEta (Thread[Task worker for ':' Thread 2,5,main]) started.
Resolving dependencies...
In order, the following will be built (use -v for more details):
 - text-1.2.2.2 (lib) (requires build)
Found patch in eta-hackage for text-1.2.2.2
Configuring text-1.2.2.2 (lib)...

> Task :installDependenciesEta
Task ':installDependenciesEta' is not up-to-date because:
  Task.upToDateWhen is false.
Executing external command: [/Users/joshsh/.gradle/caches/etlas/1.5.0.0/etlas, --select-eta=0.8.6b2, deps, lib:fatjar] in workingDir: /private/tmp/eta/fatjar/build/eta/main

Building text-1.2.2.2 (lib)...

> Task :installDependenciesEta FAILED
:installDependenciesEta (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 30.376 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':installDependenciesEta'.
> [/Users/joshsh/.gradle/caches/etlas/1.5.0.0/etlas, --select-eta=0.8.6b2, deps, lib:fatjar] failed with ExitCode 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 57s
3 actionable tasks: 2 executed, 1 up-to-date

Third run (text-1.2.3.1):

$ ./gradlew shadowJar --info
Initialized native services in: /Users/joshsh/.gradle/native
Found daemon DaemonInfo{pid=86469, address=[1f076ac0-d4b3-449a-98f0-39471d3ca92a port:61424, addresses:[/0:0:0:0:0:0:0:1, /127.0.0.1]], state=Idle, lastBusy=1542118419460, context=DefaultDaemonContext[uid=bb8911a3-ab10-41b4-887e-d267125bf5c2,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home,daemonRegistryDir=/Users/joshsh/.gradle/daemon,pid=86469,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]} however its context does not match the desired criteria.
Java home is different.
Wanted: DefaultDaemonContext[uid=null,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_151.jdk/Contents/Home,daemonRegistryDir=/Users/joshsh/.gradle/daemon,pid=16320,idleTimeout=null,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]
Actual: DefaultDaemonContext[uid=bb8911a3-ab10-41b4-887e-d267125bf5c2,javaHome=/Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home,daemonRegistryDir=/Users/joshsh/.gradle/daemon,pid=86469,idleTimeout=10800000,daemonOpts=-XX:+HeapDumpOnOutOfMemoryError,-Xmx1024m,-Dfile.encoding=UTF-8,-Duser.country=US,-Duser.language=en,-Duser.variant]

  Looking for a different daemon...
The client will now receive all logging from the daemon (pid: 85668). The daemon log file: /Users/joshsh/.gradle/daemon/4.10.2/daemon-85668.out.log
Starting 38th build in daemon [uptime: 3 hrs 59 mins 0.77 secs, performance: 100%, no major garbage collections]
Using 8 worker leases.
Starting Build
Settings evaluated using settings file '/private/tmp/eta/fatjar/settings.gradle'.
Projects loaded. Root project using build file '/private/tmp/eta/fatjar/build.gradle'.
Included projects: [root project 'fatjar']

> Configure project :
Evaluating root project 'fatjar' using build file '/private/tmp/eta/fatjar/build.gradle'.
Compiling build file '/private/tmp/eta/fatjar/build.gradle' using SubsetScriptTransformer.
Compiling build file '/private/tmp/eta/fatjar/build.gradle' using BuildScriptTransformer.
All projects evaluated.
Selected primary task 'shadowJar' from project :
Tasks to be executed: [task ':setupEnvironmentEta', task ':resolveDependenciesEta', task ':installDependenciesEta', task ':compileJava', task ':compileEta', task ':processResources', task ':classes', task ':shadowJar']
:setupEnvironmentEta (Thread[Task worker for ':' Thread 2,5,main]) started.

> Task :setupEnvironmentEta UP-TO-DATE
Task ':setupEnvironmentEta' is not up-to-date because:
  Task.upToDateWhen is false.
Executing external command: [/Users/joshsh/.gradle/caches/etlas/1.5.0.0/etlas, select, --list, --installed] in workingDir: null
:setupEnvironmentEta (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 0.161 secs.
:resolveDependenciesEta (Thread[Task worker for ':' Thread 2,5,main]) started.
Resolving dependencies...
etlas: Could not resolve dependencies:
trying: base-4.11.1.0/installed-9g5... (dependency of fatjar-0.0.0)
trying: text-1.2.3.1:-integer-simple
next goal: integer-gmp (dependency of text-1.2.3.1:-integer-simple)
rejecting: integer-gmp-1.0.2.0 (conflict: base =>
ghc-prim==0.4.0.0/installed-Jhi..., integer-gmp => ghc-prim>=0.5.2)
rejecting: integer-gmp-1.0.1.0 (conflict: base =>
ghc-prim==0.4.0.0/installed-Jhi..., integer-gmp => ghc-prim>=0.5.1)
rejecting: integer-gmp-1.0.0.1 (conflict: base =>
ghc-prim==0.4.0.0/installed-Jhi..., integer-gmp => ghc-prim>=0.5)
rejecting: integer-gmp-1.0.0.0, integer-gmp-0.5.1.0 (only already installed
instances can be used)
After searching the rest of the dependency tree exhaustively, these were the
goals I've had most trouble fulfilling: text, fatjar, base, integer-gmp,
text-1.2.3.1:flag, integer-simple

> Task :resolveDependenciesEta FAILED
Task ':resolveDependenciesEta' is not up-to-date because:
  Value of input property 'dependencies' has changed for task ':resolveDependenciesEta'
Executing external command: [/Users/joshsh/.gradle/caches/etlas/1.5.0.0/etlas, --select-eta=0.8.6b2, freeze] in workingDir: /private/tmp/eta/fatjar/build/eta-freeze
:resolveDependenciesEta (Thread[Task worker for ':' Thread 2,5,main]) completed. Took 1.718 secs.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':resolveDependenciesEta'.
> Nonzero (1) exit code for command [/Users/joshsh/.gradle/caches/etlas/1.5.0.0/etlas, --select-eta=0.8.6b2, freeze] with workingDir /private/tmp/eta/fatjar/build/eta-freeze

* Try:
Run with --stacktrace option to get the stack trace. Run with --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2s
2 actionable tasks: 1 executed, 1 up-to-date
rahulmutt commented 6 years ago

Perhaps the problem is related to #36?

jneira commented 6 years ago

Hi and thanks for the detailed report:

rahulmutt commented 6 years ago

It was shown that text-1.2.2.2 has a serious bug so we decided not to backport the patch. Please use text-1.2.3.0. If you still feel it should be patched, please let us know.

The errors in the build for text-1.2.2.2 look like this after checking in ~/.etlas/logs/eta-0.8.6.2/text-1.2.2.2-*.log:

Data/Text/Lazy/Builder/Int.hs:247:55: error:
    Ambiguous occurrence ‘<>’
    It could refer to either ‘Prelude.<>’,
                             imported from ‘Prelude’ at Data/Text/Lazy/Builder/Int.hs:17:8-33
                             (and originally defined in ‘GHC.Base’)
                          or ‘Data.Text.Internal.Builder.Functions.<>’,
                             imported from ‘Data.Text.Internal.Builder.Functions’ at Data/Text/Lazy/Builder/Int.hs:26:46-49
                             (and originally defined
                                at Data/Text/Internal/Builder/Functions.hs:37:1-4)
    |
247 |                     PAIR(x,y) -> pblock q <> pblock r <> putB ns
    |                                                       ^^

Data/Text/Lazy/Builder/Int.hs:260:40: error:
    Ambiguous occurrence ‘<>’
    It could refer to either ‘Prelude.<>’,
                             imported from ‘Prelude’ at Data/Text/Lazy/Builder/Int.hs:17:8-33
                             (and originally defined in ‘GHC.Base’)
                          or ‘Data.Text.Internal.Builder.Functions.<>’,
                             imported from ‘Data.Text.Internal.Builder.Functions’ at Data/Text/Lazy/Builder/Int.hs:26:46-49
                             (and originally defined
                                at Data/Text/Internal/Builder/Functions.hs:37:1-4)
    |
260 |             | otherwise = loop (d-1) q <> hexDigit r

which can be fixed by making text-1.2.2.2 base-4.11.1.0-compatible because that change is causing the clashes.

rahulmutt commented 6 years ago

I've replicated and reported the No value specified for provider bug in #38.

joshsh commented 6 years ago

Thank you; bumping the text dependency to the latest patched version solved the problem. Here are all of the dependencies of my project which needed to be special-cased for (gradle-)Eta:

rahulmutt commented 6 years ago

@joshsh Can you file a request on eta-hackage to provide patches for those specific versions of all the libraries?