Skip to content

Replace JavaJarExec with JavaExec#1197

Merged
Goooler merged 8 commits intomainfrom
g/20250126/remove-java-jar-exec
Jan 29, 2025
Merged

Replace JavaJarExec with JavaExec#1197
Goooler merged 8 commits intomainfrom
g/20250126/remove-java-jar-exec

Conversation

@Goooler
Copy link
Copy Markdown
Member

@Goooler Goooler commented Jan 26, 2025


  • CHANGELOG's "Unreleased" section has been updated, if applicable.

@Goooler Goooler requested a review from Copilot January 26, 2025 06:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 6 changed files in this pull request and generated no comments.

Files not reviewed (4)
  • api/shadow.api: Language not supported
  • src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt: Language not supported
  • src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/ShadowApplicationPlugin.kt: Language not supported
  • src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks/JavaJarExec.kt: Language not supported

@Goooler Goooler enabled auto-merge (squash) January 26, 2025 06:31
@Goooler Goooler disabled auto-merge January 26, 2025 06:32
Comment on lines -51 to +56
it.mainClass.set("-jar")
it.classpath(jarFile)
it.mainClass.set(javaApplication.mainClass)
Copy link
Copy Markdown
Member Author

@Goooler Goooler Jan 26, 2025

Choose a reason for hiding this comment

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

Set mainClass from javaApplication.mainClass instead of -jar and make sure the jarFile is in classpath, so that we can get rid of the args appending logic in

val allArgs = buildList {
add(jarFile.get().asFile.path)
// Must cast args to List<String> here to avoid type mismatch.
addAll(args as List<String>)
}
setArgs(allArgs)

Also, eliminates doFirst logic in 2900592.

@Goooler
Copy link
Copy Markdown
Member Author

Goooler commented Jan 26, 2025

@ljacomet Can you take a review for this? I noticed you did some adoption in #576.

…a-jar-exec

// Conflicts:
//	src/functionalTest/kotlin/com/github/jengelman/gradle/plugins/shadow/ApplicationPluginTest.kt
@Goooler Goooler force-pushed the g/20250126/remove-java-jar-exec branch from 0c4472d to 6aa5c44 Compare January 29, 2025 02:12
@Goooler Goooler enabled auto-merge (squash) January 29, 2025 02:36
@Goooler Goooler disabled auto-merge January 29, 2025 02:36
@Goooler Goooler enabled auto-merge (squash) January 29, 2025 02:37
@Goooler Goooler merged commit 3663571 into main Jan 29, 2025
@Goooler Goooler deleted the g/20250126/remove-java-jar-exec branch January 29, 2025 02:41
@Goooler
Copy link
Copy Markdown
Member Author

Goooler commented Jan 29, 2025

The newly added test in #1214 passed both before and after this change, so everything looks good.

Feel free to have a post review.

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