use of com.intellij.packaging.artifacts.Artifact in project azure-tools-for-java by Microsoft.
the class SparkSubmitModel method action.
public void action(@NotNull SparkSubmissionParameter submissionParameter) {
HDInsightUtil.getJobStatusManager(project).setJobRunningState(true);
setSubmissionParameters(submissionParameter);
postEventAction();
if (isLocalArtifact()) {
submit();
} else {
final List<Artifact> artifacts = new ArrayList<>();
final Artifact artifact = artifactHashMap.get(submissionParameter.getArtifactName());
artifacts.add(artifact);
ArtifactsWorkspaceSettings.getInstance(project).setArtifactsToBuild(artifacts);
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
final CompileScope scope = ArtifactCompileScope.createArtifactsScope(project, artifacts, true);
CompilerManager.getInstance(project).make(scope, new CompileStatusNotification() {
@Override
public void finished(boolean aborted, int errors, int warnings, CompileContext compileContext) {
if (aborted || errors != 0) {
showCompilerErrorMessage(compileContext);
HDInsightUtil.getJobStatusManager(project).setJobRunningState(false);
} else {
postEventProperty.put("IsSubmitSucceed", "true");
postEventProperty.put("SubmitFailedReason", "CompileSuccess");
AppInsightsClient.create(HDInsightBundle.message("SparkProjectCompileSuccess"), null, postEventProperty);
HDInsightUtil.showInfoOnSubmissionMessageWindow(project, String.format("Info : Build %s successfully.", artifact.getOutputFile()));
submit();
}
}
});
}
}, ModalityState.defaultModalityState());
}
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class ArtifactBySourceFileFinderImpl method computeFileToArtifactsMap.
private MultiValuesMap<VirtualFile, Artifact> computeFileToArtifactsMap() {
final MultiValuesMap<VirtualFile, Artifact> result = new MultiValuesMap<>();
final ArtifactManager artifactManager = ArtifactManager.getInstance(myProject);
for (final Artifact artifact : artifactManager.getArtifacts()) {
final PackagingElementResolvingContext context = artifactManager.getResolvingContext();
ArtifactUtil.processPackagingElements(artifact, null, new PackagingElementProcessor<PackagingElement<?>>() {
@Override
public boolean process(@NotNull PackagingElement<?> element, @NotNull PackagingElementPath path) {
if (element instanceof FileOrDirectoryCopyPackagingElement<?>) {
final VirtualFile root = ((FileOrDirectoryCopyPackagingElement) element).findFile();
if (root != null) {
result.put(root, artifact);
}
} else if (element instanceof ModuleOutputPackagingElement) {
for (VirtualFile sourceRoot : ((ModuleOutputPackagingElement) element).getSourceRoots(context)) {
result.put(sourceRoot, artifact);
}
}
return true;
}
}, context, true);
}
return result;
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class ArtifactsTestUtil method findArtifact.
public static Artifact findArtifact(Project project, String artifactName) {
final ArtifactManager manager = ArtifactManager.getInstance(project);
final Artifact artifact = manager.findArtifact(artifactName);
assertNotNull("'" + artifactName + "' artifact not found", artifact);
return artifact;
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class ArtifactsWorkspaceSettings method setArtifactsToBuild.
public void setArtifactsToBuild(@NotNull Collection<? extends Artifact> artifacts) {
myState.myArtifactsToBuild.clear();
for (Artifact artifact : artifacts) {
myState.myArtifactsToBuild.add(artifact.getName());
}
Collections.sort(myState.myArtifactsToBuild);
}
use of com.intellij.packaging.artifacts.Artifact in project intellij-community by JetBrains.
the class ArtifactElementType method getAvailableArtifacts.
@NotNull
public static List<? extends Artifact> getAvailableArtifacts(@NotNull final ArtifactEditorContext context, @NotNull final Artifact artifact, final boolean notIncludedOnly) {
final Set<Artifact> result = new HashSet<>(Arrays.asList(context.getArtifactModel().getArtifacts()));
if (notIncludedOnly) {
ArtifactUtil.processPackagingElements(artifact, ARTIFACT_ELEMENT_TYPE, artifactPackagingElement -> {
result.remove(artifactPackagingElement.findArtifact(context));
return true;
}, context, true);
}
result.remove(artifact);
final Iterator<Artifact> iterator = result.iterator();
while (iterator.hasNext()) {
Artifact another = iterator.next();
final boolean notContainThis = ArtifactUtil.processPackagingElements(another, ARTIFACT_ELEMENT_TYPE, element -> !artifact.getName().equals(element.getArtifactName()), context, true);
if (!notContainThis) {
iterator.remove();
}
}
final ArrayList<Artifact> list = new ArrayList<>(result);
Collections.sort(list, ArtifactManager.ARTIFACT_COMPARATOR);
return list;
}
Aggregations