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

JVM: merge manifests of shaded libraries instead of overwriting them when packing benchmarks jar #274

Open
fzhinkin opened this issue Nov 6, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@fzhinkin
Copy link
Contributor

fzhinkin commented Nov 6, 2024

Currently, JVM's Jar task responsible for generating executable benchmarks jar generates a brand new manifest that includes only a main-class attribute.

Depending on shaded libraries, that might be an issue. For example, if one of the libraries bundled into a resulting jar was a MR-JAR, the resulting manifest will be missing multi-release: true attribute and target-specific code will never be invoked (and that's a problem if you're actually trying to benchmark MR-related functionality ;) ).

It would be nice to merge manifests when generating a jar, like Maven Shade's AppendingTransformer does.

@fzhinkin fzhinkin added the enhancement New feature or request label Nov 6, 2024
@fzhinkin
Copy link
Contributor Author

fzhinkin commented Nov 6, 2024

As a workaround, one can update a config of existing Jar task to add required attributes:

afterEvaluate {
    tasks.named("jvmBenchmarkJar").configure {
        this as org.gradle.jvm.tasks.Jar
        manifest {
            attributes("Multi-Release" to true)
        }
    }
}

Besides looking like a hack, the workaround requires to spot the issue in the first place (and that might not be obvious).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant