diff --git a/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildAction.java b/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildAction.java index 39e9fd3cf801..6cc8ac059f34 100644 --- a/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildAction.java +++ b/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildAction.java @@ -94,7 +94,7 @@ public class GenerateAntBuildAction extends CompileActionBase { } int rc = Messages .showOkCancelDialog(project, CompilerBundle.message("generate.ant.build.custom.compiler.conflict.message", msg.toString()), - CompilerBundle.message("generate.ant.build.custom.compiler.conflict.titile"), Messages.getErrorIcon()); + CompilerBundle.message("generate.ant.build.custom.compiler.conflict.title"), Messages.getErrorIcon()); if (rc != 0) { return false; } diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/ChunkBuild.java b/java/compiler/impl/src/com/intellij/compiler/ant/ChunkBuild.java index 39e2fa1dd618..31ad7ca0bf30 100644 --- a/java/compiler/impl/src/com/intellij/compiler/ant/ChunkBuild.java +++ b/java/compiler/impl/src/com/intellij/compiler/ant/ChunkBuild.java @@ -61,8 +61,10 @@ public class ChunkBuild extends CompositeGenerator{ add(new Property(BuildProperties.getOutputPathForTestsProperty(chunk.getName()), location)); add(createBootclasspath(chunk), 1); - add(new ModuleChunkClasspath(chunk, genOptions, false), 1); - add(new ModuleChunkClasspath(chunk, genOptions, true), 1); + add(new ModuleChunkClasspath(chunk, genOptions, false, false), 1); + add(new ModuleChunkClasspath(chunk, genOptions, true, false), 1); + add(new ModuleChunkClasspath(chunk, genOptions, false, true), 1); + add(new ModuleChunkClasspath(chunk, genOptions, true, true), 1); final ModuleChunkSourcepath moduleSources = new ModuleChunkSourcepath(project, chunk, genOptions); add(moduleSources, 1); diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java b/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java index 484c78613e30..245fc339c06d 100644 --- a/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java +++ b/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java @@ -33,175 +33,169 @@ import java.util.Map; * Date: Mar 19, 2004 */ public class CompileModuleChunkTarget extends CompositeGenerator { - private final Target myMainTarget; - private final Target myProductionTarget; - private final Target myTestsTarget; - public CompileModuleChunkTarget(final Project project, - ModuleChunk moduleChunk, - VirtualFile[] sourceRoots, - VirtualFile[] testSourceRoots, - File baseDir, - GenerationOptions genOptions) { - final String moduleChunkName = moduleChunk.getName(); - //noinspection HardCodedStringLiteral - final Tag compilerArgs = new Tag("compilerarg", Pair.create("line", BuildProperties.propertyRef( - BuildProperties.getModuleChunkCompilerArgsProperty(moduleChunkName)))); - //noinspection HardCodedStringLiteral - final Pair classpathRef = Pair.create("refid", BuildProperties.getClasspathProperty(moduleChunkName)); - final Tag classpathTag = new Tag("classpath", classpathRef); - //noinspection HardCodedStringLiteral - final Tag bootclasspathTag = - new Tag("bootclasspath", Pair.create("refid", BuildProperties.getBootClasspathProperty(moduleChunkName))); - final PatternSetRef compilerExcludes = new PatternSetRef(BuildProperties.getExcludedFromCompilationProperty(moduleChunkName)); + public CompileModuleChunkTarget(final Project project, + ModuleChunk moduleChunk, + VirtualFile[] sourceRoots, + VirtualFile[] testSourceRoots, + File baseDir, + GenerationOptions genOptions) { + final String moduleChunkName = moduleChunk.getName(); + //noinspection HardCodedStringLiteral + final Tag compilerArgs = new Tag("compilerarg", Pair.create("line", BuildProperties.propertyRef( + BuildProperties.getModuleChunkCompilerArgsProperty(moduleChunkName)))); + //noinspection HardCodedStringLiteral + final Pair classpathRef = Pair.create("refid", BuildProperties.getClasspathProperty(moduleChunkName)); + final Tag classpathTag = new Tag("classpath", classpathRef); + //noinspection HardCodedStringLiteral + final Tag bootclasspathTag = + new Tag("bootclasspath", Pair.create("refid", BuildProperties.getBootClasspathProperty(moduleChunkName))); + final PatternSetRef compilerExcludes = new PatternSetRef(BuildProperties.getExcludedFromCompilationProperty(moduleChunkName)); - final String mainTargetName = BuildProperties.getCompileTargetName(moduleChunkName); - final @NonNls String productionTargetName = mainTargetName + ".production"; - final @NonNls String testsTargetName = mainTargetName + ".tests"; + final String mainTargetName = BuildProperties.getCompileTargetName(moduleChunkName); + final @NonNls String productionTargetName = mainTargetName + ".production"; + final @NonNls String testsTargetName = mainTargetName + ".tests"; - final int modulesCount = moduleChunk.getModules().length; - myMainTarget = new Target(mainTargetName, productionTargetName + "," + testsTargetName, - CompilerBundle.message("generated.ant.build.compile.modules.main.target.comment", modulesCount, - moduleChunkName), null); - myProductionTarget = new Target(productionTargetName, getChunkDependenciesString(moduleChunk), - CompilerBundle.message("generated.ant.build.compile.modules.production.classes.target.comment", - modulesCount, moduleChunkName), null); - myTestsTarget = new Target(testsTargetName, productionTargetName, - CompilerBundle.message("generated.ant.build.compile.modules.tests.target.comment", modulesCount, - moduleChunkName), BuildProperties.PROPERTY_SKIP_TESTS); - final ChunkCustomCompilerExtension[] customCompilers = moduleChunk.getCustomCompilers(); + final int modulesCount = moduleChunk.getModules().length; + Target mainTarget = new Target(mainTargetName, productionTargetName + "," + testsTargetName, + CompilerBundle.message("generated.ant.build.compile.modules.main.target.comment", modulesCount, + moduleChunkName), null); + Target productionTarget = new Target(productionTargetName, getChunkDependenciesString(moduleChunk), + CompilerBundle.message("generated.ant.build.compile.modules.production.classes.target.comment", + modulesCount, moduleChunkName), null); + Target testsTarget = new Target(testsTargetName, productionTargetName, + CompilerBundle.message("generated.ant.build.compile.modules.tests.target.comment", modulesCount, + moduleChunkName), BuildProperties.PROPERTY_SKIP_TESTS); + final ChunkCustomCompilerExtension[] customCompilers = moduleChunk.getCustomCompilers(); - if (sourceRoots.length > 0) { - final String outputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathProperty(moduleChunkName)); - final Tag srcTag = new Tag("src", Pair.create("refid", BuildProperties.getSourcepathProperty(moduleChunkName))); - myProductionTarget.add(new Mkdir(outputPathRef)); - createCustomCompilerTasks(project, moduleChunk, genOptions, false, customCompilers, compilerArgs, bootclasspathTag, - classpathTag, compilerExcludes, srcTag, outputPathRef, myProductionTarget); - if (customCompilers.length == 0 || genOptions.enableFormCompiler) { - final Javac javac = new Javac(genOptions, moduleChunk, outputPathRef); - javac.add(compilerArgs); - javac.add(bootclasspathTag); - javac.add(classpathTag); - //noinspection HardCodedStringLiteral - javac.add(srcTag); - javac.add(compilerExcludes); - myProductionTarget.add(javac); - } - myProductionTarget.add(createCopyTask(project, moduleChunk, sourceRoots, outputPathRef, baseDir, genOptions)); - } - - if (testSourceRoots.length > 0) { - final String testOutputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathForTestsProperty(moduleChunkName)); - final Tag srcTag = new Tag("src", Pair.create("refid", BuildProperties.getTestSourcepathProperty(moduleChunkName))); - final Tag testClassPath = new Tag("classpath"); - testClassPath.add(new Tag("path", classpathRef)); - testClassPath.add(new PathElement(BuildProperties.propertyRef(BuildProperties.getOutputPathProperty(moduleChunkName)))); - myTestsTarget.add(new Mkdir(testOutputPathRef)); - createCustomCompilerTasks(project, moduleChunk, genOptions, true, customCompilers, compilerArgs, bootclasspathTag, - testClassPath, compilerExcludes, srcTag, testOutputPathRef, myTestsTarget); - if (customCompilers.length == 0 || genOptions.enableFormCompiler) { - final Javac javac = new Javac(genOptions, moduleChunk, testOutputPathRef); - javac.add(compilerArgs); - javac.add(classpathTag); - //noinspection HardCodedStringLiteral - javac.add(testClassPath); - //noinspection HardCodedStringLiteral - javac.add(srcTag); - javac.add(compilerExcludes); - myTestsTarget.add(javac); - } - myTestsTarget.add(createCopyTask(project, moduleChunk, testSourceRoots, testOutputPathRef, baseDir, genOptions)); - } - - add(myMainTarget); - add(myProductionTarget, 1); - add(myTestsTarget, 1); + if (sourceRoots.length > 0) { + final String outputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathProperty(moduleChunkName)); + final Tag srcTag = new Tag("src", Pair.create("refid", BuildProperties.getSourcepathProperty(moduleChunkName))); + productionTarget.add(new Mkdir(outputPathRef)); + createCustomCompilerTasks(project, moduleChunk, genOptions, false, customCompilers, compilerArgs, bootclasspathTag, + classpathTag, compilerExcludes, srcTag, outputPathRef, productionTarget); + if (customCompilers.length == 0 || genOptions.enableFormCompiler) { + final Javac javac = new Javac(genOptions, moduleChunk, outputPathRef); + javac.add(compilerArgs); + javac.add(bootclasspathTag); + javac.add(classpathTag); + javac.add(srcTag); + javac.add(compilerExcludes); + productionTarget.add(javac); + } + productionTarget.add(createCopyTask(project, moduleChunk, sourceRoots, outputPathRef, baseDir, genOptions)); } - /** - * Create custom compiler tasks - * - * @param project the proejct - * @param moduleChunk the module chunkc - * @param genOptions generation options - * @param compileTests if true tests are being compiled - * @param customCompilers an array of custom compilers for this cunk - * @param compilerArgs the javac compilier arguements - * @param bootclasspathTag the boot classpath element for the javac compiler - * @param classpathTag the classpath tag for the javac compiler - * @param compilerExcludes the compiler excluded tag - * @param srcTag the soruce tag - * @param outputPathRef the output path references - * @param target the target where to add custom compiler - */ - private void createCustomCompilerTasks(Project project, - ModuleChunk moduleChunk, - GenerationOptions genOptions, - boolean compileTests, - ChunkCustomCompilerExtension[] customCompilers, - Tag compilerArgs, - Tag bootclasspathTag, - Tag classpathTag, - PatternSetRef compilerExcludes, - Tag srcTag, - String outputPathRef, - Target target) { - if (customCompilers.length > 1) { - target.add(new Tag("fail", Pair.create("message", CompilerBundle.message( - "generated.ant.build.compile.modules.fail.custom.comipilers")))); - } - for (ChunkCustomCompilerExtension ext : customCompilers) { - ext.generateCustomCompile(project, moduleChunk, genOptions, compileTests, target, compilerArgs, bootclasspathTag, - classpathTag, compilerExcludes, srcTag, outputPathRef); - } + if (testSourceRoots.length > 0) { + + final String testOutputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathForTestsProperty(moduleChunkName)); + final Tag srcTag = new Tag("src", Pair.create("refid", BuildProperties.getTestSourcepathProperty(moduleChunkName))); + final Pair testClasspathRef = Pair.create("refid", BuildProperties.getTestClasspathProperty(moduleChunkName)); + final Tag testClassPath = new Tag("classpath", testClasspathRef); + testsTarget.add(new Mkdir(testOutputPathRef)); + createCustomCompilerTasks(project, moduleChunk, genOptions, true, customCompilers, compilerArgs, bootclasspathTag, + testClassPath, compilerExcludes, srcTag, testOutputPathRef, testsTarget); + if (customCompilers.length == 0 || genOptions.enableFormCompiler) { + final Javac javac = new Javac(genOptions, moduleChunk, testOutputPathRef); + javac.add(compilerArgs); + javac.add(bootclasspathTag); + javac.add(testClassPath); + javac.add(srcTag); + javac.add(compilerExcludes); + testsTarget.add(javac); + } + testsTarget.add(createCopyTask(project, moduleChunk, testSourceRoots, testOutputPathRef, baseDir, genOptions)); } - private String getChunkDependenciesString(ModuleChunk moduleChunk) { - final StringBuffer moduleDependencies = new StringBuffer(); - final ModuleChunk[] dependencies = moduleChunk.getDependentChunks(); - for (int idx = 0; idx < dependencies.length; idx++) { - final ModuleChunk dependency = dependencies[idx]; - if (idx > 0) { - moduleDependencies.append(","); - } - moduleDependencies.append(BuildProperties.getCompileTargetName(dependency.getName())); - } - return moduleDependencies.toString(); - } + add(mainTarget); + add(productionTarget, 1); + add(testsTarget, 1); + } - private static Generator createCopyTask(final Project project, - ModuleChunk chunk, - VirtualFile[] sourceRoots, - String toDir, - File baseDir, - final GenerationOptions genOptions) { - //noinspection HardCodedStringLiteral - final Tag filesSelector = new Tag("type", Pair.create("type", "file")); - final PatternSetRef excludes = CompilerExcludes.isAvailable(project) ? new PatternSetRef( - BuildProperties.getExcludedFromCompilationProperty(chunk.getName())) : null; - final PatternSetRef resourcePatternsPatternSet = new PatternSetRef(BuildProperties.PROPERTY_COMPILER_RESOURCE_PATTERNS); - final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); - final CompositeGenerator composite = new CompositeGenerator(); - final Map outputDirToTaskMap = new HashMap(); - for (final VirtualFile root : sourceRoots) { - final String packagePrefix = fileIndex.getPackageNameByDirectory(root); - final String targetDir = - packagePrefix != null && packagePrefix.length() > 0 ? toDir + "/" + packagePrefix.replace('.', '/') : toDir; - Copy copy = outputDirToTaskMap.get(targetDir); - if (copy == null) { - copy = new Copy(targetDir); - outputDirToTaskMap.put(targetDir, copy); - composite.add(copy); - } - final FileSet fileSet = new FileSet( - GenerationUtils.toRelativePath(root, baseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions)); - fileSet.add(resourcePatternsPatternSet); - fileSet.add(filesSelector); - if (excludes != null) { - fileSet.add(excludes); - } - copy.add(fileSet); - } - return composite; + /** + * Create custom compiler tasks + * + * @param project the proejct + * @param moduleChunk the module chunkc + * @param genOptions generation options + * @param compileTests if true tests are being compiled + * @param customCompilers an array of custom compilers for this cunk + * @param compilerArgs the javac compilier arguements + * @param bootclasspathTag the boot classpath element for the javac compiler + * @param classpathTag the classpath tag for the javac compiler + * @param compilerExcludes the compiler excluded tag + * @param srcTag the soruce tag + * @param outputPathRef the output path references + * @param target the target where to add custom compiler + */ + private static void createCustomCompilerTasks(Project project, + ModuleChunk moduleChunk, + GenerationOptions genOptions, + boolean compileTests, + ChunkCustomCompilerExtension[] customCompilers, + Tag compilerArgs, + Tag bootclasspathTag, + Tag classpathTag, + PatternSetRef compilerExcludes, + Tag srcTag, + String outputPathRef, + Target target) { + if (customCompilers.length > 1) { + target.add(new Tag("fail", Pair.create("message", CompilerBundle.message( + "generated.ant.build.compile.modules.fail.custom.compilers")))); } + for (ChunkCustomCompilerExtension ext : customCompilers) { + ext.generateCustomCompile(project, moduleChunk, genOptions, compileTests, target, compilerArgs, bootclasspathTag, + classpathTag, compilerExcludes, srcTag, outputPathRef); + } + } + + private static String getChunkDependenciesString(ModuleChunk moduleChunk) { + final StringBuffer moduleDependencies = new StringBuffer(); + final ModuleChunk[] dependencies = moduleChunk.getDependentChunks(); + for (int idx = 0; idx < dependencies.length; idx++) { + final ModuleChunk dependency = dependencies[idx]; + if (idx > 0) { + moduleDependencies.append(","); + } + moduleDependencies.append(BuildProperties.getCompileTargetName(dependency.getName())); + } + return moduleDependencies.toString(); + } + + private static Generator createCopyTask(final Project project, + ModuleChunk chunk, + VirtualFile[] sourceRoots, + String toDir, + File baseDir, + final GenerationOptions genOptions) { + //noinspection HardCodedStringLiteral + final Tag filesSelector = new Tag("type", Pair.create("type", "file")); + final PatternSetRef excludes = CompilerExcludes.isAvailable(project) ? new PatternSetRef( + BuildProperties.getExcludedFromCompilationProperty(chunk.getName())) : null; + final PatternSetRef resourcePatternsPatternSet = new PatternSetRef(BuildProperties.PROPERTY_COMPILER_RESOURCE_PATTERNS); + final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); + final CompositeGenerator composite = new CompositeGenerator(); + final Map outputDirToTaskMap = new HashMap(); + for (final VirtualFile root : sourceRoots) { + final String packagePrefix = fileIndex.getPackageNameByDirectory(root); + final String targetDir = + packagePrefix != null && packagePrefix.length() > 0 ? toDir + "/" + packagePrefix.replace('.', '/') : toDir; + Copy copy = outputDirToTaskMap.get(targetDir); + if (copy == null) { + copy = new Copy(targetDir); + outputDirToTaskMap.put(targetDir, copy); + composite.add(copy); + } + final FileSet fileSet = new FileSet( + GenerationUtils.toRelativePath(root, baseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions)); + fileSet.add(resourcePatternsPatternSet); + fileSet.add(filesSelector); + if (excludes != null) { + fileSet.add(excludes); + } + copy.add(fileSet); + } + return composite; + } } diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java b/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java index 0cf89fa45299..b8413cbafcbf 100644 --- a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java +++ b/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java @@ -45,12 +45,14 @@ public class ModuleChunkClasspath extends Path { * @param chunk a chunk to process * @param genOptions a generation options * @param generateRuntimeClasspath if true, runtime classpath is being generated. Otherwise a compile time classpath is constructed + * @param generateTestClasspath if true, a test classpath is generated. */ @SuppressWarnings({"unchecked"}) - public ModuleChunkClasspath(final ModuleChunk chunk, final GenerationOptions genOptions, final boolean generateRuntimeClasspath) { - super(generateRuntimeClasspath - ? BuildProperties.getRuntimeClasspathProperty(chunk.getName()) - : BuildProperties.getClasspathProperty(chunk.getName())); + public ModuleChunkClasspath(final ModuleChunk chunk, + final GenerationOptions genOptions, + final boolean generateRuntimeClasspath, + final boolean generateTestClasspath) { + super(generateClasspathName(chunk, generateRuntimeClasspath, generateTestClasspath)); final OrderedSet pathItems = new OrderedSet((TObjectHashingStrategy)TObjectHashingStrategy.CANONICAL); @@ -87,6 +89,28 @@ public class ModuleChunkClasspath extends Path { if (!orderEntry.isValid()) { continue; } + if (orderEntry instanceof ExportableOrderEntry) { + ExportableOrderEntry e = (ExportableOrderEntry)orderEntry; + switch (e.getScope()) { + case COMPILE: + break; + case PROVIDED: + if (generateRuntimeClasspath && !generateTestClasspath) { + continue; + } + break; + case RUNTIME: + if (!generateRuntimeClasspath) { + continue; + } + break; + case TEST: + if (!generateTestClasspath) { + continue; + } + break; + } + } if (!generateRuntimeClasspath) { // needed for compilation classpath only if ((orderEntry instanceof ModuleSourceOrderEntry)) { @@ -122,7 +146,9 @@ public class ModuleChunkClasspath extends Path { if (!processedChunks.contains(depChunk)) { // chunk references are included in the runtime classpath only once processedChunks.add(depChunk); - pathItems.add(new PathRefItem(BuildProperties.getRuntimeClasspathProperty(depChunk.getName()))); + String property = generateTestClasspath ? BuildProperties.getTestRuntimeClasspathProperty(depChunk.getName()) + : BuildProperties.getRuntimeClasspathProperty(depChunk.getName()); + pathItems.add(new PathRefItem(property)); } } else { @@ -145,9 +171,10 @@ public class ModuleChunkClasspath extends Path { pathItems.add(new PathRefItem(BuildProperties.getLibraryPathId(libraryName))); } } - else { + else if (orderEntry instanceof ModuleSourceOrderEntry) { // Module source entry? - for (String url : getCompilationClasses(orderEntry, ((GenerationOptionsImpl)genOptions), generateRuntimeClasspath)) { + for (String url : getCompilationClasses(orderEntry, ((GenerationOptionsImpl)genOptions), generateRuntimeClasspath, + generateTestClasspath, dependencyLevel == 0)) { if (url.endsWith(JarFileSystem.JAR_SEPARATOR)) { url = url.substring(0, url.length() - JarFileSystem.JAR_SEPARATOR.length()); } @@ -162,6 +189,11 @@ public class ModuleChunkClasspath extends Path { } } } + else { + // Unknown order entry type. If it is actually encountered, extension point should be implemented + pathItems.add(new GeneratorItem(orderEntry.getClass().getName(), + new Comment("Unknown OrderEntryType: " + orderEntry.getClass().getName()))); + } } } }.processModule(module, 0, false); @@ -172,16 +204,45 @@ public class ModuleChunkClasspath extends Path { } } + /** + * Generate classpath name + * + * @param chunk a chunk + * @param generateRuntimeClasspath + * @param generateTestClasspath + * @return a name for the classpath + */ + private static String generateClasspathName(ModuleChunk chunk, boolean generateRuntimeClasspath, boolean generateTestClasspath) { + if (generateTestClasspath) { + return generateRuntimeClasspath + ? BuildProperties.getTestRuntimeClasspathProperty(chunk.getName()) + : BuildProperties.getTestClasspathProperty(chunk.getName()); + } + else { + return generateRuntimeClasspath + ? BuildProperties.getRuntimeClasspathProperty(chunk.getName()) + : BuildProperties.getClasspathProperty(chunk.getName()); + } + } + private static String[] getCompilationClasses(final OrderEntry orderEntry, final GenerationOptionsImpl options, - final boolean forRuntime) { + final boolean forRuntime, + final boolean forTest, + final boolean firstLevel) { if (!forRuntime) { - return orderEntry.getUrls(OrderRootType.COMPILATION_CLASSES); + if (forTest) { + return orderEntry.getUrls(firstLevel ? OrderRootType.PRODUCTION_COMPILATION_CLASSES : OrderRootType.COMPILATION_CLASSES); + } + else { + return firstLevel ? new String[0] : orderEntry.getUrls(OrderRootType.PRODUCTION_COMPILATION_CLASSES); + } } final Set jdkUrls = options.getAllJdkUrls(); final OrderedSet urls = new OrderedSet(); - urls.addAll(Arrays.asList(orderEntry.getUrls(OrderRootType.CLASSES_AND_OUTPUT))); + urls.addAll(Arrays.asList(orderEntry.getUrls(forTest ? OrderRootType.COMPILATION_CLASSES + : OrderRootType.PRODUCTION_COMPILATION_CLASSES))); urls.removeAll(jdkUrls); return ArrayUtil.toStringArray(urls); } diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/BuildProperties.java b/java/compiler/openapi/src/com/intellij/compiler/ant/BuildProperties.java index a308f75c9347..78de36087d44 100644 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/BuildProperties.java +++ b/java/compiler/openapi/src/com/intellij/compiler/ant/BuildProperties.java @@ -35,231 +35,241 @@ import java.util.HashSet; import java.util.Set; public abstract class BuildProperties extends CompositeGenerator { - public static final @NonNls String TARGET_ALL = "all"; - public static final @NonNls String TARGET_BUILD_MODULES = "build.modules"; - public static final @NonNls String TARGET_CLEAN = "clean"; - public static final @NonNls String TARGET_INIT = "init"; - public static final @NonNls String DEFAULT_TARGET = TARGET_ALL; - public static final @NonNls String PROPERTY_COMPILER_NAME = "compiler.name"; - public static final @NonNls String PROPERTY_COMPILER_ADDITIONAL_ARGS = "compiler.args"; - public static final @NonNls String PROPERTY_COMPILER_MAX_MEMORY = "compiler.max.memory"; - public static final @NonNls String PROPERTY_COMPILER_EXCLUDES = "compiler.excluded"; - public static final @NonNls String PROPERTY_COMPILER_RESOURCE_PATTERNS = "compiler.resources"; - public static final @NonNls String PROPERTY_IGNORED_FILES = "ignored.files"; - public static final @NonNls String PROPERTY_COMPILER_GENERATE_DEBUG_INFO = "compiler.debug"; - public static final @NonNls String PROPERTY_COMPILER_GENERATE_NO_WARNINGS = "compiler.generate.no.warnings"; - public static final @NonNls String PROPERTY_PROJECT_JDK_HOME = "project.jdk.home"; - public static final @NonNls String PROPERTY_PROJECT_JDK_BIN = "project.jdk.bin"; - public static final @NonNls String PROPERTY_PROJECT_JDK_CLASSPATH = "project.jdk.classpath"; - public static final @NonNls String PROPERTY_SKIP_TESTS = "skip.tests"; - public static final @NonNls String PROPERTY_LIBRARIES_PATTERNS = "library.patterns"; - public static final @NonNls String PROPERTY_IDEA_HOME = "idea.home"; - public static final @NonNls String PROPERTY_JAVAC2_HOME = "javac2.home"; - public static final @NonNls String PROPERTY_JAVAC2_CLASSPATH_ID = "javac2.classpath"; + public static final @NonNls String TARGET_ALL = "all"; + public static final @NonNls String TARGET_BUILD_MODULES = "build.modules"; + public static final @NonNls String TARGET_CLEAN = "clean"; + public static final @NonNls String TARGET_INIT = "init"; + public static final @NonNls String DEFAULT_TARGET = TARGET_ALL; + public static final @NonNls String PROPERTY_COMPILER_NAME = "compiler.name"; + public static final @NonNls String PROPERTY_COMPILER_ADDITIONAL_ARGS = "compiler.args"; + public static final @NonNls String PROPERTY_COMPILER_MAX_MEMORY = "compiler.max.memory"; + public static final @NonNls String PROPERTY_COMPILER_EXCLUDES = "compiler.excluded"; + public static final @NonNls String PROPERTY_COMPILER_RESOURCE_PATTERNS = "compiler.resources"; + public static final @NonNls String PROPERTY_IGNORED_FILES = "ignored.files"; + public static final @NonNls String PROPERTY_COMPILER_GENERATE_DEBUG_INFO = "compiler.debug"; + public static final @NonNls String PROPERTY_COMPILER_GENERATE_NO_WARNINGS = "compiler.generate.no.warnings"; + public static final @NonNls String PROPERTY_PROJECT_JDK_HOME = "project.jdk.home"; + public static final @NonNls String PROPERTY_PROJECT_JDK_BIN = "project.jdk.bin"; + public static final @NonNls String PROPERTY_PROJECT_JDK_CLASSPATH = "project.jdk.classpath"; + public static final @NonNls String PROPERTY_SKIP_TESTS = "skip.tests"; + public static final @NonNls String PROPERTY_LIBRARIES_PATTERNS = "library.patterns"; + public static final @NonNls String PROPERTY_IDEA_HOME = "idea.home"; + public static final @NonNls String PROPERTY_JAVAC2_HOME = "javac2.home"; + public static final @NonNls String PROPERTY_JAVAC2_CLASSPATH_ID = "javac2.classpath"; - protected abstract void createJdkGenerators(Project project); + protected abstract void createJdkGenerators(Project project); - public static Sdk[] getUsedJdks(Project project) { - final Set jdks = new HashSet(); - Module[] modules = ModuleManager.getInstance(project).getModules(); - for (Module module : modules) { - Sdk jdk = ModuleRootManager.getInstance(module).getSdk(); - if (jdk != null) { - jdks.add(jdk); - } - } - return jdks.toArray(new Sdk[jdks.size()]); + public static Sdk[] getUsedJdks(Project project) { + final Set jdks = new HashSet(); + Module[] modules = ModuleManager.getInstance(project).getModules(); + for (Module module : modules) { + Sdk jdk = ModuleRootManager.getInstance(module).getSdk(); + if (jdk != null) { + jdks.add(jdk); + } } + return jdks.toArray(new Sdk[jdks.size()]); + } - @NonNls - public static String getPropertyFileName(Project project) { - return getProjectBuildFileName(project) + ".properties"; + @NonNls + public static String getPropertyFileName(Project project) { + return getProjectBuildFileName(project) + ".properties"; + } + + @NonNls + public static String getJdkPathId(@NonNls final String jdkName) { + return "jdk.classpath." + convertName(jdkName); + } + + @NonNls + public static String getModuleChunkJdkClasspathProperty(@NonNls final String moduleChunkName) { + return "module.jdk.classpath." + convertName(moduleChunkName); + } + + @NonNls + public static String getModuleChunkJdkHomeProperty(@NonNls final String moduleChunkName) { + return "module.jdk.home." + convertName(moduleChunkName); + } + + @NonNls + public static String getModuleChunkJdkBinProperty(@NonNls final String moduleChunkName) { + return "module.jdk.bin." + convertName(moduleChunkName); + } + + @NonNls + public static String getModuleChunkCompilerArgsProperty(@NonNls final String moduleName) { + return "compiler.args." + convertName(moduleName); + } + + @NonNls + public static String getLibraryPathId(@NonNls final String libraryName) { + return "library." + convertName(libraryName) + ".classpath"; + } + + @NonNls + public static String getJdkHomeProperty(@NonNls final String jdkName) { + return "jdk.home." + convertName(jdkName); + } + + @NonNls + public static String getJdkBinProperty(@NonNls final String jdkName) { + return "jdk.bin." + convertName(jdkName); + } + + @NonNls + public static String getCompileTargetName(@NonNls String moduleName) { + return "compile.module." + convertName(moduleName); + } + + @NonNls + public static String getOutputPathProperty(@NonNls String moduleName) { + return convertName(moduleName) + ".output.dir"; + } + + @NonNls + public static String getOutputPathForTestsProperty(@NonNls String moduleName) { + return convertName(moduleName) + ".testoutput.dir"; + } + + @NonNls + public static String getClasspathProperty(@NonNls String moduleName) { + return convertName(moduleName) + ".module.production.classpath"; + } + + @NonNls + public static String getTestClasspathProperty(@NonNls String moduleName) { + return convertName(moduleName) + ".module.classpath"; + } + + @NonNls + public static String getRuntimeClasspathProperty(@NonNls String moduleName) { + return convertName(moduleName) + ".runtime.production.module.classpath"; + } + + @NonNls + public static String getTestRuntimeClasspathProperty(@NonNls String moduleName) { + return convertName(moduleName) + ".runtime.module.classpath"; + } + + @NonNls + public static String getBootClasspathProperty(@NonNls String moduleName) { + return convertName(moduleName) + ".module.bootclasspath"; + } + + @NonNls + public static String getSourcepathProperty(@NonNls String moduleName) { + return convertName(moduleName) + ".module.sourcepath"; + } + + @NonNls + public static String getTestSourcepathProperty(@NonNls String moduleName) { + return convertName(moduleName) + ".module.test.sourcepath"; + } + + @NonNls + public static String getExcludedFromModuleProperty(@NonNls String moduleName) { + return "excluded.from.module." + convertName(moduleName); + } + + @NonNls + public static String getExcludedFromCompilationProperty(@NonNls String moduleName) { + return "excluded.from.compilation." + convertName(moduleName); + } + + @NonNls + public static String getProjectBuildFileName(Project project) { + return convertName(project.getName()); + } + + @NonNls + public static String getModuleChunkBuildFileName(final ModuleChunk chunk) { + return "module_" + convertName(chunk.getName()); + } + + @NonNls + public static String getModuleCleanTargetName(@NonNls String moduleName) { + return "clean.module." + convertName(moduleName); + } + + @NonNls + public static String getModuleChunkBasedirProperty(ModuleChunk chunk) { + return "module." + convertName(chunk.getName()) + ".basedir"; + } + + /** + * left for compatibility + * + * @param module the module to get property for + * @return name of the property + */ + @NonNls + public static String getModuleBasedirProperty(Module module) { + return "module." + convertName(module.getName()) + ".basedir"; + } + + @NonNls + public static String getProjectBaseDirProperty() { + return "basedir"; + } + + public static File getModuleChunkBaseDir(ModuleChunk chunk) { + return chunk.getBaseDir(); + } + + public static File getProjectBaseDir(final Project project) { + final VirtualFile baseDir = project.getBaseDir(); + assert baseDir != null; + return VfsUtil.virtualToIoFile(baseDir); + } + + /** + * Convert name. All double quotes are removed and spaces are replaced with underscore. + * + * @param name a name to convert + * @return a converted name + */ + @NonNls + public static String convertName(@NonNls final String name) { + //noinspection HardCodedStringLiteral + return name.replaceAll("\"", "").replaceAll("\\s+", "_").toLowerCase(); + } + + @NonNls + public static String getPathMacroProperty(@NonNls String pathMacro) { + return "path.variable." + convertName(pathMacro); + } + + @NonNls + public static String propertyRef(@NonNls String propertyName) { + return "${" + propertyName + "}"; + } + + /** + * Construct path relative to the specified property + * + * @param propertyName the property name + * @param relativePath the relative path + * @return the path relative to the property + */ + @NonNls + public static String propertyRelativePath(@NonNls String propertyName, @NonNls String relativePath) { + return "${" + propertyName + "}/" + relativePath; + } + + + public static File toCanonicalFile(final File file) { + File canonicalFile; + try { + canonicalFile = file.getCanonicalFile(); } - - @NonNls - public static String getJdkPathId(@NonNls final String jdkName) { - return "jdk.classpath." + convertName(jdkName); + catch (IOException e) { + canonicalFile = file; } + return canonicalFile; + } - @NonNls - public static String getModuleChunkJdkClasspathProperty(@NonNls final String moduleChunkName) { - return "module.jdk.classpath." + convertName(moduleChunkName); - } - - @NonNls - public static String getModuleChunkJdkHomeProperty(@NonNls final String moduleChunkName) { - return "module.jdk.home." + convertName(moduleChunkName); - } - - @NonNls - public static String getModuleChunkJdkBinProperty(@NonNls final String moduleChunkName) { - return "module.jdk.bin." + convertName(moduleChunkName); - } - - @NonNls - public static String getModuleChunkCompilerArgsProperty(@NonNls final String moduleName) { - return "compiler.args." + convertName(moduleName); - } - - @NonNls - public static String getLibraryPathId(@NonNls final String libraryName) { - return "library." + convertName(libraryName) + ".classpath"; - } - - @NonNls - public static String getJdkHomeProperty(@NonNls final String jdkName) { - return "jdk.home." + convertName(jdkName); - } - - @NonNls - public static String getJdkBinProperty(@NonNls final String jdkName) { - return "jdk.bin." + convertName(jdkName); - } - - @NonNls - public static String getCompileTargetName(@NonNls String moduleName) { - return "compile.module." + convertName(moduleName); - } - - @NonNls - public static String getOutputPathProperty(@NonNls String moduleName) { - return convertName(moduleName) + ".output.dir"; - } - - @NonNls - public static String getOutputPathForTestsProperty(@NonNls String moduleName) { - return convertName(moduleName) + ".testoutput.dir"; - } - - @NonNls - public static String getClasspathProperty(@NonNls String moduleName) { - return convertName(moduleName) + ".module.classpath"; - } - - @NonNls - public static String getRuntimeClasspathProperty(@NonNls String moduleName) { - return convertName(moduleName) + ".runtime.module.classpath"; - } - - @NonNls - public static String getBootClasspathProperty(@NonNls String moduleName) { - return convertName(moduleName) + ".module.bootclasspath"; - } - - @NonNls - public static String getSourcepathProperty(@NonNls String moduleName) { - return convertName(moduleName) + ".module.sourcepath"; - } - - @NonNls - public static String getTestSourcepathProperty(@NonNls String moduleName) { - return convertName(moduleName) + ".module.test.sourcepath"; - } - - @NonNls - public static String getExcludedFromModuleProperty(@NonNls String moduleName) { - return "excluded.from.module." + convertName(moduleName); - } - - @NonNls - public static String getExcludedFromCompilationProperty(@NonNls String moduleName) { - return "excluded.from.compilation." + convertName(moduleName); - } - - @NonNls - public static String getProjectBuildFileName(Project project) { - return convertName(project.getName()); - } - - @NonNls - public static String getModuleChunkBuildFileName(final ModuleChunk chunk) { - return "module_" + convertName(chunk.getName()); - } - - @NonNls - public static String getModuleCleanTargetName(@NonNls String moduleName) { - return "clean.module." + convertName(moduleName); - } - - @NonNls - public static String getModuleChunkBasedirProperty(ModuleChunk chunk) { - return "module." + convertName(chunk.getName()) + ".basedir"; - } - - /** - * left for compatibility - * - * @param module the module to get property for - * @return name of the property - */ - @NonNls - public static String getModuleBasedirProperty(Module module) { - return "module." + convertName(module.getName()) + ".basedir"; - } - - @NonNls - public static String getProjectBaseDirProperty() { - return "basedir"; - } - - public static File getModuleChunkBaseDir(ModuleChunk chunk) { - return chunk.getBaseDir(); - } - - public static File getProjectBaseDir(final Project project) { - final VirtualFile baseDir = project.getBaseDir(); - assert baseDir != null; - return VfsUtil.virtualToIoFile(baseDir); - } - - /** - * Convert name. All double quotes are removed and spaces are replaced with underscore. - * - * @param name a name to convert - * @return a converted name - */ - @NonNls - public static String convertName(@NonNls final String name) { - //noinspection HardCodedStringLiteral - return name.replaceAll("\"", "").replaceAll("\\s+", "_").toLowerCase(); - } - - @NonNls - public static String getPathMacroProperty(@NonNls String pathMacro) { - return "path.variable." + convertName(pathMacro); - } - - @NonNls - public static String propertyRef(@NonNls String propertyName) { - return "${" + propertyName + "}"; - } - - /** - * Construct path relative to the specified property - * - * @param propertyName the property name - * @param relativePath the relative path - * @return the path relative to the property - */ - @NonNls - public static String propertyRelativePath(@NonNls String propertyName, @NonNls String relativePath) { - return "${" + propertyName + "}/" + relativePath; - } - - - public static File toCanonicalFile(final File file) { - File canonicalFile; - try { - canonicalFile = file.getCanonicalFile(); - } - catch (IOException e) { - canonicalFile = file; - } - return canonicalFile; - } - - @NonNls - public static String getTempDirForModuleProperty(@NonNls String moduleName) { - return "tmp.dir." + convertName(moduleName); - } + @NonNls + public static String getTempDirForModuleProperty(@NonNls String moduleName) { + return "tmp.dir." + convertName(moduleName); + } } \ No newline at end of file diff --git a/platform/lang-api/src/com/intellij/openapi/roots/DependencyScope.java b/platform/lang-api/src/com/intellij/openapi/roots/DependencyScope.java index d2a6f8a23681..6727fb836394 100644 --- a/platform/lang-api/src/com/intellij/openapi/roots/DependencyScope.java +++ b/platform/lang-api/src/com/intellij/openapi/roots/DependencyScope.java @@ -19,6 +19,20 @@ package com.intellij.openapi.roots; import org.jdom.Element; /** + * The table below specifies which order entries are used during compilation and runtime. + * + * + * + * + * + * + * + * + * + * + * + *
Production
Compile
Production
Runtime
Test
Compile
Test
Runtime
{@link #COMPILE} ****
{@link #TEST} **
{@link #RUNTIME} * *
{@link #PROVIDED} * **
Production
Output
***
Test
Output
*
+ * * @author yole */ public enum DependencyScope { diff --git a/resources-en/src/messages/CompilerBundle.properties b/resources-en/src/messages/CompilerBundle.properties index bb35069591c1..c318eea22c3c 100644 --- a/resources-en/src/messages/CompilerBundle.properties +++ b/resources-en/src/messages/CompilerBundle.properties @@ -197,10 +197,10 @@ validation.display.name=Validation action.name.exclude.from.validation=Exclude from Validation -generate.ant.build.custom.compiler.conflict.titile=Conflicting Custom Compilers for Chunk(s) +generate.ant.build.custom.compiler.conflict.title=Conflicting Custom Compilers for Chunk(s) generate.ant.build.custom.compiler.conflict.message=The chunks listed below use more then one custom compiler.
for them you will need to resolve conflict between
compilers manually. The compilation task will also contain
the fail task.
    {0}
generate.ant.build.custom.compiler.conflict.message.row=
  • {0}
  • -generated.ant.build.compile.modules.fail.custom.comipilers=Conflict between custom compilers should be resolved manually. +generated.ant.build.compile.modules.fail.custom.compilers=Conflict between custom compilers should be resolved manually. generated.ant.build.custom.compilers.comment=Custom Compiler Taskdefs label.generate.ant.script.inline.runtime.classpaths=Inline runtime classpaths label.generate.ant.script.generate.idea.home=Use current IDEA instance for idea.home property