Skip to content
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

Cross-compile the plugin against 0.13.15 and 1.0.0-M6 #117

Merged
merged 5 commits into from
Jun 15, 2017

Conversation

lomigmegard
Copy link
Contributor

@lomigmegard lomigmegard commented May 26, 2017

This PR fixes #115.

I had to update the two CustomRunnerApp in the scripted tests two use the main() method. I ran into the IncompatibleClassChangeError issue, changes fix #66.

Now you have to use ^ scripted and ^ publishSigned to cross-compile with the correct sbt version (see the 0.13.16-M1 release notes).

@lomigmegard
Copy link
Contributor Author

lomigmegard commented May 26, 2017

Note that there are still one or two deprecation warnings that can be addressed in a subsequent PR.

Copy link
Member

@ktoso ktoso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks a ton :)

compile in Jmh <<= (compile in Jmh) dependsOn (compile in Test)
run in Jmh <<= (run in Jmh) dependsOn (Keys.compile in Jmh)
compile in Jmh := (compile in Jmh).dependsOn(compile in Test).value
run in Jmh := (run in Jmh).dependsOn(Keys.compile in Jmh).value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool thanks

version.sbt Outdated
@@ -1 +1 @@
version in ThisBuild := "0.2.25"
version in ThisBuild := "0.3.0-SNAPSHOT"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I guess hm... timing should work out fine I hope

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you prefer 0.2.26-SNAPSHOT that's fine too. No real reason to bump to 0.3 tbh.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's not bump the minor for now.
It likely deserves a 1.0 soon anyway.

build.sbt Outdated
@@ -13,12 +13,12 @@ val jmhVersion = {
val commonSettings = Seq(
organization := "pl.project13.scala",

scalaVersion := "2.10.6",
crossSbtVersions := Vector("0.13.15", "1.0.0-M5"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -113,7 +108,7 @@ lazy val extras = project
.settings(sonatypeSettings: _*)
.settings(
name := "sbt-jmh-extras",
scalaVersion := "2.12.2",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the only thing I am not sure about, since it's pure Java we may want to force it to target 1.6 to be able to use the plugin with a 1.6 JVM (using sbt 0.13.15)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@retronym do you guys still care about benchmarking against JDK6 with JMH?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're only benchmarking on JDK8+ now. But sbt-jmh-extras doesn't actually depend on Scala (see setting below this line), so I'm not sure if this is needed at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do benchmark on Scala 2.13.x, which is a reason to avoid a Scala dependency for this module.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, extras is java only so the question is more about what jdk target should be set here.
We're also fine in akka with 8+ nowadays I think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should still be possible to use a custom JDK for the forks with jmh:run -jvm /jdk/1.6, right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, should work but perhaps best to sanity check - I can look at it tomorrow :)

@ktoso
Copy link
Member

ktoso commented Jun 12, 2017

Bumped to M6 to see if it builds

@ktoso
Copy link
Member

ktoso commented Jun 12, 2017

scipted breaks:


java.lang.NoSuchMethodException: sbt.test.ScriptedTests$.run(java.io.File, boolean, [Ljava.lang.String;, java.io.File, [Ljava.lang.String;)
	at java.lang.Class.getMethod(Class.java:1778)
	at sbt.ScriptedPlugin$$anonfun$scriptedRunTask0.89€.apply(ScriptedPlugin.scala:39)
	at sbt.ScriptedPlugin$$anonfun$scriptedRunTask0.89€.apply(ScriptedPlugin.scala:38)
	at scala.Function1$$anonfun$compose0.89€.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u22190.89€.apply(TypeFunctions.scala:40)
	at sbt.std.Transform$$anon3.56€.work(System.scala:63)
	at sbt.Execute$$anonfun$submit0.89€$$anonfun$apply0.89€.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit0.89€$$anonfun$apply0.89€.apply(Execute.scala:228)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
	at sbt.Execute.work(Execute.scala:237)
	at sbt.Execute$$anonfun$submit0.89€.apply(Execute.scala:228)
	at sbt.Execute$$anonfun$submit0.89€.apply(Execute.scala:228)
	at sbt.ConcurrentRestrictions$$anon3.56€$$anonfun0.89€.apply(ConcurrentRestrictions.scala:159)
	at sbt.CompletionService$$anon1.78€.call(CompletionService.scala:28)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
[error] (plugin/*:scriptedRun) java.lang.NoSuchMethodException: sbt.test.ScriptedTests$.run(java.io.File, boolean, [Ljava.lang.String;, java.io.File, [Ljava.lang.String;)
[error] Total time: 108 s, completed Jun 12, 2017 9:33:45 AM

is this expected @eed3si9n plugin upgrade or sth else?

@jvican
Copy link
Member

jvican commented Jun 13, 2017

That's sbt/sbt#3245.

Can you update with the following snippet and try again? It should work:

ScriptedPlugin.scripted := {
  val args = ScriptedPlugin.asInstanceOf[{
    def scriptedParser(f: File): complete.Parser[Seq[String]]
  }].scriptedParser(sbtTestDirectory.value).parsed
  val prereq: Unit = scriptedDependencies.value
  try {
    if((sbtVersion in pluginCrossBuild).value == "1.0.0-M6") {
      ScriptedPlugin.scriptedTests.value.asInstanceOf[{
        def run(
          x1: File,
          x2: Boolean,
          x3: Array[String],
          x4: File,
          x5: Array[String],
          x6: java.util.List[File]
        ): Unit
      }].run(
        sbtTestDirectory.value,
        scriptedBufferLog.value,
        args.toArray,
        sbtLauncher.value,
        scriptedLaunchOpts.value.toArray,
        new java.util.ArrayList()
      )
    } else {
      ScriptedPlugin.scriptedTests.value.asInstanceOf[{
        def run(
          x1: File,
          x2: Boolean,
          x3: Array[String],
          x4: File,
          x5: Array[String]
        ): Unit
      }].run(
        sbtTestDirectory.value,
        scriptedBufferLog.value,
        args.toArray,
        sbtLauncher.value,
        scriptedLaunchOpts.value.toArray
      )
    }
  } catch { case e: java.lang.reflect.InvocationTargetException => throw e.getCause }
}

I'll try to fix this at the core and you can ditch that code in the next RC.

@lomigmegard
Copy link
Contributor Author

@ktoso I will try to add this fix tonight, or you prefer to wait for a proper fix in the upstream project?

@jvican
Copy link
Member

jvican commented Jun 14, 2017

I would appreciate if you use that fix. We don't know if this is going to be released before the release candidate yet, and this is blocking my migration to 1.0 in Zinc: sbt/zinc#316.

@lomigmegard lomigmegard changed the title Cross-compile the plugin against 0.13.15 and 1.0.0-M5 Cross-compile the plugin against 0.13.15 and 1.0.0-M6 Jun 14, 2017
@jvican
Copy link
Member

jvican commented Jun 14, 2017

@lomigmegard Thanks. Tests are passing @ktoso.

@ktoso
Copy link
Member

ktoso commented Jun 15, 2017

Thanks a ton @lomigmegard @jvican
Shall I release a version then?

@ktoso ktoso merged commit db26a9c into sbt:master Jun 15, 2017
@jvican
Copy link
Member

jvican commented Jun 15, 2017

Yes please :)

@ktoso
Copy link
Member

ktoso commented Jun 27, 2017

So... I'm unable to publish correctly for 0.13.16-M1 (so that it lands as 2.12). I don't see how to solve it, requesting help @eed3si9n @jvican

^publish ing also does not work correctly, it releases under 2.10

@ktoso
Copy link
Member

ktoso commented Jun 27, 2017

Ok, managed to get it working. ^ was failing before it got to the right version.

@lomigmegard
Copy link
Contributor Author

Yay!!

@lomigmegard lomigmegard deleted the sbt_1.0 branch June 27, 2017 09:15
@holgerbrandl
Copy link

I'm still seeing the IncompatibleClassChangeError error when having an object Foo extends App in the sources. I'm using sbt-jmh v0.2.24 along with sbt.version v0.13.16 and scalaVersion=2.11.11. Is there a newer plugin version available which I could use?
Or should sumbit it as another ticket?

@retronym
Copy link
Member

retronym commented Sep 21, 2017 via email

@holgerbrandl
Copy link

Thanks for pointing that out.

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.

Cross compile with sbt 1.0.0-M5 IncompatibleClassChangeError with custom runner
5 participants