Skip to content

Commit e6d7a94

Browse files
committed
more fixes for sonatype central compat
1 parent b3bd66f commit e6d7a94

File tree

4 files changed

+68
-24
lines changed

4 files changed

+68
-24
lines changed

build.mill

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,17 @@ trait MillJavaModule extends JavaModule {
422422
}
423423

424424
trait MillPublishJavaModule extends MillJavaModule with PublishModule {
425+
426+
def artifactName = "mill-" + super.artifactName()
427+
def publishVersion = millVersion()
428+
def publishProperties = super.publishProperties() ++ Map(
429+
"info.releaseNotesURL" -> Settings.changelogUrl
430+
)
431+
def pomSettings = MillPublishJavaModule.commonPomSettings(artifactName())
432+
def javacOptions = Seq("-source", "1.8", "-target", "1.8", "-encoding", "UTF-8")
433+
}
434+
435+
object MillPublishJavaModule {
425436
def commonPomSettings(artifactName: String) = {
426437
PomSettings(
427438
description = artifactName,
@@ -436,15 +447,7 @@ trait MillPublishJavaModule extends MillJavaModule with PublishModule {
436447
)
437448
}
438449

439-
def artifactName = "mill-" + super.artifactName()
440-
def publishVersion = millVersion()
441-
def publishProperties = super.publishProperties() ++ Map(
442-
"info.releaseNotesURL" -> Settings.changelogUrl
443-
)
444-
def pomSettings = commonPomSettings(artifactName())
445-
def javacOptions = Seq("-source", "1.8", "-target", "1.8", "-encoding", "UTF-8")
446450
}
447-
448451
/**
449452
* Some custom scala settings and test convenience
450453
*/
@@ -641,7 +644,7 @@ trait BridgeModule extends MillPublishCrossScalaModule {
641644
def scalaVersion = crossScalaVersion
642645
def publishVersion = bridgeVersion
643646
def artifactName = "mill-scala-compiler-bridge"
644-
def pomSettings = commonPomSettings(artifactName())
647+
def pomSettings = MillPublishJavaModule.commonPomSettings(artifactName())
645648
def crossFullScalaVersion = true
646649
def ivyDeps = Agg(
647650
ivy"org.scala-sbt:compiler-interface:${Deps.zinc.version}",

dist/package.mill

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ trait InstallModule extends build.MillPublishJavaModule {
1515
}
1616
def moduleDeps = Seq(build.runner, build.idea, build.main.init)
1717

18-
def jar = executableRaw()
1918
def executableRaw: T[PathRef]
2019

2120
def executable = Task {
@@ -60,6 +59,45 @@ trait InstallModule extends build.MillPublishJavaModule {
6059
)
6160
targetFile
6261
}
62+
63+
def artifact = Task {
64+
Artifact(build.Settings.pomOrg, artifactName(), build.millVersion())
65+
}
66+
67+
def pomSettings = Task {
68+
build.MillPublishJavaModule.commonPomSettings(artifactName())
69+
}
70+
71+
def artifactFileNamePrefix = Task {
72+
s"${artifactName()}-${build.millVersion()}"
73+
}
74+
75+
def pom: T[PathRef] = Task {
76+
val pom = Pom(
77+
artifact = artifact(),
78+
dependencies = Nil,
79+
name = artifactName(),
80+
pomSettings = pomSettings(),
81+
properties = Map(),
82+
packagingType = "jar",
83+
parentProject = None,
84+
bomDependencies = Nil,
85+
dependencyManagement = Nil
86+
)
87+
val pomPath = Task.dest / s"${artifactFileNamePrefix()}.pom"
88+
os.write.over(pomPath, pom)
89+
PathRef(pomPath)
90+
}
91+
92+
def publishArtifacts = Task {
93+
PublishModule.PublishData(
94+
meta = artifact(),
95+
payload = Seq(
96+
executableRaw() -> s"${artifactFileNamePrefix()}.exe",
97+
pom() -> s"${artifactFileNamePrefix()}.pom"
98+
)
99+
)
100+
}
63101
}
64102

65103
object `package` extends RootModule with InstallModule {
@@ -233,20 +271,20 @@ object `package` extends RootModule with InstallModule {
233271
prepareBootstrapLauncher(millBootstrapBat().path, Task.dest, build.millVersion(), "mill.bat")
234272
}
235273

236-
def examplePathsWithArtifactName: Task[Seq[(os.Path, String)]] = Task.Anon {
274+
def examplePathsWithArtifactName: Task[Seq[(PathRef, String)]] = Task.Anon {
237275
for {
238276
exampleMod <- build.example.exampleModules
239277
path = exampleMod.millSourcePath
240278
} yield {
241279
val example = path.subRelativeTo(Task.workspace)
242280
val artifactName = example.segments.mkString("-")
243-
(path, artifactName)
281+
(PathRef(path), artifactName)
244282
}
245283
}
246284

247285
def exampleZips: T[Seq[PathRef]] = Task {
248286
examplePathsWithArtifactName().map { case (examplePath, exampleStr) =>
249-
os.copy(examplePath, Task.dest / exampleStr, createFolders = true)
287+
os.copy(examplePath.path, Task.dest / exampleStr, createFolders = true)
250288
os.write(Task.dest / exampleStr / ".mill-version", build.millLastTag())
251289
os.copy(bootstrapLauncher().path, Task.dest / exampleStr / "mill")
252290
os.copy(bootstrapLauncherBat().path, Task.dest / exampleStr / "mill.bat")
@@ -257,12 +295,14 @@ object `package` extends RootModule with InstallModule {
257295
}
258296

259297
def publishArtifacts = Task {
260-
super.publishArtifacts()
261-
.copy(payload =
262-
super.publishArtifacts().payload ++
263-
exampleZips().map(z => (z, z.path.last)) ++
264-
Seq((bootstrapLauncher(), "mill"), (bootstrapLauncherBat(), "mill.bat"))
265-
)
298+
super.publishArtifacts().copy(payload =
299+
super.publishArtifacts().payload ++
300+
exampleZips().map(z => (z, s"${artifactFileNamePrefix()}-${z.path.last}")) ++
301+
Seq(
302+
(bootstrapLauncher(), s"${artifactFileNamePrefix()}-mill.sh"),
303+
(bootstrapLauncherBat(), s"${artifactFileNamePrefix()}-mill.bat")
304+
)
305+
)
266306
}
267307

268308
def uploadToGithub(authKey: String) = Task.Command {

docs/modules/ROOT/pages/cli/installation-ide.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ bootstrap script, included. You can also download the boostrap script manually:
2020
.Mac/Linux
2121
[source,console,subs="verbatim,attributes"]
2222
----
23-
> curl -L {mill-download-url}/mill -o mill
23+
> curl -L {mill-download-url}/mill-dist-{mill-version}-mill.sh -o mill
2424
> chmod +x mill
2525
> echo {mill-version} > .mill-version
2626
----
2727
2828
.Windows
2929
[source,console,subs="verbatim,attributes"]
3030
----
31-
> curl -L {mill-download-url}/mill.bat -o mill.bat
31+
> curl -L {mill-download-url}/mill-dist-{mill-version}-mill.bat -o mill.bat
3232
> echo {mill-version}> .mill-version
3333
----
3434

main/init/package.mill

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ object `package` extends RootModule with build.MillPublishScalaModule {
1515

1616
def exampleList: T[PathRef] = Task {
1717
val data: Seq[(os.SubPath, String)] =
18-
build.dist.examplePathsWithArtifactName().map { case (path, str) =>
19-
val downloadUrl = s"${build.millDownloadUrl()}/$str.zip"
20-
val subPath = path.subRelativeTo(Task.workspace / "example")
18+
build.dist.examplePathsWithArtifactName().map { case (pathRef, str) =>
19+
val downloadUrl =
20+
s"${build.millDownloadUrl()}/mill-dist-${build.dist.artifactFileNamePrefix()}-$str.zip"
21+
val subPath = pathRef.path.subRelativeTo(Task.workspace / "example")
2122
(subPath, downloadUrl)
2223
}
2324

0 commit comments

Comments
 (0)