-
Notifications
You must be signed in to change notification settings - Fork 10
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
Parallelize source set retrieval. #168
Conversation
plugin/src/main/java/com/microsoft/java/bs/gradle/plugin/SourceSetsModelBuilder.java
Outdated
Show resolved
Hide resolved
d8c08fb
to
ff89166
Compare
@jdneo I've pushed all the language specific stuff to be stored in the I've also moved I've tested anecdotally using Kafka. I'm getting speed ups on sourceset retrieval of around 5x when |
I've experienced I've tested against Gradle and it's 12x faster to retrieve source sets on my machine. |
ff89166
to
e21ddf6
Compare
Fixed test. The supported languages weren't being supplied in all
|
e21ddf6
to
5cb1205
Compare
Hi @Arthurm1, I'm working on some other stuff recently. I'll make sure to review this PR once I've finished the stuff. |
model/src/main/java/com/microsoft/java/bs/gradle/model/actions/GetSourceSetsAction.java
Show resolved
Hide resolved
model/src/main/java/com/microsoft/java/bs/gradle/model/GradleSourceSet.java
Outdated
Show resolved
Hide resolved
plugin/src/main/java/com/microsoft/java/bs/gradle/plugin/dependency/DependencyCollector.java
Show resolved
Hide resolved
5cb1205
to
49aab29
Compare
model/src/main/java/com/microsoft/java/bs/gradle/model/JavaExtension.java
Outdated
Show resolved
Hide resolved
model/src/main/java/com/microsoft/java/bs/gradle/model/actions/GetSourceSetsAction.java
Outdated
Show resolved
Hide resolved
Hi @Arthurm1, should I add |
I can observe the perf boost for this change. Opening the repo Meanwhile, I encountered an error with this change: microsoft/vscode-gradle#1566. This error cannot be observed in the develop branch. Looks like we need to add the dedup logic in the project dependency resolution? |
I think using |
I can't see why this would happen. The classpaths for
and
So it doesn't look like there are duplicates unless the It doesn't appear to be duplicating display names either. |
Ah I see. This might be the reason. Because the JDT project model does not have equivalent concept for source set in Gradle. In JDT, one project can only have one classpath. So they are merged together. Sorry for the confusion. |
Question about this: I tried this change without setting |
Do you special case the |
I don't know for sure. I think you either have to set |
Yes, in JDT, each classpath entry can have an attribute named |
Ah - does the gradle project fail without this PR then? |
No, it doesn't |
server/src/main/java/com/microsoft/java/bs/core/internal/managers/BuildTargetManager.java
Show resolved
Hide resolved
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.
LGTM. Thank you @Arthurm1 for your contribution
This PR got away from me slightly so has a number of changes.
The idea here was to retrieve sourcesets concurrently by creating an action for each project and then submitting all those actions at once. If Gradle > 6.7 then it will attempt to execute these actions in parallel.
Scala in particular can be slow to populate some of its information so this is faster. I haven't tested to see if it speeds up any large public Gradle projects like
Gradle
orKafka
.This also simplifies the
SourceSetsModelBuilder
as the data retrieved is purely for 1 project.Changes...
SourceSetsModelBuilder
to only populate 1 project to allow parallel retrieval inGradleSourceSetsAction
.GetSourceSetsAction
to get the model for all projects/subprojects/included builds.GradleBuild#getEditableBuilds
instead ofGradleBuild#getIncludedBuilds
if available. This will include thebuildSrc
project. See hereScala
and in included builds, the classpath includes the project jars rather than the classes directories. So for BSP clients, they now realize that the class files are from project sources and can navigate to the source rather than decompiling the classfile from the jar.main
source set only limitation on inter-project dependencies. Any project with custom configs (or one usingTestFixtures
) needs this.GradleSourceSet#ProjectName
- it's not usedgetCompileClasspath
. Although this really means that the user's build file is wrong but at least they don't get an exception from the plugin.