Search in sources :

Example 6 with LayoutFileSet

use of jetbrains.antlayout.util.LayoutFileSet in project intellij-community by JetBrains.

the class ExtractedDirContent method build.

@Override
public List<LayoutFileSet> build(TempFileFactory temp) {
    final File outputDir = temp.allocateTempFile("extractedDir");
    expandTask.setProject(getProject());
    expandTask.setSrc(new File(jarPath.replace('/', File.separatorChar)));
    File target = outputDir;
    if (!pathInJar.endsWith("/")) {
        pathInJar += "/";
    }
    if (pathInJar.startsWith("/")) {
        pathInJar = pathInJar.substring(1);
    }
    if (pathInJar.length() > 0) {
        final PatternSet patternSet = new PatternSet();
        patternSet.createInclude().setName(pathInJar + "**");
        expandTask.addPatternset(patternSet);
        target = new File(outputDir, pathInJar.replace('/', File.separatorChar));
    }
    expandTask.setDest(outputDir);
    expandTask.perform();
    final LayoutFileSet fileSet = new LayoutFileSet();
    fileSet.setDir(target);
    return Collections.singletonList(fileSet);
}
Also used : LayoutFileSet(jetbrains.antlayout.util.LayoutFileSet) File(java.io.File) PatternSet(org.apache.tools.ant.types.PatternSet)

Aggregations

LayoutFileSet (jetbrains.antlayout.util.LayoutFileSet)6 File (java.io.File)4 ArrayList (java.util.ArrayList)2 LinkedHashSet (java.util.LinkedHashSet)1 Copy (org.apache.tools.ant.taskdefs.Copy)1 PatternSet (org.apache.tools.ant.types.PatternSet)1