Skip to content

Conversation

oehme
Copy link
Contributor

@oehme oehme commented May 9, 2018

The recent change to start parameter serialization
had omitted the Gradle home directory, leading to
Gradle chosing the distribution that the daemon was
started with over the distribution that the client
wanted. This is now fixed.

This also fixes another issue where the Gradle home
was not passed on to nested builds like buildSrc,
which lead to the same problem for them.

Gradle#getGradleHomeDir will now correctly return
the home dir that the client selected, not the home
dir that the daemon was originally started with.

The test veryfing all this has been fixed so that
it asserts that the daemon was reused. Previously
it was just creating new daemons and thus passing.

@oehme oehme added this to the 4.8 RC1 milestone May 9, 2018
@oehme oehme force-pushed the oehme/init-scripts/from-distro branch from 5bdf0cc to f10be5c Compare May 9, 2018 18:13
@oehme oehme changed the title Run init scripts form the client distribution Run init scripts from the client distribution May 9, 2018
@oehme oehme assigned oehme and unassigned adammurdoch May 11, 2018
@oehme
Copy link
Contributor Author

oehme commented May 11, 2018

I found why it wasn't catching it - It was starting a new daemon and there was no assertion that the daemon is reused. I'll have a fixed test soon.

@oehme oehme force-pushed the oehme/init-scripts/from-distro branch from f10be5c to 63da558 Compare May 11, 2018 16:58
The recent change to start parameter serialization
had omitted the Gradle home directory, leading to
Gradle chosing the distribution that the daemon was
started with over the distribution that the client
wanted. This is now fixed.

This also fixes another issue where the Gradle home
was not passed on to nested builds like buildSrc,
which lead to the same problem for them.

Gradle#getGradleHomeDir will now correctly return
the home dir that the client selected, not the home
dir that the daemon was originally started with.

The test veryfing all this has been fixed so that
it asserts that the daemon was reused. Previously
it was just creating new daemons and thus passing.
@oehme oehme force-pushed the oehme/init-scripts/from-distro branch from 63da558 to c4ce376 Compare May 11, 2018 17:00
@oehme oehme requested review from big-guy and marcphilipp and removed request for marcphilipp May 11, 2018 17:00
@oehme
Copy link
Contributor Author

oehme commented May 11, 2018

@big-guy Can I request your review on this since it's getting late in Europe?

@big-guy
Copy link
Member

big-guy commented May 11, 2018

@oehme I got it, no worries.

Copy link
Member

@big-guy big-guy left a comment

Choose a reason for hiding this comment

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

@oehme there were some unit test failures around the changes to DefaultGradle, but looking at the TAPI test failures makes me think this has wider implications that changes other behavior.

I think it makes sense to have gradle.gradleHomeDir match the daemon installation. I think build scans captures this information somewhere.

}

@Override
public File getGradleHomeDir() {
Copy link
Member

Choose a reason for hiding this comment

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

I think this changes the meaning of gradle.gradleHomeDir a bit...

Returns the Gradle home directory, if any. This directory is the directory containing the Gradle distribution executing this build.
When using the “Gradle Daemon”, this may not be the same Gradle distribution that the build was started with. If an existing daemon process is running that is deemed compatible (e.g. has the desired JVM characteristics) then this daemon may be used instead of starting a new process and it may have been started from a different “gradle home”.

I read that to mean that gradle.gradleHomeDir should always be the installation of the Gradle daemon that's running the build and not the client requested Gradle installation.

The TAPI failing tests point to that too:
https://builds.gradle.org/viewLog.html?buildId=12814254&tab=buildResultsDiv&buildTypeId=Gradle_Check_Quick_Java7_Oracle_Windows_toolingApi

This is saying that the first build starts a daemon with distro1. The second build, using distro2, uses the distro1 daemon. The build sees the init scripts from the right distribution, but gradle.gradleHomeDir is the installation directory of the daemon running the build.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. It just shows that the init script integ test was never working.


then:
distro2Result.output.contains "from distro 2"
distro2Result.output.contains "runtime gradle home: ${distro2.absolutePath}"
Copy link
Member

Choose a reason for hiding this comment

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

based on the TAPI test, I think this was supposed to be looking for distro1.absolutePath.

@oehme
Copy link
Contributor Author

oehme commented May 12, 2018

Superseded by #5378

@oehme oehme closed this May 12, 2018
@oehme oehme deleted the oehme/init-scripts/from-distro branch May 12, 2018 18:00
@ov7a ov7a removed this from the 4.8 RC1 milestone Mar 28, 2024
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

Successfully merging this pull request may close these issues.

4 participants