11package  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+ 
43import  build .project .settings 
54import  com .lumidion .sonatype .central .client .core .{PublishingType , SonatypeCredentials }
65import  settings .{PublishLocalNoFluff , workspaceDirName }
7- import  de .tobiasroeser .mill .vcs .version ._ 
8- import  mill ._ 
6+ import  mill .* 
97import  mill .javalib .publish .Artifact 
10- import  scalalib ._ 
8+ import  mill .util .{Tasks , VcsVersion }
9+ import  scalalib .* 
1110import  org .eclipse .jgit .api .Git 
11+ import  mill .api .{BuildCtx , ModuleCtx , Task }
1212
1313import  java .nio .charset .Charset 
14- import  scala .concurrent .duration ._ 
15- import  scala .jdk .CollectionConverters ._ 
14+ import  scala .concurrent .duration .* 
15+ import  scala .jdk .CollectionConverters .* 
1616
17- lazy   val  (ghOrg : String , ghName : String ) =  {
17+ def   gh :  (ghOrg : String , ghName : String ) =  {
1818  def  default  =  (" VirtusLab" " scala-cli" 
1919  val  isCI     =  System .getenv(" CI" !=  null 
2020  if  (isCI) {
@@ -62,7 +62,9 @@ lazy val (ghOrg: String, ghName: String) = {
6262    default
6363}
6464
65- 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  = 
6668  if  (state.commitsSinceLastTag >  0 )
6769    if  (simple) {
6870      val  versionOrEmpty  =  state.lastTag
@@ -141,15 +143,18 @@ trait ScalaCliPublishModule extends SonatypeCentralPublishModule with PublishLoc
141143  )
142144  override  def  publishVersion :  T [String ] =  finalPublishVersion()
143145  override  def  sourceJar :  T [PathRef ]     =  Task  {
144-     import  mill .util .Jvm .createJar 
145-     val  allSources0  =  allSources().map(_.path).filter(os.exists).toSet
146-     createJar(
147-       allSources0 ++  resources().map(_.path).filter(os.exists),
148-       manifest(),
149-       (input, relPath) => 
150-         ! allSources0(input) || 
151-         (! relPath.segments.contains(" .scala" &&  ! relPath.segments.contains(workspaceDirName))
152-     )
146+     PathRef  {
147+       import  mill .util .Jvm .createJar 
148+       val  allSources0  =  allSources().map(_.path).filter(os.exists)
149+       createJar(
150+         jar =  Task .dest /  " out.jar" 
151+         inputPaths =  allSources0 ++  resources().map(_.path).filter(os.exists),
152+         manifest =  manifest(),
153+         fileFilter =  (input, relPath) => 
154+           ! allSources0.toSet(input) || 
155+           (! relPath.segments.contains(" .scala" &&  ! relPath.segments.contains(workspaceDirName))
156+       )
157+     }
153158  }
154159}
155160
@@ -211,7 +216,7 @@ def publishSonatype(
211216  publisher.publishAll(
212217    publishingType =  publishingType,
213218    singleBundleName =  finalBundleName,
214-     artifacts =  artifacts :  _ *
219+     artifacts =  artifacts* 
215220  )
216221}
217222
@@ -235,7 +240,7 @@ def setShouldPublish() = Task.Command {
235240  val  charSet  =  Charset .defaultCharset()
236241  val  nl       =  System .lineSeparator()
237242  os.write.append(
238-     os.Path (envFile, Task .workspace ),
243+     os.Path (envFile, BuildCtx .workspaceRoot ),
239244    s " SHOULD_PUBLISH= ${shouldPublish()}$nl" .getBytes(charSet)
240245  )
241246}
0 commit comments