@@ -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
@@ -363,63 +356,3 @@ trait Chisel extends CrossSbtModule with HasScala2MacroAnno with HasScalaPlugin
363
356
}
364
357
365
358
object unipublish extends Unipublish
366
-
367
- /** Tasks for publishing to Sonatype */
368
- object publish extends Module {
369
-
370
- def getEnvVar(name: String) = Task.Command {
371
- Task.env.get(name) match {
372
- case Some(value) => Result.Success(value)
373
- case None => Result.Failure(s"Must define environment variable $name")
374
- }
375
- }
376
-
377
- def sonatypeCredentials: Task[SonatypeCredentials] = Task.Anon {
378
- val username = getEnvVar("MAVEN_CENTRAL_USERNAME")()
379
- val password = getEnvVar("MAVEN_CENTRAL_PASSWORD")()
380
- SonatypeCredentials(username, password)
381
- }
382
-
383
- def importPgp = Task.Anon {
384
- val secret = getEnvVar("PGP_SECRET")()
385
- os.call(
386
- ("gpg", "--import", "--no-tty", "--batch", "--yes"),
387
- stdin = java.util.Base64.getDecoder.decode(secret)
388
- )
389
- }
390
-
391
- // We can't directly use mill.scalalib.SonatypeCentralPublishModule.publishAll because
392
- // there's no easy way to programmatically pick which Modules to publish, and
393
- // we don't want to publish everything.
394
- // We aren't yet publishing Scala 3 cross-builds nor the CIRCT bindings.
395
- def publishAll(): Command[Unit] = Task.Command {
396
- val artifacts: Seq[(Seq[(os.Path, String)], Artifact)] =
397
- Task.traverse(v.publishedProjects)(_.publishArtifacts)().map { case PublishModule.PublishData(a, s) =>
398
- (s.map { case (p, f) => (p.path, f) }, a)
399
- }
400
- // unipublish is the main Chisel artifact, use it to make bundle name
401
- val PublishModule.PublishData(Artifact(group, id, version), _) = unipublish.publishArtifacts()
402
- val bundleName = Some(s"$group.$id-$version")
403
-
404
- val sonatypeCreds = sonatypeCredentials()
405
- // Import GPG, this is mutating the environment
406
- importPgp()
407
- val pgpPass = getEnvVar("PGP_PASSPHRASE")()
408
- val gpgArgs = PublishModule.defaultGpgArgsForPassphrase(Some(pgpPass))
409
-
410
- new SonatypeCentralPublisher(
411
- sonatypeCreds,
412
- gpgArgs,
413
- readTimeout = 10 * 60 * 1000,
414
- connectTimeout = 10 * 1000,
415
- Task.log,
416
- BuildCtx.workspaceRoot,
417
- Task.env,
418
- awaitTimeout = 10 * 60 * 1000
419
- ).publishAll(
420
- publishingType = PublishingType.USER_MANAGED, // confirm in UI
421
- singleBundleName = bundleName,
422
- artifacts*
423
- )
424
- }
425
- }
0 commit comments