mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git.labs.intellij.net:idea/community
This commit is contained in:
@@ -535,7 +535,6 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements
|
||||
}
|
||||
myProcessorPath = pathBuilder.toString();
|
||||
|
||||
myProcessorPath = annotationProcessingSettings.getAttributeValue("processorPath", "");
|
||||
myProcessorsMap.clear();
|
||||
for (Element processorChild : ((Collection<Element>)annotationProcessingSettings.getChildren("processor"))) {
|
||||
final String name = processorChild.getAttributeValue("name");
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
package com.intellij.compiler.ant;
|
||||
|
||||
import com.intellij.compiler.ant.j2ee.BuildExplodedTarget;
|
||||
import com.intellij.compiler.ant.j2ee.BuildJarTarget;
|
||||
import com.intellij.compiler.ant.j2ee.CompositeBuildTarget;
|
||||
import com.intellij.compiler.ant.taskdefs.Target;
|
||||
import com.intellij.openapi.compiler.make.BuildRecipe;
|
||||
@@ -42,10 +41,6 @@ public class BuildTargetsFactoryImpl extends BuildTargetsFactory {
|
||||
return new BuildExplodedTarget(parameters, buildRecipe, description);
|
||||
}
|
||||
|
||||
public Target createBuildJarTarget(final ExplodedAndJarTargetParameters parameters, final BuildRecipe buildRecipe, final String description) {
|
||||
return new BuildJarTarget(parameters, buildRecipe, description);
|
||||
}
|
||||
|
||||
|
||||
public Generator createComment(final String comment) {
|
||||
return new Comment(comment);
|
||||
|
||||
@@ -1,175 +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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author cdr
|
||||
*/
|
||||
package com.intellij.compiler.ant.j2ee;
|
||||
|
||||
import com.intellij.compiler.ant.BuildProperties;
|
||||
import com.intellij.compiler.ant.ExplodedAndJarTargetParameters;
|
||||
import com.intellij.compiler.ant.GenerationUtils;
|
||||
import com.intellij.compiler.ant.Tag;
|
||||
import com.intellij.compiler.ant.taskdefs.*;
|
||||
import com.intellij.compiler.make.ExplodedAndJarBuildGenerator;
|
||||
import com.intellij.openapi.compiler.make.*;
|
||||
import com.intellij.openapi.deployment.DeploymentUtil;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class BuildJarTarget extends Target {
|
||||
|
||||
public BuildJarTarget(final ExplodedAndJarTargetParameters parameters,
|
||||
final BuildRecipe buildRecipe,
|
||||
final String description) {
|
||||
super(parameters.getBuildJarTargetName(), null, description, null);
|
||||
final File moduleBaseDir = parameters.getChunk().getBaseDir();
|
||||
|
||||
BuildConfiguration buildConfiguration = parameters.getBuildConfiguration();
|
||||
//noinspection HardCodedStringLiteral
|
||||
final File jarDir = new File(buildConfiguration.isJarEnabled() ? new File(buildConfiguration.getJarPath()).getParentFile() : moduleBaseDir, "/temp");
|
||||
String tempDir = GenerationUtils.toRelativePath(jarDir.getPath(), parameters.getChunk(), parameters.getGenerationOptions());
|
||||
final String tempDirProperty = BuildProperties.getTempDirForModuleProperty(parameters.getContainingModule().getName());
|
||||
final boolean[] tempDirUsed = new boolean[] { false };
|
||||
|
||||
final ExplodedAndJarBuildGenerator[] generators = Extensions.getExtensions(DefaultExplodedAndJarBuildGenerator.EP_NAME);
|
||||
final List<ZipFileSet> zipFileSetTags = new ArrayList<ZipFileSet>();
|
||||
buildRecipe.visitInstructions(new BuildInstructionVisitor() {
|
||||
public boolean visitInstruction(final BuildInstruction instruction) throws Exception {
|
||||
for (final ExplodedAndJarBuildGenerator generator : generators) {
|
||||
final Ref<Boolean> ref = new Ref<Boolean>(false);
|
||||
final ZipFileSet[] tags = generator.generateTagsForJarTarget(instruction, parameters, ref);
|
||||
if (tags != null) {
|
||||
if (ref.get() != null && ref.get()) {
|
||||
tempDirUsed[0] = true;
|
||||
}
|
||||
zipFileSetTags.addAll(Arrays.asList(tags));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
final Ref<Boolean> ref = Ref.create(false);
|
||||
zipFileSetTags.addAll(Arrays.asList(DefaultExplodedAndJarBuildGenerator.INSTANCE.generateTagsForJarTarget(instruction, parameters, ref)));
|
||||
if (ref.get() != null && ref.get()) {
|
||||
tempDirUsed[0] = true;
|
||||
}
|
||||
return super.visitInstruction(instruction);
|
||||
}
|
||||
}, false);
|
||||
if (tempDirUsed[0]) {
|
||||
add(new Property(tempDirProperty, tempDir));
|
||||
add(new Mkdir(BuildProperties.propertyRef(tempDirProperty)));
|
||||
}
|
||||
final List<Tag> prepareTags = new ArrayList<Tag>();
|
||||
buildRecipe.visitInstructions(new BuildInstructionVisitor() {
|
||||
public boolean visitInstruction(final BuildInstruction instruction) throws Exception {
|
||||
for (final ExplodedAndJarBuildGenerator generator : generators) {
|
||||
final Tag[] tags = generator.generateJarBuildPrepareTags(instruction, parameters);
|
||||
if (tags != null) {
|
||||
prepareTags.addAll(Arrays.asList(tags));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
prepareTags.addAll(Arrays.asList(DefaultExplodedAndJarBuildGenerator.INSTANCE.generateJarBuildPrepareTags(instruction, parameters)));
|
||||
return super.visitInstruction(instruction);
|
||||
}
|
||||
}, false);
|
||||
for (Tag tag : prepareTags) {
|
||||
add(tag);
|
||||
}
|
||||
final String destFile = BuildProperties.propertyRef(parameters.getJarPathParameter());
|
||||
final @NonNls String jarDirProperty = "jar.dir";
|
||||
add(new Dirname(jarDirProperty, destFile));
|
||||
add(new Mkdir(BuildProperties.propertyRef(jarDirProperty)));
|
||||
final Jar jarTag = new Jar(destFile, "preserve");
|
||||
add(jarTag);
|
||||
final java.util.jar.Manifest manifest = DeploymentUtil.getInstance().createManifest(buildRecipe);
|
||||
|
||||
if (manifest != null) {
|
||||
final Manifest manifestTag = new Manifest();
|
||||
jarTag.add(manifestTag);
|
||||
manifestTag.applyAttributes(manifest);
|
||||
}
|
||||
|
||||
for (ZipFileSet zipFileSet : zipFileSetTags) {
|
||||
jarTag.add(zipFileSet);
|
||||
}
|
||||
if (tempDirUsed[0]) {
|
||||
add(new Delete(BuildProperties.propertyRef(tempDirProperty)));
|
||||
}
|
||||
|
||||
// emit copy commands for dependencies
|
||||
buildRecipe.visitInstructions(new BuildInstructionVisitor() {
|
||||
private int myJarDirCount = 2;
|
||||
|
||||
public boolean visitFileCopyInstruction(FileCopyInstruction instruction) throws Exception {
|
||||
if (!instruction.isExternalDependencyInstruction()) return true;
|
||||
final File sourceFile = instruction.getFile();
|
||||
final String outputRelativePath = DeploymentUtil.appendToPath("/",instruction.getOutputRelativePath());
|
||||
final Module instructionModule = instruction.getModule();
|
||||
String sourceLocation = GenerationUtils.toRelativePath(sourceFile.getPath(), moduleBaseDir, instructionModule,
|
||||
parameters.getGenerationOptions());
|
||||
String jarPathPropertyRef = BuildProperties.propertyRef(parameters.getJarPathParameter());
|
||||
|
||||
final Copy copy;
|
||||
if (instruction.isDirectory()) {
|
||||
copy = new Copy(DeploymentUtil.appendToPath(jarPathPropertyRef,outputRelativePath));
|
||||
copy.add(new FileSet(sourceLocation));
|
||||
}
|
||||
else {
|
||||
copy = new Copy(sourceLocation, DeploymentUtil.appendToPath(jarPathPropertyRef,outputRelativePath));
|
||||
}
|
||||
|
||||
add(copy);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean visitJarAndCopyBuildInstruction(JarAndCopyBuildInstruction instruction) throws Exception {
|
||||
if (!instruction.isExternalDependencyInstruction()) return true;
|
||||
String jarPathPropertyRef = BuildProperties.propertyRef(parameters.getJarPathParameter());
|
||||
String pathToCreateJar = jarPathPropertyRef + DeploymentUtil.appendToPath("/",instruction.getOutputRelativePath());
|
||||
@NonNls final String jarDir = "jar.dir" + myJarDirCount++;
|
||||
add(new Dirname(jarDir, pathToCreateJar));
|
||||
add(new Mkdir(BuildProperties.propertyRef(jarDir)));
|
||||
add(DefaultExplodedAndJarBuildGenerator.generateJarTag(instruction, pathToCreateJar, moduleBaseDir, parameters.getGenerationOptions()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean visitCompoundBuildInstruction(final CompoundBuildInstruction instruction) throws Exception {
|
||||
if (!instruction.isExternalDependencyInstruction()) return true;
|
||||
String outputPath = DeploymentUtil.appendToPath(BuildProperties.propertyRef(parameters.getJarPathParameter()), instruction.getOutputRelativePath());
|
||||
if (instruction.getBuildProperties().isJarEnabled()) {
|
||||
String jarPath = BuildProperties.propertyRef(parameters.getCompoundBuildInstructionNaming().getJarPathProperty(instruction));
|
||||
add(new Copy(jarPath, outputPath));
|
||||
}
|
||||
else {
|
||||
AntCall call = new AntCall(parameters.getCompoundBuildInstructionNaming().getBuildJarTargetName(instruction));
|
||||
call.add(new Param(parameters.getJarPathParameter(), outputPath));
|
||||
add(call);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,7 +41,6 @@ public class CompositeBuildTarget extends CompositeGenerator {
|
||||
final String depends, @Nullable String jarPath) {
|
||||
|
||||
final File moduleBaseDir = parameters.getChunk().getBaseDir();
|
||||
final Module containingModule = parameters.getContainingModule();
|
||||
final Target buildTarget = new Target(targetName, depends, targetDescription, null);
|
||||
final BuildConfiguration buildConfiguration = parameters.getBuildConfiguration();
|
||||
|
||||
|
||||
-124
@@ -19,11 +19,8 @@ import com.intellij.compiler.ant.*;
|
||||
import com.intellij.compiler.ant.taskdefs.*;
|
||||
import com.intellij.compiler.make.ExplodedAndJarBuildGenerator;
|
||||
import com.intellij.compiler.make.MakeUtil;
|
||||
import com.intellij.openapi.compiler.DummyCompileContext;
|
||||
import com.intellij.openapi.compiler.make.*;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -77,23 +74,6 @@ public class DefaultExplodedAndJarBuildGenerator extends ExplodedAndJarBuildGene
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean visitCompoundBuildInstruction(CompoundBuildInstruction instruction) throws RuntimeException {
|
||||
if (instruction.isExternalDependencyInstruction()) return true;
|
||||
final String outputRelativePath = "/" + instruction.getOutputRelativePath();
|
||||
final String outputPath = BuildProperties.propertyRef(parameters.getExplodedPathParameter()) + outputRelativePath;
|
||||
|
||||
final Tag tag;
|
||||
if (instruction.getBuildProperties().isExplodedEnabled()) {
|
||||
tag = new Copy(outputPath);
|
||||
tag.add(new FileSet(BuildProperties.propertyRef(parameters.getCompoundBuildInstructionNaming().getExplodedPathProperty(instruction))));
|
||||
}
|
||||
else {
|
||||
tag = new AntCall(parameters.getCompoundBuildInstructionNaming().getBuildExplodedTargetName(instruction));
|
||||
tag.add(new Param(parameters.getExplodedPathParameter(), outputPath));
|
||||
}
|
||||
tags.add(tag);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return tags.toArray(new Tag[tags.size()]);
|
||||
}
|
||||
@@ -124,108 +104,4 @@ public class DefaultExplodedAndJarBuildGenerator extends ExplodedAndJarBuildGene
|
||||
}
|
||||
|
||||
|
||||
|
||||
@NotNull
|
||||
public ZipFileSet[] generateTagsForJarTarget(@NotNull final BuildInstruction instruction, @NotNull final ExplodedAndJarTargetParameters parameters,
|
||||
final Ref<Boolean> tempDirUsed)
|
||||
throws Exception {
|
||||
final List<ZipFileSet> zipFileSetTags = new SmartList<ZipFileSet>();
|
||||
final String tempDirProperty = BuildProperties.getTempDirForModuleProperty(parameters.getContainingModule().getName());
|
||||
final File moduleBaseDir = parameters.getChunk().getBaseDir();
|
||||
instruction.accept(new BuildInstructionVisitor() {
|
||||
public boolean visitFileCopyInstruction(FileCopyInstruction instruction) throws RuntimeException {
|
||||
if (instruction.isExternalDependencyInstruction()) return true;
|
||||
final File sourceFile = instruction.getFile();
|
||||
final Module instructionModule = instruction.getModule();
|
||||
final String sourceLocation = GenerationUtils.toRelativePath(sourceFile.getPath(), moduleBaseDir, instructionModule,
|
||||
parameters.getGenerationOptions());
|
||||
final ZipFileSet fileSet = new ZipFileSet(sourceLocation, instruction.getOutputRelativePath(), instruction.isDirectory());
|
||||
|
||||
zipFileSetTags.add(fileSet);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean visitJarAndCopyBuildInstruction(JarAndCopyBuildInstruction instruction) throws RuntimeException {
|
||||
if (instruction.isExternalDependencyInstruction()) return true;
|
||||
tempDirUsed.set(true);
|
||||
final String jarName = new File(instruction.getOutputRelativePath()).getName();
|
||||
final String destJarPath = BuildProperties.propertyRef(tempDirProperty)+"/"+jarName;
|
||||
|
||||
zipFileSetTags.add(new ZipFileSet(destJarPath, instruction.getOutputRelativePath(), false));
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean visitCompoundBuildInstruction(CompoundBuildInstruction instruction) throws RuntimeException {
|
||||
if (instruction.isExternalDependencyInstruction()) return true;
|
||||
// gather child module dependencies
|
||||
final BuildRecipe childModuleRecipe = instruction.getChildInstructions(DummyCompileContext.getInstance());
|
||||
childModuleRecipe.visitInstructions(new BuildInstructionVisitor() {
|
||||
public boolean visitFileCopyInstruction(FileCopyInstruction instruction) throws RuntimeException {
|
||||
if (!instruction.isExternalDependencyInstruction()) return true;
|
||||
final File file = instruction.getFile();
|
||||
final Module instructionModule = instruction.getModule();
|
||||
String sourceLocation = GenerationUtils.toRelativePath(file.getPath(), moduleBaseDir, instructionModule,
|
||||
parameters.getGenerationOptions());
|
||||
final String relPath = PathUtil.getCanonicalPath("/tmp/"+instruction.getOutputRelativePath()).substring(1);
|
||||
final ZipFileSet zipFileSet = new ZipFileSet(sourceLocation, relPath, false);
|
||||
zipFileSetTags.add(zipFileSet);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean visitJarAndCopyBuildInstruction(JarAndCopyBuildInstruction instruction) throws RuntimeException {
|
||||
if (!instruction.isExternalDependencyInstruction()) return true;
|
||||
final String relPath = PathUtil.getCanonicalPath("/tmp/"+instruction.getOutputRelativePath()).substring(1);
|
||||
tempDirUsed.set(true);
|
||||
final ZipFileSet zipFileSet = new ZipFileSet(BuildProperties.propertyRef(tempDirProperty) + "/" + relPath, relPath, false);
|
||||
zipFileSetTags.add(zipFileSet);
|
||||
return true;
|
||||
}
|
||||
}, false);
|
||||
|
||||
if (instruction.getBuildProperties().isJarEnabled()) {
|
||||
final ZipFileSet zipFileSet = new ZipFileSet(BuildProperties.propertyRef(parameters.getCompoundBuildInstructionNaming().getJarPathProperty(instruction)), instruction.getOutputRelativePath(), false);
|
||||
zipFileSetTags.add(zipFileSet);
|
||||
}
|
||||
else {
|
||||
final String jarName = new File(instruction.getOutputRelativePath()).getName();
|
||||
final String destJarPath = BuildProperties.propertyRef(tempDirProperty)+"/"+jarName;
|
||||
tempDirUsed.set(true);
|
||||
zipFileSetTags.add(new ZipFileSet(destJarPath, instruction.getOutputRelativePath(), false));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return zipFileSetTags.toArray(new ZipFileSet[zipFileSetTags.size()]);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Tag[] generateJarBuildPrepareTags(@NotNull final BuildInstruction instruction, @NotNull final ExplodedAndJarTargetParameters parameters)
|
||||
throws Exception {
|
||||
final List<Tag> prepareTags = new SmartList<Tag>();
|
||||
final String tempDirProperty = BuildProperties.getTempDirForModuleProperty(parameters.getContainingModule().getName());
|
||||
final File moduleBaseDir = parameters.getChunk().getBaseDir();
|
||||
instruction.accept(new BuildInstructionVisitor() {
|
||||
|
||||
public boolean visitJarAndCopyBuildInstruction(JarAndCopyBuildInstruction instruction) throws RuntimeException {
|
||||
if (instruction.isExternalDependencyInstruction()) return true;
|
||||
final String jarName = new File(instruction.getOutputRelativePath()).getName();
|
||||
final String destJarPath = BuildProperties.propertyRef(tempDirProperty)+"/"+jarName;
|
||||
prepareTags.add(generateJarTag(instruction, destJarPath, moduleBaseDir, parameters.getGenerationOptions()));
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean visitCompoundBuildInstruction(CompoundBuildInstruction instruction) throws RuntimeException {
|
||||
if (instruction.isExternalDependencyInstruction()) return true;
|
||||
if (!instruction.getBuildProperties().isJarEnabled()) {
|
||||
final String jarName = new File(instruction.getOutputRelativePath()).getName();
|
||||
final String destJarPath = BuildProperties.propertyRef(tempDirProperty)+"/"+jarName;
|
||||
final AntCall makeJar = new AntCall(parameters.getCompoundBuildInstructionNaming().getBuildJarTargetName(instruction));
|
||||
prepareTags.add(makeJar);
|
||||
makeJar.add(new Param(parameters.getJarPathParameter(), destJarPath));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return prepareTags.toArray(new Tag[prepareTags.size()]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,7 +478,8 @@ public class CompileDriver {
|
||||
// in case another project was opened in the frame while the compiler was working (See SCR# 28591)
|
||||
statusBar.setInfo(statusMessage);
|
||||
if (duration > ONE_MINUTE_MS) {
|
||||
ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.MESSAGES_WINDOW, MessageType.INFO, statusMessage);
|
||||
final MessageType messageType = errorCount > 0 ? MessageType.ERROR : warningCount > 0 ? MessageType.WARNING : MessageType.INFO;
|
||||
ToolWindowManager.getInstance(myProject).notifyByBalloon(ToolWindowId.MESSAGES_WINDOW, messageType, statusMessage);
|
||||
}
|
||||
}
|
||||
if (_status != ExitStatus.UP_TO_DATE && compileContext.getMessageCount(null) > 0) {
|
||||
|
||||
+9
-5
@@ -169,18 +169,22 @@ public class TranslatingCompilerFilesMonitor implements ApplicationComponent {
|
||||
if (_forceCompile || pathsToRecompile != null && !pathsToRecompile.isEmpty()) {
|
||||
while (scopeSrcIterator.hasNext()) {
|
||||
final VirtualFile file = scopeSrcIterator.next();
|
||||
if (!file.isValid() || configuration.isExcludedFromCompilation(file) || !compiler.isCompilableFile(file, context)) {
|
||||
if (!file.isValid()) {
|
||||
continue;
|
||||
}
|
||||
final int fileId = getFileId(file);
|
||||
if (_forceCompile) {
|
||||
toCompile.add(file);
|
||||
if (pathsToRecompile == null || !pathsToRecompile.contains(fileId)) {
|
||||
addSourceForRecompilation(projectId, file, null);
|
||||
if (compiler.isCompilableFile(file, context) && !configuration.isExcludedFromCompilation(file)) {
|
||||
toCompile.add(file);
|
||||
if (pathsToRecompile == null || !pathsToRecompile.contains(fileId)) {
|
||||
addSourceForRecompilation(projectId, file, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pathsToRecompile.contains(fileId)) {
|
||||
toCompile.add(file);
|
||||
if (compiler.isCompilableFile(file, context) && !configuration.isExcludedFromCompilation(file)) {
|
||||
toCompile.add(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -63,9 +63,13 @@ public class AnnotationProcessingCompiler implements SourceProcessingCompiler{
|
||||
final List<ProcessingItem> items = new ArrayList<ProcessingItem>(files.length);
|
||||
final Set<Module> excludedModules = config.getExcludedModules();
|
||||
for (final VirtualFile file : files) {
|
||||
if (excludedModules.size() == 0 || !excludedModules.contains(context.getModuleByFile(file))) {
|
||||
items.add(new MyProcessingItem(file));
|
||||
if (excludedModules.size() != 0 && excludedModules.contains(context.getModuleByFile(file))) {
|
||||
continue;
|
||||
}
|
||||
if (config.isExcludedFromCompilation(file)) {
|
||||
continue;
|
||||
}
|
||||
items.add(new MyProcessingItem(file));
|
||||
}
|
||||
return items.toArray(new ProcessingItem[items.size()]);
|
||||
}
|
||||
|
||||
-214
@@ -1,214 +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.impl.packagingCompiler;
|
||||
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompilerBundle;
|
||||
import com.intellij.openapi.compiler.CompilerMessageCategory;
|
||||
import com.intellij.openapi.compiler.make.*;
|
||||
import com.intellij.openapi.deployment.DeploymentUtil;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.io.ZipUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
public class CompoundBuildInstructionImpl extends BuildInstructionBase implements CompoundBuildInstruction {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.compiler.impl.packagingCompiler.CompoundBuildInstructionImpl");
|
||||
|
||||
private final BuildConfiguration myBuildConfiguration;
|
||||
private final BuildParticipant myBuildParticipant;
|
||||
@NonNls private static final String TMP_FILE_SUFFIX = ".tmp";
|
||||
|
||||
public CompoundBuildInstructionImpl(BuildParticipant buildParticipant, String outputRelativePath) {
|
||||
super(outputRelativePath, buildParticipant.getModule());
|
||||
myBuildConfiguration = buildParticipant.getBuildConfiguration();
|
||||
myBuildParticipant = buildParticipant;
|
||||
}
|
||||
|
||||
public BuildParticipant getBuildParticipant() {
|
||||
return myBuildParticipant;
|
||||
}
|
||||
|
||||
public boolean accept(BuildInstructionVisitor visitor) throws Exception {
|
||||
return visitor.visitCompoundBuildInstruction(this);
|
||||
}
|
||||
|
||||
public void addFilesToJar(@NotNull final CompileContext context,
|
||||
@NotNull final File jarFile,
|
||||
@NotNull final JarOutputStream outputStream,
|
||||
BuildRecipe dependencies,
|
||||
@Nullable final Set<String> writtenRelativePaths,
|
||||
@Nullable final FileFilter fileFilter) throws IOException {
|
||||
// create temp jars, and add these into upper level jar
|
||||
// todo optimization: cache created jars
|
||||
final File tempFile;
|
||||
final BuildRecipe childDependencies = new BuildRecipeImpl();
|
||||
if (myBuildConfiguration.isJarEnabled()) {
|
||||
tempFile = new File(myBuildConfiguration.getJarPath());
|
||||
final BuildRecipe childModuleRecipe = getChildInstructions(context);
|
||||
childModuleRecipe.visitInstructions(new BuildInstructionVisitor() {
|
||||
public boolean visitInstruction(BuildInstruction instruction) throws RuntimeException {
|
||||
if (instruction.isExternalDependencyInstruction()) {
|
||||
childDependencies.addInstruction(instruction);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
else {
|
||||
tempFile = File.createTempFile("jar___", TMP_FILE_SUFFIX);
|
||||
tempFile.deleteOnExit();
|
||||
makeJar(context, tempFile, childDependencies, fileFilter, true);
|
||||
childDependencies.visitInstructions(new BuildInstructionVisitor() {
|
||||
public boolean visitFileCopyInstruction(FileCopyInstruction instruction) throws Exception {
|
||||
File file = new File(PathUtil.getCanonicalPath(DeploymentUtil.appendToPath(tempFile.getPath(), instruction.getOutputRelativePath())));
|
||||
addFileToDelete(file);
|
||||
return true;
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
ZipUtil.addFileToZip(outputStream, tempFile, getOutputRelativePath(), writtenRelativePaths, fileFilter);
|
||||
try {
|
||||
childDependencies.visitInstructionsWithExceptions(new BuildInstructionVisitor() {
|
||||
public boolean visitFileCopyInstruction(FileCopyInstruction instruction) throws Exception {
|
||||
File file = instruction.getFile();
|
||||
String dependencyRelativePath = PathUtil.getCanonicalPath(DeploymentUtil.appendToPath(getOutputRelativePath(), instruction.getOutputRelativePath()));
|
||||
|
||||
ZipUtil.addFileOrDirRecursively(outputStream, jarFile, file, dependencyRelativePath, fileFilter, writtenRelativePaths);
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean visitJarAndCopyBuildInstruction(JarAndCopyBuildInstruction instruction) throws Exception {
|
||||
if (instruction.getJarFile() == null) {
|
||||
File tempJar = File.createTempFile("___",TMP_FILE_SUFFIX);
|
||||
addFileToDelete(tempJar);
|
||||
instruction.makeJar(context, tempJar, fileFilter);
|
||||
}
|
||||
File jarFile = instruction.getJarFile();
|
||||
String dependencyRelativePath = PathUtil.getCanonicalPath(DeploymentUtil.appendToPath(getOutputRelativePath(), instruction.getOutputRelativePath()));
|
||||
|
||||
ZipUtil.addFileToZip(outputStream, jarFile, dependencyRelativePath, writtenRelativePaths, fileFilter);
|
||||
return true;
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
// return jarFile and possible jars linked via manifest
|
||||
public void makeJar(final CompileContext context,
|
||||
final File jarFile,
|
||||
final BuildRecipe dependencies,
|
||||
final FileFilter fileFilter,
|
||||
final boolean processExternalDependencies) throws IOException {
|
||||
final BuildRecipe buildRecipe = getChildInstructions(context);
|
||||
final Manifest manifest = DeploymentUtil.getInstance().createManifest(buildRecipe);
|
||||
if (manifest == null) {
|
||||
File file = DeploymentUtil.getInstance().findUserSuppliedManifestFile(buildRecipe);
|
||||
LOG.assertTrue(file != null);
|
||||
context.addMessage(CompilerMessageCategory.WARNING, CompilerBundle.message("message.text.using.user.supplied.manifest", file.getAbsolutePath()), null, -1, -1);
|
||||
}
|
||||
FileUtil.createParentDirs(jarFile);
|
||||
final BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(jarFile));
|
||||
final JarOutputStream jarOutputStream = manifest == null ? new JarOutputStream(out) : new JarOutputStream(out, manifest);
|
||||
|
||||
final Set<String> tempWrittenRelativePaths = new THashSet<String>();
|
||||
if (manifest != null) {
|
||||
tempWrittenRelativePaths.add(JarFile.MANIFEST_NAME);
|
||||
}
|
||||
try {
|
||||
buildRecipe.visitInstructionsWithExceptions(new BuildInstructionVisitor() {
|
||||
public boolean visitInstruction(BuildInstruction instruction) throws IOException {
|
||||
if (processExternalDependencies || !instruction.isExternalDependencyInstruction()) {
|
||||
instruction.addFilesToJar(context, jarFile, jarOutputStream, dependencies, tempWrittenRelativePaths, fileFilter);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
catch (IOException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (RuntimeException e) {
|
||||
throw e;
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
finally {
|
||||
jarOutputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
public BuildRecipe getChildInstructions(CompileContext context) {
|
||||
return myBuildParticipant.getBuildInstructions(context);
|
||||
}
|
||||
|
||||
public BuildConfiguration getBuildProperties() {
|
||||
return myBuildConfiguration;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Java EE build instruction: " + myBuildParticipant + " -> " + getOutputRelativePath();
|
||||
}
|
||||
|
||||
public File findFileByRelativePath(String relativePath) {
|
||||
if (!relativePath.startsWith(getOutputRelativePath())) return null;
|
||||
final String pathFromFile = relativePath.substring(getOutputRelativePath().length());
|
||||
final Ref<File> file = new Ref<File>();
|
||||
final BuildRecipe buildRecipe = getChildInstructions(null);
|
||||
buildRecipe.visitInstructions(new BuildInstructionVisitor() {
|
||||
public boolean visitInstruction(BuildInstruction instruction) throws RuntimeException {
|
||||
final File found = instruction.findFileByRelativePath(pathFromFile);
|
||||
if (found != null) {
|
||||
file.set(found);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, false);
|
||||
return file.get();
|
||||
}
|
||||
|
||||
public void collectFilesToDelete(final Collection<File> filesToDelete) {
|
||||
super.collectFilesToDelete(filesToDelete);
|
||||
BuildRecipe childInstructions = getChildInstructions(null);
|
||||
childInstructions.visitInstructions(new BuildInstructionVisitor() {
|
||||
public boolean visitInstruction(BuildInstruction instruction) throws Exception {
|
||||
((BuildInstructionBase)instruction).collectFilesToDelete(filesToDelete);
|
||||
return true;
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
}
|
||||
-44
@@ -15,25 +15,16 @@
|
||||
*/
|
||||
package com.intellij.compiler.impl.packagingCompiler;
|
||||
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompilerBundle;
|
||||
import com.intellij.openapi.compiler.make.BuildInstructionVisitor;
|
||||
import com.intellij.openapi.compiler.make.BuildRecipe;
|
||||
import com.intellij.openapi.compiler.make.FileCopyInstruction;
|
||||
import com.intellij.openapi.compiler.make.PackagingFileFilter;
|
||||
import com.intellij.openapi.deployment.DeploymentUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.util.io.ZipUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.jar.JarOutputStream;
|
||||
|
||||
public class FileCopyInstructionImpl extends BuildInstructionBase implements FileCopyInstruction {
|
||||
private File myFile;
|
||||
@@ -68,41 +59,6 @@ public class FileCopyInstructionImpl extends BuildInstructionBase implements Fil
|
||||
return visitor.visitFileCopyInstruction(this);
|
||||
}
|
||||
|
||||
public File findFileByRelativePath(String relativePath) {
|
||||
if (!relativePath.startsWith(getOutputRelativePath())) return null;
|
||||
final String pathFromFile = relativePath.substring(getOutputRelativePath().length());
|
||||
if (!myIsDirectory) {
|
||||
return "".equals(pathFromFile) ? myFile : null;
|
||||
}
|
||||
final File file = DeploymentUtil.canonicalRelativePath(myFile, pathFromFile);
|
||||
|
||||
return file.exists() ? file : null;
|
||||
}
|
||||
|
||||
public void addFilesToJar(@NotNull CompileContext context,
|
||||
@NotNull File jarFile,
|
||||
@NotNull JarOutputStream outputStream,
|
||||
BuildRecipe dependencies,
|
||||
@Nullable Set<String> writtenRelativePaths,
|
||||
@Nullable FileFilter fileFilter) throws IOException {
|
||||
final String outputRelativePath = getOutputRelativePath();
|
||||
|
||||
File file = getFile();
|
||||
if (isExternalDependencyInstruction()) {
|
||||
// copy dependent file along with jar file
|
||||
final File toFile = DeploymentUtil.canonicalRelativePath(jarFile, outputRelativePath);
|
||||
DeploymentUtil.getInstance().copyFile(file, toFile, context, null, fileFilter);
|
||||
dependencies.addInstruction(this);
|
||||
}
|
||||
else {
|
||||
boolean ok = ZipUtil.addFileOrDirRecursively(outputStream, jarFile, file, outputRelativePath, fileFilter, writtenRelativePaths);
|
||||
if (!ok) {
|
||||
DeploymentUtil.reportRecursiveCopying(context, file.getPath(), jarFile.getPath(), "",
|
||||
CompilerBundle.message("message.text.setup.jar.outside.directory.path", file.getPath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (myChangedSet == null) {
|
||||
if (getModule() != null) {
|
||||
|
||||
+4
-84
@@ -15,26 +15,14 @@
|
||||
*/
|
||||
package com.intellij.compiler.impl.packagingCompiler;
|
||||
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompilerBundle;
|
||||
import com.intellij.openapi.compiler.make.*;
|
||||
import com.intellij.openapi.compiler.make.BuildInstructionVisitor;
|
||||
import com.intellij.openapi.compiler.make.JarAndCopyBuildInstruction;
|
||||
import com.intellij.openapi.compiler.make.PackagingFileFilter;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.deployment.DeploymentUtil;
|
||||
import com.intellij.util.io.ZipUtil;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.jar.JarOutputStream;
|
||||
import java.util.jar.Manifest;
|
||||
import java.util.jar.JarFile;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
@@ -44,9 +32,6 @@ import java.util.jar.JarFile;
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class JarAndCopyBuildInstructionImpl extends FileCopyInstructionImpl implements JarAndCopyBuildInstruction {
|
||||
private File myJarFile;
|
||||
private final List<File> myTempJars = new ArrayList<File>(1);
|
||||
@NonNls private static final String TMP_FILE_SUFFIX = ".tmp";
|
||||
|
||||
public JarAndCopyBuildInstructionImpl(Module module, File directoryToJar, String outputRelativePath, @Nullable PackagingFileFilter fileFilter) {
|
||||
super(directoryToJar, false, module, outputRelativePath, fileFilter);
|
||||
@@ -56,63 +41,6 @@ public class JarAndCopyBuildInstructionImpl extends FileCopyInstructionImpl impl
|
||||
super(directoryToJar, false, module, outputRelativePath);
|
||||
}
|
||||
|
||||
public void addFilesToJar(@NotNull CompileContext context,
|
||||
@NotNull File jarFile,
|
||||
@NotNull JarOutputStream outputStream,
|
||||
BuildRecipe dependencies,
|
||||
@Nullable Set<String> writtenRelativePaths,
|
||||
@Nullable FileFilter fileFilter) throws IOException {
|
||||
// create temp jars, and add these into upper level jar
|
||||
// todo optimization: cache created jars
|
||||
@NonNls final String moduleName = getModule() == null ? "jar" : ModuleUtil.getModuleNameInReadAction(getModule());
|
||||
final File tempFile = File.createTempFile(moduleName+"___",TMP_FILE_SUFFIX);
|
||||
myTempJars.add(tempFile);
|
||||
makeJar(context, tempFile, fileFilter);
|
||||
|
||||
final String outputRelativePath = getOutputRelativePath();
|
||||
|
||||
File file = getJarFile();
|
||||
if (isExternalDependencyInstruction()) {
|
||||
// copy dependent file along with jar file
|
||||
final File toFile = DeploymentUtil.canonicalRelativePath(jarFile, outputRelativePath);
|
||||
DeploymentUtil.getInstance().copyFile(file, toFile, context, null, fileFilter);
|
||||
dependencies.addInstruction(this);
|
||||
}
|
||||
else {
|
||||
ZipUtil.addFileToZip(outputStream, file, outputRelativePath, writtenRelativePaths, fileFilter);
|
||||
}
|
||||
}
|
||||
|
||||
public void makeJar(@NotNull CompileContext context, @NotNull File jarFile, @Nullable FileFilter fileFilter) throws IOException {
|
||||
if (jarFile.equals(myJarFile)) return;
|
||||
if (myJarFile != null && myJarFile.exists()) {
|
||||
// optimization: file already jarred, copy it over
|
||||
DeploymentUtil.getInstance().copyFile(myJarFile, jarFile, context, null, fileFilter);
|
||||
}
|
||||
else {
|
||||
FileUtil.createParentDirs(jarFile);
|
||||
Manifest manifest = new Manifest();
|
||||
ManifestBuilder.setGlobalAttributes(manifest.getMainAttributes());
|
||||
|
||||
final JarOutputStream jarOutputStream = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(jarFile)), manifest);
|
||||
|
||||
try {
|
||||
final THashSet<String> writtenPaths = new THashSet<String>();
|
||||
writtenPaths.add(JarFile.MANIFEST_NAME);
|
||||
boolean ok = ZipUtil.addDirToZipRecursively(jarOutputStream, jarFile, getFile(), "", fileFilter, writtenPaths);
|
||||
if (!ok) {
|
||||
String dirPath = getFile().getPath();
|
||||
DeploymentUtil.reportRecursiveCopying(context, dirPath, jarFile.getPath(), "",
|
||||
CompilerBundle.message("message.text.setup.jar.outside.directory.path", dirPath));
|
||||
}
|
||||
}
|
||||
finally {
|
||||
jarOutputStream.close();
|
||||
}
|
||||
}
|
||||
myJarFile = jarFile;
|
||||
}
|
||||
|
||||
public boolean accept(BuildInstructionVisitor visitor) throws Exception {
|
||||
return visitor.visitJarAndCopyBuildInstruction(this);
|
||||
}
|
||||
@@ -121,12 +49,4 @@ public class JarAndCopyBuildInstructionImpl extends FileCopyInstructionImpl impl
|
||||
return "JAR and copy: " + getFile() + "->"+getOutputRelativePath();
|
||||
}
|
||||
|
||||
public File getJarFile() {
|
||||
return myJarFile;
|
||||
}
|
||||
|
||||
public void deleteTemporaryJars() {
|
||||
FileUtil.asyncDelete(myTempJars);
|
||||
myTempJars.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.compiler.impl.packagingCompiler;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
@@ -31,17 +30,11 @@ public class JarInfo {
|
||||
private List<Pair<String, VirtualFile>> myPackedFiles;
|
||||
private LinkedHashSet<Pair<String, JarInfo>> myPackedJars;
|
||||
private List<DestinationInfo> myDestinations;
|
||||
private List<String> myClasspath;
|
||||
|
||||
public JarInfo() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public JarInfo(List<String> classpath) {
|
||||
myDestinations = new ArrayList<DestinationInfo>();
|
||||
myPackedFiles = new ArrayList<Pair<String, VirtualFile>>();
|
||||
myPackedJars = new LinkedHashSet<Pair<String, JarInfo>>();
|
||||
myClasspath = classpath;
|
||||
}
|
||||
|
||||
public void addDestination(DestinationInfo info) {
|
||||
@@ -74,11 +67,6 @@ public class JarInfo {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public List<String> getClasspath() {
|
||||
return myClasspath;
|
||||
}
|
||||
|
||||
public List<DestinationInfo> getAllDestinations() {
|
||||
return myDestinations;
|
||||
}
|
||||
|
||||
+3
-9
@@ -20,7 +20,6 @@ import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.CompilerBundle;
|
||||
import com.intellij.openapi.compiler.CompilerMessageCategory;
|
||||
import com.intellij.openapi.deployment.DeploymentUtil;
|
||||
import com.intellij.openapi.deployment.DeploymentUtilImpl;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
@@ -162,19 +161,14 @@ public class JarsBuilder {
|
||||
File jarFile = createTempFile();
|
||||
myBuiltJars.put(jar, jarFile);
|
||||
|
||||
Manifest manifest = createManifest(jar);
|
||||
DeploymentUtilImpl.setManifestAttributes(manifest.getMainAttributes(), jar.getClasspath());
|
||||
Manifest manifest = null;
|
||||
final JarOutputStream jarOutputStream = createJarOutputStream(jarFile, manifest);
|
||||
|
||||
try {
|
||||
final THashSet<String> writtenPaths = new THashSet<String>();
|
||||
writtenPaths.add(JarFile.MANIFEST_NAME);
|
||||
for (Pair<String, VirtualFile> pair : jar.getPackedFiles()) {
|
||||
File file = VfsUtil.virtualToIoFile(pair.getSecond());
|
||||
String relativePath = pair.getFirst();
|
||||
if (!JarFile.MANIFEST_NAME.equalsIgnoreCase(relativePath)) {
|
||||
addFileToJar(jarOutputStream, file, relativePath, writtenPaths);
|
||||
}
|
||||
addFileToJar(jarOutputStream, file, pair.getFirst(), writtenPaths);
|
||||
}
|
||||
|
||||
for (Pair<String, JarInfo> nestedJar : jar.getPackedJars()) {
|
||||
@@ -198,7 +192,7 @@ public class JarsBuilder {
|
||||
|
||||
protected JarOutputStream createJarOutputStream(final File jarFile, final Manifest manifest) throws IOException {
|
||||
FileUtil.createParentDirs(jarFile);
|
||||
return new JarOutputStream(new BufferedOutputStream(new FileOutputStream(jarFile)), manifest);
|
||||
return new JarOutputStream(new BufferedOutputStream(new FileOutputStream(jarFile)));
|
||||
}
|
||||
|
||||
protected File createTempFile() throws IOException {
|
||||
|
||||
+3
-6
@@ -16,14 +16,12 @@
|
||||
package com.intellij.compiler.impl.packagingCompiler;
|
||||
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.compiler.make.BuildParticipant;
|
||||
import com.intellij.openapi.compiler.make.BuildConfiguration;
|
||||
import com.intellij.openapi.compiler.make.BuildParticipant;
|
||||
import com.intellij.openapi.compiler.make.BuildRecipe;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.deployment.DeploymentUtilImpl;
|
||||
import com.intellij.openapi.util.MultiValuesMap;
|
||||
import com.intellij.packaging.impl.compiler.ArtifactPackagingProcessingItem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -72,8 +70,7 @@ public class OldProcessingItemsBuilderContext extends ProcessingItemsBuilderCont
|
||||
JarInfo jarInfo = getCachedJar(buildConfiguration);
|
||||
boolean addJarContent = jarInfo == null;
|
||||
if (jarInfo == null) {
|
||||
List<String> classpath = DeploymentUtilImpl.getExternalDependenciesClasspath(buildRecipe);
|
||||
jarInfo = new JarInfo(classpath);
|
||||
jarInfo = new JarInfo();
|
||||
putCachedJar(buildConfiguration, jarInfo);
|
||||
}
|
||||
jarInfo.addDestination(destinationInfo);
|
||||
|
||||
-34
@@ -274,40 +274,6 @@ public class ProcessingItemsBuilder extends BuildInstructionVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean visitCompoundBuildInstruction(final CompoundBuildInstruction instruction) throws Exception {
|
||||
String outputPath = DeploymentUtil.appendToPath(myOutputPaths.peek(), instruction.getOutputRelativePath());
|
||||
myOutputPaths.push(outputPath);
|
||||
BuildRecipe childInstructions = instruction.getChildInstructions(myContext.getCompileContext());
|
||||
NestedJarInfo oldNestedJar = null;
|
||||
if (myNestedJars != null) {
|
||||
if (instruction.isExternalDependencyInstruction()) {
|
||||
oldNestedJar = myNestedJars.pop();
|
||||
}
|
||||
DestinationInfo destinationInfo;
|
||||
if (!myNestedJars.isEmpty()) {
|
||||
NestedJarInfo nestedJar = myNestedJars.peek();
|
||||
destinationInfo = new JarDestinationInfo(trimParentPrefix(instruction.getOutputRelativePath()), nestedJar.myJarInfo, nestedJar.myDestination);
|
||||
}
|
||||
else {
|
||||
String jarPath = getCanonicalConcat(myBuildConfiguration.getJarPath(), instruction.getOutputRelativePath());
|
||||
destinationInfo = createExplodedDestination(jarPath);
|
||||
}
|
||||
myNestedJars.push(myContext.createNestedJarInfo(destinationInfo, instruction.getBuildProperties(), childInstructions));
|
||||
}
|
||||
|
||||
buildItems(childInstructions);
|
||||
|
||||
if (myNestedJars != null) {
|
||||
myNestedJars.pop();
|
||||
if (oldNestedJar != null) {
|
||||
myNestedJars.push(oldNestedJar);
|
||||
}
|
||||
}
|
||||
myOutputPaths.pop();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static class NestedJarInfo {
|
||||
private final JarInfo myJarInfo;
|
||||
private final DestinationInfo myDestination;
|
||||
|
||||
@@ -37,15 +37,4 @@ public abstract class ExplodedAndJarBuildGenerator {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ZipFileSet[] generateTagsForJarTarget(@NotNull BuildInstruction instruction, @NotNull ExplodedAndJarTargetParameters parameters,
|
||||
final Ref<Boolean> tempDirUsed) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Tag[] generateJarBuildPrepareTags(@NotNull BuildInstruction instruction, @NotNull ExplodedAndJarTargetParameters parameters) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.intellij.openapi.module.ModuleUtil;
|
||||
import com.intellij.openapi.roots.*;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -48,8 +47,6 @@ import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.jar.Attributes;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
/**
|
||||
* @author Alexey Kudravtsev
|
||||
@@ -285,18 +282,6 @@ public class DeploymentUtilImpl extends DeploymentUtil {
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
public @Nullable File findUserSuppliedManifestFile(@NotNull BuildRecipe buildRecipe) {
|
||||
final Ref<File> ref = Ref.create(null);
|
||||
buildRecipe.visitInstructions(new BuildInstructionVisitor() {
|
||||
public boolean visitInstruction(BuildInstruction instruction) throws Exception {
|
||||
final File file = instruction.findFileByRelativePath(JarFile.MANIFEST_NAME);
|
||||
ref.set(file);
|
||||
return file == null;
|
||||
}
|
||||
}, false);
|
||||
return ref.get();
|
||||
}
|
||||
|
||||
public void checkConfigFile(final ConfigFile descriptor, final CompileContext compileContext, final Module module) {
|
||||
if (new File(VfsUtil.urlToPath(descriptor.getUrl())).exists()) {
|
||||
String message = getConfigFileErrorMessage(descriptor);
|
||||
@@ -312,17 +297,6 @@ public class DeploymentUtilImpl extends DeploymentUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public @Nullable Manifest createManifest(@NotNull BuildRecipe buildRecipe) {
|
||||
if (findUserSuppliedManifestFile(buildRecipe) != null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final List<String> classpathElements = getExternalDependenciesClasspath(buildRecipe);
|
||||
final Manifest manifest = new Manifest();
|
||||
setManifestAttributes(manifest.getMainAttributes(), classpathElements);
|
||||
return manifest;
|
||||
}
|
||||
|
||||
public static void setManifestAttributes(final Attributes mainAttributes, final @Nullable List<String> classpathElements) {
|
||||
if (classpathElements != null && classpathElements.size() > 0) {
|
||||
StringBuilder builder;
|
||||
|
||||
@@ -22,7 +22,6 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryEx;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.roots.ui.configuration.FacetsProvider;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
@@ -40,13 +39,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class LibraryLinkImpl extends LibraryLink {
|
||||
private static final Map<PackagingMethod, String> methodToDescriptionForDirs = new HashMap<PackagingMethod, String>();
|
||||
private static final Map<PackagingMethod, String> methodToDescriptionForFiles = new HashMap<PackagingMethod, String>();
|
||||
@NonNls public static final String LEVEL_ATTRIBUTE_NAME = "level";
|
||||
@NonNls public static final String URL_ELEMENT_NAME = "url";
|
||||
@NonNls private static final String TEMP_ELEMENT_NAME = "temp";
|
||||
@@ -54,17 +49,6 @@ public class LibraryLinkImpl extends LibraryLink {
|
||||
|
||||
@NonNls private static final String JAR_SUFFIX = ".jar";
|
||||
|
||||
static {
|
||||
methodToDescriptionForDirs.put(PackagingMethod.DO_NOT_PACKAGE, CompilerBundle.message("packaging.method.description.do.not.package"));
|
||||
methodToDescriptionForDirs.put(PackagingMethod.COPY_FILES, CompilerBundle.message("packaging.method.description.copy.directories"));
|
||||
methodToDescriptionForDirs.put(PackagingMethod.JAR_AND_COPY_FILE, CompilerBundle.message("packaging.method.description.jar.and.copy.file"));
|
||||
methodToDescriptionForDirs.put(PackagingMethod.JAR_AND_COPY_FILE_AND_LINK_VIA_MANIFEST, CompilerBundle.message("packaging.method.description.jar.and.copy.file.and.link.via.manifest"));
|
||||
|
||||
methodToDescriptionForFiles.put(PackagingMethod.DO_NOT_PACKAGE, CompilerBundle.message("packaging.method.description.do.not.package"));
|
||||
methodToDescriptionForFiles.put(PackagingMethod.COPY_FILES, CompilerBundle.message("packaging.method.description.copy.files"));
|
||||
methodToDescriptionForFiles.put(PackagingMethod.COPY_FILES_AND_LINK_VIA_MANIFEST, CompilerBundle.message("packaging.method.description.copy.files.and.link.via.manifest"));
|
||||
}
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.deployment.LibraryLink");
|
||||
private LibraryInfo myLibraryInfo;
|
||||
private final Project myProject;
|
||||
@@ -137,26 +121,6 @@ public class LibraryLinkImpl extends LibraryLink {
|
||||
return FileUtil.toSystemDependentName(path);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
String levelName = myLibraryInfo.getLevel();
|
||||
if (levelName.equals(MODULE_LEVEL)) {
|
||||
return CompilerBundle.message("library.link.description.module.library");
|
||||
}
|
||||
final LibraryTable table = findTable(levelName, myProject);
|
||||
return table == null ? "???" : table.getPresentation().getDisplayName(false);
|
||||
}
|
||||
|
||||
public String getDescriptionForPackagingMethod(PackagingMethod method) {
|
||||
if (hasDirectoriesOnly()) {
|
||||
final String text = methodToDescriptionForDirs.get(method);
|
||||
return text != null ? text : methodToDescriptionForFiles.get(method);
|
||||
}
|
||||
else {
|
||||
final String text = methodToDescriptionForFiles.get(method);
|
||||
return text != null ? text : methodToDescriptionForDirs.get(method);
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getUrls() {
|
||||
fixLibraryInfo();
|
||||
return myLibraryInfo.getUrls();
|
||||
|
||||
@@ -29,11 +29,8 @@ import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class ModuleLinkImpl extends ModuleLink {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.deployment.ModuleLink");
|
||||
@@ -41,15 +38,6 @@ public class ModuleLinkImpl extends ModuleLink {
|
||||
@NonNls private static final String TEMP_ELEMENT_NAME = "temp";
|
||||
private Module myModule;
|
||||
private String myModuleName;
|
||||
private static final Map<PackagingMethod, String> methodToDescription = new HashMap<PackagingMethod, String>();
|
||||
|
||||
static {
|
||||
methodToDescription.put(PackagingMethod.DO_NOT_PACKAGE, CompilerBundle.message("packaging.method.description.do.not.package"));
|
||||
methodToDescription.put(PackagingMethod.COPY_FILES, CompilerBundle.message("packaging.method.description.copy.module.output"));
|
||||
methodToDescription.put(PackagingMethod.JAR_AND_COPY_FILE, CompilerBundle.message("packaging.method.description.jar.module.and.copy"));
|
||||
methodToDescription.put(PackagingMethod.JAR_AND_COPY_FILE_AND_LINK_VIA_MANIFEST, CompilerBundle.message("packaging.method.description.jar.module.link.via.manifest.and.copy"));
|
||||
methodToDescription.put(PackagingMethod.INCLUDE_MODULE_IN_BUILD, CompilerBundle.message("packaging.method.description.include.module.in.build"));
|
||||
}
|
||||
|
||||
public ModuleLinkImpl(@NotNull Module module, @NotNull Module parentModule) {
|
||||
super(parentModule);
|
||||
@@ -99,15 +87,6 @@ public class ModuleLinkImpl extends ModuleLink {
|
||||
return getName();
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
final Module module = getModule();
|
||||
return module == null ? "" : module.getModuleType().getName();
|
||||
}
|
||||
|
||||
public String getDescriptionForPackagingMethod(PackagingMethod method) {
|
||||
return methodToDescription.get(method);
|
||||
}
|
||||
|
||||
public boolean resolveElement(ModulesProvider provider, final FacetsProvider facetsProvider) {
|
||||
return getModule(provider) != null;
|
||||
}
|
||||
|
||||
@@ -1,103 +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.openapi.deployment;
|
||||
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.util.JDOMExternalizer;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author cdr
|
||||
* @deprecated
|
||||
*/
|
||||
class OrderEntryInfo implements JDOMExternalizable {
|
||||
public boolean copy;
|
||||
public String URI="";
|
||||
private final Map<String,String> attributes = new HashMap<String, String>();
|
||||
@NonNls protected static final String ATTRIBUTE_ELEMENT_NAME = "attribute";
|
||||
@NonNls protected static final String NAME_ATTR_NAME = "name";
|
||||
@NonNls protected static final String VALUE_ATTR_NAME = "value";
|
||||
@NonNls protected static final String ATTRIBUTES_ELEMENT_NAME = "attributes";
|
||||
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
JDOMExternalizer.write(element,"copy",copy);
|
||||
JDOMExternalizer.write(element,"URI",URI);
|
||||
writeAttributes(element);
|
||||
}
|
||||
|
||||
private void writeAttributes(Element element) {
|
||||
if (attributes.size() == 0) return;
|
||||
Element root = new Element(ATTRIBUTES_ELEMENT_NAME);
|
||||
element.addContent(root);
|
||||
Set<String> names = attributes.keySet();
|
||||
for (String name : names) {
|
||||
String value = attributes.get(name);
|
||||
Element attr = new Element(ATTRIBUTE_ELEMENT_NAME);
|
||||
attr.setAttribute(NAME_ATTR_NAME, name);
|
||||
attr.setAttribute(VALUE_ATTR_NAME, value);
|
||||
root.addContent(attr);
|
||||
}
|
||||
}
|
||||
private void readAttributes(Element element) {
|
||||
Element attrs = element.getChild(ATTRIBUTES_ELEMENT_NAME);
|
||||
if (attrs == null) return;
|
||||
List roots = attrs.getChildren(ATTRIBUTE_ELEMENT_NAME);
|
||||
if (roots.size() == 0) return;
|
||||
for (Object root : roots) {
|
||||
Element attr = (Element)root;
|
||||
String name = attr.getAttributeValue(NAME_ATTR_NAME);
|
||||
String value = attr.getAttributeValue(VALUE_ATTR_NAME);
|
||||
attributes.put(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
copy = JDOMExternalizer.readBoolean(element,"copy");
|
||||
URI = JDOMExternalizer.readString(element,"URI");
|
||||
readAttributes(element);
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (!(o instanceof OrderEntryInfo)) return false;
|
||||
|
||||
final OrderEntryInfo orderEntryInfo = (OrderEntryInfo)o;
|
||||
|
||||
if (copy != orderEntryInfo.copy) return false;
|
||||
if (URI != null ? !URI.equals(orderEntryInfo.URI) : orderEntryInfo.URI != null) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int result;
|
||||
result = copy ? 1 : 0;
|
||||
result = 29 * result + (URI != null ? URI.hashCode() : 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map<String, String> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
}
|
||||
-207
@@ -1,207 +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.openapi.deployment;
|
||||
|
||||
import com.intellij.facet.impl.DefaultFacetsProvider;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.ui.configuration.DefaultModulesProvider;
|
||||
import com.intellij.openapi.roots.ui.configuration.FacetsProvider;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Alexey Kudravtsev
|
||||
*/
|
||||
public class PackagingConfigurationImpl implements PackagingConfiguration {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.javaee.module.J2EEModuleContainerImpl");
|
||||
protected ModulesProvider myDefaultModulesProvider;
|
||||
protected final Module myParentModule;
|
||||
protected final Set<ContainerElement> myContents = new LinkedHashSet<ContainerElement>();
|
||||
|
||||
@NonNls public static final String TYPE_ATTRIBUTE_NAME = "type";
|
||||
@NonNls public static final String CONTAINER_ELEMENT_NAME = "containerElement";
|
||||
@NonNls public static final String MODULE_TYPE = "module";
|
||||
@NonNls public static final String LIBRARY_TYPE = "library";
|
||||
public static final TObjectHashingStrategy<ContainerElement> IGNORING_ATTRIBUTES_EQUALITY = new ElementIgnoringAttributesEquality();
|
||||
|
||||
public PackagingConfigurationImpl(@NotNull Module module) {
|
||||
myParentModule = module;
|
||||
myDefaultModulesProvider = new DefaultModulesProvider(module.getProject());
|
||||
}
|
||||
|
||||
public PackagingConfigurationImpl createNewInstance() {
|
||||
return new PackagingConfigurationImpl(myParentModule);
|
||||
}
|
||||
|
||||
public void removeLibrary(final Library library) {
|
||||
for (ContainerElement content : myContents) {
|
||||
if (content instanceof LibraryLink && library.equals(((LibraryLink)content).getLibrary())) {
|
||||
removeContainerElement(content);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
clearContainer();
|
||||
LOG.assertTrue(myParentModule != null);
|
||||
|
||||
final List<Element> children = element.getChildren(CONTAINER_ELEMENT_NAME);
|
||||
for (Element child : children) {
|
||||
final String type = child.getAttributeValue(TYPE_ATTRIBUTE_NAME);
|
||||
ContainerElement containerElement;
|
||||
containerElement = createElement(child, myParentModule, type);
|
||||
|
||||
containerElement.readExternal(child);
|
||||
|
||||
addElement(containerElement);
|
||||
}
|
||||
}
|
||||
|
||||
protected ContainerElement createElement(final @NotNull Element child, final @NotNull Module module, final String type) throws InvalidDataException {
|
||||
if (MODULE_TYPE.equals(type)) {
|
||||
return new ModuleLinkImpl((String)null, module);
|
||||
}
|
||||
else if (LIBRARY_TYPE.equals(type)) {
|
||||
return new LibraryLinkImpl(null, module);
|
||||
}
|
||||
else {
|
||||
throw new InvalidDataException("invalid type: " + type + " " + child);
|
||||
}
|
||||
}
|
||||
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
for (final ContainerElement containerElement : myContents) {
|
||||
final Element child = new Element(CONTAINER_ELEMENT_NAME);
|
||||
final String type = getElementType(containerElement);
|
||||
child.setAttribute(TYPE_ATTRIBUTE_NAME, type);
|
||||
containerElement.writeExternal(child);
|
||||
element.addContent(child);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getElementType(final ContainerElement containerElement) throws WriteExternalException {
|
||||
if (containerElement instanceof ModuleLink) {
|
||||
return MODULE_TYPE;
|
||||
}
|
||||
else if (containerElement instanceof LibraryLink) {
|
||||
return LIBRARY_TYPE;
|
||||
}
|
||||
else {
|
||||
throw new WriteExternalException("invalid type: " + containerElement);
|
||||
}
|
||||
}
|
||||
|
||||
public ModuleLink[] getContainingModules() {
|
||||
|
||||
final List<ModuleLink> moduleLinks = new ArrayList<ModuleLink>();
|
||||
|
||||
ContainerElement[] elements = getElements();
|
||||
for (ContainerElement element : elements) {
|
||||
if (element instanceof ModuleLink) {
|
||||
moduleLinks.add((ModuleLink)element);
|
||||
}
|
||||
}
|
||||
|
||||
return moduleLinks.toArray(new ModuleLink[moduleLinks.size()]);
|
||||
}
|
||||
|
||||
public LibraryLink[] getContainingLibraries() {
|
||||
final List<LibraryLink> libraryLinks = new ArrayList<LibraryLink>();
|
||||
ContainerElement[] elements = getElements();
|
||||
for (ContainerElement element : elements) {
|
||||
if (element instanceof LibraryLink) {
|
||||
libraryLinks.add((LibraryLink)element);
|
||||
}
|
||||
}
|
||||
return libraryLinks.toArray(new LibraryLink[libraryLinks.size()]);
|
||||
}
|
||||
|
||||
public ContainerElement[] getElements() {
|
||||
return getElements(myDefaultModulesProvider, DefaultFacetsProvider.INSTANCE, true, false, false);
|
||||
}
|
||||
|
||||
public ContainerElement[] getElements(ModulesProvider provider, final FacetsProvider facetsProvider,
|
||||
final boolean includeResolved, final boolean includeUnresolved, final boolean includeNonPackaged) {
|
||||
ArrayList<ContainerElement> result = new ArrayList<ContainerElement>();
|
||||
for (final ContainerElement containerElement : myContents) {
|
||||
final boolean resolved = containerElement.resolveElement(provider, facetsProvider);
|
||||
if ((resolved && includeResolved || !resolved && includeUnresolved)
|
||||
&& (includeNonPackaged || containerElement.getPackagingMethod() != PackagingMethod.DO_NOT_PACKAGE)) {
|
||||
result.add(containerElement);
|
||||
}
|
||||
}
|
||||
return result.toArray(new ContainerElement[result.size()]);
|
||||
}
|
||||
|
||||
public void setElements(ContainerElement[] elements) {
|
||||
clearContainer();
|
||||
myContents.addAll(Arrays.asList(elements));
|
||||
}
|
||||
|
||||
protected void removeModuleLinkInternal(Module module) {
|
||||
for (final ContainerElement containerElement : myContents) {
|
||||
if (containerElement instanceof ModuleLink && ((ModuleLink)containerElement).getModule() == module) {
|
||||
removeContainerElement(containerElement);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removeContainerElement(final ContainerElement containerElement) {
|
||||
return myContents.remove(containerElement);
|
||||
}
|
||||
|
||||
public Module[] getContainingIdeaModules() {
|
||||
ModuleLink[] containingModules = getContainingModules();
|
||||
List<Module> result = new ArrayList<Module>(containingModules.length);
|
||||
for (ModuleLink containingModule : containingModules) {
|
||||
final Module module = containingModule.getModule();
|
||||
if (module != null) {
|
||||
result.add(module);
|
||||
}
|
||||
}
|
||||
return result.toArray(new Module[result.size()]);
|
||||
}
|
||||
|
||||
protected void clearContainer() {
|
||||
myContents.clear();
|
||||
}
|
||||
|
||||
public void addOrReplaceElement(final ContainerElement element) {
|
||||
for (Iterator<ContainerElement> it = myContents.iterator(); it.hasNext();) {
|
||||
ContainerElement content = it.next();
|
||||
if (content.equalsIgnoreAttributes(element)) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
addElement(element);
|
||||
}
|
||||
|
||||
public void addElement(ContainerElement element) {
|
||||
myContents.add(element);
|
||||
}
|
||||
|
||||
}
|
||||
+7
-41
@@ -15,17 +15,16 @@
|
||||
*/
|
||||
package com.intellij.packaging.impl.compiler;
|
||||
|
||||
import com.intellij.compiler.impl.CompilerUtil;
|
||||
import com.intellij.compiler.CompilerManagerImpl;
|
||||
import com.intellij.compiler.impl.CompilerCacheManager;
|
||||
import com.intellij.compiler.impl.CompilerUtil;
|
||||
import com.intellij.compiler.impl.FileProcessingCompilerStateCache;
|
||||
import com.intellij.compiler.impl.packagingCompiler.*;
|
||||
import com.intellij.compiler.CompilerManagerImpl;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.compiler.*;
|
||||
import com.intellij.openapi.deployment.DeploymentUtil;
|
||||
import com.intellij.openapi.deployment.DeploymentUtilImpl;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -52,9 +51,11 @@ import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.DataInput;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -291,8 +292,6 @@ public class IncrementalArtifactsCompiler implements PackagingCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
createManifestFiles(builderContext.getManifestFiles());
|
||||
|
||||
JarsBuilder builder = new JarsBuilder(changedJars, fileFilter, context);
|
||||
final boolean processed = builder.buildJars(writtenPaths);
|
||||
if (!processed) {
|
||||
@@ -330,39 +329,6 @@ public class IncrementalArtifactsCompiler implements PackagingCompiler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void createManifestFiles(final List<ManifestFileInfo> manifestFileInfos) throws IOException {
|
||||
for (ManifestFileInfo manifestFileInfo : manifestFileInfos) {
|
||||
File outputFile = new File(FileUtil.toSystemDependentName(manifestFileInfo.getOutputPath()));
|
||||
Manifest manifest;
|
||||
if (outputFile.exists()) {
|
||||
FileInputStream stream = new FileInputStream(outputFile);
|
||||
try {
|
||||
manifest = new Manifest(stream);
|
||||
}
|
||||
finally {
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
else {
|
||||
manifest = new Manifest();
|
||||
}
|
||||
|
||||
DeploymentUtilImpl.setManifestAttributes(manifest.getMainAttributes(), manifestFileInfo.getClasspath());
|
||||
|
||||
FileUtil.createParentDirs(outputFile);
|
||||
FileOutputStream out = null;
|
||||
try {
|
||||
out = new FileOutputStream(outputFile);
|
||||
manifest.write(out);
|
||||
}
|
||||
finally {
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void processDestinations(final List<ArtifactPackagingProcessingItem> items) {
|
||||
for (ArtifactPackagingProcessingItem item : items) {
|
||||
item.setProcessed();
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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.impl.elements;
|
||||
|
||||
import com.intellij.openapi.compiler.CompilerBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.packaging.elements.CompositePackagingElementType;
|
||||
import com.intellij.packaging.elements.PackagingElement;
|
||||
import com.intellij.packaging.impl.ui.properties.ArchiveElementPropertiesPanel;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.packaging.ui.PackagingElementPropertiesPanel;
|
||||
import com.intellij.util.Icons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
class ArchiveElementType extends CompositePackagingElementType<ArchivePackagingElement> {
|
||||
ArchiveElementType() {
|
||||
super("archive", CompilerBundle.message("element.type.name.archive"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getCreateElementIcon() {
|
||||
return Icons.JAR_ICON;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ArchivePackagingElement createEmpty(@NotNull Project project) {
|
||||
return new ArchivePackagingElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackagingElementPropertiesPanel createElementPropertiesPanel(@NotNull ArchivePackagingElement element,
|
||||
@NotNull ArtifactEditorContext context) {
|
||||
final String name = element.getArchiveFileName();
|
||||
if (name.length() >= 4 && name.charAt(name.length() - 4) == '.' && StringUtil.endsWithIgnoreCase(name, "ar")) {
|
||||
return new ArchiveElementPropertiesPanel(element, context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PackagingElement<?> createComposite(@NotNull ArtifactEditorContext context, CompositePackagingElement<?> parent) {
|
||||
final String initialValue = PackagingElementFactoryImpl.suggestFileName(parent, "archive", ".jar");
|
||||
final String path = Messages.showInputDialog(context.getProject(), "Enter archive name: ", "New Archive", null, initialValue, new FilePathValidator());
|
||||
if (path == null) return null;
|
||||
return PackagingElementFactoryImpl.createDirectoryOrArchiveWithParents(path, true);
|
||||
}
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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.impl.elements;
|
||||
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElementType;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class DirectoryCopyElementType extends PackagingElementType<DirectoryCopyPackagingElement> {
|
||||
public static final Icon COPY_OF_FOLDER_ICON = IconLoader.getIcon("/nodes/copyOfFolder.png");
|
||||
|
||||
DirectoryCopyElementType() {
|
||||
super("dir-copy", "Directory Content");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getCreateElementIcon() {
|
||||
return COPY_OF_FOLDER_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<? extends DirectoryCopyPackagingElement> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
|
||||
@NotNull CompositePackagingElement<?> parent) {
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, true);
|
||||
final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, context.getProject());
|
||||
final VirtualFile[] files = chooser.choose(null, context.getProject());
|
||||
final List<DirectoryCopyPackagingElement> list = new ArrayList<DirectoryCopyPackagingElement>();
|
||||
for (VirtualFile file : files) {
|
||||
list.add(new DirectoryCopyPackagingElement(file.getPath()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DirectoryCopyPackagingElement createEmpty(@NotNull Project project) {
|
||||
return new DirectoryCopyPackagingElement();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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.impl.elements;
|
||||
|
||||
import com.intellij.openapi.compiler.CompilerBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.packaging.elements.CompositePackagingElementType;
|
||||
import com.intellij.packaging.elements.PackagingElement;
|
||||
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
|
||||
import com.intellij.packaging.impl.ui.properties.DirectoryElementPropertiesPanel;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.packaging.ui.PackagingElementPropertiesPanel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
class DirectoryElementType extends CompositePackagingElementType<DirectoryPackagingElement> {
|
||||
private static final Icon ICON = IconLoader.getIcon("/actions/newFolder.png");
|
||||
|
||||
DirectoryElementType() {
|
||||
super("directory", CompilerBundle.message("element.type.name.directory"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getCreateElementIcon() {
|
||||
return ICON;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DirectoryPackagingElement createEmpty(@NotNull Project project) {
|
||||
return new DirectoryPackagingElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackagingElementPropertiesPanel createElementPropertiesPanel(@NotNull DirectoryPackagingElement element,
|
||||
@NotNull ArtifactEditorContext context) {
|
||||
if (ArtifactUtil.isArchiveName(element.getDirectoryName())) {
|
||||
return new DirectoryElementPropertiesPanel(element, context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public PackagingElement<?> createComposite(@NotNull ArtifactEditorContext context, CompositePackagingElement<?> parent) {
|
||||
final String initialValue = PackagingElementFactoryImpl.suggestFileName(parent, "folder", "");
|
||||
String path = Messages.showInputDialog(context.getProject(), "Enter directory name: ", "New Directory", null, initialValue, new FilePathValidator());
|
||||
if (path == null) return null;
|
||||
return PackagingElementFactoryImpl.createDirectoryOrArchiveWithParents(path, false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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.impl.elements;
|
||||
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.elements.CompositePackagingElement;
|
||||
import com.intellij.packaging.elements.PackagingElementType;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class FileCopyElementType extends PackagingElementType<FileCopyPackagingElement> {
|
||||
public static final Icon ICON = IconLoader.getIcon("/fileTypes/text.png");
|
||||
|
||||
FileCopyElementType() {
|
||||
super("file-copy", "File");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getCreateElementIcon() {
|
||||
return ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<? extends FileCopyPackagingElement> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
|
||||
@NotNull CompositePackagingElement<?> parent) {
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, true, true, false, true);
|
||||
final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, context.getProject());
|
||||
final VirtualFile[] files = chooser.choose(null, context.getProject());
|
||||
final List<FileCopyPackagingElement> list = new ArrayList<FileCopyPackagingElement>();
|
||||
for (VirtualFile file : files) {
|
||||
list.add(new FileCopyPackagingElement(file.getPath()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FileCopyPackagingElement createEmpty(@NotNull Project project) {
|
||||
return new FileCopyPackagingElement();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.impl.elements;
|
||||
|
||||
import com.intellij.openapi.ui.InputValidator;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.PathUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
class FilePathValidator implements InputValidator {
|
||||
public boolean checkInput(String inputString) {
|
||||
final List<String> fileNames = StringUtil.split(FileUtil.toSystemIndependentName(inputString), "/");
|
||||
if (fileNames.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
for (String fileName : fileNames) {
|
||||
if (!PathUtil.isValidFileName(fileName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean canClose(String inputString) {
|
||||
return checkInput(inputString);
|
||||
}
|
||||
}
|
||||
+7
-151
@@ -15,11 +15,7 @@
|
||||
*/
|
||||
package com.intellij.packaging.impl.elements;
|
||||
|
||||
import com.intellij.openapi.compiler.CompilerBundle;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
|
||||
import com.intellij.openapi.fileChooser.FileChooserDialog;
|
||||
import com.intellij.openapi.fileChooser.FileChooserFactory;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
@@ -27,27 +23,19 @@ import com.intellij.openapi.roots.impl.libraries.LibraryImpl;
|
||||
import com.intellij.openapi.roots.impl.libraries.LibraryTableImplUtil;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.roots.libraries.LibraryTable;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.openapi.util.IconLoader;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.artifacts.Artifact;
|
||||
import com.intellij.packaging.artifacts.ArtifactPointerManager;
|
||||
import com.intellij.packaging.elements.*;
|
||||
import com.intellij.packaging.impl.artifacts.ArtifactUtil;
|
||||
import com.intellij.packaging.impl.ui.properties.ArchiveElementPropertiesPanel;
|
||||
import com.intellij.packaging.impl.ui.properties.DirectoryElementPropertiesPanel;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.packaging.ui.PackagingElementPropertiesPanel;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Icons;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -229,7 +217,7 @@ public class PackagingElementFactoryImpl extends PackagingElementFactory {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static String suggestFileName(@NotNull CompositePackagingElement<?> parent, @NonNls @NotNull String prefix, @NonNls @NotNull String suffix) {
|
||||
public static String suggestFileName(@NotNull CompositePackagingElement<?> parent, @NonNls @NotNull String prefix, @NonNls @NotNull String suffix) {
|
||||
String name = prefix + suffix;
|
||||
int i = 2;
|
||||
while (findArchiveOrDirectoryByName(parent, name) != null) {
|
||||
@@ -282,144 +270,12 @@ public class PackagingElementFactoryImpl extends PackagingElementFactory {
|
||||
return Collections.singletonList(root);
|
||||
}
|
||||
|
||||
private static class DirectoryElementType extends CompositePackagingElementType<DirectoryPackagingElement> {
|
||||
private static final Icon ICON = IconLoader.getIcon("/actions/newFolder.png");
|
||||
|
||||
private DirectoryElementType() {
|
||||
super("directory", CompilerBundle.message("element.type.name.directory"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getCreateElementIcon() {
|
||||
return ICON;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DirectoryPackagingElement createEmpty(@NotNull Project project) {
|
||||
return new DirectoryPackagingElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackagingElementPropertiesPanel createElementPropertiesPanel(@NotNull DirectoryPackagingElement element,
|
||||
@NotNull ArtifactEditorContext context) {
|
||||
if (ArtifactUtil.isArchiveName(element.getDirectoryName())) {
|
||||
return new DirectoryElementPropertiesPanel(element, context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public DirectoryPackagingElement createComposite(@NotNull ArtifactEditorContext context, CompositePackagingElement<?> parent) {
|
||||
final String initialValue = suggestFileName(parent, "folder", "");
|
||||
final String name = Messages.showInputDialog(context.getProject(), "Enter directory name: ", "New Directory", null, initialValue, null);
|
||||
if (name == null) return null;
|
||||
return new DirectoryPackagingElement(name);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ArchiveElementType extends CompositePackagingElementType<ArchivePackagingElement> {
|
||||
private ArchiveElementType() {
|
||||
super("archive", CompilerBundle.message("element.type.name.archive"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getCreateElementIcon() {
|
||||
return Icons.JAR_ICON;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ArchivePackagingElement createEmpty(@NotNull Project project) {
|
||||
return new ArchivePackagingElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PackagingElementPropertiesPanel createElementPropertiesPanel(@NotNull ArchivePackagingElement element,
|
||||
@NotNull ArtifactEditorContext context) {
|
||||
final String name = element.getArchiveFileName();
|
||||
if (name.length() >= 4 && name.charAt(name.length() - 4) == '.' && StringUtil.endsWithIgnoreCase(name, "ar")) {
|
||||
return new ArchiveElementPropertiesPanel(element, context);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ArchivePackagingElement createComposite(@NotNull ArtifactEditorContext context, CompositePackagingElement<?> parent) {
|
||||
final String initialValue = suggestFileName(parent, "archive", ".jar");
|
||||
final String name = Messages.showInputDialog(context.getProject(), "Enter archive name: ", "New Archive", null, initialValue, null);
|
||||
if (name == null) return null;
|
||||
return new ArchivePackagingElement(name);
|
||||
}
|
||||
}
|
||||
|
||||
public static class FileCopyElementType extends PackagingElementType<FileCopyPackagingElement> {
|
||||
public static final Icon ICON = IconLoader.getIcon("/fileTypes/text.png");
|
||||
|
||||
private FileCopyElementType() {
|
||||
super("file-copy", "File");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getCreateElementIcon() {
|
||||
return ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<? extends FileCopyPackagingElement> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
|
||||
@NotNull CompositePackagingElement<?> parent) {
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, false, true, true, false, true);
|
||||
final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, context.getProject());
|
||||
final VirtualFile[] files = chooser.choose(null, context.getProject());
|
||||
final List<FileCopyPackagingElement> list = new ArrayList<FileCopyPackagingElement>();
|
||||
for (VirtualFile file : files) {
|
||||
list.add(new FileCopyPackagingElement(file.getPath()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FileCopyPackagingElement createEmpty(@NotNull Project project) {
|
||||
return new FileCopyPackagingElement();
|
||||
}
|
||||
}
|
||||
|
||||
public static class DirectoryCopyElementType extends PackagingElementType<DirectoryCopyPackagingElement> {
|
||||
public static final Icon COPY_OF_FOLDER_ICON = IconLoader.getIcon("/nodes/copyOfFolder.png");
|
||||
|
||||
private DirectoryCopyElementType() {
|
||||
super("dir-copy", "Directory Content");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getCreateElementIcon() {
|
||||
return COPY_OF_FOLDER_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<? extends DirectoryCopyPackagingElement> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
|
||||
@NotNull CompositePackagingElement<?> parent) {
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(false, true, false, false, false, true);
|
||||
final FileChooserDialog chooser = FileChooserFactory.getInstance().createFileChooser(descriptor, context.getProject());
|
||||
final VirtualFile[] files = chooser.choose(null, context.getProject());
|
||||
final List<DirectoryCopyPackagingElement> list = new ArrayList<DirectoryCopyPackagingElement>();
|
||||
for (VirtualFile file : files) {
|
||||
list.add(new DirectoryCopyPackagingElement(file.getPath()));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public DirectoryCopyPackagingElement createEmpty(@NotNull Project project) {
|
||||
return new DirectoryCopyPackagingElement();
|
||||
}
|
||||
public static PackagingElement<?> createDirectoryOrArchiveWithParents(@NotNull String path, final boolean archive) {
|
||||
path = FileUtil.toSystemIndependentName(path);
|
||||
final String parentPath = PathUtil.getParentPath(path);
|
||||
final String fileName = PathUtil.getFileName(path);
|
||||
final PackagingElement<?> element = archive ? new ArchivePackagingElement(fileName) : new DirectoryPackagingElement(fileName);
|
||||
return getInstance().createParentDirectories(parentPath, element);
|
||||
}
|
||||
|
||||
private static class ArtifactRootElementType extends PackagingElementType<ArtifactRootElement<?>> {
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ import com.intellij.openapi.compiler.CompilerBundle;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.impl.elements.PackagingElementFactoryImpl;
|
||||
import com.intellij.packaging.impl.elements.DirectoryCopyElementType;
|
||||
import com.intellij.packaging.ui.PackagingElementPresentation;
|
||||
import com.intellij.packaging.ui.PackagingElementWeights;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
@@ -56,7 +56,7 @@ public class DirectoryCopyPresentation extends PackagingElementPresentation {
|
||||
}
|
||||
|
||||
public void render(@NotNull PresentationData presentationData, SimpleTextAttributes mainAttributes, SimpleTextAttributes commentAttributes) {
|
||||
presentationData.setIcons(PackagingElementFactoryImpl.DirectoryCopyElementType.COPY_OF_FOLDER_ICON);
|
||||
presentationData.setIcons(DirectoryCopyElementType.COPY_OF_FOLDER_ICON);
|
||||
if (myFile == null || !myFile.isDirectory()) {
|
||||
mainAttributes = SimpleTextAttributes.ERROR_ATTRIBUTES;
|
||||
final VirtualFile parentFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(mySourcePath));
|
||||
|
||||
@@ -19,7 +19,7 @@ import com.intellij.ide.projectView.PresentationData;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.packaging.impl.elements.PackagingElementFactoryImpl;
|
||||
import com.intellij.packaging.impl.elements.FileCopyElementType;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.packaging.ui.PackagingElementPresentation;
|
||||
import com.intellij.packaging.ui.PackagingElementWeights;
|
||||
@@ -65,12 +65,12 @@ public class FileCopyPresentation extends PackagingElementPresentation {
|
||||
|
||||
public void render(@NotNull PresentationData presentationData, SimpleTextAttributes mainAttributes, SimpleTextAttributes commentAttributes) {
|
||||
if (myFile != null && !myFile.isDirectory() || myContext.isManifestFile(mySourcePath)) {
|
||||
presentationData.setIcons(myFile != null ? myFile.getIcon() : PackagingElementFactoryImpl.FileCopyElementType.ICON);
|
||||
presentationData.setIcons(myFile != null ? myFile.getIcon() : FileCopyElementType.ICON);
|
||||
presentationData.addText(myOutputFileName, mainAttributes);
|
||||
presentationData.addText(" (" + mySourcePath + ")", commentAttributes);
|
||||
}
|
||||
else {
|
||||
presentationData.setIcons(PackagingElementFactoryImpl.FileCopyElementType.ICON);
|
||||
presentationData.setIcons(FileCopyElementType.ICON);
|
||||
presentationData.addText(myOutputFileName, SimpleTextAttributes.ERROR_ATTRIBUTES);
|
||||
final VirtualFile parentFile = LocalFileSystem.getInstance().findFileByPath(FileUtil.toSystemIndependentName(mySourcePath));
|
||||
presentationData.addText("(" + mySourcePath + ")",
|
||||
|
||||
@@ -37,8 +37,6 @@ public abstract class BuildTargetsFactory {
|
||||
|
||||
public abstract Target createBuildExplodedTarget(ExplodedAndJarTargetParameters parameters, BuildRecipe buildRecipe, String description);
|
||||
|
||||
public abstract Target createBuildJarTarget(ExplodedAndJarTargetParameters parameters, BuildRecipe buildRecipe, String description);
|
||||
|
||||
public abstract Generator createComment(String comment);
|
||||
|
||||
//for test
|
||||
|
||||
-37
@@ -1,37 +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 org.jetbrains.annotations.NonNls;
|
||||
import com.intellij.openapi.compiler.make.CompoundBuildInstruction;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public abstract class CompoundBuildInstructionNaming {
|
||||
@NonNls
|
||||
public abstract String getBuildExplodedTargetName(CompoundBuildInstruction instruction);
|
||||
|
||||
@NonNls
|
||||
public abstract String getBuildJarTargetName(CompoundBuildInstruction instruction);
|
||||
|
||||
@NonNls
|
||||
public abstract String getExplodedPathProperty(CompoundBuildInstruction instruction);
|
||||
|
||||
@NonNls
|
||||
public abstract String getJarPathProperty(CompoundBuildInstruction instruction);
|
||||
}
|
||||
+6
-17
@@ -17,7 +17,6 @@
|
||||
package com.intellij.compiler.ant;
|
||||
|
||||
import com.intellij.openapi.compiler.make.BuildConfiguration;
|
||||
import com.intellij.openapi.compiler.make.CompoundBuildInstruction;
|
||||
import com.intellij.openapi.module.Module;
|
||||
|
||||
/**
|
||||
@@ -34,19 +33,13 @@ public class ExplodedAndJarTargetParameters {
|
||||
private final String myExplodedPathProperty;
|
||||
private final String myJarPathProperty;
|
||||
private final BuildConfiguration myBuildConfiguration;
|
||||
private final CompoundBuildInstructionNaming myCompoundBuildInstructionNaming;
|
||||
|
||||
public ExplodedAndJarTargetParameters(final ModuleChunk chunk,
|
||||
final Module containingModule,
|
||||
final GenerationOptions generationOptions,
|
||||
final BuildConfiguration buildConfiguration,
|
||||
final String explodedPathParameter,
|
||||
final String jarPathParameter,
|
||||
final String buildExplodedTargetName,
|
||||
final String buildJarTargetName,
|
||||
final String explodedPathProperty,
|
||||
final String jarPathProperty, final CompoundBuildInstructionNaming compoundBuildInstructionNaming) {
|
||||
myCompoundBuildInstructionNaming = compoundBuildInstructionNaming;
|
||||
public ExplodedAndJarTargetParameters(final ModuleChunk chunk, final Module containingModule, final GenerationOptions generationOptions,
|
||||
final BuildConfiguration buildConfiguration, final String explodedPathParameter, final String jarPathParameter,
|
||||
final String buildExplodedTargetName,
|
||||
final String buildJarTargetName,
|
||||
final String explodedPathProperty,
|
||||
final String jarPathProperty) {
|
||||
myBuildConfiguration = buildConfiguration;
|
||||
myChunk = chunk;
|
||||
myContainingModule = containingModule;
|
||||
@@ -95,10 +88,6 @@ public class ExplodedAndJarTargetParameters {
|
||||
return myJarPathProperty;
|
||||
}
|
||||
|
||||
public CompoundBuildInstructionNaming getCompoundBuildInstructionNaming() {
|
||||
return myCompoundBuildInstructionNaming;
|
||||
}
|
||||
|
||||
public BuildConfiguration getBuildConfiguration() {
|
||||
return myBuildConfiguration;
|
||||
}
|
||||
|
||||
@@ -15,31 +15,13 @@
|
||||
*/
|
||||
package com.intellij.openapi.compiler.make;
|
||||
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.jar.JarOutputStream;
|
||||
|
||||
public interface BuildInstruction {
|
||||
String getOutputRelativePath();
|
||||
Module getModule();
|
||||
|
||||
@Deprecated
|
||||
void addFilesToJar(@NotNull CompileContext context,
|
||||
@NotNull File jarFile,
|
||||
@NotNull JarOutputStream outputStream,
|
||||
BuildRecipe dependencies,
|
||||
@Nullable Set<String> writtenRelativePaths,
|
||||
@Nullable FileFilter fileFilter) throws IOException;
|
||||
|
||||
boolean accept(BuildInstructionVisitor visitor) throws Exception;
|
||||
|
||||
boolean isExternalDependencyInstruction();
|
||||
File findFileByRelativePath(String relativePath);
|
||||
}
|
||||
|
||||
-3
@@ -26,7 +26,4 @@ public abstract class BuildInstructionVisitor {
|
||||
public boolean visitJarAndCopyBuildInstruction(JarAndCopyBuildInstruction instruction) throws Exception {
|
||||
return visitFileCopyInstruction(instruction);
|
||||
}
|
||||
public boolean visitCompoundBuildInstruction(CompoundBuildInstruction instruction) throws Exception {
|
||||
return visitInstruction(instruction);
|
||||
}
|
||||
}
|
||||
+20
-16
@@ -56,22 +56,7 @@ public abstract class BuildParticipantBase extends BuildParticipant {
|
||||
final ConfigFile[] deploymentDescriptors = getDeploymentDescriptors();
|
||||
ApplicationManager.getApplication().runReadAction(new Runnable() {
|
||||
public void run() {
|
||||
for (ConfigFile descriptor : deploymentDescriptors) {
|
||||
VirtualFile virtualFile = descriptor.getVirtualFile();
|
||||
if (virtualFile != null) {
|
||||
ConfigFileMetaData metaData = descriptor.getMetaData();
|
||||
final File file = VfsUtil.virtualToIoFile(virtualFile);
|
||||
final String fileName;
|
||||
if (metaData.isFileNameFixed()) {
|
||||
fileName = metaData.getFileName();
|
||||
}
|
||||
else {
|
||||
fileName = virtualFile.getName();
|
||||
}
|
||||
instructions.addFileCopyInstruction(file, false, myModule, metaData.getDirectoryPath() + "/" + fileName, null);
|
||||
}
|
||||
|
||||
}
|
||||
registerDescriptorCopyingInstructions(BuildParticipantBase.this.myModule, deploymentDescriptors, instructions);
|
||||
|
||||
|
||||
final CustomConfigFile[] customDescriptors = getCustomDescriptors();
|
||||
@@ -87,6 +72,25 @@ public abstract class BuildParticipantBase extends BuildParticipant {
|
||||
});
|
||||
}
|
||||
|
||||
public static void registerDescriptorCopyingInstructions(Module module, ConfigFile[] deploymentDescriptors, BuildRecipe instructions) {
|
||||
for (ConfigFile descriptor : deploymentDescriptors) {
|
||||
VirtualFile virtualFile = descriptor.getVirtualFile();
|
||||
if (virtualFile != null) {
|
||||
ConfigFileMetaData metaData = descriptor.getMetaData();
|
||||
final File file = VfsUtil.virtualToIoFile(virtualFile);
|
||||
final String fileName;
|
||||
if (metaData.isFileNameFixed()) {
|
||||
fileName = metaData.getFileName();
|
||||
}
|
||||
else {
|
||||
fileName = virtualFile.getName();
|
||||
}
|
||||
instructions.addFileCopyInstruction(file, false, module, metaData.getDirectoryPath() + "/" + fileName, null);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected CustomConfigFile[] getCustomDescriptors() {
|
||||
return CustomConfigFile.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
-28
@@ -1,28 +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.openapi.compiler.make;
|
||||
|
||||
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
|
||||
public interface CompoundBuildInstruction extends BuildInstruction {
|
||||
|
||||
BuildConfiguration getBuildProperties();
|
||||
|
||||
BuildRecipe getChildInstructions(CompileContext context);
|
||||
|
||||
BuildParticipant getBuildParticipant();
|
||||
}
|
||||
-13
@@ -15,21 +15,8 @@
|
||||
*/
|
||||
package com.intellij.openapi.compiler.make;
|
||||
|
||||
import com.intellij.openapi.compiler.CompileContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface JarAndCopyBuildInstruction extends FileCopyInstruction {
|
||||
@Deprecated
|
||||
void makeJar(@NotNull CompileContext context,
|
||||
@NotNull File jarFile,
|
||||
@Nullable FileFilter fileFilter) throws IOException;
|
||||
File getJarFile();
|
||||
|
||||
@Deprecated
|
||||
void deleteTemporaryJars();
|
||||
}
|
||||
@@ -104,10 +104,6 @@ public abstract class ContainerElement implements JDOMExternalizable, Cloneable,
|
||||
return 0;
|
||||
}
|
||||
|
||||
public abstract String getDescription();
|
||||
|
||||
public abstract String getDescriptionForPackagingMethod(PackagingMethod method);
|
||||
|
||||
public ContainerElement clone() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.io.IOException;
|
||||
import java.util.Set;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
public abstract class DeploymentUtil {
|
||||
public static DeploymentUtil getInstance() {
|
||||
@@ -93,8 +92,6 @@ public abstract class DeploymentUtil {
|
||||
|
||||
public abstract void reportDeploymentDescriptorDoesNotExists(ConfigFile descriptor, CompileContext context, Module module);
|
||||
|
||||
@Nullable public abstract Manifest createManifest(@NotNull BuildRecipe buildRecipe);
|
||||
|
||||
public abstract void addJavaModuleOutputs(@NotNull Module module,
|
||||
@NotNull ModuleLink[] containingModules,
|
||||
@NotNull BuildRecipe instructions,
|
||||
@@ -110,14 +107,6 @@ public abstract class DeploymentUtil {
|
||||
@NotNull CompileContext context,
|
||||
String explodedPath);
|
||||
|
||||
public static boolean checkFileExists(final File file, CompileContext context) {
|
||||
if (!file.exists()) {
|
||||
context.addMessage(CompilerMessageCategory.ERROR, CompilerBundle.message("compiler.message.text.file.does.not.exist", file),null,-1,-1);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static String concatPaths(String... paths) {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
for (String path : paths) {
|
||||
@@ -194,8 +183,6 @@ public abstract class DeploymentUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract @Nullable File findUserSuppliedManifestFile(@NotNull BuildRecipe buildRecipe);
|
||||
|
||||
public abstract void checkConfigFile(final ConfigFile descriptor, final CompileContext compileContext, final Module module);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +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.openapi.deployment;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
|
||||
import com.intellij.openapi.roots.ui.configuration.FacetsProvider;
|
||||
|
||||
public interface PackagingConfiguration extends JDOMExternalizable {
|
||||
ModuleLink[] getContainingModules();
|
||||
|
||||
LibraryLink[] getContainingLibraries();
|
||||
|
||||
ContainerElement[] getElements();
|
||||
|
||||
void setElements(ContainerElement[] elements);
|
||||
|
||||
Module[] getContainingIdeaModules();
|
||||
|
||||
ContainerElement[] getElements(ModulesProvider provider, FacetsProvider facetsProvider,
|
||||
boolean includeResolved, boolean includeUnresolved, boolean includeNonPackaged);
|
||||
|
||||
void addOrReplaceElement(ContainerElement element);
|
||||
|
||||
boolean removeContainerElement(ContainerElement containerElement);
|
||||
}
|
||||
+3
-3
@@ -39,11 +39,11 @@ public abstract class CompositePackagingElementType<E extends CompositePackaging
|
||||
|
||||
|
||||
@Nullable
|
||||
public abstract E createComposite(@NotNull ArtifactEditorContext context, CompositePackagingElement<?> parent);
|
||||
protected abstract PackagingElement<?> createComposite(@NotNull ArtifactEditorContext context, CompositePackagingElement<?> parent);
|
||||
|
||||
@NotNull
|
||||
public List<? extends E> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact, @NotNull CompositePackagingElement<?> parent) {
|
||||
final E composite = createComposite(context, parent);
|
||||
public List<? extends PackagingElement<?>> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact, @NotNull CompositePackagingElement<?> parent) {
|
||||
final PackagingElement<?> composite = createComposite(context, parent);
|
||||
return composite != null ? Collections.singletonList(composite) : Collections.<E>emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ public abstract class PackagingElementType<E extends PackagingElement<?>> {
|
||||
public abstract boolean canCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact);
|
||||
|
||||
@NotNull
|
||||
public abstract List<? extends E> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
|
||||
@NotNull CompositePackagingElement<?> parent);
|
||||
public abstract List<? extends PackagingElement<?>> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
|
||||
@NotNull CompositePackagingElement<?> parent);
|
||||
|
||||
@NotNull
|
||||
public abstract E createEmpty(@NotNull Project project);
|
||||
|
||||
@@ -46,8 +46,11 @@ import com.intellij.execution.CantRunException;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.ExecutionResult;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.configurations.CommandLineState;
|
||||
import com.intellij.execution.configurations.RemoteConnection;
|
||||
import com.intellij.execution.configurations.RunProfileState;
|
||||
import com.intellij.execution.filters.ExceptionFilter;
|
||||
import com.intellij.execution.filters.TextConsoleBuilder;
|
||||
import com.intellij.execution.process.ProcessAdapter;
|
||||
import com.intellij.execution.process.ProcessEvent;
|
||||
import com.intellij.execution.process.ProcessListener;
|
||||
@@ -1621,6 +1624,12 @@ public abstract class DebugProcessImpl implements DebugProcess {
|
||||
|
||||
try {
|
||||
synchronized (myProcessListeners) {
|
||||
if (state instanceof CommandLineState) {
|
||||
final TextConsoleBuilder consoleBuilder = ((CommandLineState)state).getConsoleBuilder();
|
||||
if (consoleBuilder != null) {
|
||||
consoleBuilder.addFilter(new ExceptionFilter(session.getSearchScope()));
|
||||
}
|
||||
}
|
||||
myExecutionResult = state.execute(executor, runner);
|
||||
if (myExecutionResult == null) {
|
||||
fail();
|
||||
|
||||
@@ -341,11 +341,10 @@ public class DebuggerSession implements AbstractDebuggerSession {
|
||||
|
||||
@Nullable
|
||||
protected ExecutionResult attach(@NotNull final Executor executor, @NotNull final ProgramRunner runner, final ModuleRunProfile profile, final RunProfileState state, final RemoteConnection remoteConnection, final boolean pollConnection) throws ExecutionException {
|
||||
final ExecutionResult executionResult = myDebugProcess.attachVirtualMachine(executor, runner, this, state, remoteConnection, pollConnection);
|
||||
final String addressDisplayName = DebuggerBundle.getAddressDisplayName(remoteConnection);
|
||||
final String transportName = DebuggerBundle.getTransportName(remoteConnection);
|
||||
final Module[] modules = profile.getModules();
|
||||
if (modules == null || modules.length == 0) {
|
||||
if (modules.length == 0) {
|
||||
mySearchScope = GlobalSearchScope.allScope(getProject());
|
||||
}
|
||||
else {
|
||||
@@ -356,6 +355,7 @@ public class DebuggerSession implements AbstractDebuggerSession {
|
||||
}
|
||||
mySearchScope = scope;
|
||||
}
|
||||
final ExecutionResult executionResult = myDebugProcess.attachVirtualMachine(executor, runner, this, state, remoteConnection, pollConnection);
|
||||
getContextManager().setState(SESSION_EMPTY_CONTEXT, STATE_WAITING_ATTACH, EVENT_START_WAIT_ATTACH, DebuggerBundle.message("status.waiting.attach", addressDisplayName, transportName));
|
||||
return executionResult;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@ import com.intellij.debugger.ui.impl.watch.*;
|
||||
import com.intellij.execution.*;
|
||||
import com.intellij.execution.configurations.RunProfile;
|
||||
import com.intellij.execution.executors.DefaultDebugExecutor;
|
||||
import com.intellij.execution.filters.ExceptionFilter;
|
||||
import com.intellij.execution.filters.TextConsoleBuilder;
|
||||
import com.intellij.execution.filters.TextConsoleBuilderFactory;
|
||||
import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.runners.ProgramRunner;
|
||||
@@ -511,7 +513,9 @@ public class DebuggerSessionTab extends DebuggerLogConsoleManagerBase implements
|
||||
|
||||
public void addThreadDump(List<ThreadState> threads) {
|
||||
final Project project = getProject();
|
||||
final ConsoleView consoleView = TextConsoleBuilderFactory.getInstance().createBuilder(project).getConsole();
|
||||
final TextConsoleBuilder consoleBuilder = TextConsoleBuilderFactory.getInstance().createBuilder(project);
|
||||
consoleBuilder.addFilter(new ExceptionFilter(myDebuggerSession.getSearchScope()));
|
||||
final ConsoleView consoleView = consoleBuilder.getConsole();
|
||||
final DefaultActionGroup toolbarActions = new DefaultActionGroup();
|
||||
final ThreadDumpPanel panel = new ThreadDumpPanel(project, consoleView, toolbarActions, threads);
|
||||
|
||||
|
||||
@@ -39,9 +39,16 @@ public class ExceptionFilter implements Filter, DumbAware {
|
||||
private static final String AT_PREFIX = AT + " ";
|
||||
private static final String STANDALONE_AT = " " + AT + " ";
|
||||
private static final TextAttributes HYPERLINK_ATTRIBUTES = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.HYPERLINK_ATTRIBUTES);
|
||||
private final GlobalSearchScope mySearchScope;
|
||||
|
||||
public ExceptionFilter(@NotNull final Project project) {
|
||||
myProject = project;
|
||||
mySearchScope = GlobalSearchScope.allScope(myProject);
|
||||
}
|
||||
|
||||
public ExceptionFilter(@NotNull final GlobalSearchScope scope) {
|
||||
myProject = scope.getProject();
|
||||
mySearchScope = scope;
|
||||
}
|
||||
|
||||
public Result applyFilter(final String line, final int textEndOffset) {
|
||||
@@ -81,7 +88,7 @@ public class ExceptionFilter implements Filter, DumbAware {
|
||||
try{
|
||||
final int lineNumber = Integer.parseInt(lineString);
|
||||
final PsiManager manager = PsiManager.getInstance(myProject);
|
||||
PsiClass aClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(className, GlobalSearchScope.allScope(myProject));
|
||||
PsiClass aClass = JavaPsiFacade.getInstance(manager.getProject()).findClass(className, mySearchScope);
|
||||
if (aClass == null) return null;
|
||||
final PsiFile file = (PsiFile) aClass.getContainingFile().getNavigationElement();
|
||||
if (file == null) return null;
|
||||
|
||||
+5
-1
@@ -6,7 +6,6 @@ package com.intellij.ide.util.frameworkSupport;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.ide.util.newProjectWizard.AddSupportForFrameworksPanel;
|
||||
import com.intellij.ide.util.frameworkSupport.FrameworkSupportProvider;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.WriteAction;
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -80,6 +79,11 @@ public class AddFrameworkSupportDialog extends DialogWrapper {
|
||||
super.doOKAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHelpId() {
|
||||
return "reference.frameworks.support.dialog";
|
||||
}
|
||||
|
||||
protected JComponent createCenterPanel() {
|
||||
return myAddSupportPanel.getMainPanel();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.roots.ModuleRootModel;
|
||||
import com.intellij.openapi.roots.OrderEntry;
|
||||
import com.intellij.openapi.roots.impl.ModuleRootManagerImpl;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
@@ -144,6 +145,13 @@ public abstract class ModuleEditor implements Place.Navigator, Disposable {
|
||||
return myModifiableRootModelProxy;
|
||||
}
|
||||
|
||||
public ModuleRootModel getRootModel() {
|
||||
if (myModifiableRootModel != null) {
|
||||
return getModifiableRootModelProxy();
|
||||
}
|
||||
return ModuleRootManager.getInstance(myModule);
|
||||
}
|
||||
|
||||
public boolean isModified() {
|
||||
for (ModuleConfigurationEditor moduleElementsEditor : myEditors) {
|
||||
if (moduleElementsEditor.isModified()) {
|
||||
|
||||
+2
-2
@@ -151,11 +151,11 @@ public class ModulesConfigurator implements ModulesProvider, ModuleEditor.Change
|
||||
final ModuleEditor editor = getModuleEditor(module);
|
||||
ModuleRootModel rootModel = null;
|
||||
if (editor != null) {
|
||||
rootModel = editor.getModifiableRootModel();
|
||||
rootModel = editor.getRootModel();
|
||||
}
|
||||
if (rootModel == null && getModule(module.getName()) != null) {
|
||||
createModuleEditor(module);
|
||||
rootModel = getModuleEditor(module).getModifiableRootModel();
|
||||
rootModel = getModuleEditor(module).getRootModel();
|
||||
}
|
||||
|
||||
return rootModel;
|
||||
|
||||
@@ -93,8 +93,10 @@ public class DefaultInsertHandler extends TemplateInsertHandler implements Clone
|
||||
myDocument = myEditor.getDocument();
|
||||
|
||||
TailType tailType = getTailType(completionChar);
|
||||
if (completionChar == Lookup.COMPLETE_STATEMENT_SELECT_CHAR) {
|
||||
tailType = TailType.SMART_COMPLETION;
|
||||
}
|
||||
|
||||
//adjustContextAfterLookupStringInsertion();
|
||||
myState = new InsertHandlerState(myContext.getSelectionEndOffset(), myContext.getSelectionEndOffset());
|
||||
|
||||
final boolean needLeftParenth = isToInsertParenth();
|
||||
@@ -412,7 +414,6 @@ public class DefaultInsertHandler extends TemplateInsertHandler implements Clone
|
||||
case '#':
|
||||
case '\"':
|
||||
case '[': return TailType.createSimpleTailType(completionChar);
|
||||
case Lookup.COMPLETE_STATEMENT_SELECT_CHAR: return TailType.SMART_COMPLETION;
|
||||
//case '!': if (!(myLookupItem.getObject() instanceof PsiVariable)) return TailType.EXCLAMATION;
|
||||
}
|
||||
final TailType attr = myLookupItem.getTailType();
|
||||
|
||||
+5
-1
@@ -620,7 +620,11 @@ public class JavaSmartCompletionContributor extends CompletionContributor {
|
||||
element instanceof PsiThisExpression || element instanceof PsiSuperExpression ||
|
||||
element instanceof PsiTypeElement ||
|
||||
element instanceof PsiClassObjectAccessExpression) {
|
||||
context.getOffsetMap().addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, element.getTextRange().getEndOffset());
|
||||
int newEnd = element.getTextRange().getEndOffset();
|
||||
if (element instanceof PsiMethodCallExpression) {
|
||||
newEnd = ((PsiMethodCallExpression)element).getMethodExpression().getElement().getTextRange().getEndOffset();
|
||||
}
|
||||
context.getOffsetMap().addOffset(CompletionInitializationContext.IDENTIFIER_END_OFFSET, newEnd);
|
||||
element = element.getParent();
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -148,7 +148,7 @@ public class AnnotationsHighlightUtil {
|
||||
if (annotation == annotationToCheck) continue;
|
||||
PsiJavaCodeReferenceElement nameRef = annotation.getNameReferenceElement();
|
||||
if (nameRef == null) continue;
|
||||
PsiClass aClass = (PsiClass)nameRef.resolve();
|
||||
PsiElement aClass = nameRef.resolve();
|
||||
if (resolved.equals(aClass)) {
|
||||
return HighlightInfo.createHighlightInfo(HighlightInfoType.ERROR, element, JavaErrorMessages.message("annotation.duplicate.annotation"));
|
||||
}
|
||||
|
||||
+2
-3
@@ -68,12 +68,11 @@ public class AdjustPackageNameFix implements LocalQuickFix {
|
||||
}
|
||||
}
|
||||
else {
|
||||
final PsiPackageStatement packageStatement = factory.createPackageStatement(myTargetPackage.getQualifiedName());
|
||||
if (myStatement != null) {
|
||||
PsiJavaCodeReferenceElement packageReferenceElement = factory.createPackageReferenceElement(myTargetPackage);
|
||||
myStatement.getPackageReference().replace(packageReferenceElement);
|
||||
myStatement.getPackageReference().replace(packageStatement.getPackageReference());
|
||||
}
|
||||
else {
|
||||
PsiPackageStatement packageStatement = factory.createPackageStatement(myTargetPackage.getQualifiedName());
|
||||
myFile.addAfter(packageStatement, null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,9 +232,13 @@ public class ImportHelper{
|
||||
|
||||
Map<String, Set<String>> classNames = new THashMap<String, Set<String>>();
|
||||
JavaPsiFacade facade = JavaPsiFacade.getInstance(file.getProject());
|
||||
for (String onDemand : onDemands) {
|
||||
for (int i = onDemands.size()-1; i>=0; i--) {
|
||||
String onDemand = onDemands.get(i);
|
||||
PsiPackage aPackage = facade.findPackage(onDemand);
|
||||
if (aPackage == null) continue;
|
||||
if (aPackage == null) {
|
||||
onDemands.remove(i);
|
||||
continue;
|
||||
}
|
||||
PsiClass[] psiClasses = aPackage.getClasses(resolveScope);
|
||||
Set<String> set = new THashSet<String>(psiClasses.length);
|
||||
for (PsiClass psiClass : psiClasses) {
|
||||
|
||||
+13
-2
@@ -93,7 +93,9 @@ public class ClassResolverProcessor extends BaseScopeProcessor implements NameHi
|
||||
}
|
||||
|
||||
private static boolean isOnDemand(PsiElement fileContext, PsiClass psiClass) {
|
||||
if (fileContext instanceof PsiImportStatementBase && ((PsiImportStatementBase)fileContext).isOnDemand()) return true;
|
||||
if (fileContext instanceof PsiImportStatementBase) {
|
||||
return ((PsiImportStatementBase)fileContext).isOnDemand();
|
||||
}
|
||||
String fqn = psiClass.getQualifiedName();
|
||||
if (fqn == null) return false;
|
||||
return "java.lang".equals(StringUtil.getPackageName(fqn));
|
||||
@@ -106,6 +108,7 @@ public class ClassResolverProcessor extends BaseScopeProcessor implements NameHi
|
||||
if (!myClassName.equals(name)) {
|
||||
return true;
|
||||
}
|
||||
boolean accessible = myPlace == null || checkAccessibility(aClass);
|
||||
if (myCandidates == null) {
|
||||
myCandidates = new SmartList<ClassCandidateInfo>();
|
||||
}
|
||||
@@ -126,6 +129,15 @@ public class ClassResolverProcessor extends BaseScopeProcessor implements NameHi
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean infoAccessible = info.isAccessible();
|
||||
if (infoAccessible && !accessible) {
|
||||
return true;
|
||||
}
|
||||
if (!infoAccessible && accessible) {
|
||||
myCandidates.remove(i);
|
||||
continue;
|
||||
}
|
||||
|
||||
// single import wins over on-demand
|
||||
boolean myOnDemand = isOnDemand(myCurrentFileContext, aClass);
|
||||
boolean otherOnDemand = isOnDemand(info.getCurrentFileResolveScope(), otherClass);
|
||||
@@ -137,7 +149,6 @@ public class ClassResolverProcessor extends BaseScopeProcessor implements NameHi
|
||||
}
|
||||
}
|
||||
|
||||
boolean accessible = myPlace == null || checkAccessibility(aClass);
|
||||
myHasAccessibleCandidate |= accessible;
|
||||
myHasInaccessibleCandidate |= !accessible;
|
||||
myCandidates.add(new ClassCandidateInfo(aClass, state.get(PsiSubstitutor.KEY), !accessible, myCurrentFileContext));
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class ChangeSignatureUtil {
|
||||
if (elementsToRemove == null) {
|
||||
elementsToRemove = new ArrayList<Child>();
|
||||
for (int i = 0; i < shouldRemoveChild.length; i++) {
|
||||
if (shouldRemoveChild[i]) {
|
||||
if (shouldRemoveChild[i] && i < elements.size()) {
|
||||
elementsToRemove.add(elements.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -179,8 +179,11 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
final Component rendererComponent = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
|
||||
|
||||
final StringBuffer buf = new StringBuffer();
|
||||
((PsiExpression)value).accept(new PsiExpressionTrimRenderer(buf));
|
||||
setText(buf.toString());
|
||||
final PsiExpression expr = (PsiExpression)value;
|
||||
if (expr.isValid()) {
|
||||
expr.accept(new PsiExpressionTrimRenderer(buf));
|
||||
setText(buf.toString());
|
||||
}
|
||||
return rendererComponent;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -99,7 +99,7 @@ public class PushDownConflicts {
|
||||
}
|
||||
|
||||
if (!InheritanceUtil.isInheritorOrSelf(aClass, targetClass, true)) {
|
||||
myConflicts.putValue(aClass, RefactoringBundle.message("pushed.members.will.not.be.visible.from.certain.call.sites"));
|
||||
myConflicts.putValue(referenceExpression, RefactoringBundle.message("pushed.members.will.not.be.visible.from.certain.call.sites"));
|
||||
break Members;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1115,7 +1115,7 @@ public class RefactoringUtil {
|
||||
final Set<PsiTypeParameter> used = new HashSet<PsiTypeParameter>();
|
||||
for (final PsiElement element : elements) {
|
||||
if (element == null) continue;
|
||||
element.accept(new JavaRecursiveElementWalkingVisitor() {
|
||||
element.accept(new JavaRecursiveElementVisitor() { //pull up extends cls class with type params
|
||||
|
||||
@Override public void visitReferenceElement(PsiJavaCodeReferenceElement reference) {
|
||||
super.visitReferenceElement(reference);
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MyJavaClass {
|
||||
|
||||
{
|
||||
|
||||
List l = new ArrayList(239);
|
||||
<caret>
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
import java.util.List;
|
||||
|
||||
public class MyJavaClass {
|
||||
|
||||
{
|
||||
|
||||
List l = new ArraL<caret>239
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class MyJavaClass {
|
||||
|
||||
boolean ffff() {}
|
||||
|
||||
{
|
||||
|
||||
boolean b = ffff(<caret>239);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
public class MyJavaClass {
|
||||
|
||||
boolean ffff() {}
|
||||
|
||||
{
|
||||
|
||||
boolean b = <caret>equals(239);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>A.java</file>
|
||||
<line>2</line>
|
||||
<description>Constructor is never used</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
class B {
|
||||
A a=new A(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class A {
|
||||
A() {
|
||||
}
|
||||
A(int k) {
|
||||
System.out.println(k);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
class B extends A {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
abstract class A {
|
||||
A() {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
@@ -0,0 +1,5 @@
|
||||
public class External {
|
||||
{
|
||||
new Test();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
public class Test implements java.io.Serializable {
|
||||
private void writeObject(java.io.ObjectOutputStream out) {}
|
||||
private void readObject(java.io.ObjectInputStream in) {}
|
||||
public Object writeReplace() { return null; }
|
||||
public Object readResolve() { return null; }
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="p1.Form">
|
||||
<component id="566a6" class="javax.swing.JLabel" binding="myLabel">
|
||||
<constraints>
|
||||
<xy x="167" y="116" width="33" height="16"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Label"/>
|
||||
</properties>
|
||||
</component>
|
||||
</form>
|
||||
@@ -0,0 +1,8 @@
|
||||
package p1;
|
||||
|
||||
public class Form {
|
||||
private JLabel myLabel;
|
||||
|
||||
private void createUIComponents() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@Annotated
|
||||
public class Test {
|
||||
@Annotated
|
||||
public void foo(){}
|
||||
|
||||
@Annotated
|
||||
public int myPublicField;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER, ElementType.LOCAL_VARIABLE})
|
||||
public @interface Test {
|
||||
String value() default "";
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
public class A {
|
||||
public A() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class B implements I{
|
||||
public void projectOpened() {
|
||||
new A();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
public interface I {
|
||||
void projectOpened();
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
class Test {
|
||||
public static void main(String[] args){
|
||||
I i = null;
|
||||
i.projectOpened();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<component>B</component>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
public class A {
|
||||
public static void main(String[] args) {
|
||||
new A();
|
||||
}
|
||||
|
||||
private void a(){
|
||||
}
|
||||
|
||||
private void b(){
|
||||
a();
|
||||
}
|
||||
|
||||
@java.lang.SuppressWarnings({"UnusedDeclaration"})
|
||||
private void c(){
|
||||
b();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
public class A {
|
||||
public A(int i) {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class B {
|
||||
public static void main(String[] args){
|
||||
System.out.println(new A(1));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
public class Test {
|
||||
public static void main(String[] args){
|
||||
System.out.println(new A(1));
|
||||
}
|
||||
|
||||
private class A {
|
||||
public A(int i){}
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package test;
|
||||
|
||||
public class AMatcher implements Matcher{
|
||||
private static final BracePair [] PAIRS = new BracePair[]{new BracePair()};
|
||||
public BracePair[] getPairs() {
|
||||
return PAIRS;
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package test;
|
||||
|
||||
public class BracePair {
|
||||
|
||||
public BracePair() {
|
||||
}
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
package test;
|
||||
|
||||
public interface Matcher {
|
||||
BracePair[] getPairs();
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package test;
|
||||
|
||||
public class Test {
|
||||
|
||||
public Test(Matcher m) {
|
||||
BracePair[] bracePairs = m.getPairs();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new Test(new AMatcher()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
public void Test1 {
|
||||
void foo() {
|
||||
if (Test.FIRST.invert() != Test.SECOND) {
|
||||
//assert
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user