Search in sources :

Example 1 with Mkdir

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));
}
Also used : Mkdir(com.intellij.compiler.ant.taskdefs.Mkdir) Unzip(com.intellij.compiler.ant.taskdefs.Unzip) Include(com.intellij.compiler.ant.taskdefs.Include) PatternSet(com.intellij.compiler.ant.taskdefs.PatternSet)

Example 2 with Mkdir

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;
}
Also used : Mkdir(com.intellij.compiler.ant.taskdefs.Mkdir) Property(com.intellij.compiler.ant.taskdefs.Property)

Aggregations

Mkdir (com.intellij.compiler.ant.taskdefs.Mkdir)2 Include (com.intellij.compiler.ant.taskdefs.Include)1 PatternSet (com.intellij.compiler.ant.taskdefs.PatternSet)1 Property (com.intellij.compiler.ant.taskdefs.Property)1 Unzip (com.intellij.compiler.ant.taskdefs.Unzip)1