use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class ArtifactExternalDependenciesImporterImpl method applyChanges.
@Override
public void applyChanges(ModifiableArtifactModel artifactModel, final PackagingElementResolvingContext context) {
myManifestFiles.saveManifestFiles();
final List<Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>>> elementsToInclude = new ArrayList<>();
for (Artifact artifact : artifactModel.getArtifacts()) {
ArtifactUtil.processPackagingElements(artifact, ArtifactElementType.ARTIFACT_ELEMENT_TYPE, new PackagingElementProcessor<ArtifactPackagingElement>() {
@Override
public boolean process(@NotNull ArtifactPackagingElement artifactPackagingElement, @NotNull PackagingElementPath path) {
final Artifact included = artifactPackagingElement.findArtifact(context);
final CompositePackagingElement<?> parent = path.getLastParent();
if (parent != null && included != null) {
final List<PackagingElement<?>> elements = myExternalDependencies.get(included);
if (elements != null) {
elementsToInclude.add(Pair.create(parent, elements));
}
}
return true;
}
}, context, false);
}
for (Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>> pair : elementsToInclude) {
pair.getFirst().addOrFindChildren(pair.getSecond());
}
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class ArtifactProblemsHolderImpl method registerProblem.
private void registerProblem(@NotNull String message, @Nullable List<PackagingElement<?>> pathToPlace, final ProjectStructureProblemType problemType, @NotNull ArtifactProblemQuickFix... quickFixes) {
String parentPath;
PackagingElement<?> element;
if (pathToPlace != null && !pathToPlace.isEmpty()) {
parentPath = PackagingElementPath.createPath(pathToPlace.subList(1, pathToPlace.size() - 1)).getPathString();
element = pathToPlace.get(pathToPlace.size() - 1);
} else {
parentPath = null;
element = null;
}
final Artifact artifact = myContext.getArtifactModel().getArtifactByOriginal(myOriginalArtifact);
final PlaceInArtifact place = new PlaceInArtifact(artifact, myContext, parentPath, element);
myProblemsHolder.registerProblem(new ArtifactProblemDescription(message, problemType, pathToPlace, place, convertQuickFixes(quickFixes)));
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class ArtifactProjectStructureElement method getUsagesInElement.
@Override
public List<ProjectStructureElementUsage> getUsagesInElement() {
final Artifact artifact = myArtifactsStructureContext.getArtifactModel().getArtifactByOriginal(myOriginalArtifact);
final List<ProjectStructureElementUsage> usages = new ArrayList<>();
final CompositePackagingElement<?> rootElement = myArtifactsStructureContext.getRootElement(artifact);
ArtifactUtil.processPackagingElements(rootElement, null, new PackagingElementProcessor<PackagingElement<?>>() {
@Override
public boolean process(@NotNull PackagingElement<?> packagingElement, @NotNull PackagingElementPath path) {
ProjectStructureElement element = getProjectStructureElementFor(packagingElement, ArtifactProjectStructureElement.this.myContext, ArtifactProjectStructureElement.this.myArtifactsStructureContext);
if (element != null) {
usages.add(createUsage(packagingElement, element, path.getPathStringFrom("/", rootElement)));
}
return true;
}
}, myArtifactsStructureContext, false, artifact.getArtifactType());
return usages;
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class UiDesignerExternalBuildTest method testCopyFormsRuntimeToArtifact.
//IDEA-94779
public void testCopyFormsRuntimeToArtifact() throws IOException {
VirtualFile file = createFile("src/A.java", "class A{}");
VirtualFile srcRoot = file.getParent();
Module module = addModule("a", srcRoot);
Artifact a = addArtifact(root().module(module));
make(a);
assertOutput(a, fs().file("A.class"));
File dir = PathManagerEx.findFileUnderCommunityHome("plugins/ui-designer/testData/build/copyFormsRuntimeToArtifact");
FileUtil.copyDir(dir, VfsUtilCore.virtualToIoFile(srcRoot));
srcRoot.refresh(false, false);
make(a);
File outputDir = VfsUtilCore.virtualToIoFile(getOutputDir(a));
assertTrue(new File(outputDir, "A.class").exists());
assertTrue(new File(outputDir, "B.class").exists());
assertTrue(new File(outputDir, AbstractLayout.class.getName().replace('.', '/') + ".class").exists());
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class AppEngineUtil method collectAppEngineArtifacts.
public static List<Artifact> collectAppEngineArtifacts(@NotNull Project project, final boolean withAppEngineFacetOnly) {
final List<Artifact> artifacts = new ArrayList<>();
if (project.isDefault())
return artifacts;
for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
if (AppEngineWebIntegration.getInstance().getAppEngineTargetArtifactTypes().contains(artifact.getArtifactType()) && (!withAppEngineFacetOnly || findAppEngineFacet(project, artifact) != null)) {
artifacts.add(artifact);
}
}
Collections.sort(artifacts, ArtifactManager.ARTIFACT_COMPARATOR);
return artifacts;
}
Aggregations