Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support mill init from an existing sbt project, and improve related Maven and Gradle support #4586

Open
wants to merge 117 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
ac22329
Initially copy and adapt some code to support `mill init` from an exi…
ShreckYe Feb 4, 2025
d2ad688
Add a cross module for the models and split the code because Mill use…
ShreckYe Feb 5, 2025
39f928e
Initially implement assembling and adding the `sbt-mill-init-generate…
ShreckYe Feb 6, 2025
3c9f155
Add code to add the sbt plugin and run the `millInitGenerateProjectTr…
ShreckYe Feb 6, 2025
923ddf4
Remove the files generated by sbt in "main/init/sbt/test/resources/sc…
ShreckYe Feb 6, 2025
268eb63
Replace "SBT"s with lowercase "sbt"
ShreckYe Feb 6, 2025
86e1807
Move the old "sbt-mill-init-generate-project-tree" Mill module and ru…
ShreckYe Feb 6, 2025
9991d8a
Remove unneeded code in the generated sbt plugin project and add µTes…
ShreckYe Feb 6, 2025
a253537
Move `ProjectTreePlugin` into the sbt project and set up the build lo…
ShreckYe Feb 7, 2025
01bfcf5
Initially complete implementing `SbtBuildGenMain` and the sbt plugin …
ShreckYe Feb 15, 2025
8b141aa
Remove the unnecessary code marked with TODOs to be removed in the pr…
ShreckYe Feb 15, 2025
1fd0b65
Do not diff a subproject's `BuildInfo` with `ThisBuild`'s anymore in …
ShreckYe Feb 16, 2025
f38991b
Move the "mill.scalalib.SbtModule" import into `SbtBuildGenMain` to f…
ShreckYe Feb 16, 2025
f70e818
Export and import sbt's `scalaVersion` too
ShreckYe Feb 16, 2025
7e1e2b6
Exclude the Scala Standard Libraries
ShreckYe Feb 16, 2025
6f4c45d
Add the https://github.com/pbassiner/sbt-multi-project-example projec…
ShreckYe Feb 16, 2025
913ef1d
Generate the expected snapshots for "sbt-multi-project-example" and i…
ShreckYe Feb 16, 2025
ac9d657
Generate the expected snapshots for "sbt-multi-project-example" with …
ShreckYe Feb 16, 2025
f8d748b
Set the settings in `ThisBuild` in "sbt-multi-project-example" so the…
ShreckYe Feb 16, 2025
4156577
Add POM settings in `ThisBuild` in "sbt-multi-project-example" to tes…
ShreckYe Feb 16, 2025
f0d1378
Stop updating the expected test sample snapshots
ShreckYe Feb 16, 2025
ea780d7
Copy and adapt the docs and some code for sbt from those for Gradle r…
ShreckYe Feb 16, 2025
b59e33f
Copy and adapt the integration tests for sbt from those for Gradle, r…
ShreckYe Feb 17, 2025
31154ac
Add a TODO
ShreckYe Feb 17, 2025
3d2fafe
Add the example tests, and add more and rearrange the integration tes…
ShreckYe Feb 18, 2025
44f6ada
Set up sbt in the CI to fix the failing CI tests
ShreckYe Feb 19, 2025
802f005
Move `setup-sbt` to `post-build-setup`
ShreckYe Feb 19, 2025
39baa2d
Refine a TODO
ShreckYe Feb 19, 2025
0c9b749
Merge branch 'main' into init-from-sbt
ShreckYe Feb 19, 2025
3db8288
Fix compiling and test issues after the merge
ShreckYe Feb 19, 2025
918359e
Split the `sbt assembly` command into a tuple, and replace `scala.sys…
ShreckYe Feb 19, 2025
4419d7f
Fix calling the sbt command in the `sbtPluginJarResources` Mill task …
ShreckYe Feb 19, 2025
68d830f
Get the `sbt millInitExportBuild` command to work on Windows with a w…
ShreckYe Feb 19, 2025
7155ec8
Fix a bug that the exported projects are ordered differently in diffe…
ShreckYe Feb 19, 2025
3ef1bef
Try fixing integration test timeout in the CI
ShreckYe Feb 20, 2025
1655bb9
Fix a compiling error introduced in the previous commit
ShreckYe Feb 20, 2025
6b717b7
Try fixing more integration test failures on CI, both on Linux with J…
ShreckYe Feb 20, 2025
018cd53
Fix the failing example tests added in commit 3d2fafed6a2cdcbce2f8c6c…
ShreckYe Feb 20, 2025
4112c6f
Run `./mill mill.scalalib.scalafmt.ScalafmtModule/reformatAll` since …
ShreckYe Feb 20, 2025
40cdaa3
Add one more exception in docs from the integration test failures fix…
ShreckYe Feb 20, 2025
3cfb3aa
Add `setup-sbt` in `autofix.ci` too as it fails without it
ShreckYe Feb 20, 2025
e66f8ee
Merge branch 'main' into init-from-sbt
ShreckYe Feb 20, 2025
7ed2c3a
Fix the merge
ShreckYe Feb 20, 2025
ee28377
Support converting child projects nested in a parent directory which …
ShreckYe Feb 22, 2025
88c31b1
Run more `compile` and `test` tasks in the submodules of part of the …
ShreckYe Feb 22, 2025
f533126
Reformat `GradleBuildGenMain.scala`
ShreckYe Feb 22, 2025
6e48c2b
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 22, 2025
2286ed0
Fix the integration tests failing on windows caused by `split('\n')`
ShreckYe Feb 22, 2025
768a2b1
Fix the bug the converted sbt test modules extend `MavenTests` instea…
ShreckYe Feb 23, 2025
cd168ff
Update (fix) an integration test accordingly
ShreckYe Feb 23, 2025
9ee23de
Try fixing Mill `test` in the converted project of `MillInitScalaCsv1…
ShreckYe Feb 23, 2025
87afa17
Move the `jvmId` config arg to `BasicConfig` and support it in `SbtBu…
ShreckYe Feb 23, 2025
02206a6
Support the `baseProject` config arg too in `SbtBuildGenMain` and upd…
ShreckYe Feb 23, 2025
c819207
Fix assertions in `MillInitSbtMultiProjectExampleTests` that fail due…
ShreckYe Feb 23, 2025
22033e9
Support comparing a module's `def`'s with and extending super base mo…
ShreckYe Feb 24, 2025
34b837d
Fix assertions in `MillInitSbtMultiProjectExampleTests` that fail due…
ShreckYe Feb 24, 2025
729fc9d
Fix bugs introduced in commit 22033e909dd461689b374815ca4602b087b8830…
ShreckYe Feb 24, 2025
f1bfd9a
Fix some grammar mistakes
ShreckYe Feb 24, 2025
af5454d
Rename some integration tests for explicitness and consistency
ShreckYe Feb 24, 2025
8794040
Update `MillInitSbtZioHttpTests` with the result and improve `testAll…
ShreckYe Feb 24, 2025
ca1c827
Support more `CrossVersion` types
ShreckYe Feb 24, 2025
1cd32b0
Fix a warning discovered by CI `lint-autofix`
ShreckYe Feb 24, 2025
d34d385
Fix a warning by making a def private
ShreckYe Feb 24, 2025
1d8011c
Supported converting `type, `classifier`, and `exclusions` in sbt dep…
ShreckYe Feb 24, 2025
12e9d73
Run more `compile` and `test` tasks in the submodules of all the conv…
ShreckYe Feb 25, 2025
2be0d80
Reformat "main/init/package.mill" as `lint-autofix` fails on CI
ShreckYe Feb 25, 2025
44c7381
Add a comment
ShreckYe Feb 25, 2025
8ca434a
Review the reasons why the tasks succeed or fail and improve comments…
ShreckYe Feb 25, 2025
75af776
Run more `compile` and `test` tasks in `MillInitSbtScalaCheckTests`
ShreckYe Feb 25, 2025
6cac44b
Merge branch 'main' into init-from-sbt
ShreckYe Feb 25, 2025
c2256f8
Reformat
ShreckYe Feb 25, 2025
10d2076
Add some `override`s following commit 57ab8e6218f5fab869e238037edfc8d…
ShreckYe Feb 25, 2025
d0d1e39
Update the expected test snapshots and fix the unit tests broken by t…
ShreckYe Feb 25, 2025
3933fde
Revert to using a Mill module for the sbt plugin
ShreckYe Feb 26, 2025
144f16f
remove unnecessary files in the original sbt project, move `ExportBui…
ShreckYe Feb 26, 2025
c91b342
Copy the "sbt.autoplugins" file packaged in the jar generated by the …
ShreckYe Feb 26, 2025
bc5d03d
Add the sbt library as `compileIvyDeps`
ShreckYe Feb 26, 2025
f07f565
Exclude the Scala libraries from the assembly jar too
ShreckYe Feb 26, 2025
0147fcc
Merge branch 'init-from-sbt-use-mill-module-for-sbt-plugin' into init…
ShreckYe Feb 26, 2025
2ca01b2
Revamp the integration test code as requested
ShreckYe Feb 27, 2025
5a7696b
[autofix.ci] apply automated fixes
autofix-ci[bot] Feb 27, 2025
46e475c
Clean up
ShreckYe Feb 27, 2025
5f9abe0
Replace `OM` with `Option[M]` as requested in https://github.com/com-…
ShreckYe Feb 27, 2025
629bec5
Replace "scalacenter/library-example" with "scala/scala3-example-proj…
ShreckYe Feb 27, 2025
62db02d
Support converting sbt dependency configurations with multiple config…
ShreckYe Feb 27, 2025
2c6799f
Render `def testSandboxWorkingDir = false` in the test modules by def…
ShreckYe Feb 27, 2025
a83cf62
Fix `MillInitSbtGatlingTests` that fails on Windows and a link to a s…
ShreckYe Feb 28, 2025
3a99f85
Add assertions on the number of source files produced the `allSourceF…
ShreckYe Mar 1, 2025
3c22ec6
Not stream the output via `os.Inherit` by default in `testMillInit`
ShreckYe Mar 1, 2025
8ba4322
Use the `testMillInit` helper in `MillInitMavenTests.scala` and `Mill…
ShreckYe Mar 3, 2025
323c0bf
Combine all the successful tasks into one command by default to speed…
ShreckYe Mar 3, 2025
88b087d
Fix `MillInitGradleEhcache3Tests` failing on Linux with JDK 11 on CI
ShreckYe Mar 3, 2025
7548a98
Call `writeMillJvmVersionTemurin11` instead as the issue in the previ…
ShreckYe Mar 4, 2025
978ba8c
Rename the sbt plugin module to `exportplugin` as requested in https:…
ShreckYe Mar 4, 2025
be4457c
Pull the latest commit and remove the special case in `MillInitSbtGat…
ShreckYe Mar 4, 2025
0fb0af6
Fix a bug in the module code that the custom error message is not pri…
ShreckYe Mar 4, 2025
a04fe27
Run the wildcard task when possible in `testMillInit` with `combineSu…
ShreckYe Mar 4, 2025
819226f
Try fixing the failing test on Linux with JDK 11 on CI and print it o…
ShreckYe Mar 4, 2025
93e87cd
Merge branch 'main' into init-from-sbt
ShreckYe Mar 4, 2025
c903ee2
Skip `MillInitSbtGatlingTests` on Windows
ShreckYe Mar 5, 2025
a23caa6
Make `lowerCaseOsName` a private method as requested in https://githu…
ShreckYe Mar 5, 2025
a2bbacf
Merge branch 'main' into init-from-sbt
ShreckYe Mar 5, 2025
77f17ac
Reuse `workerScalaVersion212`
ShreckYe Mar 5, 2025
f64f8f4
`git checkout main -- build.mill` and update to resolve https://githu…
ShreckYe Mar 5, 2025
92b5978
Bump sbt to 1.10.10
ShreckYe Mar 5, 2025
085cf48
Add a system property `TEST_SBT_VERSION` to stick a single source of …
ShreckYe Mar 5, 2025
5cd08ea
[autofix.ci] apply automated fixes
autofix-ci[bot] Mar 5, 2025
1ee8163
Update integration/feature/init/src/MillInitSbtTests.scala
ShreckYe Mar 5, 2025
4dd7803
Replace another `sys.props("TEST_SBT_VERSION")` as in the previous co…
ShreckYe Mar 5, 2025
3e88144
Use `BuildInfo` to pass the sbt version to the runtime in the `main/i…
ShreckYe Mar 5, 2025
d147b86
Fix bugs in `testModulesByGroup` pointed out at https://github.com/co…
ShreckYe Mar 7, 2025
b27db68
Merge branch 'main' into init-from-sbt
ShreckYe Mar 7, 2025
4fc62e9
update-patch
lihaoyi Mar 7, 2025
222a15d
Get sbt's inter-project dependencies from sbt `buildDependencies` ins…
ShreckYe Mar 9, 2025
2955888
Get Gradle's inter-project dependencies from Gradle `ProjectDependenc…
ShreckYe Mar 10, 2025
c24db27
Merge branch 'init-from-sbt-retrieve-inter-project-dependencies-direc…
ShreckYe Mar 10, 2025
474ca86
Remove unnecessary `getGav` methods and rename existing ones to be mo…
ShreckYe Mar 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/actions/post-build-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ runs:
name: ${{ inputs.os }}-selective-execution-artifact

- run: mv out/mill-selective-execution/mill-selective-execution.json out/mill-selective-execution.json
shell: bash
shell: bash

- uses: sbt/setup-sbt@v1
2 changes: 1 addition & 1 deletion .github/actions/pre-build-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ runs:
- uses: actions/checkout@v4

- run: echo temurin:${{ inputs.java-version }} > .mill-jvm-version
shell: bash
shell: bash
2 changes: 2 additions & 0 deletions .github/workflows/autofix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: sbt/setup-sbt@v1

- run: |
./mill __.fix + mill.javalib.palantirformat.PalantirFormatModule/ + mill.scalalib.scalafmt.ScalafmtModule/ + mill.kotlinlib.ktlint.KtlintModule/
./mill --meta-level 1 mill.scalalib.scalafmt.ScalafmtModule/
Expand Down
9 changes: 7 additions & 2 deletions build.mill
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ object Deps {
val scala2Version = "2.13.15"
// The Scala 2.12.x version to use for some workers
val workerScalaVersion212 = "2.12.20"
val sbtScalaVersion212 = workerScalaVersion212

val testScala213Version = "2.13.15"
// Scala Native 4.2 will not get releases for new Scala version
Expand Down Expand Up @@ -220,6 +221,7 @@ object Deps {
ivy"org.apache.maven.resolver:maven-resolver-transport-wagon:$mavenResolverVersion"
val coursierJvmIndexVersion = "0.0.4-84-f852c6"
val gradleApi = ivy"dev.gradleplugins:gradle-api:8.11.1"
val sbt = ivy"org.scala-sbt:sbt:1.10.10"

object RuntimeDeps {
val dokkaVersion = "2.0.0"
Expand Down Expand Up @@ -569,7 +571,8 @@ trait MillBaseTestsModule extends TestModule {
s"-DTEST_TEST_INTERFACE_VERSION=${Deps.sbtTestInterface.version}",
s"-DTEST_ZIOTEST_VERSION=${Deps.TestDeps.zioTest.version}",
s"-DTEST_ZINC_VERSION=${Deps.zinc.version}",
s"-DTEST_KOTLIN_VERSION=${Deps.kotlinCompiler.version}"
s"-DTEST_KOTLIN_VERSION=${Deps.kotlinCompiler.version}",
s"-DTEST_SBT_VERSION=${Deps.sbt.version}"
)
}

Expand Down Expand Up @@ -714,8 +717,10 @@ trait MillStableScalaModule extends MillPublishScalaModule with Mima {
}
}

trait MillPublishCrossScalaModule extends MillPublishJavaModule with CrossScalaModule

object bridge extends Cross[BridgeModule](compilerBridgeScalaVersions)
trait BridgeModule extends MillPublishJavaModule with CrossScalaModule {
trait BridgeModule extends MillPublishCrossScalaModule {
def scalaVersion = crossScalaVersion
def publishVersion = bridgeVersion
def artifactName = "mill-scala-compiler-bridge"
Expand Down
54 changes: 28 additions & 26 deletions ci/mill-bootstrap.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/build.mill b/build.mill
index 42be8622781..ecb84c31089 100644
index 1f184f35cb7..c702f9e93a6 100644
--- a/build.mill
+++ b/build.mill
@@ -1,16 +1,16 @@
Expand All @@ -23,7 +23,7 @@ index 42be8622781..ecb84c31089 100644
import mill.T
import mill.define.Cross

@@ -288,19 +288,19 @@ object Deps {
@@ -290,19 +290,19 @@ object Deps {
}

def millVersion: T[String] = Task.Input {
Expand All @@ -47,7 +47,7 @@ index 42be8622781..ecb84c31089 100644
}

def millDownloadPrefix = Task {
@@ -319,7 +319,7 @@ def millBinPlatform: T[String] = Task {
@@ -321,7 +321,7 @@ def millBinPlatform: T[String] = Task {
}
}

Expand All @@ -56,7 +56,7 @@ index 42be8622781..ecb84c31089 100644

def millJvmVersion = Task.Source(Task.workspace / ".mill-jvm-version")

@@ -469,7 +469,7 @@ trait MillPublishJavaModule extends MillJavaModule with PublishModule {
@@ -471,7 +471,7 @@ trait MillPublishJavaModule extends MillJavaModule with PublishModule {
/**
* Some custom scala settings and test convenience
*/
Expand All @@ -65,7 +65,7 @@ index 42be8622781..ecb84c31089 100644
def scalaVersion = Deps.scalaVersion
def scalapVersion: T[String] = Deps.scala2Version
def scalafixScalaBinaryVersion = T {
@@ -526,8 +526,8 @@ trait MillScalaModule extends ScalaModule with MillJavaModule with ScalafixModul
@@ -528,8 +528,8 @@ trait MillScalaModule extends ScalaModule with MillJavaModule with ScalafixModul
val binaryVersion = ZincWorkerUtil.scalaBinaryVersion(sv)
val hasModuleDefs = binaryVersion == "2.13" || binaryVersion == "3"
super.scalacPluginIvyDeps() ++
Expand All @@ -76,7 +76,7 @@ index 42be8622781..ecb84c31089 100644
}

def mandatoryIvyDeps = T {
@@ -535,13 +535,13 @@ trait MillScalaModule extends ScalaModule with MillJavaModule with ScalafixModul
@@ -537,13 +537,13 @@ trait MillScalaModule extends ScalaModule with MillJavaModule with ScalafixModul
val binaryVersion = ZincWorkerUtil.scalaBinaryVersion(sv)
val hasModuleDefs = binaryVersion == "2.13" || binaryVersion == "3"
super.mandatoryIvyDeps() ++
Expand All @@ -92,7 +92,7 @@ index 42be8622781..ecb84c31089 100644
def scalafixConfig = T { Some(T.workspace / ".scalafix.conf") }
def forkArgs = super.forkArgs() ++ outer.testArgs()
def moduleDeps = outer.testModuleDeps
@@ -581,7 +581,8 @@ trait MillBaseTestsModule extends TestModule {
@@ -584,7 +584,8 @@ trait MillBaseTestsModule extends TestModule {
trait MillPublishScalaModule extends MillScalaModule with MillPublishJavaModule

/** Publishable module which contains strictly handled API. */
Expand All @@ -102,17 +102,17 @@ index 42be8622781..ecb84c31089 100644
import com.github.lolgab.mill.mima._
override def mimaBinaryIssueFilters: T[Seq[ProblemFilter]] = Seq(
// (5x) MIMA doesn't properly ignore things which are nested inside other private things
@@ -711,7 +712,7 @@ trait MillStableScalaModule extends MillPublishScalaModule with Mima {
@@ -714,7 +715,7 @@ trait MillStableScalaModule extends MillPublishScalaModule with Mima {
def skipPreviousVersions: T[Seq[String]] = T {
T.log.info("Skipping mima for previous versions (!!1000s of errors due to Scala 3)")
mimaPreviousVersions() // T(Seq.empty[String])
- }
+ }*/
}

object bridge extends Cross[BridgeModule](compilerBridgeScalaVersions)
trait MillPublishCrossScalaModule extends MillPublishJavaModule with CrossScalaModule
diff --git a/contrib/package.mill b/contrib/package.mill
index 78dac75644b..fa53e9c7525 100644
index b68c27a1ef8..01a3e9da2c0 100644
--- a/contrib/package.mill
+++ b/contrib/package.mill
@@ -3,13 +3,12 @@ package build.contrib
Expand Down Expand Up @@ -189,7 +189,7 @@ index e49f218f4be..9d03aa073f3 100644
def ivyDeps = Task {
if (!caseName.contains("realistic") && !caseName.contains("sourcecode")) super.ivyDeps()
diff --git a/dist/package.mill b/dist/package.mill
index fbbeacbc843..b3e00f8db5f 100644
index 515ed31025a..821d8fcc540 100644
--- a/dist/package.mill
+++ b/dist/package.mill
@@ -2,15 +2,14 @@ package build.dist
Expand Down Expand Up @@ -219,7 +219,7 @@ index fbbeacbc843..b3e00f8db5f 100644
PathRef(path)
}

@@ -185,10 +184,10 @@ object `package` extends RootModule with InstallModule {
@@ -186,10 +185,10 @@ object `package` extends RootModule with InstallModule {
val wd = os.Path(wd0, Task.workspace)
os.makeDir.all(wd)
try {
Expand All @@ -233,7 +233,7 @@ index fbbeacbc843..b3e00f8db5f 100644
)
mill.api.Result.Success(())
} catch {
@@ -233,7 +232,7 @@ object `package` extends RootModule with InstallModule {
@@ -234,7 +233,7 @@ object `package` extends RootModule with InstallModule {
def examplePathsWithArtifactName: Task[Seq[(os.Path, String)]] = Task.Anon {
for {
exampleMod <- build.example.exampleModules
Expand All @@ -242,15 +242,15 @@ index fbbeacbc843..b3e00f8db5f 100644
} yield {
val example = path.subRelativeTo(Task.workspace)
val artifactName = example.segments.mkString("-")
@@ -263,6 +262,7 @@ object `package` extends RootModule with InstallModule {
@@ -264,6 +263,7 @@ object `package` extends RootModule with InstallModule {
}

def uploadToGithub(authKey: String) = Task.Command {
+ /*
val vcsState = VcsVersion.vcsState()
val label = vcsState.copy(dirtyHash = None).format()
if (label != build.millVersion()) sys.error("Modified mill version detected, aborting upload")
@@ -279,7 +279,7 @@ object `package` extends RootModule with InstallModule {
@@ -280,7 +280,7 @@ object `package` extends RootModule with InstallModule {
headers = Seq("Authorization" -> ("token " + authKey))
)
}
Expand All @@ -259,7 +259,7 @@ index fbbeacbc843..b3e00f8db5f 100644
()
}

@@ -316,7 +316,7 @@ object `package` extends RootModule with InstallModule {
@@ -317,7 +317,7 @@ object `package` extends RootModule with InstallModule {
out.write(os.read.bytes(assembly().path))
}

Expand All @@ -269,7 +269,7 @@ index fbbeacbc843..b3e00f8db5f 100644
PathRef(executable)
}
diff --git a/example/package.mill b/example/package.mill
index 62190fd6c1e..9d4f176c915 100644
index fd3a934c8ff..56e35add240 100644
--- a/example/package.mill
+++ b/example/package.mill
@@ -3,13 +3,12 @@ package build.example
Expand All @@ -287,7 +287,7 @@ index 62190fd6c1e..9d4f176c915 100644
import mill.contrib.buildinfo.BuildInfo
import mill.T
import mill.define.Cross
@@ -18,111 +17,111 @@ import mill.define.Cross
@@ -18,112 +17,112 @@ import mill.define.Cross
import $meta._

object `package` extends RootModule with Module {
Expand Down Expand Up @@ -357,13 +357,15 @@ index 62190fd6c1e..9d4f176c915 100644
- object web extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "web"))
- object native extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "native"))
- object spark extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "spark"))
- object migrating extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "migrating"))
+ extends Cross[ExampleCrossModule](build.listIn(moduleDir / "dependencies"))
+ object testing extends Cross[ExampleCrossModule](build.listIn(moduleDir / "testing"))
+ object linting extends Cross[ExampleCrossModule](build.listIn(moduleDir / "linting"))
+ object publishing extends Cross[ExampleCrossModule](build.listIn(moduleDir / "publishing"))
+ object web extends Cross[ExampleCrossModule](build.listIn(moduleDir / "web"))
+ object native extends Cross[ExampleCrossModule](build.listIn(moduleDir / "native"))
+ object spark extends Cross[ExampleCrossModule](build.listIn(moduleDir / "spark"))
+ object migrating extends Cross[ExampleCrossModule](build.listIn(moduleDir / "migrating"))
}
object javascriptlib extends Module {
- object basic extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "basic"))
Expand Down Expand Up @@ -457,7 +459,7 @@ index 62190fd6c1e..9d4f176c915 100644
case "1-test-suite" => line
.replace(
"mill bar.test bar.BarTests.hello",
@@ -147,7 +146,7 @@ object `package` extends RootModule with Module {
@@ -148,7 +147,7 @@ object `package` extends RootModule with Module {
case "publishing" => Some(scalalib.publishing)
case _ => None
}
Expand All @@ -466,7 +468,7 @@ index 62190fd6c1e..9d4f176c915 100644
.flatMap(_.valuesToModules.get(List(crossValue)))

def testRepoRoot = Task {
@@ -213,10 +212,10 @@ object `package` extends RootModule with Module {
@@ -214,10 +213,10 @@ object `package` extends RootModule with Module {

trait ExampleCrossModule extends build.integration.IntegrationTestModule {
// disable scalafix because these example modules don't have sources causing it to misbehave
Expand All @@ -479,7 +481,7 @@ index 62190fd6c1e..9d4f176c915 100644
def sources = Task {
sources0()
.flatMap(pathRef => os.walk(pathRef.path))
@@ -245,7 +244,7 @@ object `package` extends RootModule with Module {
@@ -246,7 +245,7 @@ object `package` extends RootModule with Module {

def rendered = Task {
var seenCode = false
Expand All @@ -488,7 +490,7 @@ index 62190fd6c1e..9d4f176c915 100644
os.write(
Task.dest / "example.adoc",
parsed()
@@ -303,7 +302,7 @@ $txt
@@ -304,7 +303,7 @@ $txt
"gatling" -> ("gatling/gatling", "3870fda86e6bca005fbd53108c60a65db36279b6"),
"arrow" -> ("arrow-kt/arrow", "bc9bf92cc98e01c21bdd2bf8640cf7db0f97204a")
)
Expand All @@ -498,7 +500,7 @@ index 62190fd6c1e..9d4f176c915 100644
val (repoPath, repoHash) = repoInfo(crossValue)
def repoSlug = repoPath.split("/").last
diff --git a/integration/package.mill b/integration/package.mill
index 53cdc15a9f6..9271663b81e 100644
index 4b27b722fdb..8a1df6bf598 100644
--- a/integration/package.mill
+++ b/integration/package.mill
@@ -3,13 +3,12 @@ package build.integration
Expand Down Expand Up @@ -600,7 +602,7 @@ index 957d929826d..112f1aaccb8 100644
// TODO: document, why we have this dependency
ivy"org.jsoup:jsoup:1.18.1"
diff --git a/scalajslib/package.mill b/scalajslib/package.mill
index 562041446af..f4cce7cebb1 100644
index ee6663745f9..09b545ca7a5 100644
--- a/scalajslib/package.mill
+++ b/scalajslib/package.mill
@@ -44,7 +44,7 @@ object `package` extends RootModule with build.MillStableScalaModule with BuildI
Expand All @@ -613,7 +615,7 @@ index 562041446af..f4cce7cebb1 100644
def mandatoryIvyDeps = Agg.empty[Dep]
def compileIvyDeps = super.mandatoryIvyDeps() ++ Agg(
diff --git a/scalalib/package.mill b/scalalib/package.mill
index d25adf2effd..6852f802156 100644
index df9a8c206ba..aa7da099928 100644
--- a/scalalib/package.mill
+++ b/scalalib/package.mill
@@ -2,14 +2,13 @@ package build.scalalib
Expand Down Expand Up @@ -659,7 +661,7 @@ index 3b577e29c65..7f45dcaeab6 100644
def forkEnv =
super.forkEnv() ++ Map("MILL_EXECUTABLE_PATH" -> build.dist.launcher().path.toString())
diff --git a/website/package.mill b/website/package.mill
index f88dc3fe8f6..2e2d2be3716 100644
index 8c7cc0641db..52ab881d38c 100644
--- a/website/package.mill
+++ b/website/package.mill
@@ -26,7 +26,7 @@ object `package` extends RootModule {
Expand Down
8 changes: 6 additions & 2 deletions core/constants/src/mill/constants/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@

public class Util {

public static boolean isWindows =
System.getProperty("os.name").toLowerCase(Locale.ROOT).startsWith("windows");
private static String lowerCaseOsName() {
return System.getProperty("os.name").toLowerCase(Locale.ROOT);
}

public static boolean isWindows = lowerCaseOsName().startsWith("windows");
public static boolean isLinux = lowerCaseOsName().equals("linux");
public static boolean isJava9OrAbove =
!System.getProperty("java.specification.version").startsWith("1.");

Expand Down
1 change: 1 addition & 0 deletions dist/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ object `package` extends RootModule with InstallModule {
build.main.graphviz.testDep(),
build.main.init.maven.testDep(),
build.main.init.gradle.testDep(),
build.main.init.sbt.testDep(),
build.scalalib.backgroundwrapper.testDep(),
build.contrib.bloop.testDep(),
build.contrib.buildinfo.testDep(),
Expand Down
1 change: 1 addition & 0 deletions example/package.mill
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ object `package` extends RootModule with Module {
object web extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "web"))
object native extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "native"))
object spark extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "spark"))
object migrating extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "migrating"))
}
object javascriptlib extends Module {
object basic extends Cross[ExampleCrossModule](build.listIn(millSourcePath / "basic"))
Expand Down
28 changes: 28 additions & 0 deletions example/scalalib/migrating/1-sbt-complete/build.mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/** Usage

> rm build.mill # remove any existing build file

> git init .
> git remote add -f origin https://github.com/scala/scala3-example-project.git
> git checkout 853808c50601e88edaa7272bcfb887b96be0e22a

> ./mill init
converting sbt build
Running the added `millInitExportBuild` sbt task to export the build
converting module scala3-example-project
generated 1 Mill build file(s)
removing existing Mill build files
writing Mill build file to build.mill
converted sbt build to Mill
formatting Mill build files
Formatting 1 Scala sources
parsed config (v3.8.4): ...
init completed, run "mill resolve _" to list available tasks

> ./mill compile
compiling 13 Scala sources to ...out/compile.dest/classes ...

> ./mill test
MySuite:
+ example test that succeeds ...
*/
27 changes: 27 additions & 0 deletions example/scalalib/migrating/2-sbt-incomplete/build.mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/** Usage

> rm build.mill # remove any existing build file

> git init .
> git remote add -f origin https://github.com/tototoshi/scala-csv.git
> git checkout 2.0.0

> ./mill init
converting sbt build
Running the added `millInitExportBuild` sbt task to export the build
converting module scala-csv
generated 1 Mill build file(s)
removing existing Mill build files
writing Mill build file to build.mill
converted sbt build to Mill
formatting Mill build files
Formatting 1 Scala sources
parsed config (v3.8.4): ...
init completed, run "mill resolve _" to list available tasks

> ./mill compile # You will have to further configure the `CrossScalaModule` for different Scala versions
compiling 7 Scala sources and 3 Java sources to ...out/compile.dest/classes ...
error: class CSVReader protected (private val lineReader: LineReader)(implicit format: CSVFormat) extends Closeable with CSVReaderCompat {
error: ^
error: one error found
*/
Loading
Loading