diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java b/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java
index c42b1a0caf7b..80dae42cb5e6 100644
--- a/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java
+++ b/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java
@@ -42,145 +42,147 @@ import java.io.IOException;
// todo: move path variables properties and jdk home properties into te generated property file
public class BuildPropertiesImpl extends BuildProperties {
- public BuildPropertiesImpl(Project project, final GenerationOptions genOptions) {
- add(new Property(getPropertyFileName(project)));
+ public BuildPropertiesImpl(Project project, final GenerationOptions genOptions) {
+ add(new Property(getPropertyFileName(project)));
- //noinspection HardCodedStringLiteral
- add(new Comment(CompilerBundle.message("generated.ant.build.disable.tests.property.comment"),
- new Property(PROPERTY_SKIP_TESTS, "true")));
- final JavacSettings javacSettings = JavacSettings.getInstance(project);
- if (genOptions.enableFormCompiler) {
- //noinspection HardCodedStringLiteral
- add(new Property(PROPERTY_JAVAC2_HOME, propertyRelativePath(PROPERTY_IDEA_HOME, "lib")));
- Path javac2 = new Path(PROPERTY_JAVAC2_CLASSPATH_ID);
- javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "javac2.jar")));
- javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "jdom.jar")));
- javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "asm.jar")));
- javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "asm-commons.jar")));
- javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "jgoodies-forms.jar")));
- add(javac2);
- //noinspection HardCodedStringLiteral
- add(new Tag("taskdef", Pair.create("name", "javac2"), Pair.create("classname", "com.intellij.ant.Javac2"),
- Pair.create("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
- add(new Tag("taskdef", Pair.create("name", "instrumentIdeaExtensions"),
- Pair.create("classname", "com.intellij.ant.InstrumentIdeaExtensions"),
- Pair.create("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
- }
+ //noinspection HardCodedStringLiteral
+ add(new Comment(CompilerBundle.message("generated.ant.build.disable.tests.property.comment"),
+ new Property(PROPERTY_SKIP_TESTS, "true")));
+ final JavacSettings javacSettings = JavacSettings.getInstance(project);
+ add(new Comment(CompilerBundle.message("generated.ant.build.compiler.options.comment")), 1);
+ //noinspection HardCodedStringLiteral
+ add(new Property(PROPERTY_COMPILER_GENERATE_DEBUG_INFO, javacSettings.DEBUGGING_INFO ? "on" : "off"), 1);
+ //noinspection HardCodedStringLiteral
+ add(new Property(PROPERTY_COMPILER_GENERATE_NO_WARNINGS, javacSettings.GENERATE_NO_WARNINGS ? "on" : "off"));
+ add(new Property(PROPERTY_COMPILER_ADDITIONAL_ARGS, javacSettings.ADDITIONAL_OPTIONS_STRING));
+ //noinspection HardCodedStringLiteral
+ add(new Property(PROPERTY_COMPILER_MAX_MEMORY, Integer.toString(javacSettings.MAXIMUM_HEAP_SIZE) + "m"));
- add(new Comment(CompilerBundle.message("generated.ant.build.compiler.options.comment")), 1);
- //noinspection HardCodedStringLiteral
- add(new Property(PROPERTY_COMPILER_GENERATE_DEBUG_INFO, javacSettings.DEBUGGING_INFO ? "on" : "off"), 1);
- //noinspection HardCodedStringLiteral
- add(new Property(PROPERTY_COMPILER_GENERATE_NO_WARNINGS, javacSettings.GENERATE_NO_WARNINGS ? "on" : "off"));
- add(new Property(PROPERTY_COMPILER_ADDITIONAL_ARGS, javacSettings.ADDITIONAL_OPTIONS_STRING));
- //noinspection HardCodedStringLiteral
- add(new Property(PROPERTY_COMPILER_MAX_MEMORY, Integer.toString(javacSettings.MAXIMUM_HEAP_SIZE) + "m"));
+ add(new IgnoredFiles());
- add(new IgnoredFiles());
-
- if (CompilerExcludes.isAvailable(project)) {
- add(new CompilerExcludes(project, genOptions));
- }
-
- if (!genOptions.expandJarDirectories) {
- add(new LibraryPatterns(project, genOptions));
- }
-
- add(new CompilerResourcePatterns(project));
-
- if (genOptions.forceTargetJdk) {
- createJdkGenerators(project);
- }
-
- LibraryDefinitionsGeneratorFactory factory = new LibraryDefinitionsGeneratorFactory((ProjectEx)project, genOptions);
-
- final LibraryTablesRegistrar registrar = LibraryTablesRegistrar.getInstance();
- final Generator projectLibs = factory.create(registrar.getLibraryTable(project), getProjectBaseDir(project),
- CompilerBundle.message("generated.ant.build.project.libraries.comment"));
- if (projectLibs != null) {
- add(projectLibs);
- }
-
- final Generator globalLibs =
- factory.create(registrar.getLibraryTable(), null, CompilerBundle.message("generated.ant.build.global.libraries.comment"));
- if (globalLibs != null) {
- add(globalLibs);
- }
-
- for (final LibraryTable table : registrar.getCustomLibraryTables()) {
- if (table.getLibraries().length != 0) {
- final Generator appServerLibs = factory.create(table, null, table.getPresentation().getDisplayName(true));
- if (appServerLibs != null) {
- add(appServerLibs);
- }
- }
- }
-
- final ChunkCustomCompilerExtension[] customCompilers = genOptions.getCustomCompilers();
- if (customCompilers.length > 0) {
- add(new Comment(CompilerBundle.message("generated.ant.build.custom.compilers.comment")), 1);
- for (ChunkCustomCompilerExtension ext : customCompilers) {
- ext.generateCustomCompilerTaskRegistration(project, genOptions, this);
- }
- }
+ if (CompilerExcludes.isAvailable(project)) {
+ add(new CompilerExcludes(project, genOptions));
}
- protected void createJdkGenerators(final Project project) {
- final Sdk[] jdks = getUsedJdks(project);
-
- if (jdks.length > 0) {
- add(new Comment(CompilerBundle.message("generated.ant.build.jdk.definitions.comment")), 1);
-
- for (final Sdk jdk : jdks) {
- if (jdk.getHomeDirectory() == null) {
- continue;
- }
- final SdkType sdkType = jdk.getSdkType();
- if (!(sdkType instanceof JavaSdkType) || ((JavaSdkType)sdkType).getBinPath(jdk) == null) {
- continue;
- }
- final File home = VfsUtil.virtualToIoFile(jdk.getHomeDirectory());
- File homeDir;
- try {
- // use canonical path in order to resolve symlinks
- homeDir = home.getCanonicalFile();
- }
- catch (IOException e) {
- homeDir = home;
- }
- final String jdkName = jdk.getName();
- final String jdkHomeProperty = getJdkHomeProperty(jdkName);
- final FileSet fileSet = new FileSet(propertyRef(jdkHomeProperty));
- final String[] urls = jdk.getRootProvider().getUrls(OrderRootType.CLASSES);
- for (String url : urls) {
- final String path = GenerationUtils.trimJarSeparator(VirtualFileManager.extractPath(url));
- final File pathElement = new File(path);
- final String relativePath = FileUtil.getRelativePath(homeDir, pathElement);
- if (relativePath != null) {
- fileSet.add(new Include(relativePath.replace(File.separatorChar, '/')));
- }
- }
-
- final File binPath = toCanonicalFile(new File(((JavaSdkType)sdkType).getBinPath(jdk)));
- final String relativePath = FileUtil.getRelativePath(homeDir, binPath);
- if (relativePath != null) {
- add(new Property(BuildProperties.getJdkBinProperty(jdkName),
- propertyRef(jdkHomeProperty) + "/" + FileUtil.toSystemIndependentName(relativePath)), 1);
- }
- else {
- add(new Property(BuildProperties.getJdkBinProperty(jdkName), FileUtil.toSystemIndependentName(binPath.getPath())), 1);
- }
-
- final Path jdkPath = new Path(getJdkPathId(jdkName));
- jdkPath.add(fileSet);
- add(jdkPath);
- }
- }
-
- final Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectJdk();
- add(new Property(PROPERTY_PROJECT_JDK_HOME, projectJdk != null ? propertyRef(getJdkHomeProperty(projectJdk.getName())) : ""), 1);
- add(new Property(PROPERTY_PROJECT_JDK_BIN, projectJdk != null ? propertyRef(getJdkBinProperty(projectJdk.getName())) : ""));
- add(new Property(PROPERTY_PROJECT_JDK_CLASSPATH, projectJdk != null ? getJdkPathId(projectJdk.getName()) : ""));
+ if (!genOptions.expandJarDirectories) {
+ add(new LibraryPatterns(project, genOptions));
}
+ add(new CompilerResourcePatterns(project));
+
+ if (genOptions.forceTargetJdk) {
+ createJdkGenerators(project);
+ }
+
+ LibraryDefinitionsGeneratorFactory factory = new LibraryDefinitionsGeneratorFactory((ProjectEx)project, genOptions);
+
+ final LibraryTablesRegistrar registrar = LibraryTablesRegistrar.getInstance();
+ final Generator projectLibs = factory.create(registrar.getLibraryTable(project), getProjectBaseDir(project),
+ CompilerBundle.message("generated.ant.build.project.libraries.comment"));
+ if (projectLibs != null) {
+ add(projectLibs);
+ }
+
+ final Generator globalLibs =
+ factory.create(registrar.getLibraryTable(), null, CompilerBundle.message("generated.ant.build.global.libraries.comment"));
+ if (globalLibs != null) {
+ add(globalLibs);
+ }
+
+ for (final LibraryTable table : registrar.getCustomLibraryTables()) {
+ if (table.getLibraries().length != 0) {
+ final Generator appServerLibs = factory.create(table, null, table.getPresentation().getDisplayName(true));
+ if (appServerLibs != null) {
+ add(appServerLibs);
+ }
+ }
+ }
+
+ final ChunkCustomCompilerExtension[] customCompilers = genOptions.getCustomCompilers();
+ if (genOptions.enableFormCompiler || customCompilers.length > 0) {
+ add(new Comment(CompilerBundle.message("generated.ant.build.custom.compilers.comment")));
+ Target register = new Target(TARGET_REGISTER_CUSTOM_COMPILERS, null, null, null);
+ if (genOptions.enableFormCompiler) {
+ //noinspection HardCodedStringLiteral
+ add(new Property(PROPERTY_JAVAC2_HOME, propertyRelativePath(PROPERTY_IDEA_HOME, "lib")));
+ Path javac2 = new Path(PROPERTY_JAVAC2_CLASSPATH_ID);
+ javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "javac2.jar")));
+ javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "jdom.jar")));
+ javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "asm.jar")));
+ javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "asm-commons.jar")));
+ javac2.add(new PathElement(propertyRelativePath(PROPERTY_JAVAC2_HOME, "jgoodies-forms.jar")));
+ add(javac2);
+ //noinspection HardCodedStringLiteral
+ register.add(new Tag("taskdef", Pair.create("name", "javac2"), Pair.create("classname", "com.intellij.ant.Javac2"),
+ Pair.create("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
+ register.add(new Tag("taskdef", Pair.create("name", "instrumentIdeaExtensions"),
+ Pair.create("classname", "com.intellij.ant.InstrumentIdeaExtensions"),
+ Pair.create("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID)));
+ }
+ if (customCompilers.length > 0) {
+ for (ChunkCustomCompilerExtension ext : customCompilers) {
+ ext.generateCustomCompilerTaskRegistration(project, genOptions, register);
+ }
+ }
+ add(register);
+ }
+ }
+
+ protected void createJdkGenerators(final Project project) {
+ final Sdk[] jdks = getUsedJdks(project);
+
+ if (jdks.length > 0) {
+ add(new Comment(CompilerBundle.message("generated.ant.build.jdk.definitions.comment")), 1);
+
+ for (final Sdk jdk : jdks) {
+ if (jdk.getHomeDirectory() == null) {
+ continue;
+ }
+ final SdkType sdkType = jdk.getSdkType();
+ if (!(sdkType instanceof JavaSdkType) || ((JavaSdkType)sdkType).getBinPath(jdk) == null) {
+ continue;
+ }
+ final File home = VfsUtil.virtualToIoFile(jdk.getHomeDirectory());
+ File homeDir;
+ try {
+ // use canonical path in order to resolve symlinks
+ homeDir = home.getCanonicalFile();
+ }
+ catch (IOException e) {
+ homeDir = home;
+ }
+ final String jdkName = jdk.getName();
+ final String jdkHomeProperty = getJdkHomeProperty(jdkName);
+ final FileSet fileSet = new FileSet(propertyRef(jdkHomeProperty));
+ final String[] urls = jdk.getRootProvider().getUrls(OrderRootType.CLASSES);
+ for (String url : urls) {
+ final String path = GenerationUtils.trimJarSeparator(VirtualFileManager.extractPath(url));
+ final File pathElement = new File(path);
+ final String relativePath = FileUtil.getRelativePath(homeDir, pathElement);
+ if (relativePath != null) {
+ fileSet.add(new Include(relativePath.replace(File.separatorChar, '/')));
+ }
+ }
+
+ final File binPath = toCanonicalFile(new File(((JavaSdkType)sdkType).getBinPath(jdk)));
+ final String relativePath = FileUtil.getRelativePath(homeDir, binPath);
+ if (relativePath != null) {
+ add(new Property(BuildProperties.getJdkBinProperty(jdkName),
+ propertyRef(jdkHomeProperty) + "/" + FileUtil.toSystemIndependentName(relativePath)), 1);
+ }
+ else {
+ add(new Property(BuildProperties.getJdkBinProperty(jdkName), FileUtil.toSystemIndependentName(binPath.getPath())), 1);
+ }
+
+ final Path jdkPath = new Path(getJdkPathId(jdkName));
+ jdkPath.add(fileSet);
+ add(jdkPath);
+ }
+ }
+
+ final Sdk projectJdk = ProjectRootManager.getInstance(project).getProjectJdk();
+ add(new Property(PROPERTY_PROJECT_JDK_HOME, projectJdk != null ? propertyRef(getJdkHomeProperty(projectJdk.getName())) : ""), 1);
+ add(new Property(PROPERTY_PROJECT_JDK_BIN, projectJdk != null ? propertyRef(getJdkBinProperty(projectJdk.getName())) : ""));
+ add(new Property(PROPERTY_PROJECT_JDK_CLASSPATH, projectJdk != null ? getJdkPathId(projectJdk.getName()) : ""));
+ }
}
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 245fc339c06d..e08040b1f246 100644
--- a/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java
+++ b/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java
@@ -56,17 +56,29 @@ public class CompileModuleChunkTarget extends CompositeGenerator {
final @NonNls String productionTargetName = mainTargetName + ".production";
final @NonNls String testsTargetName = mainTargetName + ".tests";
+ final ChunkCustomCompilerExtension[] customCompilers = moduleChunk.getCustomCompilers();
+ final String customCompilersDependency = customCompilers.length != 0 || genOptions.enableFormCompiler ?
+ BuildProperties.TARGET_REGISTER_CUSTOM_COMPILERS : "";
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),
+ String dependenciesProduction = getChunkDependenciesString(moduleChunk);
+ if (customCompilersDependency.length() > 0) {
+ if (dependenciesProduction != null && dependenciesProduction.length() > 0) {
+ dependenciesProduction = customCompilersDependency + "," + dependenciesProduction;
+ }
+ else {
+ dependenciesProduction = customCompilersDependency;
+ }
+ }
+ Target productionTarget = new Target(productionTargetName, dependenciesProduction,
CompilerBundle.message("generated.ant.build.compile.modules.production.classes.target.comment",
modulesCount, moduleChunkName), null);
- Target testsTarget = new Target(testsTargetName, productionTargetName,
+ String dependenciesTests = (customCompilersDependency.length() != 0 ? customCompilersDependency + "," : "") + productionTargetName;
+ Target testsTarget = new Target(testsTargetName, dependenciesTests,
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));
@@ -115,31 +127,31 @@ public class CompileModuleChunkTarget extends CompositeGenerator {
/**
* Create custom compiler tasks
*
- * @param project the proejct
- * @param moduleChunk the module chunkc
+ * @param project the project
+ * @param moduleChunk the module chunk
* @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 customCompilers an array of custom compilers for this chunk
+ * @param compilerArgs the javac compiler arguments
* @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 srcTag the source 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) {
+ 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"))));
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 78de36087d44..0eb86f056305 100644
--- a/java/compiler/openapi/src/com/intellij/compiler/ant/BuildProperties.java
+++ b/java/compiler/openapi/src/com/intellij/compiler/ant/BuildProperties.java
@@ -39,6 +39,7 @@ public abstract class BuildProperties extends CompositeGenerator {
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 TARGET_REGISTER_CUSTOM_COMPILERS = "register.custom.compilers";
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";
@@ -272,4 +273,4 @@ public abstract class BuildProperties extends CompositeGenerator {
public static String getTempDirForModuleProperty(@NonNls String moduleName) {
return "tmp.dir." + convertName(moduleName);
}
-}
\ No newline at end of file
+}
diff --git a/resources-en/src/messages/CompilerBundle.properties b/resources-en/src/messages/CompilerBundle.properties
index c318eea22c3c..5a7f2a310922 100644
--- a/resources-en/src/messages/CompilerBundle.properties
+++ b/resources-en/src/messages/CompilerBundle.properties
@@ -201,10 +201,10 @@ generate.ant.build.custom.compiler.conflict.title=Conflicting Custom Compilers f
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.