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

Generate version.conf file in runtime jar #1132

Merged
merged 4 commits into from
Oct 2, 2020
Merged

Conversation

ennru
Copy link
Member

@ennru ennru commented Oct 1, 2020

Add a version.conf file to make the Akka gRPC version available outside of class files.
This complements the generated akka.grpc.gen.BuildInfo class.

@@ -23,7 +23,7 @@ lazy val codegen = Project(id = akkaGrpcCodegenId, base = file("codegen"))
val file = assembly.value
Assemblies.mkBatAssembly(file)
},
buildInfoKeys ++= BuildInfoKey.ofN(organization, name, version, scalaVersion, sbtVersion),
buildInfoKeys ++= Seq[BuildInfoKey](organization, name, version, scalaVersion, sbtVersion),
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 nice to fix this warning :)

object VersionGenerator {

val settings: Seq[Setting[_]] = inConfig(Compile)(
Seq(resourceGenerators += generateVersion(resourceManaged, _ / "version.conf", """|akka.grpc.version = "%s"
Copy link
Contributor

Choose a reason for hiding this comment

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

OK I guess :)

@raboof
Copy link
Contributor

raboof commented Oct 1, 2020

The generated version.conf files clash when creating an assembly:

[info] [error] java.lang.RuntimeException: deduplicate: different file contents found in the following:
[info] [error] /home/jenkinsakka/.cache/coursier/v1/https/repo1.maven.org/maven2/com/typesafe/akka/akka-actor_2.12/2.5.31/akka-actor_2.12-2.5.31.jar:version.conf
[info] [error] /localhome/jenkinsakka/.ivy2/local/com.lightbend.akka.grpc/akka-grpc-runtime_2.12/1.0.2-4-29bf5f74/jars/akka-grpc-runtime_2.12.jar:version.conf

Of course it is possible to fix this by choosing the 'append' strategy, but since apparently AFAICT we're not doing this yet for any of the other sattelite projects yet, perhaps we should consider if we want to let them clash like this?

@ennru
Copy link
Member Author

ennru commented Oct 1, 2020

Of course it is possible to fix this by choosing the 'append' strategy, but since apparently AFAICT we're not doing this yet for any of the other sattelite projects yet, perhaps we should consider if we want to let them clash like this?

I said the same when we added it to Alpakka Kafka.

akka/alpakka-kafka#1188 (comment)

// Should no longer be needed from Akka 2.6.6, which includes
// d2afff6bfc29baf0fb03f531fbe3af40a97fd39f
assemblyMergeStrategy in assembly := {
assembly / assemblyMergeStrategy := {
case PathList("google", "protobuf", "field_mask.proto") =>
// The only difference is in a comment, so we could also just pick
// one, but we don't need it anyway so better to be deterministic:
MergeStrategy.discard
Copy link
Member Author

Choose a reason for hiding this comment

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

Should I remove this while at it?

Copy link
Contributor

@raboof raboof left a comment

Choose a reason for hiding this comment

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

I'm not really a fan of introducing additional required configuration when creating an assembly.

Where is this version.conf used? Couldn't we choose names so we can avoid name clashes on the classpath?

@ennru
Copy link
Member Author

ennru commented Oct 2, 2020

Thanks for pushing back. I should have done that in the Alpakka Kafka case as well.
I chose a library-unique file name now.

The file is used by other tools when a project produces a fat-jar so that the jar manifest files can't be used to detect the originating version of the libraries.

@raboof raboof merged commit 95eeb15 into akka:master Oct 2, 2020
@ennru ennru deleted the version-conf branch October 2, 2020 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants