Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to publish to Maven Central in publish command #1003

Merged
merged 6 commits into from
May 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -8,6 +8,7 @@ import java.nio.file.InvalidPathException
import scala.cli.commands._
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