Skip to content

Add Automatic-Module-Names to MANIFEST.MF files of projects with suffix_3 #12903

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

Merged
merged 2 commits into from
Jun 24, 2021
Merged
Changes from 1 commit
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
64 changes: 54 additions & 10 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,18 @@ object Build {
def dottyCompilerSettings(implicit mode: Mode): sbt.Def.SettingsDefinition =
if (mode == NonBootstrapped) nonBootstrapedDottyCompilerSettings else bootstrapedDottyCompilerSettings

lazy val `scala3-compiler` = project.in(file("compiler")).asDottyCompiler(NonBootstrapped)
lazy val `scala3-compiler-bootstrapped` = project.in(file("compiler")).asDottyCompiler(Bootstrapped)

lazy val `scala3-compiler` = project.in(file("compiler")).
asDottyCompiler(NonBootstrapped).
settings(
Compile / packageBin / packageOptions +=
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://docs.oracle.com/javase/specs/jls/se16/html/jls-7.html#jls-7.7:

A module name consists of one or more Java identifiers (§3.8) separated by "." tokens.

A java identifier can't have a - in its name, so I don't think this is a valid name, use a . instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, you probably need to replaceAll("-", ".") to handle the "-" in the project names.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also instead of name I think we should use moduleName, that's what shows up in the pom in the end.

)
lazy val `scala3-compiler-bootstrapped` = project.in(file("compiler")).
asDottyCompiler(Bootstrapped).
settings(
Compile / packageBin / packageOptions +=
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
)
def dottyCompiler(implicit mode: Mode): Project = mode match {
case NonBootstrapped => `scala3-compiler`
case Bootstrapped => `scala3-compiler-bootstrapped`
Expand All @@ -767,8 +776,18 @@ object Build {
),
)

lazy val `scala3-library` = project.in(file("library")).asDottyLibrary(NonBootstrapped)
lazy val `scala3-library-bootstrapped`: Project = project.in(file("library")).asDottyLibrary(Bootstrapped)
lazy val `scala3-library` = project.in(file("library")).
asDottyLibrary(NonBootstrapped).
settings(
Compile / packageBin / packageOptions +=
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
)
lazy val `scala3-library-bootstrapped`: Project = project.in(file("library")).
asDottyLibrary(Bootstrapped).
settings(
Compile / packageBin / packageOptions +=
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
)

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

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

lazy val `tasty-core` = project.in(file("tasty")).asTastyCore(NonBootstrapped)
lazy val `tasty-core-bootstrapped`: Project = project.in(file("tasty")).asTastyCore(Bootstrapped)
lazy val `tasty-core-scala2`: Project = project.in(file("tasty")).asTastyCoreScala2
lazy val `tasty-core` = project.in(file("tasty")).
asTastyCore(NonBootstrapped).
settings(
Compile / packageBin / packageOptions +=
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
)
lazy val `tasty-core-bootstrapped`: Project = project.in(file("tasty")).
asTastyCore(Bootstrapped).
settings(
Compile / packageBin / packageOptions +=
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
)
lazy val `tasty-core-scala2`: Project = project.in(file("tasty")).
asTastyCoreScala2.
settings(
Compile / packageBin / packageOptions +=
Package.ManifestAttributes("Automatic-Module-Name" -> s"$dottyOrganization-${name.value}")
)

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

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

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

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

Expand Down