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

packaged artifact names changed in 1.0.0-RC3 #3388

Closed
muuki88 opened this issue Jul 29, 2017 · 3 comments
Closed

packaged artifact names changed in 1.0.0-RC3 #3388

muuki88 opened this issue Jul 29, 2017 · 3 comments

Comments

@muuki88
Copy link
Contributor

muuki88 commented Jul 29, 2017

steps

  • checkout sbt-native-packager on branch wip/cross-build-sbt-1.0
  • Set version ; ++2.12.2 ; ^^1.0.0-RC3
  • Run scripted jar/* tests

problem

The jar file names should contain the organization, but it is missing.
All tests in the jar/* folder check the MANIFEST.MF that the classpath
has all necessary jars.

The error message indicates that the names have changed:

java.lang.AssertionError: assertion failed: 
MANIFEST Class-Path should contain com.typesafe.config:
[info] [error] launcher-jar-test.launcher-jar-test-0.1.0.jar launcher-jar-test_2.12-0.1.0.jar scala-library.jar config-1.3.1.jar

Instead I have config-1.3.1.jar.

( the actual log shows 'akka-actor', which is simply wrong output. I'm fixing that in the next commits )

expectation

The exported jars contain the organization and normalizedName.

notes

sbt version: 1.0.0-RC3

@eed3si9n
Copy link
Member

This is 0.13's artifactName https://github.com/sbt/sbt-zero-thirteen/blob/0.13/ivy/src/main/scala/sbt/Artifact.scala#L80-L87:

 def artifactName(scalaVersion: ScalaVersion, module: ModuleID, artifact: Artifact): String =
    {
      import artifact._
      val classifierStr = classifier match { case None => ""; case Some(c) => "-" + c }
      val cross = CrossVersion(module.crossVersion, scalaVersion.full, scalaVersion.binary)
      val base = CrossVersion.applyCross(artifact.name, cross)
      base + "-" + module.revision + classifierStr + "." + artifact.extension
    }

@muuki88
Copy link
Contributor Author

muuki88 commented Aug 5, 2017

Thanks @eed3si9n :)

I found the responsible lines in native-packager that cause this regression:
https://github.com/sbt/sbt-native-packager/blob/master/src/main/scala/com/typesafe/sbt/packager/archetypes/JavaAppPackaging.scala#L103-L109

private def getJarFullFilename(dep: Attributed[File]): String = {
  val filename: Option[String] = for {
    module <- dep.metadata.get(AttributeKey[ModuleID]("module-id"))
    artifact <- dep.metadata.get(AttributeKey[Artifact]("artifact"))
  } yield makeJarName(module.organization, module.name, module.revision, artifact.name, artifact.classifier)
  filename.getOrElse(dep.data.getName)
}

Both dep.metadata calls return None and the dep.data.getName is used as a fallback, which causes the failing tests. I'll take a deeper look on how to fix this for both sbt 0.13.x and 1.x.

@muuki88
Copy link
Contributor Author

muuki88 commented Aug 5, 2017

Turns out that the module-id key was renamed to moduleID which causes the for-comprehension to return None.

@muuki88 muuki88 closed this as completed Aug 5, 2017
muuki88 added a commit to sbt/sbt-native-packager that referenced this issue Aug 5, 2017
muuki88 added a commit to sbt/sbt-native-packager that referenced this issue Aug 7, 2017
muuki88 added a commit to sbt/sbt-native-packager that referenced this issue Aug 10, 2017
* Cross build with sbt 1.0

* Fix travis.yml

* Fix Build.scala scripted tests

* Remove 'provided' scope for jdeb temporarily

* Fix dependencies for scripted tests

* Fix scripted test calls by using packageBin instead of package-bin

* Fix multiproject-classifiers test by using new `withClassifier` method.
This may break 0.13.6 -> add compat for this

* Replace all *** PathFilter calls in scripted tests

* Replace Process with sys.process.Process and add Compat.io import

* Fixing all remaining scripted tests

* Fix jdk-packager script tests

* Fix travis osx oraclejdk8 issue: travis-ci/travis-ci/issues/2316

* Reduce travis ci test matrix

* Update out-dated akka dependency in scripted test

* Replace akka with typesafe config as a dependency test

We need a stable library for scala 2.10 and 2.12. A java lib is
more suitable here.

* Fix wrong task names

* Replace akka with typesafe config as a dependency test

We need a stable library for scala 2.10 and 2.12. A java lib is
more suitable here.

* Polyfill new method `withClassifier` on sbt.Artifact

* Remove jdk definition

* List every test setup explicitly  for travis

* Also set env for the osx build

* Only use java8 for testing and output scripted buffer

* Another approach for travis

* Fix rpm scripted tests

* Rebase and fix newly added test

* Fix debian scripted tests

* Run only the script docker tests which don't require docker

* Fix validateJdkPackager and actually run the jdkpackacker scripts

* Explicitly include all the different envs in travis

* Remove jdkpackager/test-package-image scripted test on travis

* Upgrade to sbt-1.0.0-RC2 and use crossbuil

* Go back to M6 and switch-case the provided dependencies

* Run actual tests on MacOS X

* use sbtVersion in pluginCrossBuild and downgrade to sbt-io M11

* Fix scripted camelCase jdkpackager

* Try to upgrade to 1.0.0-RC2

* Build with 0.13.16

* Upgrade sbt-io

* Fix linting error for ivy configs

* Upgrade to 1.0.0-RC3

* Fix jar names in JavaAppPackaging. See sbt/sbt/issues/3388

* Formatting SettingsHelper

* Adding the correct moduleSettings

See sbt/librarymanagement/issues/154

* Upgrade scalafmt

* Upgrade sbt-release process

* Setting version to 1.2.2-RC1

* Setting version to 1.2.2-SNAPSHOT
littleRoundaer added a commit to littleRoundaer/sbt-native-packager that referenced this issue Jul 19, 2022
* Cross build with sbt 1.0

* Fix travis.yml

* Fix Build.scala scripted tests

* Remove 'provided' scope for jdeb temporarily

* Fix dependencies for scripted tests

* Fix scripted test calls by using packageBin instead of package-bin

* Fix multiproject-classifiers test by using new `withClassifier` method.
This may break 0.13.6 -> add compat for this

* Replace all *** PathFilter calls in scripted tests

* Replace Process with sys.process.Process and add Compat.io import

* Fixing all remaining scripted tests

* Fix jdk-packager script tests

* Fix travis osx oraclejdk8 issue: travis-ci/travis-ci/issues/2316

* Reduce travis ci test matrix

* Update out-dated akka dependency in scripted test

* Replace akka with typesafe config as a dependency test

We need a stable library for scala 2.10 and 2.12. A java lib is
more suitable here.

* Fix wrong task names

* Replace akka with typesafe config as a dependency test

We need a stable library for scala 2.10 and 2.12. A java lib is
more suitable here.

* Polyfill new method `withClassifier` on sbt.Artifact

* Remove jdk definition

* List every test setup explicitly  for travis

* Also set env for the osx build

* Only use java8 for testing and output scripted buffer

* Another approach for travis

* Fix rpm scripted tests

* Rebase and fix newly added test

* Fix debian scripted tests

* Run only the script docker tests which don't require docker

* Fix validateJdkPackager and actually run the jdkpackacker scripts

* Explicitly include all the different envs in travis

* Remove jdkpackager/test-package-image scripted test on travis

* Upgrade to sbt-1.0.0-RC2 and use crossbuil

* Go back to M6 and switch-case the provided dependencies

* Run actual tests on MacOS X

* use sbtVersion in pluginCrossBuild and downgrade to sbt-io M11

* Fix scripted camelCase jdkpackager

* Try to upgrade to 1.0.0-RC2

* Build with 0.13.16

* Upgrade sbt-io

* Fix linting error for ivy configs

* Upgrade to 1.0.0-RC3

* Fix jar names in JavaAppPackaging. See sbt/sbt/issues/3388

* Formatting SettingsHelper

* Adding the correct moduleSettings

See sbt/librarymanagement/issues/154

* Upgrade scalafmt

* Upgrade sbt-release process

* Setting version to 1.2.2-RC1

* Setting version to 1.2.2-SNAPSHOT
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants