use of com.intellij.compiler.ant.taskdefs.Mkdir in project intellij-community by JetBrains.
the class ExtractedDirectoryPackagingElement method computeAntInstructions.
@Override
public List<? extends Generator> computeAntInstructions(@NotNull PackagingElementResolvingContext resolvingContext, @NotNull AntCopyInstructionCreator creator, @NotNull ArtifactAntGenerationContext generationContext, @NotNull ArtifactType artifactType) {
final String jarPath = generationContext.getSubstitutedPath(myFilePath);
final String pathInJar = StringUtil.trimStart(myPathInJar, "/");
if (pathInJar.length() == 0) {
return Collections.singletonList(creator.createExtractedDirectoryInstruction(jarPath));
}
final String archiveName = PathUtil.getFileName(myFilePath);
final String tempDirProperty = generationContext.createNewTempFileProperty("temp.unpacked.path." + archiveName, archiveName);
final String tempDirPath = BuildProperties.propertyRef(tempDirProperty);
generationContext.runBeforeCurrentArtifact(new Mkdir(tempDirPath));
final Unzip unzip = new Unzip(jarPath, tempDirPath);
final PatternSet patterns = new PatternSet(null);
patterns.add(new Include(pathInJar + "**"));
unzip.add(patterns);
generationContext.runBeforeCurrentArtifact(unzip);
return Collections.singletonList(creator.createDirectoryContentCopyInstruction(tempDirPath + "/" + pathInJar));
}
use of com.intellij.compiler.ant.taskdefs.Mkdir in project intellij-community by JetBrains.
the class ArtifactAntGenerationContextImpl method createNewTempFileProperty.
public String createNewTempFileProperty(String basePropertyName, String fileName) {
String tempFileName = fileName;
int i = 1;
String tempSubdir = null;
while (myTempFileNames.contains(tempFileName)) {
tempSubdir = String.valueOf(i++);
tempFileName = tempSubdir + "/" + fileName;
}
String propertyName = basePropertyName;
i = 2;
while (myProperties.contains(propertyName)) {
propertyName = basePropertyName + i++;
}
runBeforeBuild(new Property(propertyName, BuildProperties.propertyRelativePath(ARTIFACTS_TEMP_DIR_PROPERTY, tempFileName)));
if (tempSubdir != null && myCreatedTempSubdirs.add(tempSubdir)) {
runBeforeBuild(new Mkdir(BuildProperties.propertyRelativePath(ARTIFACTS_TEMP_DIR_PROPERTY, tempSubdir)));
}
myTempFileNames.add(tempFileName);
myProperties.add(propertyName);
return propertyName;
}
Aggregations