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

Can't override javaHome for GradleBuildConfigurationReader #484

Open
joshfriend opened this issue Apr 24, 2023 · 0 comments
Open

Can't override javaHome for GradleBuildConfigurationReader #484

joshfriend opened this issue Apr 24, 2023 · 0 comments

Comments

@joshfriend
Copy link
Contributor

joshfriend commented Apr 24, 2023

GradleBuildConfigurationReader.readConfiguration() invokes a gradle build with the help task to generate the GradleBuildConfiguration. (For the project I am profiling, this takes several minutes of configuration time to perform. Is it possible to shorten this time it takes to resolve the gradle version and read the build configuration?)

new ToolingApiGradleClient(connection).runTasks(ImmutableList.of("help"), ImmutableList.of("-I", initScript.getAbsolutePath()), ImmutableList.of());
BuildDetails buildDetails = readBuildDetails();
JavaEnvironment javaEnvironment = buildEnvironment.getJava();
List<String> allJvmArgs = new ArrayList<>(javaEnvironment.getJvmArguments());
allJvmArgs.addAll(readSystemPropertiesFromGradleProperties());
boolean usesAnyScanPlugin = buildDetails.usesAnyScanPlugin();
version = new GradleBuildConfiguration(
GradleVersion.version(buildEnvironment.getGradle().getGradleVersion()),
new File(buildDetails.getGradleHome()),
javaEnvironment.getJavaHome(),
allJvmArgs,
usesAnyScanPlugin
);

I cannot override the value of javaHome for this gradle execution, so it defaults to JAVA_HOME which is set to jdk11 in the environment I run these tests in. We would like to enforce JDK 17 for this project by throwing an error when a developer invokes a build with jdk11 to avoid more confusing errors that may happen later in the build, but this means that the project is no longer compatible with profiler.

I'm working on updating the build environment where profiling is run, but it seems like this should be possible to override.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant