use of org.jetbrains.jps.incremental.ResourcesTarget in project intellij-community by JetBrains.
the class ResourcesTargetType method computeAllTargets.
@NotNull
@Override
public List<ResourcesTarget> computeAllTargets(@NotNull JpsModel model) {
List<JpsModule> modules = model.getProject().getModules();
List<ResourcesTarget> targets = new ArrayList<>(modules.size());
for (JpsModule module : modules) {
targets.add(new ResourcesTarget(module, this));
}
return targets;
}
use of org.jetbrains.jps.incremental.ResourcesTarget in project intellij-community by JetBrains.
the class CheckResourcesTarget method computeRootDescriptors.
@NotNull
@Override
public List<GroovyResourceRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
ResourcesTarget target = new ResourcesTarget(myModule, ResourcesTargetType.getInstance(isTests()));
List<ResourceRootDescriptor> resources = target.computeRootDescriptors(model, index, ignoredFileIndex, dataPaths);
return ContainerUtil.map(resources, descriptor -> new GroovyResourceRootDescriptor(descriptor, CheckResourcesTarget.this));
}
use of org.jetbrains.jps.incremental.ResourcesTarget in project intellij-community by JetBrains.
the class ResourcesBuilder method build.
@Override
public void build(@NotNull ResourcesTarget target, @NotNull DirtyFilesHolder<ResourceRootDescriptor, ResourcesTarget> holder, @NotNull final BuildOutputConsumer outputConsumer, @NotNull final CompileContext context) throws ProjectBuildException, IOException {
if (!isResourceProcessingEnabled(target.getModule())) {
return;
}
try {
holder.processDirtyFiles(new FileProcessor<ResourceRootDescriptor, ResourcesTarget>() {
private final Map<ResourceRootDescriptor, Boolean> mySkippedRoots = new HashMap<>();
public boolean apply(ResourcesTarget target, final File file, final ResourceRootDescriptor sourceRoot) throws IOException {
Boolean isSkipped = mySkippedRoots.get(sourceRoot);
if (isSkipped == null) {
final File outputDir = target.getOutputDir();
isSkipped = Boolean.valueOf(outputDir == null || FileUtil.filesEqual(outputDir, sourceRoot.getRootFile()));
mySkippedRoots.put(sourceRoot, isSkipped);
}
if (isSkipped.booleanValue()) {
return true;
}
try {
copyResource(context, sourceRoot, file, outputConsumer);
} catch (IOException e) {
LOG.info(e);
context.processMessage(new CompilerMessage("resources", BuildMessage.Kind.ERROR, e.getMessage(), FileUtil.toSystemIndependentName(file.getPath())));
return false;
}
return !context.getCancelStatus().isCanceled();
}
});
context.checkCanceled();
context.processMessage(new ProgressMessage(""));
} catch (BuildDataCorruptedException | ProjectBuildException e) {
throw e;
} catch (Exception e) {
throw new ProjectBuildException(e.getMessage(), e);
}
}
Aggregations