thread safe data structures (IDEA-231222)

GitOrigin-RevId: 3587ceeca3c989705756e82ca9015c435988e3bb
This commit is contained in:
Eugene Zhuravlev
2020-01-23 15:14:21 +00:00
committed by intellij-monorepo-bot
parent a1fdb77b71
commit a6b332cba7
2 changed files with 17 additions and 14 deletions
@@ -184,7 +184,9 @@ public class IncProjectBuilder {
context = createContext(scope);
sourcesState = new BuildTargetSourcesState(context);
// Clear source state report if force clean or rebuild
if (forceCleanCaches || context.isProjectRebuild()) sourcesState.clearSourcesState();
if (forceCleanCaches || context.isProjectRebuild()) {
sourcesState.clearSourcesState();
}
runBuild(context, forceCleanCaches);
myProjectDescriptor.dataManager.saveVersion();
myProjectDescriptor.dataManager.reportUnhandledRelativizerPaths();
@@ -13,6 +13,7 @@ import org.jetbrains.jps.model.library.sdk.JpsSdk;
import org.jetbrains.jps.model.serialization.JpsModelSerializationDataService;
import java.io.File;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@@ -26,8 +27,8 @@ public class PathRelativizerService {
private static final String PROJECT_DIR_IDENTIFIER = "$PROJECT_DIR$";
private static final String BUILD_DIR_IDENTIFIER = "$BUILD_DIR$";
private List<PathRelativizer> myRelativizers;
private Set<String> myUnhandledPaths;
private final List<PathRelativizer> myRelativizers = new SmartList<>();
private final Set<String> myUnhandledPaths = Collections.synchronizedSet(new LinkedHashSet<>());
public PathRelativizerService(@Nullable String projectPath, @Nullable String buildDirPath) {
initialize(projectPath, buildDirPath, null);
@@ -50,12 +51,11 @@ public class PathRelativizerService {
private void initialize(@Nullable String projectPath, @Nullable String buildDirPath, @Nullable Set<JpsSdk<?>> javaSdks) {
String normalizedProjectPath = projectPath != null ? normalizePath(projectPath) : null;
String normalizedBuildDirPath = buildDirPath != null ? normalizePath(buildDirPath) : null;
myRelativizers = new SmartList<>(new CommonPathRelativizer(normalizedProjectPath, PROJECT_DIR_IDENTIFIER),
new JavaSdkPathRelativizer(javaSdks),
new CommonPathRelativizer(normalizedBuildDirPath, BUILD_DIR_IDENTIFIER),
new MavenPathRelativizer(),
new GradlePathRelativizer());
myUnhandledPaths = new LinkedHashSet<>();
myRelativizers.add(new CommonPathRelativizer(normalizedProjectPath, PROJECT_DIR_IDENTIFIER));
myRelativizers.add(new JavaSdkPathRelativizer(javaSdks));
myRelativizers.add(new CommonPathRelativizer(normalizedBuildDirPath, BUILD_DIR_IDENTIFIER));
myRelativizers.add(new MavenPathRelativizer());
myRelativizers.add(new GradlePathRelativizer());
}
/**
@@ -94,11 +94,12 @@ public class PathRelativizerService {
}
public void reportUnhandledPaths() {
if (!LOG.isDebugEnabled()) return;
final StringBuilder logBuilder = new StringBuilder();
myUnhandledPaths.forEach(it -> logBuilder.append(it).append("\n"));
LOG.debug("Unhandled by relativizer paths:" + "\n" + logBuilder.toString());
myUnhandledPaths = new LinkedHashSet<>();
if (LOG.isDebugEnabled()) {
final StringBuilder logBuilder = new StringBuilder();
myUnhandledPaths.forEach(it -> logBuilder.append(it).append("\n"));
LOG.debug("Unhandled by relativizer paths:" + "\n" + logBuilder.toString());
myUnhandledPaths.clear();
}
}
@NotNull