Skip to content

[Do not merge] Testing building with Java 9 in our CI environment. #5706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

retronym
Copy link
Member

I've run sbt publishLocal on the CI server to make SBT 0.13.4-b646662
available. This includes changes to be compatible with Java 9.

I've also installed JDK9-ea on the CI server, and made it selectable
with jvmSelect oracle 9:

scala/scala-jenkins-infra#221

Finally, I've used:

https://github.com/retronym/java9-rt-export

to export a Java 8-style rt.jar to make scalac work without
needing native support for reading the jrt:// virtual filesystem
containing the standard library classes. Scala 2.12.1 and higher
support this, but SBT itself still uses Scala 2.10.6, so the shim
JAR is required.

This commit uses 0.13.4-b646662 for this build, and sets an system
property to instruct scalac to add the rt.jar shim to the compilation
classpath.

@scala-jenkins scala-jenkins added this to the 2.12.2 milestone Feb 16, 2017
@retronym
Copy link
Member Author

retronym commented Feb 16, 2017

The CI builds in this PR will still be using OpenJDK 8. That failed with:

++ /usr/local/bin/sbt -sbt-version 0.13.14-b646662 -Dscala.ext.dirs=/usr/lib/jvm/jdk-9-ea-oracle/scala-ext -Dsbt.override.build.repos=true -Dsbt.repository.config=/home/jenkins/workspace/scala-2.12.x-validate-publish-core/scripts/sbt-repositories-config --warn 'setupPublishCore https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/' generateBuildCharacterPropertiesFile
Java HotSpot(TM) 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
java.lang.AssertionError: assertion failed: not a type: symbol
 loaded from class BuildSettings$ in package with name BuildSettings$ and classloader java.net.URLClassLoader@1148eca4
	at scala.reflect.runtime.JavaMirrors$JavaMirror.scala$reflect$runtime$JavaMirrors$JavaMirror$$classToScala1(JavaMirrors.scala:979)
	at scala.reflect.runtime.JavaMirrors$JavaMirror$$anonfun$classToScala$1.apply(JavaMirrors.scala:938)
	at scala.reflect.runtime.JavaMirrors$JavaMirror$$anonfun$classToScala$1.apply(JavaMirrors.scala:938)
	at scala.reflect.runtime.JavaMirrors$JavaMirror$$anonfun$toScala$1.apply(JavaMirrors.scala:104)
	at scala.reflect.runtime.TwoWayCache.toScala(TwoWayCache.scala:38)
	at scala.reflect.runtime.JavaMirrors$JavaMirror.toScala(JavaMirrors.scala:102)
	at scala.reflect.runtime.JavaMirrors$JavaMirror.classToScala(JavaMirrors.scala:938)
	at scala.reflect.runtime.JavaMirrors$JavaMirror.classSymbol(JavaMirrors.scala:206)
	at scala.reflect.runtime.JavaMirrors$JavaMirror$JavaInstanceMirror.symbol(JavaMirrors.scala:245)
	at scala.reflect.runtime.JavaMirrors$JavaMirror$JavaInstanceMirror.symbol(JavaMirrors.scala:243)
	at sbt.Plugins$$anonfun$1.apply$mcZ$sp(Plugins.scala:349)
	at sbt.Plugins$$anonfun$1.apply(Plugins.scala:349)
	at sbt.Plugins$$anonfun$1.apply(Plugins.scala:349)
	at scala.util.control.Exception$Catch$$anonfun$opt$1.apply(Exception.scala:118)
	at scala.util.control.Exception$Catch$$anonfun$opt$1.apply(Exception.scala:118)
	at scala.util.control.Exception$Catch.apply(Exception.scala:102)
	at scala.util.control.Exception$Catch.opt(Exception.scala:118)
	at sbt.Plugins$.hasAutoImportGetter(Plugins.scala:348)
	at sbt.PluginDiscovery$$anonfun$1.apply(PluginDiscovery.scala:41)
	at sbt.PluginDiscovery$$anonfun$1.apply(PluginDiscovery.scala:39)
	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
	at scala.collection.immutable.List.foreach(List.scala:318)
	at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
	at scala.collection.AbstractTraversable.map(Traversable.scala:105)
	at sbt.PluginDiscovery$.discoverAll(PluginDiscovery.scala:39)
	at sbt.Load$.loadPlugins(Load.scala:900)
	at sbt.Load$.loadPluginDefinition(Load.scala:857)
	at sbt.Load$.buildPlugins(Load.scala:852)
	at sbt.Load$.plugins(Load.scala:840)
	at sbt.Load$$anonfun$loadUnit$1$$anonfun$34.apply(Load.scala:465)
	at sbt.Load$$anonfun$loadUnit$1$$anonfun$34.apply(Load.scala:465)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$$anonfun$loadUnit$1.apply(Load.scala:464)
	at sbt.Load$$anonfun$loadUnit$1.apply(Load.scala:459)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$.loadUnit(Load.scala:459)
	at sbt.Load$$anonfun$25$$anonfun$apply$14.apply(Load.scala:311)
	at sbt.Load$$anonfun$25$$anonfun$apply$14.apply(Load.scala:310)
	at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:91)
	at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:90)
	at sbt.BuildLoader.apply(BuildLoader.scala:140)
	at sbt.Load$.loadAll(Load.scala:365)
	at sbt.Load$.loadURI(Load.scala:320)
	at sbt.Load$.load(Load.scala:316)
	at sbt.Load$.load(Load.scala:305)
	at sbt.Load$$anonfun$4.apply(Load.scala:146)
	at sbt.Load$$anonfun$4.apply(Load.scala:146)
	at sbt.Load$.timed(Load.scala:1025)
	at sbt.Load$.apply(Load.scala:146)
	at sbt.Load$.defaultLoad(Load.scala:39)
	at sbt.BuiltinCommands$.liftedTree1$1(Main.scala:496)
	at sbt.BuiltinCommands$.doLoadProject(Main.scala:496)
	at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:488)
	at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:488)
	at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
	at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
	at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
	at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
	at sbt.Command$.process(Command.scala:93)
	at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
	at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
	at sbt.State$$anon$1.process(State.scala:184)
	at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
	at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.MainLoop$.next(MainLoop.scala:96)
	at sbt.MainLoop$.run(MainLoop.scala:89)
	at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:68)
	at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:63)
	at sbt.Using.apply(Using.scala:24)
	at sbt.MainLoop$.runWithNewLog(MainLoop.scala:63)
	at sbt.MainLoop$.runAndClearLast(MainLoop.scala:46)
	at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:30)
	at sbt.MainLoop$.runLogged(MainLoop.scala:22)
	at sbt.StandardMain$.runManaged(Main.scala:57)
	at sbt.xMain.run(Main.scala:29)
	at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
	at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
	at xsbt.boot.Launch$.run(Launch.scala:109)
	at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
	at xsbt.boot.Launch$.launch(Launch.scala:117)
	at xsbt.boot.Launch$.apply(Launch.scala:18)
	at xsbt.boot.Boot$.runImpl(Boot.scala:41)
	at xsbt.boot.Boot$.main(Boot.scala:17)
	at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.AssertionError: assertion failed: not a type: symbol
[error]  loaded from class BuildSettings$ in package with name BuildSettings$ and classloader java.net.URLClassLoader@1148eca4

This might be a regression in SBT since 0.13.13, or some problem in my locally built version of SBT. /cc @dwijnand @eed3si9n

Once we solve this, I'll manually build with Java 9 by running the Jenkins job with a custom JDK selection parameter.

@retronym retronym added the WIP label Feb 16, 2017
I've run `sbt publishLocal` on the CI server to make SBT 0.13.4-b646662
available. This includes changes to be compatible with Java 9.

I've also installed JDK9-ea on the CI server, and made it selectable
with `jvmSelect oracle 9`:

  scala/scala-jenkins-infra#221

Finally, I've used:

  https://github.com/retronym/java9-rt-export

to export a Java 8-style rt.jar to make scalac work without
needing native support for reading the jrt:// virtual filesystem
containing the standard library classes. Scala 2.12.1 and higher
support this, but SBT itself still uses Scala 2.10.6, so the shim
JAR is required.

This commit uses 0.13.4-b646662 for this build. The following
commit will sets an system property to instruct scalac to add the
rt.jar shim to the compilation classpath. I've split these steps
to help diagnose a failure.

r
This reverts commit 1394ff019ec2337e99b007e338c87ecdbf266061.
@retronym
Copy link
Member Author

I've minimized the exception in runtime reflection and lodged it as scala/scala-dev#304. The workaround is to avoid the empty package in the build definition.

@SethTisue SethTisue removed this from the 2.12.2 milestone Feb 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants