Skip to content

Commit

Permalink
Merge pull request #248 from ohze/issue-247
Browse files Browse the repository at this point in the history
  • Loading branch information
SethTisue authored Oct 28, 2021
2 parents 84f679e + 29cb343 commit 96fa643
Show file tree
Hide file tree
Showing 5 changed files with 354 additions and 345 deletions.
39 changes: 8 additions & 31 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ lazy val commonSettings = Seq(
},
)

lazy val fnGen = (project in file("fnGen"))
.settings(commonSettings)
.settings(
crossScalaVersions := Seq("2.12.15"),
scalaVersion := crossScalaVersions.value.head,
run / fork := true, // Needed if you run this project directly
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value,
libraryDependencies += "org.scala-lang" % "scala-compiler" % scalaVersion.value
)

lazy val scalaJava8Compat = (project in file("."))
.settings(ScalaModulePlugin.scalaModuleSettings)
.settings(ScalaModulePlugin.scalaModuleOsgiSettings)
Expand All @@ -65,8 +55,6 @@ lazy val scalaJava8Compat = (project in file("."))
scalaModuleAutomaticModuleName := Some("scala.compat.java8"),
)
.settings(
fork := true, // This must be set so that runner task is forked when it runs fnGen and the compiler gets a proper classpath

OsgiKeys.exportPackage := osgiExport(scalaVersion.value, version.value),

OsgiKeys.privatePackage := List("scala.concurrent.java8.*"),
Expand All @@ -77,30 +65,19 @@ lazy val scalaJava8Compat = (project in file("."))

libraryDependencies += "com.github.sbt" % "junit-interface" % "0.13.2" % "test",

mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._, ProblemFilters._
Seq(
// bah
exclude[IncompatibleSignatureProblem]("*"),
// mysterious -- see scala/scala-java8-compat#211
exclude[DirectMissingMethodProblem ]("scala.compat.java8.Priority1FunctionConverters.enrichAsJavaIntFunction"),
exclude[ReversedMissingMethodProblem]("scala.compat.java8.Priority1FunctionConverters.enrichAsJavaIntFunction"),
exclude[DirectMissingMethodProblem ]("scala.compat.java8.FunctionConverters.package.enrichAsJavaIntFunction" ),
exclude[ReversedMissingMethodProblem]("scala.compat.java8.FunctionConverters.package.enrichAsJavaIntFunction" ),
)
// see https://github.com/scala/scala-java8-compat/issues/247
versionPolicyPreviousVersions := versionPolicyPreviousVersions.value.flatMap {
case VersionNumber(Seq(0, _*), _, _) => Nil
case VersionNumber(Seq(1, 0, n, _*), _, _) if n <= 1 => Nil
case v => Seq(v)
},

testOptions += Tests.Argument(TestFrameworks.JUnit, "-v", "-a"),

(Compile / sourceGenerators) += Def.task {
val out = (Compile / sourceManaged).value
if (!out.exists) IO.createDirectory(out)
val canon = out.getCanonicalPath
val args = (new File(canon, "FunctionConverters.scala")).toString :: Nil
val runTarget = (fnGen / Compile / mainClass).value getOrElse "No main class defined for function conversion generator"
val classPath = (fnGen / Compile / fullClasspath).value
runner.value.run(runTarget, classPath.files, args, streams.value.log)
(out ** "*.scala").get
val f = (Compile / sourceManaged).value / "FunctionConverters.scala"
IO.write(f, WrapFnGen.code)
Seq(f)
}.taskValue,

Compile / sourceGenerators += Def.task {
Expand Down
314 changes: 0 additions & 314 deletions fnGen/WrapFnGen.scala

This file was deleted.

Loading

0 comments on commit 96fa643

Please sign in to comment.