Skip to content

Commit

Permalink
Merge pull request #1003 from alexarchambault/publish-maven-central
Browse files Browse the repository at this point in the history
Allow to publish to Maven Central in publish command
  • Loading branch information
alexarchambault authored May 11, 2022
2 parents 555dc0c + 0217c31 commit 9b46e97
Show file tree
Hide file tree
Showing 15 changed files with 363 additions and 149 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package scala.cli.commands.publish

import caseapp._

import scala.cli.commands.{CompileCrossOptions, MainClassOptions, SharedOptions, SharedWatchOptions}
import scala.cli.signing.shared.PasswordOption
import scala.cli.signing.util.ArgParsers._

// format: off
final case class PublishOptions(
@Recurse
shared: SharedOptions = SharedOptions(),
@Recurse
watch: SharedWatchOptions = SharedWatchOptions(),
@Recurse
compileCross: CompileCrossOptions = CompileCrossOptions(),
@Recurse
mainClass: MainClassOptions = MainClassOptions(),
@Recurse
sharedPublish: SharedPublishOptions = SharedPublishOptions(),

@Group("Publishing")
@HelpMessage("Directory where temporary files for publishing should be written")
@Hidden
workingDir: Option[String] = None,

@Group("Publishing")
@Hidden
@HelpMessage("Scala version suffix to append to the module name, like \"_2.13\" or \"_3\"")
@ValueDescription("suffix")
scalaVersionSuffix: Option[String] = None,
@Group("Publishing")
@Hidden
@HelpMessage("Scala platform suffix to append to the module name, like \"_sjs1\" or \"_native0.4\"")
@ValueDescription("suffix")
scalaPlatformSuffix: Option[String] = None,

@Group("Publishing")
@HelpMessage("Whether to build and publish source JARs")
sources: Option[Boolean] = None,

@Group("Publishing")
@HelpMessage("Whether to build and publish doc JARs")
@ExtraName("scaladoc")
@ExtraName("javadoc")
doc: Option[Boolean] = None,

@Group("Publishing")
@HelpMessage("ID of the GPG key to use to sign artifacts")
@ValueDescription("key-id")
@ExtraName("K")
gpgKey: Option[String] = None,

@Group("Publishing")
@HelpMessage("Method to use to sign artifacts")
@ValueDescription("gpg|bc")
signer: Option[String] = None,

@Group("Publishing")
@HelpMessage("gpg command-line options")
@ValueDescription("argument")
@ExtraName("G")
@ExtraName("gpgOpt")
gpgOption: List[String] = Nil
)
// format: on

object PublishOptions {
implicit lazy val parser: Parser[PublishOptions] = Parser.derive
implicit lazy val help: Help[PublishOptions] = Help.derive
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
package scala.cli.commands
package scala.cli.commands.publish

import caseapp._

import scala.cli.signing.shared.PasswordOption
import scala.cli.signing.util.ArgParsers._

// format: off
final case class PublishOptions(
@Recurse
shared: SharedOptions = SharedOptions(),
@Recurse
watch: SharedWatchOptions = SharedWatchOptions(),
@Recurse
compileCross: CompileCrossOptions = CompileCrossOptions(),
@Recurse
mainClass: MainClassOptions = MainClassOptions(),

@Group("Publishing")
@HelpMessage("Directory where temporary files for publishing should be written")
@Hidden
workingDir: Option[String] = None,
final case class SharedPublishOptions(

@Group("Publishing")
@HelpMessage("Organization to publish artifacts under")
Expand Down Expand Up @@ -54,17 +41,6 @@ final case class PublishOptions(
@ValueDescription("id|name|URL|email")
developer: List[String] = Nil,

@Group("Publishing")
@Hidden
@HelpMessage("Scala version suffix to append to the module name, like \"_2.13\" or \"_3\"")
@ValueDescription("suffix")
scalaVersionSuffix: Option[String] = None,
@Group("Publishing")
@Hidden
@HelpMessage("Scala platform suffix to append to the module name, like \"_sjs1\" or \"_native0.4\"")
@ValueDescription("suffix")
scalaPlatformSuffix: Option[String] = None,

@Group("Publishing")
@HelpMessage("Repository to publish to")
@ValueDescription("URL or path")
Expand All @@ -73,47 +49,30 @@ final case class PublishOptions(
publishRepository: Option[String] = None,

@Group("Publishing")
@HelpMessage("Whether to build and publish source JARs")
sources: Option[Boolean] = None,
@HelpMessage("User to use with publishing repository")
@ValueDescription("user")
user: Option[PasswordOption] = None,

@Group("Publishing")
@HelpMessage("Whether to build and publish doc JARs")
@ExtraName("scaladoc")
@ExtraName("javadoc")
doc: Option[Boolean] = None,

@Group("Publishing")
@HelpMessage("ID of the GPG key to use to sign artifacts")
@ValueDescription("key-id")
@ExtraName("K")
gpgKey: Option[String] = None,
@HelpMessage("Password to use with publishing repository")
@ValueDescription("value:…")
password: Option[PasswordOption] = None,

@Group("Publishing")
@HelpMessage("Secret key to use to sign artifacts with BouncyCastle")
@ValueDescription("path")
secretKey: Option[String] = None,
secretKey: Option[PasswordOption] = None,

@Group("Publishing")
@HelpMessage("Password of secret key to use to sign artifacts with BouncyCastle")
@ValueDescription("value:…")
@ExtraName("secretKeyPass")
secretKeyPassword: Option[PasswordOption] = None,
secretKeyPassword: Option[PasswordOption] = None

@Group("Publishing")
@HelpMessage("Method to use to sign artifacts")
@ValueDescription("gpg|bc")
signer: Option[String] = None,

@Group("Publishing")
@HelpMessage("gpg command-line options")
@ValueDescription("argument")
@ExtraName("G")
@ExtraName("gpgOpt")
gpgOption: List[String] = Nil
)
// format: on

object PublishOptions {
implicit lazy val parser: Parser[PublishOptions] = Parser.derive
implicit lazy val help: Help[PublishOptions] = Help.derive
object SharedPublishOptions {
lazy val parser: Parser[SharedPublishOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[SharedPublishOptions, parser.D] = parser
implicit lazy val help: Help[SharedPublishOptions] = Help.derive
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
final class BouncycastleSignerMakerSubst {

@Substitute
Signer get(PasswordOption passwordOrNull, Path secretKey, Supplier<Path> launcher, Logger logger) {
Signer get(PasswordOption passwordOrNull, PasswordOption secretKey, Supplier<Path> launcher, Logger logger) {
return BouncycastleExternalSigner$.MODULE$.apply(secretKey, passwordOrNull, launcher.get(), logger);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import scala.cli.commands._
import scala.cli.commands.bloop.BloopOutput
import scala.cli.commands.github.{SecretCreate, SecretList}
import scala.cli.commands.pgp.{PgpCommands, PgpCommandsSubst}
import scala.cli.commands.publish.Publish

class ScalaCliCommands(
val progName: String,
Expand Down
Loading

0 comments on commit 9b46e97

Please sign in to comment.