Commit 2bcdb85
Fix
Motivation:
':core:shadedClasses' fails when JaCoCo report is enabled by
`-Pcoverage` because `shadedClasses` is only used in the JaCoco task.
```java
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':core:shadedClasses'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:135)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:288)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:133)
...
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.AbstractManagedExecutor$1.run(AbstractManagedExecutor.java:47)
Caused by: org.gradle.api.InvalidUserDataException: Cannot expand ZIP '/home/runner/work/armeria/armeria/core/build/libs/armeria-1.33.3-SNAPSHOT-shaded.jar' as it does not exist.
```
https://github.com/line/armeria/blob/7148df07f3a7fe7cb4640fb1ca761cbaca8b347f/gradle/scripts/lib/java-coverage.gradle#L103
It seems that the `archiveClassifier.set('shaded')` configuration used
when upgrading Gradle 9 is causing the problem.
Based on the following two configurations, the path of archiveFile
becomes `<artifact>-untrimmed-<version>-shaded.jar`.
https://github.com/line/armeria/blob/7148df07f3a7fe7cb4640fb1ca761cbaca8b347f/gradle/scripts/lib/java-shade.gradle#L28
https://github.com/line/armeria/blob/7148df07f3a7fe7cb4640fb1ca761cbaca8b347f/gradle/scripts/lib/java-shade.gradle#L118
This is then renamed to `<artifact>-shaded-<version>-shaded.jar` by
`trimShadedJar` task. However, since the input file of `shadedClasses`
is `<artifact>-<version>-shaded.jar`, the task fails to fine the jar
file.
Modifications:
- Generate the output file name correctly by removing `untrimmed` infix
from the output jar file instead of renaming it to `shaded`.
- Miscellaneous) Make `publishJarPublicationToMavenLocal` depend on
`shadedTask` or `trimShadedJar` to run `publishToMavenLocal`
successfully.
Result:
`:core:shadedClasses` runs correctly
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Chores**
* Updated build artifact naming conventions to improve clarity and
consistency in generated outputs.
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: minux <[email protected]>:core:shadedClasses failure (#6514)1 parent 08f0b32 commit 2bcdb85
2 files changed
+8
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
132 | 134 | | |
133 | 135 | | |
134 | 136 | | |
| |||
0 commit comments