gradle: Properly configure sourceSet compile and runtime classpaths#7313
Merged
Conversation
This fix is for Bnd Workspace builds. We use jarLibraryElements to process configurations to require jar elements (instead of output folders). We do this since Bnd can add content to the jar which is sourced from the classpath of the jar task. So, we now set the sourceSet compile and runtime classpaths using the jarLibraryElements file collection from the compile and runtime classpath configurations, respectively, preceeded with the necessary sourceSet outputs for each classpath. - main compile: compileClasspath configuration - main runtime: main output + runtimeClasspath configuration - test compile: main output + testCompileClasspath configuration - test runtime: test output + main output + testRuntimeClasspath configuration We no longer set the classpath or destination dir in the compile task since it will use the related sourceSet compile classpath and destination dir. We also remove the incorrect setting of the runtimeOnly and testRuntimeOnly configurations. Fixes bndtools#7306 Signed-off-by: BJ Hargrave <bj@hargrave.dev>
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.
This fix is for Bnd Workspace builds.
We use jarLibraryElements to process configurations to require jar elements (instead of output folders). We do this since Bnd can add content to the jar which is sourced from the classpath of the jar task.
So, we now set the sourceSet compile and runtime classpaths using the jarLibraryElements file collection from the compile and runtime classpath configurations, respectively, preceeded with the necessary sourceSet outputs for each classpath.
We no longer set the classpath or destination dir in the compile task since it will use the related sourceSet compile classpath and destination dir.
We also remove the incorrect setting of the runtimeOnly and testRuntimeOnly configurations.
Fixes #7306