summaryrefslogtreecommitdiff
path: root/integration/test/resources/caffeine/build.sc
blob: aaa6662642426106653c750a73f5803aa8fb6829 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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("com.novocode.junit.JUnitFramework")
    def ivyDeps = Agg(
      ivy"com.novocode:junit-interface:0.11",
      ivy"com.lihaoyi:mill-contrib-testng:${sys.props("MILL_VERSION")}",
      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 testFrameworks = Seq("mill.testng.TestNGFramework")
    def ivyDeps = super.ivyDeps() ++ Agg(
      libraries.ycsb,
      libraries.fastutil,
      libraries.guava,
      libraries.commonsLang3,
      testLibraries.junit,
      testLibraries.jctools,
      testLibraries.guavaTestLib,
    ) ++
      testLibraries.testng

    def allSourceFiles = super.allSourceFiles().filter(_.path.last != "OSGiTest.java")
  }
}

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
    )
    def allSourceFiles = super.allSourceFiles().filter(_.path.last != "OSGiTest.java")
    def forkArgs = Seq(
      "-Dguava.osgi.version=" + versions.guava,
      "-Dcaffeine.osgi.jar=" + caffeine.jar().path,
      "-Dcaffeine-guava.osgi.jar=" + guava.jar().path
    )
  }
}

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
  }
}