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

Add version to jar manifest and read at runtime for SDK version header #22

Merged
merged 3 commits into from
Feb 24, 2024

Conversation

albertchae
Copy link
Collaborator

Add version to the jar manifest and read from that to send the SDK version header

https://docs.gradle.org/current/samples/sample_building_kotlin_libraries.html#customize_the_library_jar

https://stackoverflow.com/a/43065467

To avoid unnecessarily reading from the manifest file, we store the value in a companion object which
should have the effect of making it a singleton.

An alternative using java properties was considered based on https://stackoverflow.com/a/70088083, but
the jar manifest seems more appropriate

- add version to build.gradle.kts
- create a version properties file at build time that can be read in app

Following example from https://stackoverflow.com/a/70088083
https://docs.gradle.org/current/samples/sample_building_kotlin_libraries.html#customize_the_library_jar

https://stackoverflow.com/a/43065467

Add getVersion to a companion object on `Version`, which I believe means
the version should only be read from the manifest file once.
Copy link
Collaborator

@KiKoS0 KiKoS0 left a comment

Choose a reason for hiding this comment

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

LGTM

@albertchae albertchae merged commit 79a0220 into main Feb 24, 2024
7 checks passed
@albertchae albertchae deleted the build-version branch February 24, 2024 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants