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

Distribute Mill Assembly via Maven Central #2560

Merged
merged 3 commits into from
May 31, 2023
Merged
Changes from all commits
Commits
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
18 changes: 15 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,11 @@ object runner extends MillPublicScalaModule {
}
}

object dist extends MillPublishJavaModule{
def jar = dev.assembly()
def moduleDeps = Seq(runner)
}

object dev extends MillPublishScalaModule {
def moduleDeps = Seq(runner)

Expand Down Expand Up @@ -1253,8 +1258,10 @@ object dev extends MillPublishScalaModule {
mill.scalalib.Assembly.Rule.ExcludePattern("mill/local-test-overrides/.*")
)

// All modules that we want to aggregate as part of this `dev` assembly.
// Excluding itself, and the `dist` module that uses it
lazy val allPublishModules = build.millInternal.modules.collect {
case m: PublishModule if m ne this => m
case m: PublishModule if (m ne this) && (m ne dist) => m
Copy link
Member

@lefou lefou May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change the name of that target or add some comment to clarify its purpose?

}

def assembly = T {
Expand Down Expand Up @@ -1617,13 +1624,18 @@ def millBootstrap = T.sources(T.workspace / "mill")

def bootstrapLauncher = T {
val outputPath = T.ctx.dest / "mill"
val millBootstrapGrepPrefix = "\nDEFAULT_MILL_VERSION="
val millBootstrapGrepPrefix = "(\n *DEFAULT_MILL_VERSION=)"
val millDownloadUrlPrefix = "(\n *MILL_DOWNLOAD_URL=)"
os.write(
outputPath,
os.read(millBootstrap().head.path)
.replaceAll(
millBootstrapGrepPrefix + "[^\\n]+",
millBootstrapGrepPrefix + millVersion()
"$1" + millVersion()
)
.replaceAll(
millDownloadUrlPrefix + "[^\\n]+",
"$1" + "\"https://repo1.maven.org/maven2/com/lihaoyi/mill-dist/\\$MILL_VERSION/mill-dist-\\$MILL_VERSION.jar\""
)
)
os.perms.set(outputPath, "rwxrwxrwx")
Expand Down