use of com.google.idea.blaze.base.sync.BlazeSyncParams.SyncMode in project intellij by bazelbuild.
the class JarCache method onSync.
void onSync(BlazeContext context, ProjectViewSet projectViewSet, BlazeProjectData projectData, BlazeSyncParams.SyncMode syncMode) {
Collection<BlazeLibrary> libraries = BlazeLibraryCollector.getLibraries(projectViewSet, projectData);
boolean fullRefresh = syncMode == SyncMode.FULL;
boolean removeMissingFiles = syncMode == SyncMode.INCREMENTAL;
boolean enabled = updateEnabled();
if (!enabled || fullRefresh) {
clearCache();
}
if (!enabled) {
return;
}
List<BlazeJarLibrary> jarLibraries = libraries.stream().filter(library -> library instanceof BlazeJarLibrary).map(library -> (BlazeJarLibrary) library).collect(Collectors.toList());
ArtifactLocationDecoder artifactLocationDecoder = projectData.artifactLocationDecoder;
BiMap<File, String> sourceFileToCacheKey = HashBiMap.create(jarLibraries.size());
for (BlazeJarLibrary library : jarLibraries) {
File jarFile = artifactLocationDecoder.decode(library.libraryArtifact.jarForIntellijLibrary());
sourceFileToCacheKey.put(jarFile, cacheKeyForJar(jarFile));
for (ArtifactLocation sourceJar : library.libraryArtifact.sourceJars) {
File srcJarFile = artifactLocationDecoder.decode(sourceJar);
sourceFileToCacheKey.put(srcJarFile, cacheKeyForSourceJar(srcJarFile));
}
}
this.traits = new JarCacheSynchronizerTraits(cacheDir, sourceFileToCacheKey);
refresh(context, removeMissingFiles);
}
use of com.google.idea.blaze.base.sync.BlazeSyncParams.SyncMode in project intellij by bazelbuild.
the class UnpackedAars method onSync.
void onSync(BlazeContext context, ProjectViewSet projectViewSet, BlazeProjectData projectData, BlazeSyncParams.SyncMode syncMode) {
Collection<BlazeLibrary> libraries = BlazeLibraryCollector.getLibraries(projectViewSet, projectData);
boolean fullRefresh = syncMode == SyncMode.FULL;
boolean removeMissingFiles = syncMode == SyncMode.INCREMENTAL;
if (!enabled || fullRefresh) {
clearCache();
}
if (!enabled) {
return;
}
List<AarLibrary> aarLibraries = libraries.stream().filter(library -> library instanceof AarLibrary).map(library -> (AarLibrary) library).collect(Collectors.toList());
ArtifactLocationDecoder artifactLocationDecoder = projectData.artifactLocationDecoder;
BiMap<File, String> sourceAarFileToCacheKey = HashBiMap.create(aarLibraries.size());
BiMap<File, String> sourceJarFileToCacheKey = HashBiMap.create(aarLibraries.size());
for (AarLibrary library : aarLibraries) {
File aarFile = artifactLocationDecoder.decode(library.aarArtifact);
String cacheKey = cacheKeyForAar(aarFile);
sourceAarFileToCacheKey.put(aarFile, cacheKey);
File jarFile = artifactLocationDecoder.decode(library.libraryArtifact.jarForIntellijLibrary());
// Use the aar key for the jar as well.
sourceJarFileToCacheKey.put(jarFile, cacheKey);
}
this.aarTraits = new AarTraits(cacheDir, sourceAarFileToCacheKey);
this.jarTraits = new JarTraits(cacheDir, sourceJarFileToCacheKey);
refresh(context, removeMissingFiles);
}
Aggregations