Skip to content

Commit f03676e

Browse files
authored
Deprecate --src and --sources to disambiguate with --source compiler option (#3412)
* Deprecate `--src` * Deprecate `--sources` * Deprecate `--sources` in publish * Add `--jar-sources` and `--sources-jar` aliases for publish, to match package * Remove deprecated `--sources` references in tests
1 parent 570df62 commit f03676e

File tree

7 files changed

+19
-10
lines changed

7 files changed

+19
-10
lines changed

modules/cli/src/main/scala/scala/cli/commands/package0/PackageOptions.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,12 @@ final case class PackageOptions(
5151
@Name("sourcesJar")
5252
@Name("jarSources")
5353
@Name("sources")
54+
@Tag(tags.deprecated("sources"))
55+
@Name("src")
56+
@Tag(tags.deprecated("src"))
5457
@Tag(tags.restricted)
5558
@Tag(tags.inShortHelp)
56-
src: Boolean = false,
59+
withSources: Boolean = false,
5760
@Group(HelpGroup.Package.toString)
5861
@HelpMessage("Generate a scaladoc JAR rather than an executable JAR")
5962
@ExtraName("scaladoc")
@@ -145,7 +148,7 @@ final case class PackageOptions(
145148
def packageTypeOpt: Option[PackageType] =
146149
forcedPackageTypeOpt.orElse {
147150
if (library) Some(PackageType.LibraryJar)
148-
else if (src) Some(PackageType.SourceJar)
151+
else if (withSources) Some(PackageType.SourceJar)
149152
else if (assembly) Some(
150153
PackageType.Assembly(
151154
addPreamble = preamble,

modules/cli/src/main/scala/scala/cli/commands/publish/Publish.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
104104
val contextualOptions = PublishContextualOptions(
105105
repository = publishRepo.publishRepository.filter(_.trim.nonEmpty),
106106
repositoryIsIvy2LocalLike = ivy2LocalLike,
107-
sourceJar = sharedPublish.sources,
107+
sourceJar = sharedPublish.withSources,
108108
docJar = sharedPublish.doc,
109109
gpgSignatureId = sharedPublish.gpgKey.map(_.trim).filter(_.nonEmpty),
110110
gpgOptions = sharedPublish.gpgOption,

modules/cli/src/main/scala/scala/cli/commands/publish/SharedPublishOptions.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@ final case class SharedPublishOptions(
3030

3131
@Group(HelpGroup.Publishing.toString)
3232
@HelpMessage("Whether to build and publish source JARs")
33+
@Name("sourcesJar")
34+
@Name("jarSources")
35+
@Name("sources")
36+
@Tag(tags.deprecated("sources"))
3337
@Tag(tags.restricted)
3438
@Tag(tags.inShortHelp)
35-
sources: Option[Boolean] = None,
39+
withSources: Option[Boolean] = None,
3640

3741
@Group(HelpGroup.Publishing.toString)
3842
@HelpMessage("Whether to build and publish doc JARs")

modules/integration/src/test/scala/scala/cli/integration/BspTestDefinitions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1712,7 +1712,7 @@ abstract class BspTestDefinitions extends ScalaCliSuite with TestScalaVersionArg
17121712
"--power",
17131713
"package",
17141714
jarSources,
1715-
"--src",
1715+
"--with-sources",
17161716
"-o",
17171717
sourceJarPath,
17181718
extraOptions

modules/integration/src/test/scala/scala/cli/integration/PackageTestDefinitions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ abstract class PackageTestDefinitions extends ScalaCliSuite with TestScalaVersio
869869
test("source JAR") {
870870
val dest = os.rel / "sources.jar"
871871
simpleInputWithScalaAndSc.fromRoot { root =>
872-
os.proc(TestUtil.cli, "--power", "package", extraOptions, ".", "-o", dest, "--src").call(
872+
os.proc(TestUtil.cli, "--power", "package", extraOptions, ".", "-o", dest, "--with-sources").call(
873873
cwd = root,
874874
stdin = os.Inherit,
875875
stdout = os.Inherit

modules/integration/src/test/scala/scala/cli/integration/PublishTestDefinitions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ abstract class PublishTestDefinitions extends ScalaCliSuite with TestScalaVersio
320320
"--power",
321321
"publish",
322322
extraOptions,
323-
"--sources=false",
323+
"--with-sources=false",
324324
"--doc=false",
325325
"--checksum",
326326
"sha-1",

website/docs/reference/cli-options.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -779,9 +779,9 @@ Overwrite the destination file, if it exists
779779

780780
Generate a library JAR rather than an executable JAR
781781

782-
### `--src`
782+
### `--with-sources`
783783

784-
Aliases: `--jar-sources`, `--sources`, `--sources-jar`
784+
Aliases: `--jar-sources`, [deprecated] `--sources`, `--sources-jar`, [deprecated] `--src`
785785

786786
Generate a source JAR rather than an executable JAR
787787

@@ -1035,7 +1035,9 @@ Scala version suffix to append to the module name, like "_2.13" or "_3"
10351035
[Internal]
10361036
Scala platform suffix to append to the module name, like "_sjs1" or "_native0.4"
10371037

1038-
### `--sources`
1038+
### `--with-sources`
1039+
1040+
Aliases: `--jar-sources`, [deprecated] `--sources`, `--sources-jar`
10391041

10401042
Whether to build and publish source JARs
10411043

0 commit comments

Comments
 (0)