use of org.jetbrains.jps.model.artifact.elements.JpsPackagingElement in project intellij-community by JetBrains.
the class JpsLibraryFilesPackagingElementImpl method getSubstitution.
@Override
public List<JpsPackagingElement> getSubstitution() {
JpsLibrary library = getLibraryReference().resolve();
if (library == null)
return Collections.emptyList();
List<JpsPackagingElement> result = new ArrayList<>();
for (File file : library.getFiles(JpsOrderRootType.COMPILED)) {
String path = FileUtil.toSystemIndependentName(file.getAbsolutePath());
if (file.isDirectory()) {
result.add(JpsPackagingElementFactory.getInstance().createDirectoryCopy(path));
} else {
result.add(JpsPackagingElementFactory.getInstance().createFileCopy(path, null));
}
}
return result;
}
use of org.jetbrains.jps.model.artifact.elements.JpsPackagingElement in project intellij-community by JetBrains.
the class RebuildArtifactOnConfigurationChangeTest method testAddRootChangingRootIndices.
public void testAddRootChangingRootIndices() {
String file1 = createFile("d1/a/b/1.txt");
String file2 = createFile("d2/x/y/2.txt");
JpsArtifact a = addArtifact(root().fileCopy(file1).fileCopy(file2));
buildAll();
assertOutput(a, fs().file("1.txt").file("2.txt"));
JpsCompositePackagingElement root = a.getRootElement();
assertEquals(2, root.getChildren().size());
JpsPackagingElement last = root.getChildren().get(1);
root.removeChild(last);
String file3 = createFile("d3/1/2/3.txt");
root.addChild(JpsPackagingElementFactory.getInstance().createFileCopy(file3, null));
root.addChild(last);
buildAll();
assertOutput(a, fs().file("1.txt").file("2.txt").file("3.txt"));
}
use of org.jetbrains.jps.model.artifact.elements.JpsPackagingElement in project intellij-community by JetBrains.
the class JpsArtifactOutputPackagingElementImpl method getSubstitution.
@Override
public List<JpsPackagingElement> getSubstitution() {
JpsArtifact artifact = getArtifactReference().resolve();
if (artifact == null)
return Collections.emptyList();
JpsCompositePackagingElement rootElement = artifact.getRootElement();
if (rootElement instanceof JpsArtifactRootElement) {
return new ArrayList<>(rootElement.getChildren());
} else {
return Collections.<JpsPackagingElement>singletonList(rootElement);
}
}
Aggregations