Skip to content

Commit

Permalink
make synchronization of classpath calculation more fine-grained
Browse files Browse the repository at this point in the history
Currently, the calculation of the classpath for a project is effectively a singleton because the BundleProject is used as monitor (synchronization). This leads to a poor performance if executing a tycho build with  many threads, many projects and complex dependencies.

This change replaces the global monitor with a fine-grained monitor the given project the classpath should be calculated for. This speeds up the parallel build.
  • Loading branch information
andreas-schwarz-vector committed Feb 4, 2025
1 parent f5e7053 commit 9562574
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ public EclipsePluginProject getEclipsePluginProject(ReactorProject otherProject)
/**
* Add to maven project some properties storing info about the plugin project model, for easier
* reuse in further mojos (eg combining with eclipse-run and PDE API Tools).
*
*
* @param mavenProjectProperties
* @param pdeProject
*/
Expand All @@ -320,13 +320,8 @@ public List<ClasspathEntry.AccessRule> getBootClasspathExtraAccessRules(ReactorP
return getBundleClassPath(project).getExtraBootClasspathAccessRules();
}

public synchronized BundleClassPath getBundleClassPath(ReactorProject project) {
if (project.getContextValue(CTX_CLASSPATH) instanceof BundleClassPath bundleClassPath) {
return bundleClassPath;
}
BundleClassPath cp = resolveClassPath(getMavenSession(project), getMavenProject(project));
project.setContextValue(CTX_CLASSPATH, cp);
return cp;
public BundleClassPath getBundleClassPath(ReactorProject project) {
return project.computeContextValue(CTX_CLASSPATH, () -> resolveClassPath(getMavenSession(project), getMavenProject(project)));
}

/**
Expand Down Expand Up @@ -521,7 +516,7 @@ public Filter getTargetEnvironmentFilter(MavenProject project) {

@Override
public void readExecutionEnvironmentConfiguration(ReactorProject project, MavenSession mavenSession,
ExecutionEnvironmentConfiguration sink) {
ExecutionEnvironmentConfiguration sink) {
// read packaging-type independent configuration
super.readExecutionEnvironmentConfiguration(project, mavenSession, sink);

Expand Down

0 comments on commit 9562574

Please sign in to comment.