mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (warnings; typos; formatting)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,7 @@ import org.jetbrains.jps.service.SharedThreadPool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -38,7 +39,7 @@ public class JavaBuilderService extends BuilderService {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends BuildTargetType<?>> getTargetTypes() {
|
||||
final ArrayList<BuildTargetType<?>> types = new ArrayList<>();
|
||||
List<BuildTargetType<?>> types = new ArrayList<>();
|
||||
types.addAll(JavaModuleBuildTargetType.ALL_TYPES);
|
||||
types.addAll(ResourcesTargetType.ALL_TYPES);
|
||||
return types;
|
||||
@@ -59,6 +60,6 @@ public class JavaBuilderService extends BuilderService {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<? extends TargetBuilder<?, ?>> createBuilders() {
|
||||
return Arrays.asList(new ResourcesBuilder());
|
||||
return Collections.singletonList(new ResourcesBuilder());
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
-34
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.builders.BuildOutputConsumer;
|
||||
import org.jetbrains.jps.builders.DirtyFilesHolder;
|
||||
import org.jetbrains.jps.builders.FileProcessor;
|
||||
import org.jetbrains.jps.builders.java.ResourceRootDescriptor;
|
||||
import org.jetbrains.jps.builders.java.ResourcesTargetType;
|
||||
import org.jetbrains.jps.builders.storage.BuildDataCorruptedException;
|
||||
@@ -39,12 +38,14 @@ import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Eugene Zhuravlev
|
||||
* Date: 10/6/11
|
||||
* @since 6.10.2011
|
||||
*/
|
||||
public class ResourcesBuilder extends TargetBuilder<ResourceRootDescriptor, ResourcesTarget> {
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.resourses.ResourcesBuilder");
|
||||
private static final Logger LOG = Logger.getInstance("#org.jetbrains.jps.incremental.resources.ResourcesBuilder");
|
||||
|
||||
public static final String BUILDER_NAME = "Resource Compiler";
|
||||
private static final List<StandardResourceBuilderEnabler> ourEnablers = Collections.synchronizedList(new ArrayList<StandardResourceBuilderEnabler>());
|
||||
|
||||
private static final List<StandardResourceBuilderEnabler> ourEnablers = Collections.synchronizedList(new ArrayList<>());
|
||||
|
||||
public ResourcesBuilder() {
|
||||
super(ResourcesTargetType.ALL_TYPES);
|
||||
@@ -57,40 +58,34 @@ public class ResourcesBuilder extends TargetBuilder<ResourceRootDescriptor, Reso
|
||||
@Override
|
||||
public void build(@NotNull ResourcesTarget target,
|
||||
@NotNull DirtyFilesHolder<ResourceRootDescriptor, ResourcesTarget> holder,
|
||||
@NotNull final BuildOutputConsumer outputConsumer,
|
||||
@NotNull final CompileContext context) throws ProjectBuildException, IOException {
|
||||
|
||||
@NotNull BuildOutputConsumer outputConsumer,
|
||||
@NotNull 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;
|
||||
}
|
||||
Map<ResourceRootDescriptor, Boolean> skippedRoots = new HashMap<>();
|
||||
holder.processDirtyFiles((target_, file, sourceRoot) -> {
|
||||
Boolean isSkipped = skippedRoots.get(sourceRoot);
|
||||
if (isSkipped == null) {
|
||||
File outputDir = target_.getOutputDir();
|
||||
isSkipped = Boolean.valueOf(outputDir == null || FileUtil.filesEqual(outputDir, sourceRoot.getRootFile()));
|
||||
skippedRoots.put(sourceRoot, isSkipped);
|
||||
}
|
||||
if (isSkipped.booleanValue()) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
copyResource(context, sourceRoot, file, outputConsumer);
|
||||
return !context.getCancelStatus().isCanceled();
|
||||
}
|
||||
catch (IOException e) {
|
||||
LOG.info(e);
|
||||
String sourcePath = FileUtil.toSystemIndependentName(file.getPath());
|
||||
context.processMessage(new CompilerMessage("resources", BuildMessage.Kind.ERROR, e.getMessage(), sourcePath));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
context.checkCanceled();
|
||||
@@ -149,5 +144,4 @@ public class ResourcesBuilder extends TargetBuilder<ResourceRootDescriptor, Reso
|
||||
public String getPresentableName() {
|
||||
return "Resource Compiler";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user