-
Notifications
You must be signed in to change notification settings - Fork 10
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
Composite Builds using Build Actions #154
Conversation
@microsoft-github-policy-service agree |
@Tanish-Ranjan Thanks for the PR. I see you've used a Gradle If that's the best route then you probably don't need the I think you'll still need to work out the project dependencies across included builds. Maybe you can put that in the @Test
void testCompositeBuild2() {
File projectDir = projectPath.resolve("composite-build-2").toFile();
PreferenceManager preferenceManager = new PreferenceManager();
preferenceManager.setPreferences(new Preferences());
GradleApiConnector connector = new GradleApiConnector(preferenceManager);
GradleSourceSets gradleSourceSets = connector.getGradleSourceSets(projectDir.toURI(), null);
assertEquals(6, gradleSourceSets.getGradleSourceSets().size());
GradleSourceSet mainApp = findSourceSet(gradleSourceSets, "app [main]");
GradleSourceSet mainStringUtils = findSourceSet(gradleSourceSets, "string-utils [main]");
GradleSourceSet mainNumberUtils = findSourceSet(gradleSourceSets, "number-utils [test]");
assertHasBuildTargetDependency(mainApp, mainStringUtils);
assertHasBuildTargetDependency(mainApp, mainNumberUtils);
} |
That's correct @Arthurm1. Gradle automatically manages substitution of dependencies. It didn't work previously in commit f2097d0 because Gradle was getting scoped to the project, loosing reference of the overall build and hence was not able to perform dependency substitutions from the included builds. With the help of Gradle TAPI's |
Thanks for pointing it out. I'll look into it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me.
Just a few remarks.
I think you have to wait for @jdneo's review though.
...er/src/main/java/com/microsoft/java/bs/core/internal/gradle/actions/GetSourceSetsAction.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/com/microsoft/java/bs/core/internal/gradle/actions/GetSourceSetsAction.java
Outdated
Show resolved
Hide resolved
9d5184b
to
1299cd7
Compare
This commit updates this branch to reflect the latest changes in the main branch. This ensures the branch stays aligned with the current development state.
This commit addresses checkstyle warnings identified in the GradleApiConnector.java
This commit refactors the CompositeBuild tests for better organization and clarity. Changes: - Moved the existing composite-build test to a new test named "composite-build-1" - Added a new test named "composite-build-2" to verify dependency substitution functionality.
This commit improves the code by delegating the logic for retrieving source sets to a dedicated build action named `GetSourceSetsAction`. This enhances code organization and separation of concerns. Additionally, the test case `testCompositeBuild2` has been updated to verify if the new approach correctly retrieves the expected source sets.
Changes: - Removed unused files: DefaultGradleIncludedBuild.java and GradleIncludedBuild.java - Removed leftover implementations from DefaultGradleSourceSets.java - Moved dependency mapping logic from SourceSetsModelBuilder.java to GetSourceSetsBuildAction.java - Introduced GradleSourceSetsMetadata.java for passing information between SourceSetsModelBuilder and GetSourceSetsBuildAction for dependency mapping - Updated GradleApiConnectorTest.java#testCompositeBuild2 to verify proper dependency mapping - Updated GradleBuildServerPluginTest.java#getGradleSourceSets to receive GradleSourceSetsMetadata and return expected GradleSourceSets
Changes: - Added missing import statements for improved readability. - Utilized Java 17 features for concise code (var type inference). - Addressed checkstyle warnings to maintain code consistency.
1299cd7
to
e8e3d0f
Compare
...er/src/main/java/com/microsoft/java/bs/core/internal/gradle/actions/GetSourceSetsAction.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/com/microsoft/java/bs/core/internal/gradle/actions/GetSourceSetsAction.java
Outdated
Show resolved
Hide resolved
plugin/src/main/java/com/microsoft/java/bs/gradle/plugin/SourceSetsModelBuilder.java
Show resolved
Hide resolved
model/src/main/java/com/microsoft/java/bs/gradle/model/GradleSourceSetsMetadata.java
Outdated
Show resolved
Hide resolved
model/src/main/java/com/microsoft/java/bs/gradle/model/GradleSourceSetsMetadata.java
Outdated
Show resolved
Hide resolved
...er/src/main/java/com/microsoft/java/bs/core/internal/gradle/actions/GetSourceSetsAction.java
Outdated
Show resolved
Hide resolved
plugin/src/main/java/com/microsoft/java/bs/gradle/plugin/SourceSetsModelBuilder.java
Outdated
Show resolved
Hide resolved
Changes: - Refactored variable and method names to reflect their purpose clearly. - Updated JavaDoc comments for better explanation.
...er/src/main/java/com/microsoft/java/bs/core/internal/gradle/actions/GetSourceSetsAction.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Tested with Gradle official composite build sample and a composite build project that provided by a user. Both works as expected.
Thank you @Tanish-Ranjan and @Arthurm1 for the contribution, good job!
Big thanks to @Arthurm1 for the initial insights into the tooling API! Your guidance gave this PR a significant head start. Additionally, a huge thanks to all the gsoc mentors (@jdneo @donat @hegyibalint @reinsch82) who provided support throughout this process. Your help was invaluable in getting this completed so quickly. |
Ok, so after some investigation, I found that the current solution has some problems:
|
This PR continues the work done by @Arthurm1 for composite-builds on #122, bringing in support for included builds, including dependency substitution using build actions.