Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 44ed2e5

Browse files
committedApr 9, 2018
First pass at a Caffeine integration build now works (only on Java 9 tho)
1 parent eb04366 commit 44ed2e5

File tree

9 files changed

+321
-12
lines changed

9 files changed

+321
-12
lines changed
 

‎build.sc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ object scalajslib extends MillModule {
177177
}
178178
}
179179
}
180+
180181
def testRepos = T{
181182
Seq(
182183
"MILL_ACYCLIC_REPO" ->
@@ -190,7 +191,9 @@ def testRepos = T{
190191
"MILL_UPICKLE_REPO" ->
191192
shared.downloadTestRepo("lihaoyi/upickle", "7f33085c890db7550a226c349832eabc3cd18769", T.ctx().dest/"upickle"),
192193
"MILL_PLAY_JSON_REPO" ->
193-
shared.downloadTestRepo("playframework/play-json", "0a5ba16a03f3b343ac335117eb314e7713366fd4", T.ctx().dest/"play-json")
194+
shared.downloadTestRepo("playframework/play-json", "0a5ba16a03f3b343ac335117eb314e7713366fd4", T.ctx().dest/"play-json"),
195+
"MILL_CAFFEINE_REPO" ->
196+
shared.downloadTestRepo("ben-manes/caffeine", "c02c623aedded8174030596989769c2fecb82fe4", T.ctx().dest/"caffeine")
194197
)
195198
}
196199

‎ci/test-mill-2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ set -eux
66
git clean -xdf
77

88
# Run tests
9-
mill integration.test "mill.integration.local.{AcyclicTests,AmmoniteTests}"
9+
mill integration.test "mill.integration.local.{AcyclicTests,AmmoniteTests,CaffeineTests}"
Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
2+
import mill._
3+
import mill.scalalib._
4+
import coursier.MavenRepository
5+
import mill.modules.Jvm
6+
import $file.deps
7+
import deps.{benchmarkLibraries, benchmarkVersions, libraries, testLibraries, testVersions, versions}
8+
9+
trait CaffeineModule extends MavenModule{
10+
def repositories = super.repositories ++ Seq(
11+
coursier.ivy.IvyRepository(
12+
"https://dl.bintray.com/sbt/sbt-plugin-releases/" +
13+
coursier.ivy.Pattern.default.string,
14+
dropInfoAttributes = true
15+
),
16+
MavenRepository("https://jcenter.bintray.com/"),
17+
MavenRepository("https://jitpack.io/"),
18+
MavenRepository("http://repo.spring.io/plugins-release")
19+
)
20+
trait Tests extends super.Tests{
21+
def testFrameworks = Seq("de.johoop.testnginterface.TestNGFramework")
22+
def ivyDeps = Agg(
23+
ivy"de.johoop:sbt-testng-interface_2.12:3.1.1",
24+
libraries.guava,
25+
testLibraries.mockito,
26+
testLibraries.hamcrest,
27+
ivy"org.hamcrest:hamcrest-library:1.3",
28+
testLibraries.awaitility,
29+
) ++
30+
testLibraries.testng ++
31+
testLibraries.osgiRuntime ++
32+
testLibraries.osgiCompile
33+
}
34+
}
35+
object caffeine extends CaffeineModule {
36+
37+
def ivyDeps = Agg(
38+
libraries.jsr305,
39+
)
40+
41+
def generatedSources = T{
42+
val out = T.ctx().dest
43+
val mains = Seq(
44+
"com.github.benmanes.caffeine.cache.NodeFactoryGenerator",
45+
"com.github.benmanes.caffeine.cache.LocalCacheFactoryGenerator",
46+
)
47+
for(mainCls <- mains) Jvm.interactiveSubprocess(
48+
mainCls,
49+
javaPoet.runClasspath().map(_.path),
50+
javaPoet.forkArgs(),
51+
javaPoet.forkEnv(),
52+
Seq(out.toString),
53+
workingDir = ammonite.ops.pwd
54+
)
55+
56+
Seq(PathRef(out))
57+
}
58+
59+
object javaPoet extends MavenModule{
60+
def millSourcePath = caffeine.millSourcePath
61+
def sources = T.sources(
62+
millSourcePath / 'src / 'javaPoet / 'java
63+
)
64+
def resources = T.sources(
65+
millSourcePath / 'src / 'javaPoet / 'resources
66+
)
67+
def ivyDeps = Agg(
68+
libraries.guava,
69+
libraries.jsr305,
70+
libraries.javapoet,
71+
libraries.commonsLang3
72+
)
73+
}
74+
75+
object test extends Tests{
76+
def ivyDeps = super.ivyDeps() ++ Agg(
77+
libraries.ycsb,
78+
libraries.fastutil,
79+
libraries.guava,
80+
libraries.commonsLang3,
81+
testLibraries.junit,
82+
testLibraries.jctools,
83+
testLibraries.guavaTestLib,
84+
) ++
85+
testLibraries.testng
86+
}
87+
}
88+
89+
object guava extends CaffeineModule {
90+
def moduleDeps = Seq(caffeine)
91+
def ivyDeps = Agg(libraries.guava)
92+
object test extends Tests{
93+
def ivyDeps = super.ivyDeps() ++ Agg(
94+
testLibraries.junit,
95+
testLibraries.truth,
96+
testLibraries.jctools,
97+
testLibraries.easymock,
98+
testLibraries.guavaTestLib
99+
)
100+
}
101+
}
102+
103+
object jcache extends CaffeineModule {
104+
def moduleDeps = Seq(caffeine)
105+
def ivyDeps = Agg(libraries.jcache, libraries.config, libraries.jsr330)
106+
object test extends Tests{
107+
def ivyDeps = super.ivyDeps() ++ Agg(
108+
testLibraries.junit,
109+
testLibraries.jcacheTck,
110+
testLibraries.jcacheTckTests,
111+
testLibraries.jcacheGuice,
112+
testLibraries.guavaTestLib
113+
) ++
114+
testLibraries.testng
115+
}
116+
}
117+
118+
object simulator extends CaffeineModule {
119+
def moduleDeps = Seq(caffeine)
120+
def ivyDeps = Agg(
121+
libraries.xz,
122+
libraries.akka,
123+
libraries.ycsb,
124+
libraries.guava,
125+
libraries.fastutil,
126+
libraries.flipTables,
127+
benchmarkLibraries.ohc,
128+
libraries.commonsLang3,
129+
libraries.commonsCompress,
130+
benchmarkLibraries.tcache,
131+
libraries.univocityParsers,
132+
benchmarkLibraries.cache2k,
133+
benchmarkLibraries.ehcache3,
134+
benchmarkLibraries.rapidoid,
135+
benchmarkLibraries.collision,
136+
benchmarkLibraries.slf4jNop,
137+
benchmarkLibraries.expiringMap,
138+
benchmarkLibraries.elasticSearch
139+
)
140+
object test extends Tests{
141+
142+
def ivyDeps = super.ivyDeps() ++ testLibraries.testng
143+
}
144+
}
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
2+
import mill._
3+
import mill.scalalib._
4+
5+
object versions{
6+
val akka = "2.5.11"
7+
val commonsCompress = "1.16.1"
8+
val commonsLang3 = "3.7"
9+
val config = "1.3.3"
10+
val errorProne = "2.2.0"
11+
val fastutil = "8.1.1"
12+
val flipTables = "1.0.2"
13+
val guava = "24.1-jre"
14+
val javapoet = "1.10.0"
15+
val jcache = "1.1.0"
16+
val jsr305 = "3.0.2"
17+
val jsr330 = "1"
18+
val univocityParsers = "2.6.2"
19+
val ycsb = "0.13.0"
20+
val xz = "1.8"
21+
}
22+
object testVersions{
23+
val awaitility = "3.1.0"
24+
val easymock = "3.5.1"
25+
val hamcrest = "2.0.0.0"
26+
val jcacheTck = "1.1.0"
27+
val jctools = "2.1.2"
28+
val junit = "4.12"
29+
val mockito = "2.18.0"
30+
val paxExam = "4.11.0"
31+
val testng = "6.14.3"
32+
val truth = "0.24"
33+
}
34+
object benchmarkVersions{
35+
val cache2k = "1.0.2.Final"
36+
val collision = "0.3.3"
37+
val concurrentlinkedhashmap = "1.4.2"
38+
val ehcache3 = "3.5.2"
39+
val elasticSearch = "6.2.3"
40+
val expiringMap = "0.5.8"
41+
val jackrabbit = "1.8.2"
42+
val jamm = "0.3.2"
43+
val javaObjectLayout = "0.9"
44+
val jmh = ".2"
45+
val koloboke = "0.6.8"
46+
val ohc = "0.6.1"
47+
val rapidoid = "5.5.4"
48+
val slf4j = "1.7.25"
49+
val tcache = "1.0.5"
50+
}
51+
object libraries{
52+
val akka = ivy"com.typesafe.akka:akka-actor_2.12:${versions.akka}"
53+
val commonsCompress = ivy"org.apache.commons:commons-compress:${versions.commonsCompress}"
54+
val commonsLang3 = ivy"org.apache.commons:commons-lang3:${versions.commonsLang3}"
55+
val config = ivy"com.typesafe:config:${versions.config}"
56+
val errorProneAnnotations = ivy"com.google.errorprone:error_prone_annotations:${versions.errorProne}"
57+
val errorProneCore = ivy"com.google.errorprone:error_prone_core:${versions.errorProne}"
58+
val fastutil = ivy"it.unimi.dsi:fastutil:${versions.fastutil}"
59+
val flipTables = ivy"com.jakewharton.fliptables:fliptables:${versions.flipTables}"
60+
val guava = ivy"com.google.guava:guava:${versions.guava}"
61+
val javapoet = ivy"com.squareup:javapoet:${versions.javapoet}"
62+
val jcache = ivy"javax.cache:cache-api:${versions.jcache}"
63+
val jsr305 = ivy"com.google.code.findbugs:jsr305:${versions.jsr305}"
64+
val jsr330 = ivy"javax.inject:javax.inject:${versions.jsr330}"
65+
val univocityParsers = ivy"com.univocity:univocity-parsers:${versions.univocityParsers}"
66+
val ycsb = ivy"com.github.brianfrankcooper.ycsb:core:${versions.ycsb}"
67+
val xz = ivy"org.tukaani:xz:${versions.xz}"
68+
}
69+
object testLibraries{
70+
val awaitility = ivy"org.awaitility:awaitility:${testVersions.awaitility}"
71+
.excludeOrg("org.hamcrest")
72+
73+
val easymock = ivy"org.easymock:easymock:${testVersions.easymock}"
74+
75+
val guavaTestLib = ivy"com.google.guava:guava-testlib:${versions.guava}"
76+
.excludeOrg("com.google.truth", "junit")
77+
78+
val hamcrest = ivy"org.hamcrest:java-hamcrest:${testVersions.hamcrest}"
79+
val jcacheGuice = ivy"org.jsr107.ri:cache-annotations-ri-guice:${versions.jcache}"
80+
val jcacheTck = ivy"javax.cache:cache-tests:${testVersions.jcacheTck}"
81+
val jcacheTckTests = ivy"javax.cache:cache-tests:${testVersions.jcacheTck}"
82+
val jctools = ivy"org.jctools:jctools-core:${testVersions.jctools}"
83+
val junit = ivy"junit:junit:${testVersions.junit}"
84+
85+
val mockito = ivy"org.mockito:mockito-core:${testVersions.mockito}"
86+
.excludeOrg("org.hamcrest")
87+
88+
val osgiCompile = Seq(
89+
ivy"org.apache.felix:org.apache.felix.framework:5.6.10",
90+
ivy"org.ops4j.pax.exam:pax-exam-junit4:${testVersions.paxExam}"
91+
)
92+
93+
val osgiRuntime = Seq(
94+
ivy"org.ops4j.pax.exam:pax-exam-container-native:${testVersions.paxExam}",
95+
ivy"org.ops4j.pax.exam:pax-exam-link-mvn:${testVersions.paxExam}",
96+
ivy"org.ops4j.pax.url:pax-url-aether:2.5.4"
97+
)
98+
99+
val testng = Seq(
100+
ivy"org.testng:testng:${testVersions.testng}"
101+
.excludeOrg("junit", "guice"),
102+
ivy"com.google.inject:guice:4.2.0"
103+
)
104+
105+
val truth = ivy"com.google.truth:truth:${testVersions.truth}"
106+
}
107+
object benchmarkLibraries{
108+
val cache2k = ivy"org.cache2k:cache2k-core:${benchmarkVersions.cache2k}"
109+
val collision = ivy"systems.comodal:collision:${benchmarkVersions.collision}"
110+
val concurrentlinkedhashmap = ivy"com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:${benchmarkVersions.concurrentlinkedhashmap}"
111+
val ehcache3 = ivy"org.ehcache:ehcache:${benchmarkVersions.ehcache3}"
112+
113+
val elasticSearch = ivy"org.elasticsearch:elasticsearch:${benchmarkVersions.elasticSearch}"
114+
.excludeOrg("org.apache.lucene")
115+
116+
val expiringMap = ivy"net.jodah:expiringmap:${benchmarkVersions.expiringMap}"
117+
118+
val jackrabbit = ivy"org.apache.jackrabbit:oak-core:${benchmarkVersions.jackrabbit}"
119+
.excludeOrg("junit")
120+
121+
val jamm = ivy"com.github.jbellis:jamm:${benchmarkVersions.jamm}"
122+
val javaObjectLayout = ivy"org.openjdk.jol:jol-cli:${benchmarkVersions.javaObjectLayout}"
123+
124+
val koloboke = Seq(
125+
ivy"net.openhft:koloboke-api-jdk8:${benchmarkVersions.koloboke}",
126+
ivy"net.openhft:koloboke-impl-jdk8:${benchmarkVersions.koloboke}",
127+
)
128+
129+
val ohc = ivy"org.caffinitas.ohc:ohc-core-j8:${benchmarkVersions.ohc}"
130+
val rapidoid = ivy"org.rapidoid:rapidoid-commons:${benchmarkVersions.rapidoid}"
131+
val slf4jNop = ivy"org.slf4j:slf4j-nop:${benchmarkVersions.slf4j}"
132+
val tcache = ivy"com.trivago:triava:${benchmarkVersions.tcache}"
133+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package mill.integration
2+
3+
import utest._
4+
5+
class CaffeineTests(fork: Boolean) extends IntegrationTestSuite("MILL_CAFFEINE_REPO", "caffeine", fork) {
6+
val tests = Tests{
7+
initWorkspace()
8+
'test - {
9+
// Caffeine only can build using Java 9 or up. Java 8 results in weird
10+
// type inference issues during the compile
11+
if (mill.client.ClientServer.isJava9OrAbove){
12+
assert(eval(s"caffeine.test.compile"))
13+
assert(eval(s"guava.test.compile"))
14+
assert(eval(s"jcache.test.compile"))
15+
assert(eval(s"simulator.test.compile"))
16+
}
17+
}
18+
19+
}
20+
}

‎integration/test/src/mill/integration/IntegrationTestSuite.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ abstract class IntegrationTestSuite(repoKey: String, val workspaceSlug: String,
1717
wrapper
1818
}
1919

20-
def buildFiles: Seq[Path] = {
21-
Seq(buildFilePath / "build.sc")
22-
}
20+
def buildFiles: Seq[Path] = ls.rec(buildFilePath)
2321

2422
override def initWorkspace() = {
2523
super.initWorkspace()

‎integration/test/src/mill/integration/forked/Tests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ object BetterFilesTests extends mill.integration.BetterFilesTests(fork = true)
66
object JawnTests extends mill.integration.JawnTests(fork = true)
77
object UpickleTests extends mill.integration.UpickleTests(fork = true)
88
object PlayJsonTests extends mill.integration.PlayJsonTests(fork = true)
9+
object CaffeineTests extends mill.integration.CaffeineTests(fork = true)

‎integration/test/src/mill/integration/local/Tests.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ object BetterFilesTests extends mill.integration.BetterFilesTests(fork = false)
66
object JawnTests extends mill.integration.JawnTests(fork = false)
77
object UpickleTests extends mill.integration.UpickleTests(fork = false)
88
object PlayJsonTests extends mill.integration.PlayJsonTests(fork = false)
9+
object CaffeineTests extends mill.integration.CaffeineTests(fork = false)

‎scalalib/src/mill/scalalib/MiscModule.scala

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,28 @@ trait CrossScalaModule extends ScalaModule with CrossModuleBase{ outer =>
5050
}
5151
}
5252

53-
trait SbtModule extends ScalaModule { outer =>
53+
trait MavenTests extends TestModule{
54+
override def sources = T.sources(
55+
millSourcePath / 'src / 'test / 'scala,
56+
millSourcePath / 'src / 'test / 'java
57+
)
58+
override def resources = T.sources{ millSourcePath / 'src / 'test / 'resources }
59+
}
60+
trait MavenModule extends JavaModule{outer =>
61+
5462
override def sources = T.sources(
5563
millSourcePath / 'src / 'main / 'scala,
5664
millSourcePath / 'src / 'main / 'java
5765
)
5866
override def resources = T.sources{ millSourcePath / 'src / 'main / 'resources }
59-
trait Tests extends super.Tests {
67+
trait Tests extends super.Tests with MavenTests {
68+
override def millSourcePath = outer.millSourcePath
69+
}
70+
}
71+
72+
trait SbtModule extends MavenModule with ScalaModule{ outer =>
73+
trait Tests extends super.Tests with MavenTests {
6074
override def millSourcePath = outer.millSourcePath
61-
override def sources = T.sources(
62-
millSourcePath / 'src / 'test / 'scala,
63-
millSourcePath / 'src / 'test / 'java
64-
)
65-
override def resources = T.sources{ millSourcePath / 'src / 'test / 'resources }
6675
}
6776
}
6877

0 commit comments

Comments
 (0)
Please sign in to comment.