|
1 | 1 | package build.project.publish |
2 | | -import $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::0.4.0` |
3 | | -import $ivy.`org.eclipse.jgit:org.eclipse.jgit:7.3.0.202506031305-r` |
| 2 | + |
4 | 3 | import build.project.settings |
5 | 4 | import com.lumidion.sonatype.central.client.core.{PublishingType, SonatypeCredentials} |
6 | 5 | import settings.{PublishLocalNoFluff, workspaceDirName} |
7 | | -import de.tobiasroeser.mill.vcs.version._ |
8 | | -import mill._ |
9 | | -import mill.api.BuildCtx |
| 6 | +import mill.* |
10 | 7 | import mill.javalib.publish.Artifact |
11 | | -import scalalib._ |
| 8 | +import mill.util.{Tasks, VcsVersion} |
| 9 | +import scalalib.* |
12 | 10 | import org.eclipse.jgit.api.Git |
| 11 | +import mill.api.{BuildCtx, ModuleCtx, Task} |
13 | 12 |
|
14 | 13 | import java.nio.charset.Charset |
15 | | -import scala.concurrent.duration._ |
16 | | -import scala.jdk.CollectionConverters._ |
| 14 | +import scala.concurrent.duration.* |
| 15 | +import scala.jdk.CollectionConverters.* |
17 | 16 |
|
18 | | -lazy val (ghOrg: String, ghName: String) = { |
| 17 | +def gh: (ghOrg: String, ghName: String) = { |
19 | 18 | def default = ("VirtusLab", "scala-cli") |
20 | 19 | val isCI = System.getenv("CI") != null |
21 | 20 | if (isCI) { |
@@ -63,7 +62,9 @@ lazy val (ghOrg: String, ghName: String) = { |
63 | 62 | default |
64 | 63 | } |
65 | 64 |
|
66 | | -private def computePublishVersion(state: VcsState, simple: Boolean): String = |
| 65 | +lazy val (ghOrg: String, ghName: String) = gh |
| 66 | + |
| 67 | +private def computePublishVersion(state: VcsVersion.State, simple: Boolean): String = |
67 | 68 | if (state.commitsSinceLastTag > 0) |
68 | 69 | if (simple) { |
69 | 70 | val versionOrEmpty = state.lastTag |
@@ -141,19 +142,20 @@ trait ScalaCliPublishModule extends SonatypeCentralPublishModule with PublishLoc |
141 | 142 | ) |
142 | 143 | ) |
143 | 144 | override def publishVersion: T[String] = finalPublishVersion() |
144 | | - override def sourceJar: T[PathRef] = Task { |
145 | | - import mill.util.Jvm.createJar |
146 | | - val allSources0 = allSources().map(_.path).filter(os.exists).toSet |
147 | | - val jar = Task.dest / "sources.jar" |
148 | | - createJar( |
149 | | - jar = jar, |
150 | | - inputPaths = allSources0 ++ resources().map(_.path).filter(os.exists), |
151 | | - manifest = manifest(), |
152 | | - fileFilter = (input, relPath) => |
153 | | - !allSources0(input) || |
154 | | - (!relPath.segments.contains(".scala") && !relPath.segments.contains(workspaceDirName)) |
155 | | - ) |
156 | | - PathRef(jar) |
| 145 | + |
| 146 | + override def sourceJar: T[PathRef] = Task { |
| 147 | + PathRef { |
| 148 | + import mill.util.Jvm.createJar |
| 149 | + val allSources0 = allSources().map(_.path).filter(os.exists) |
| 150 | + createJar( |
| 151 | + jar = Task.dest / "out.jar", |
| 152 | + inputPaths = allSources0 ++ resources().map(_.path).filter(os.exists), |
| 153 | + manifest = manifest(), |
| 154 | + fileFilter = (input, relPath) => |
| 155 | + !allSources0.toSet(input) || |
| 156 | + (!relPath.segments.contains(".scala") && !relPath.segments.contains(workspaceDirName)) |
| 157 | + ) |
| 158 | + } |
157 | 159 | } |
158 | 160 | } |
159 | 161 |
|
@@ -215,7 +217,7 @@ def publishSonatype( |
215 | 217 | publisher.publishAll( |
216 | 218 | publishingType = publishingType, |
217 | 219 | singleBundleName = finalBundleName, |
218 | | - artifacts = artifacts: _* |
| 220 | + artifacts = artifacts* |
219 | 221 | ) |
220 | 222 | } |
221 | 223 |
|
|
0 commit comments