summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Haoyi <haoyi.sg@gmail.com>2018-04-08 18:58:55 -0700
committerLi Haoyi <haoyi.sg@gmail.com>2018-04-08 20:36:54 -0700
commit44ed2e53f0d66f62988c532f5a8ceb056bb74d65 (patch)
tree7ea7518ce7211f2be5cbb1347f5c0567548368e1
parenteb04366771e23bc4a8f574ec7317f10e82fbdc6f (diff)
downloadmill-44ed2e53f0d66f62988c532f5a8ceb056bb74d65.tar.gz
mill-44ed2e53f0d66f62988c532f5a8ceb056bb74d65.tar.bz2
mill-44ed2e53f0d66f62988c532f5a8ceb056bb74d65.zip
First pass at a Caffeine integration build now works (only on Java 9 tho)
-rwxr-xr-xbuild.sc5
-rwxr-xr-xci/test-mill-2.sh2
-rw-r--r--integration/test/resources/caffeine/build.sc144
-rw-r--r--integration/test/resources/caffeine/deps.sc133
-rw-r--r--integration/test/src/mill/integration/CaffeineTests.scala20
-rw-r--r--integration/test/src/mill/integration/IntegrationTestSuite.scala4
-rw-r--r--integration/test/src/mill/integration/forked/Tests.scala1
-rw-r--r--integration/test/src/mill/integration/local/Tests.scala1
-rw-r--r--scalalib/src/mill/scalalib/MiscModule.scala23
9 files changed, 321 insertions, 12 deletions
diff --git a/build.sc b/build.sc
index 76fe8b9b..1376690b 100755
--- a/build.sc
+++ b/build.sc
@@ -177,6 +177,7 @@ object scalajslib extends MillModule {
}
}
}
+
def testRepos = T{
Seq(
"MILL_ACYCLIC_REPO" ->
@@ -190,7 +191,9 @@ def testRepos = T{
"MILL_UPICKLE_REPO" ->
shared.downloadTestRepo("lihaoyi/upickle", "7f33085c890db7550a226c349832eabc3cd18769", T.ctx().dest/"upickle"),
"MILL_PLAY_JSON_REPO" ->
- shared.downloadTestRepo("playframework/play-json", "0a5ba16a03f3b343ac335117eb314e7713366fd4", T.ctx().dest/"play-json")
+ shared.downloadTestRepo("playframework/play-json", "0a5ba16a03f3b343ac335117eb314e7713366fd4", T.ctx().dest/"play-json"),
+ "MILL_CAFFEINE_REPO" ->
+ shared.downloadTestRepo("ben-manes/caffeine", "c02c623aedded8174030596989769c2fecb82fe4", T.ctx().dest/"caffeine")
)
}
diff --git a/ci/test-mill-2.sh b/ci/test-mill-2.sh
index ce61bb7c..c61143e1 100755
--- a/ci/test-mill-2.sh
+++ b/ci/test-mill-2.sh
@@ -6,4 +6,4 @@ set -eux
git clean -xdf
# Run tests
-mill integration.test "mill.integration.local.{AcyclicTests,AmmoniteTests}"
+mill integration.test "mill.integration.local.{AcyclicTests,AmmoniteTests,CaffeineTests}"
diff --git a/integration/test/resources/caffeine/build.sc b/integration/test/resources/caffeine/build.sc
new file mode 100644
index 00000000..fccf2995
--- /dev/null
+++ b/integration/test/resources/caffeine/build.sc
@@ -0,0 +1,144 @@
+
+import mill._
+import mill.scalalib._
+import coursier.MavenRepository
+import mill.modules.Jvm
+import $file.deps
+import deps.{benchmarkLibraries, benchmarkVersions, libraries, testLibraries, testVersions, versions}
+
+trait CaffeineModule extends MavenModule{
+ def repositories = super.repositories ++ Seq(
+ coursier.ivy.IvyRepository(
+ "https://dl.bintray.com/sbt/sbt-plugin-releases/" +
+ coursier.ivy.Pattern.default.string,
+ dropInfoAttributes = true
+ ),
+ MavenRepository("https://jcenter.bintray.com/"),
+ MavenRepository("https://jitpack.io/"),
+ MavenRepository("http://repo.spring.io/plugins-release")
+ )
+ trait Tests extends super.Tests{
+ def testFrameworks = Seq("de.johoop.testnginterface.TestNGFramework")
+ def ivyDeps = Agg(
+ ivy"de.johoop:sbt-testng-interface_2.12:3.1.1",
+ libraries.guava,
+ testLibraries.mockito,
+ testLibraries.hamcrest,
+ ivy"org.hamcrest:hamcrest-library:1.3",
+ testLibraries.awaitility,
+ ) ++
+ testLibraries.testng ++
+ testLibraries.osgiRuntime ++
+ testLibraries.osgiCompile
+ }
+}
+object caffeine extends CaffeineModule {
+
+ def ivyDeps = Agg(
+ libraries.jsr305,
+ )
+
+ def generatedSources = T{
+ val out = T.ctx().dest
+ val mains = Seq(
+ "com.github.benmanes.caffeine.cache.NodeFactoryGenerator",
+ "com.github.benmanes.caffeine.cache.LocalCacheFactoryGenerator",
+ )
+ for(mainCls <- mains) Jvm.interactiveSubprocess(
+ mainCls,
+ javaPoet.runClasspath().map(_.path),
+ javaPoet.forkArgs(),
+ javaPoet.forkEnv(),
+ Seq(out.toString),
+ workingDir = ammonite.ops.pwd
+ )
+
+ Seq(PathRef(out))
+ }
+
+ object javaPoet extends MavenModule{
+ def millSourcePath = caffeine.millSourcePath
+ def sources = T.sources(
+ millSourcePath / 'src / 'javaPoet / 'java
+ )
+ def resources = T.sources(
+ millSourcePath / 'src / 'javaPoet / 'resources
+ )
+ def ivyDeps = Agg(
+ libraries.guava,
+ libraries.jsr305,
+ libraries.javapoet,
+ libraries.commonsLang3
+ )
+ }
+
+ object test extends Tests{
+ def ivyDeps = super.ivyDeps() ++ Agg(
+ libraries.ycsb,
+ libraries.fastutil,
+ libraries.guava,
+ libraries.commonsLang3,
+ testLibraries.junit,
+ testLibraries.jctools,
+ testLibraries.guavaTestLib,
+ ) ++
+ testLibraries.testng
+ }
+}
+
+object guava extends CaffeineModule {
+ def moduleDeps = Seq(caffeine)
+ def ivyDeps = Agg(libraries.guava)
+ object test extends Tests{
+ def ivyDeps = super.ivyDeps() ++ Agg(
+ testLibraries.junit,
+ testLibraries.truth,
+ testLibraries.jctools,
+ testLibraries.easymock,
+ testLibraries.guavaTestLib
+ )
+ }
+}
+
+object jcache extends CaffeineModule {
+ def moduleDeps = Seq(caffeine)
+ def ivyDeps = Agg(libraries.jcache, libraries.config, libraries.jsr330)
+ object test extends Tests{
+ def ivyDeps = super.ivyDeps() ++ Agg(
+ testLibraries.junit,
+ testLibraries.jcacheTck,
+ testLibraries.jcacheTckTests,
+ testLibraries.jcacheGuice,
+ testLibraries.guavaTestLib
+ ) ++
+ testLibraries.testng
+ }
+}
+
+object simulator extends CaffeineModule {
+ def moduleDeps = Seq(caffeine)
+ def ivyDeps = Agg(
+ libraries.xz,
+ libraries.akka,
+ libraries.ycsb,
+ libraries.guava,
+ libraries.fastutil,
+ libraries.flipTables,
+ benchmarkLibraries.ohc,
+ libraries.commonsLang3,
+ libraries.commonsCompress,
+ benchmarkLibraries.tcache,
+ libraries.univocityParsers,
+ benchmarkLibraries.cache2k,
+ benchmarkLibraries.ehcache3,
+ benchmarkLibraries.rapidoid,
+ benchmarkLibraries.collision,
+ benchmarkLibraries.slf4jNop,
+ benchmarkLibraries.expiringMap,
+ benchmarkLibraries.elasticSearch
+ )
+ object test extends Tests{
+
+ def ivyDeps = super.ivyDeps() ++ testLibraries.testng
+ }
+} \ No newline at end of file
diff --git a/integration/test/resources/caffeine/deps.sc b/integration/test/resources/caffeine/deps.sc
new file mode 100644
index 00000000..f7133040
--- /dev/null
+++ b/integration/test/resources/caffeine/deps.sc
@@ -0,0 +1,133 @@
+
+import mill._
+import mill.scalalib._
+
+object versions{
+ val akka = "2.5.11"
+ val commonsCompress = "1.16.1"
+ val commonsLang3 = "3.7"
+ val config = "1.3.3"
+ val errorProne = "2.2.0"
+ val fastutil = "8.1.1"
+ val flipTables = "1.0.2"
+ val guava = "24.1-jre"
+ val javapoet = "1.10.0"
+ val jcache = "1.1.0"
+ val jsr305 = "3.0.2"
+ val jsr330 = "1"
+ val univocityParsers = "2.6.2"
+ val ycsb = "0.13.0"
+ val xz = "1.8"
+}
+object testVersions{
+ val awaitility = "3.1.0"
+ val easymock = "3.5.1"
+ val hamcrest = "2.0.0.0"
+ val jcacheTck = "1.1.0"
+ val jctools = "2.1.2"
+ val junit = "4.12"
+ val mockito = "2.18.0"
+ val paxExam = "4.11.0"
+ val testng = "6.14.3"
+ val truth = "0.24"
+}
+object benchmarkVersions{
+ val cache2k = "1.0.2.Final"
+ val collision = "0.3.3"
+ val concurrentlinkedhashmap = "1.4.2"
+ val ehcache3 = "3.5.2"
+ val elasticSearch = "6.2.3"
+ val expiringMap = "0.5.8"
+ val jackrabbit = "1.8.2"
+ val jamm = "0.3.2"
+ val javaObjectLayout = "0.9"
+ val jmh = ".2"
+ val koloboke = "0.6.8"
+ val ohc = "0.6.1"
+ val rapidoid = "5.5.4"
+ val slf4j = "1.7.25"
+ val tcache = "1.0.5"
+}
+object libraries{
+ val akka = ivy"com.typesafe.akka:akka-actor_2.12:${versions.akka}"
+ val commonsCompress = ivy"org.apache.commons:commons-compress:${versions.commonsCompress}"
+ val commonsLang3 = ivy"org.apache.commons:commons-lang3:${versions.commonsLang3}"
+ val config = ivy"com.typesafe:config:${versions.config}"
+ val errorProneAnnotations = ivy"com.google.errorprone:error_prone_annotations:${versions.errorProne}"
+ val errorProneCore = ivy"com.google.errorprone:error_prone_core:${versions.errorProne}"
+ val fastutil = ivy"it.unimi.dsi:fastutil:${versions.fastutil}"
+ val flipTables = ivy"com.jakewharton.fliptables:fliptables:${versions.flipTables}"
+ val guava = ivy"com.google.guava:guava:${versions.guava}"
+ val javapoet = ivy"com.squareup:javapoet:${versions.javapoet}"
+ val jcache = ivy"javax.cache:cache-api:${versions.jcache}"
+ val jsr305 = ivy"com.google.code.findbugs:jsr305:${versions.jsr305}"
+ val jsr330 = ivy"javax.inject:javax.inject:${versions.jsr330}"
+ val univocityParsers = ivy"com.univocity:univocity-parsers:${versions.univocityParsers}"
+ val ycsb = ivy"com.github.brianfrankcooper.ycsb:core:${versions.ycsb}"
+ val xz = ivy"org.tukaani:xz:${versions.xz}"
+}
+object testLibraries{
+ val awaitility = ivy"org.awaitility:awaitility:${testVersions.awaitility}"
+ .excludeOrg("org.hamcrest")
+
+ val easymock = ivy"org.easymock:easymock:${testVersions.easymock}"
+
+ val guavaTestLib = ivy"com.google.guava:guava-testlib:${versions.guava}"
+ .excludeOrg("com.google.truth", "junit")
+
+ val hamcrest = ivy"org.hamcrest:java-hamcrest:${testVersions.hamcrest}"
+ val jcacheGuice = ivy"org.jsr107.ri:cache-annotations-ri-guice:${versions.jcache}"
+ val jcacheTck = ivy"javax.cache:cache-tests:${testVersions.jcacheTck}"
+ val jcacheTckTests = ivy"javax.cache:cache-tests:${testVersions.jcacheTck}"
+ val jctools = ivy"org.jctools:jctools-core:${testVersions.jctools}"
+ val junit = ivy"junit:junit:${testVersions.junit}"
+
+ val mockito = ivy"org.mockito:mockito-core:${testVersions.mockito}"
+ .excludeOrg("org.hamcrest")
+
+ val osgiCompile = Seq(
+ ivy"org.apache.felix:org.apache.felix.framework:5.6.10",
+ ivy"org.ops4j.pax.exam:pax-exam-junit4:${testVersions.paxExam}"
+ )
+
+ val osgiRuntime = Seq(
+ ivy"org.ops4j.pax.exam:pax-exam-container-native:${testVersions.paxExam}",
+ ivy"org.ops4j.pax.exam:pax-exam-link-mvn:${testVersions.paxExam}",
+ ivy"org.ops4j.pax.url:pax-url-aether:2.5.4"
+ )
+
+ val testng = Seq(
+ ivy"org.testng:testng:${testVersions.testng}"
+ .excludeOrg("junit", "guice"),
+ ivy"com.google.inject:guice:4.2.0"
+ )
+
+ val truth = ivy"com.google.truth:truth:${testVersions.truth}"
+}
+object benchmarkLibraries{
+ val cache2k = ivy"org.cache2k:cache2k-core:${benchmarkVersions.cache2k}"
+ val collision = ivy"systems.comodal:collision:${benchmarkVersions.collision}"
+ val concurrentlinkedhashmap = ivy"com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:${benchmarkVersions.concurrentlinkedhashmap}"
+ val ehcache3 = ivy"org.ehcache:ehcache:${benchmarkVersions.ehcache3}"
+
+ val elasticSearch = ivy"org.elasticsearch:elasticsearch:${benchmarkVersions.elasticSearch}"
+ .excludeOrg("org.apache.lucene")
+
+ val expiringMap = ivy"net.jodah:expiringmap:${benchmarkVersions.expiringMap}"
+
+ val jackrabbit = ivy"org.apache.jackrabbit:oak-core:${benchmarkVersions.jackrabbit}"
+ .excludeOrg("junit")
+
+ val jamm = ivy"com.github.jbellis:jamm:${benchmarkVersions.jamm}"
+ val javaObjectLayout = ivy"org.openjdk.jol:jol-cli:${benchmarkVersions.javaObjectLayout}"
+
+ val koloboke = Seq(
+ ivy"net.openhft:koloboke-api-jdk8:${benchmarkVersions.koloboke}",
+ ivy"net.openhft:koloboke-impl-jdk8:${benchmarkVersions.koloboke}",
+ )
+
+ val ohc = ivy"org.caffinitas.ohc:ohc-core-j8:${benchmarkVersions.ohc}"
+ val rapidoid = ivy"org.rapidoid:rapidoid-commons:${benchmarkVersions.rapidoid}"
+ val slf4jNop = ivy"org.slf4j:slf4j-nop:${benchmarkVersions.slf4j}"
+ val tcache = ivy"com.trivago:triava:${benchmarkVersions.tcache}"
+} \ No newline at end of file
diff --git a/integration/test/src/mill/integration/CaffeineTests.scala b/integration/test/src/mill/integration/CaffeineTests.scala
new file mode 100644
index 00000000..b206aa97
--- /dev/null
+++ b/integration/test/src/mill/integration/CaffeineTests.scala
@@ -0,0 +1,20 @@
+package mill.integration
+
+import utest._
+
+class CaffeineTests(fork: Boolean) extends IntegrationTestSuite("MILL_CAFFEINE_REPO", "caffeine", fork) {
+ val tests = Tests{
+ initWorkspace()
+ 'test - {
+ // Caffeine only can build using Java 9 or up. Java 8 results in weird
+ // type inference issues during the compile
+ if (mill.client.ClientServer.isJava9OrAbove){
+ assert(eval(s"caffeine.test.compile"))
+ assert(eval(s"guava.test.compile"))
+ assert(eval(s"jcache.test.compile"))
+ assert(eval(s"simulator.test.compile"))
+ }
+ }
+
+ }
+}
diff --git a/integration/test/src/mill/integration/IntegrationTestSuite.scala b/integration/test/src/mill/integration/IntegrationTestSuite.scala
index d24261f3..721557c0 100644
--- a/integration/test/src/mill/integration/IntegrationTestSuite.scala
+++ b/integration/test/src/mill/integration/IntegrationTestSuite.scala
@@ -17,9 +17,7 @@ abstract class IntegrationTestSuite(repoKey: String, val workspaceSlug: String,
wrapper
}
- def buildFiles: Seq[Path] = {
- Seq(buildFilePath / "build.sc")
- }
+ def buildFiles: Seq[Path] = ls.rec(buildFilePath)
override def initWorkspace() = {
super.initWorkspace()
diff --git a/integration/test/src/mill/integration/forked/Tests.scala b/integration/test/src/mill/integration/forked/Tests.scala
index 4a2e9f53..38c739ab 100644
--- a/integration/test/src/mill/integration/forked/Tests.scala
+++ b/integration/test/src/mill/integration/forked/Tests.scala
@@ -6,3 +6,4 @@ object BetterFilesTests extends mill.integration.BetterFilesTests(fork = true)
object JawnTests extends mill.integration.JawnTests(fork = true)
object UpickleTests extends mill.integration.UpickleTests(fork = true)
object PlayJsonTests extends mill.integration.PlayJsonTests(fork = true)
+object CaffeineTests extends mill.integration.CaffeineTests(fork = true)
diff --git a/integration/test/src/mill/integration/local/Tests.scala b/integration/test/src/mill/integration/local/Tests.scala
index b4f78ee4..c1eba757 100644
--- a/integration/test/src/mill/integration/local/Tests.scala
+++ b/integration/test/src/mill/integration/local/Tests.scala
@@ -6,3 +6,4 @@ object BetterFilesTests extends mill.integration.BetterFilesTests(fork = false)
object JawnTests extends mill.integration.JawnTests(fork = false)
object UpickleTests extends mill.integration.UpickleTests(fork = false)
object PlayJsonTests extends mill.integration.PlayJsonTests(fork = false)
+object CaffeineTests extends mill.integration.CaffeineTests(fork = false)
diff --git a/scalalib/src/mill/scalalib/MiscModule.scala b/scalalib/src/mill/scalalib/MiscModule.scala
index b355bb50..0e8bde3e 100644
--- a/scalalib/src/mill/scalalib/MiscModule.scala
+++ b/scalalib/src/mill/scalalib/MiscModule.scala
@@ -50,19 +50,28 @@ trait CrossScalaModule extends ScalaModule with CrossModuleBase{ outer =>
}
}
-trait SbtModule extends ScalaModule { outer =>
+trait MavenTests extends TestModule{
+ override def sources = T.sources(
+ millSourcePath / 'src / 'test / 'scala,
+ millSourcePath / 'src / 'test / 'java
+ )
+ override def resources = T.sources{ millSourcePath / 'src / 'test / 'resources }
+}
+trait MavenModule extends JavaModule{outer =>
+
override def sources = T.sources(
millSourcePath / 'src / 'main / 'scala,
millSourcePath / 'src / 'main / 'java
)
override def resources = T.sources{ millSourcePath / 'src / 'main / 'resources }
- trait Tests extends super.Tests {
+ trait Tests extends super.Tests with MavenTests {
+ override def millSourcePath = outer.millSourcePath
+ }
+}
+
+trait SbtModule extends MavenModule with ScalaModule{ outer =>
+ trait Tests extends super.Tests with MavenTests {
override def millSourcePath = outer.millSourcePath
- override def sources = T.sources(
- millSourcePath / 'src / 'test / 'scala,
- millSourcePath / 'src / 'test / 'java
- )
- override def resources = T.sources{ millSourcePath / 'src / 'test / 'resources }
}
}