@@ -4,15 +4,12 @@ import $ivy.`com.github.lolgab::mill-mima::0.1.0`
44import mill ._ , scalalib ._ , scalajslib ._ , scalanativelib ._ , publish ._
55import de .tobiasroeser .mill .vcs .version .VcsVersion
66import com .github .lolgab .mill .mima ._
7- import mill .scalalib .api .Util .isScala3
7+ import mill .scalalib .api .ZincWorkerUtil .isScala3
88
99val dottyCommunityBuildVersion = sys.props.get(" dottyVersion" ).toList
1010
1111val scalaVersions =
12- " 2.11.12" :: " 2.12.16" :: " 2.13.8" :: " 3.1.3" :: dottyCommunityBuildVersion
13-
14- val scalaJSVersions = scalaVersions.map((_, " 1.10.1" ))
15- val scalaNativeVersions = scalaVersions.map((_, " 0.4.5" ))
12+ " 2.12.16" :: " 2.13.8" :: " 3.3.1" :: dottyCommunityBuildVersion
1613
1714trait MimaCheck extends Mima {
1815 def mimaPreviousVersions = Seq (" 0.2.4" , " 0.2.5" , " 0.2.6" , " 0.2.7" , " 0.2.8" , " 0.3.0" , " 0.3.1" )
@@ -41,98 +38,42 @@ trait SourcecodeModule extends PublishModule with MimaCheck {
4138 )
4239 )
4340}
44- trait SourcecodeMainModule extends CrossScalaModule {
45- def millSourcePath = super .millSourcePath / offset
46-
47- def offset : os.RelPath = os.rel
48-
41+ trait SourcecodeMainModule extends CrossScalaModule with PlatformScalaModule {
4942 def compileIvyDeps =
5043 if (crossScalaVersion.startsWith(" 2" )) Agg (
5144 ivy " org.scala-lang:scala-reflect: ${crossScalaVersion}" ,
5245 ivy " org.scala-lang:scala-compiler: ${crossScalaVersion}"
5346 )
5447 else Agg .empty[Dep ]
55-
56- def sources = T .sources(
57- super .sources()
58- .flatMap(source =>
59- Seq (
60- PathRef (source.path / os.up / source.path.last),
61- PathRef (source.path / os.up / os.up / source.path.last)
62- )
63- )
64- )
6548}
6649
50+ object sourcecode extends Module {
51+ object jvm extends Cross [JvmSourcecodeModule ](scalaVersions)
52+ trait JvmSourcecodeModule extends SourcecodeMainModule with ScalaModule with SourcecodeModule {
6753
68- trait SourcecodeTestModule extends ScalaModule {
69- def crossScalaVersion : String
70-
71- def offset : os.RelPath = os.rel
72- def millSourcePath = super .millSourcePath / os.up
73-
74- def sources = T .sources(
75- super .sources()
76- .++ (CrossModuleBase .scalaVersionPaths(crossScalaVersion, s => millSourcePath / s " src- $s" ))
77- .flatMap(source =>
78- Seq (
79- PathRef (source.path / os.up / " test" / source.path.last),
80- PathRef (source.path / os.up / os.up / " test" / source.path.last)
81- )
82- )
83- .distinct
84- )
85- }
54+ object test extends ScalaTests {
8655
87- object sourcecode extends Module {
88- object jvm extends Cross [JvmSourcecodeModule ](scalaVersions : _* )
89- class JvmSourcecodeModule (val crossScalaVersion : String )
90- extends SourcecodeMainModule with ScalaModule with SourcecodeModule {
91-
92- object test extends SourcecodeTestModule {
93- def scalaVersion = crossScalaVersion
94- def moduleDeps = Seq (JvmSourcecodeModule .this )
95- val crossScalaVersion = JvmSourcecodeModule .this .crossScalaVersion
56+ def testFramework = " "
9657 }
9758 }
9859
99- object js extends Cross [JsSourcecodeModule ](scalaJSVersions : _* )
100- class JsSourcecodeModule (val crossScalaVersion : String , crossJSVersion : String )
101- extends SourcecodeMainModule with ScalaJSModule with SourcecodeModule {
102- def offset = os.up
103-
104- def scalaJSVersion = crossJSVersion
105- object test extends SourcecodeTestModule with ScalaJSModule {
106- def scalaVersion = crossScalaVersion
107- def scalaJSVersion = crossJSVersion
108- def offset = os.up
109- def moduleDeps = Seq (JsSourcecodeModule .this )
110- val crossScalaVersion = JsSourcecodeModule .this .crossScalaVersion
60+ object js extends Cross [JsSourcecodeModule ](scalaVersions)
61+ trait JsSourcecodeModule extends SourcecodeMainModule with ScalaJSModule with SourcecodeModule {
62+
63+ def scalaJSVersion = " 1.12.0"
64+ object test extends ScalaJSTests {
65+ def testFramework = " "
11166 }
11267 }
11368
114- object native extends Cross [NativeSourcecodeModule ](scalaNativeVersions : _* )
115- class NativeSourcecodeModule (val crossScalaVersion : String , crossScalaNativeVersion : String )
116- extends SourcecodeMainModule with ScalaNativeModule with SourcecodeModule {
117- def offset = os.up
118-
119- def scalaNativeVersion = crossScalaNativeVersion
120-
121- override def docJar =
122- if (crossScalaVersion.startsWith(" 2." )) super .docJar
123- else T {
124- val outDir = T .ctx().dest
125- val javadocDir = outDir / " javadoc"
126- os.makeDir.all(javadocDir)
127- mill.api.Result .Success (mill.modules.Jvm .createJar(Agg (javadocDir))(outDir))
128- }
129-
130- object test extends SourcecodeTestModule with ScalaNativeModule {
131- def scalaVersion = crossScalaVersion
132- def scalaNativeVersion = crossScalaNativeVersion
133- def offset = os.up
134- def moduleDeps = Seq (NativeSourcecodeModule .this )
135- val crossScalaVersion = NativeSourcecodeModule .this .crossScalaVersion
69+ object native extends Cross [NativeSourcecodeModule ](scalaVersions)
70+ trait NativeSourcecodeModule extends SourcecodeMainModule with ScalaNativeModule with SourcecodeModule {
71+
72+ def scalaNativeVersion = " 0.5.0"
73+ object test extends ScalaNativeTests {
74+ // stub to make use of test plumbing but not running a test suite
75+ def mainClass = Some (" sourcecode.Main" )
76+ def testFramework = " "
13677 }
13778 }
13879}
0 commit comments