From f50cd81ea4b7096c15dec72d378fb8497a796ccf Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Mon, 27 Sep 2021 10:49:13 +0200 Subject: [PATCH 1/6] Moved Caffeine-specific test files patching more local --- integration/test/src/CaffeineTests.scala | 51 +++++++++++++++++++ .../test/src/IntegrationTestSuite.scala | 43 +--------------- 2 files changed, 52 insertions(+), 42 deletions(-) diff --git a/integration/test/src/CaffeineTests.scala b/integration/test/src/CaffeineTests.scala index c6d976a019b..fd589b56f8b 100644 --- a/integration/test/src/CaffeineTests.scala +++ b/integration/test/src/CaffeineTests.scala @@ -4,6 +4,57 @@ import utest._ class CaffeineTests(fork: Boolean) extends IntegrationTestSuite("MILL_CAFFEINE_REPO", "caffeine", fork) { + + override def initWorkspace() = { + val path = super.initWorkspace() + // Fixes for caffeine test suite under Java11 + os.walk(workspacePath).foreach { p => + p.last match { + case "AsMapTest.java" => + println(s"Patching ${p} ...") + os.write.over( + p, + os.read.lines(p) + .map( + _.replace( + "map.keySet().toArray(null);", + "map.keySet().toArray((Integer[]) null);" + ) + .replace( + "map.values().toArray(null);", + "map.values().toArray((Integer[]) null);" + ) + .replace( + "map.entrySet().toArray(null);", + "map.entrySet().toArray((Integer[]) null);" + ) + ) + .mkString("\n") + ) + case "EmptyCachesTest.java" => + println(s"Patching ${p} ...") + os.write.over( + p, + os.read.lines(p) + .map( + _.replace("keys.toArray(null);", "keys.toArray((Object[]) null);") + .replace( + "values.toArray(null);", + "values.toArray((Object[]) null);" + ) + .replace( + "entries.toArray(null);", + "entries.toArray((Entry[]) null);" + ) + ) + .mkString("\n") + ) + case _ => // no patching needed + } + } + path + } + val tests = Tests { initWorkspace() 'test - { diff --git a/integration/test/src/IntegrationTestSuite.scala b/integration/test/src/IntegrationTestSuite.scala index 065ca049868..2d9148999aa 100644 --- a/integration/test/src/IntegrationTestSuite.scala +++ b/integration/test/src/IntegrationTestSuite.scala @@ -16,6 +16,7 @@ abstract class IntegrationTestSuite(repoKey: String, val workspaceSlug: String, wrapper } + /** Files to copy into the workspace */ def buildFiles: Seq[os.Path] = os.walk(buildFilePath) override def initWorkspace() = { @@ -23,48 +24,6 @@ abstract class IntegrationTestSuite(repoKey: String, val workspaceSlug: String, buildFiles.foreach { file => os.copy.over(file, workspacePath / file.last) } - os.walk(workspacePath).foreach { p => - if (p.last == "AsMapTest.java") { - os.write.over( - p, - os.read - .lines(p) - .map( - _.replace( - "map.keySet().toArray(null);", - "map.keySet().toArray((Integer[]) null);" - ) - .replace( - "map.values().toArray(null);", - "map.values().toArray((Integer[]) null);" - ) - .replace( - "map.entrySet().toArray(null);", - "map.entrySet().toArray((Integer[]) null);" - ) - ) - .mkString("\n") - ) - } else if (p.last == "EmptyCachesTest.java") { - os.write.over( - p, - os.read - .lines(p) - .map( - _.replace("keys.toArray(null);", "keys.toArray((Object[]) null);") - .replace( - "values.toArray(null);", - "values.toArray((Object[]) null);" - ) - .replace( - "entries.toArray(null);", - "entries.toArray((Entry[]) null);" - ) - ) - .mkString("\n") - ) - } - } assert(!os.walk(workspacePath).exists(_.ext == "class")) path } From e733de777f574c65e4fb9b2524ecb575e1746e5c Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Mon, 27 Sep 2021 15:57:32 +0200 Subject: [PATCH 2/6] Enabled caffeine test in CI --- .github/workflows/actions.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index ff3ad323bf1..0438a2894f4 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -25,6 +25,9 @@ jobs: - java-version: 8 # buildcmd: ./mill -i integration.test "mill.integration.local.{BetterFilesTests,UpickleTests}" buildcmd: ./mill -i integration.test "mill.integration.local.UpickleTests" + - java-version: 11 + # buildcmd: ./mill -i integration.test "mill.integration.local.{BetterFilesTests,UpickleTests}" + buildcmd: ./mill -i integration.test "mill.integration.local.CaffeineTests" runs-on: ubuntu-latest From c13539c2b5492f3f8a6def2d65d7da522e7544e4 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Mon, 27 Sep 2021 16:45:41 +0200 Subject: [PATCH 3/6] Added ivy repo to mill's used repos from caffeine tests --- integration/test/resources/play-json/build.sc | 54 ++++++++++--------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/integration/test/resources/play-json/build.sc b/integration/test/resources/play-json/build.sc index a59d604800d..573a382cc41 100644 --- a/integration/test/resources/play-json/build.sc +++ b/integration/test/resources/play-json/build.sc @@ -1,3 +1,6 @@ +// we need to load mill-contrib-testng installed into local ivy repo while CI is preparing this test +interp.repositories() ++= Seq(coursierapi.Repository.ivy2Local()) + import mill._, mill.scalalib._, mill.scalalib.publish._, mill.scalajslib._ import $file.playJsonVersion import $file.reformat @@ -44,35 +47,35 @@ trait PlayJsonModule extends BaseModule with PublishModule /*with MiMa */{ } } - def scalacOptions = Seq("-deprecation", "-feature", "-unchecked", "-encoding", "utf8") - def javacOptions = Seq("-encoding", "UTF-8", "-Xlint:-options") + override def scalacOptions = Seq("-deprecation", "-feature", "-unchecked", "-encoding", "utf8") + override def javacOptions = Seq("-encoding", "UTF-8", "-Xlint:-options") def publishVersion = playJsonVersion.current } abstract class PlayJson(val platformSegment: String) extends PlayJsonModule { def crossScalaVersion: String - def millSourcePath = os.pwd / "play-json" - def artifactName = "play-json" + override def millSourcePath = os.pwd / "play-json" + override def artifactName = "play-json" - def sources = T.sources( + override def sources = T.sources( millSourcePath / platformSegment / "src" / "main", millSourcePath / "shared" / "src" / "main" ) - def ivyDeps = Agg( + override def ivyDeps = Agg( ivy"${scalaOrganization()}:scala-reflect:${scalaVersion()}", ivy"org.typelevel::macro-compat::1.1.1" ) private val macroParadise = ivy"org.scalamacros:::paradise:2.1.0" - def compileIvyDeps = Agg( + override def compileIvyDeps = Agg( macroParadise, ivy"${scalaOrganization()}:scala-compiler:${scalaVersion()}" ) - def scalacPluginIvyDeps = Agg(macroParadise) + override def scalacPluginIvyDeps = Agg(macroParadise) // def mimaBinaryIssueFilters = Seq( // // AbstractFunction1 is in scala.runtime and isn't meant to be used by end users @@ -89,8 +92,7 @@ abstract class PlayJson(val platformSegment: String) extends PlayJsonModule { // ProblemFilters.exclude[ReversedMissingMethodProblem]("play.api.libs.json.JsonConfiguration.optionHandlers") // ) - def generatedSources = T { - + override def generatedSources = T { val dir = T.ctx.dest os.makeDir.all(dir / "play-json") @@ -144,11 +146,11 @@ abstract class PlayJson(val platformSegment: String) extends PlayJsonModule { object playJsonJvm extends Cross[PlayJsonJvm](ScalaVersions:_*) class PlayJsonJvm(val crossScalaVersion: String) extends PlayJson("jvm") { - def moduleDeps = Seq(playFunctionalJvm(crossScalaVersion)) + override def moduleDeps = Seq(playFunctionalJvm(crossScalaVersion)) val jacksonVersion = "2.9.3" - def ivyDeps = super.ivyDeps() ++ Agg( + override def ivyDeps = super.ivyDeps() ++ Agg( ivy"joda-time:joda-time:2.9.9", ivy"com.fasterxml.jackson.core:jackson-core:$jacksonVersion", ivy"com.fasterxml.jackson.core:jackson-annotations:$jacksonVersion", @@ -158,7 +160,7 @@ class PlayJsonJvm(val crossScalaVersion: String) extends PlayJson("jvm") { ) trait Tests extends super.Tests { - def ivyDeps = + override def ivyDeps = Agg( ivy"org.scalatest::scalatest:3.0.5-M1", ivy"org.scalacheck::scalacheck:1.13.5", @@ -167,7 +169,7 @@ class PlayJsonJvm(val crossScalaVersion: String) extends PlayJson("jvm") { specs2Core() ) - def sources = { + override def sources = { val docSpecs = os.walk(millSourcePath / os.up / "docs" / "manual" / "working" / "scalaGuide") .filter(os.isDir) .filter(_.last=="code") @@ -190,20 +192,20 @@ class PlayJsonJvm(val crossScalaVersion: String) extends PlayJson("jvm") { object playJsonJs extends Cross[PlayJsonJs](ScalaVersions:_*) class PlayJsonJs(val crossScalaVersion: String) extends PlayJson("js") with ScalaJSModule { - def moduleDeps = Seq(playFunctionalJs(crossScalaVersion)) + override def moduleDeps = Seq(playFunctionalJs(crossScalaVersion)) def scalaJSVersion = "0.6.32" // TODO: remove super[PlayJson].Tests with super[ScalaJSModule].Tests hack object test extends super[PlayJson].Tests with super[ScalaJSModule].Tests with Scalariform with TestModule.ScalaTest /* with Headers*/ { - def ivyDeps = + override def ivyDeps = Agg( ivy"org.scalatest::scalatest::3.0.5-M1", ivy"org.scalacheck::scalacheck::1.13.5", ivy"com.chuusai::shapeless::2.3.3" ) - def sources = T.sources( + override def sources = T.sources( millSourcePath / platformSegment / "src" / "test", millSourcePath / "shared" / "src" / "test" ) @@ -211,8 +213,8 @@ class PlayJsonJs(val crossScalaVersion: String) extends PlayJson("js") with Scal } trait PlayFunctional extends PlayJsonModule { - def millSourcePath = os.pwd / "play-functional" - def artifactName = "play-functional" + override def millSourcePath = os.pwd / "play-functional" + override def artifactName = "play-functional" } object playFunctionalJvm extends Cross[PlayFunctionalJvm](ScalaVersions:_*) @@ -225,26 +227,26 @@ class PlayFunctionalJs(val crossScalaVersion: String) extends PlayFunctional wit object playJoda extends Cross[PlayJoda](ScalaVersions:_*) class PlayJoda(val crossScalaVersion: String) extends PlayJsonModule { - def moduleDeps = Seq(playJsonJvm(crossScalaVersion)) + override def moduleDeps = Seq(playJsonJvm(crossScalaVersion)) - def millSourcePath = os.pwd / "play-json-joda" - def artifactName = "play-json-joda" + override def millSourcePath = os.pwd / "play-json-joda" + override def artifactName = "play-json-joda" - def ivyDeps = Agg( + override def ivyDeps = Agg( ivy"joda-time:joda-time:2.9.9" ) object test extends Tests with TestModule.Specs2 { - def ivyDeps = Agg(specs2Core()) + override def ivyDeps = Agg(specs2Core()) } } object benchmarks extends Cross[Benchmarks](ScalaVersions:_*) class Benchmarks(val crossScalaVersion: String) extends BaseModule with Jmh { - def moduleDeps = Seq(playJsonJvm(crossScalaVersion)) + override def moduleDeps = Seq(playJsonJvm(crossScalaVersion)) - def millSourcePath = os.pwd / "benchmarks" + override def millSourcePath = os.pwd / "benchmarks" } // TODO: we should have a way to "take all modules in this build" From da8dce9ae5bf54a212141311777e37a020f2c3ad Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Mon, 27 Sep 2021 16:59:58 +0200 Subject: [PATCH 4/6] Publish testng contrib module before running test --- .github/workflows/actions.yml | 12 ++++++++---- integration/test/resources/play-json/build.sc | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 0438a2894f4..2f7b7be8bf6 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -26,8 +26,10 @@ jobs: # buildcmd: ./mill -i integration.test "mill.integration.local.{BetterFilesTests,UpickleTests}" buildcmd: ./mill -i integration.test "mill.integration.local.UpickleTests" - java-version: 11 - # buildcmd: ./mill -i integration.test "mill.integration.local.{BetterFilesTests,UpickleTests}" - buildcmd: ./mill -i integration.test "mill.integration.local.CaffeineTests" + # Caffeine tests require a published testng contrib module + buildcmd: | + ./mill -i contrib.testng.publishLocal + ./mill -i integration.test "mill.integration.local.CaffeineTests" runs-on: ubuntu-latest @@ -40,11 +42,13 @@ jobs: with: java-version: ${{ matrix.java-version }} - - name: Run '${{ matrix.buildcmd }}' + - name: Prepare git config run: | git config --add user.name "Mill GithHub Actions" git config --add user.email "mill-ci@localhost" - ${{ matrix.buildcmd }} + + - name: Run '${{ matrix.buildcmd }}' + run: ${{ matrix.buildcmd }} test-windows: strategy: diff --git a/integration/test/resources/play-json/build.sc b/integration/test/resources/play-json/build.sc index 573a382cc41..dccec935c40 100644 --- a/integration/test/resources/play-json/build.sc +++ b/integration/test/resources/play-json/build.sc @@ -1,5 +1,5 @@ // we need to load mill-contrib-testng installed into local ivy repo while CI is preparing this test -interp.repositories() ++= Seq(coursierapi.Repository.ivy2Local()) +//interp.repositories() ++= Seq(coursierapi.Repository.ivy2Local()) import mill._, mill.scalalib._, mill.scalalib.publish._, mill.scalajslib._ import $file.playJsonVersion From 5d2a2ae040eebafd8422ed553b29139ea0dfea29 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Mon, 27 Sep 2021 17:10:46 +0200 Subject: [PATCH 5/6] cleanup --- integration/test/resources/play-json/build.sc | 3 --- 1 file changed, 3 deletions(-) diff --git a/integration/test/resources/play-json/build.sc b/integration/test/resources/play-json/build.sc index dccec935c40..3bdb3980cd1 100644 --- a/integration/test/resources/play-json/build.sc +++ b/integration/test/resources/play-json/build.sc @@ -1,6 +1,3 @@ -// we need to load mill-contrib-testng installed into local ivy repo while CI is preparing this test -//interp.repositories() ++= Seq(coursierapi.Repository.ivy2Local()) - import mill._, mill.scalalib._, mill.scalalib.publish._, mill.scalajslib._ import $file.playJsonVersion import $file.reformat From 49183686e97827fd9a64cf56132b2e39537ad438 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Mon, 27 Sep 2021 17:23:42 +0200 Subject: [PATCH 6/6] Moved test into matrix --- .github/workflows/actions.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 2f7b7be8bf6..69080be0c89 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -21,15 +21,15 @@ jobs: # - ./mill -i integration.test "mill.integration.local.JawnTests" - ./mill -i integration.test "mill.integration.local.{AcyclicTests,AmmoniteTests,DocAnnotationsTests}" - ./mill -i docs.antora.githubPages + # Caffeine tests require a published testng contrib module + - | + ./mill -i contrib.testng.publishLocal + ./mill -i integration.test "mill.integration.local.CaffeineTests" include: - java-version: 8 # buildcmd: ./mill -i integration.test "mill.integration.local.{BetterFilesTests,UpickleTests}" buildcmd: ./mill -i integration.test "mill.integration.local.UpickleTests" - - java-version: 11 - # Caffeine tests require a published testng contrib module - buildcmd: | - ./mill -i contrib.testng.publishLocal - ./mill -i integration.test "mill.integration.local.CaffeineTests" + runs-on: ubuntu-latest