@@ -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
65103object `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 {
0 commit comments