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
Fix some IP problems in the build #28929
base: master
Are you sure you want to change the base?
Conversation
@bot-gradle test this BD |
I've triggered the following builds for you. Click here to see all build failures. |
@bot-gradle test AST |
I've triggered the following builds for you. Click here to see all build failures. |
buildEnvironmentExtension.gitBranch = git("rev-parse", "--abbrev-ref", "HEAD") | ||
buildEnvironmentExtension.repoRoot = layout.projectDirectory.parentOrRoot() | ||
val buildLayout = layout | ||
gradle.lifecycle.beforeProject { |
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.
🤔 Before git
would be executed only twice per build, right? And now it's once per project?
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.
Interestingly it seems it's called 3-times in both cases during sync, at least when trying to do some println in the zip part I get for both:
> Configure project :
Executed 'git rev-parse --abbrev-ref HEAD' for ':'
Executed 'git rev-parse --abbrev-ref HEAD' for ':'
Executed 'git rev-parse --abbrev-ref HEAD' for ':'
So it looks like provider is evaulated anytime git()
is called anyway, or that should not be the case?
If you have any ideas how to improve that, let me know.
We can also just merge improvement for gradle/shared-with-buildSrc/mirrors.settings.gradle.kts
that is trivial and we leave this one for some other time when we'll have more tools.
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.
Any thoughts if that solution could be a problem or not @gradle/bt-developer-productivity?
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.
So it looks like provider is evaulated anytime git() is called anyway, or that should not be the case?
This seems to be expected behavior. BiProvider
's implementation did run the combiner function every time:
Line 100 in 489a48f
return calculateOwnPresentValue().get(); |
Line 79 in 489a48f
R combinedUnpackedValue = combiner.apply(leftValue.getWithoutSideEffect(), rightValue.getWithoutSideEffect()); |
That being said, it's still a bit inefficient to have the provider instance in every Project
, even though it may not be a problem right now. Suppose somebody start using gitCommitId
in every Project
in the future, that would be executed hundreds of times.
Right now I don't have a very good idea for this, is it possible to store the information in the similar way as DevelocityConfiguration
? I think there's only one instance stored in the build right?
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.
It would be possible to always execute git
once in the settings plugin and then simply propagate the data to every project as a Kotlin data class or similar construct (until we have a proper solution via the Shared Data API):
captureBuildEnvironment().let { buildEnvironment ->
gradle.lifecycle.beforeProject {
extensions.add("buildEnvironment", buildEnvironment)
}
}
No description provided.