Move injecting Main-Class manifest attr logic from doFirst into copy#1724
Merged
Move injecting Main-Class manifest attr logic from doFirst into copy#1724
Main-Class manifest attr logic from doFirst into copy#1724Conversation
03c6338 to
7a8ca11
Compare
1 task
…-prop # Conflicts: # src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowApplicationPlugin.kt
…ks/ShadowJar.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR moves the injection of the Main-Class manifest attribute from the doFirst task action to the copy phase and introduces a dedicated mainClass property on the ShadowJar task. This refactoring provides a more direct API for setting the main class while maintaining backward compatibility with existing plugin integrations.
Key changes:
- Adds a new
mainClassproperty to theShadowJartask with CLI option support - Moves main class injection logic from
doFirstinto theinjectManifestAttributes()method called during the copy phase - Updates
ShadowApplicationPluginandShadowKmpPluginto use the new property instead of manualdoFirstconfiguration
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ShadowJar.kt | Adds mainClass property and moves injection logic to injectManifestAttributes() method |
| ShadowKmpPlugin.kt | Replaces manual doFirst logic with mainClass property convention |
| ShadowApplicationPlugin.kt | Replaces manual doFirst logic with mainClass property convention |
| JavaPluginsTest.kt | Adds comprehensive tests for new mainClass property functionality |
| ApplicationPluginTest.kt | Updates tests to verify new main class override behavior |
| lint-baseline.xml | Updates line number references due to code changes |
| README.md | Documents the new --main-class CLI option |
| changes/README.md | Documents the new feature and breaking change |
| shadow.api | Updates public API with new getMainClass() method |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.