mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix generated ant for unpacked directories in artifacts (IDEA-51729)
This commit is contained in:
+2
-3
@@ -53,8 +53,7 @@ public class ArchiveAntCopyInstructionCreator implements AntCopyInstructionCreat
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Generator createExtractedDirectoryInstruction(@NotNull String jarPath, @NotNull String pathInJar) {
|
||||
final String pattern = pathInJar.length() == 0 ? null : pathInJar + "**";
|
||||
return ZipFileSet.createUnpackedSet(jarPath, pathInJar, true, pattern);
|
||||
public Generator createExtractedDirectoryInstruction(@NotNull String jarPath) {
|
||||
return ZipFileSet.createUnpackedSet(jarPath, myPrefix, true);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-8
@@ -58,13 +58,7 @@ public class DirectoryAntCopyInstructionCreator implements AntCopyInstructionCre
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Generator createExtractedDirectoryInstruction(@NotNull String jarPath, @NotNull String pathInJar) {
|
||||
final Unzip unzip = new Unzip(jarPath, myOutputDirectory);
|
||||
if (pathInJar.length() > 0) {
|
||||
final PatternSet patterns = new PatternSet(null);
|
||||
patterns.add(new Include(pathInJar + "**"));
|
||||
unzip.add(patterns);
|
||||
}
|
||||
return unzip;
|
||||
public Generator createExtractedDirectoryInstruction(@NotNull String jarPath) {
|
||||
return new Unzip(jarPath, myOutputDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
+23
-1
@@ -15,7 +15,12 @@
|
||||
*/
|
||||
package com.intellij.packaging.impl.elements;
|
||||
|
||||
import com.intellij.compiler.ant.BuildProperties;
|
||||
import com.intellij.compiler.ant.Generator;
|
||||
import com.intellij.compiler.ant.taskdefs.Include;
|
||||
import com.intellij.compiler.ant.taskdefs.Mkdir;
|
||||
import com.intellij.compiler.ant.taskdefs.PatternSet;
|
||||
import com.intellij.compiler.ant.taskdefs.Unzip;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
@@ -25,6 +30,7 @@ import com.intellij.packaging.elements.*;
|
||||
import com.intellij.packaging.impl.ui.ExtractedDirectoryPresentation;
|
||||
import com.intellij.packaging.ui.ArtifactEditorContext;
|
||||
import com.intellij.packaging.ui.PackagingElementPresentation;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -73,7 +79,23 @@ public class ExtractedDirectoryPackagingElement extends FileOrDirectoryCopyPacka
|
||||
@NotNull ArtifactAntGenerationContext generationContext,
|
||||
@NotNull ArtifactType artifactType) {
|
||||
final String jarPath = generationContext.getSubstitutedPath(myFilePath);
|
||||
return Collections.singletonList(creator.createExtractedDirectoryInstruction(jarPath, StringUtil.trimStart(myPathInJar, "/")));
|
||||
final String pathInJar = StringUtil.trimStart(myPathInJar, "/");
|
||||
if (pathInJar.length() == 0) {
|
||||
return Collections.singletonList(creator.createExtractedDirectoryInstruction(jarPath));
|
||||
}
|
||||
|
||||
final String archiveName = PathUtil.getFileName(myFilePath);
|
||||
final String tempDirProperty = generationContext.createNewTempFileProperty("temp.unpacked.path." + archiveName, archiveName);
|
||||
final String tempDirPath = BuildProperties.propertyRef(tempDirProperty);
|
||||
generationContext.runBeforeCurrentArtifact(new Mkdir(tempDirPath));
|
||||
|
||||
final Unzip unzip = new Unzip(jarPath, tempDirPath);
|
||||
final PatternSet patterns = new PatternSet(null);
|
||||
patterns.add(new Include(pathInJar + "**"));
|
||||
unzip.add(patterns);
|
||||
generationContext.runBeforeCurrentArtifact(unzip);
|
||||
|
||||
return Collections.singletonList(creator.createDirectoryContentCopyInstruction(tempDirPath + "/" + pathInJar));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -43,11 +43,10 @@ public class ZipFileSet extends Tag{
|
||||
pair("prefix", prefix(isDir, relativePath)));
|
||||
}
|
||||
|
||||
public static ZipFileSet createUnpackedSet(@NonNls String zipFilePath, @NotNull String relativePath, final boolean isDir, String pattern) {
|
||||
public static ZipFileSet createUnpackedSet(@NonNls String zipFilePath, @NotNull String relativePath, final boolean isDir) {
|
||||
return new ZipFileSet("zipfileset",
|
||||
pair("src", zipFilePath),
|
||||
pair("prefix", prefix(isDir, relativePath)),
|
||||
pair("includes", pattern));
|
||||
pair("prefix", prefix(isDir, relativePath)));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-1
@@ -38,5 +38,5 @@ public interface AntCopyInstructionCreator {
|
||||
Generator createSubFolderCommand(@NotNull String directoryName);
|
||||
|
||||
@NotNull
|
||||
Generator createExtractedDirectoryInstruction(@NotNull String jarPath, @NotNull String pathInJar);
|
||||
Generator createExtractedDirectoryInstruction(@NotNull String jarPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user