Skip to content
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

Support composite builds of multimodule gradle projects #29233

Merged
merged 1 commit into from Nov 28, 2022

Conversation

tomas1885
Copy link
Contributor

Support composite builds of multimodule gradle projects.
Support hot reloading and source watching composite builds.
Support using local extensions as a composite build.

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 13, 2022

Thanks for your pull request!

The title of your pull request does not follow our editorial rules. Could you have a look?

  • title should not end up with dot

This message is automatically generated by a bot.

@quarkus-bot quarkus-bot bot added area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle labels Nov 13, 2022
@tomas1885
Copy link
Contributor Author

fixes #29234

@tomas1885 tomas1885 changed the title Support composite builds of multimodule gradle projects. Support composite builds of multimodule gradle projects Nov 13, 2022
@glefloch
Copy link
Member

Thanks for this contribution @tomas1885, this looks good to me.

Could you also add an integration test here : https://github.com/quarkusio/quarkus/tree/main/integration-tests/gradle

@tomas1885
Copy link
Contributor Author

Hi @glefloch, can you give me an hint on how to run a single integration test locally without running the whole gradle plugin test suite?
I also noticed the contribution guide mentions that some extra steps are needed when adding integration tests (not sure if that applies to integration test of an existing module).

@tomas1885
Copy link
Contributor Author

Hi @glefloch, I added 2 integration tests for this fix, one for dev mode and another for build.
Currently no integration tests for extensions project, I might be able to add these in the next couple of days if necessary.

@@ -213,7 +214,9 @@ private void setUpDeploymentConfiguration() {
final DependencyHandler dependencies = project.getDependencies();
final Set<Dependency> deploymentDependencies = new HashSet<>();
for (ExtensionDependency extension : extensions) {
if (extension instanceof LocalExtensionDependency) {
if (extension instanceof IncludedBuildExtensionDependency) {
deploymentDependencies.add(((IncludedBuildExtensionDependency) extension).getDeployment());
Copy link
Member

Choose a reason for hiding this comment

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

Could we do it the way it's done below? i.e.

deploymentDependencies.add(dependencies.create(
                                    extension.getDeploymentModule().getGroupId() + ":"
                                            + extension.getDeploymentModule().getArtifactId() + ":"
                                            + extension.getDeploymentModule().getVersion()));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It might work, as it creates a similar object (the one returned from the extension object is an ExternalModuleDependecy while the one returned from the dependencies.create is a decorated object), in any case we would need to differentiate between a locally built extension and a composite built one. I would rather consolidate these 3 type into a self describing one, but didn't want to change the current code to that extent. I also dislike the addition of the boolean parameter to the loadExtensionInfo in the ToolingUtils class, but again, didn't want to change the code to that extent.

public static Project includedBuildProject(IncludedBuildInternal includedBuild,
final ProjectComponentIdentifier componentIdentifier) {
return includedBuild.getTarget().getMutableModel().getRootProject().findProject(
componentIdentifier.getProjectPath());
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to get hold of a project using non-internal API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was also kind of hesitant to use this, as relaying on Internal implementation details usually has ‏consequences, but haven't found a different way. I believe there's no other way, as the current Gradle project (under build) is by definition unrelated to the included build, so getting a reference to the other Gradle project can't be done through the current Gradle project object graphs.

@quarkus-bot

This comment has been minimized.

@@ -0,0 +1 @@
deployment-artifact=org.acme.extensions\:quarkus-example-extension\:1.0
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
deployment-artifact=org.acme.extensions\:quarkus-example-extension\:1.0
deployment-artifact=org.acme.extensions\:quarkus-example-extension-deployment\:1.0

# extension-dependencies:
# - "io.quarkus:quarkus-arc::jar"
# - "io.quarkus:quarkus-core::jar"
#artifact: "com.neema:quarkus-logzio::jar:@version@"
Copy link
Member

Choose a reason for hiding this comment

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

The elements commented above are supposed to be filled in by the generator, aren't they? The comments should be removed either way.

@quarkus-bot

This comment has been minimized.

@tomas1885
Copy link
Contributor Author

@aloubyansky Any hint on how to resolve the CI issue with the missing dependency version for the composite build integration test with the local extension? The actual integration test works, but it seems to fail due to missing version in the whole gradle integration tests POM.

@aloubyansky
Copy link
Member

Good question. @famod do you have any suggestion?
@tomas1885 you could try looking into the update-dependencies.sh why it's picking it up. There are other extensions in the testsuite that are not "noticed" by the script. It looks like it's collecting artifacts with quarkus- suffix. Perhaps, you could try renaming quarkus-example-extension to simply example-extension or something?

@famod
Copy link
Member

famod commented Nov 22, 2022

Yeah, either rename it so that it's not picked up or remove it from the list of artifact ids to be processed: https://github.com/quarkusio/quarkus/blob/main/integration-tests/gradle/update-dependencies.sh#L40
E.g. add -e '/quarkus-example-extension/d' (if you take this route, please also extend the comment here: https://github.com/quarkusio/quarkus/blob/main/integration-tests/gradle/update-dependencies.sh#L37)

@aloubyansky
Copy link
Member

@tomas1885 thanks for your dedication so far :) we'll need your commits to be squashed before we merge it, btw.

@quarkus-bot quarkus-bot bot added this to To do in Quarkus Documentation Nov 23, 2022
@tomas1885
Copy link
Contributor Author

tomas1885 commented Nov 23, 2022

@aloubyansky I squashed my commits but I see this PR carries extra commits from a main branch sync I did after the first commit for this branch, do I need to rebase everything on top? Should I resync with the latest main again? What's your preferred practice?

@aloubyansky
Copy link
Member

We want only your changes in the PR. Rebasing and squashing is usually all that's necessary.

@tomas1885
Copy link
Contributor Author

Hi @aloubyansky, I squashed the commit a few days ago, forgot to ping you, is there anything else that should be done here?

dependencies {
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Copy link
Member

Choose a reason for hiding this comment

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

Looks like I missed these versions. The junit dependencies are included in the quarkus-bom and they are 5.9.1 now. Could you simply remove the versions?

implementation platform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation ("${quarkusPlatformGroupId}:quarkus-arc:${quarkusPlatformVersion}")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Copy link
Member

Choose a reason for hiding this comment

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

Same here

implementation platform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation ("${quarkusPlatformGroupId}:quarkus-arc:${quarkusPlatformVersion}")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Copy link
Member

Choose a reason for hiding this comment

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

And here

dependencies {
implementation enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Copy link
Member

Choose a reason for hiding this comment

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

And here

implementation platform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation ("${quarkusPlatformGroupId}:quarkus-arc:${quarkusPlatformVersion}")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Copy link
Member

Choose a reason for hiding this comment

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

And here

implementation platform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
implementation ("${quarkusPlatformGroupId}:quarkus-arc:${quarkusPlatformVersion}")
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
Copy link
Member

Choose a reason for hiding this comment

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

And here

…n, to avoid being picked up by update-dependencies.sh

Change composite build test project extension name deployment-artifact property to the correct one
Remove comments from composite build test project extension manifest
Fix composite build test project build integration test

Add composite build with extension integration tests

Fix basic composite build integration test

Add integration tests for gradle composite builds (dev mode and build)

Support composite builds of multimodule gradle projects.
Support hot reloading and source watching composite builds.
Support using local extensions as a composite build.

Remove explicit jupiter version
Quarkus Documentation automation moved this from To do to Reviewer approved Nov 28, 2022
@aloubyansky
Copy link
Member

Thanks a lot @tomas1885

@aloubyansky aloubyansky merged commit 631d433 into quarkusio:main Nov 28, 2022
Quarkus Documentation automation moved this from Reviewer approved to Done Nov 28, 2022
@quarkus-bot quarkus-bot bot added this to the 2.15 - main milestone Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/documentation area/gradle Gradle area/oidc area/resteasy area/security
Development

Successfully merging this pull request may close these issues.

None yet

5 participants