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 2429e5996174..39e9fd3cf801 100644 --- a/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildAction.java +++ b/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildAction.java @@ -106,7 +106,6 @@ public class GenerateAntBuildAction extends CompileActionBase { Presentation presentation = event.getPresentation(); Project project = PlatformDataKeys.PROJECT.getData(event.getDataContext()); presentation.setEnabled(project != null); - presentation.setVisible(ChunkBuildExtension.hasBuildExtensions()); } private void generate(final Project project, final GenerationOptions genOptions) { 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 64d51d1b6dc9..39e2fa1dd618 100644 --- a/java/compiler/impl/src/com/intellij/compiler/ant/ChunkBuild.java +++ b/java/compiler/impl/src/com/intellij/compiler/ant/ChunkBuild.java @@ -32,45 +32,43 @@ public class ChunkBuild extends CompositeGenerator{ public ChunkBuild(Project project, ModuleChunk chunk, GenerationOptions genOptions) { final File chunkBaseDir = chunk.getBaseDir(); - if (ChunkBuildExtension.hasSelfOutput(chunk)) { - if (genOptions.forceTargetJdk) { - if (chunk.isJdkInherited()) { - add(new Property(BuildProperties.getModuleChunkJdkHomeProperty(chunk.getName()), BuildProperties.propertyRef(BuildProperties.PROPERTY_PROJECT_JDK_HOME))); - add(new Property(BuildProperties.getModuleChunkJdkBinProperty(chunk.getName()), BuildProperties.propertyRef(BuildProperties.PROPERTY_PROJECT_JDK_BIN))); - add(new Property(BuildProperties.getModuleChunkJdkClasspathProperty(chunk.getName()), BuildProperties.propertyRef(BuildProperties.PROPERTY_PROJECT_JDK_CLASSPATH))); - } - else { - final Sdk jdk = chunk.getJdk(); - add(new Property(BuildProperties.getModuleChunkJdkHomeProperty(chunk.getName()), jdk != null? BuildProperties.propertyRef(BuildProperties.getJdkHomeProperty(jdk.getName())): "")); - add(new Property(BuildProperties.getModuleChunkJdkBinProperty(chunk.getName()), jdk != null? BuildProperties.propertyRef(BuildProperties.getJdkBinProperty(jdk.getName())): "")); - add(new Property(BuildProperties.getModuleChunkJdkClasspathProperty(chunk.getName()), jdk != null? BuildProperties.getJdkPathId(jdk.getName()) : "")); - } + if (genOptions.forceTargetJdk) { + if (chunk.isJdkInherited()) { + add(new Property(BuildProperties.getModuleChunkJdkHomeProperty(chunk.getName()), BuildProperties.propertyRef(BuildProperties.PROPERTY_PROJECT_JDK_HOME))); + add(new Property(BuildProperties.getModuleChunkJdkBinProperty(chunk.getName()), BuildProperties.propertyRef(BuildProperties.PROPERTY_PROJECT_JDK_BIN))); + add(new Property(BuildProperties.getModuleChunkJdkClasspathProperty(chunk.getName()), BuildProperties.propertyRef(BuildProperties.PROPERTY_PROJECT_JDK_CLASSPATH))); } - - add(new Property(BuildProperties.getModuleChunkCompilerArgsProperty(chunk.getName()), BuildProperties.propertyRef(BuildProperties.PROPERTY_COMPILER_ADDITIONAL_ARGS)), 1); - - final String outputPathUrl = chunk.getOutputDirUrl(); - String location = outputPathUrl != null? - GenerationUtils.toRelativePath(VirtualFileManager.extractPath(outputPathUrl), chunkBaseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions) : - CompilerBundle.message("value.undefined"); - add(new Property(BuildProperties.getOutputPathProperty(chunk.getName()), location), 1); - - final String testOutputPathUrl = chunk.getTestsOutputDirUrl(); - if (testOutputPathUrl != null) { - location = GenerationUtils.toRelativePath(VirtualFileManager.extractPath(testOutputPathUrl), chunkBaseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions); + else { + final Sdk jdk = chunk.getJdk(); + add(new Property(BuildProperties.getModuleChunkJdkHomeProperty(chunk.getName()), jdk != null? BuildProperties.propertyRef(BuildProperties.getJdkHomeProperty(jdk.getName())): "")); + add(new Property(BuildProperties.getModuleChunkJdkBinProperty(chunk.getName()), jdk != null? BuildProperties.propertyRef(BuildProperties.getJdkBinProperty(jdk.getName())): "")); + add(new Property(BuildProperties.getModuleChunkJdkClasspathProperty(chunk.getName()), jdk != null? BuildProperties.getJdkPathId(jdk.getName()) : "")); } - 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); - - final ModuleChunkSourcepath moduleSources = new ModuleChunkSourcepath(project, chunk, genOptions); - add(moduleSources, 1); - add(new CompileModuleChunkTarget(project, chunk, moduleSources.getSourceRoots(), moduleSources.getTestSourceRoots(), chunkBaseDir, genOptions), 1); - add(new CleanModule(chunk), 1); } + add(new Property(BuildProperties.getModuleChunkCompilerArgsProperty(chunk.getName()), BuildProperties.propertyRef(BuildProperties.PROPERTY_COMPILER_ADDITIONAL_ARGS)), 1); + + final String outputPathUrl = chunk.getOutputDirUrl(); + String location = outputPathUrl != null? + GenerationUtils.toRelativePath(VirtualFileManager.extractPath(outputPathUrl), chunkBaseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions) : + CompilerBundle.message("value.undefined"); + add(new Property(BuildProperties.getOutputPathProperty(chunk.getName()), location), 1); + + final String testOutputPathUrl = chunk.getTestsOutputDirUrl(); + if (testOutputPathUrl != null) { + location = GenerationUtils.toRelativePath(VirtualFileManager.extractPath(testOutputPathUrl), chunkBaseDir, BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions); + } + 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); + + final ModuleChunkSourcepath moduleSources = new ModuleChunkSourcepath(project, chunk, genOptions); + add(moduleSources, 1); + add(new CompileModuleChunkTarget(project, chunk, moduleSources.getSourceRoots(), moduleSources.getTestSourceRoots(), chunkBaseDir, genOptions), 1); + add(new CleanModule(chunk), 1); + ChunkBuildExtension.process(this, chunk, genOptions); } diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/CleanModule.java b/java/compiler/impl/src/com/intellij/compiler/ant/CleanModule.java index d3041acca036..0b27face7e1f 100644 --- a/java/compiler/impl/src/com/intellij/compiler/ant/CleanModule.java +++ b/java/compiler/impl/src/com/intellij/compiler/ant/CleanModule.java @@ -27,10 +27,8 @@ public class CleanModule extends Target { public CleanModule(ModuleChunk chunk) { super(BuildProperties.getModuleCleanTargetName(chunk.getName()), null, CompilerBundle.message("generated.ant.build.cleanup.module.task.comment"), null); - if (ChunkBuildExtension.hasSelfOutput(chunk)) { - final String chunkName = chunk.getName(); - add(new Delete(BuildProperties.propertyRef(BuildProperties.getOutputPathProperty(chunkName)))); - add(new Delete(BuildProperties.propertyRef(BuildProperties.getOutputPathForTestsProperty(chunkName)))); - } + final String chunkName = chunk.getName(); + add(new Delete(BuildProperties.propertyRef(BuildProperties.getOutputPathProperty(chunkName)))); + add(new Delete(BuildProperties.propertyRef(BuildProperties.getOutputPathForTestsProperty(chunkName)))); } } diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/ChunkBuildExtension.java b/java/compiler/openapi/src/com/intellij/compiler/ant/ChunkBuildExtension.java index fb2592366f11..ec48ecd1c038 100644 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/ChunkBuildExtension.java +++ b/java/compiler/openapi/src/com/intellij/compiler/ant/ChunkBuildExtension.java @@ -19,7 +19,6 @@ package com.intellij.compiler.ant; import com.intellij.ExtensionPoints; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.module.Module; import com.intellij.openapi.project.Project; import com.intellij.util.ArrayUtil; import org.jetbrains.annotations.NonNls; @@ -30,15 +29,8 @@ import java.util.Arrays; import java.util.List; public abstract class ChunkBuildExtension { - /** - * true, if there are build extensions for the modules, the variable is accessed only from AWT thread - */ - private static Boolean myHasExtensions = null; - public static final ExtensionPointName EP_NAME = ExtensionPointName.create(ExtensionPoints.ANT_BUILD_GEN); - public abstract boolean haveSelfOutputs(Module[] modules); - @NotNull @NonNls public abstract String[] getTargets(final ModuleChunk chunk); @@ -48,26 +40,6 @@ public abstract class ChunkBuildExtension { public void generateProperties(final PropertyFileGenerator generator, final Project project, final GenerationOptions options) { } - public static boolean hasSelfOutput(ModuleChunk chunk) { - final ChunkBuildExtension[] extensions = Extensions.getRootArea().getExtensionPoint(EP_NAME).getExtensions(); - final Module[] modules = chunk.getModules(); - for (ChunkBuildExtension extension : extensions) { - if (extension.haveSelfOutputs(modules)) return true; - } - return false; - } - - /** - * @return true if there are build extensions registered - */ - public static boolean hasBuildExtensions() { - if (myHasExtensions == null) { - ChunkBuildExtension[] extensions = Extensions.getRootArea().getExtensionPoint(EP_NAME).getExtensions(); - myHasExtensions = extensions.length != 0; - } - return myHasExtensions; - } - public static String[] getAllTargets(ModuleChunk chunk) { List allTargets = new ArrayList(); final ChunkBuildExtension[] extensions = Extensions.getRootArea().getExtensionPoint(EP_NAME).getExtensions(); diff --git a/plugins/devkit/src/build/ant/ChunkBuildPluginExtension.java b/plugins/devkit/src/build/ant/ChunkBuildPluginExtension.java index ccea0ee633bb..355c6ce89469 100644 --- a/plugins/devkit/src/build/ant/ChunkBuildPluginExtension.java +++ b/plugins/devkit/src/build/ant/ChunkBuildPluginExtension.java @@ -38,10 +38,6 @@ import java.util.Set; public class ChunkBuildPluginExtension extends ChunkBuildExtension { - public boolean haveSelfOutputs(Module[] modules) { - return true; - } - @NotNull public String[] getTargets(final ModuleChunk chunk) { return isPlugins(chunk.getModules()) ? new String[] {PluginBuildProperties.getBuildJarTargetName(chunk.getName())}