-
Notifications
You must be signed in to change notification settings - Fork 6
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
Adds a Bloop-specific Gradle project configuration #106
Open
jvican
wants to merge
10
commits into
scalacenter:main
Choose a base branch
from
jvican:jorge/add-bloop-config-gradle
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Commits on May 15, 2024
-
Adds a Bloop-specific Gradle project configuration
Some Gradle experts at $WORK have told me that the way we were previously resolving artifacts wasn't strictly correct due to two reason: - Project references in project configurations (like the ones we resolve in `getConfigurationArtifacts`) are allowed to be empty for now, but that will change, and it's a bug. gradle/gradle#26155 - The way we currently resolve artifacts doesn't let Gradle know our intention (as we can resolve any arbitrary configuration) and it doesn't play well with Gradle transforms, which require all of the resolved configuration artifacts to be present, otherwise it fails with a `FileNotFoundException`. As a result, I changed the code to introduce a Gradle configuration `bloopConfig` that extends all those configurations we care about, and change the resolution code to only depend on that configuration. It seems that solution works and passes all tests, and it avoids the `FileNotFoundException` error I found out. Because we now have a proper `configuration`, it means that users that create their own configuration and want it to be exported to bloop need to do `bloopConfig.extendsFrom(myConfig)` where `myConfig` is a user-defined configuration. The reason for this is because when we declare that our configuration extends all the other existing configuration, we do it at evaluation time. User-defined configurations run after the bloop plugin, so they never get added unless the user wishes to. This is not a big deal as custom configuration are extremely rare, and this is a common practice in Gradle land when you define your own configuration.
Configuration menu - View commit details
-
Copy full SHA for db66441 - Browse repository at this point
Copy the full SHA db66441View commit details -
Configuration menu - View commit details
-
Copy full SHA for ec8804e - Browse repository at this point
Copy the full SHA ec8804eView commit details -
Configuration menu - View commit details
-
Copy full SHA for a27df07 - Browse repository at this point
Copy the full SHA a27df07View commit details -
Configuration menu - View commit details
-
Copy full SHA for 42fb17d - Browse repository at this point
Copy the full SHA 42fb17dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 149489f - Browse repository at this point
Copy the full SHA 149489fView commit details
Commits on May 17, 2024
-
Introduce a bloopConfig configuration by source set
The previous solution worked, but it was not ideal because it introduced the concept of a `bloopConfig` that had to extend all the configurations in the project (even across different source sets, e.g. main, test, integTest, etc.). This is awkward because the plugin generates a bloop config per source set. So, if we have one bloop config extending all configurations from all source sets, and then depending on that when generating bloop config per source set, we're running into a lot of repeated resolutions to produce the necessary artifacts and the resolution config section contains a lot more artifacts than it should (e.g. foo.json and foo-test.json would contain the same set of artifacts). Also, in theory, this approach could also cause Gradle to add the wrong artifact version because it would need reconciling all artifact across all source sets is more likely to produce different results. This is a theoretical point, but it'd be nice to avoid it. So, the fix to all of this is to make a `bloopConfig` configuration per source set. For example, the main source set gets a `bloopConfigMain` configuration that extends from some default configurations that we care about for Java/Scala plugins. (In the Android world, there are no sourcesets, but "variants" so we fallback on the previous behavior and depend on all the sources for `bloopConfigAndroid`, a config that exists only in Android projects and that adds the artifacts of all the project variants -- this is the behavior one expects, and in this case we extend from all the configurations in the variants for backwards compatibility.) To make the process more customizable for end users, I've also added a new property in the bloop configuration that lets users specify the extra configurations that should be extended per source set: ``` bloop { extendUserConfigurations = [configurations.myCustomConfig.name] } ``` This way, users have control over the configurations that should also contribute artifacts to the resolution section in the bloop config. This is nice and better than the previous approach.
Configuration menu - View commit details
-
Copy full SHA for 3a179bd - Browse repository at this point
Copy the full SHA 3a179bdView commit details -
Configuration menu - View commit details
-
Copy full SHA for bf78cd2 - Browse repository at this point
Copy the full SHA bf78cd2View commit details
Commits on May 19, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 8678cd4 - Browse repository at this point
Copy the full SHA 8678cd4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2e263fa - Browse repository at this point
Copy the full SHA 2e263faView commit details -
Configuration menu - View commit details
-
Copy full SHA for 933348f - Browse repository at this point
Copy the full SHA 933348fView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.