@@ -7,11 +7,8 @@ package build
7
7
8
8
import mill._
9
9
import mill.api.{BuildCtx, Result}
10
- import mill.javalib.SonatypeCentralPublishModule
11
10
import mill.scalalib._
12
11
import mill.scalalib.scalafmt._
13
- import mill.scalalib.publish.{Artifact, SonatypePublisher}
14
- import com.lumidion.sonatype.central.client.core.{PublishingType, SonatypeCredentials}
15
12
16
13
object v extends Module {
17
14
@@ -69,10 +66,6 @@ object v extends Module {
69
66
}
70
67
}
71
68
72
- // Projects that we publish to Maven
73
- def publishedProjects: Seq[SonatypeCentralPublishModule] =
74
- pluginScalaCrossVersions.filterNot(isScala3).map(plugin.cross(_)) ++ Seq(unipublish)
75
-
76
69
val scalaVersion = scalaCrossVersions.head
77
70
val jmhVersion = "1.37"
78
71
val osLib = mvn"com.lihaoyi::os-lib:0.10.7" // 0.11 requires Java 11
@@ -366,63 +359,3 @@ trait Chisel extends CrossSbtModule with HasScala2MacroAnno with HasScalaPlugin
366
359
}
367
360
368
361
object unipublish extends Unipublish
369
-
370
- /** Tasks for publishing to Sonatype */
371
- object publish extends Module {
372
-
373
- def getEnvVar(name: String) = Task.Command {
374
- Task.env.get(name) match {
375
- case Some(value) => Result.Success(value)
376
- case None => Result.Failure(s"Must define environment variable $name")
377
- }
378
- }
379
-
380
- def sonatypeCredentials: Task[SonatypeCredentials] = Task.Anon {
381
- val username = getEnvVar("MAVEN_CENTRAL_USERNAME")()
382
- val password = getEnvVar("MAVEN_CENTRAL_PASSWORD")()
383
- SonatypeCredentials(username, password)
384
- }
385
-
386
- def importPgp = Task.Anon {
387
- val secret = getEnvVar("PGP_SECRET")()
388
- os.call(
389
- ("gpg", "--import", "--no-tty", "--batch", "--yes"),
390
- stdin = java.util.Base64.getDecoder.decode(secret)
391
- )
392
- }
393
-
394
- // We can't directly use mill.scalalib.SonatypeCentralPublishModule.publishAll because
395
- // there's no easy way to programmatically pick which Modules to publish, and
396
- // we don't want to publish everything.
397
- // We aren't yet publishing Scala 3 cross-builds nor the CIRCT bindings.
398
- def publishAll(): Command[Unit] = Task.Command {
399
- val artifacts: Seq[(Seq[(os.Path, String)], Artifact)] =
400
- Task.traverse(v.publishedProjects)(_.publishArtifacts)().map { case PublishModule.PublishData(a, s) =>
401
- (s.map { case (p, f) => (p.path, f) }, a)
402
- }
403
- // unipublish is the main Chisel artifact, use it to make bundle name
404
- val PublishModule.PublishData(Artifact(group, id, version), _) = unipublish.publishArtifacts()
405
- val bundleName = Some(s"$group.$id-$version")
406
-
407
- val sonatypeCreds = sonatypeCredentials()
408
- // Import GPG, this is mutating the environment
409
- importPgp()
410
- val pgpPass = getEnvVar("PGP_PASSPHRASE")()
411
- val gpgArgs = PublishModule.defaultGpgArgsForPassphrase(Some(pgpPass))
412
-
413
- new SonatypeCentralPublisher(
414
- sonatypeCreds,
415
- gpgArgs,
416
- readTimeout = 10 * 60 * 1000,
417
- connectTimeout = 10 * 1000,
418
- Task.log,
419
- BuildCtx.workspaceRoot,
420
- Task.env,
421
- awaitTimeout = 10 * 60 * 1000
422
- ).publishAll(
423
- publishingType = PublishingType.USER_MANAGED, // confirm in UI
424
- singleBundleName = bundleName,
425
- artifacts*
426
- )
427
- }
428
- }
0 commit comments