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

Plugin doesn't work with mrjars #225

Open
Sineaggi opened this issue Sep 18, 2022 · 0 comments
Open

Plugin doesn't work with mrjars #225

Sineaggi opened this issue Sep 18, 2022 · 0 comments

Comments

@Sineaggi
Copy link

Describe the bug
The jmhJar task is currently unaware of mrjars. If you have a dependency on an mrjar, or you use the me.champeau.mrjar plugin, the jmhJar task does not include the Multi-Release attribute.

To Reproduce
Steps to reproduce the behavior:

  1. Use mr jar
  2. Change e.g. java toolchain jmh was run with
  3. Observe no change in classes loaded

Requires mrjar dependency when testing compatibility with mrjar plugin

dependencies {
    "pluginsUnderTest"("me.champeau.gradle.mrjar:plugin:0.1.1")
}

Test can be added to JMHPluginTest.groovy

    void "manifest includes multi release attribute"() {
        when:
        Project project = ProjectBuilder.builder().build()
        project.repositories {
            mavenCentral()
        }
        project.apply plugin: 'java'
        project.apply plugin: 'me.champeau.jmh'
        project.apply plugin: 'me.champeau.mrjar'

        project.multiRelease {
            targetVersions(8, 17)
        }

        then:
        // regular jar task contains 'Multi-Release' attribute
        def jar = project.tasks.findByName('jar')
        'Multi-Release' in jar.manifest.attributes

        // jmhJar task does not contain 'Multi-Release' attribute
        def task = project.tasks.findByName('jmhJar')
        'Multi-Release' in task.manifest.attributes
    }

A proper fix might also need to look through the manifests of other jars for Multi-Release attribute.

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

No branches or pull requests

1 participant