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

Setting JAR manifest encoding doesn't work with configuration cache #31838

Open
mlopatkin opened this issue Dec 19, 2024 · 1 comment
Open

Setting JAR manifest encoding doesn't work with configuration cache #31838

mlopatkin opened this issue Dec 19, 2024 · 1 comment
Labels
a:bug in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures

Comments

@mlopatkin
Copy link
Member

Current Behavior

The specified manifest encoding on the Jar task is ignored when configuration cache is enabled

Expected Behavior

The same specified encoding is used regardless of CC state

Context (optional)

No response

Self-contained Reproducer Project

See this test:

task jar(type: Jar) {
    from file('test')
    destinationDirectory = file('dest')
    archiveFileName = 'test.jar'
    manifestContentCharset = 'ISO-8859-15'
    manifest {
        attributes 'moji': 'bak€'
    }
}

Gradle version

8.12, though it likely never worked properly

Build scan URL (optional)

No response

Your Environment (optional)

No response

@mlopatkin
Copy link
Member Author

Jar task configures the manifest in a very contrived way, and the configured encoding is propagated as a side effect of saving when CC is in play:

  1. There is a Cached instance in the copy spec file collection
  2. It sets the encoding when computing the manifest

However, this set goes nowhere, because the same Manifest is referenced by the manifest field of the task. By the time we get to serializing the file collection, the field has been processed and the manifest has been serialized - with default encoding. Thus upon restoring from cache, the modification is lost.

@ov7a ov7a added in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures and removed to-triage labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:bug in:java-plugins java-library, java, java-base, java-platform, java-test-fixtures
Projects
None yet
Development

No branches or pull requests

2 participants