mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
external compiler: store source-output mapping per target
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
import org.jetbrains.jps.model.module.JpsModule;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -13,5 +11,5 @@ public interface FileProcessor {
|
||||
/**
|
||||
* @return true if processing should continue, false if should stop
|
||||
*/
|
||||
boolean apply(JpsModule module, File file, String sourceRoot) throws IOException;
|
||||
boolean apply(ModuleBuildTarget target, File file, String sourceRoot) throws IOException;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.jetbrains.jps.incremental;
|
||||
|
||||
import org.jetbrains.jps.model.module.JpsModule;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
@@ -38,7 +36,7 @@ public class FilesCollector implements FileProcessor{
|
||||
return myContainer;
|
||||
}
|
||||
|
||||
public boolean apply(JpsModule module, File file, String sourceRoot) throws IOException {
|
||||
public boolean apply(ModuleBuildTarget target, File file, String sourceRoot) throws IOException {
|
||||
if (myFilter.accept(file)) {
|
||||
myContainer.add(file);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.concurrency.BoundedTaskExecutor;
|
||||
import com.intellij.util.containers.ConcurrentHashSet;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import com.intellij.util.containers.MultiMapBasedOnSet;
|
||||
import com.intellij.util.io.MappingFailedException;
|
||||
import com.intellij.util.io.PersistentEnumerator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -269,10 +271,8 @@ public class IncProjectBuilder {
|
||||
clearOutputs(context);
|
||||
}
|
||||
else {
|
||||
for (JpsModule module : context.getProjectDescriptor().jpsProject.getModules()) {
|
||||
final String moduleName = module.getName();
|
||||
clearOutputFiles(context, moduleName, true);
|
||||
clearOutputFiles(context, moduleName, false);
|
||||
for (ModuleBuildTarget target : context.getChunks().getAllTargets()) {
|
||||
clearOutputFiles(context, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,8 +295,8 @@ public class IncProjectBuilder {
|
||||
myProjectDescriptor.fsState.clearAll();
|
||||
}
|
||||
|
||||
private static void clearOutputFiles(CompileContext context, final String moduleName, boolean forTests) throws IOException {
|
||||
final SourceToOutputMapping map = context.getProjectDescriptor().dataManager.getSourceToOutputMap(moduleName, forTests);
|
||||
private static void clearOutputFiles(CompileContext context, ModuleBuildTarget target) throws IOException {
|
||||
final SourceToOutputMapping map = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target);
|
||||
for (String srcPath : map.getKeys()) {
|
||||
final Collection<String> outs = map.getState(srcPath);
|
||||
if (outs != null && !outs.isEmpty()) {
|
||||
@@ -309,37 +309,29 @@ public class IncProjectBuilder {
|
||||
}
|
||||
|
||||
private void clearOutputs(CompileContext context) throws ProjectBuildException, IOException {
|
||||
final Collection<JpsModule> modulesToClean = context.getProjectDescriptor().jpsProject.getModules();
|
||||
final Map<File, Set<Pair<String, Boolean>>> rootsToDelete = new HashMap<File, Set<Pair<String, Boolean>>>(); // map: outputRoot-> setOfPairs([module, isTest])
|
||||
final MultiMap<File, ModuleBuildTarget> rootsToDelete = new MultiMapBasedOnSet<File, ModuleBuildTarget>();
|
||||
final Set<File> annotationOutputs = new HashSet<File>(); // separate collection because no root intersection checks needed for annotation generated sources
|
||||
final Set<File> allSourceRoots = new HashSet<File>();
|
||||
|
||||
final ProjectPaths paths = context.getProjectPaths();
|
||||
|
||||
for (JpsModule module : modulesToClean) {
|
||||
final File out = paths.getModuleOutputDir(module, false);
|
||||
for (ModuleBuildTarget target : context.getChunks().getAllTargets()) {
|
||||
final File out = paths.getModuleOutputDir(target.getModule(), target.isTests());
|
||||
if (out != null) {
|
||||
appendRootInfo(rootsToDelete, out, module, false);
|
||||
}
|
||||
final File testOut = paths.getModuleOutputDir(module, true);
|
||||
if (testOut != null) {
|
||||
appendRootInfo(rootsToDelete, testOut, module, true);
|
||||
rootsToDelete.putValue(out, target);
|
||||
}
|
||||
|
||||
final AnnotationProcessingProfile profile = context.getAnnotationProcessingProfile(module);
|
||||
final AnnotationProcessingProfile profile = context.getAnnotationProcessingProfile(target.getModule());
|
||||
if (profile.isEnabled()) {
|
||||
File annotationOut =
|
||||
paths.getAnnotationProcessorGeneratedSourcesOutputDir(module, false, profile.getGeneratedSourcesDirName());
|
||||
if (annotationOut != null) {
|
||||
annotationOutputs.add(annotationOut);
|
||||
}
|
||||
annotationOut =
|
||||
paths.getAnnotationProcessorGeneratedSourcesOutputDir(module, true, profile.getGeneratedSourcesDirName());
|
||||
paths.getAnnotationProcessorGeneratedSourcesOutputDir(target.getModule(), target.isTests(), profile.getGeneratedSourcesDirName());
|
||||
if (annotationOut != null) {
|
||||
annotationOutputs.add(annotationOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (JpsModule module : context.getProjectDescriptor().jpsProject.getModules()) {
|
||||
final List<RootDescriptor> moduleRoots = context.getProjectDescriptor().rootsIndex.getModuleRoots(context, module);
|
||||
for (RootDescriptor d : moduleRoots) {
|
||||
allSourceRoots.add(d.root);
|
||||
@@ -348,7 +340,7 @@ public class IncProjectBuilder {
|
||||
|
||||
// check that output and source roots are not overlapping
|
||||
final List<File> filesToDelete = new ArrayList<File>();
|
||||
for (Map.Entry<File, Set<Pair<String, Boolean>>> entry : rootsToDelete.entrySet()) {
|
||||
for (Map.Entry<File, Collection<ModuleBuildTarget>> entry : rootsToDelete.entrySet()) {
|
||||
context.checkCanceled();
|
||||
boolean okToDelete = true;
|
||||
final File outputRoot = entry.getKey();
|
||||
@@ -370,8 +362,8 @@ public class IncProjectBuilder {
|
||||
else {
|
||||
context.processMessage(new CompilerMessage(BUILD_NAME, BuildMessage.Kind.WARNING, "Output path " + outputRoot.getPath() + " intersects with a source root. The output cannot be cleaned."));
|
||||
// clean only those files we are aware of
|
||||
for (Pair<String, Boolean> info : entry.getValue()) {
|
||||
clearOutputFiles(context, info.first, info.second);
|
||||
for (ModuleBuildTarget target : entry.getValue()) {
|
||||
clearOutputFiles(context, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -386,13 +378,13 @@ public class IncProjectBuilder {
|
||||
);
|
||||
}
|
||||
|
||||
private static void appendRootInfo(Map<File, Set<Pair<String, Boolean>>> rootsToDelete, File out, JpsModule module, boolean isTest) {
|
||||
Set<Pair<String, Boolean>> infos = rootsToDelete.get(out);
|
||||
private static void appendRootInfo(Map<File, Set<ModuleBuildTarget>> rootsToDelete, File out, ModuleBuildTarget target) {
|
||||
Set<ModuleBuildTarget> infos = rootsToDelete.get(out);
|
||||
if (infos == null) {
|
||||
infos = new HashSet<Pair<String, Boolean>>();
|
||||
infos = new HashSet<ModuleBuildTarget>();
|
||||
rootsToDelete.put(out, infos);
|
||||
}
|
||||
infos.add(Pair.create(module.getName(), isTest));
|
||||
infos.add(target);
|
||||
}
|
||||
|
||||
private static void runTasks(CompileContext context, final List<BuildTask> tasks) throws ProjectBuildException {
|
||||
@@ -636,7 +628,7 @@ public class IncProjectBuilder {
|
||||
}
|
||||
removedSources.put(target, deletedPaths);
|
||||
|
||||
final SourceToOutputMapping sourceToOutputStorage = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target.getModuleName(), target.isTests());
|
||||
final SourceToOutputMapping sourceToOutputStorage = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target);
|
||||
// actually delete outputs associated with removed paths
|
||||
for (String deletedSource : deletedPaths) {
|
||||
// deleting outputs corresponding to non-existing source
|
||||
@@ -786,19 +778,18 @@ public class IncProjectBuilder {
|
||||
|
||||
private static void syncOutputFiles(final CompileContext context, ModuleChunk chunk) throws ProjectBuildException {
|
||||
final BuildDataManager dataManager = context.getProjectDescriptor().dataManager;
|
||||
final boolean compilingTests = chunk.isTests();
|
||||
try {
|
||||
final Collection<String> allOutputs = new LinkedList<String>();
|
||||
|
||||
FSOperations.processFilesToRecompile(context, chunk, new FileProcessor() {
|
||||
private final Map<JpsModule, SourceToOutputMapping> storageMap = new HashMap<JpsModule, SourceToOutputMapping>();
|
||||
private final Map<ModuleBuildTarget, SourceToOutputMapping> storageMap = new HashMap<ModuleBuildTarget, SourceToOutputMapping>();
|
||||
|
||||
@Override
|
||||
public boolean apply(JpsModule module, File file, String sourceRoot) throws IOException {
|
||||
SourceToOutputMapping srcToOut = storageMap.get(module);
|
||||
public boolean apply(ModuleBuildTarget target, File file, String sourceRoot) throws IOException {
|
||||
SourceToOutputMapping srcToOut = storageMap.get(target);
|
||||
if (srcToOut == null) {
|
||||
srcToOut = dataManager.getSourceToOutputMap(module.getName(), compilingTests);
|
||||
storageMap.put(module, srcToOut);
|
||||
srcToOut = dataManager.getSourceToOutputMap(target);
|
||||
storageMap.put(target, srcToOut);
|
||||
}
|
||||
final String srcPath = FileUtil.toSystemIndependentName(file.getPath());
|
||||
final Collection<String> outputs = srcToOut.getState(srcPath);
|
||||
@@ -959,7 +950,7 @@ public class IncProjectBuilder {
|
||||
// handle deleted paths
|
||||
final BuildFSState fsState = pd.fsState;
|
||||
fsState.clearDeletedPaths(target);
|
||||
final SourceToOutputMapping sourceToOutputMap = pd.dataManager.getSourceToOutputMap(target.getModuleName(), target.isTests());
|
||||
final SourceToOutputMapping sourceToOutputMap = pd.dataManager.getSourceToOutputMap(target);
|
||||
for (final Iterator<String> it = sourceToOutputMap.getKeysIterator(); it.hasNext();) {
|
||||
final String path = it.next();
|
||||
// can check if the file exists
|
||||
|
||||
@@ -247,8 +247,7 @@ public abstract class ModuleLevelBuilder extends Builder {
|
||||
for (ModuleBuildTarget target : chunk.getTargets()) {
|
||||
final Collection<String> paths = map.remove(target);
|
||||
if (paths != null) {
|
||||
final SourceToOutputMapping storage = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target.getModuleName(),
|
||||
target.isTests());
|
||||
final SourceToOutputMapping storage = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target);
|
||||
for (String path : paths) {
|
||||
storage.remove(path);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class BuildFSState extends FSState {
|
||||
if (excludes.isExcluded(file)) {
|
||||
continue;
|
||||
}
|
||||
if (!processor.apply(target.getModule(), file, root)) {
|
||||
if (!processor.apply(target, file, root)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
isTemp = rootDescriptor.isTemp;
|
||||
if (!isTemp) {
|
||||
try {
|
||||
dataManager.getSourceToOutputMap(rootDescriptor.module, rootDescriptor.target.isTests()).appendData(sourcePath, outputPath);
|
||||
dataManager.getSourceToOutputMap(rootDescriptor.target).appendData(sourcePath, outputPath);
|
||||
}
|
||||
catch (Exception e) {
|
||||
context.processMessage(new CompilerMessage(BUILDER_NAME, e));
|
||||
@@ -149,7 +149,7 @@ public class JavaBuilder extends ModuleLevelBuilder {
|
||||
final Set<File> formsToCompile = new HashSet<File>();
|
||||
|
||||
FSOperations.processFilesToRecompile(context, chunk, new FileProcessor() {
|
||||
public boolean apply(JpsModule module, File file, String sourceRoot) throws IOException {
|
||||
public boolean apply(ModuleBuildTarget target, File file, String sourceRoot) throws IOException {
|
||||
if (JAVA_SOURCES_FILTER.accept(file)) {
|
||||
filesToCompile.add(file);
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ public class ResourcesBuilder extends ModuleLevelBuilder {
|
||||
};
|
||||
|
||||
FSOperations.processFilesToRecompile(context, chunk, moduleFilter, new FileProcessor() {
|
||||
public boolean apply(final JpsModule module, final File file, final String sourceRoot) throws IOException {
|
||||
public boolean apply(final ModuleBuildTarget target, final File file, final String sourceRoot) throws IOException {
|
||||
if (patterns.isResourceFile(file, sourceRoot)) {
|
||||
try {
|
||||
context.processMessage(new ProgressMessage("Copying " + file.getPath()));
|
||||
doneSomething.set(true);
|
||||
copyResource(
|
||||
context, module, file, sourceRoot,
|
||||
context.getProjectDescriptor().dataManager.getSourceToOutputMap(module.getName(), chunk.isTests()), chunk.isTests()
|
||||
context, target.getModule(), file, sourceRoot,
|
||||
context.getProjectDescriptor().dataManager.getSourceToOutputMap(target), target.isTests()
|
||||
);
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.ether.dependencyView.Mappings;
|
||||
import org.jetbrains.jps.ModuleChunk;
|
||||
import org.jetbrains.jps.builders.BuildTarget;
|
||||
import org.jetbrains.jps.incremental.ModuleBuildTarget;
|
||||
import org.jetbrains.jps.incremental.artifacts.ArtifactsBuildData;
|
||||
|
||||
@@ -26,8 +27,7 @@ public class BuildDataManager implements StorageOwner {
|
||||
private static final String MAPPINGS_STORAGE = "mappings";
|
||||
|
||||
private final Object mySourceToOutputLock = new Object();
|
||||
private final Map<String, SourceToOutputMapping> myProductionSourceToOutputs = new HashMap<String, SourceToOutputMapping>();
|
||||
private final Map<String, SourceToOutputMapping> myTestSourceToOutputs = new HashMap<String, SourceToOutputMapping>();
|
||||
private final Map<BuildTarget, SourceToOutputMapping> mySourceToOutputs = new HashMap<BuildTarget, SourceToOutputMapping>();
|
||||
|
||||
private final SourceToFormMapping mySrcToFormMap;
|
||||
private final ArtifactsBuildData myArtifactsBuildData;
|
||||
@@ -49,15 +49,15 @@ public class BuildDataManager implements StorageOwner {
|
||||
return new File(myDataStorageRoot, "output-roots");
|
||||
}
|
||||
|
||||
public SourceToOutputMapping getSourceToOutputMap(final String moduleName, final boolean testSources) throws IOException {
|
||||
String lowerCaseModuleName = moduleName.toLowerCase(Locale.US);
|
||||
final Map<String, SourceToOutputMapping> storageMap = testSources ? myTestSourceToOutputs : myProductionSourceToOutputs;
|
||||
public SourceToOutputMapping getSourceToOutputMap(final ModuleBuildTarget target) throws IOException {
|
||||
final boolean testSources = target.isTests();
|
||||
SourceToOutputMapping mapping;
|
||||
synchronized (mySourceToOutputLock) {
|
||||
mapping = storageMap.get(lowerCaseModuleName);
|
||||
mapping = mySourceToOutputs.get(target);
|
||||
if (mapping == null) {
|
||||
String lowerCaseModuleName = target.getModuleName().toLowerCase(Locale.US);
|
||||
mapping = new SourceToOutputMapping(new File(getSourceToOutputRoot(lowerCaseModuleName, testSources), "data"));
|
||||
storageMap.put(lowerCaseModuleName, mapping);
|
||||
mySourceToOutputs.put(target, mapping);
|
||||
}
|
||||
}
|
||||
return mapping;
|
||||
@@ -122,12 +122,7 @@ public class BuildDataManager implements StorageOwner {
|
||||
public void flush(boolean memoryCachesOnly) {
|
||||
myArtifactsBuildData.flush(memoryCachesOnly);
|
||||
synchronized (mySourceToOutputLock) {
|
||||
for (Map.Entry<String, SourceToOutputMapping> entry : myProductionSourceToOutputs.entrySet()) {
|
||||
final SourceToOutputMapping mapping = entry.getValue();
|
||||
mapping.flush(memoryCachesOnly);
|
||||
}
|
||||
for (Map.Entry<String, SourceToOutputMapping> entry : myTestSourceToOutputs.entrySet()) {
|
||||
final SourceToOutputMapping mapping = entry.getValue();
|
||||
for (SourceToOutputMapping mapping : mySourceToOutputs.values()) {
|
||||
mapping.flush(memoryCachesOnly);
|
||||
}
|
||||
}
|
||||
@@ -183,9 +178,7 @@ public class BuildDataManager implements StorageOwner {
|
||||
synchronized (mySourceToOutputLock) {
|
||||
for (ModuleChunk chunk : chunks) {
|
||||
for (ModuleBuildTarget target : chunk.getTargets()) {
|
||||
final Map<String, SourceToOutputMapping> storageMap = target.isTests() ? myTestSourceToOutputs : myProductionSourceToOutputs;
|
||||
final String moduleName = target.getModuleName().toLowerCase(Locale.US);
|
||||
final SourceToOutputMapping mapping = storageMap.remove(moduleName);
|
||||
final SourceToOutputMapping mapping = mySourceToOutputs.remove(target);
|
||||
if (mapping != null) {
|
||||
mapping.close();
|
||||
}
|
||||
@@ -197,19 +190,9 @@ public class BuildDataManager implements StorageOwner {
|
||||
private void closeSourceToOutputStorages() throws IOException {
|
||||
IOException ex = null;
|
||||
try {
|
||||
for (Map.Entry<String, SourceToOutputMapping> entry : myProductionSourceToOutputs.entrySet()) {
|
||||
for (SourceToOutputMapping mapping : mySourceToOutputs.values()) {
|
||||
try {
|
||||
entry.getValue().close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
if (e != null) {
|
||||
ex = e;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, SourceToOutputMapping> entry : myTestSourceToOutputs.entrySet()) {
|
||||
try {
|
||||
entry.getValue().close();
|
||||
mapping.close();
|
||||
}
|
||||
catch (IOException e) {
|
||||
if (e != null) {
|
||||
@@ -219,8 +202,7 @@ public class BuildDataManager implements StorageOwner {
|
||||
}
|
||||
}
|
||||
finally {
|
||||
myProductionSourceToOutputs.clear();
|
||||
myTestSourceToOutputs.clear();
|
||||
mySourceToOutputs.clear();
|
||||
}
|
||||
if (ex != null) {
|
||||
throw ex;
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public final class SourceToOutputMapping extends AbstractStateStorage<String, Co
|
||||
return super.getState(FileUtil.toSystemIndependentName(srcPath));
|
||||
}
|
||||
|
||||
protected static Collection<String> normalizePaths(Collection<String> outputs) {
|
||||
private static Collection<String> normalizePaths(Collection<String> outputs) {
|
||||
Collection<String> normalized = new ArrayList<String>(outputs.size());
|
||||
for (String out : outputs) {
|
||||
normalized.add(FileUtil.toSystemIndependentName(out));
|
||||
|
||||
+20
-20
@@ -101,13 +101,13 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
final Map<File, JpsModule> idlFilesToCompile = new HashMap<File, JpsModule>();
|
||||
final Map<File, JpsModule> rsFilesToCompile = new HashMap<File, JpsModule>();
|
||||
final Map<File, ModuleBuildTarget> idlFilesToCompile = new HashMap<File, ModuleBuildTarget>();
|
||||
final Map<File, ModuleBuildTarget> rsFilesToCompile = new HashMap<File, ModuleBuildTarget>();
|
||||
|
||||
FSOperations.processFilesToRecompile(context, chunk, new FileProcessor() {
|
||||
@Override
|
||||
public boolean apply(JpsModule module, File file, String sourceRoot) throws IOException {
|
||||
final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);
|
||||
public boolean apply(ModuleBuildTarget target, File file, String sourceRoot) throws IOException {
|
||||
final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(target.getModule());
|
||||
|
||||
if (extension == null) {
|
||||
return true;
|
||||
@@ -115,10 +115,10 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
final String ext = FileUtil.getExtension(file.getName());
|
||||
|
||||
if (AIDL_EXTENSION.equals(ext)) {
|
||||
idlFilesToCompile.put(file, module);
|
||||
idlFilesToCompile.put(file, target);
|
||||
}
|
||||
else if (RENDERSCRIPT_EXTENSION.equals(ext)) {
|
||||
rsFilesToCompile.put(file, module);
|
||||
rsFilesToCompile.put(file, target);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -363,7 +363,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
|
||||
private static boolean runAidlCompiler(@NotNull final CompileContext context,
|
||||
@NotNull Map<File, JpsModule> files,
|
||||
@NotNull Map<File, ModuleBuildTarget> files,
|
||||
@NotNull Map<JpsModule, MyModuleData> moduleDataMap) {
|
||||
if (files.size() > 0) {
|
||||
context.processMessage(new ProgressMessage(AndroidJpsBundle.message("android.jps.progress.aidl")));
|
||||
@@ -371,12 +371,12 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
|
||||
boolean success = true;
|
||||
|
||||
for (Map.Entry<File, JpsModule> entry : files.entrySet()) {
|
||||
for (Map.Entry<File, ModuleBuildTarget> entry : files.entrySet()) {
|
||||
final File file = entry.getKey();
|
||||
final JpsModule module = entry.getValue();
|
||||
final ModuleBuildTarget buildTarget = entry.getValue();
|
||||
final String filePath = file.getPath();
|
||||
|
||||
final MyModuleData moduleData = moduleDataMap.get(module);
|
||||
final MyModuleData moduleData = moduleDataMap.get(buildTarget.getModule());
|
||||
|
||||
if (!LOG.assertTrue(moduleData != null)) {
|
||||
context.processMessage(
|
||||
@@ -384,7 +384,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
success = false;
|
||||
continue;
|
||||
}
|
||||
final File generatedSourcesDir = AndroidJpsUtil.getGeneratedSourcesStorage(module, context.getProjectDescriptor().dataManager);
|
||||
final File generatedSourcesDir = AndroidJpsUtil.getGeneratedSourcesStorage(buildTarget.getModule(), context.getProjectDescriptor().dataManager);
|
||||
final File aidlOutputDirectory = new File(generatedSourcesDir, AndroidJpsUtil.AIDL_GENERATED_SOURCE_ROOT_NAME);
|
||||
|
||||
if (!aidlOutputDirectory.exists() && !aidlOutputDirectory.mkdirs()) {
|
||||
@@ -398,7 +398,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
final IAndroidTarget target = moduleData.getPlatform().getTarget();
|
||||
|
||||
try {
|
||||
final File[] sourceRoots = AndroidJpsUtil.getSourceRootsForModuleAndDependencies(module);
|
||||
final File[] sourceRoots = AndroidJpsUtil.getSourceRootsForModuleAndDependencies(buildTarget.getModule());
|
||||
final String[] sourceRootPaths = AndroidJpsUtil.toPaths(sourceRoots);
|
||||
final String packageName = computePackageForFile(context, file);
|
||||
|
||||
@@ -421,7 +421,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
success = false;
|
||||
}
|
||||
else {
|
||||
final SourceToOutputMapping sourceToOutputMap = context.getProjectDescriptor().dataManager.getSourceToOutputMap(module.getName(), false);
|
||||
final SourceToOutputMapping sourceToOutputMap = context.getProjectDescriptor().dataManager.getSourceToOutputMap(buildTarget);
|
||||
sourceToOutputMap.update(filePath, outputFilePath);
|
||||
FSOperations.markDirty(context, outputFile);
|
||||
}
|
||||
@@ -435,7 +435,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
|
||||
private static boolean runRenderscriptCompiler(@NotNull final CompileContext context,
|
||||
@NotNull Map<File, JpsModule> files,
|
||||
@NotNull Map<File, ModuleBuildTarget> files,
|
||||
@NotNull Map<JpsModule, MyModuleData> moduleDataMap) {
|
||||
if (files.size() > 0) {
|
||||
context.processMessage(new ProgressMessage(AndroidJpsBundle.message("android.jps.progress.renderscript")));
|
||||
@@ -443,11 +443,11 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
|
||||
boolean success = true;
|
||||
|
||||
for (Map.Entry<File, JpsModule> entry : files.entrySet()) {
|
||||
for (Map.Entry<File, ModuleBuildTarget> entry : files.entrySet()) {
|
||||
final File file = entry.getKey();
|
||||
final JpsModule module = entry.getValue();
|
||||
final ModuleBuildTarget buildTarget = entry.getValue();
|
||||
|
||||
final MyModuleData moduleData = moduleDataMap.get(module);
|
||||
final MyModuleData moduleData = moduleDataMap.get(buildTarget.getModule());
|
||||
if (!LOG.assertTrue(moduleData != null)) {
|
||||
context.processMessage(new CompilerMessage(ANDROID_RENDERSCRIPT_COMPILER, BuildMessage.Kind.ERROR,
|
||||
AndroidJpsBundle.message("android.jps.internal.error")));
|
||||
@@ -456,7 +456,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
|
||||
final BuildDataManager dataManager = context.getProjectDescriptor().dataManager;
|
||||
final File generatedSourcesDir = AndroidJpsUtil.getGeneratedSourcesStorage(module, dataManager);
|
||||
final File generatedSourcesDir = AndroidJpsUtil.getGeneratedSourcesStorage(buildTarget.getModule(), dataManager);
|
||||
final File rsOutputDirectory = new File(generatedSourcesDir, AndroidJpsUtil.RENDERSCRIPT_GENERATED_SOURCE_ROOT_NAME);
|
||||
if (!rsOutputDirectory.exists() && !rsOutputDirectory.mkdirs()) {
|
||||
context.processMessage(new CompilerMessage(ANDROID_RENDERSCRIPT_COMPILER, BuildMessage.Kind.ERROR, AndroidJpsBundle
|
||||
@@ -465,7 +465,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
continue;
|
||||
}
|
||||
|
||||
final File generatedResourcesDir = AndroidJpsUtil.getGeneratedResourcesStorage(module, dataManager);
|
||||
final File generatedResourcesDir = AndroidJpsUtil.getGeneratedResourcesStorage(buildTarget.getModule(), dataManager);
|
||||
final File rawDir = new File(generatedResourcesDir, "raw");
|
||||
|
||||
if (!rawDir.exists() && !rawDir.mkdirs()) {
|
||||
@@ -504,7 +504,7 @@ public class AndroidSourceGeneratingBuilder extends ModuleLevelBuilder {
|
||||
}
|
||||
final List<String> newFilePaths = Arrays.asList(AndroidJpsUtil.toPaths(newFiles.toArray(new File[newFiles.size()])));
|
||||
|
||||
final SourceToOutputMapping sourceToOutputMap = dataManager.getSourceToOutputMap(module.getName(), false);
|
||||
final SourceToOutputMapping sourceToOutputMap = dataManager.getSourceToOutputMap(buildTarget);
|
||||
sourceToOutputMap.update(filePath, newFilePaths);
|
||||
|
||||
for (File newFile : newFiles) {
|
||||
|
||||
@@ -235,7 +235,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
|
||||
assert patterns != null;
|
||||
final List<File> toCompile = new ArrayList<File>();
|
||||
FSOperations.processFilesToRecompile(context, chunk, new FileProcessor() {
|
||||
public boolean apply(JpsModule module, File file, String sourceRoot) throws IOException {
|
||||
public boolean apply(ModuleBuildTarget target, File file, String sourceRoot) throws IOException {
|
||||
final String path = file.getPath();
|
||||
if (isGroovyFile(path) && !patterns.isResourceFile(file, sourceRoot)) { //todo file type check
|
||||
toCompile.add(file);
|
||||
@@ -264,7 +264,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
|
||||
final RootDescriptor moduleAndRoot = context.getProjectDescriptor().rootsIndex.getModuleAndRoot(context, new File(sourcePath));
|
||||
if (moduleAndRoot != null) {
|
||||
final String moduleName = moduleAndRoot.module;
|
||||
context.getProjectDescriptor().dataManager.getSourceToOutputMap(moduleName, moduleAndRoot.isTestRoot).appendData(sourcePath, outputPath);
|
||||
context.getProjectDescriptor().dataManager.getSourceToOutputMap(moduleAndRoot.target).appendData(sourcePath, outputPath);
|
||||
String moduleOutputPath = generationOutputs.get(context.getProjectDescriptor().rootsIndex.getModuleByName(moduleName));
|
||||
generatedEvent.add(moduleOutputPath, FileUtil.getRelativePath(moduleOutputPath, outputPath, '/'));
|
||||
}
|
||||
@@ -299,7 +299,7 @@ public class GroovyBuilder extends ModuleLevelBuilder {
|
||||
final Map<String, String> class2Src = new HashMap<String, String>();
|
||||
for (ModuleBuildTarget target : chunk.getTargets()) {
|
||||
String moduleOutputPath = finalOutputs.get(target.getModule());
|
||||
final SourceToOutputMapping srcToOut = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target.getModuleName(), target.isTests());
|
||||
final SourceToOutputMapping srcToOut = context.getProjectDescriptor().dataManager.getSourceToOutputMap(target);
|
||||
for (String src : srcToOut.getKeys()) {
|
||||
if (!toCompilePaths.contains(src) && isGroovyFile(src) &&
|
||||
!context.getProjectDescriptor().project.getCompilerConfiguration().getExcludes().isExcluded(new File(src))) {
|
||||
|
||||
Reference in New Issue
Block a user