@@ -269,6 +269,13 @@ object Build {
269
269
// If someone puts a source file at the root (e.g., for manual testing),
270
270
// don't pick it up as part of any project.
271
271
sourcesInBase := false ,
272
+
273
+ // For compatibility with Java 9+ module system;
274
+ // without Automatic-Module-Name, the module name is derived from the jar file which is invalid because of the _3 suffix.
275
+ Compile / packageBin / packageOptions +=
276
+ Package .ManifestAttributes (
277
+ " Automatic-Module-Name" -> s " ${dottyOrganization.replaceAll(" -" ," ." )}. ${moduleName.value.replaceAll(" -" ," ." )}"
278
+ )
272
279
)
273
280
274
281
// Settings used for projects compiled only with Java
@@ -751,18 +758,9 @@ object Build {
751
758
def dottyCompilerSettings (implicit mode : Mode ): sbt.Def .SettingsDefinition =
752
759
if (mode == NonBootstrapped ) nonBootstrapedDottyCompilerSettings else bootstrapedDottyCompilerSettings
753
760
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
- )
761
+ lazy val `scala3-compiler` = project.in(file(" compiler" )).asDottyCompiler(NonBootstrapped )
762
+ lazy val `scala3-compiler-bootstrapped` = project.in(file(" compiler" )).asDottyCompiler(Bootstrapped )
763
+
766
764
def dottyCompiler (implicit mode : Mode ): Project = mode match {
767
765
case NonBootstrapped => `scala3-compiler`
768
766
case Bootstrapped => `scala3-compiler-bootstrapped`
@@ -776,18 +774,8 @@ object Build {
776
774
),
777
775
)
778
776
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
- )
777
+ lazy val `scala3-library` = project.in(file(" library" )).asDottyLibrary(NonBootstrapped )
778
+ lazy val `scala3-library-bootstrapped` : Project = project.in(file(" library" )).asDottyLibrary(Bootstrapped )
791
779
792
780
def dottyLibrary (implicit mode : Mode ): Project = mode match {
793
781
case NonBootstrapped => `scala3-library`
@@ -811,8 +799,6 @@ object Build {
811
799
(" org.scala-js" %% " scalajs-library" % scalaJSVersion).cross(CrossVersion .for3Use2_13),
812
800
Compile / unmanagedSourceDirectories ++=
813
801
(`scala3-library-bootstrapped` / Compile / unmanagedSourceDirectories).value,
814
- Compile / packageBin / packageOptions +=
815
- Package .ManifestAttributes (" Automatic-Module-Name" -> s " $dottyOrganization- ${name.value}" ),
816
802
817
803
// Configure the source maps to point to GitHub for releases
818
804
scalacOptions ++= {
@@ -834,24 +820,9 @@ object Build {
834
820
scalacOptions += " -source:3.0-migration"
835
821
)
836
822
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
- )
823
+ lazy val `tasty-core` = project.in(file(" tasty" )).asTastyCore(NonBootstrapped )
824
+ lazy val `tasty-core-bootstrapped` : Project = project.in(file(" tasty" )).asTastyCore(Bootstrapped )
825
+ lazy val `tasty-core-scala2` : Project = project.in(file(" tasty" )).asTastyCoreScala2
855
826
856
827
def tastyCore (implicit mode : Mode ): Project = mode match {
857
828
case NonBootstrapped => `tasty-core`
@@ -865,9 +836,7 @@ object Build {
865
836
// but we always need it to be present on the JVM classpath at runtime.
866
837
dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
867
838
settings(
868
- javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
869
- Compile / packageBin / packageOptions +=
870
- Package .ManifestAttributes (" Automatic-Module-Name" -> s " $dottyOrganization- ${name.value}" )
839
+ javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value
871
840
)
872
841
873
842
lazy val `scala3-tasty-inspector` = project.in(file(" tasty-inspector" )).
@@ -877,9 +846,7 @@ object Build {
877
846
// but we always need it to be present on the JVM classpath at runtime.
878
847
dependsOn(dottyCompiler(Bootstrapped ) % " provided; compile->runtime; test->test" ).
879
848
settings(
880
- javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
881
- Compile / packageBin / packageOptions +=
882
- Package .ManifestAttributes (" Automatic-Module-Name" -> s " $dottyOrganization- ${name.value}" )
849
+ javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value
883
850
)
884
851
885
852
/** Scala library compiled by dotty using the latest published sources of the library */
@@ -1039,8 +1006,6 @@ object Build {
1039
1006
// Work around https://github.com/eclipse/lsp4j/issues/295
1040
1007
dependencyOverrides += " org.eclipse.xtend" % " org.eclipse.xtend.lib" % " 2.16.0" ,
1041
1008
javaOptions := (`scala3-compiler-bootstrapped` / javaOptions).value,
1042
- Compile / packageBin / packageOptions +=
1043
- Package .ManifestAttributes (" Automatic-Module-Name" -> s " $dottyOrganization- ${name.value}" ),
1044
1009
1045
1010
run := Def .inputTaskDyn {
1046
1011
val inputArgs = spaceDelimited(" <arg>" ).parsed
@@ -1344,8 +1309,6 @@ object Build {
1344
1309
Compile / mainClass := Some (" dotty.tools.scaladoc.Main" ),
1345
1310
Compile / buildInfoKeys := Seq [BuildInfoKey ](version),
1346
1311
Compile / buildInfoPackage := " dotty.tools.scaladoc" ,
1347
- Compile / packageBin / packageOptions +=
1348
- Package .ManifestAttributes (" Automatic-Module-Name" -> s " $dottyOrganization- ${name.value}" ),
1349
1312
BuildInfoPlugin .buildInfoScopedSettings(Compile ),
1350
1313
BuildInfoPlugin .buildInfoDefaultSettings,
1351
1314
0 commit comments