-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2cf9d3c
commit bb46992
Showing
7 changed files
with
245 additions
and
36 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
modules/cli-options/src/main/scala/scala/cli/commands/publish/PublishLocalOptions.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package scala.cli.commands.publish | ||
|
||
import caseapp._ | ||
|
||
import scala.cli.commands.{CompileCrossOptions, MainClassOptions, SharedOptions, SharedWatchOptions} | ||
|
||
// format: off | ||
final case class PublishLocalOptions( | ||
@Recurse | ||
shared: SharedOptions = SharedOptions(), | ||
@Recurse | ||
watch: SharedWatchOptions = SharedWatchOptions(), | ||
@Recurse | ||
compileCross: CompileCrossOptions = CompileCrossOptions(), | ||
@Recurse | ||
mainClass: MainClassOptions = MainClassOptions(), | ||
@Recurse | ||
publishParams: PublishParamsOptions = PublishParamsOptions(), | ||
@Recurse | ||
sharedPublish: SharedPublishOptions = SharedPublishOptions() | ||
) | ||
// format: on | ||
|
||
object PublishLocalOptions { | ||
implicit lazy val parser: Parser[PublishLocalOptions] = Parser.derive | ||
implicit lazy val help: Help[PublishLocalOptions] = Help.derive | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
modules/cli/src/main/scala/scala/cli/commands/publish/PublishLocal.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package scala.cli.commands.publish | ||
|
||
import caseapp.core.RemainingArgs | ||
|
||
import scala.cli.commands.ScalaCommand | ||
import scala.cli.commands.util.SharedOptionsUtil._ | ||
import scala.cli.CurrentParams | ||
import scala.build.BuildThreads | ||
|
||
object PublishLocal extends ScalaCommand[PublishLocalOptions] { | ||
|
||
override def group = "Main" | ||
override def inSipScala = false | ||
override def sharedOptions(options: PublishLocalOptions) = | ||
Some(options.shared) | ||
|
||
override def names = List( | ||
List("publish", "local") | ||
) | ||
|
||
def run(options: PublishLocalOptions, args: RemainingArgs): Unit = { | ||
maybePrintGroupHelp(options) | ||
|
||
CurrentParams.verbosity = options.shared.logging.verbosity | ||
val inputs = options.shared.inputsOrExit(args) | ||
CurrentParams.workspaceOpt = Some(inputs.workspace) | ||
|
||
val logger = options.shared.logger | ||
val initialBuildOptions = Publish.mkBuildOptions( | ||
options.shared, | ||
options.publishParams, | ||
options.sharedPublish, | ||
PublishRepositoryOptions(), | ||
options.mainClass, | ||
None | ||
).orExit(logger) | ||
val threads = BuildThreads.create() | ||
|
||
val compilerMaker = options.shared.compilerMaker(threads) | ||
val docCompilerMaker = options.shared.compilerMaker(threads, scaladoc = true) | ||
|
||
val cross = options.compileCross.cross.getOrElse(false) | ||
|
||
lazy val workingDir = options.sharedPublish.workingDir | ||
.filter(_.trim.nonEmpty) | ||
.map(os.Path(_, os.pwd)) | ||
.getOrElse { | ||
os.temp.dir( | ||
prefix = "scala-cli-publish-", | ||
deleteOnExit = true | ||
) | ||
} | ||
|
||
val ivy2HomeOpt = options.sharedPublish.ivy2Home | ||
.filter(_.trim.nonEmpty) | ||
.map(os.Path(_, os.pwd)) | ||
|
||
Publish.doRun( | ||
inputs, | ||
logger, | ||
initialBuildOptions, | ||
compilerMaker, | ||
docCompilerMaker, | ||
cross, | ||
workingDir, | ||
ivy2HomeOpt, | ||
publishLocal = true, | ||
options.watch.watch | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.