Skip to content
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

Fix - swap scala version and platform in artifact name for Scala.js #1443

Merged
merged 1 commit into from Oct 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -436,11 +436,11 @@ object Publish extends ScalaCommand[PublishOptions] with BuildCommandHelpers {
build.artifacts.scalaOpt.map(_.params) match {
case Some(scalaParams) =>
val pf = publishOptions.scalaPlatformSuffix.getOrElse {
// FIXME Allow full cross version too
"_" + scalaParams.scalaBinaryVersion
scalaParams.platform.fold("")("_" + _)
}
val sv = publishOptions.scalaVersionSuffix.getOrElse {
scalaParams.platform.fold("")("_" + _)
// FIXME Allow full cross version too
"_" + scalaParams.scalaBinaryVersion
}
name + pf + sv
case None =>
Expand Down
Expand Up @@ -43,6 +43,8 @@ abstract class PublishTestDefinitions(val scalaVersionOpt: Option[String])
else "_" + actualScalaVersion.split('.').take(2).mkString(".")
val expectedArtifactsDir: RelPath =
os.rel / "org" / "virtuslab" / "scalacli" / "test" / s"simple$scalaSuffix" / "0.2.0-SNAPSHOT"
val expectedJsArtifactsDir: RelPath =
os.rel / "org" / "virtuslab" / "scalacli" / "test" / s"simple_sjs1$scalaSuffix" / "0.2.0-SNAPSHOT"
}

test("simple") {
Expand Down Expand Up @@ -145,6 +147,48 @@ abstract class PublishTestDefinitions(val scalaVersionOpt: Option[String])
}
}

test("artifacts name for scalajs") {
val baseExpectedArtifacts = Seq(
s"simple_sjs1${TestCase.scalaSuffix}-0.2.0-SNAPSHOT.pom",
s"simple_sjs1${TestCase.scalaSuffix}-0.2.0-SNAPSHOT.jar",
s"simple_sjs1${TestCase.scalaSuffix}-0.2.0-SNAPSHOT-javadoc.jar",
s"simple_sjs1${TestCase.scalaSuffix}-0.2.0-SNAPSHOT-sources.jar"
)
val expectedArtifacts = baseExpectedArtifacts
.flatMap { n =>
Seq("", ".md5", ".sha1").map(n + _)
}
.map(os.rel / _)
.toSet

TestCase.testInputs.fromRoot { root =>
os.proc(
TestUtil.cli,
"publish",
extraOptions,
"project",
"--js",
"-R",
"test-repo"
).call(
cwd = root,
stdin = os.Inherit,
stdout = os.Inherit
)

val files = os.walk(root / "test-repo")
.filter(os.isFile(_))
.map(_.relativeTo(root / "test-repo"))
val notInDir = files.filter(!_.startsWith(TestCase.expectedJsArtifactsDir))
expect(notInDir.isEmpty)

val files0 = files.map(_.relativeTo(TestCase.expectedJsArtifactsDir)).toSet

expect((files0 -- expectedArtifacts).isEmpty)
expect((expectedArtifacts -- files0).isEmpty)
}
}

test("custom checksums") {
val baseExpectedArtifacts = Seq(
s"simple${TestCase.scalaSuffix}-0.2.0-SNAPSHOT.pom",
Expand Down