Skip to content

Commit 55c2325

Browse files
Add Automatic-Module-Names to MANIFEST.MF files of projects with suffix _3
The issue is described in #12899 In this PR I decided to add `Automatic-Module-Name` values only to projects with the suffix _3, that is: 1. scala3-compiler_3 2. scala3-library_3 3. scala3-library-sjs1_3 4. scala3-language-server_3 5. scala3-staging_3 6. scala3-tasty-inspector_3 7. scaladoc_3 8. tasty-core_3 and for consistency also tasty-core-scala2. The values are derived from dottyOrganization + the project name.
1 parent 8c18a71 commit 55c2325

File tree

1 file changed

+54
-10
lines changed

1 file changed

+54
-10
lines changed

project/Build.scala

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -751,9 +751,18 @@ object Build {
751751
def dottyCompilerSettings(implicit mode: Mode): sbt.Def.SettingsDefinition =
752752
if (mode == NonBootstrapped) nonBootstrapedDottyCompilerSettings else bootstrapedDottyCompilerSettings
753753

754-
lazy val `scala3-compiler` = project.in(file("compiler")).asDottyCompiler(NonBootstrapped)
755-
lazy val `scala3-compiler-bootstrapped` = project.in(file("compiler")).asDottyCompiler(Bootstrapped)
756-
754+
lazy val `scala3-compiler` = project.in(file("compiler")).
755+
asDottyCompiler(NonBootstrapped).
756+
settings(
757+
Compile / packageBin / packageOptions +=
758+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
759+
)
760+
lazy val `scala3-compiler-bootstrapped` = project.in(file("compiler")).
761+
asDottyCompiler(Bootstrapped).
762+
settings(
763+
Compile / packageBin / packageOptions +=
764+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
765+
)
757766
def dottyCompiler(implicit mode: Mode): Project = mode match {
758767
case NonBootstrapped => `scala3-compiler`
759768
case Bootstrapped => `scala3-compiler-bootstrapped`
@@ -767,8 +776,18 @@ object Build {
767776
),
768777
)
769778

770-
lazy val `scala3-library` = project.in(file("library")).asDottyLibrary(NonBootstrapped)
771-
lazy val `scala3-library-bootstrapped`: Project = project.in(file("library")).asDottyLibrary(Bootstrapped)
779+
lazy val `scala3-library` = project.in(file("library")).
780+
asDottyLibrary(NonBootstrapped).
781+
settings(
782+
Compile / packageBin / packageOptions +=
783+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
784+
)
785+
lazy val `scala3-library-bootstrapped`: Project = project.in(file("library")).
786+
asDottyLibrary(Bootstrapped).
787+
settings(
788+
Compile / packageBin / packageOptions +=
789+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
790+
)
772791

773792
def dottyLibrary(implicit mode: Mode): Project = mode match {
774793
case NonBootstrapped => `scala3-library`
@@ -792,6 +811,8 @@ object Build {
792811
("org.scala-js" %% "scalajs-library" % scalaJSVersion).cross(CrossVersion.for3Use2_13),
793812
Compile / unmanagedSourceDirectories ++=
794813
(`scala3-library-bootstrapped` / Compile / unmanagedSourceDirectories).value,
814+
Compile / packageBin / packageOptions +=
815+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}"),
795816

796817
// Configure the source maps to point to GitHub for releases
797818
scalacOptions ++= {
@@ -813,9 +834,24 @@ object Build {
813834
scalacOptions += "-source:3.0-migration"
814835
)
815836

816-
lazy val `tasty-core` = project.in(file("tasty")).asTastyCore(NonBootstrapped)
817-
lazy val `tasty-core-bootstrapped`: Project = project.in(file("tasty")).asTastyCore(Bootstrapped)
818-
lazy val `tasty-core-scala2`: Project = project.in(file("tasty")).asTastyCoreScala2
837+
lazy val `tasty-core` = project.in(file("tasty")).
838+
asTastyCore(NonBootstrapped).
839+
settings(
840+
Compile / packageBin / packageOptions +=
841+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
842+
)
843+
lazy val `tasty-core-bootstrapped`: Project = project.in(file("tasty")).
844+
asTastyCore(Bootstrapped).
845+
settings(
846+
Compile / packageBin / packageOptions +=
847+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
848+
)
849+
lazy val `tasty-core-scala2`: Project = project.in(file("tasty")).
850+
asTastyCoreScala2.
851+
settings(
852+
Compile / packageBin / packageOptions +=
853+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
854+
)
819855

820856
def tastyCore(implicit mode: Mode): Project = mode match {
821857
case NonBootstrapped => `tasty-core`
@@ -829,7 +865,9 @@ object Build {
829865
// but we always need it to be present on the JVM classpath at runtime.
830866
dependsOn(dottyCompiler(Bootstrapped) % "provided; compile->runtime; test->test").
831867
settings(
832-
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value
868+
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
869+
Compile / packageBin / packageOptions +=
870+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
833871
)
834872

835873
lazy val `scala3-tasty-inspector` = project.in(file("tasty-inspector")).
@@ -839,7 +877,9 @@ object Build {
839877
// but we always need it to be present on the JVM classpath at runtime.
840878
dependsOn(dottyCompiler(Bootstrapped) % "provided; compile->runtime; test->test").
841879
settings(
842-
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value
880+
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
881+
Compile / packageBin / packageOptions +=
882+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
843883
)
844884

845885
/** Scala library compiled by dotty using the latest published sources of the library */
@@ -999,6 +1039,8 @@ object Build {
9991039
// Work around https://github.com/eclipse/lsp4j/issues/295
10001040
dependencyOverrides += "org.eclipse.xtend" % "org.eclipse.xtend.lib" % "2.16.0",
10011041
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1042+
Compile / packageBin / packageOptions +=
1043+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}"),
10021044

10031045
run := Def.inputTaskDyn {
10041046
val inputArgs = spaceDelimited("<arg>").parsed
@@ -1302,6 +1344,8 @@ object Build {
13021344
Compile / mainClass := Some("dotty.tools.scaladoc.Main"),
13031345
Compile / buildInfoKeys := Seq[BuildInfoKey](version),
13041346
Compile / buildInfoPackage := "dotty.tools.scaladoc",
1347+
Compile / packageBin / packageOptions +=
1348+
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}"),
13051349
BuildInfoPlugin.buildInfoScopedSettings(Compile),
13061350
BuildInfoPlugin.buildInfoDefaultSettings,
13071351

0 commit comments

Comments
 (0)