From a6190f70678dcf70a2ed9fe6811ac6055ba216dc Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 22 Nov 2019 16:57:06 +0100 Subject: [PATCH] Extract Generate Ant Build functionality to plugin under intellij-obsolete-plugins GitOrigin-RevId: 154899b342665bf224f4c60697aebf9283e97f28 --- .../compiler/actions/AntBuildForm.form | 113 ------ .../actions/GenerateAntBuildAction.java | 324 ---------------- .../actions/GenerateAntBuildDialog.java | 347 ------------------ .../compiler/ant/BuildPropertiesImpl.java | 176 --------- .../compiler/ant/BuildTargetsFactoryImpl.java | 22 -- .../com/intellij/compiler/ant/ChunkBuild.java | 89 ----- .../intellij/compiler/ant/CleanModule.java | 33 -- .../intellij/compiler/ant/CleanProject.java | 54 --- .../com/intellij/compiler/ant/Comment.java | 59 --- .../ant/CompileModuleChunkTarget.java | 212 ----------- .../compiler/ant/CompilerExcludes.java | 74 ---- .../ant/CompilerResourcePatterns.java | 55 --- .../compiler/ant/GenerateAntApplication.java | 104 ------ .../compiler/ant/GenerateAntMain.java | 37 -- .../compiler/ant/GenerationOptionsImpl.java | 324 ---------------- .../intellij/compiler/ant/IgnoredFiles.java | 47 --- .../LibraryDefinitionsGeneratorFactory.java | 176 --------- .../compiler/ant/LibraryPatterns.java | 53 --- .../compiler/ant/ModuleChunkAntProject.java | 45 --- .../compiler/ant/ModuleChunkClasspath.java | 345 ----------------- .../compiler/ant/ModuleChunkSourcePath.java | 182 --------- .../intellij/compiler/ant/ModuleSources.java | 126 ------- .../ant/MultipleFileProjectBuild.java | 41 --- .../intellij/compiler/ant/ProjectBuild.java | 102 ----- .../ant/PropertyFileGeneratorImpl.java | 91 ----- .../compiler/ant/SingleFileProjectBuild.java | 39 -- .../ArchiveAntCopyInstructionCreator.java | 63 ---- .../ArtifactAntGenerationContextImpl.java | 160 -------- .../ant/artifacts/ArtifactsGenerator.java | 207 ----------- .../ant/artifacts/CleanArtifactTarget.java | 31 -- .../DirectoryAntCopyInstructionCreator.java | 71 ---- .../elements/ArchivePackagingElement.java | 36 +- .../elements/ArtifactPackagingElement.java | 21 +- .../elements/ArtifactRootElementImpl.java | 17 +- .../DirectoryCopyPackagingElement.java | 20 +- .../elements/DirectoryPackagingElement.java | 25 +- .../ExtractedDirectoryPackagingElement.java | 43 +-- .../elements/FileCopyPackagingElement.java | 21 +- .../ModuleOutputPackagingElementBase.java | 30 +- ...roductionModuleOutputPackagingElement.java | 22 +- .../ProductionModuleSourcePackagingElement.kt | 15 +- .../TestModuleOutputPackagingElement.java | 22 +- .../compiler/ant/BuildProperties.java | 254 ------------- .../compiler/ant/BuildTargetsFactory.java | 31 -- .../compiler/ant/ChunkBuildExtension.java | 83 ----- .../ant/ChunkCustomCompilerExtension.java | 88 ----- .../compiler/ant/CompositeGenerator.java | 122 ------ .../compiler/ant/GenerationOptions.java | 137 ------- .../compiler/ant/GenerationUtils.java | 105 ------ .../com/intellij/compiler/ant/Generator.java | 61 --- .../intellij/compiler/ant/ModuleChunk.java | 140 ------- .../compiler/ant/PropertyFileGenerator.java | 31 -- .../src/com/intellij/compiler/ant/Tag.java | 88 ----- .../compiler/ant/taskdefs/AntCall.java | 30 -- .../compiler/ant/taskdefs/AntProject.java | 31 -- .../compiler/ant/taskdefs/Attribute.java | 30 -- .../intellij/compiler/ant/taskdefs/Copy.java | 35 -- .../compiler/ant/taskdefs/Delete.java | 30 -- .../compiler/ant/taskdefs/DirSet.java | 31 -- .../compiler/ant/taskdefs/Dirname.java | 30 -- .../compiler/ant/taskdefs/Exclude.java | 32 -- .../compiler/ant/taskdefs/FileSet.java | 31 -- .../compiler/ant/taskdefs/Import.java | 35 -- .../compiler/ant/taskdefs/Include.java | 31 -- .../intellij/compiler/ant/taskdefs/Jar.java | 33 -- .../intellij/compiler/ant/taskdefs/Javac.java | 69 ---- .../compiler/ant/taskdefs/Manifest.java | 51 --- .../intellij/compiler/ant/taskdefs/Mkdir.java | 30 -- .../intellij/compiler/ant/taskdefs/Param.java | 31 -- .../intellij/compiler/ant/taskdefs/Path.java | 30 -- .../compiler/ant/taskdefs/PathElement.java | 32 -- .../compiler/ant/taskdefs/PathRef.java | 31 -- .../compiler/ant/taskdefs/PatternSet.java | 29 -- .../compiler/ant/taskdefs/PatternSetRef.java | 31 -- .../compiler/ant/taskdefs/Property.java | 36 -- .../compiler/ant/taskdefs/Target.java | 59 --- .../intellij/compiler/ant/taskdefs/Unzip.java | 27 -- .../intellij/compiler/ant/taskdefs/Zip.java | 28 -- .../compiler/ant/taskdefs/ZipFileSet.java | 67 ---- .../elements/AntCopyInstructionCreator.java | 42 --- .../ArtifactAntGenerationContext.java | 51 --- .../elements/ComplexPackagingElement.java | 37 +- .../elements/CompositePackagingElement.java | 28 +- .../packaging/elements/PackagingElement.java | 25 +- java/java-impl/src/META-INF/JavaPlugin.xml | 9 - .../openapi/actionSystem/IdeActions.java | 1 - .../src/messages/ActionsBundle.properties | 2 - plugins/ant/resources/META-INF/plugin.xml | 1 - .../artifacts/AntArtifactBuildExtension.java | 59 --- .../devkit-core/resources/META-INF/plugin.xml | 1 - .../src/build/ant/BuildJarTarget.java | 132 ------- .../build/ant/ChunkBuildPluginExtension.java | 59 --- .../src/build/ant/PluginBuildProperties.java | 39 -- .../idea/devkit/build/GenerateAntTest.java | 103 ------ plugins/groovy/src/META-INF/plugin.xml | 2 - .../ant/GroovyAntCustomCompilerProvider.java | 140 ------- .../src/META-INF/common-javaFX-plugin.xml | 1 - .../ant/JavaFxChunkBuildExtension.java | 231 ------------ .../src/messages/CompilerBundle.properties | 42 --- resources/src/idea/JavaActions.xml | 1 - 100 files changed, 19 insertions(+), 7131 deletions(-) delete mode 100644 java/compiler/impl/src/com/intellij/compiler/actions/AntBuildForm.form delete mode 100644 java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildAction.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildDialog.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/BuildTargetsFactoryImpl.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/ChunkBuild.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/CleanModule.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/CleanProject.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/Comment.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/CompilerExcludes.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/CompilerResourcePatterns.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntMain.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/GenerationOptionsImpl.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/IgnoredFiles.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/LibraryDefinitionsGeneratorFactory.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/LibraryPatterns.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkAntProject.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkSourcePath.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/ModuleSources.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/MultipleFileProjectBuild.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/ProjectBuild.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/PropertyFileGeneratorImpl.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/SingleFileProjectBuild.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArchiveAntCopyInstructionCreator.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArtifactAntGenerationContextImpl.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArtifactsGenerator.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/artifacts/CleanArtifactTarget.java delete mode 100644 java/compiler/impl/src/com/intellij/compiler/ant/artifacts/DirectoryAntCopyInstructionCreator.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/BuildProperties.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/BuildTargetsFactory.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/ChunkBuildExtension.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/ChunkCustomCompilerExtension.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/CompositeGenerator.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/GenerationOptions.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/GenerationUtils.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/Generator.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/ModuleChunk.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/PropertyFileGenerator.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/Tag.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntCall.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntProject.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Attribute.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Copy.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Delete.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/DirSet.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Dirname.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Exclude.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/FileSet.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Import.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Include.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Jar.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Javac.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Manifest.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Mkdir.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Param.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Path.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PathElement.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PathRef.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSet.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSetRef.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Property.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Target.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Unzip.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Zip.java delete mode 100644 java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/ZipFileSet.java delete mode 100644 java/compiler/openapi/src/com/intellij/packaging/elements/AntCopyInstructionCreator.java delete mode 100644 java/compiler/openapi/src/com/intellij/packaging/elements/ArtifactAntGenerationContext.java delete mode 100644 plugins/ant/src/com/intellij/lang/ant/config/impl/artifacts/AntArtifactBuildExtension.java delete mode 100644 plugins/devkit/devkit-core/src/build/ant/BuildJarTarget.java delete mode 100644 plugins/devkit/devkit-core/src/build/ant/ChunkBuildPluginExtension.java delete mode 100644 plugins/devkit/devkit-core/src/build/ant/PluginBuildProperties.java delete mode 100644 plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/build/GenerateAntTest.java delete mode 100644 plugins/groovy/src/org/jetbrains/plugins/groovy/ant/GroovyAntCustomCompilerProvider.java delete mode 100644 plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java diff --git a/java/compiler/impl/src/com/intellij/compiler/actions/AntBuildForm.form b/java/compiler/impl/src/com/intellij/compiler/actions/AntBuildForm.form deleted file mode 100644 index da9463433bbe..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/actions/AntBuildForm.form +++ /dev/null @@ -1,113 +0,0 @@ - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildAction.java b/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildAction.java deleted file mode 100644 index 9f4a61477bbb..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildAction.java +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.actions; - -import com.intellij.compiler.CompilerConfiguration; -import com.intellij.compiler.CompilerConfigurationImpl; -import com.intellij.compiler.ant.*; -import com.intellij.compiler.impl.CompilerUtil; -import com.intellij.configurationStore.StoreUtil; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.actionSystem.Presentation; -import com.intellij.openapi.application.ReadAction; -import com.intellij.openapi.compiler.CompilerBundle; -import com.intellij.openapi.progress.ProgressIndicator; -import com.intellij.openapi.progress.ProgressManager; -import com.intellij.openapi.progress.Task; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vfs.LocalFileSystem; -import com.intellij.openapi.vfs.ReadonlyStatusHandler; -import com.intellij.openapi.vfs.VfsUtilCore; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; - -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.util.*; - -public class GenerateAntBuildAction extends CompileActionBase { - @NonNls private static final String XML_EXTENSION = ".xml"; - - @Override - protected void doAction(DataContext dataContext, final Project project) { - ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(project)).convertPatterns(); - final GenerateAntBuildDialog dialog = new GenerateAntBuildDialog(project); - if (dialog.showAndGet()) { - final String[] names = dialog.getRepresentativeModuleNames(); - final GenerationOptionsImpl[] genOptions = new GenerationOptionsImpl[1]; - if (!ProgressManager.getInstance().runProcessWithProgressSynchronously( - (Runnable)() -> genOptions[0] = ReadAction - .compute(() -> new GenerationOptionsImpl(project, dialog.isGenerateSingleFileBuild(), dialog.isFormsCompilationEnabled(), - dialog.isBackupFiles(), dialog.isForceTargetJdk(), dialog.isRuntimeClasspathInlined(), - dialog.isIdeaHomeGenerated(), names, dialog.getOutputFileName())), "Analyzing project structure...", true, project)) { - return; - } - if (!validateGenOptions(project, genOptions[0])) { - return; - } - generate(project, genOptions[0]); - } - } - - /** - * Validate generation options and notify user about possible problems - * - * @param project a context project - * @param genOptions a generation optiosn - * @return true if the generator should proceed with current options or if there is not conflict. - */ - private static boolean validateGenOptions(Project project, GenerationOptionsImpl genOptions) { - final Collection EMPTY = Collections.emptyList(); - Collection conflicts = EMPTY; - for (ModuleChunk chunk : genOptions.getModuleChunks()) { - final ChunkCustomCompilerExtension[] customeCompilers = chunk.getCustomCompilers(); - if (customeCompilers.length > 1) { - if (conflicts == EMPTY) { - conflicts = new LinkedList<>(); - } - conflicts.add(chunk.getName()); - } - } - if (!conflicts.isEmpty()) { - StringBuilder msg = new StringBuilder(); - for (String conflictingChunk : conflicts) { - msg.append(CompilerBundle.message("generate.ant.build.custom.compiler.conflict.message.row", conflictingChunk)); - } - int rc = Messages - .showOkCancelDialog(project, CompilerBundle.message("generate.ant.build.custom.compiler.conflict.message", msg.toString()), - CompilerBundle.message("generate.ant.build.custom.compiler.conflict.title"), Messages.getErrorIcon()); - if (rc != Messages.OK) { - return false; - } - } - return true; - } - - @Override - public void update(@NotNull AnActionEvent e) { - Presentation presentation = e.getPresentation(); - presentation.setEnabled(e.getProject() != null); - } - - private void generate(@NotNull Project project, final GenerationOptions genOptions) { - StoreUtil.saveDocumentsAndProjectSettings(project); - final List filesToRefresh = new ArrayList<>(); - final IOException[] _ex = new IOException[]{null}; - final List _generated = new ArrayList<>(); - - try { - if (genOptions.generateSingleFile) { - final File projectBuildFileDestDir = VfsUtilCore.virtualToIoFile(project.getBaseDir()); - final File destFile = new File(projectBuildFileDestDir, genOptions.getBuildFileName()); - final File propertiesFile = new File(projectBuildFileDestDir, genOptions.getPropertiesFileName()); - - ensureFilesWritable(project, new File[]{destFile, propertiesFile}); - } - else { - final List allFiles = new ArrayList<>(); - - final File projectBuildFileDestDir = VfsUtilCore.virtualToIoFile(project.getBaseDir()); - allFiles.add(new File(projectBuildFileDestDir, genOptions.getBuildFileName())); - allFiles.add(new File(projectBuildFileDestDir, genOptions.getPropertiesFileName())); - - final ModuleChunk[] chunks = genOptions.getModuleChunks(); - for (final ModuleChunk chunk : chunks) { - final File chunkBaseDir = BuildProperties.getModuleChunkBaseDir(chunk); - allFiles.add(new File(chunkBaseDir, BuildProperties.getModuleChunkBuildFileName(chunk) + XML_EXTENSION)); - } - - ensureFilesWritable(project, allFiles.toArray(new File[0])); - } - - new Task.Modal(project, CompilerBundle.message("generate.ant.build.title"), false) { - @Override - public void run(@NotNull final ProgressIndicator indicator) { - indicator.setIndeterminate(true); - indicator.setText(CompilerBundle.message("generate.ant.build.progress.message")); - try { - final File[] generated; - if (genOptions.generateSingleFile) { - generated = generateSingleFileBuild(project, genOptions, filesToRefresh); - } - else { - generated = generateMultipleFileBuild(project, genOptions, filesToRefresh); - } - if (generated != null) { - ContainerUtil.addAll(_generated, generated); - } - } - catch (IOException e) { - _ex[0] = e; - } - } - }.queue(); - - } - catch (IOException e) { - _ex[0] = e; - } - - if (_ex[0] != null) { - Messages.showErrorDialog(project, CompilerBundle.message("error.ant.files.generate.failed", _ex[0].getMessage()), - CompilerBundle.message("generate.ant.build.title")); - } - else { - StringBuilder filesString = new StringBuilder(); - for (int idx = 0; idx < _generated.size(); idx++) { - final File file = _generated.get(idx); - if (idx > 0) { - filesString.append(",\n"); - } - filesString.append(file.getPath()); - } - Messages.showInfoMessage(project, CompilerBundle.message("message.ant.files.generated.ok", filesString.toString()), - CompilerBundle.message("generate.ant.build.title")); - } - - if (filesToRefresh.size() > 0) { - CompilerUtil.refreshIOFiles(filesToRefresh); - } - } - - private boolean backup(final File file, final Project project, GenerationOptions genOptions, List filesToRefresh) { - if (!genOptions.backupPreviouslyGeneratedFiles || !file.exists()) { - return true; - } - final String path = file.getPath(); - final int extensionIndex = path.lastIndexOf("."); - final String extension = path.substring(extensionIndex); - //noinspection HardCodedStringLiteral - final String backupPath = path.substring(0, extensionIndex) + - "_" + - new Date(file.lastModified()).toString().replaceAll("\\s+", "_").replaceAll(":", "-") + - extension; - final File backupFile = new File(backupPath); - boolean ok; - try { - FileUtil.rename(file, backupFile); - ok = true; - } - catch (IOException e) { - Messages.showErrorDialog(project, CompilerBundle.message("error.ant.files.backup.failed", path), - CompilerBundle.message("generate.ant.build.title")); - ok = false; - } - filesToRefresh.add(backupFile); - return ok; - } - - private File[] generateSingleFileBuild(Project project, GenerationOptions genOptions, List filesToRefresh) throws IOException { - final File projectBuildFileDestDir = VfsUtilCore.virtualToIoFile(project.getBaseDir()); - projectBuildFileDestDir.mkdirs(); - final File destFile = new File(projectBuildFileDestDir, genOptions.getBuildFileName()); - final File propertiesFile = new File(projectBuildFileDestDir, genOptions.getPropertiesFileName()); - - if (!backup(destFile, project, genOptions, filesToRefresh)) { - return null; - } - if (!backup(propertiesFile, project, genOptions, filesToRefresh)) { - return null; - } - - generateSingleFileBuild(project, genOptions, destFile, propertiesFile); - - filesToRefresh.add(destFile); - filesToRefresh.add(propertiesFile); - return new File[]{destFile, propertiesFile}; - } - - public static void generateSingleFileBuild(final Project project, - final GenerationOptions genOptions, - final File buildxmlFile, - final File propertiesFile) throws IOException { - FileUtil.createIfDoesntExist(buildxmlFile); - FileUtil.createIfDoesntExist(propertiesFile); - try (PrintWriter dataOutput = makeWriter(buildxmlFile)) { - new SingleFileProjectBuild(project, genOptions).generate(dataOutput); - } - try (PrintWriter propertiesOut = makeWriter(propertiesFile)) { - new PropertyFileGeneratorImpl(project, genOptions).generate(propertiesOut); - } - } - - /** - * Create print writer over file with UTF-8 encoding - * - * @param buildxmlFile a file to write to - * @return a created print writer - * @throws UnsupportedEncodingException if endcoding not found - * @throws FileNotFoundException if file not found - */ - private static PrintWriter makeWriter(final File buildxmlFile) throws UnsupportedEncodingException, FileNotFoundException { - return new PrintWriter(new OutputStreamWriter(new FileOutputStream(buildxmlFile), StandardCharsets.UTF_8)); - } - - private void ensureFilesWritable(Project project, File[] files) throws IOException { - final List toCheck = new ArrayList<>(files.length); - final LocalFileSystem lfs = LocalFileSystem.getInstance(); - for (File file : files) { - final VirtualFile vFile = lfs.findFileByIoFile(file); - if (vFile != null) { - toCheck.add(vFile); - } - } - final ReadonlyStatusHandler.OperationStatus status = - ReadonlyStatusHandler.getInstance(project).ensureFilesWritable(toCheck); - if (status.hasReadonlyFiles()) { - throw new IOException(status.getReadonlyFilesMessage()); - } - } - - public File[] generateMultipleFileBuild(Project project, GenerationOptions genOptions, List filesToRefresh) throws IOException { - final File projectBuildFileDestDir = VfsUtilCore.virtualToIoFile(project.getBaseDir()); - projectBuildFileDestDir.mkdirs(); - final List generated = new ArrayList<>(); - final File projectBuildFile = new File(projectBuildFileDestDir, genOptions.getBuildFileName()); - final File propertiesFile = new File(projectBuildFileDestDir, genOptions.getPropertiesFileName()); - final ModuleChunk[] chunks = genOptions.getModuleChunks(); - - final File[] chunkFiles = new File[chunks.length]; - for (int idx = 0; idx < chunks.length; idx++) { - final ModuleChunk chunk = chunks[idx]; - final File chunkBaseDir = BuildProperties.getModuleChunkBaseDir(chunk); - chunkFiles[idx] = new File(chunkBaseDir, BuildProperties.getModuleChunkBuildFileName(chunk) + XML_EXTENSION); - } - - if (!backup(projectBuildFile, project, genOptions, filesToRefresh)) { - return null; - } - if (!backup(propertiesFile, project, genOptions, filesToRefresh)) { - return null; - } - - FileUtil.createIfDoesntExist(projectBuildFile); - try (PrintWriter mainDataOutput = makeWriter(projectBuildFile)) { - final MultipleFileProjectBuild build = new MultipleFileProjectBuild(project, genOptions); - build.generate(mainDataOutput); - generated.add(projectBuildFile); - - // the sequence in which modules are imported is important cause output path properties for dependent modules should be defined first - - for (int idx = 0; idx < chunks.length; idx++) { - final ModuleChunk chunk = chunks[idx]; - final File chunkBuildFile = chunkFiles[idx]; - final File chunkBaseDir = chunkBuildFile.getParentFile(); - if (chunkBaseDir != null) { - chunkBaseDir.mkdirs(); - } - final boolean moduleBackupOk = backup(chunkBuildFile, project, genOptions, filesToRefresh); - if (!moduleBackupOk) { - return null; - } - - FileUtil.createIfDoesntExist(chunkBuildFile); - try (PrintWriter out = makeWriter(chunkBuildFile)) { - new ModuleChunkAntProject(project, chunk, genOptions).generate(out); - generated.add(chunkBuildFile); - } - } - } - // properties - try (PrintWriter propertiesOut = makeWriter(propertiesFile)) { - new PropertyFileGeneratorImpl(project, genOptions).generate(propertiesOut); - generated.add(propertiesFile); - } - - filesToRefresh.addAll(generated); - return generated.toArray(new File[0]); - } - -} diff --git a/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildDialog.java b/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildDialog.java deleted file mode 100644 index f6866429a2a8..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/actions/GenerateAntBuildDialog.java +++ /dev/null @@ -1,347 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.actions; - -import com.intellij.compiler.HelpID; -import com.intellij.compiler.ModuleCompilerUtil; -import com.intellij.compiler.ant.BuildProperties; -import com.intellij.ide.util.PropertiesComponent; -import com.intellij.openapi.compiler.CompilerBundle; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.ui.DialogWrapper; -import com.intellij.openapi.ui.MultiLineLabelUI; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.ui.IdeBorderFactory; -import com.intellij.ui.ScrollPaneFactory; -import com.intellij.util.ArrayUtilRt; -import com.intellij.util.Chunk; -import com.intellij.util.ListWithSelection; -import com.intellij.util.ui.JBUI; -import com.intellij.util.ui.Table; -import com.intellij.util.ui.table.ComboBoxTableCellEditor; -import org.jetbrains.annotations.NonNls; - -import javax.swing.*; -import javax.swing.table.AbstractTableModel; -import javax.swing.table.DefaultTableCellRenderer; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableColumn; -import java.awt.*; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -/** - * @author Eugene Zhuravlev - */ -public class GenerateAntBuildDialog extends DialogWrapper { - private JPanel myPanel; - private JRadioButton myRbGenerateSingleFileBuild; - private JRadioButton myRbGenerateMultipleFilesBuild; - private JCheckBox myCbEnableUIFormsCompilation; - private JRadioButton myRbBackupFiles; - private JRadioButton myRbOverwriteFiles; - private JCheckBox myCbForceTargetJdk; - private JCheckBox myCbInlineRuntimeClasspath; - private JPanel myChunksPanel; - private JCheckBox myGenerateIdeaHomeProperty; - private JTextField myOutputFileNameField; - private final Project myProject; - @NonNls private static final String SINGLE_FILE_PROPERTY = "GenerateAntBuildDialog.generateSingleFile"; - @NonNls private static final String UI_FORM_PROPERTY = "GenerateAntBuildDialog.enableUiFormCompile"; - @NonNls private static final String FORCE_TARGET_JDK_PROPERTY = "GenerateAntBuildDialog.forceTargetJdk"; - @NonNls private static final String BACKUP_FILES_PROPERTY = "GenerateAntBuildDialog.backupFiles"; - @NonNls private static final String INLINE_RUNTIME_CLASSPATH_PROPERTY = "GenerateAntBuildDialog.inclineRuntiemClasspath"; - @NonNls private static final String GENERATE_IDEA_HOME_PROPERTY = "GenerateAntBuildDialog.generateIdeaHomeProperty"; - @NonNls private static final String OUTPUT_FILE_NAME_PROPERTY = "GenerateAntBuildDialog.outputFileNameProperty"; - private MyTableModel myTableModel; - private Table myTable; - - public GenerateAntBuildDialog(Project project) { - super(project, false); - myProject = project; - setTitle(CompilerBundle.message("generate.ant.build.title")); - init(); - loadSettings(); - } - - private List> getCycleChunks() { - List> chunks = - ModuleCompilerUtil.getSortedModuleChunks(myProject, Arrays.asList(ModuleManager.getInstance(myProject).getModules())); - for (Iterator> it = chunks.iterator(); it.hasNext();) { - final Chunk chunk = it.next(); - if (chunk.getNodes().size() == 1) { - it.remove(); - } - } - return chunks; - } - - private void loadSettings() { - final PropertiesComponent properties = PropertiesComponent.getInstance(myProject); - if (properties.isValueSet(SINGLE_FILE_PROPERTY)) { - final boolean singleFile = properties.isTrueValue(SINGLE_FILE_PROPERTY); - myRbGenerateSingleFileBuild.setSelected(singleFile); - myRbGenerateMultipleFilesBuild.setSelected(!singleFile); - } - if (properties.isValueSet(UI_FORM_PROPERTY)) { - myCbEnableUIFormsCompilation.setSelected(properties.isTrueValue(UI_FORM_PROPERTY)); - } - if (properties.isValueSet(FORCE_TARGET_JDK_PROPERTY)) { - myCbForceTargetJdk.setSelected(properties.isTrueValue(FORCE_TARGET_JDK_PROPERTY)); - } - if (properties.isValueSet(BACKUP_FILES_PROPERTY)) { - final boolean backup = properties.isTrueValue(BACKUP_FILES_PROPERTY); - myRbBackupFiles.setSelected(backup); - myRbOverwriteFiles.setSelected(!backup); - } - if (properties.isValueSet(INLINE_RUNTIME_CLASSPATH_PROPERTY)) { - myCbInlineRuntimeClasspath.setSelected(properties.isTrueValue(INLINE_RUNTIME_CLASSPATH_PROPERTY)); - } - if (properties.isValueSet(GENERATE_IDEA_HOME_PROPERTY)) { - myGenerateIdeaHomeProperty.setSelected(properties.isTrueValue(GENERATE_IDEA_HOME_PROPERTY)); - } - if (properties.isValueSet(OUTPUT_FILE_NAME_PROPERTY)) { - myOutputFileNameField.setText(properties.getValue(OUTPUT_FILE_NAME_PROPERTY)); - } - else { - myOutputFileNameField.setText(BuildProperties.getProjectBuildFileName(myProject)); - } - } - - private void saveSettings() { - final PropertiesComponent properties = PropertiesComponent.getInstance(myProject); - properties.setValue(SINGLE_FILE_PROPERTY, myRbGenerateSingleFileBuild.isSelected()); - properties.setValue(UI_FORM_PROPERTY, myCbEnableUIFormsCompilation.isSelected()); - properties.setValue(FORCE_TARGET_JDK_PROPERTY, myCbForceTargetJdk.isSelected()); - properties.setValue(BACKUP_FILES_PROPERTY, myRbBackupFiles.isSelected()); - properties.setValue(INLINE_RUNTIME_CLASSPATH_PROPERTY, myCbInlineRuntimeClasspath.isSelected()); - properties.setValue(GENERATE_IDEA_HOME_PROPERTY, myGenerateIdeaHomeProperty.isSelected()); - properties.setValue(OUTPUT_FILE_NAME_PROPERTY, StringUtil.nullize(getOutputFileName())); - } - - @Override - public void dispose() { - saveSettings(); - super.dispose(); - } - - @Override - protected JComponent createCenterPanel() { - final ButtonGroup group = new ButtonGroup(); - group.add(myRbGenerateMultipleFilesBuild); - group.add(myRbGenerateSingleFileBuild); - - final ButtonGroup group1 = new ButtonGroup(); - group1.add(myRbBackupFiles); - group1.add(myRbOverwriteFiles); - - myRbGenerateMultipleFilesBuild.setSelected(true); - myRbBackupFiles.setSelected(true); - myCbEnableUIFormsCompilation.setSelected(true); - myCbForceTargetJdk.setSelected(true); - myCbInlineRuntimeClasspath.setSelected(false); - - initChunksPanel(); - - return myPanel; - } - - private void initChunksPanel() { - List> chunks = getCycleChunks(); - if (chunks.isEmpty()) { - return; - } - myChunksPanel.setLayout(new BorderLayout()); - myChunksPanel.setBorder( - IdeBorderFactory.createTitledBorder(CompilerBundle.message("generate.ant.build.dialog.cyclic.modules.table.title"))); - JLabel textLabel = new JLabel(CompilerBundle.message("generate.ant.build.dialog.cyclic.modules.table.description")); - textLabel.setUI(new MultiLineLabelUI()); - textLabel.setBorder(JBUI.Borders.empty(4, 4, 6, 4)); - myChunksPanel.add(textLabel, BorderLayout.NORTH); - - myTableModel = new MyTableModel(chunks); - myTable = new Table(myTableModel); - final MyTableCellRenderer cellRenderer = new MyTableCellRenderer(); - final TableColumn nameColumn = myTable.getColumnModel().getColumn(MyTableModel.NAME_COLUMN); - nameColumn.setCellEditor(ComboBoxTableCellEditor.INSTANCE); - nameColumn.setCellRenderer(cellRenderer); - final TableColumn labelColumn = myTable.getColumnModel().getColumn(MyTableModel.NUMBER_COLUMN); - labelColumn.setCellRenderer(cellRenderer); - - final Dimension preferredSize = new Dimension(myTable.getPreferredSize()); - preferredSize.height = (myTableModel.getRowCount() + 2) * myTable.getRowHeight() + myTable.getTableHeader().getHeight(); - - final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); - scrollPane.setPreferredSize(preferredSize); - myChunksPanel.add(scrollPane, BorderLayout.CENTER); - } - - @Override - protected void doOKAction() { - if (myTable != null) { - TableCellEditor cellEditor = myTable.getCellEditor(); - if (cellEditor != null) { - cellEditor.stopCellEditing(); - } - } - super.doOKAction(); - } - - public boolean isGenerateSingleFileBuild() { - return myRbGenerateSingleFileBuild.isSelected(); - } - - public boolean isFormsCompilationEnabled() { - return myCbEnableUIFormsCompilation.isSelected(); - } - - public boolean isForceTargetJdk() { - return myCbForceTargetJdk.isSelected(); - } - - public boolean isBackupFiles() { - return myRbBackupFiles.isSelected(); - } - - public boolean isRuntimeClasspathInlined() { - return myCbInlineRuntimeClasspath.isSelected(); - } - - public String[] getRepresentativeModuleNames() { - return myTableModel != null ? myTableModel.getModuleRepresentatives() : ArrayUtilRt.EMPTY_STRING_ARRAY; - } - - /** - * @return true if user has selected to generate IDEA_HOME property - */ - public boolean isIdeaHomeGenerated() { - return myGenerateIdeaHomeProperty.isSelected(); - } - - public String getOutputFileName() { - return myOutputFileNameField.getText().trim(); - } - - private static class MyTableModel extends AbstractTableModel { - private static final int NUMBER_COLUMN = 0; - private static final int NAME_COLUMN = 1; - - private final List> myItems = new ArrayList<>(); - - private MyTableModel(List> chunks) { - for (final Chunk chunk : chunks) { - final ListWithSelection item = new ListWithSelection<>(); - for (final Module module : chunk.getNodes()) { - item.add(module.getName()); - } - item.selectFirst(); - myItems.add(new Pair<>(createCycleName(chunk), item)); - } - } - - private static String createCycleName(Chunk chunk) { - final StringBuilder buf = new StringBuilder(); - for (Module module : chunk.getNodes()) { - if (buf.length() > 0) { - buf.append(", "); - } - buf.append(module.getName()); - } - buf.insert(0, "["); - buf.append("]"); - return buf.toString(); - } - - public String[] getModuleRepresentatives() { - final String[] names = new String[myItems.size()]; - int index = 0; - for (final Pair pair : myItems) { - names[index++] = (String)pair.getSecond().getSelection(); - } - return names; - } - - @Override - public int getColumnCount() { - return 2; - } - - @Override - public int getRowCount() { - return myItems.size(); - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return columnIndex == 1; - } - - @Override - public Class getColumnClass(int columnIndex) { - switch (columnIndex) { - case NUMBER_COLUMN: - return String.class; - case NAME_COLUMN: - return ListWithSelection.class; - default: - return super.getColumnClass(columnIndex); - } - } - - @Override - public Object getValueAt(int rowIndex, int columnIndex) { - switch (columnIndex) { - case NUMBER_COLUMN: - return myItems.get(rowIndex).getFirst(); - case NAME_COLUMN: - return myItems.get(rowIndex).getSecond(); - default: - return null; - } - } - - @Override - public void setValueAt(Object aValue, int rowIndex, int columnIndex) { - if (columnIndex == NAME_COLUMN) { - myItems.get(rowIndex).getSecond().select(aValue); - } - } - - @Override - public String getColumnName(int columnIndex) { - switch (columnIndex) { - case NUMBER_COLUMN: - return CompilerBundle.message("generate.ant.build.dialog.cyclic.modules.table.number.column.header"); - case NAME_COLUMN: - return CompilerBundle.message("generate.ant.build.dialog.cyclic.modules.table.name.column.header"); - } - return super.getColumnName(columnIndex); - } - } - - private static class MyTableCellRenderer extends DefaultTableCellRenderer { - @Override - public Component getTableCellRendererComponent(JTable table, - Object value, - boolean isSelected, - boolean hasFocus, - int row, - int column) { - if (value instanceof ListWithSelection) { - value = ((ListWithSelection)value).getSelection(); - } - final JLabel component = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - component.setHorizontalAlignment(SwingConstants.CENTER); - return component; - } - } - - @Override - protected String getHelpId() { - return HelpID.GENERATE_ANT_BUILD; - } -} \ No newline at end of file diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java b/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java deleted file mode 100644 index 8dd6f2763d88..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/BuildPropertiesImpl.java +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant; - -import com.intellij.compiler.CompilerConfiguration; -import com.intellij.compiler.ant.taskdefs.*; -import com.intellij.compiler.impl.javaCompiler.javac.JavacConfiguration; -import com.intellij.openapi.compiler.CompilerBundle; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ex.ProjectEx; -import com.intellij.openapi.projectRoots.JavaSdkType; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.projectRoots.SdkTypeId; -import com.intellij.openapi.roots.OrderRootType; -import com.intellij.openapi.roots.ProjectRootManager; -import com.intellij.openapi.roots.libraries.LibraryTable; -import com.intellij.openapi.roots.libraries.LibraryTablesRegistrar; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.vfs.VfsUtilCore; -import com.intellij.openapi.vfs.VirtualFileManager; -import org.jetbrains.jps.model.java.compiler.JpsJavaCompilerOptions; - -import java.io.File; -import java.io.IOException; - -import static com.intellij.openapi.util.Pair.pair; - -/** - * @author Eugene Zhuravlev - */ -// 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(genOptions.getPropertiesFileName())); - - add(new Comment(CompilerBundle.message("generated.ant.build.disable.tests.property.comment"), - new Property(PROPERTY_SKIP_TESTS, "true"))); - final JpsJavaCompilerOptions javacSettings = JavacConfiguration.getOptions(project, JavacConfiguration.class); - add(new Comment(CompilerBundle.message("generated.ant.build.compiler.options.comment")), 1); - add(new Property(PROPERTY_COMPILER_GENERATE_DEBUG_INFO, javacSettings.DEBUGGING_INFO ? "on" : "off"), 1); - 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)); - final int heapSize = CompilerConfiguration.getInstance(project).getBuildProcessHeapSize(javacSettings.MAXIMUM_HEAP_SIZE); - add(new Property(PROPERTY_COMPILER_MAX_MEMORY, heapSize + "m")); - - 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 (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) { - add(new Property(PROPERTY_JAVAC2_HOME, propertyRelativePath(PROPERTY_IDEA_HOME, "lib"))); - Path javac2 = new Path(PROPERTY_JAVAC2_CLASSPATH_ID); - FileSet fileSet = new FileSet("${" + PROPERTY_JAVAC2_HOME + "}"); - fileSet.add(new Include("javac2.jar")); - fileSet.add(new Include("jdom.jar")); - fileSet.add(new Include("asm-all*.jar")); - fileSet.add(new Include("forms-*.jar")); - javac2.add(fileSet); - add(javac2); - register.add(new Tag("taskdef", - pair("name", "javac2"), - pair("classname", "com.intellij.ant.Javac2"), - pair("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID))); - register.add(new Tag("taskdef", - pair("name", "instrumentIdeaExtensions"), - pair("classname", "com.intellij.ant.InstrumentIdeaExtensions"), - pair("classpathref", PROPERTY_JAVAC2_CLASSPATH_ID))); - } - if (customCompilers.length > 0) { - for (ChunkCustomCompilerExtension ext : customCompilers) { - ext.generateCustomCompilerTaskRegistration(project, genOptions, register); - } - } - add(register); - } - } - - @Override - 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 SdkTypeId sdkType = jdk.getSdkType(); - if (!(sdkType instanceof JavaSdkType) || ((JavaSdkType)sdkType).getBinPath(jdk) == null) { - continue; - } - final File home = VfsUtilCore.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).getProjectSdk(); - 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/BuildTargetsFactoryImpl.java b/java/compiler/impl/src/com/intellij/compiler/ant/BuildTargetsFactoryImpl.java deleted file mode 100644 index 240fdf240c28..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/BuildTargetsFactoryImpl.java +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - -package com.intellij.compiler.ant; - -import com.intellij.openapi.project.Project; -import com.intellij.util.ArrayUtilRt; -import org.jetbrains.annotations.TestOnly; - -public class BuildTargetsFactoryImpl extends BuildTargetsFactory { - - - @Override - public Generator createComment(final String comment) { - return new Comment(comment); - } - - @Override - @TestOnly - public GenerationOptions getDefaultOptions(Project project) { - return new GenerationOptionsImpl(project, true, false, false, true, ArrayUtilRt.EMPTY_STRING_ARRAY); - } -} \ No newline at end of file diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/ChunkBuild.java b/java/compiler/impl/src/com/intellij/compiler/ant/ChunkBuild.java deleted file mode 100644 index 0f12566848a1..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/ChunkBuild.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.Path; -import com.intellij.compiler.ant.taskdefs.Property; -import com.intellij.openapi.compiler.CompilerBundle; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.vfs.VirtualFileManager; - -import java.io.File; - -/** - * @author Eugene Zhuravlev - */ -public class ChunkBuild extends CompositeGenerator{ - - public ChunkBuild(Project project, ModuleChunk chunk, GenerationOptions genOptions) { - final File chunkBaseDir = chunk.getBaseDir(); - 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()) : "")); - } - } - - final StringBuilder compileArgs = new StringBuilder(); - compileArgs.append(chunk.getChunkSpecificCompileOptions()); - if (compileArgs.length() > 0) { - compileArgs.append(" "); - } - compileArgs.append(BuildProperties.propertyRef(BuildProperties.PROPERTY_COMPILER_ADDITIONAL_ARGS)); - add(new Property(BuildProperties.getModuleChunkCompilerArgsProperty(chunk.getName()), compileArgs.toString()), 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, 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); - add(new CompileModuleChunkTarget(project, chunk, moduleSources.getSourceRoots(), moduleSources.getTestSourceRoots(), chunkBaseDir, genOptions), 1); - add(new CleanModule(chunk), 1); - - ChunkBuildExtension.process(this, chunk, genOptions); - } - - private static Generator createBootclasspath(ModuleChunk chunk) { - final Path bootclasspath = new Path(BuildProperties.getBootClasspathProperty(chunk.getName())); - bootclasspath.add(new Comment(CompilerBundle.message("generated.ant.build.bootclasspath.comment"))); - return bootclasspath; - } - - -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/CleanModule.java b/java/compiler/impl/src/com/intellij/compiler/ant/CleanModule.java deleted file mode 100644 index 53d9a7502e72..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/CleanModule.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.Delete; -import com.intellij.compiler.ant.taskdefs.Target; -import com.intellij.openapi.compiler.CompilerBundle; - -/** - * @author Eugene Zhuravlev - */ -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); - 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/impl/src/com/intellij/compiler/ant/CleanProject.java b/java/compiler/impl/src/com/intellij/compiler/ant/CleanProject.java deleted file mode 100644 index 9092ed4acd05..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/CleanProject.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.artifacts.ArtifactsGenerator; -import com.intellij.compiler.ant.taskdefs.Target; -import com.intellij.openapi.compiler.CompilerBundle; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.text.StringUtil; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; - -/** - * @author Eugene Zhuravlev - */ -public class CleanProject extends Generator { - private final Target myTarget; - - public CleanProject(Project project, @NotNull GenerationOptions genOptions, @NotNull ArtifactsGenerator artifactsGenerator) { - List dependencies = new ArrayList<>(); - final ModuleChunk[] chunks = genOptions.getModuleChunks(); - for (ModuleChunk chunk : chunks) { - dependencies.add(BuildProperties.getModuleCleanTargetName(chunk.getName())); - } - dependencies.addAll(artifactsGenerator.getCleanTargetNames()); - for (ChunkBuildExtension extension : ChunkBuildExtension.EP_NAME.getExtensions()) { - dependencies.addAll(extension.getCleanTargetNames(project, genOptions)); - } - myTarget = new Target(BuildProperties.TARGET_CLEAN, StringUtil.join(dependencies, ", "), - CompilerBundle.message("generated.ant.build.clean.all.task.comment"), null); - } - - @Override - public void generate(PrintWriter out) throws IOException { - myTarget.generate(out); - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/Comment.java b/java/compiler/impl/src/com/intellij/compiler/ant/Comment.java deleted file mode 100644 index 0e62a5670517..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/Comment.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import java.io.IOException; -import java.io.PrintWriter; - -/** - * @author Eugene Zhuravlev - */ -public class Comment extends Generator{ - private final String myComment; - private final Generator myCommentedData; - - public Comment(String comment) { - this(comment, null); - } - - public Comment(Generator commentedData) { - this(null, commentedData); - } - - public Comment(String comment, Generator commentedData) { - myComment = comment; - myCommentedData = commentedData; - } - - @Override - public void generate(PrintWriter out) throws IOException { - if (myComment != null) { - out.print(""); - if (myCommentedData != null) { - crlf(out); - } - } - if (myCommentedData != null) { - out.print(""); - } - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java b/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java deleted file mode 100644 index 89bd1b3c2479..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/CompileModuleChunkTarget.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.*; -import com.intellij.openapi.compiler.CompilerBundle; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.ProjectFileIndex; -import com.intellij.openapi.roots.ProjectRootManager; -import com.intellij.openapi.util.Couple; -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.NonNls; - -import java.io.File; -import java.util.HashMap; -import java.util.Map; - -/** - * @author Eugene Zhuravlev - */ -public class CompileModuleChunkTarget extends CompositeGenerator { - - 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", Couple.of("line", BuildProperties.propertyRef( - BuildProperties.getModuleChunkCompilerArgsProperty(moduleChunkName)))); - //noinspection HardCodedStringLiteral - final Couple classpathRef = Couple.of("refid", BuildProperties.getClasspathProperty(moduleChunkName)); - final Tag classpathTag = new Tag("classpath", classpathRef); - //noinspection HardCodedStringLiteral - final Tag bootclasspathTag = - new Tag("bootclasspath", Couple.of("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 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); - 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); - 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); - - if (sourceRoots.length > 0) { - final String outputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathProperty(moduleChunkName)); - final Tag srcTag = new Tag("src", Couple.of("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)); - } - - if (testSourceRoots.length > 0) { - - final String testOutputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathForTestsProperty(moduleChunkName)); - final Tag srcTag = new Tag("src", Couple.of("refid", BuildProperties.getTestSourcepathProperty(moduleChunkName))); - final Couple testClasspathRef = Couple.of("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)); - } - - add(mainTarget); - add(productionTarget, 1); - add(testsTarget, 1); - } - - /** - * Create custom compiler tasks - * - * @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 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 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) { - if (customCompilers.length > 1) { - target.add(new Tag("fail", Couple.of("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 StringBuilder moduleDependencies = new StringBuilder(); - 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", Couple.of("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/CompilerExcludes.java b/java/compiler/impl/src/com/intellij/compiler/ant/CompilerExcludes.java deleted file mode 100644 index f6c85a233836..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/CompilerExcludes.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.CompilerConfiguration; -import com.intellij.compiler.CompilerConfigurationImpl; -import com.intellij.compiler.ant.taskdefs.Exclude; -import com.intellij.compiler.ant.taskdefs.PatternSet; -import com.intellij.openapi.compiler.options.ExcludeEntryDescription; -import com.intellij.openapi.project.Project; - -import java.io.IOException; -import java.io.PrintWriter; - -/** - * @author Eugene Zhuravlev - */ -public class CompilerExcludes extends Generator { - private final PatternSet myPatternSet; - - public CompilerExcludes(Project project, GenerationOptions genOptions) { - final CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project); - final ExcludeEntryDescription[] excludeEntryDescriptions = - compilerConfiguration.getExcludedEntriesConfiguration().getExcludeEntryDescriptions(); - myPatternSet = new PatternSet(BuildProperties.PROPERTY_COMPILER_EXCLUDES); - for (final ExcludeEntryDescription entry : excludeEntryDescriptions) { - final String path = GenerationUtils - .toRelativePath(entry.getVirtualFile(), BuildProperties.getProjectBaseDir(project), BuildProperties.getProjectBaseDirProperty(), - genOptions); - if (path == null) { - // entry is invalid, skip it - continue; - } - if (entry.isFile()) { - myPatternSet.add(new Exclude(path)); - } - else { - if (entry.isIncludeSubdirectories()) { - myPatternSet.add(new Exclude(path + "/**")); - } - else { - myPatternSet.add(new Exclude(path + "/*")); - } - } - } - } - - - @Override - public void generate(PrintWriter out) throws IOException { - myPatternSet.generate(out); - } - - public static boolean isAvailable(Project project) { - final CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project); - final ExcludeEntryDescription[] excludeEntryDescriptions = - compilerConfiguration.getExcludedEntriesConfiguration().getExcludeEntryDescriptions(); - return excludeEntryDescriptions.length > 0; - } - -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/CompilerResourcePatterns.java b/java/compiler/impl/src/com/intellij/compiler/ant/CompilerResourcePatterns.java deleted file mode 100644 index 76d1ae145066..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/CompilerResourcePatterns.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.CompilerConfiguration; -import com.intellij.compiler.CompilerConfigurationImpl; -import com.intellij.compiler.ant.taskdefs.Exclude; -import com.intellij.compiler.ant.taskdefs.Include; -import com.intellij.compiler.ant.taskdefs.PatternSet; -import com.intellij.openapi.project.Project; - -import java.io.IOException; -import java.io.PrintWriter; - -/** - * @author Eugene Zhuravlev - */ -public class CompilerResourcePatterns extends Generator { - private final PatternSet myPatternSet; - - public CompilerResourcePatterns(Project project) { - final CompilerConfigurationImpl compilerConfiguration = (CompilerConfigurationImpl)CompilerConfiguration.getInstance(project); - final String[] patterns = compilerConfiguration.getResourceFilePatterns(); - myPatternSet = new PatternSet(BuildProperties.PROPERTY_COMPILER_RESOURCE_PATTERNS); - for (String pattern : patterns) { - if (CompilerConfigurationImpl.isPatternNegated(pattern)) { - myPatternSet.add(new Exclude("**/" + pattern.substring(1))); - } - else { - myPatternSet.add(new Include("**/" + pattern)); - } - } - } - - - @Override - public void generate(PrintWriter out) throws IOException { - myPatternSet.generate(out); - } - - -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java b/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java deleted file mode 100644 index c5e4558e2325..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntApplication.java +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant; - -import com.intellij.codeInspection.InspectionsBundle; -import com.intellij.compiler.actions.GenerateAntBuildAction; -import com.intellij.openapi.application.ex.ApplicationEx; -import com.intellij.openapi.application.ex.ApplicationManagerEx; -import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.project.ex.ProjectManagerEx; -import com.intellij.openapi.vfs.LocalFileSystem; -import com.intellij.openapi.vfs.VirtualFile; - -import javax.swing.*; -import java.io.File; -import java.io.IOException; -import java.nio.file.Paths; - -/** - * @author max - */ -public class GenerateAntApplication { - private static final Logger LOG = Logger.getInstance(GenerateAntApplication.class); - - public String myProjectPath = null; - public String myOutPath = null; - private Project myProject; - private int myVerboseLevel = 0; - - public void startup() { - if (myProjectPath == null || myOutPath == null) { - GenerateAntMain.printHelp(); - } - - SwingUtilities.invokeLater(() -> { - ApplicationEx application = ApplicationManagerEx.getApplicationEx(); - try { - logMessage(0, "Starting app... "); - application.setSaveAllowed(false); - application.load(); - logMessageLn(0, "done"); - - this.run(); - } - catch (Exception e) { - LOG.error(e); - } - finally { - application.exit(true, true); - } - }); - } - - public void run() { - try { - myProjectPath = myProjectPath.replace(File.separatorChar, '/'); - VirtualFile vfsProject = LocalFileSystem.getInstance().findFileByPath(myProjectPath); - if (vfsProject == null) { - logError(InspectionsBundle.message("inspection.application.file.cannot.be.found", myProjectPath)); - GenerateAntMain.printHelp(); - } - - logMessage(0, "Loading project..."); - myProject = ProjectManagerEx.getInstanceEx().loadProject(Paths.get(myProjectPath).toAbsolutePath()); - - logMessageLn(0, " done"); - - GenerateAntBuildAction.generateSingleFileBuild(myProject, - new GenerationOptionsImpl(myProject, true, true, false, false, new String[] {}), - new File("/Users/max/build/build.xml"), - new File("/Users/max/build/build.properties")); - - logMessage(0, "Hello!"); - } - catch (IOException e) { - LOG.error(e); - GenerateAntMain.printHelp(); - } - catch (Exception e) { - LOG.error(e); - System.exit(1); - } - } - - public void setVerboseLevel(int verboseLevel) { - myVerboseLevel = verboseLevel; - } - - private void logMessage(int minVerboseLevel, String message) { - if (myVerboseLevel >= minVerboseLevel) { - System.out.print(message); - } - } - - private void logError(String message) { - System.err.println(message); - } - - private void logMessageLn(int minVerboseLevel, String message) { - if (myVerboseLevel >= minVerboseLevel) { - System.out.println(message); - } - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntMain.java b/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntMain.java deleted file mode 100644 index b16b8bf1c658..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/GenerateAntMain.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant; - -import com.intellij.openapi.application.ApplicationStarter; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; - -import java.util.List; - -final class GenerateAntMain implements ApplicationStarter { - private GenerateAntApplication myApplication; - - @Override - @NonNls - public String getCommandName() { - return "ant"; - } - - @Override - public void premain(@NotNull List args) { - System.setProperty("idea.load.plugins", "false"); - myApplication = new GenerateAntApplication(); - - myApplication.myProjectPath = args.get(1); - myApplication.myOutPath = args.get(2); - } - - @Override - public void main(@NotNull String[] args) { - myApplication.startup(); - } - - public static void printHelp() { - System.out.println("Wrong params"); - System.exit(1); - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/GenerationOptionsImpl.java b/java/compiler/impl/src/com/intellij/compiler/ant/GenerationOptionsImpl.java deleted file mode 100644 index 503e600a5d4a..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/GenerationOptionsImpl.java +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant; - -import com.intellij.application.options.ReplacePathToMacroMap; -import com.intellij.compiler.ModuleCompilerUtil; -import com.intellij.openapi.application.PathMacros; -import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.ProjectJdkTable; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.roots.CompilerModuleExtension; -import com.intellij.openapi.roots.OrderRootType; -import com.intellij.openapi.util.SystemInfo; -import com.intellij.openapi.util.io.FileUtilRt; -import com.intellij.util.Chunk; -import com.intellij.util.IncorrectOperationException; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.graph.CachingSemiGraph; -import com.intellij.util.graph.Graph; -import com.intellij.util.graph.GraphGenerator; -import com.intellij.util.graph.InboundSemiGraph; -import org.jetbrains.annotations.NotNull; - -import java.io.File; -import java.util.*; - -/** - * Implementation class for Ant generation options - * - * @author Eugene Zhuravlev - */ -public class GenerationOptionsImpl extends GenerationOptions { - - /** - * from absolute path to macro substitutions - */ - private final ReplacePathToMacroMap myMacroReplacementMap; - /** - * from absolute path to macro substitutions - */ - private final Map myOutputUrlToPropertyRefMap; - /** - * module chunks - */ - private final ModuleChunk[] myModuleChunks; - /** - * the project to be converted - */ - private final Project myProject; - private final boolean myGenerateIdeaHomeProperty; - private final String myOutputFileName; - private Set myJdkUrls; - /** - * Custom compilers used in the ant build. - */ - private final Set myCustomCompilers = new HashSet<>(); - /** - * map from modules to chunks - */ - private final Map myModuleToChunkMap = new HashMap<>(); - - /** - * A constructor - * - * @param project a project to generate - * @param generateSingleFile a value of corresponding option - * @param enableFormCompiler a value of corresponding option - * @param backupPreviouslyGeneratedFiles a value of corresponding option - * @param forceTargetJdk a value of corresponding option - * @param inlineRuntimeClasspath if true a runtiem classpaths are inlined - * @param representativeModuleNames a module name that represents module chunks. - * @param outputFileName a name for the output file - */ - public GenerationOptionsImpl(Project project, - boolean generateSingleFile, - boolean enableFormCompiler, - boolean backupPreviouslyGeneratedFiles, - boolean forceTargetJdk, - boolean inlineRuntimeClasspath, - boolean generateIdeaHomeProperty, - String[] representativeModuleNames, String outputFileName) { - super(forceTargetJdk, generateSingleFile, enableFormCompiler, backupPreviouslyGeneratedFiles, inlineRuntimeClasspath); - myProject = project; - myGenerateIdeaHomeProperty = generateIdeaHomeProperty; - myOutputFileName = outputFileName; - myMacroReplacementMap = createReplacementMap(); - myModuleChunks = createModuleChunks(representativeModuleNames); - myOutputUrlToPropertyRefMap = createOutputUrlToPropertyRefMap(myModuleChunks); - } - - /** - * A constructor - * - * @param project a project to generate - * @param forceTargetJdk a value of corresponding option - * @param generateSingleFile a value of corresponding option - * @param enableFormCompiler a value of corresponding option - * @param backupPreviouslyGeneratedFiles a value of corresponding option - * @param representativeModuleNames a module name that represents module chunks. - */ - @Deprecated - public GenerationOptionsImpl(Project project, - boolean generateSingleFile, - boolean enableFormCompiler, - boolean backupPreviouslyGeneratedFiles, - boolean forceTargetJdk, - String[] representativeModuleNames) { - this(project, forceTargetJdk, generateSingleFile, enableFormCompiler, backupPreviouslyGeneratedFiles, false, false, - representativeModuleNames, null); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isIdeaHomeGenerated() { - return myGenerateIdeaHomeProperty; - } - - @Override - public String getBuildFileName() { - return getOutputFileName() + ".xml"; - } - - @Override - public String getPropertiesFileName() { - return getOutputFileName() + ".properties"; - } - - private String getOutputFileName() { - if (myOutputFileName == null || myOutputFileName.length() == 0) { - return BuildProperties.getProjectBuildFileName(myProject); - } - return myOutputFileName; - } - - /** - * {@inheritDoc} - */ - @Override - public ModuleChunk getChunkByModule(final Module module) { - if (myModuleToChunkMap.isEmpty()) { - for (ModuleChunk c : myModuleChunks) { - for (Module m : c.getModules()) { - myModuleToChunkMap.put(m, c); - } - } - } - return myModuleToChunkMap.get(module); - } - - @Override - public String subsitutePathWithMacros(@NotNull String path) { - return myMacroReplacementMap.substitute(path, SystemInfo.isFileSystemCaseSensitive); - } - - @Override - public String getPropertyRefForUrl(String url) { - return myOutputUrlToPropertyRefMap.get(url); - } - - @NotNull - private static ReplacePathToMacroMap createReplacementMap() { - Map pathMacros = PathMacros.getInstance().getUserMacros(); - ReplacePathToMacroMap map = new ReplacePathToMacroMap(); - for (String macroName : pathMacros.keySet()) { - map.put(FileUtilRt.toSystemIndependentName(pathMacros.get(macroName)), BuildProperties.propertyRef(BuildProperties.getPathMacroProperty(macroName))); - } - map.put(FileUtilRt.toSystemIndependentName(PathManager.getHomePath()), BuildProperties.propertyRef(BuildProperties.PROPERTY_IDEA_HOME)); - return map; - } - - private static Map createOutputUrlToPropertyRefMap(ModuleChunk[] chunks) { - final Map map = new HashMap<>(); - - for (final ModuleChunk chunk : chunks) { - final String outputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathProperty(chunk.getName())); - final String testsOutputPathRef = BuildProperties.propertyRef(BuildProperties.getOutputPathForTestsProperty(chunk.getName())); - - final Module[] modules = chunk.getModules(); - for (final Module module : modules) { - final String outputPathUrl = CompilerModuleExtension.getInstance(module).getCompilerOutputUrl(); - if (outputPathUrl != null) { - map.put(outputPathUrl, outputPathRef); - } - final String outputPathForTestsUrl = CompilerModuleExtension.getInstance(module).getCompilerOutputUrlForTests(); - if (outputPathForTestsUrl != null) { - if (outputPathUrl == null || !outputPathForTestsUrl.equals(outputPathUrl)) { - map.put(outputPathForTestsUrl, testsOutputPathRef); - } - } - } - } - return map; - } - - @Override - public ModuleChunk[] getModuleChunks() { - return myModuleChunks; - } - - private ModuleChunk[] createModuleChunks(String[] representativeModuleNames) { - final Set mainModuleNames = ContainerUtil.set(representativeModuleNames); - final Graph> chunkGraph = ModuleCompilerUtil.toChunkGraph(ModuleManager.getInstance(myProject).moduleGraph()); - final Map, ModuleChunk> map = new HashMap<>(); - final Map> reverseMap = new HashMap<>(); - for (final Chunk chunk : chunkGraph.getNodes()) { - final Set modules = chunk.getNodes(); - final ModuleChunk moduleChunk = new ModuleChunk(modules.toArray(Module.EMPTY_ARRAY)); - for (final Module module : modules) { - if (mainModuleNames.contains(module.getName())) { - moduleChunk.setMainModule(module); - break; - } - } - map.put(chunk, moduleChunk); - reverseMap.put(moduleChunk, chunk); - } - - final Graph moduleChunkGraph = GraphGenerator.generate(CachingSemiGraph.cache(new InboundSemiGraph() { - @Override - @NotNull - public Collection getNodes() { - return map.values(); - } - - @NotNull - @Override - public Iterator getIn(ModuleChunk n) { - final Chunk chunk = reverseMap.get(n); - final Iterator> in = chunkGraph.getIn(chunk); - return new Iterator() { - @Override - public boolean hasNext() { - return in.hasNext(); - } - - @Override - public ModuleChunk next() { - return map.get(in.next()); - } - - @Override - public void remove() { - throw new IncorrectOperationException("Method is not supported"); - } - }; - } - })); - final Collection nodes = moduleChunkGraph.getNodes(); - final ModuleChunk[] moduleChunks = nodes.toArray(new ModuleChunk[0]); - for (ModuleChunk moduleChunk : moduleChunks) { - final Iterator depsIterator = moduleChunkGraph.getIn(moduleChunk); - List deps = new ArrayList<>(); - while (depsIterator.hasNext()) { - deps.add(depsIterator.next()); - } - moduleChunk.setDependentChunks(deps.toArray(new ModuleChunk[0])); - ContainerUtil.addAll(myCustomCompilers, moduleChunk.getCustomCompilers()); - } - Arrays.sort(moduleChunks, new ChunksComparator()); - if (generateSingleFile) { - final File baseDir = BuildProperties.getProjectBaseDir(myProject); - for (ModuleChunk chunk : moduleChunks) { - chunk.setBaseDir(baseDir); - } - } - return moduleChunks; - } - - /** - * {@inheritDoc} - */ - @Override - public ChunkCustomCompilerExtension[] getCustomCompilers() { - ChunkCustomCompilerExtension[] sorted = myCustomCompilers.toArray(new ChunkCustomCompilerExtension[0]); - Arrays.sort(sorted, ChunkCustomCompilerExtension.COMPARATOR); - return sorted; - } - - Set getAllJdkUrls() { - if (myJdkUrls != null) { - return myJdkUrls; - } - final Sdk[] projectJdks = ProjectJdkTable.getInstance().getAllJdks(); - myJdkUrls = new HashSet<>(); - for (Sdk jdk : projectJdks) { - ContainerUtil.addAll(myJdkUrls, jdk.getRootProvider().getUrls(OrderRootType.CLASSES)); - } - return myJdkUrls; - } - - private static class ChunksComparator implements Comparator { - final Map myCachedLevels = new HashMap<>(); - - @Override - public int compare(final ModuleChunk o1, final ModuleChunk o2) { - final int level1 = getChunkLevel(o1); - final int level2 = getChunkLevel(o2); - return (level1 == level2) ? o1.getName().compareToIgnoreCase(o2.getName()) : (level1 - level2); - } - - private int getChunkLevel(ModuleChunk chunk) { - Integer level = myCachedLevels.get(chunk); - if (level == null) { - final ModuleChunk[] chunks = chunk.getDependentChunks(); - if (chunks.length > 0) { - int maxLevel = 0; - for (ModuleChunk dependent : chunks) { - maxLevel = Math.max(maxLevel, getChunkLevel(dependent)); - } - level = 1 + maxLevel; - } - else { - level = 0; - } - myCachedLevels.put(chunk, level); - } - return level.intValue(); - } - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/IgnoredFiles.java b/java/compiler/impl/src/com/intellij/compiler/ant/IgnoredFiles.java deleted file mode 100644 index 9e75a5939426..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/IgnoredFiles.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.Exclude; -import com.intellij.compiler.ant.taskdefs.PatternSet; -import com.intellij.openapi.fileTypes.FileTypeManager; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.StringTokenizer; - -/** - * @author Eugene Zhuravlev - */ -public class IgnoredFiles extends Generator{ - private final PatternSet myPatternSet; - - public IgnoredFiles() { - myPatternSet = new PatternSet(BuildProperties.PROPERTY_IGNORED_FILES); - final StringTokenizer tokenizer = new StringTokenizer(FileTypeManager.getInstance().getIgnoredFilesList(), ";", false); - while(tokenizer.hasMoreTokens()) { - final String filemask = tokenizer.nextToken(); - myPatternSet.add(new Exclude("**/" + filemask + "/**")); - } - } - - - - @Override - public void generate(PrintWriter out) throws IOException { - myPatternSet.generate(out); - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/LibraryDefinitionsGeneratorFactory.java b/java/compiler/impl/src/com/intellij/compiler/ant/LibraryDefinitionsGeneratorFactory.java deleted file mode 100644 index f32a252065d2..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/LibraryDefinitionsGeneratorFactory.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.FileSet; -import com.intellij.compiler.ant.taskdefs.Path; -import com.intellij.compiler.ant.taskdefs.PathElement; -import com.intellij.compiler.ant.taskdefs.PatternSetRef; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.project.ex.ProjectEx; -import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.roots.OrderRootType; -import com.intellij.openapi.roots.libraries.Library; -import com.intellij.openapi.roots.libraries.LibraryTable; -import com.intellij.openapi.vfs.JarFileSystem; -import com.intellij.openapi.vfs.LocalFileSystem; -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.Nullable; - -import java.io.File; -import java.util.*; - -/** - * @author Eugene Zhuravlev - */ -public class LibraryDefinitionsGeneratorFactory { - private final ProjectEx myProject; - private final GenerationOptions myGenOptions; - private final Set myUsedLibraries = new HashSet<>(); - - public LibraryDefinitionsGeneratorFactory(ProjectEx project, GenerationOptions genOptions) { - myProject = project; - myGenOptions = genOptions; - final ModuleManager moduleManager = ModuleManager.getInstance(project); - final Module[] modules = moduleManager.getModules(); - for (Module module : modules) { - ModuleRootManager.getInstance(module).orderEntries().forEachLibrary(library -> { - final String name = library.getName(); - if (name != null) { - myUsedLibraries.add(name); - } - return true; - }); - } - } - - /** - * Create a generator for the specified libary type. It generates a list of library definitions. - * - * @param libraryTable a library table to examine - * @param baseDir base directory for ant build script - * @param comment a comment to use for the library - * @return the created generator or null if there is a nothing to generate - */ - @Nullable - public Generator create(LibraryTable libraryTable, File baseDir, final String comment) { - final Library[] libraries = libraryTable.getLibraries(); - if (libraries.length == 0) { - return null; - } - - final CompositeGenerator gen = new CompositeGenerator(); - - gen.add(new Comment(comment), 1); - // sort libraries to ensure stable order of them. - TreeMap sortedLibs = new TreeMap<>(); - for (final Library library : libraries) { - final String libraryName = library.getName(); - if (!myUsedLibraries.contains(libraryName)) { - continue; - } - sortedLibs.put(BuildProperties.getLibraryPathId(libraryName), library); - } - for (final Library library : sortedLibs.values()) { - final String libraryName = library.getName(); - final Path libraryPath = new Path(BuildProperties.getLibraryPathId(libraryName)); - genLibraryContent(myProject, myGenOptions, library, baseDir, libraryPath); - gen.add(libraryPath, 1); - } - return gen.getGeneratorCount() > 0 ? gen : null; - } - - /** - * Generate library content - * - * @param project the context project - * @param genOptions the generation options - * @param library the library which content is generated - * @param baseDir the base directory - * @param libraryPath the composite generator to update - */ - public static void genLibraryContent(final ProjectEx project, - final GenerationOptions genOptions, - final Library library, - final File baseDir, - final CompositeGenerator libraryPath) { - genLibraryContent(genOptions, library, OrderRootType.CLASSES, baseDir, libraryPath); - } - - public static void genLibraryContent(final GenerationOptions genOptions, - final Library library, - final OrderRootType rootType, final File baseDir, - final CompositeGenerator libraryPath) { - if (genOptions.expandJarDirectories) { - final VirtualFile[] files = library.getFiles(rootType); - // note that it is assumed that directory entries inside library path are unordered - TreeSet visitedPaths = new TreeSet<>(); - for (final VirtualFile file : files) { - final String path = GenerationUtils - .toRelativePath(file, baseDir, BuildProperties.getProjectBaseDirProperty(), genOptions); - visitedPaths.add(path); - } - for (final String path : visitedPaths) { - libraryPath.add(new PathElement(path)); - } - } - else { - TreeSet urls = new TreeSet<>(Arrays.asList(library.getUrls(rootType))); - for (String url : urls) { - File file = fileFromUrl(url); - final String path = GenerationUtils - .toRelativePath(file.getPath(), baseDir, BuildProperties.getProjectBaseDirProperty(), genOptions); - if (url.startsWith(JarFileSystem.PROTOCOL_PREFIX)) { - libraryPath.add(new PathElement(path)); - } - else if (url.startsWith(LocalFileSystem.PROTOCOL_PREFIX)) { - if (library.isJarDirectory(url, rootType)) { - final FileSet fileSet = new FileSet(path); - fileSet.add(new PatternSetRef(BuildProperties.PROPERTY_LIBRARIES_PATTERNS)); - libraryPath.add(fileSet); - } - else { - libraryPath.add(new PathElement(path)); - } - } - else { - throw new IllegalStateException("Unknown url type: " + url); - } - } - } - } - - /** - * Gets file from jar of file URL - * - * @param url an url to parse - * @return - */ - private static File fileFromUrl(String url) { - final String filePart; - if (url.startsWith(JarFileSystem.PROTOCOL_PREFIX) && url.endsWith(JarFileSystem.JAR_SEPARATOR)) { - filePart = url.substring(JarFileSystem.PROTOCOL_PREFIX.length(), url.length() - JarFileSystem.JAR_SEPARATOR.length()); - } - else if (url.startsWith(LocalFileSystem.PROTOCOL_PREFIX)) { - filePart = url.substring(JarFileSystem.PROTOCOL_PREFIX.length()); - } - else { - throw new IllegalArgumentException("Unknown url type: " + url); - } - return new File(filePart.replace('/', File.separatorChar)); - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/LibraryPatterns.java b/java/compiler/impl/src/com/intellij/compiler/ant/LibraryPatterns.java deleted file mode 100644 index a1822b60a876..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/LibraryPatterns.java +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.Include; -import com.intellij.compiler.ant.taskdefs.PatternSet; -import com.intellij.ide.highlighter.ArchiveFileType; -import com.intellij.openapi.fileTypes.*; -import com.intellij.openapi.project.Project; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -/** - * Library pattern generation (based on {@link ArchiveFileType#INSTANCE} file type). - */ -public class LibraryPatterns extends Generator { - /** - * A pattern set to use - */ - private final PatternSet myPatternSet; - - /** - * A constructor - * - * @param project a context project - * @param genOptions a generation options - */ - public LibraryPatterns(Project project, GenerationOptions genOptions) { - myPatternSet = new PatternSet(BuildProperties.PROPERTY_LIBRARIES_PATTERNS); - final FileType type = ArchiveFileType.INSTANCE; - final List matchers = FileTypeManager.getInstance().getAssociations(type); - for (FileNameMatcher m : matchers) { - if (m instanceof ExactFileNameMatcher) { - final String path = GenerationUtils - .toRelativePath(m.getPresentableString(), BuildProperties.getProjectBaseDir(project), BuildProperties.getProjectBaseDirProperty(), - genOptions); - myPatternSet.add(new Include(path)); - } - else { - myPatternSet.add(new Include(m.getPresentableString())); - } - } - } - - /** - * {@inheritDoc} - */ - @Override - public void generate(final PrintWriter out) throws IOException { - myPatternSet.generate(out); - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkAntProject.java b/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkAntProject.java deleted file mode 100644 index ea4cfac5dc0f..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkAntProject.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.AntProject; -import com.intellij.compiler.ant.taskdefs.Dirname; -import com.intellij.openapi.project.Project; - -import java.io.IOException; -import java.io.PrintWriter; - -/** - * @author Eugene Zhuravlev - */ -public class ModuleChunkAntProject extends Generator{ - private final AntProject myAntProject; - - public ModuleChunkAntProject(Project project, ModuleChunk moduleChunk, GenerationOptions genOptions) { - myAntProject = new AntProject(BuildProperties.getModuleChunkBuildFileName(moduleChunk), BuildProperties.getCompileTargetName(moduleChunk.getName())); - myAntProject.add(new Dirname(BuildProperties.getModuleChunkBasedirProperty(moduleChunk), BuildProperties.propertyRef("ant.file." + BuildProperties.getModuleChunkBuildFileName(moduleChunk)))); - myAntProject.add(new ChunkBuild(project, moduleChunk, genOptions)); - - } - - @Override - public void generate(PrintWriter out) throws IOException { - writeXmlHeader(out); - myAntProject.generate(out); - } - - -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java b/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java deleted file mode 100644 index a8188865b31c..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkClasspath.java +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.Path; -import com.intellij.compiler.ant.taskdefs.PathElement; -import com.intellij.compiler.ant.taskdefs.PathRef; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.project.ex.ProjectEx; -import com.intellij.openapi.roots.*; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.JarFileSystem; -import com.intellij.openapi.vfs.VirtualFileManager; -import com.intellij.util.ArrayUtilRt; -import com.intellij.util.containers.ContainerUtil; -import com.intellij.util.containers.OrderedSet; - -import java.io.File; -import java.util.HashSet; -import java.util.Set; - -/** - * Generator of module chunk classspath. The class used to generate both runtime and compile time classpaths. - * - * @author Eugene Zhuravlev - */ -public class ModuleChunkClasspath extends Path { - - /** - * A constructor - * - * @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. - */ - public ModuleChunkClasspath(final ModuleChunk chunk, - final GenerationOptions genOptions, - final boolean generateRuntimeClasspath, - final boolean generateTestClasspath) { - super(generateClasspathName(chunk, generateRuntimeClasspath, generateTestClasspath)); - - final OrderedSet pathItems = - new OrderedSet<>(); - final String moduleChunkBasedirProperty = BuildProperties.getModuleChunkBasedirProperty(chunk); - final Module[] modules = chunk.getModules(); - // processed chunks (used only in runtime classpath), every chunk is referenced exactly once - final Set processedChunks = new HashSet<>(); - // pocessed modules - final Set processedModules = new HashSet<>(); - for (final Module module : modules) { - new Object() { - /** - * Process the module. The logic is different for compile-time case and runtime case. - * In the case of runtime, only directly referenced objects are included in classpath. - * Indirectly referenced are - * - * @param module a module to process. - * @param dependencyLevel is increased with every of recursion. - * @param isModuleExported if true the module is exported from the previous level - */ - public void processModule(final Module module, final int dependencyLevel, final boolean isModuleExported) { - if (processedModules.contains(module)) { - // the module is already processed, nothing should be done - return; - } - if (dependencyLevel > 1 && !isModuleExported && !(genOptions.inlineRuntimeClasspath && generateRuntimeClasspath)) { - // the module is not in exports and it is not directly included skip it in the case of library pathgeneration - return; - } - processedModules.add(module); - final ProjectEx project = (ProjectEx)chunk.getProject(); - final File baseDir = BuildProperties.getProjectBaseDir(project); - OrderEnumerator enumerator = ModuleRootManager.getInstance(module).orderEntries(); - if (generateRuntimeClasspath) { - enumerator = enumerator.runtimeOnly(); - } - else { - enumerator = enumerator.compileOnly(); - if (!generateTestClasspath && (dependencyLevel == 0 || chunk.contains(module))) { - // this is the entry for outpath of the currently processed module - // the root module is never included - enumerator = enumerator.withoutModuleSourceEntries(); - } - } - if (!generateTestClasspath) { - enumerator = enumerator.productionOnly(); - } - enumerator.forEach(orderEntry -> { - if (!orderEntry.isValid()) { - return true; - } - - if (!generateRuntimeClasspath && - !(orderEntry instanceof ModuleOrderEntry) && - !(orderEntry instanceof ModuleSourceOrderEntry)) { - // needed for compilation classpath only - final boolean isExported = (orderEntry instanceof ExportableOrderEntry) && ((ExportableOrderEntry)orderEntry).isExported(); - if (dependencyLevel > 0 && !isExported) { - // non-exported dependencies are excluded and not processed - return true; - } - } - - if (orderEntry instanceof JdkOrderEntry) { - if (genOptions.forceTargetJdk && !generateRuntimeClasspath) { - pathItems - .add(new PathRefItem(BuildProperties.propertyRef(BuildProperties.getModuleChunkJdkClasspathProperty(chunk.getName())))); - } - } - else if (orderEntry instanceof ModuleOrderEntry) { - final ModuleOrderEntry moduleOrderEntry = (ModuleOrderEntry)orderEntry; - final Module dependentModule = moduleOrderEntry.getModule(); - if (!chunk.contains(dependentModule)) { - if (generateRuntimeClasspath && !genOptions.inlineRuntimeClasspath) { - // in case of runtime classpath, just an referenced to corresponding classpath is created - final ModuleChunk depChunk = genOptions.getChunkByModule(dependentModule); - if (!processedChunks.contains(depChunk)) { - // chunk references are included in the runtime classpath only once - processedChunks.add(depChunk); - String property = generateTestClasspath ? BuildProperties.getTestRuntimeClasspathProperty(depChunk.getName()) - : BuildProperties.getRuntimeClasspathProperty(depChunk.getName()); - pathItems.add(new PathRefItem(property)); - } - } - else { - // in case of compile classpath or inlined runtime classpath, - // the referenced module is processed recursively - processModule(dependentModule, dependencyLevel + 1, moduleOrderEntry.isExported()); - } - } - } - else if (orderEntry instanceof LibraryOrderEntry) { - final LibraryOrderEntry libraryOrderEntry = (LibraryOrderEntry)orderEntry; - final String libraryName = libraryOrderEntry.getLibraryName(); - if (((LibraryOrderEntry)orderEntry).isModuleLevel()) { - CompositeGenerator gen = new CompositeGenerator(); - gen.setHasLeadingNewline(false); - LibraryDefinitionsGeneratorFactory.genLibraryContent(project, genOptions, libraryOrderEntry.getLibrary(), baseDir, gen); - pathItems.add(new GeneratorItem(libraryName, gen)); - } - else { - pathItems.add(new PathRefItem(BuildProperties.getLibraryPathId(libraryName))); - } - } - else if (orderEntry instanceof ModuleSourceOrderEntry) { - // Module source entry? - for (String url : getCompilationClasses(module, ((GenerationOptionsImpl)genOptions), generateRuntimeClasspath, - generateTestClasspath, dependencyLevel == 0)) { - url = StringUtil.trimEnd(url, JarFileSystem.JAR_SEPARATOR); - final String propertyRef = genOptions.getPropertyRefForUrl(url); - if (propertyRef != null) { - pathItems.add(new PathElementItem(propertyRef)); - } - else { - final String path = VirtualFileManager.extractPath(url); - pathItems.add(new PathElementItem( - GenerationUtils.toRelativePath(path, chunk.getBaseDir(), moduleChunkBasedirProperty, genOptions))); - } - } - } - 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()))); - } - return true; - }); - } - }.processModule(module, 0, false); - } - // convert path items to generators - for (final ClasspathItem pathItem : pathItems) { - add(pathItem.toGenerator()); - } - } - - /** - * 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 Module module, - final GenerationOptionsImpl options, - final boolean forRuntime, - final boolean forTest, - final boolean firstLevel) { - final CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module); - if (extension == null) return ArrayUtilRt.EMPTY_STRING_ARRAY; - - if (!forRuntime) { - if (forTest) { - return extension.getOutputRootUrls(!firstLevel); - } - else { - return firstLevel ? ArrayUtilRt.EMPTY_STRING_ARRAY : extension.getOutputRootUrls(false); - } - } - final Set jdkUrls = options.getAllJdkUrls(); - - final OrderedSet urls = new OrderedSet<>(); - ContainerUtil.addAll(urls, extension.getOutputRootUrls(forTest)); - urls.removeAll(jdkUrls); - return ArrayUtilRt.toStringArray(urls); - } - - /** - * The base class for an item in the class path. Instances of the subclasses are used instead - * of generators when building the class path content. The subclasses implement {@link Object#equals(Object)} - * and {@link Object#hashCode()} methods in order to eliminate duplicates when building classpath. - */ - private abstract static class ClasspathItem { - /** - * primary reference or path of the element - */ - protected final String myValue; - - /** - * A constructor - * - * @param value primary value of the element - */ - ClasspathItem(String value) { - myValue = value; - } - - /** - * @return a generator for path elements. - */ - public abstract Generator toGenerator(); - } - - /** - * Class path item that directly embeds generator - */ - private static class GeneratorItem extends ClasspathItem { - /** - * An embedded generator - */ - final Generator myGenerator; - - /** - * A constructor - * - * @param value primary value of the element - * @param generator a generator to use - */ - GeneratorItem(String value, final Generator generator) { - super(value); - myGenerator = generator; - } - - @Override - public Generator toGenerator() { - return myGenerator; - } - } - - /** - * This path element directly references some location. - */ - private static class PathElementItem extends ClasspathItem { - /** - * A constructor - * - * @param value a referenced location - */ - PathElementItem(String value) { - super(value); - } - - @Override - public Generator toGenerator() { - return new PathElement(myValue); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof PathElementItem)) return false; - - final PathElementItem pathElementItem = (PathElementItem)o; - - if (!myValue.equals(pathElementItem.myValue)) return false; - - return true; - } - - @Override - public int hashCode() { - return myValue.hashCode(); - } - } - - /** - * This path element references a path - */ - private static class PathRefItem extends ClasspathItem { - /** - * A constructor - * - * @param value an indentifier of referenced classpath - */ - PathRefItem(String value) { - super(value); - } - - @Override - public Generator toGenerator() { - return new PathRef(myValue); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof PathRefItem)) return false; - - final PathRefItem pathRefItem = (PathRefItem)o; - - if (!myValue.equals(pathRefItem.myValue)) return false; - - return true; - } - - @Override - public int hashCode() { - return myValue.hashCode(); - } - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkSourcePath.java b/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkSourcePath.java deleted file mode 100644 index ea5252967466..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleChunkSourcePath.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright 2000-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.*; -import com.intellij.openapi.fileTypes.FileTypeManager; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.ContentEntry; -import com.intellij.openapi.roots.ModuleFileIndex; -import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.vfs.VfsUtilCore; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.openapi.vfs.VirtualFileVisitor; -import org.jetbrains.annotations.NotNull; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Eugene Zhuravlev - */ -public class ModuleChunkSourcePath extends CompositeGenerator{ - private final VirtualFile[] mySourceRoots; - private final VirtualFile[] myTestSourceRoots; - - public ModuleChunkSourcePath(final Project project, ModuleChunk chunk, final GenerationOptions genOptions) { - final Path sourcePath = new Path(BuildProperties.getSourcepathProperty(chunk.getName())); - final Path testSourcePath = new Path(BuildProperties.getTestSourcepathProperty(chunk.getName())); - final PatternSet excludedFromCompilation = new PatternSet(BuildProperties.getExcludedFromCompilationProperty(chunk.getName())); - final String moduleChunkBasedirProperty = BuildProperties.getModuleChunkBasedirProperty(chunk); - final Module[] modules = chunk.getModules(); - - if (CompilerExcludes.isAvailable(project)) { - excludedFromCompilation.add(new PatternSetRef(BuildProperties.PROPERTY_COMPILER_EXCLUDES)); - } - - final List sourceRootFiles = new ArrayList<>(); - final List testSourceRootFiles = new ArrayList<>(); - - for (final Module module : modules) { - final String moduleName = module.getName(); - final ModuleRootManager rootManager = ModuleRootManager.getInstance(module); - final ModuleFileIndex moduleFileIndex = rootManager.getFileIndex(); - - - final PatternSet excludedFromModule = new PatternSet(BuildProperties.getExcludedFromModuleProperty(moduleName)); - excludedFromModule.add(new PatternSetRef(BuildProperties.PROPERTY_IGNORED_FILES)); - - final ContentEntry[] contentEntries = rootManager.getContentEntries(); - for (final ContentEntry contentEntry : contentEntries) { - final VirtualFile file = contentEntry.getFile(); - if (file == null) { - continue; // filter invalid entries - } - if (!file.isInLocalFileSystem()) { - continue; // skip content roots inside jar and zip archives - } - final VirtualFile dirSetRoot = getDirSetRoot(contentEntry); - - final String dirSetRootRelativeToBasedir = GenerationUtils - .toRelativePath(dirSetRoot, chunk.getBaseDir(), moduleChunkBasedirProperty, genOptions); - final DirSet sourcesDirSet = new DirSet(dirSetRootRelativeToBasedir); - final DirSet testSourcesDirSet = new DirSet(dirSetRootRelativeToBasedir); - - final VirtualFile[] sourceRoots = contentEntry.getSourceFolderFiles(); - for (final VirtualFile root : sourceRoots) { - if (!moduleFileIndex.isInContent(root)) { - continue; // skip library sources - } - - addExcludePatterns(module, root, root, excludedFromModule, true); - - final Include include = new Include(VfsUtilCore.getRelativePath(root, dirSetRoot, '/')); - if (moduleFileIndex.isInTestSourceContent(root)) { - testSourcesDirSet.add(include); - testSourceRootFiles.add(root); - } - else { - sourcesDirSet.add(include); - sourceRootFiles.add(root); - } - } - if (sourcesDirSet.getGeneratorCount() > 0) { - sourcePath.add(sourcesDirSet); - } - if (testSourcesDirSet.getGeneratorCount() > 0) { - testSourcePath.add(testSourcesDirSet); - } - } - - if (excludedFromModule.getGeneratorCount() > 0) { - add(excludedFromModule); - excludedFromCompilation.add(new PatternSetRef(BuildProperties.getExcludedFromModuleProperty(moduleName))); - } - } - - mySourceRoots = VfsUtilCore.toVirtualFileArray(sourceRootFiles); - myTestSourceRoots = VfsUtilCore.toVirtualFileArray(testSourceRootFiles); - - if (excludedFromCompilation.getGeneratorCount() > 0) { - add(excludedFromCompilation, 1); - } - if (sourcePath.getGeneratorCount() > 0) { - add(sourcePath, 1); - } - if (testSourcePath.getGeneratorCount() != 0) { - add(testSourcePath, 1); - } - } - - public VirtualFile[] getSourceRoots() { - return mySourceRoots; - } - - public VirtualFile[] getTestSourceRoots() { - return myTestSourceRoots; - } - - private VirtualFile getDirSetRoot(final ContentEntry contentEntry) { - final VirtualFile contentRoot = contentEntry.getFile(); - final VirtualFile[] sourceFolderFiles = contentEntry.getSourceFolderFiles(); - for (VirtualFile sourceFolderFile : sourceFolderFiles) { - if (contentRoot.equals(sourceFolderFile)) { - return contentRoot.getParent(); - } - } - return contentRoot; - } - - private static void addExcludePatterns(Module module, - final VirtualFile root, - VirtualFile dir, - final CompositeGenerator generator, - final boolean parentIncluded) { - final FileTypeManager fileTypeManager = FileTypeManager.getInstance(); - final ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); - - VfsUtilCore.visitChildrenRecursively(dir, new VirtualFileVisitor() { - @Override - public boolean visitFile(@NotNull VirtualFile dir) { - if (!dir.isDirectory() || fileTypeManager.isFileIgnored(dir)) { - // ignored files are handled by global 'ignored' pattern set - return false; - } - - final boolean isIncluded = moduleRootManager.getFileIndex().isInContent(dir); - if (isIncluded != parentIncluded) { - final String relativePath = VfsUtilCore.getRelativePath(dir, root, '/'); - if (isIncluded) { - generator.add(new Include(relativePath + "/**")); - } - else { - if (!isExcludedByDefault(dir.getName())) { - generator.add(new Exclude(relativePath + "/**")); - } - } - } - - return true; - } - }); - } - - private static boolean isExcludedByDefault(String name) { - //noinspection HardCodedStringLiteral - return "CVS".equals(name) || "SCCS".equals(name) || ".DS_Store".equals(name); - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleSources.java b/java/compiler/impl/src/com/intellij/compiler/ant/ModuleSources.java deleted file mode 100644 index ce4e086ae170..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/ModuleSources.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.openapi.module.Module; -import com.intellij.openapi.roots.ContentEntry; -import com.intellij.openapi.vfs.VirtualFile; - -import java.io.File; - -/** - * @author Eugene Zhuravlev - */ -public class ModuleSources extends CompositeGenerator{ - private final VirtualFile[] mySourceRoots = VirtualFile.EMPTY_ARRAY; - private final VirtualFile[] myTestSourceRoots = VirtualFile.EMPTY_ARRAY; - - public ModuleSources(Module module, File baseDir, final GenerationOptions genOptions) { - /* - final ModuleRootManager rootManager = ModuleRootManager.getInstance(module); - final ModuleFileIndex moduleFileIndex = rootManager.getFileIndex(); - - final List sourceRootFiles = new ArrayList(); - final List testSourceRootFiles = new ArrayList(); - - final Path sourcepath = new Path(BuildProperties.getSourcepathProperty(module.getName())); - final Path testSourcepath = new Path(BuildProperties.getTestSourcepathProperty(module.getName())); - final PatternSet excludedFromModule = new PatternSet(BuildProperties.getExcludedFromModuleProperty(module.getName())); - - final ContentEntry[] contentEntries = rootManager.getContentEntries(); - for (int idx = 0; idx < contentEntries.length; idx++) { - final ContentEntry contentEntry = contentEntries[idx]; - final VirtualFile file = contentEntry.getFile(); - if (file == null) { - continue; // filter invalid entries - } - if (!(file.getFileSystem() instanceof LocalFileSystem)) { - continue; // skip content roots inside jar and zip archives - } - final VirtualFile dirSetRoot = getDirSetRoot(contentEntry); - - final String dirSetRootRelativeToBasedir = GenerationUtils.toRelativePath(dirSetRoot, baseDir, BuildProperties.getModuleChunkBasedirProperty(module), genOptions, !module.isSavePathsRelative()); - final DirSet sourcesDirSet = new DirSet(dirSetRootRelativeToBasedir); - final DirSet testSourcesDirSet = new DirSet(dirSetRootRelativeToBasedir); - - final VirtualFile[] sourceRoots = contentEntry.getSourceFolderFiles(); - for (int i = 0; i < sourceRoots.length; i++) { - final VirtualFile root = sourceRoots[i]; - if (!moduleFileIndex.isInContent(root)) { - continue; // skip library sources - } - - addExcludePatterns(module, root, root, excludedFromModule, true); - - final Include include = new Include(VfsUtil.getRelativePath(root, dirSetRoot, '/')); - if (moduleFileIndex.isInTestSourceContent(root)) { - testSourcesDirSet.add(include); - testSourceRootFiles.add(root); - } - else { - sourcesDirSet.add(include); - sourceRootFiles.add(root); - } - } - if (sourcesDirSet.getGeneratorCount() > 0) { - sourcepath.add(sourcesDirSet); - } - if (testSourcesDirSet.getGeneratorCount() > 0) { - testSourcepath.add(testSourcesDirSet); - } - } - - mySourceRoots = sourceRootFiles.toArray(new VirtualFile[sourceRootFiles.size()]); - myTestSourceRoots = testSourceRootFiles.toArray(new VirtualFile[testSourceRootFiles.size()]); - - final String moduleName = module.getName(); - - add(excludedFromModule); - - final PatternSet excludedFromCompilation = new PatternSet(BuildProperties.getExcludedFromCompilationProperty(moduleName)); - excludedFromCompilation.add(new PatternSetRef(BuildProperties.getExcludedFromModuleProperty(moduleName))); - excludedFromCompilation.add(new PatternSetRef(BuildProperties.PROPERTY_COMPILER_EXCLUDES)); - add(excludedFromCompilation, 1); - - if (sourcepath.getGeneratorCount() > 0) { - add(sourcepath, 1); - } - if (testSourcepath.getGeneratorCount() != 0) { - add(testSourcepath, 1); - } - */ - } - - private VirtualFile getDirSetRoot(final ContentEntry contentEntry) { - final VirtualFile contentRoot = contentEntry.getFile(); - final VirtualFile[] sourceFolderFiles = contentEntry.getSourceFolderFiles(); - for (VirtualFile sourceFolderFile : sourceFolderFiles) { - if (contentRoot.equals(sourceFolderFile)) { - return contentRoot.getParent(); - } - } - return contentRoot; - } - - public VirtualFile[] getSourceRoots() { - return mySourceRoots; - } - - public VirtualFile[] getTestSourceRoots() { - return myTestSourceRoots; - } - -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/MultipleFileProjectBuild.java b/java/compiler/impl/src/com/intellij/compiler/ant/MultipleFileProjectBuild.java deleted file mode 100644 index 4187036ca517..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/MultipleFileProjectBuild.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.Import; -import com.intellij.openapi.project.Project; - -import java.io.File; - -/** - * @author Eugene Zhuravlev - */ -public class MultipleFileProjectBuild extends ProjectBuild{ - public MultipleFileProjectBuild(Project project, GenerationOptions genOptions) { - super(project, genOptions); - } - - @Override - protected Generator createModuleBuildGenerator(ModuleChunk chunk, GenerationOptions genOptions) { - //noinspection HardCodedStringLiteral - final String chunkBuildFile = BuildProperties.getModuleChunkBaseDir(chunk).getPath() + File.separator + BuildProperties.getModuleChunkBuildFileName(chunk) + ".xml"; - final File projectBaseDir = BuildProperties.getProjectBaseDir(myProject); - final String pathToFile = GenerationUtils.toRelativePath( - chunkBuildFile, projectBaseDir, BuildProperties.getProjectBaseDirProperty(), genOptions); - return new Import(pathToFile); - } - -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/ProjectBuild.java b/java/compiler/impl/src/com/intellij/compiler/ant/ProjectBuild.java deleted file mode 100644 index c00a133ac966..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/ProjectBuild.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.artifacts.ArtifactsGenerator; -import com.intellij.compiler.ant.taskdefs.AntProject; -import com.intellij.compiler.ant.taskdefs.Target; -import com.intellij.openapi.compiler.CompilerBundle; -import com.intellij.openapi.project.Project; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -/** - * @author Eugene Zhuravlev - */ -public abstract class ProjectBuild extends Generator { - protected final Project myProject; - private final AntProject myAntProject; - - public ProjectBuild(Project project, GenerationOptions genOptions) { - myProject = project; - myAntProject = new AntProject(BuildProperties.getProjectBuildFileName(myProject), BuildProperties.DEFAULT_TARGET); - - myAntProject.add(new BuildPropertiesImpl(myProject, genOptions), 1); - - // the sequence in which modules are imported is important cause output path properties for dependent modules should be defined first - - final StringBuilder buildModulesTargetNames = new StringBuilder(); - buildModulesTargetNames.append(BuildProperties.TARGET_INIT); - buildModulesTargetNames.append(", "); - buildModulesTargetNames.append(BuildProperties.TARGET_CLEAN); - final ModuleChunk[] chunks = genOptions.getModuleChunks(); - - if (chunks.length > 0) { - myAntProject.add(new Comment(CompilerBundle.message("generated.ant.build.modules.section.title")), 1); - - for (final ModuleChunk chunk : chunks) { - myAntProject.add(createModuleBuildGenerator(chunk, genOptions), 1); - final String[] targets = ChunkBuildExtension.getAllTargets(chunk); - for (String target : targets) { - if (buildModulesTargetNames.length() > 0) { - buildModulesTargetNames.append(", "); - } - buildModulesTargetNames.append(target); - } - } - } - for (ChunkBuildExtension extension : ChunkBuildExtension.EP_NAME.getExtensions()) { - extension.generateProjectTargets(project, genOptions, myAntProject); - } - - final Target initTarget = new Target(BuildProperties.TARGET_INIT, null, - CompilerBundle.message("generated.ant.build.initialization.section.title"), null); - initTarget.add(new Comment(CompilerBundle.message("generated.ant.build.initialization.section.comment"))); - myAntProject.add(initTarget, 1); - - ArtifactsGenerator artifactsGenerator = new ArtifactsGenerator(project, genOptions); - - myAntProject.add(new CleanProject(project, genOptions, artifactsGenerator), 1); - - myAntProject.add(new Target(BuildProperties.TARGET_BUILD_MODULES, buildModulesTargetNames.toString(), - CompilerBundle.message("generated.ant.build.build.all.modules.target.name"), null), 1); - - StringBuilder buildAllTargetNames = new StringBuilder(); - buildAllTargetNames.append(BuildProperties.TARGET_BUILD_MODULES); - if (artifactsGenerator.hasArtifacts()) { - List generators = artifactsGenerator.generate(); - for (Generator generator : generators) { - myAntProject.add(generator, 1); - } - - buildAllTargetNames.append(", ").append(ArtifactsGenerator.BUILD_ALL_ARTIFACTS_TARGET); - } - - myAntProject.add(new Target(BuildProperties.TARGET_ALL, buildAllTargetNames.toString(), - CompilerBundle.message("generated.ant.build.build.all.target.name"), null), 1); - } - - @Override - public void generate(PrintWriter out) throws IOException { - writeXmlHeader(out); - myAntProject.generate(out); - } - - protected abstract Generator createModuleBuildGenerator(final ModuleChunk chunk, GenerationOptions genOptions); - -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/PropertyFileGeneratorImpl.java b/java/compiler/impl/src/com/intellij/compiler/ant/PropertyFileGeneratorImpl.java deleted file mode 100644 index 04a86c589b3e..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/PropertyFileGeneratorImpl.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant; - -import com.intellij.openapi.application.PathMacros; -import com.intellij.openapi.application.PathManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.util.Couple; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.VfsUtilCore; -import com.intellij.util.ArrayUtilRt; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -/** - * Generator for property files. - * - * @author Eugene Zhuravlev - */ -public class PropertyFileGeneratorImpl extends PropertyFileGenerator { - /** - * List of the properties - */ - private final List> myProperties = new ArrayList<>(); - - /** - * A constructor that extracts all need properties for ant build from the project. - * - * @param project a project to examine - * @param genOptions generation options - */ - public PropertyFileGeneratorImpl(Project project, GenerationOptions genOptions) { - // path variables - final Map pathMacros = PathMacros.getInstance().getUserMacros(); - if (pathMacros.size() > 0) { - final String[] macroNames = ArrayUtilRt.toStringArray(pathMacros.keySet()); - Arrays.sort(macroNames); - for (final String macroName : macroNames) { - addProperty(BuildProperties.getPathMacroProperty(macroName), pathMacros.get(macroName)); - } - } - // jdk homes - if (genOptions.forceTargetJdk) { - final Sdk[] usedJdks = BuildProperties.getUsedJdks(project); - for (Sdk jdk : usedJdks) { - if (jdk.getHomeDirectory() == null) { - continue; - } - final File homeDir = BuildProperties.toCanonicalFile(VfsUtilCore.virtualToIoFile(jdk.getHomeDirectory())); - addProperty(BuildProperties.getJdkHomeProperty(jdk.getName()), homeDir.getPath().replace(File.separatorChar, '/')); - } - } - // generate idea.home property - if (genOptions.isIdeaHomeGenerated()) { - addProperty(BuildProperties.PROPERTY_IDEA_HOME, PathManager.getHomePath()); - } - - if (genOptions.enableFormCompiler) { - addProperty(BuildProperties.PROPERTY_INCLUDE_JAVA_RUNTIME_FOR_INSTRUMENTATION, genOptions.forceTargetJdk? "false" : "true"); - } - - ChunkBuildExtension.generateAllProperties(this, project, genOptions); - } - - @Override - public void addProperty(String name, String value) { - myProperties.add(Couple.of(name, value)); - } - - @Override - public void generate(PrintWriter out) throws IOException { - boolean isFirst = true; - for (final Couple pair : myProperties) { - if (!isFirst) { - crlf(out); - } - else { - isFirst = false; - } - out.print(StringUtil.escapeProperty(pair.getFirst(), true)); - out.print("="); - out.print(StringUtil.escapeProperty(pair.getSecond(), false)); - } - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/SingleFileProjectBuild.java b/java/compiler/impl/src/com/intellij/compiler/ant/SingleFileProjectBuild.java deleted file mode 100644 index dd87571937e7..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/SingleFileProjectBuild.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.Dirname; -import com.intellij.openapi.compiler.CompilerBundle; -import com.intellij.openapi.project.Project; - -/** - * @author Eugene Zhuravlev - */ -public class SingleFileProjectBuild extends ProjectBuild { - public SingleFileProjectBuild(Project project, GenerationOptions genOptions) { - super(project, genOptions); - } - - @Override - protected Generator createModuleBuildGenerator(ModuleChunk chunk, GenerationOptions genOptions) { - final CompositeGenerator gen = new CompositeGenerator(); - gen.add(new Comment(CompilerBundle.message("generated.ant.build.building.concrete.module.section.title", chunk.getName()))); - gen.add(new Dirname(BuildProperties.getModuleChunkBasedirProperty(chunk), BuildProperties.propertyRef("ant.file")), 1); - gen.add(new ChunkBuild(myProject, chunk, genOptions), 1); - return gen; - } - -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArchiveAntCopyInstructionCreator.java b/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArchiveAntCopyInstructionCreator.java deleted file mode 100644 index 7350cf2e218b..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArchiveAntCopyInstructionCreator.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant.artifacts; - -import com.intellij.compiler.ant.Generator; -import com.intellij.compiler.ant.Tag; -import com.intellij.compiler.ant.taskdefs.ZipFileSet; -import com.intellij.packaging.elements.AntCopyInstructionCreator; -import org.jetbrains.annotations.NotNull; - -/** - * @author nik - */ -public class ArchiveAntCopyInstructionCreator implements AntCopyInstructionCreator { - private final String myPrefix; - - public ArchiveAntCopyInstructionCreator(String prefix) { - myPrefix = prefix; - } - - @Override - @NotNull - public Tag createDirectoryContentCopyInstruction(@NotNull String dirPath) { - return new ZipFileSet(dirPath, myPrefix, true); - } - - @Override - @NotNull - public Tag createFileCopyInstruction(@NotNull String filePath, String outputFileName) { - final String relativePath = myPrefix + "/" + outputFileName; - return new ZipFileSet(filePath, relativePath, false); - } - - @Override - @NotNull - public AntCopyInstructionCreator subFolder(@NotNull String directoryName) { - return new ArchiveAntCopyInstructionCreator(myPrefix + "/" + directoryName); - } - - @Override - public Generator createSubFolderCommand(@NotNull String directoryName) { - return null; - } - - @NotNull - @Override - public Generator createExtractedDirectoryInstruction(@NotNull String jarPath) { - return ZipFileSet.createUnpackedSet(jarPath, myPrefix, true); - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArtifactAntGenerationContextImpl.java b/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArtifactAntGenerationContextImpl.java deleted file mode 100644 index 7f981874063c..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArtifactAntGenerationContextImpl.java +++ /dev/null @@ -1,160 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant.artifacts; - -import com.intellij.compiler.ant.BuildProperties; -import com.intellij.compiler.ant.GenerationOptions; -import com.intellij.compiler.ant.GenerationUtils; -import com.intellij.compiler.ant.Generator; -import com.intellij.compiler.ant.taskdefs.Mkdir; -import com.intellij.compiler.ant.taskdefs.Property; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.vfs.VfsUtilCore; -import com.intellij.packaging.artifacts.Artifact; -import com.intellij.packaging.elements.ArtifactAntGenerationContext; -import com.intellij.packaging.impl.artifacts.ArtifactUtil; -import gnu.trove.THashMap; -import gnu.trove.THashSet; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; - -import java.util.*; - -/** - * @author nik - */ -public class ArtifactAntGenerationContextImpl implements ArtifactAntGenerationContext { - @NonNls public static final String ARTIFACTS_TEMP_DIR_PROPERTY = "artifacts.temp.dir"; - private final Map myArtifact2Target = new THashMap<>(); - private final List myBeforeBuildGenerators = new ArrayList<>(); - private final List myAfterBuildGenerators = new ArrayList<>(); - private final Set myTempFileNames = new THashSet<>(); - private final Set myCreatedTempSubdirs = new THashSet<>(); - private final Set myProperties = new LinkedHashSet<>(); - private final Project myProject; - private final GenerationOptions myGenerationOptions; - private final List myBeforeCurrentArtifact = new ArrayList<>(); - private final Set myArtifactsToClean = new THashSet<>(); - - public ArtifactAntGenerationContextImpl(Project project, GenerationOptions generationOptions, List allArtifacts) { - myProject = project; - myGenerationOptions = generationOptions; - for (Artifact artifact : allArtifacts) { - if (ArtifactUtil.shouldClearArtifactOutputBeforeRebuild(artifact)) { - myArtifactsToClean.add(artifact); - } - } - } - - @Override - public Project getProject() { - return myProject; - } - - @Override - public GenerationOptions getGenerationOptions() { - return myGenerationOptions; - } - - @Override - public String getConfiguredArtifactOutputProperty(@NotNull Artifact artifact) { - return "artifact.output." + BuildProperties.convertName(artifact.getName()); - } - - @Override - public String getArtifactOutputProperty(@NotNull Artifact artifact) { - if (shouldBuildIntoTempDirectory(artifact)) { - return "artifact.temp.output." + BuildProperties.convertName(artifact.getName()); - } - return getConfiguredArtifactOutputProperty(artifact); - } - - public boolean shouldBuildIntoTempDirectory(@NotNull Artifact artifact) { - return !myArtifactsToClean.contains(artifact); - } - - public String getCleanTargetName(@NotNull Artifact artifact) { - return "clean.artifact." + BuildProperties.convertName(artifact.getName()); - } - - public String getTargetName(@NotNull Artifact artifact) { - String target = myArtifact2Target.get(artifact); - if (target == null) { - target = generateTargetName(artifact.getName()); - myArtifact2Target.put(artifact, target); - } - return target; - } - - private static String generateTargetName(String artifactName) { - return "artifact." + BuildProperties.convertName(artifactName); - } - - @Override - public String getSubstitutedPath(String path) { - return GenerationUtils.toRelativePath(path, VfsUtilCore.virtualToIoFile(myProject.getBaseDir()), BuildProperties.getProjectBaseDirProperty(), myGenerationOptions); - } - - @Override - public void runBeforeCurrentArtifact(Generator generator) { - myBeforeCurrentArtifact.add(generator); - } - - @Override - public void runBeforeBuild(Generator generator) { - myBeforeBuildGenerators.add(generator); - } - - @Override - public void runAfterBuild(Generator generator) { - myAfterBuildGenerators.add(generator); - } - - @Override - public String createNewTempFileProperty(String basePropertyName, String fileName) { - String tempFileName = fileName; - int i = 1; - String tempSubdir = null; - while (myTempFileNames.contains(tempFileName)) { - tempSubdir = String.valueOf(i++); - tempFileName = tempSubdir + "/" + fileName; - } - - String propertyName = basePropertyName; - i = 2; - while (myProperties.contains(propertyName)) { - propertyName = basePropertyName + i++; - } - - runBeforeBuild(new Property(propertyName, BuildProperties.propertyRelativePath(ARTIFACTS_TEMP_DIR_PROPERTY, tempFileName))); - if (tempSubdir != null && myCreatedTempSubdirs.add(tempSubdir)) { - runBeforeBuild(new Mkdir(BuildProperties.propertyRelativePath(ARTIFACTS_TEMP_DIR_PROPERTY, tempSubdir))); - } - myTempFileNames.add(tempFileName); - myProperties.add(propertyName); - return propertyName; - } - - public Generator[] getAndClearBeforeCurrentArtifact() { - final Generator[] generators = myBeforeCurrentArtifact.toArray(new Generator[0]); - myBeforeCurrentArtifact.clear(); - return generators; - } - - @Override - public String getModuleOutputPath(String moduleName) { - return BuildProperties.getOutputPathProperty(moduleName); - } - - @Override - public String getModuleTestOutputPath(@NonNls String moduleName) { - return BuildProperties.getOutputPathForTestsProperty(moduleName); - } - - public List getBeforeBuildGenerators() { - return myBeforeBuildGenerators; - } - - public List getAfterBuildGenerators() { - return myAfterBuildGenerators; - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArtifactsGenerator.java b/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArtifactsGenerator.java deleted file mode 100644 index bf98b4422d5a..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/ArtifactsGenerator.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant.artifacts; - -import com.intellij.compiler.ant.*; -import com.intellij.compiler.ant.taskdefs.*; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Couple; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.packaging.artifacts.Artifact; -import com.intellij.packaging.artifacts.ArtifactManager; -import com.intellij.packaging.artifacts.ArtifactType; -import com.intellij.packaging.elements.PackagingElementResolvingContext; -import com.intellij.packaging.impl.artifacts.ArtifactUtil; -import com.intellij.packaging.impl.elements.ArtifactPackagingElement; -import com.intellij.packaging.impl.elements.ModuleOutputPackagingElement; -import org.jetbrains.annotations.NonNls; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * @author nik - */ -public class ArtifactsGenerator { - @NonNls public static final String BUILD_ALL_ARTIFACTS_TARGET = "build.all.artifacts"; - @NonNls private static final String INIT_ARTIFACTS_TARGET = "init.artifacts"; - private final PackagingElementResolvingContext myResolvingContext; - private final ArtifactAntGenerationContextImpl myContext; - private final List myAllArtifacts; - - public ArtifactsGenerator(Project project, GenerationOptions genOptions) { - myResolvingContext = ArtifactManager.getInstance(project).getResolvingContext(); - - myAllArtifacts = new ArrayList<>(Arrays.asList(ArtifactManager.getInstance(project).getSortedArtifacts())); - - myContext = new ArtifactAntGenerationContextImpl(project, genOptions, myAllArtifacts); - } - - public boolean hasArtifacts() { - return !myAllArtifacts.isEmpty(); - } - - public List generate() { - final List generators = new ArrayList<>(); - - final Target initTarget = new Target(INIT_ARTIFACTS_TARGET, null, null, null); - generators.add(initTarget); - initTarget.add(new Property(ArtifactAntGenerationContextImpl.ARTIFACTS_TEMP_DIR_PROPERTY, BuildProperties.propertyRelativePath(BuildProperties.getProjectBaseDirProperty(), "__artifacts_temp"))); - - for (Artifact artifact : myAllArtifacts) { - if (!myContext.shouldBuildIntoTempDirectory(artifact)) { - generators.add(new CleanArtifactTarget(artifact, myContext)); - } - final String outputPath = artifact.getOutputPath(); - if (!StringUtil.isEmpty(outputPath)) { - initTarget.add(new Property(myContext.getConfiguredArtifactOutputProperty(artifact), myContext.getSubstitutedPath(outputPath))); - } - } - initTarget.add(new Mkdir(BuildProperties.propertyRef(ArtifactAntGenerationContextImpl.ARTIFACTS_TEMP_DIR_PROPERTY))); - - StringBuilder depends = new StringBuilder(); - for (Artifact artifact : myAllArtifacts) { - Target target = createArtifactTarget(artifact); - generators.add(target); - - if (!StringUtil.isEmpty(artifact.getOutputPath())) { - if (depends.length() > 0) depends.append(", "); - depends.append(myContext.getTargetName(artifact)); - } - } - - for (Generator generator : myContext.getBeforeBuildGenerators()) { - initTarget.add(generator); - } - - initArtifacts(myResolvingContext.getProject(), initTarget); - - Target buildAllArtifacts = new Target(BUILD_ALL_ARTIFACTS_TARGET, depends.toString(), "Build all artifacts", null); - for (Artifact artifact : myAllArtifacts) { - final String artifactOutputPath = artifact.getOutputPath(); - if (!StringUtil.isEmpty(artifactOutputPath) && myContext.shouldBuildIntoTempDirectory(artifact)) { - final String outputPath = BuildProperties.propertyRef(myContext.getConfiguredArtifactOutputProperty(artifact)); - buildAllArtifacts.add(new Mkdir(outputPath)); - final Copy copy = new Copy(outputPath); - copy.add(new FileSet(BuildProperties.propertyRef(myContext.getArtifactOutputProperty(artifact)))); - buildAllArtifacts.add(copy); - } - } - - buildAllArtifacts.add(new Comment("Delete temporary files"), 1); - for (Generator generator : myContext.getAfterBuildGenerators()) { - buildAllArtifacts.add(generator); - } - buildAllArtifacts.add(new Delete(BuildProperties.propertyRef(ArtifactAntGenerationContextImpl.ARTIFACTS_TEMP_DIR_PROPERTY))); - - generators.add(buildAllArtifacts); - return generators; - } - - private Target createArtifactTarget(Artifact artifact) { - final StringBuilder depends = new StringBuilder(INIT_ARTIFACTS_TARGET); - - ArtifactUtil.processRecursivelySkippingIncludedArtifacts(artifact, packagingElement -> { - if (packagingElement instanceof ArtifactPackagingElement) { - final Artifact included = ((ArtifactPackagingElement)packagingElement).findArtifact(myResolvingContext); - if (included != null) { - if (depends.length() > 0) depends.append(", "); - depends.append(myContext.getTargetName(included)); - } - } - else if (packagingElement instanceof ModuleOutputPackagingElement) { - final Module module = ((ModuleOutputPackagingElement)packagingElement).findModule(myResolvingContext); - if (module != null) { - if (depends.length() > 0) depends.append(", "); - depends.append(BuildProperties.getCompileTargetName(module.getName())); - } - } - return true; - }, myResolvingContext); - - final Couple xmlNs = getArtifactXmlNs(artifact.getArtifactType()); - final Target artifactTarget = - new Target(myContext.getTargetName(artifact), depends.toString(), "Build '" + artifact.getName() + "' artifact", null, - Pair.getFirst(xmlNs), Pair.getSecond(xmlNs)); - - if (myContext.shouldBuildIntoTempDirectory(artifact)) { - final String outputDirectory = BuildProperties.propertyRelativePath(ArtifactAntGenerationContextImpl.ARTIFACTS_TEMP_DIR_PROPERTY, - FileUtil.sanitizeFileName(artifact.getName())); - artifactTarget.add(new Property(myContext.getArtifactOutputProperty(artifact), outputDirectory)); - } - - final String outputPath = BuildProperties.propertyRef(myContext.getArtifactOutputProperty(artifact)); - artifactTarget.add(new Mkdir(outputPath)); - generateTasksForArtifacts(artifact, artifactTarget, true); - - final DirectoryAntCopyInstructionCreator creator = new DirectoryAntCopyInstructionCreator(outputPath); - - List copyInstructions = new ArrayList<>(); - if (needAntArtifactInstructions(artifact.getArtifactType())) { - copyInstructions.addAll(artifact.getRootElement().computeAntInstructions(myResolvingContext, creator, myContext, artifact.getArtifactType())); - } - - for (Generator generator : myContext.getAndClearBeforeCurrentArtifact()) { - artifactTarget.add(generator); - } - for (Generator tag : copyInstructions) { - artifactTarget.add(tag); - } - generateTasksForArtifacts(artifact, artifactTarget, false); - return artifactTarget; - } - - private void generateTasksForArtifacts(Artifact artifact, Target artifactTarget, final boolean preprocessing) { - for (ChunkBuildExtension extension : ChunkBuildExtension.EP_NAME.getExtensions()) { - extension.generateTasksForArtifact(artifact, preprocessing, myContext, artifactTarget); - } - } - - private void initArtifacts(Project project, CompositeGenerator generator) { - for (ChunkBuildExtension extension : ChunkBuildExtension.EP_NAME.getExtensions()) { - extension.initArtifacts(project, myContext.getGenerationOptions(), generator); - } - } - - private static Couple getArtifactXmlNs(ArtifactType artifactType) { - for (ChunkBuildExtension extension : ChunkBuildExtension.EP_NAME.getExtensions()) { - final Couple xmlNs = extension.getArtifactXmlNs(artifactType); - if (xmlNs != null) return xmlNs; - } - return null; - } - - private static boolean needAntArtifactInstructions(ArtifactType artifactType) { - for (ChunkBuildExtension extension : ChunkBuildExtension.EP_NAME.getExtensions()) { - if (!extension.needAntArtifactInstructions(artifactType)) return false; - } - return true; - } - - public List getCleanTargetNames() { - final List targets = new ArrayList<>(); - for (Artifact artifact : myAllArtifacts) { - if (!myContext.shouldBuildIntoTempDirectory(artifact)) { - targets.add(myContext.getCleanTargetName(artifact)); - } - } - return targets; - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/CleanArtifactTarget.java b/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/CleanArtifactTarget.java deleted file mode 100644 index 8a205af6a5d1..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/CleanArtifactTarget.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant.artifacts; - -import com.intellij.compiler.ant.taskdefs.Target; -import com.intellij.compiler.ant.taskdefs.Delete; -import com.intellij.compiler.ant.BuildProperties; -import com.intellij.packaging.artifacts.Artifact; - -/** - * @author nik - */ -public class CleanArtifactTarget extends Target { - public CleanArtifactTarget(Artifact artifact, ArtifactAntGenerationContextImpl context) { - super(context.getCleanTargetName(artifact), null, "clean " + artifact.getName() + " artifact output", null); - add(new Delete(BuildProperties.propertyRef(context.getConfiguredArtifactOutputProperty(artifact)))); - } -} diff --git a/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/DirectoryAntCopyInstructionCreator.java b/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/DirectoryAntCopyInstructionCreator.java deleted file mode 100644 index 1b3d64f8151e..000000000000 --- a/java/compiler/impl/src/com/intellij/compiler/ant/artifacts/DirectoryAntCopyInstructionCreator.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant.artifacts; - -import com.intellij.compiler.ant.Generator; -import com.intellij.compiler.ant.Tag; -import com.intellij.compiler.ant.taskdefs.Copy; -import com.intellij.compiler.ant.taskdefs.FileSet; -import com.intellij.compiler.ant.taskdefs.Mkdir; -import com.intellij.compiler.ant.taskdefs.Unzip; -import com.intellij.packaging.elements.AntCopyInstructionCreator; -import org.jetbrains.annotations.NotNull; - -/** - * @author nik - */ -public class DirectoryAntCopyInstructionCreator implements AntCopyInstructionCreator { - private final String myOutputDirectory; - - public DirectoryAntCopyInstructionCreator(String outputDirectory) { - myOutputDirectory = outputDirectory; - } - - public String getOutputDirectory() { - return myOutputDirectory; - } - - @Override - @NotNull - public Tag createDirectoryContentCopyInstruction(@NotNull String dirPath) { - final Copy copy = new Copy(myOutputDirectory); - copy.add(new FileSet(dirPath)); - return copy; - } - - @Override - @NotNull - public Tag createFileCopyInstruction(@NotNull String filePath, String outputFileName) { - return new Copy(filePath, myOutputDirectory + "/" + outputFileName); - } - - @Override - @NotNull - public AntCopyInstructionCreator subFolder(@NotNull String directoryName) { - return new DirectoryAntCopyInstructionCreator(myOutputDirectory + "/" + directoryName); - } - - @Override - public Generator createSubFolderCommand(@NotNull String directoryName) { - return new Mkdir(myOutputDirectory + "/" + directoryName); - } - - @NotNull - @Override - public Generator createExtractedDirectoryInstruction(@NotNull String jarPath) { - return new Unzip(jarPath, myOutputDirectory); - } -} diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArchivePackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArchivePackagingElement.java index 2289cf8c6721..a9b2041a9a2e 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArchivePackagingElement.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArchivePackagingElement.java @@ -1,17 +1,7 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements; -import com.intellij.compiler.ant.BuildProperties; -import com.intellij.compiler.ant.Generator; -import com.intellij.compiler.ant.Tag; -import com.intellij.compiler.ant.artifacts.ArchiveAntCopyInstructionCreator; -import com.intellij.compiler.ant.taskdefs.Jar; -import com.intellij.compiler.ant.taskdefs.Zip; -import com.intellij.packaging.artifacts.ArtifactType; -import com.intellij.packaging.elements.AntCopyInstructionCreator; -import com.intellij.packaging.elements.ArtifactAntGenerationContext; import com.intellij.packaging.elements.PackagingElement; -import com.intellij.packaging.elements.PackagingElementResolvingContext; import com.intellij.packaging.impl.ui.ArchiveElementPresentation; import com.intellij.packaging.ui.ArtifactEditorContext; import com.intellij.packaging.ui.PackagingElementPresentation; @@ -20,9 +10,6 @@ import com.intellij.util.xmlb.annotations.Attribute; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; -import java.util.Collections; -import java.util.List; - /** * @author nik */ @@ -45,27 +32,6 @@ public class ArchivePackagingElement extends CompositeElementWithManifest computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, @NotNull AntCopyInstructionCreator creator, - @NotNull ArtifactAntGenerationContext generationContext, - @NotNull ArtifactType artifactType) { - final String tempJarProperty = generationContext.createNewTempFileProperty("temp.jar.path." + myArchiveFileName, myArchiveFileName); - String jarPath = BuildProperties.propertyRef(tempJarProperty); - final Tag jar; - if (myArchiveFileName.endsWith(".jar")) { - jar = new Jar(jarPath, "preserve", true); - } - else { - jar = new Zip(jarPath); - } - for (Generator generator : computeChildrenGenerators(resolvingContext, new ArchiveAntCopyInstructionCreator(""), generationContext, artifactType)) { - jar.add(generator); - } - generationContext.runBeforeCurrentArtifact(jar); - return Collections.singletonList(creator.createFileCopyInstruction(jarPath, myArchiveFileName)); - } - @Attribute(NAME_ATTRIBUTE) public String getArchiveFileName() { return myArchiveFileName; diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactPackagingElement.java index e850c93a1729..15e5798e8479 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactPackagingElement.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactPackagingElement.java @@ -1,8 +1,6 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements; -import com.intellij.compiler.ant.BuildProperties; -import com.intellij.compiler.ant.Generator; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.packaging.artifacts.Artifact; @@ -20,7 +18,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; -import java.util.Collections; import java.util.List; /** @@ -65,22 +62,6 @@ public class ArtifactPackagingElement extends ComplexPackagingElement computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, @NotNull AntCopyInstructionCreator creator, - @NotNull ArtifactAntGenerationContext generationContext, - @NotNull ArtifactType artifactType) { - final Artifact artifact = findArtifact(resolvingContext); - if (artifact != null) { - if (artifact.getArtifactType().getSubstitution(artifact, resolvingContext, artifactType) != null) { - return super.computeAntInstructions(resolvingContext, creator, generationContext, artifactType); - } - final String outputPath = BuildProperties.propertyRef(generationContext.getArtifactOutputProperty(artifact)); - return Collections.singletonList(creator.createDirectoryContentCopyInstruction(outputPath)); - } - return Collections.emptyList(); - } - @Override @NotNull public PackagingElementPresentation createPresentation(@NotNull ArtifactEditorContext context) { diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactRootElementImpl.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactRootElementImpl.java index caa857d02c01..3e481bde248e 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactRootElementImpl.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ArtifactRootElementImpl.java @@ -1,22 +1,15 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements; -import com.intellij.compiler.ant.Generator; import com.intellij.icons.AllIcons; import com.intellij.ide.projectView.PresentationData; import com.intellij.openapi.compiler.CompilerBundle; -import com.intellij.packaging.artifacts.ArtifactType; -import com.intellij.packaging.elements.AntCopyInstructionCreator; -import com.intellij.packaging.elements.ArtifactAntGenerationContext; import com.intellij.packaging.elements.ArtifactRootElement; -import com.intellij.packaging.elements.PackagingElementResolvingContext; import com.intellij.packaging.ui.ArtifactEditorContext; import com.intellij.packaging.ui.PackagingElementPresentation; import com.intellij.ui.SimpleTextAttributes; import org.jetbrains.annotations.NotNull; -import java.util.List; - /** * @author nik */ @@ -66,14 +59,6 @@ public class ArtifactRootElementImpl extends ArtifactRootElement { public void rename(@NotNull String newName) { } - @Override - @NotNull - public List computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, @NotNull AntCopyInstructionCreator creator, - @NotNull ArtifactAntGenerationContext generationContext, - @NotNull ArtifactType artifactType) { - return computeChildrenGenerators(resolvingContext, creator, generationContext, artifactType); - } - @Override public String getName() { return ""; diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyPackagingElement.java index f5070fd2bea5..e58413c6ab87 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyPackagingElement.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryCopyPackagingElement.java @@ -1,19 +1,11 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements; -import com.intellij.compiler.ant.Generator; -import com.intellij.packaging.artifacts.ArtifactType; -import com.intellij.packaging.elements.AntCopyInstructionCreator; -import com.intellij.packaging.elements.ArtifactAntGenerationContext; -import com.intellij.packaging.elements.PackagingElementResolvingContext; import com.intellij.packaging.impl.ui.DirectoryCopyPresentation; import com.intellij.packaging.ui.ArtifactEditorContext; import com.intellij.packaging.ui.PackagingElementPresentation; import org.jetbrains.annotations.NotNull; -import java.util.Collections; -import java.util.List; - /** * @author nik */ @@ -33,16 +25,6 @@ public class DirectoryCopyPackagingElement extends FileOrDirectoryCopyPackagingE return new DirectoryCopyPresentation(myFilePath); } - @NotNull - @Override - public List computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, - @NotNull AntCopyInstructionCreator creator, - @NotNull ArtifactAntGenerationContext generationContext, - @NotNull ArtifactType artifactType) { - final String path = generationContext.getSubstitutedPath(myFilePath); - return Collections.singletonList(creator.createDirectoryContentCopyInstruction(path)); - } - @Override public DirectoryCopyPackagingElement getState() { return this; diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryPackagingElement.java index 57e1d070d680..555f321dfae3 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryPackagingElement.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/DirectoryPackagingElement.java @@ -1,12 +1,7 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements; -import com.intellij.compiler.ant.Generator; -import com.intellij.packaging.artifacts.ArtifactType; -import com.intellij.packaging.elements.AntCopyInstructionCreator; -import com.intellij.packaging.elements.ArtifactAntGenerationContext; import com.intellij.packaging.elements.PackagingElement; -import com.intellij.packaging.elements.PackagingElementResolvingContext; import com.intellij.packaging.impl.ui.DirectoryElementPresentation; import com.intellij.packaging.ui.ArtifactEditorContext; import com.intellij.packaging.ui.PackagingElementPresentation; @@ -15,9 +10,6 @@ import com.intellij.util.xmlb.annotations.Attribute; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; -import java.util.ArrayList; -import java.util.List; - /** * @author nik * @@ -42,21 +34,6 @@ public class DirectoryPackagingElement extends CompositeElementWithManifest computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, @NotNull AntCopyInstructionCreator creator, - @NotNull ArtifactAntGenerationContext generationContext, - @NotNull ArtifactType artifactType) { - - final List children = new ArrayList<>(); - final Generator command = creator.createSubFolderCommand(myDirectoryName); - if (command != null) { - children.add(command); - } - children.addAll(computeChildrenGenerators(resolvingContext, creator.subFolder(myDirectoryName), generationContext, artifactType)); - return children; - } - @Override public DirectoryPackagingElement getState() { return this; diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryPackagingElement.java index c28722af0b64..84cbc10c0a69 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryPackagingElement.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ExtractedDirectoryPackagingElement.java @@ -1,31 +1,17 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements; -import com.intellij.compiler.ant.BuildProperties; -import com.intellij.compiler.ant.Generator; -import com.intellij.compiler.ant.taskdefs.Include; -import com.intellij.compiler.ant.taskdefs.Mkdir; -import com.intellij.compiler.ant.taskdefs.PatternSet; -import com.intellij.compiler.ant.taskdefs.Unzip; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.packaging.artifacts.ArtifactType; -import com.intellij.packaging.elements.AntCopyInstructionCreator; -import com.intellij.packaging.elements.ArtifactAntGenerationContext; import com.intellij.packaging.elements.PackagingElement; -import com.intellij.packaging.elements.PackagingElementResolvingContext; import com.intellij.packaging.impl.ui.ExtractedDirectoryPresentation; import com.intellij.packaging.ui.ArtifactEditorContext; import com.intellij.packaging.ui.PackagingElementPresentation; -import com.intellij.util.PathUtil; import com.intellij.util.xmlb.annotations.Attribute; import org.jetbrains.annotations.NotNull; -import java.util.Collections; -import java.util.List; - /** * @author nik */ @@ -68,33 +54,6 @@ public class ExtractedDirectoryPackagingElement extends FileOrDirectoryCopyPacka return jarRoot != null ? jarRoot.findFileByRelativePath(myPathInJar) : null; } - @NotNull - @Override - public List computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, - @NotNull AntCopyInstructionCreator creator, - @NotNull ArtifactAntGenerationContext generationContext, - @NotNull ArtifactType artifactType) { - final String jarPath = generationContext.getSubstitutedPath(myFilePath); - final String pathInJar = StringUtil.trimStart(myPathInJar, "/"); - if (pathInJar.length() == 0) { - return Collections.singletonList(creator.createExtractedDirectoryInstruction(jarPath)); - } - - final String archiveName = PathUtil.getFileName(myFilePath); - final String tempDirProperty = generationContext.createNewTempFileProperty("temp.unpacked.path." + archiveName, archiveName); - final String tempDirPath = BuildProperties.propertyRef(tempDirProperty); - generationContext.runBeforeCurrentArtifact(new Mkdir(tempDirPath)); - - final Unzip unzip = new Unzip(jarPath, tempDirPath); - final PatternSet patterns = new PatternSet(null); - patterns.add(new Include(pathInJar + "**")); - unzip.add(patterns); - generationContext.runBeforeCurrentArtifact(unzip); - - return Collections.singletonList(creator.createDirectoryContentCopyInstruction(tempDirPath + "/" + pathInJar)); - } - - @Override public boolean isEqualTo(@NotNull PackagingElement element) { return element instanceof ExtractedDirectoryPackagingElement && super.isEqualTo(element) diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyPackagingElement.java index 5254556c9266..d6d1e90ceaef 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyPackagingElement.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/FileCopyPackagingElement.java @@ -1,14 +1,13 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements; -import com.intellij.compiler.ant.Generator; import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileManager; -import com.intellij.packaging.artifacts.ArtifactType; -import com.intellij.packaging.elements.*; +import com.intellij.packaging.elements.PackagingElement; +import com.intellij.packaging.elements.RenameablePackagingElement; import com.intellij.packaging.impl.ui.FileCopyPresentation; import com.intellij.packaging.ui.ArtifactEditorContext; import com.intellij.packaging.ui.PackagingElementPresentation; @@ -19,8 +18,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; -import java.util.Collections; -import java.util.List; /** * @author nik @@ -49,18 +46,6 @@ public class FileCopyPackagingElement extends FileOrDirectoryCopyPackagingElemen return new FileCopyPresentation(myFilePath, getOutputFileName()); } - @NotNull - @Override - public List computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, @NotNull AntCopyInstructionCreator creator, - @NotNull ArtifactAntGenerationContext generationContext, - @NotNull ArtifactType artifactType) { - if (isDirectory()) { - return Collections.emptyList(); - } - final String path = generationContext.getSubstitutedPath(myFilePath); - return Collections.singletonList((Generator)creator.createFileCopyInstruction(path, getOutputFileName())); - } - public String getOutputFileName() { return myRenamedOutputFileName != null ? myRenamedOutputFileName : PathUtil.getFileName(myFilePath); } diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ModuleOutputPackagingElementBase.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ModuleOutputPackagingElementBase.java index ed5e9cdb0ea5..0d935dccdd84 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ModuleOutputPackagingElementBase.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ModuleOutputPackagingElementBase.java @@ -1,17 +1,12 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements; -import com.intellij.compiler.ant.BuildProperties; -import com.intellij.compiler.ant.Generator; import com.intellij.openapi.module.ModulePointer; import com.intellij.openapi.project.Project; -import com.intellij.packaging.artifacts.ArtifactType; -import com.intellij.packaging.elements.*; +import com.intellij.packaging.elements.PackagingElementOutputKind; +import com.intellij.packaging.elements.PackagingElementResolvingContext; +import com.intellij.packaging.elements.PackagingElementType; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.Collections; -import java.util.List; public abstract class ModuleOutputPackagingElementBase extends ModulePackagingElementBase implements ModuleOutputPackagingElement { public ModuleOutputPackagingElementBase(PackagingElementType type, @@ -20,23 +15,6 @@ public abstract class ModuleOutputPackagingElementBase extends ModulePackagingEl super(type, project, modulePointer); } - @Nullable - protected abstract String getDirectoryAntProperty(ArtifactAntGenerationContext generationContext); - - @NotNull - @Override - public List computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, - @NotNull AntCopyInstructionCreator creator, - @NotNull ArtifactAntGenerationContext generationContext, - @NotNull ArtifactType artifactType) { - String property = getDirectoryAntProperty(generationContext); - if (myModulePointer != null && property != null) { - final String moduleOutput = BuildProperties.propertyRef(property); - return Collections.singletonList(creator.createDirectoryContentCopyInstruction(moduleOutput)); - } - return Collections.emptyList(); - } - @NotNull @Override public PackagingElementOutputKind getFilesKind(PackagingElementResolvingContext context) { diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ProductionModuleOutputPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ProductionModuleOutputPackagingElement.java index f8acd1511826..b46fef15a6db 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ProductionModuleOutputPackagingElement.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ProductionModuleOutputPackagingElement.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements; import com.intellij.openapi.module.Module; @@ -20,7 +6,6 @@ import com.intellij.openapi.module.ModulePointer; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ModuleRootModel; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.packaging.elements.ArtifactAntGenerationContext; import com.intellij.packaging.elements.PackagingElementResolvingContext; import com.intellij.packaging.impl.ui.DelegatedPackagingElementPresentation; import com.intellij.packaging.impl.ui.ModuleElementPresentation; @@ -50,11 +35,6 @@ public class ProductionModuleOutputPackagingElement extends ModuleOutputPackagin return "module:" + getModuleName(); } - @Override - protected String getDirectoryAntProperty(ArtifactAntGenerationContext generationContext) { - return generationContext.getModuleOutputPath(myModulePointer.getModuleName()); - } - @NotNull @Override public Collection getSourceRoots(PackagingElementResolvingContext context) { diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ProductionModuleSourcePackagingElement.kt b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ProductionModuleSourcePackagingElement.kt index 5036415232d3..adf92f20755e 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/ProductionModuleSourcePackagingElement.kt +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/ProductionModuleSourcePackagingElement.kt @@ -1,13 +1,9 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements -import com.intellij.compiler.ant.Generator import com.intellij.openapi.module.ModulePointer import com.intellij.openapi.project.Project import com.intellij.openapi.vfs.VirtualFile -import com.intellij.packaging.artifacts.ArtifactType -import com.intellij.packaging.elements.AntCopyInstructionCreator -import com.intellij.packaging.elements.ArtifactAntGenerationContext import com.intellij.packaging.elements.PackagingElementOutputKind import com.intellij.packaging.elements.PackagingElementResolvingContext import com.intellij.packaging.impl.ui.DelegatedPackagingElementPresentation @@ -35,15 +31,6 @@ class ProductionModuleSourcePackagingElement : ModulePackagingElementBase { ModuleElementPresentation(myModulePointer, context, ProductionModuleSourceElementType.ELEMENT_TYPE)) } - override fun computeAntInstructions(resolvingContext: PackagingElementResolvingContext, - creator: AntCopyInstructionCreator, - generationContext: ArtifactAntGenerationContext, - artifactType: ArtifactType): List { - return getSourceRoots(resolvingContext).map { - creator.createDirectoryContentCopyInstruction(it.path) - } - } - override fun getFilesKind(context: PackagingElementResolvingContext) = PackagingElementOutputKind.OTHER @NonNls diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/elements/TestModuleOutputPackagingElement.java b/java/compiler/impl/src/com/intellij/packaging/impl/elements/TestModuleOutputPackagingElement.java index 12fc343397f4..4ae0027af584 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/elements/TestModuleOutputPackagingElement.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/elements/TestModuleOutputPackagingElement.java @@ -1,25 +1,10 @@ -/* - * Copyright 2000-2011 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.impl.elements; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModulePointer; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.packaging.elements.ArtifactAntGenerationContext; import com.intellij.packaging.elements.PackagingElementResolvingContext; import com.intellij.packaging.impl.ui.DelegatedPackagingElementPresentation; import com.intellij.packaging.impl.ui.ModuleElementPresentation; @@ -48,11 +33,6 @@ public class TestModuleOutputPackagingElement extends ModuleOutputPackagingEleme return "module-tests:" + getModuleName(); } - @Override - protected String getDirectoryAntProperty(ArtifactAntGenerationContext generationContext) { - return generationContext.getModuleTestOutputPath(myModulePointer.getModuleName()); - } - @NotNull @Override public Collection getSourceRoots(PackagingElementResolvingContext context) { diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/BuildProperties.java b/java/compiler/openapi/src/com/intellij/compiler/ant/BuildProperties.java deleted file mode 100644 index 2661d18f5552..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/BuildProperties.java +++ /dev/null @@ -1,254 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - -package com.intellij.compiler.ant; - -import com.intellij.openapi.module.Module; -import com.intellij.openapi.module.ModuleManager; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.VfsUtilCore; -import com.intellij.openapi.vfs.VirtualFile; -import org.jetbrains.annotations.NonNls; - -import java.io.File; -import java.io.IOException; -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 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"; - 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 PROPERTY_INCLUDE_JAVA_RUNTIME_FOR_INSTRUMENTATION = "javac2.instrumentation.includeJavaRuntime"; - - 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[0]); - } - - @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 VfsUtilCore.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) { - return StringUtil.toLowerCase(name.replaceAll("\"", "").replaceAll("\\s+", "_")); - } - - @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); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/BuildTargetsFactory.java b/java/compiler/openapi/src/com/intellij/compiler/ant/BuildTargetsFactory.java deleted file mode 100644 index 6bc2de8a0a31..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/BuildTargetsFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant; - -import com.intellij.openapi.components.ServiceManager; -import com.intellij.openapi.project.Project; - -public abstract class BuildTargetsFactory { - public static BuildTargetsFactory getInstance() { - return ServiceManager.getService(BuildTargetsFactory.class); - } - - public abstract Generator createComment(String comment); - - //for test - public abstract GenerationOptions getDefaultOptions(Project project); -} \ No newline at end of file diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/ChunkBuildExtension.java b/java/compiler/openapi/src/com/intellij/compiler/ant/ChunkBuildExtension.java deleted file mode 100644 index 546f96e84c99..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/ChunkBuildExtension.java +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - -package com.intellij.compiler.ant; - -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Couple; -import com.intellij.packaging.artifacts.Artifact; -import com.intellij.packaging.artifacts.ArtifactType; -import com.intellij.packaging.elements.ArtifactAntGenerationContext; -import com.intellij.util.ArrayUtilRt; -import com.intellij.util.containers.ContainerUtil; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -public abstract class ChunkBuildExtension { - public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.antBuildGen"); - - @NotNull - @NonNls - public abstract String[] getTargets(final ModuleChunk chunk); - - public abstract void process(Project project, ModuleChunk chunk, GenerationOptions genOptions, CompositeGenerator generator); - - public void generateProjectTargets(Project project, GenerationOptions genOptions, CompositeGenerator generator) { - } - - public void generateProperties(final PropertyFileGenerator generator, final Project project, final GenerationOptions options) { - } - - public void generateTasksForArtifact(Artifact artifact, boolean preprocessing, ArtifactAntGenerationContext context, - CompositeGenerator generator) { - } - - @Nullable - public Couple getArtifactXmlNs(ArtifactType artifactType) { - return null; - } - - public boolean needAntArtifactInstructions(ArtifactType type) { - return true; - } - - public void initArtifacts(Project project, GenerationOptions genOptions, CompositeGenerator generator) {} - - public List getCleanTargetNames(Project project, GenerationOptions genOptions) { - return Collections.emptyList(); - } - - public static String[] getAllTargets(ModuleChunk chunk) { - List allTargets = new ArrayList<>(); - final ChunkBuildExtension[] extensions = EP_NAME.getExtensions(); - for (ChunkBuildExtension extension : extensions) { - ContainerUtil.addAll(allTargets, extension.getTargets(chunk)); - } - if (allTargets.isEmpty()) { - allTargets.add(BuildProperties.getCompileTargetName(chunk.getName())); - } - return ArrayUtilRt.toStringArray(allTargets); - } - - public static void process(CompositeGenerator generator, ModuleChunk chunk, GenerationOptions genOptions) { - final Project project = chunk.getProject(); - final ChunkBuildExtension[] extensions = EP_NAME.getExtensions(); - for (ChunkBuildExtension extension : extensions) { - extension.process(project, chunk, genOptions, generator); - } - } - - public static void generateAllProperties(final PropertyFileGenerator propertyFileGenerator, - final Project project, - final GenerationOptions genOptions) { - ChunkBuildExtension[] extensions = EP_NAME.getExtensions(); - for (ChunkBuildExtension extension : extensions) { - extension.generateProperties(propertyFileGenerator, project, genOptions); - } - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/ChunkCustomCompilerExtension.java b/java/compiler/openapi/src/com/intellij/compiler/ant/ChunkCustomCompilerExtension.java deleted file mode 100644 index f2ffa1492508..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/ChunkCustomCompilerExtension.java +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant; - -import com.intellij.compiler.ant.taskdefs.PatternSetRef; -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.project.Project; - -import java.util.Arrays; -import java.util.Comparator; - -/** - * The extension point for the custom compilers - */ -public abstract class ChunkCustomCompilerExtension { - /** - * Extension point name - */ - public static final ExtensionPointName EP_NAME = - ExtensionPointName.create("com.intellij.antCustomCompiler"); - /** - * Comparator that compares extensions using names. It is used for make order of elements predictable. - */ - protected static final Comparator COMPARATOR = - Comparator.comparing(o -> o.getClass().getName()); - - /** - * Generate custom compile task inside compile target. Note that if more - * than one extension requested custom compilation, all of them are included into ant - * build and fail task is added to the compile target. - * - * @param project the context project - * @param chunk the chunk to compile - * @param genOptions an options to compile - * @param generator a generator where custom compilation tasks will be added. - * @param compileTests if true, tests are compiled - * @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 - */ - @SuppressWarnings({"UnusedDeclaration"}) - public abstract void generateCustomCompile(Project project, - ModuleChunk chunk, - GenerationOptions genOptions, - boolean compileTests, - CompositeGenerator generator, - Tag compilerArgs, - Tag bootclasspathTag, - Tag classpathTag, - PatternSetRef compilerExcludes, - Tag srcTag, - String outputPathRef); - - /** - * Generate task registration for custom compiler if needed. - * - * @param project the context project - * @param genOptions an options to compile - * @param generator a generator where custom compilation tasks will be added. - */ - @SuppressWarnings({"UnusedDeclaration"}) - public abstract void generateCustomCompilerTaskRegistration(Project project, GenerationOptions genOptions, CompositeGenerator generator); - - /** - * Allows to check if the custom compilation task is required to compile module sources. - * Such task should be able to process standard java sources as well. - * - * @param chunk a chunk to check - * @return true if the facet requires custom comiplation. - */ - @SuppressWarnings({"UnusedDeclaration"}) - public abstract boolean hasCustomCompile(final ModuleChunk chunk); - - /** - * Get custom compilation providers for module chunk - * - * @param chunk a chunk to examine - * @return a list of custom compilators - */ - public static ChunkCustomCompilerExtension[] getCustomCompile(ModuleChunk chunk) { - final ChunkCustomCompilerExtension[] extensions = EP_NAME.getExtensions(); - return Arrays.stream(extensions) - .filter(extension -> extension.hasCustomCompile(chunk)) - .sorted(COMPARATOR).toArray(ChunkCustomCompilerExtension[]::new); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/CompositeGenerator.java b/java/compiler/openapi/src/com/intellij/compiler/ant/CompositeGenerator.java deleted file mode 100644 index 9631295db6f7..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/CompositeGenerator.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant; - -import com.intellij.openapi.util.Pair; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; - -/** - * A composite generator - * - * @author Eugene Zhuravlev - */ -public class CompositeGenerator extends Generator { - /** - * child generators - */ - private final List> myGenerators = new ArrayList<>(); - /** - * New line property - */ - private boolean hasLeadingNewline = true; - - /** - * A constructor - */ - public CompositeGenerator() { - } - - /** - * A constructor that adds two elements - * - * @param generator1 the first generator - * @param generator2 the second generator - * @param emptyLinesCount the amount of new lines between two generators - */ - public CompositeGenerator(Generator generator1, Generator generator2, int emptyLinesCount) { - add(generator1); - add(generator2, emptyLinesCount); - } - - /** - * By default, the composite generator generates an empty newline before generating nested eleemnts. - * Setting the property to the false, allows suppressing it. - * - * @param value the new value of the property - */ - public void setHasLeadingNewline(boolean value) { - hasLeadingNewline = value; - } - - /** - * Add child generator with no emtpy lines before it - * - * @param generator the generator to add - */ - public final void add(Generator generator) { - add(generator, 0); - } - - /** - * Add child generator with the specified amount of empty lines before it - * - * @param generator a generator - * @param emptyLinesCount amount of empty lines - */ - public final void add(Generator generator, int emptyLinesCount) { - myGenerators.add(Pair.create(generator, new Integer(emptyLinesCount))); - } - - /** - * Generate content. - * - * @param out output stream - * @throws IOException in case of IO propblem - * @see #setHasLeadingNewline(boolean) - */ - @Override - public void generate(PrintWriter out) throws IOException { - boolean first = true; - for (final Pair pair : myGenerators) { - if (first) { - if (hasLeadingNewline) { - crlf(out); - } - first = false; - } - else { - crlf(out); - } - final int emptyLinesCount = pair.getSecond().intValue(); - for (int idx = 0; idx < emptyLinesCount; idx++) { - crlf(out); - } - pair.getFirst().generate(out); - } - } - - /** - * @return amount of the child generators - */ - public final int getGeneratorCount() { - return myGenerators.size(); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/GenerationOptions.java b/java/compiler/openapi/src/com/intellij/compiler/ant/GenerationOptions.java deleted file mode 100644 index 8cca819600a5..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/GenerationOptions.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -import com.intellij.openapi.module.Module; -import org.jetbrains.annotations.NotNull; - -/** - * Ant file generation options. This object is availalbe during construction of ant object tree. - * - * @author anna - */ -public abstract class GenerationOptions { - /** - * This option specifies whether mulitfile or single file ant script is created. - */ - public final boolean generateSingleFile; - /** - * This option specifies whehter standard javac or javac2 task is used - */ - public final boolean enableFormCompiler; - /** - * This option speciries whether files are backed up before generation - */ - public final boolean backupPreviouslyGeneratedFiles; - /** - * This option specifies whether target JDK is forced during compilation or default ant JDK is used. - */ - public final boolean forceTargetJdk; - /** - * if true, the runtime classpath is inlined - */ - public final boolean inlineRuntimeClasspath; - /** - * if true, the runtime classpath is inlined - */ - public final boolean expandJarDirectories; - - - /** - * A constructor - * - * @param forceTargetJdk a value of corresponding option - * @param generateSingleFile a value of corresponding option - * @param enableFormCompiler a value of corresponding option - * @param backupPreviouslyGeneratedFiles a value of corresponding option - * @param inlineRuntimeClasspath if true, a runtiem classpaths are inlined - * @param expandJarDirectories if true, jar directories are expaned - */ - public GenerationOptions(boolean forceTargetJdk, - boolean generateSingleFile, - boolean enableFormCompiler, - boolean backupPreviouslyGeneratedFiles, - boolean inlineRuntimeClasspath, - boolean expandJarDirectories) { - this.forceTargetJdk = forceTargetJdk; - this.generateSingleFile = generateSingleFile; - this.enableFormCompiler = enableFormCompiler; - this.backupPreviouslyGeneratedFiles = backupPreviouslyGeneratedFiles; - this.inlineRuntimeClasspath = inlineRuntimeClasspath; - this.expandJarDirectories = expandJarDirectories; - } - - /** - * A constructor - * - * @param forceTargetJdk a value of corresponding option - * @param generateSingleFile a value of corresponding option - * @param enableFormCompiler a value of corresponding option - * @param backupPreviouslyGeneratedFiles a value of corresponding option - * @param inlineRuntimeClasspath if true a runtiem classpaths are inlined - */ - public GenerationOptions(boolean forceTargetJdk, - boolean generateSingleFile, - boolean enableFormCompiler, - boolean backupPreviouslyGeneratedFiles, - boolean inlineRuntimeClasspath) { - this(forceTargetJdk, generateSingleFile, enableFormCompiler, backupPreviouslyGeneratedFiles, inlineRuntimeClasspath, false); - } - - /** - * Substitute path prefix with macro reference if it matches some macro. - * - * @param path a path to update - * @return an updated path or argument - */ - public abstract String subsitutePathWithMacros(@NotNull String path); - - /** - * Get property reference for the specified url of module output directory - * - * @param url an URL to map - * @return the property reference in the form ${..} - */ - public abstract String getPropertyRefForUrl(String url); - - /** - * @return an array of module chunks. an array must not be modified by the clients. - */ - public abstract ModuleChunk[] getModuleChunks(); - - /** - * Get the chunk that contains the specified module. - * - * @param module the module to find - * @return the chunk that contains specifid module - */ - public abstract ModuleChunk getChunkByModule(Module module); - - /** - * @return a set of custom compilers, each compiler is used at least once in some chunk. - */ - public abstract ChunkCustomCompilerExtension[] getCustomCompilers(); - - /** - * @return true if the idea home property must be generated - */ - public abstract boolean isIdeaHomeGenerated(); - - - public abstract String getBuildFileName(); - - public abstract String getPropertiesFileName(); -} \ No newline at end of file diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/GenerationUtils.java b/java/compiler/openapi/src/com/intellij/compiler/ant/GenerationUtils.java deleted file mode 100644 index 6de3a06b9920..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/GenerationUtils.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant; - -import com.intellij.openapi.module.Module; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.io.FileUtilRt; -import com.intellij.openapi.vfs.JarFileSystem; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.util.PathUtil; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.File; -import java.io.IOException; - -/** - * @author Eugene Zhuravlev - */ -public class GenerationUtils { - private GenerationUtils() { - } - - /** - * Get relative file - * - * @param file a valid file (must be either belong to {@link com.intellij.openapi.vfs.LocalFileSystem} or to point to the root entry on - * {@link com.intellij.openapi.vfs.JarFileSystem}. - * @param chunk a module chunk. - * @param genOptions generation options - * @return a relative path - */ - @Nullable - public static String toRelativePath(final VirtualFile file, final ModuleChunk chunk, final GenerationOptions genOptions) { - final Module module = chunk.getModules()[0]; - final File moduleBaseDir = chunk.getBaseDir(); - return toRelativePath(file, moduleBaseDir, BuildProperties.getModuleBasedirProperty(module), genOptions); - } - - public static String toRelativePath(final String file, final File baseDir, final Module module, final GenerationOptions genOptions) { - return toRelativePath(file, baseDir, BuildProperties.getModuleBasedirProperty(module), genOptions); - } - - public static String toRelativePath(final String path, final ModuleChunk chunk, final GenerationOptions genOptions) { - return toRelativePath(path, chunk.getBaseDir(), BuildProperties.getModuleChunkBasedirProperty(chunk), genOptions); - } - - /** - * Get relative file - * - * @param file a valid file (must be either belong to {@link com.intellij.openapi.vfs.LocalFileSystem} or to point to the root entry on - * {@link com.intellij.openapi.vfs.JarFileSystem}. - * @param baseDir base director for relative path calculation - * @param baseDirPropertyName property name for the base directory - * @param genOptions generation options - * @return a relative path - */ - @Nullable - public static String toRelativePath(final VirtualFile file, - final File baseDir, - final String baseDirPropertyName, - final GenerationOptions genOptions) { - final String localPath = PathUtil.getLocalPath(file); - if (localPath == null) { - return null; - } - return toRelativePath(localPath, baseDir, baseDirPropertyName, genOptions); - } - - public static String toRelativePath(@NotNull String path, - File baseDir, - @NonNls final String baseDirPropertyName, - GenerationOptions genOptions) { - path = FileUtilRt.toSystemIndependentName(path); - if (path.length() == 0) { - return path; - } - final String substitutedPath = genOptions.subsitutePathWithMacros(path); - if (!substitutedPath.equals(path)) { - // path variable substitution has highest priority - return substitutedPath; - } - if (baseDir != null) { - File base; - try { - // use canonical paths in order to resolve symlinks - base = baseDir.getCanonicalFile(); - } - catch (IOException e) { - base = baseDir; - } - final String relativepath = FileUtil.getRelativePath(base, new File(path)); - if (relativepath != null) { - final String _relativePath = relativepath.replace(File.separatorChar, '/'); - final String root = BuildProperties.propertyRef(baseDirPropertyName); - return ".".equals(_relativePath) ? root : root + "/" + _relativePath; - } - } - return substitutedPath; - } - - public static String trimJarSeparator(final String path) { - return path.endsWith(JarFileSystem.JAR_SEPARATOR) ? path.substring(0, path.length() - JarFileSystem.JAR_SEPARATOR.length()) : path; - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/Generator.java b/java/compiler/openapi/src/com/intellij/compiler/ant/Generator.java deleted file mode 100644 index 9f90a7a8a384..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/Generator.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant; - -import java.io.IOException; -import java.io.PrintWriter; - -/** - * @author Eugene Zhuravlev - */ -public abstract class Generator { - private static int ourIndent = 0; - private static final int INDENT_SHIFT = 2; - - public abstract void generate(PrintWriter out) throws IOException; - - protected static void crlf(PrintWriter out) throws IOException { - out.println(); - indent(out); - } - - protected static void shiftIndent() { - ourIndent += INDENT_SHIFT; - } - - protected static void unshiftIndent() { - ourIndent -= INDENT_SHIFT; - } - - protected static void indent(PrintWriter out) throws IOException { - for (int idx = 0; idx < ourIndent; idx++) { - out.print(" "); - } - } - - /** - * Write XML header - * @param out a writer - * @throws IOException in case of IO problem - */ - protected static void writeXmlHeader(final PrintWriter out) throws IOException { - //noinspection HardCodedStringLiteral - out.print(""); - crlf(out); - } - -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/ModuleChunk.java b/java/compiler/openapi/src/com/intellij/compiler/ant/ModuleChunk.java deleted file mode 100644 index 728a2f2cd93f..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/ModuleChunk.java +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.compiler.ant; - -import com.intellij.compiler.CompilerConfiguration; -import com.intellij.compiler.CompilerEncodingService; -import com.intellij.openapi.application.ReadAction; -import com.intellij.openapi.module.EffectiveLanguageLevelUtil; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.roots.CompilerModuleExtension; -import com.intellij.openapi.roots.ModuleRootManager; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.pom.java.LanguageLevel; -import com.intellij.util.ArrayUtil; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.jps.model.java.JpsJavaSdkType; - -import java.io.File; -import java.nio.charset.Charset; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -/** - * Module chunk consists of interdependent modules. - * - * @author Eugene Zhuravlev - */ -public class ModuleChunk { - /* Modules in the chunk */ - private final Module[] myModules; - /* An array of custom compilation providers. */ - private final ChunkCustomCompilerExtension[] myCustomCompilers; - /* The main module in the chunk (guessed by heuristic or selected by user) */ - private Module myMainModule; - /* Chunk dependencies */ - private ModuleChunk[] myDependentChunks; - private File myBaseDir = null; - - public ModuleChunk(Module[] modules) { - myModules = modules; - Arrays.sort(myModules, (o1, o2) -> o1.getName().compareToIgnoreCase(o2.getName())); - myMainModule = myModules[0]; - myCustomCompilers = ChunkCustomCompilerExtension.getCustomCompile(this); - } - - public String getName() { - return myMainModule.getName(); - } - - /** - * @return an array of custom compilers for the module chunk - */ - public ChunkCustomCompilerExtension[] getCustomCompilers() { - return myCustomCompilers; - } - - public Module[] getModules() { - return myModules; - } - - @Nullable - public String getOutputDirUrl() { - CompilerModuleExtension extension = CompilerModuleExtension.getInstance(myMainModule); - return extension != null ? extension.getCompilerOutputUrl() : null; - } - - @Nullable - public String getTestsOutputDirUrl() { - CompilerModuleExtension extension = CompilerModuleExtension.getInstance(myMainModule); - return extension != null ? extension.getCompilerOutputUrlForTests() : null; - } - - public boolean isJdkInherited() { - return ModuleRootManager.getInstance(myMainModule).isSdkInherited(); - } - - @Nullable - public Sdk getJdk() { - return ModuleRootManager.getInstance(myMainModule).getSdk(); - } - - public ModuleChunk[] getDependentChunks() { - return myDependentChunks; - } - - public void setDependentChunks(ModuleChunk[] dependentChunks) { - myDependentChunks = dependentChunks; - } - - public File getBaseDir() { - return myBaseDir != null ? myBaseDir : new File(myMainModule.getModuleFilePath()).getParentFile(); - } - - public void setBaseDir(File baseDir) { - myBaseDir = baseDir; - } - - public void setMainModule(Module module) { - myMainModule = module; - } - - public Project getProject() { - return myMainModule.getProject(); - } - - public String getChunkSpecificCompileOptions() { - List options = new ArrayList<>(); - - Charset encoding = CompilerEncodingService.getInstance(getProject()).getPreferredModuleEncoding(myMainModule); - if (encoding != null) { - options.add("-encoding"); - options.add(encoding.name()); - } - - LanguageLevel languageLevel = ReadAction.compute(() -> EffectiveLanguageLevelUtil.getEffectiveLanguageLevel(myMainModule)); - String sourceVersion = JpsJavaSdkType.complianceOption(languageLevel.toJavaVersion()); - options.add("-source"); - options.add(sourceVersion); - - if (languageLevel.isPreview()) { - options.add("--enable-preview"); - } - - String bytecodeTarget = CompilerConfiguration.getInstance(getProject()).getBytecodeTargetLevel(myMainModule); - if (StringUtil.isEmpty(bytecodeTarget)) { - // according to IDEA rule: if not specified explicitly, set target to be the same as source language level - bytecodeTarget = sourceVersion; - } - options.add("-target"); - options.add(bytecodeTarget); - - return StringUtil.join(options, " "); - } - - public boolean contains(final Module module) { - return ArrayUtil.contains(module, myModules); - } -} \ No newline at end of file diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/PropertyFileGenerator.java b/java/compiler/openapi/src/com/intellij/compiler/ant/PropertyFileGenerator.java deleted file mode 100644 index 86c65d762a80..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/PropertyFileGenerator.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant; - -/** - * @author nik - */ -public abstract class PropertyFileGenerator extends Generator { - /** - * Add property. Note that property name and value - * are automatically escaped when the property file - * is generated. - * - * @param name a property name - * @param value a property value - */ - public abstract void addProperty(String name, String value); -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/Tag.java b/java/compiler/openapi/src/com/intellij/compiler/ant/Tag.java deleted file mode 100644 index 538743aed29c..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/Tag.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant; - -import com.intellij.openapi.util.Couple; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.text.StringUtil; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.Nullable; - -import java.io.IOException; -import java.io.PrintWriter; - -/** - * @author Eugene Zhuravlev - */ -public class Tag extends CompositeGenerator { - public static final Tag[] EMPTY_ARRAY = new Tag[0]; - private final String myTagName; - private final Pair[] myTagOptions; - - public Tag(@NonNls String tagName, Pair... tagOptions) { - myTagName = tagName; - myTagOptions = tagOptions; - } - - @Override - public void generate(PrintWriter out) throws IOException { - out.print("<"); - out.print(myTagName); - if (myTagOptions != null && myTagOptions.length > 0) { - out.print(" "); - int generated = 0; - for (final Pair option : myTagOptions) { - if (option == null) { - continue; - } - if (generated > 0) { - out.print(" "); - } - out.print((String)option.getFirst()); - out.print("=\""); - out.print(StringUtil.escapeXmlEntities((String)option.getSecond())); - out.print("\""); - generated += 1; - } - } - if (getGeneratorCount() > 0) { - out.print(">"); - shiftIndent(); - try { - super.generate(out); - } - finally { - unshiftIndent(); - } - crlf(out); - out.print(""); - } - else { - out.print("/>"); - } - } - - @Nullable - protected static Couple pair(@NonNls String v1, @Nullable @NonNls String v2) { - if (v2 == null) { - return null; - } - return Couple.of(v1, v2); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntCall.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntCall.java deleted file mode 100644 index 4de5460b3c09..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntCall.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; - -/** - * @author Eugene Zhuravlev - */ -public class AntCall extends Tag{ - - public AntCall(final String target) { - super("antcall", Couple.of("target", target)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntProject.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntProject.java deleted file mode 100644 index 94a3b116c1d0..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/AntProject.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class AntProject extends Tag { - public AntProject(@NonNls String name, @NonNls String defaultTarget) { - //noinspection HardCodedStringLiteral - super("project", Couple.of("name", name), Couple.of("default", defaultTarget)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Attribute.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Attribute.java deleted file mode 100644 index 7c62919ea5c2..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Attribute.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Attribute extends Tag{ - public Attribute(@NonNls String name, String value) { - super("attribute", Couple.of("name", name), Couple.of("value", value)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Copy.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Copy.java deleted file mode 100644 index d4c91d07e423..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Copy.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Copy extends Tag { - public Copy(@NonNls String toDir) { - //noinspection HardCodedStringLiteral - super("copy", Couple.of("todir", toDir)); - } - public Copy(@NonNls String file, @NonNls String toFile) { - //noinspection HardCodedStringLiteral - super("copy", Couple.of("file", file), Couple.of("tofile", toFile)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Delete.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Delete.java deleted file mode 100644 index 07cf873bc607..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Delete.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Delete extends Tag{ - public Delete(@NonNls String dir) { - super("delete", Couple.of("dir", dir)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/DirSet.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/DirSet.java deleted file mode 100644 index a180492d1423..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/DirSet.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class DirSet extends Tag{ - - public DirSet(@NonNls final String dir) { - super("dirset", Couple.of("dir", dir)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Dirname.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Dirname.java deleted file mode 100644 index 1cef890b141a..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Dirname.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Dirname extends Tag{ - public Dirname(@NonNls String property, @NonNls String file) { - super("dirname", Couple.of("property", property), Couple.of("file", file)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Exclude.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Exclude.java deleted file mode 100644 index e816c956305e..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Exclude.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Exclude extends Tag { - - public Exclude(@NonNls final String name) { - super("exclude", Couple.of("name", name)); - } - -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/FileSet.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/FileSet.java deleted file mode 100644 index cd4ffa93938e..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/FileSet.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class FileSet extends Tag{ - - public FileSet(@NonNls final String dir) { - super("fileset", pair("dir", dir)); - } - -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Import.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Import.java deleted file mode 100644 index c8723c686feb..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Import.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Import extends Tag{ - public Import(@NonNls String file, boolean optional) { - //noinspection HardCodedStringLiteral - super("import", Couple.of("file", file), Couple.of("optional", optional ? "true" : "false")); - } - - public Import(@NonNls String file) { - super("import", Couple.of("file", file)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Include.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Include.java deleted file mode 100644 index 9b9d9931e035..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Include.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Include extends Tag { - - public Include(@NonNls final String name) { - super("include", pair("name", name)); - } - -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Jar.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Jar.java deleted file mode 100644 index ad509a0261b9..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Jar.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Jar extends Tag { - public Jar(@NonNls final String destFile, @NonNls String duplicate) { - this(destFile, duplicate, false); - } - - public Jar(@NonNls final String destFile, @NonNls String duplicate, final boolean useManifestFromFileSets) { - super("jar", pair("destfile", destFile), pair("duplicate", duplicate), useManifestFromFileSets ? pair("filesetmanifest", "mergewithoutmain") : null); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Javac.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Javac.java deleted file mode 100644 index 86db931d6371..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Javac.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.BuildProperties; -import com.intellij.compiler.ant.GenerationOptions; -import com.intellij.compiler.ant.ModuleChunk; -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Pair; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Eugene Zhuravlev - */ -public class Javac extends Tag { - - public Javac(GenerationOptions genOptions, ModuleChunk moduleChunk, final String outputDir) { - super(getTagName(genOptions, moduleChunk), getAttributes(genOptions, outputDir, moduleChunk)); - } - - private static String getTagName(GenerationOptions genOptions, ModuleChunk moduleChunk) { - if (moduleChunk.getCustomCompilers().length > 0) { - return "instrumentIdeaExtensions"; - } - return genOptions.enableFormCompiler ? "javac2" : "javac"; - } - - private static Pair[] getAttributes(GenerationOptions genOptions, String outputDir, ModuleChunk moduleChunk) { - final List pairs = new ArrayList<>(); - pairs.add(pair("destdir", outputDir)); - if (moduleChunk.getCustomCompilers().length == 0) { - pairs.add(pair("debug", BuildProperties.propertyRef(BuildProperties.PROPERTY_COMPILER_GENERATE_DEBUG_INFO))); - pairs.add(pair("nowarn", BuildProperties.propertyRef(BuildProperties.PROPERTY_COMPILER_GENERATE_NO_WARNINGS))); - pairs.add(pair("memorymaximumsize", BuildProperties.propertyRef(BuildProperties.PROPERTY_COMPILER_MAX_MEMORY))); - pairs.add(pair("fork", "true")); - if (genOptions.forceTargetJdk) { - pairs.add(pair("executable", getExecutable(moduleChunk.getName()))); - } - } - return pairs.toArray(new Pair[0]); - } - - @Nullable - @NonNls - private static String getExecutable(String moduleName) { - if (moduleName == null) { - return null; - } - return BuildProperties.propertyRef(BuildProperties.getModuleChunkJdkBinProperty(moduleName)) + "/javac"; - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Manifest.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Manifest.java deleted file mode 100644 index ca27f69a7452..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Manifest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.compiler.make.ManifestBuilder; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.jar.Attributes; - -/** - * @author Eugene Zhuravlev - */ -public class Manifest extends Tag{ - public Manifest() { - super("manifest"); - } - - public void applyAttributes(final java.util.jar.Manifest manifest) { - ManifestBuilder.setGlobalAttributes(manifest.getMainAttributes()); - final Attributes mainAttributes = manifest.getMainAttributes(); - - List keys = new ArrayList<>(mainAttributes.keySet()); - Collections.sort(keys, (o1, o2) -> { - Attributes.Name name1 = (Attributes.Name)o1; - Attributes.Name name2 = (Attributes.Name)o2; - return name1.toString().compareTo(name2.toString()); - }); - for (final Object o : keys) { - Attributes.Name name = (Attributes.Name)o; - String value = (String)mainAttributes.get(name); - add(new Attribute(name.toString(), value)); - } - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Mkdir.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Mkdir.java deleted file mode 100644 index b75bf917a748..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Mkdir.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Mkdir extends Tag { - public Mkdir(@NonNls String directory) { - super("mkdir", Couple.of("dir", directory)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Param.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Param.java deleted file mode 100644 index 6bc1774a391d..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Param.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Param extends Tag { - public Param(@NonNls final String name, final String value) { - super("param", Couple.of("name", name), Couple.of("value", value)); - } - -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Path.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Path.java deleted file mode 100644 index aef72a1f0da7..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Path.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Path extends Tag { - - public Path(@NonNls final String id) { - super("path", pair("id", id)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PathElement.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PathElement.java deleted file mode 100644 index 7d70b521bee7..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PathElement.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class PathElement extends Tag { - - public PathElement(@NonNls String dir) { - super("pathelement", pair("location", dir)); - } - -} - diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PathRef.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PathRef.java deleted file mode 100644 index 481c62669462..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PathRef.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class PathRef extends Tag{ - - public PathRef(@NonNls final String refid) { - super("path", pair("refid", refid)); - } - -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSet.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSet.java deleted file mode 100644 index 960f0a6005cb..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSet.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class PatternSet extends Tag{ - public PatternSet(@NonNls final String id) { - super("patternset", pair("id", id)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSetRef.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSetRef.java deleted file mode 100644 index 5aaa171f927e..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/PatternSetRef.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class PatternSetRef extends Tag{ - public PatternSetRef(@NonNls final String refid) { - //noinspection HardCodedStringLiteral - super("patternset", Couple.of("refid", refid)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Property.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Property.java deleted file mode 100644 index 48869e2e1c9e..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Property.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -/** - * @author Eugene Zhuravlev - */ -public class Property extends Tag { - - public Property(@NonNls final String name, final String value) { - super("property", Couple.of("name", name), Couple.of("value", value)); - } - - public Property(@NonNls final String filePath) { - super("property", Couple.of("file", filePath)); - } - -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Target.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Target.java deleted file mode 100644 index 2985a1decab3..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Target.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.text.StringUtil; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.Nullable; - -import java.util.ArrayList; -import java.util.List; - -/** - * @author Eugene Zhuravlev - */ -public class Target extends Tag{ - public Target(@NonNls String name, @Nullable String depends, @Nullable String description, @Nullable String unlessCondition) { - super("target", getOptions(name, depends, description, unlessCondition)); - } - - public Target(@NonNls String name, @Nullable String depends, @Nullable String description, @Nullable String unlessCondition, @Nullable String xmlNsName, @Nullable String xmlNsValue) { - super("target", getOptions(name, depends, description, unlessCondition, xmlNsName, xmlNsValue)); - } - - @SuppressWarnings({"HardCodedStringLiteral"}) - private static Pair[] getOptions(@NonNls String... names) { - final List options = new ArrayList<>(); - options.add(Couple.of("name", names[0])); - appendIfNonEmpty(options, "depends", names[1]); - appendIfNonEmpty(options, "description", names[2]); - appendIfNonEmpty(options, "unless", names[3]); - if (names.length > 5) { - appendIfNonEmpty(options, names[4], names[5]); - } - return options.toArray(new Pair[0]); - } - - private static void appendIfNonEmpty(List options, final String paramName, String value) { - if (!StringUtil.isEmptyOrSpaces(value)) { - options.add(Couple.of(paramName, value)); - } - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Unzip.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Unzip.java deleted file mode 100644 index 8e3a4e7d2369..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Unzip.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; - -/** - * @author nik - */ -public class Unzip extends Tag { - public Unzip(String archivePath, String dest) { - super("unzip", pair("src", archivePath), pair("dest", dest)); - } -} diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Zip.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Zip.java deleted file mode 100644 index 25745ae29918..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/Zip.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Couple; -import org.jetbrains.annotations.NonNls; - -public class Zip extends Tag { - public Zip(@NonNls final String destFile) { - //noinspection HardCodedStringLiteral - super("zip", Couple.of("destfile", destFile)); - } -} \ No newline at end of file diff --git a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/ZipFileSet.java b/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/ZipFileSet.java deleted file mode 100644 index 5e907bbccbb9..000000000000 --- a/java/compiler/openapi/src/com/intellij/compiler/ant/taskdefs/ZipFileSet.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.intellij.compiler.ant.taskdefs; - -import com.intellij.compiler.ant.Tag; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.io.FileUtil; -import com.intellij.openapi.util.text.StringUtil; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import java.io.File; - -/** - * @author Eugene Zhuravlev - */ -public class ZipFileSet extends Tag{ - public static final ZipFileSet[] EMPTY_ARRAY = new ZipFileSet[0]; - - private ZipFileSet(@NonNls String tagName, Pair... tagOptions) { - super(tagName, tagOptions); - } - - public ZipFileSet(@NonNls String fileOrDir, @NonNls final String relativePath, boolean isDir) { - super("zipfileset", - pair(isDir ? "dir" : "file", fileOrDir), - pair("prefix", prefix(isDir, relativePath))); - } - - public static ZipFileSet createUnpackedSet(@NonNls String zipFilePath, @NotNull String relativePath, final boolean isDir) { - return new ZipFileSet("zipfileset", - pair("src", zipFilePath), - pair("prefix", prefix(isDir, relativePath))); - } - - @Nullable - private static String prefix(final boolean isDir, final String relativePath) { - String path; - if (isDir) { - path = relativePath; - } - else { - final String parent = new File(relativePath).getParent(); - path = parent == null ? "" : FileUtil.toSystemIndependentName(parent); - } - if (path != null) { - path = StringUtil.trimStart(path, "/"); - } - return !StringUtil.isEmpty(path) ? path : null; - } - -} diff --git a/java/compiler/openapi/src/com/intellij/packaging/elements/AntCopyInstructionCreator.java b/java/compiler/openapi/src/com/intellij/packaging/elements/AntCopyInstructionCreator.java deleted file mode 100644 index fc0eb0370480..000000000000 --- a/java/compiler/openapi/src/com/intellij/packaging/elements/AntCopyInstructionCreator.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.packaging.elements; - -import com.intellij.compiler.ant.Generator; -import com.intellij.compiler.ant.Tag; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * @author nik - */ -public interface AntCopyInstructionCreator { - - @NotNull - Tag createDirectoryContentCopyInstruction(@NotNull String dirPath); - - @NotNull - Tag createFileCopyInstruction(@NotNull String filePath, String outputFileName); - - @NotNull - AntCopyInstructionCreator subFolder(@NotNull String directoryName); - - @Nullable - Generator createSubFolderCommand(@NotNull String directoryName); - - @NotNull - Generator createExtractedDirectoryInstruction(@NotNull String jarPath); -} diff --git a/java/compiler/openapi/src/com/intellij/packaging/elements/ArtifactAntGenerationContext.java b/java/compiler/openapi/src/com/intellij/packaging/elements/ArtifactAntGenerationContext.java deleted file mode 100644 index 6e0ae96c0e38..000000000000 --- a/java/compiler/openapi/src/com/intellij/packaging/elements/ArtifactAntGenerationContext.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.intellij.packaging.elements; - -import com.intellij.compiler.ant.GenerationOptions; -import com.intellij.compiler.ant.Generator; -import com.intellij.openapi.project.Project; -import com.intellij.packaging.artifacts.Artifact; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.NonNls; - -/** - * @author nik - */ -public interface ArtifactAntGenerationContext { - - void runBeforeCurrentArtifact(Generator generator); - - void runBeforeBuild(Generator generator); - - void runAfterBuild(Generator generator); - - String createNewTempFileProperty(@NonNls String basePropertyName, @NonNls String fileName); - - String getModuleOutputPath(@NonNls String moduleName); - - String getModuleTestOutputPath(@NonNls String moduleName); - - String getSubstitutedPath(@NonNls String path); - - String getArtifactOutputProperty(@NotNull Artifact artifact); - - Project getProject(); - - GenerationOptions getGenerationOptions(); - - String getConfiguredArtifactOutputProperty(@NotNull Artifact artifact); -} diff --git a/java/compiler/openapi/src/com/intellij/packaging/elements/ComplexPackagingElement.java b/java/compiler/openapi/src/com/intellij/packaging/elements/ComplexPackagingElement.java index dd2328399f14..b8f21e7b57d0 100644 --- a/java/compiler/openapi/src/com/intellij/packaging/elements/ComplexPackagingElement.java +++ b/java/compiler/openapi/src/com/intellij/packaging/elements/ComplexPackagingElement.java @@ -1,27 +1,10 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.elements; -import com.intellij.compiler.ant.Generator; import com.intellij.packaging.artifacts.ArtifactType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.Collections; import java.util.List; /** @@ -32,24 +15,6 @@ public abstract class ComplexPackagingElement extends PackagingElement { super(type); } - @NotNull - @Override - public List computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, @NotNull AntCopyInstructionCreator creator, - @NotNull ArtifactAntGenerationContext generationContext, - @NotNull ArtifactType artifactType) { - final List> substitution = getSubstitution(resolvingContext, artifactType); - if (substitution == null) { - return Collections.emptyList(); - } - - final List fileSets = new ArrayList<>(); - for (PackagingElement element : substitution) { - fileSets.addAll(element.computeAntInstructions(resolvingContext, creator, generationContext, artifactType)); - } - return fileSets; - } - - @Nullable public abstract List> getSubstitution(@NotNull PackagingElementResolvingContext context, @NotNull ArtifactType artifactType); diff --git a/java/compiler/openapi/src/com/intellij/packaging/elements/CompositePackagingElement.java b/java/compiler/openapi/src/com/intellij/packaging/elements/CompositePackagingElement.java index 722cc11c94f9..6756706b6796 100644 --- a/java/compiler/openapi/src/com/intellij/packaging/elements/CompositePackagingElement.java +++ b/java/compiler/openapi/src/com/intellij/packaging/elements/CompositePackagingElement.java @@ -1,22 +1,6 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.elements; -import com.intellij.compiler.ant.Generator; -import com.intellij.packaging.artifacts.ArtifactType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -107,16 +91,6 @@ public abstract class CompositePackagingElement extends PackagingElement i return true; } - protected List computeChildrenGenerators(PackagingElementResolvingContext resolvingContext, - final AntCopyInstructionCreator copyInstructionCreator, - final ArtifactAntGenerationContext generationContext, ArtifactType artifactType) { - final List generators = new ArrayList<>(); - for (PackagingElement child : myChildren) { - generators.addAll(child.computeAntInstructions(resolvingContext, copyInstructionCreator, generationContext, artifactType)); - } - return generators; - } - public void removeAllChildren() { myChildren.clear(); } diff --git a/java/compiler/openapi/src/com/intellij/packaging/elements/PackagingElement.java b/java/compiler/openapi/src/com/intellij/packaging/elements/PackagingElement.java index d151e7279a5b..9fc1ac39fc8d 100644 --- a/java/compiler/openapi/src/com/intellij/packaging/elements/PackagingElement.java +++ b/java/compiler/openapi/src/com/intellij/packaging/elements/PackagingElement.java @@ -1,29 +1,11 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.packaging.elements; -import com.intellij.compiler.ant.Generator; import com.intellij.openapi.components.PersistentStateComponent; -import com.intellij.packaging.artifacts.ArtifactType; import com.intellij.packaging.ui.ArtifactEditorContext; import com.intellij.packaging.ui.PackagingElementPresentation; import org.jetbrains.annotations.NotNull; -import java.util.List; - /** * Describes an element in artifact's output layout. * @@ -46,11 +28,6 @@ public abstract class PackagingElement implements PersistentStateComponent return myType; } - @NotNull - public abstract List computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, @NotNull AntCopyInstructionCreator creator, - @NotNull ArtifactAntGenerationContext generationContext, - @NotNull ArtifactType artifactType); - public abstract boolean isEqualTo(@NotNull PackagingElement element); @NotNull diff --git a/java/java-impl/src/META-INF/JavaPlugin.xml b/java/java-impl/src/META-INF/JavaPlugin.xml index 333f7e5adbb0..21c9c831fccc 100644 --- a/java/java-impl/src/META-INF/JavaPlugin.xml +++ b/java/java-impl/src/META-INF/JavaPlugin.xml @@ -146,12 +146,6 @@ - - - - @@ -359,7 +353,6 @@ - @@ -384,8 +377,6 @@ - diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java index 0cbcc5120a72..7d229966b611 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/IdeActions.java @@ -144,7 +144,6 @@ public interface IdeActions { @NonNls String ACTION_COMPILE = "Compile"; @NonNls String ACTION_COMPILE_PROJECT = "CompileProject"; @NonNls String ACTION_MAKE_MODULE = "MakeModule"; - @NonNls String ACTION_GENERATE_ANT_BUILD = "GenerateAntBuild"; @NonNls String ACTION_INSPECT_CODE = "InspectCode"; @NonNls String ACTION_FIND_USAGES = "FindUsages"; diff --git a/platform/platform-resources-en/src/messages/ActionsBundle.properties b/platform/platform-resources-en/src/messages/ActionsBundle.properties index f524ee13cc01..3500cb9f0938 100644 --- a/platform/platform-resources-en/src/messages/ActionsBundle.properties +++ b/platform/platform-resources-en/src/messages/ActionsBundle.properties @@ -752,8 +752,6 @@ action.Compile.description=Force recompilation for selected module, file or pack action.RunAPT.text=Process _Annotations action.RunAPT.1.text=Process {0} _Annotations action.RunAPT.description=Run Annotation Processors on the selected scope -action.GenerateAntBuild.text=_Generate Ant Build... -action.GenerateAntBuild.description=Generate Ant Build File from the Project action.BuildAllArtifacts.text=Build All Artifacts action.DebugBuildProcess.text=Debug Build Process action.DebugBuildProcess.description=If enabled build process will wait for debug connections when started diff --git a/plugins/ant/resources/META-INF/plugin.xml b/plugins/ant/resources/META-INF/plugin.xml index e1c4e7846947..84e8bfd39d36 100644 --- a/plugins/ant/resources/META-INF/plugin.xml +++ b/plugins/ant/resources/META-INF/plugin.xml @@ -29,7 +29,6 @@ To use the Ant tool window, select View > Tool Windows > Ant Build - diff --git a/plugins/ant/src/com/intellij/lang/ant/config/impl/artifacts/AntArtifactBuildExtension.java b/plugins/ant/src/com/intellij/lang/ant/config/impl/artifacts/AntArtifactBuildExtension.java deleted file mode 100644 index 0522863d31a8..000000000000 --- a/plugins/ant/src/com/intellij/lang/ant/config/impl/artifacts/AntArtifactBuildExtension.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package com.intellij.lang.ant.config.impl.artifacts; - -import com.intellij.compiler.ant.*; -import com.intellij.compiler.ant.taskdefs.Property; -import com.intellij.lang.ant.config.impl.BuildFileProperty; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.vfs.VfsUtil; -import com.intellij.packaging.artifacts.Artifact; -import com.intellij.packaging.artifacts.ArtifactPropertiesProvider; -import com.intellij.packaging.elements.ArtifactAntGenerationContext; -import com.intellij.util.ArrayUtilRt; -import com.intellij.util.PathUtil; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.jps.ant.model.impl.artifacts.JpsAntArtifactExtensionImpl; - -/** - * @author nik - */ -public class AntArtifactBuildExtension extends ChunkBuildExtension { - @Override - public void generateTasksForArtifact(Artifact artifact, boolean preprocessing, ArtifactAntGenerationContext context, - CompositeGenerator generator) { - final ArtifactPropertiesProvider provider; - if (preprocessing) { - provider = AntArtifactPreProcessingPropertiesProvider.getInstance(); - } - else { - provider = AntArtifactPostprocessingPropertiesProvider.getInstance(); - } - final AntArtifactProperties properties = (AntArtifactProperties)artifact.getProperties(provider); - if (properties != null && properties.isEnabled()) { - final String path = VfsUtil.urlToPath(properties.getFileUrl()); - String fileName = PathUtil.getFileName(path); - String dirPath = PathUtil.getParentPath(path); - final String relativePath = GenerationUtils.toRelativePath(dirPath, BuildProperties.getProjectBaseDir(context.getProject()), - BuildProperties.getProjectBaseDirProperty(), context.getGenerationOptions()); - final Tag ant = new Tag("ant", Pair.create("antfile", fileName), Pair.create("target", properties.getTargetName()), - Pair.create("dir", relativePath)); - final String outputPath = BuildProperties.propertyRef(context.getArtifactOutputProperty(artifact)); - ant.add(new Property(JpsAntArtifactExtensionImpl.ARTIFACT_OUTPUT_PATH_PROPERTY, outputPath)); - for (BuildFileProperty property : properties.getUserProperties()) { - ant.add(new Property(property.getPropertyName(), property.getPropertyValue())); - } - generator.add(ant); - } - } - - @NotNull - @Override - public String[] getTargets(ModuleChunk chunk) { - return ArrayUtilRt.EMPTY_STRING_ARRAY; - } - - @Override - public void process(Project project, ModuleChunk chunk, GenerationOptions genOptions, CompositeGenerator generator) { - } -} diff --git a/plugins/devkit/devkit-core/resources/META-INF/plugin.xml b/plugins/devkit/devkit-core/resources/META-INF/plugin.xml index 306c0908a24b..daf6acf92459 100644 --- a/plugins/devkit/devkit-core/resources/META-INF/plugin.xml +++ b/plugins/devkit/devkit-core/resources/META-INF/plugin.xml @@ -37,7 +37,6 @@ - libs = new HashSet<>(); - for (Module module1 : modules) { - PluginBuildUtil.getLibraries(module1, libs); - } - - final String jarPathPropertyRef = BuildProperties.propertyRef(PluginBuildProperties.getJarPathProperty(moduleName)); - - if (libs.isEmpty()) { - add(createPluginsJar(jarPathPropertyRef, modules, moduleBaseDir, genOptions, moduleBuildProperties)); - } else { - @NonNls final String tempSuffix = "temp"; - final File jarDir = new File(moduleBaseDir.getParentFile(), tempSuffix); - String tempDir = GenerationUtils.toRelativePath(jarDir.getPath(), chunk, genOptions); - final String tempDirProperty = BuildProperties.getTempDirForModuleProperty(moduleName); - - add(new Property(tempDirProperty, tempDir)); - add(new Mkdir(BuildProperties.propertyRef(tempDirProperty))); - - add(new Mkdir(BuildProperties.propertyRef(tempDirProperty) + "/lib")); - - final @NonNls String libRelativePath = BuildProperties.propertyRef(tempDirProperty) + "/lib/"; - - add(createPluginsJar(libRelativePath + chunk.getName() + ".jar", modules, moduleBaseDir, genOptions, moduleBuildProperties)); - - for (Library lib : libs) { - final VirtualFile[] files = lib.getFiles(OrderRootType.CLASSES); - for (VirtualFile file : files) { - final String relativePath = GenerationUtils.toRelativePath(file, chunk, genOptions); - if (file.getFileSystem() instanceof JarFileSystem) { - add(new Copy(relativePath, libRelativePath + file.getName())); - } else { - final Jar jar = new Jar(libRelativePath + file.getNameWithoutExtension() + ".jar", "preserve"); - jar.add(new ZipFileSet(relativePath, "", true)); - add(jar); - } - } - } - - final Tag zipTag = new Zip(jarPathPropertyRef); - zipTag.add(new FileSet(tempDir)); - add(zipTag); - - add(new Delete(BuildProperties.propertyRef(tempDirProperty))); - } - } - - private static Tag createPluginsJar(@NonNls final String jarPathProperty, - final Module[] modules, final File moduleBaseDir, - final GenerationOptions genOptions, - final PluginBuildConfiguration moduleBuildProperties) { - final Tag jarTag = new Jar(jarPathProperty, "preserve"); - for (Module m : modules) { - final String path = VfsUtil.urlToPath(CompilerModuleExtension.getInstance(m).getCompilerOutputUrl()); - final String relativePath = GenerationUtils.toRelativePath(path, moduleBaseDir, m, genOptions); - jarTag.add(new ZipFileSet(relativePath, "", true)); - } - final Module module = modules[0]; - - //plugin.xml - - final String pluginXmlPath = moduleBuildProperties.getPluginXmlPath(); - final String relativePluginXMLPath = GenerationUtils.toRelativePath(pluginXmlPath, moduleBaseDir, module, genOptions); - jarTag.add(new ZipFileSet(relativePluginXMLPath, "META-INF/plugin.xml", false)); - - //manifest - final Manifest manifestTag = new Manifest(); - jarTag.add(manifestTag); - final java.util.jar.Manifest manifest; - try { - manifest = PrepareToDeployAction.createOrFindManifest(moduleBuildProperties); - } - catch (IOException e) { - return jarTag; - } - manifestTag.applyAttributes(manifest); - return jarTag; - } - -} \ No newline at end of file diff --git a/plugins/devkit/devkit-core/src/build/ant/ChunkBuildPluginExtension.java b/plugins/devkit/devkit-core/src/build/ant/ChunkBuildPluginExtension.java deleted file mode 100644 index cb89eff83ce8..000000000000 --- a/plugins/devkit/devkit-core/src/build/ant/ChunkBuildPluginExtension.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. - -package org.jetbrains.idea.devkit.build.ant; - -import com.intellij.compiler.ant.*; -import com.intellij.compiler.ant.taskdefs.Property; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.roots.libraries.Library; -import com.intellij.util.ArrayUtilRt; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.idea.devkit.DevKitBundle; -import org.jetbrains.idea.devkit.build.PluginBuildConfiguration; -import org.jetbrains.idea.devkit.build.PluginBuildUtil; -import org.jetbrains.idea.devkit.module.PluginModuleType; - -import java.util.HashSet; -import java.util.Set; - -public class ChunkBuildPluginExtension extends ChunkBuildExtension { - - @Override - @NotNull - public String[] getTargets(final ModuleChunk chunk) { - return isPlugins(chunk.getModules()) ? new String[] {PluginBuildProperties.getBuildJarTargetName(chunk.getName())} - : ArrayUtilRt.EMPTY_STRING_ARRAY; - } - - @Override - public void process(Project project, ModuleChunk chunk, GenerationOptions genOptions, CompositeGenerator generator) { - - final Module[] modules = chunk.getModules(); - if (isPlugins(modules)) { - final BuildTargetsFactory factory = BuildTargetsFactory.getInstance(); - final Module module = modules[0]; - PluginBuildConfiguration buildProperties = PluginBuildConfiguration.getInstance(module); - - final Set libs = new HashSet<>(); - PluginBuildUtil.getLibraries(module, libs); - @NonNls String jarPath = chunk.getBaseDir().getPath() + "/" + chunk.getName(); - if (libs.isEmpty()) { - jarPath += ".jar"; - } else { - jarPath += ".zip"; - } - - generator.add(new Property(PluginBuildProperties.getJarPathProperty(chunk.getName()), GenerationUtils.toRelativePath(jarPath, chunk, genOptions)), 1); - - generator.add(factory.createComment(DevKitBundle.message("ant.build.jar.comment", chunk.getName())), 1); - generator.add(new BuildJarTarget(chunk, genOptions, buildProperties)); - } - } - - private static boolean isPlugins(final Module[] modules) { - return modules.length == 1 && PluginModuleType.isOfType(modules[0]); - } - -} \ No newline at end of file diff --git a/plugins/devkit/devkit-core/src/build/ant/PluginBuildProperties.java b/plugins/devkit/devkit-core/src/build/ant/PluginBuildProperties.java deleted file mode 100644 index b709f186f58a..000000000000 --- a/plugins/devkit/devkit-core/src/build/ant/PluginBuildProperties.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2000-2009 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.idea.devkit.build.ant; - -import com.intellij.compiler.ant.BuildProperties; -import org.jetbrains.annotations.NonNls; - -/** - * @author nik - */ -public class PluginBuildProperties { - private PluginBuildProperties() { - } - - @NonNls - public static String getBuildJarTargetName(final String configurationName) { - return "plugin.build.jar." + BuildProperties.convertName(configurationName); - } - - @NonNls - public static String getJarPathProperty(final String configurationName) { - return BuildProperties.convertName(configurationName) + ".plugin.path.jar"; - } - -} diff --git a/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/build/GenerateAntTest.java b/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/build/GenerateAntTest.java deleted file mode 100644 index df0916b1ff6f..000000000000 --- a/plugins/devkit/devkit-java-tests/testSrc/org/jetbrains/idea/devkit/build/GenerateAntTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2000-2017 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.jetbrains.idea.devkit.build; - -import com.intellij.compiler.ant.BuildTargetsFactory; -import com.intellij.compiler.ant.ModuleChunk; -import com.intellij.openapi.module.Module; -import com.intellij.openapi.util.Comparing; -import com.intellij.openapi.util.text.StringUtil; -import com.intellij.openapi.vfs.VirtualFile; -import com.intellij.psi.XmlElementFactory; -import com.intellij.psi.codeStyle.CodeStyleManager; -import com.intellij.psi.xml.XmlAttribute; -import com.intellij.psi.xml.XmlTag; -import com.intellij.testFramework.JavaProjectTestCase; -import com.intellij.testFramework.PsiTestUtil; -import com.intellij.util.IncorrectOperationException; -import org.jetbrains.idea.devkit.build.ant.BuildJarTarget; - -import java.io.PrintWriter; -import java.io.StringWriter; - -public class GenerateAntTest extends JavaProjectTestCase { - public void testP1() throws Exception { - final VirtualFile parent = myModule.getModuleFile().getParent(); - assertNotNull(parent); - PsiTestUtil.setCompilerOutputPath(myModule, parent.getUrl() + "/classes", false); - checkJarTarget(new ModuleChunk(new Module[]{getModule()})); - } - - private void checkJarTarget(ModuleChunk chunk) throws Exception { - final StringWriter targetText = new StringWriter(); - final PrintWriter dataOutput = new PrintWriter(targetText); - new BuildJarTarget(chunk, BuildTargetsFactory.getInstance().getDefaultOptions(getProject()), new PluginBuildConfiguration(getModule())).generate(dataOutput); - dataOutput.flush(); - final String lowercased = StringUtil.toLowerCase(myModule.getName()); - final String expected = "\n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - " \n" + - ""; - checkBuildsEqual(targetText.toString(), expected); - } - - private void checkBuildsEqual(String generated, String expected) throws IncorrectOperationException { - final CodeStyleManager manager = CodeStyleManager.getInstance(myProject); - XmlTag genTag = XmlElementFactory.getInstance(myProject).createTagFromText(StringUtil.convertLineSeparators(generated)); - XmlTag expTag = XmlElementFactory.getInstance(myProject).createTagFromText(StringUtil.convertLineSeparators(expected)); - if (!tagsEqual(genTag, expTag)) { - genTag = (XmlTag)manager.reformat(manager.reformat(genTag)); - expTag = (XmlTag)manager.reformat(manager.reformat(expTag)); - assertEquals("Text mismatch: ", expTag.getText(), genTag.getText()); - } - } - - private static boolean tagsEqual(XmlTag genTag, XmlTag expTag) { - if (!attributesEqual(genTag, expTag)) return false; - final XmlTag[] gsubTags = genTag.getSubTags(); - final XmlTag[] esubTags = expTag.getSubTags(); - if (gsubTags.length != esubTags.length) return false; - for (int i = 0; i < esubTags.length; i++) { - XmlTag esubTag = esubTags[i]; - XmlTag gsubTag = gsubTags[i]; - if (!tagsEqual(gsubTag, esubTag)) return false; - } - return true; - } - - private static boolean attributesEqual(XmlTag genTag, XmlTag expTag) { - final XmlAttribute[] gattributes = genTag.getAttributes(); - final XmlAttribute[] eattributes = expTag.getAttributes(); - if (gattributes.length != eattributes.length) return false; - for (int i = 0; i < eattributes.length; i++) { - XmlAttribute eattribute = eattributes[i]; - XmlAttribute gattribute = gattributes[i]; - // logical comparison of the attributes (namespace:localname and display value) - if (!Comparing.strEqual(gattribute.getLocalName(), eattribute.getLocalName())) return false; - if (!Comparing.strEqual(gattribute.getNamespace(), eattribute.getNamespace())) return false; - if (!Comparing.strEqual(gattribute.getDisplayValue(), eattribute.getDisplayValue())) return false; - } - return true; - } -} \ No newline at end of file diff --git a/plugins/groovy/src/META-INF/plugin.xml b/plugins/groovy/src/META-INF/plugin.xml index 08cd8183f1e3..2300acfc5d7e 100644 --- a/plugins/groovy/src/META-INF/plugin.xml +++ b/plugins/groovy/src/META-INF/plugin.xml @@ -643,8 +643,6 @@ - - versions = utils.getSDKVersions(libraries); - String maxVersion = versions.isEmpty() ? null : Collections.max(versions); - Library sdkLib = null; - for (Library lib : libraries) { - if (maxVersion == null || maxVersion.equals(utils.getSDKVersion(LibrariesUtil.getGroovyLibraryHome(lib)))) { - sdkLib = lib; - } - } - assert sdkLib != null; - String groovySdkPathRef = BuildProperties.getLibraryPathId(sdkLib.getName()); - generator.add(new Property(GROOVYC_TASK_SDK_PROPERTY, groovySdkPathRef)); - //noinspection HardCodedStringLiteral - Tag taskdef = new Tag("taskdef", Couple.of("name", "groovyc"), Couple.of("classname", "org.codehaus.groovy.ant.Groovyc"), - Couple.of("classpathref", "${" + GROOVYC_TASK_SDK_PROPERTY + "}")); - generator.add(taskdef); - } - - /** - * {@inheritDoc} - */ - @Override - public boolean hasCustomCompile(ModuleChunk chunk) { - final Module[] modules = chunk.getModules(); - if (modules.length == 0) { - return false; - } - final PsiManager manager = PsiManager.getInstance(chunk.getProject()); - final ContentIterator groovyFileSearcher = fileOrDir -> { - ProgressManager.checkCanceled(); - return !isCompilableGroovyFile(manager, fileOrDir); - }; - for (Module m : modules) { - if (LibrariesUtil.hasGroovySdk(m)) { - final ModuleRootManager rootManager = ModuleRootManager.getInstance(m); - final ModuleFileIndex fileIndex = rootManager.getFileIndex(); - for (VirtualFile file : rootManager.getSourceRoots(JavaModuleSourceRootTypes.SOURCES)) { - if (!fileIndex.iterateContentUnderDirectory(file, groovyFileSearcher)) { - return true; - } - } - } - } - return false; - } - - /** - * @return {@code true} if the file is in Groovy and it doesn't have custom script type - */ - private static boolean isCompilableGroovyFile(PsiManager manager, VirtualFile file) { - if (file.isDirectory()) { - return false; - } - if (!FileTypeRegistry.getInstance().isFileOfType(file, GroovyFileType.GROOVY_FILE_TYPE)) { - return false; - } - PsiFile psiFile = manager.findFile(file); - if (!(psiFile instanceof GroovyFile)) { - return false; - } - return GroovyScriptUtil.isPlainGroovyScript((GroovyFile)psiFile); - } -} diff --git a/plugins/javaFX/src/META-INF/common-javaFX-plugin.xml b/plugins/javaFX/src/META-INF/common-javaFX-plugin.xml index 5ba6cb771e8d..cfa1d330f2a9 100644 --- a/plugins/javaFX/src/META-INF/common-javaFX-plugin.xml +++ b/plugins/javaFX/src/META-INF/common-javaFX-plugin.xml @@ -58,7 +58,6 @@ - diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java deleted file mode 100644 index 2042f220c272..000000000000 --- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/packaging/ant/JavaFxChunkBuildExtension.java +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. -package org.jetbrains.plugins.javaFX.packaging.ant; - -import com.intellij.compiler.ant.*; -import com.intellij.compiler.ant.artifacts.DirectoryAntCopyInstructionCreator; -import com.intellij.compiler.ant.taskdefs.Property; -import com.intellij.openapi.project.Project; -import com.intellij.openapi.projectRoots.JavaSdkType; -import com.intellij.openapi.projectRoots.Sdk; -import com.intellij.openapi.util.Couple; -import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.io.FileUtilRt; -import com.intellij.packaging.artifacts.Artifact; -import com.intellij.packaging.artifacts.ArtifactManager; -import com.intellij.packaging.artifacts.ArtifactType; -import com.intellij.packaging.elements.*; -import com.intellij.packaging.impl.elements.ArchivePackagingElement; -import com.intellij.util.ArrayUtil; -import com.intellij.util.ArrayUtilRt; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.jetbrains.plugins.javaFX.packaging.JavaFxAntGenerator; -import org.jetbrains.plugins.javaFX.packaging.JavaFxApplicationArtifactType; -import org.jetbrains.plugins.javaFX.packaging.JavaFxArtifactProperties; -import org.jetbrains.plugins.javaFX.packaging.JavaFxArtifactPropertiesProvider; - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Base64; -import java.util.Collection; -import java.util.List; - -public class JavaFxChunkBuildExtension extends ChunkBuildExtension { - - @NonNls public static final String ARTIFACT_VENDOR_SIGN_PROPERTY = "artifact.sign.vendor"; - @NonNls public static final String ARTIFACT_ALIAS_SIGN_PROPERTY = "artifact.sign.alias"; - @NonNls public static final String ARTIFACT_KEYSTORE_SIGN_PROPERTY = "artifact.sign.keystore"; - @NonNls public static final String ARTIFACT_STOREPASS_SIGN_PROPERTY = "artifact.sign.storepass"; - @NonNls public static final String ARTIFACTKEYPASS_SIGN_PROPERTY = "artifact.sign.keypass"; - - @NotNull - @Override - public String[] getTargets(ModuleChunk chunk) { - return ArrayUtilRt.EMPTY_STRING_ARRAY; - } - - @Override - public void process(Project project, ModuleChunk chunk, GenerationOptions genOptions, CompositeGenerator generator) {} - - @Override - public void initArtifacts(Project project, GenerationOptions genOptions, CompositeGenerator generator) { - final Collection artifacts = - ArtifactManager.getInstance(project).getArtifactsByType(JavaFxApplicationArtifactType.getInstance()); - if (artifacts.isEmpty()) return; - final Sdk[] jdks = BuildProperties.getUsedJdks(project); - Sdk javaSdk = null; - for (Sdk jdk : jdks) { - if (jdk.getSdkType() instanceof JavaSdkType) { - javaSdk = jdk; - break; - } - } - if (javaSdk != null) { - final Tag taskdef = new Tag("taskdef", - Couple.of("resource", "com/sun/javafx/tools/ant/antlib.xml"), - Couple.of("uri", "javafx:com.sun.javafx.tools.ant"), - Couple.of("classpath", - BuildProperties - .propertyRef(BuildProperties.getJdkHomeProperty(javaSdk.getName())) + - "/lib/ant-javafx.jar")); - generator.add(taskdef); - } - } - - protected List computeChildrenGenerators(PackagingElementResolvingContext resolvingContext, - final AntCopyInstructionCreator copyInstructionCreator, - final ArtifactAntGenerationContext generationContext, - ArtifactType artifactType, - List> children) { - final List generators = new ArrayList<>(); - for (PackagingElement child : children) { - generators.addAll(child.computeAntInstructions(resolvingContext, copyInstructionCreator, generationContext, artifactType)); - } - return generators; - } - - @Override - public void generateTasksForArtifact(Artifact artifact, - boolean preprocessing, - ArtifactAntGenerationContext context, - CompositeGenerator generator) { - if (preprocessing) return; - if (!(artifact.getArtifactType() instanceof JavaFxApplicationArtifactType)) return; - - final CompositePackagingElement rootElement = artifact.getRootElement(); - - final List> children = new ArrayList<>(); - String artifactFileName = rootElement.getName(); - for (PackagingElement child : rootElement.getChildren()) { - if (child instanceof ArchivePackagingElement) { - artifactFileName = ((ArchivePackagingElement)child).getArchiveFileName(); - children.addAll(((ArchivePackagingElement)child).getChildren()); - } else { - children.add(child); - } - } - - final String artifactName = FileUtilRt.getNameWithoutExtension(artifactFileName); - - final String tempDirPath = BuildProperties.propertyRef( - context.createNewTempFileProperty("artifact.temp.output." + artifactName, artifactFileName)); - - final PackagingElementResolvingContext resolvingContext = ArtifactManager.getInstance(context.getProject()).getResolvingContext(); - for (Generator childGenerator : computeChildrenGenerators(resolvingContext, - new DirectoryAntCopyInstructionCreator(tempDirPath), - context, artifact.getArtifactType(), children)) { - generator.add(childGenerator); - } - - final JavaFxArtifactProperties properties = - (JavaFxArtifactProperties)artifact.getProperties(JavaFxArtifactPropertiesProvider.getInstance()); - - final JavaFxArtifactProperties.JavaFxPackager javaFxPackager = - new JavaFxArtifactProperties.JavaFxPackager(artifact, properties, context.getProject()) { - @Override - protected void registerJavaFxPackagerError(String message) {} - @Override - protected void registerJavaFxPackagerInfo(String message) {} - }; - final String tempDirDeployPath = tempDirPath + "/deploy"; - final List tags = - JavaFxAntGenerator.createJarAndDeployTasks(javaFxPackager, artifactFileName, artifact.getName(), tempDirPath, tempDirDeployPath, context.getProject().getBasePath()); - for (JavaFxAntGenerator.SimpleTag tag : tags) { - buildTags(generator, tag); - } - - if (properties.isEnabledSigning()) { - - final boolean selfSigning = properties.isSelfSigning(); - String vendor = properties.getVendor(); - if (vendor != null) { - vendor = vendor.replaceAll(",", "\\\\,") ; - } - generator.add(new Property(artifactBasedProperty(ARTIFACT_VENDOR_SIGN_PROPERTY, artifactName), "CN=" + vendor)); - - final String alias = selfSigning ? "jb" : properties.getAlias(); - generator.add(new Property(artifactBasedProperty(ARTIFACT_ALIAS_SIGN_PROPERTY, artifactName), alias)); - - final String keystore = selfSigning ? tempDirPath + File.separator + "jb-key.jks" : properties.getKeystore(); - generator.add(new Property(artifactBasedProperty(ARTIFACT_KEYSTORE_SIGN_PROPERTY, artifactName), keystore)); - - final String storepass = selfSigning ? "storepass" : new String(Base64.getDecoder().decode(properties.getStorepass()), StandardCharsets.UTF_8); - generator.add(new Property(artifactBasedProperty(ARTIFACT_STOREPASS_SIGN_PROPERTY, artifactName), storepass)); - - final String keypass = selfSigning ? "keypass" : new String(Base64.getDecoder().decode(properties.getKeypass()), StandardCharsets.UTF_8); - generator.add(new Property(artifactBasedProperty(ARTIFACTKEYPASS_SIGN_PROPERTY, artifactName), keypass)); - - final Pair[] keysDescriptions = createKeysDescriptions(artifactName); - if (selfSigning) { - generator.add(new Tag("genkey", - ArrayUtil.prepend(Couple.of("dname", BuildProperties - .propertyRef(artifactBasedProperty(ARTIFACT_VENDOR_SIGN_PROPERTY, artifactName))), - keysDescriptions))); - } - - final Tag signjar = new Tag("signjar", keysDescriptions); - final Tag fileset = new Tag("fileset", Couple.of("dir", tempDirDeployPath)); - fileset.add(new Tag("include", Couple.of("name", "*.jar"))); - signjar.add(fileset); - generator.add(signjar); - } - - final DirectoryAntCopyInstructionCreator creator = new DirectoryAntCopyInstructionCreator(BuildProperties.propertyRef(context.getConfiguredArtifactOutputProperty(artifact))); - generator.add(creator.createDirectoryContentCopyInstruction(tempDirDeployPath)); - final Tag deleteTag = new Tag("delete", Couple.of("includeemptydirs", "true")); - deleteTag.add(new Tag("fileset", Couple.of("dir", tempDirPath))); - generator.add(deleteTag); - } - - private static void buildTags(CompositeGenerator generator, final JavaFxAntGenerator.SimpleTag tag) { - final Tag newTag = new Tag(tag.getName(), tag.getPairs()){ - @Override - public void generate(PrintWriter out) throws IOException { - final String value = tag.getValue(); - if (value == null) { - super.generate(out); - } else { - out.print("<" + tag.getName() + ">" + value + ""); - } - } - }; - - for (JavaFxAntGenerator.SimpleTag simpleTag : tag.getSubTags()) { - buildTags(newTag, simpleTag); - } - generator.add(newTag); - } - - private static String artifactBasedProperty(final String property, String artifactName) { - return property + "." + artifactName; - } - - private static Pair[] createKeysDescriptions(String artifactName) { - return new Pair[]{ - Couple.of("alias", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACT_ALIAS_SIGN_PROPERTY, artifactName))), - Couple.of("keystore", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACT_KEYSTORE_SIGN_PROPERTY, artifactName))), - Couple.of("storepass", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACT_STOREPASS_SIGN_PROPERTY, artifactName))), - Couple.of("keypass", BuildProperties.propertyRef(artifactBasedProperty(ARTIFACTKEYPASS_SIGN_PROPERTY, artifactName)))}; - } - - @Nullable - @Override - public Couple getArtifactXmlNs(ArtifactType artifactType) { - if (artifactType instanceof JavaFxApplicationArtifactType) { - return Couple.of("xmlns:fx", "javafx:com.sun.javafx.tools.ant"); - } - return null; - } - - @Override - public boolean needAntArtifactInstructions(ArtifactType type) { - if (type instanceof JavaFxApplicationArtifactType) { - return false; - } - return true; - } -} diff --git a/resources-en/src/messages/CompilerBundle.properties b/resources-en/src/messages/CompilerBundle.properties index a8f827de2198..b33138511ea2 100644 --- a/resources-en/src/messages/CompilerBundle.properties +++ b/resources-en/src/messages/CompilerBundle.properties @@ -8,47 +8,16 @@ error.javac.out.of.memory=Out of memory. Increase the maximum heap size in Proje progress.loading.classes=Loading classes... progress.compiling.class=Compiling {0}... progress.parsing.file=Parsing {0}... -label.generate.ant.script.use.jdk.definitions=Use JDK definitions from project files -label.generate.ant.script.overwrite.files=Overwrite previously generated files -label.generate.ant.script.backup.files=Backup previously generated files -label.generate.ant.script.single.file=Generate single-file ant build -label.generate.ant.script.generate.multiple.files=Generate multiple-file ant build (requires ant 1.6 or later to execute) -label.generate.ant.script.enable.ui.forms.compilation=Enable UI forms compilation (requires "javac2" ant task from IDEA distribution) action.compile.description.module=Module ''{0}'' action.compile.description.selected.files=Selected Files rebuild.lvcs.label.no.errors=''{0}'' with no errors rebuild.lvcs.label.with.errors=''{0}'' with errors -message.ant.files.generated.ok=Ant build files successfully generated:\n{0} -error.ant.files.generate.failed=Failed to generate ant build script: {0} -error.ant.files.backup.failed=Failed to backup file {0} -generate.ant.build.dialog.cyclic.modules.table.title=Cyclic Module Dependencies -generate.ant.build.dialog.cyclic.modules.table.description=Some modules have cyclic dependencies.\nIn order to generate ant build script, please select the \"main\" (representative) module for each dependency cycle.\nThe source code for all modules in the cycle will be compiled into the main module's output folders;\nAll modules in the cycle will use the JDK assigned to the main module;\nAny JAR files created will be named after the name of the main module. -generate.ant.build.dialog.cyclic.modules.table.number.column.header=Cycle -generate.ant.build.dialog.cyclic.modules.table.name.column.header=Main Module action.make.selected.modules.text=Build Selected _Modules -generated.ant.build.disable.tests.property.comment=Uncomment the following property if no tests compilation is needed -generated.ant.build.compiler.options.comment=Compiler options -generated.ant.build.project.libraries.comment=Project Libraries -generated.ant.build.global.libraries.comment=Global Libraries -generated.ant.build.jdk.definitions.comment=JDK definitions message.resource.patterns.format.changed=The format of resource patterns has changed.\n{0} failed to convert existing regular expression patterns:\n{1}\nPlease enter pattern string in a new format.\nEach resource pattern may contain the following wildcards:\n? - one character\n* - zero or more characters\n! - negate the pattern (allowed only at the start of a pattern)\nUse ; (semicolon) to separate resource patterns;\nEscape the "!" character with a backslash ("\\").\nYou might also need to modify template project settings.\nPress ''{2}'' to accept entered patterns, ''{3}'' to load default patterns in new format. pattern.conversion.dialog.title=Pattern Conversion error.bad.resource.patterns=The following resource patterns are malformed:{0} bad.resource.patterns.dialog.title=Malformed Resource Patterns compiler.results.export.text.prefix=line ({0}) -value.undefined=undefined -generated.ant.build.bootclasspath.comment=Paths to be included in compilation bootclasspath -generated.ant.build.cleanup.module.task.comment=cleanup module -generated.ant.build.clean.all.task.comment=cleanup all -generated.ant.build.compile.modules.main.target.comment=Compile {0,choice, 1#module|2#modules} {1} -generated.ant.build.compile.modules.production.classes.target.comment=Compile {0,choice, 1#module|2#modules} {1}; production classes -generated.ant.build.compile.modules.tests.target.comment=compile {0,choice, 1#module|2#modules} {1}; test classes -generated.ant.build.modules.section.title=Modules -generated.ant.build.initialization.section.title=Build initialization -generated.ant.build.initialization.section.comment=Perform any build initialization in this target -generated.ant.build.build.all.modules.target.name=build all modules -generated.ant.build.build.all.target.name=build all -generated.ant.build.building.concrete.module.section.title=Module {0} compiler.error.exception=Error: {0} status.compilation.aborted=Compilation aborted status.all.up.to.date=All files are up-to-date @@ -108,8 +77,6 @@ add.notnull.assertions=Add runtime &assertions for notnull-annotated methods and compiler.eclipse.name=Eclipse eclipse.options.group.title=Eclipse Options -generate.ant.build.title=Generate Ant Build -generate.ant.build.progress.message=Generating ant build... #artifacts packaging.element.text.output.root= @@ -176,16 +143,7 @@ action.name.package.files=Package Files validation.display.name=Validation action.name.exclude.from.validation=Exclude from Validation no.validators=No validators available - -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.compilers=Conflict between custom compilers should be resolved manually. -generated.ant.build.custom.compilers.comment=Register 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 label.option.autoshow.first.error=Automatically show first &error in editor -label.generate.ant.script.filename=Output file name: label.option.display.notification.popup=Display notification on build completion compiler.ref.service.validation.task.name=Backward Reference Indices Validation diff --git a/resources/src/idea/JavaActions.xml b/resources/src/idea/JavaActions.xml index effeec567a8e..f5406b5ed7ce 100644 --- a/resources/src/idea/JavaActions.xml +++ b/resources/src/idea/JavaActions.xml @@ -94,7 +94,6 @@ -