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

Import properties from build.gradle and remove hardcoded quarkus.package.output-directory #29971

Merged
merged 1 commit into from
Jan 9, 2023

Conversation

jacobdotcosta
Copy link
Contributor

  • Import properties defined in the build.gradle file using the syntax described below
  • Replace the hard-coded output location if a quarkus.package.output-directory value is passed through configuration

build.gradle quarkus property definition:

quarkus {
    properties {
        set("package.type", "uber-jar")
        set("package.output-directory", "build-gradle-output-dir")
    }
}

Closes #28897
Closes #28896

@quarkus-bot quarkus-bot bot added area/devtools Issues/PR related to maven, gradle, platform and cli tooling/plugins area/gradle Gradle labels Dec 20, 2022
@quarkus-bot

This comment was marked as resolved.

@jacobdotcosta jacobdotcosta changed the title import properties from build.gradle and remove hardcoded quarkus.package.output-directory Import properties from build.gradle and remove hardcoded quarkus.package.output-directory Dec 20, 2022
@geoand geoand requested a review from glefloch December 20, 2022 12:56
@geoand
Copy link
Contributor

geoand commented Dec 20, 2022

Thanks a lot for this @jacobdotcosta!

I'll let @glefloch and @aloubyansky comment

@quarkus-bot

This comment has been minimized.

@jacobdotcosta
Copy link
Contributor Author

jacobdotcosta commented Dec 21, 2022

I'm not sure how to fix these errors as I'm not sure how they relate to this PR, could someone give me a hand?

Gradle Tests - JDK 11 Windows has 1 error which is the following:

2022-12-20T15:01:02.2716136Z 2022-12-20 15:01:01,864 SEVERE [org.jun.jup.eng.exe.JupiterEngineExecutionContext] (main) Caught exception while closing extension context: org.junit.jupiter.engine.descriptor.MethodExtensionContext@55877274: java.io.IOException: Failed to delete temp directory D:\a\quarkus\quarkus\integration-tests\gradle\target\junit10212038324867675530. The following paths could not be deleted (see suppressed exceptions for details): , src, src\main, src\main\resources

JVM Tests - JDK 17 MacOS M1 seems to fail to start the tests with:

2022-12-20T15:12:01.6643110Z Starting machine "podman-machine-default"
2022-12-20T15:12:02.2066100Z Waiting for VM ...
2022-12-20T15:12:17.2901010Z Mounting volume... /Volumes/actions-files/githubactions:/Volumes/actions-files/githubactions
2022-12-20T15:12:17.5569370Z Error: exit status 255
2022-12-20T15:12:17.5585510Z ##[error]Process completed with exit code 125.
...
2022-12-20T15:12:17.6112590Z /Volumes/actions-files/githubactions/actions-runner/_work/_temp/1f2eaa41-292c-4c25-99ae-db2308b6f743.sh: line 1: devtools/gradle/gradlew: No such file or directory
2022-12-20T15:12:17.6116990Z ##[error]Process completed with exit code 1.

@aloubyansky
Copy link
Member

The MacOS is known to be problematic. The QuarkusPluginFunctionalTest.canDetectUpToDateBuild does seem to be related in some way though.

@jacobdotcosta jacobdotcosta force-pushed the issue-28897 branch 2 times, most recently from 270d407 to b60598a Compare January 2, 2023 11:00
@jacobdotcosta
Copy link
Contributor Author

I've downloaded the logs and checked the error messages. From what I can understand the io.quarkus.gradle.QuarkusPluginFunctionalTest#canDetectUpToDateBuild test case consists in executing the tests 2 times to make sure Gradle detects they haven't changed so it won't execute the tests again.

The problem seems to be that somewhere in the process the extension is trying to cleanup the src\main\resources sub-folder of the temporary project directory and that is failing probably because windows is locking a file. I cannot identify in the logs the step on which this failure is happening as the test class doesn't show up in the stacktrace.

@aloubyansky , could you assist me on a way of tracking this error? Do you know of any way I could try reproducing this error without having a MS Windows VM?

Thank you.

@quarkus-bot

This comment has been minimized.

@aloubyansky
Copy link
Member

Perhaps, instead @TempDir File projectRoot creating and recursively deleting a project dir "manually" will help?

…age.output-directory value

tests: IT for the build.gradle configuration
@jacobdotcosta
Copy link
Contributor Author

Perhaps, instead @TempDir File projectRoot creating and recursively deleting a project dir "manually" will help?

I think I found the problem. I wasn't closing the Stream that reads the application.properties file. This last commit should have fixed this.

@aloubyansky aloubyansky merged commit f7f159e into quarkusio:main Jan 9, 2023
@quarkus-bot quarkus-bot bot added this to the 2.16 - main milestone Jan 9, 2023
@aloubyansky
Copy link
Member

Thanks @jacobdotcosta!

Comment on lines +192 to +198
public Map<String, String> getQuarkusBuildProperties() {
return quarkusBuildProperties;
}

public void set(String name, @Nullable String value) {
quarkusBuildProperties.put(String.format("quarkus.%s", name), value);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should use lazy configuration APIs. So quarkusBuildProperties should not be of type Map<String, String> but MapProperty<String, String>. At the same time there should be an overload for set where value can be passed as a Property<String>.

Another issue with this solution is that is assumes everything is a string, but that's not the case. For example the package.output-directoy should probably be of type DirectoryProperty (see https://docs.gradle.org/current/userguide/lazy_configuration.html#working_with_files_in_lazy_properties).

Copy link
Member

Choose a reason for hiding this comment

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

@britter thanks a lot for the review. Let us know if you would like to submit a PR yourself. That'd be much appreciated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the feedback @britter , I'm reviewing the docs. I can also submit a PR to fix this, if you won't.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see myself doing this before the end of the month. So if you have some time @jacobdotcosta please go ahead.

Copy link
Member

Choose a reason for hiding this comment

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

It doesn't look like it was fixed yet. @britter in case you have some time to contribute the fixes you mentioned previously, it'll be much appreciated. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

@aloubyansky I managed to address the first part of it in #30713. I'm not sure it's possible to address the second part using a map based approached.

britter added a commit to britter/quarkus that referenced this pull request Jan 30, 2023
Changes the type of quarkusBuildProperties from Map to MapProperty. This
allows build authors to specify values which may only become available
later in the build by passed into the build using providers.

Follow up to quarkusio#29971
britter added a commit to britter/quarkus that referenced this pull request Jan 30, 2023
Changes the type of quarkusBuildProperties from Map to MapProperty. This
allows build authors to specify values which may only become available
later in the build by passed into the build using providers.

Follow up to quarkusio#29971
gsmet pushed a commit to gsmet/quarkus that referenced this pull request Jan 31, 2023
Changes the type of quarkusBuildProperties from Map to MapProperty. This
allows build authors to specify values which may only become available
later in the build by passed into the build using providers.

Follow up to quarkusio#29971

(cherry picked from commit f29e918)
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/gradle Gradle kind/bugfix
Projects
None yet
4 participants