use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class AppEngineFacetImporter method reimportFacet.
@Override
protected void reimportFacet(IdeModifiableModelsProvider modelsProvider, Module module, MavenRootModelAdapter rootModel, AppEngineFacet facet, MavenProjectsTree mavenTree, MavenProject mavenProject, MavenProjectChanges changes, Map<MavenProject, String> mavenProjectToModuleName, List<MavenProjectsProcessorTask> postTasks) {
String version = getVersion(mavenProject);
if (version != null) {
String relativePath = "/com/google/appengine/appengine-java-sdk/" + version + "/appengine-java-sdk/appengine-java-sdk-" + version;
facet.getConfiguration().setSdkHomePath(FileUtil.toSystemIndependentName(mavenProject.getLocalRepository().getPath()) + relativePath);
AppEngineWebIntegration.getInstance().setupDevServer(facet.getSdk());
final String artifactName = module.getName() + ":war exploded";
final Artifact webArtifact = modelsProvider.getModifiableArtifactModel().findArtifact(artifactName);
AppEngineWebIntegration.getInstance().setupRunConfiguration(facet.getSdk(), webArtifact, module.getProject());
}
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class ExternalSystemTestCase method assertArtifactOutput.
protected void assertArtifactOutput(String artifactName, TestFileSystemItem fs) {
final Artifact artifact = ArtifactsTestUtil.findArtifact(myProject, artifactName);
final String outputFile = artifact.getOutputFilePath();
assert outputFile != null;
final File file = new File(outputFile);
assert file.exists();
fs.assertFileEqual(file);
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class PutSourceItemIntoParentAndLinkViaManifestAction method findParentAndGrandParent.
@Nullable
private ParentElementsInfo findParentAndGrandParent(Artifact artifact) {
final Ref<ParentElementsInfo> result = Ref.create(null);
ArtifactUtil.processParents(artifact, myArtifactEditor.getContext(), new ParentElementProcessor() {
@Override
public boolean process(@NotNull CompositePackagingElement<?> element, @NotNull List<Pair<Artifact, CompositePackagingElement<?>>> parents, @NotNull Artifact artifact) {
if (parents.size() == 1) {
final Pair<Artifact, CompositePackagingElement<?>> parent = parents.get(0);
result.set(new ParentElementsInfo(parent.getFirst(), parent.getSecond(), artifact, element));
return false;
}
return true;
}
}, 1);
return result.get();
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class PutSourceItemIntoParentAndLinkViaManifestAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
final List<PackagingSourceItem> items = mySourceItemsTree.getSelectedItems();
ParentElementsInfo parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());
if (parentsInfo == null) {
return;
}
final Artifact artifact = parentsInfo.getGrandparentArtifact();
final ArtifactEditorContext context = myArtifactEditor.getContext();
//todo[nik] improve
final Runnable emptyRunnable = EmptyRunnable.getInstance();
context.editLayout(artifact, emptyRunnable);
context.editLayout(parentsInfo.getParentArtifact(), emptyRunnable);
//find elements under modifiable root
parentsInfo = findParentAndGrandParent(myArtifactEditor.getArtifact());
if (parentsInfo == null) {
return;
}
final CompositePackagingElement<?> grandParent = parentsInfo.getGrandparentElement();
final List<String> classpath = new ArrayList<>();
context.editLayout(artifact, () -> {
for (PackagingSourceItem item : items) {
final List<? extends PackagingElement<?>> elements = item.createElements(context);
grandParent.addOrFindChildren(elements);
classpath.addAll(ManifestFileUtil.getClasspathForElements(elements, context, artifact.getArtifactType()));
}
});
final ArtifactEditor parentArtifactEditor = context.getOrCreateEditor(parentsInfo.getParentArtifact());
parentArtifactEditor.addToClasspath(parentsInfo.getParentElement(), classpath);
((ArtifactEditorImpl) context.getOrCreateEditor(parentsInfo.getGrandparentArtifact())).rebuildTries();
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class ModuleSourceItemGroup method createElements.
@Override
@NotNull
public List<? extends PackagingElement<?>> createElements(@NotNull ArtifactEditorContext context) {
final Set<Module> modules = new LinkedHashSet<>();
collectDependentModules(myModule, modules, context);
final Artifact artifact = context.getArtifact();
final ArtifactType artifactType = artifact.getArtifactType();
Set<PackagingSourceItem> items = new LinkedHashSet<>();
for (Module module : modules) {
for (PackagingSourceItemsProvider provider : PackagingSourceItemsProvider.EP_NAME.getExtensions()) {
final ModuleSourceItemGroup parent = new ModuleSourceItemGroup(module);
for (PackagingSourceItem sourceItem : provider.getSourceItems(context, artifact, parent)) {
if (artifactType.isSuitableItem(sourceItem) && sourceItem.isProvideElements()) {
items.add(sourceItem);
}
}
}
}
List<PackagingElement<?>> result = new ArrayList<>();
final PackagingElementFactory factory = PackagingElementFactory.getInstance();
for (PackagingSourceItem item : items) {
final String path = artifactType.getDefaultPathFor(item.getKindOfProducedElements());
if (path != null) {
result.addAll(factory.createParentDirectories(path, item.createElements(context)));
}
}
return result;
}
Aggregations