示例#1
0
 @Override
 public ArtifactManagerState getState() {
   final ArtifactManagerState state = new ArtifactManagerState();
   for (Artifact artifact : getAllArtifactsIncludingInvalid()) {
     final ArtifactState artifactState;
     if (artifact instanceof InvalidArtifact) {
       artifactState = ((InvalidArtifact) artifact).getState();
     } else {
       artifactState = new ArtifactState();
       artifactState.setBuildOnMake(artifact.isBuildOnMake());
       artifactState.setName(artifact.getName());
       artifactState.setOutputPath(artifact.getOutputPath());
       artifactState.setRootElement(serializePackagingElement(artifact.getRootElement()));
       artifactState.setArtifactType(artifact.getArtifactType().getId());
       for (ArtifactPropertiesProvider provider : artifact.getPropertiesProviders()) {
         final ArtifactPropertiesState propertiesState =
             serializeProperties(provider, artifact.getProperties(provider));
         if (propertiesState != null) {
           artifactState.getPropertiesList().add(propertiesState);
         }
       }
       Collections.sort(
           artifactState.getPropertiesList(),
           new Comparator<ArtifactPropertiesState>() {
             @Override
             public int compare(
                 @NotNull ArtifactPropertiesState o1, @NotNull ArtifactPropertiesState o2) {
               return o1.getId().compareTo(o2.getId());
             }
           });
     }
     state.getArtifacts().add(artifactState);
   }
   return state;
 }
示例#2
0
 @NotNull
 @Override
 public PackagingElementOutputKind getKindOfProducedElements() {
   return myArtifact.getArtifactType() instanceof JarArtifactType
       ? PackagingElementOutputKind.JAR_FILES
       : PackagingElementOutputKind.OTHER;
 }
 @Nullable
 public static VirtualFile findSourceFileByOutputPath(
     Artifact artifact, String outputPath, PackagingElementResolvingContext context) {
   final List<VirtualFile> files =
       findSourceFilesByOutputPath(
           artifact.getRootElement(), outputPath, context, artifact.getArtifactType());
   return files.isEmpty() ? null : files.get(0);
 }
 public static <E extends PackagingElement<?>> boolean processPackagingElements(
     @NotNull Artifact artifact,
     @Nullable PackagingElementType<E> type,
     @NotNull PackagingElementProcessor<? super E> processor,
     final @NotNull PackagingElementResolvingContext resolvingContext,
     final boolean processSubstitutions) {
   return processPackagingElements(
       artifact.getRootElement(),
       type,
       processor,
       resolvingContext,
       processSubstitutions,
       artifact.getArtifactType());
 }
 @NotNull
 @Override
 public List<DeploymentSource> createArtifactDeploymentSources(
     Project project, ArtifactType... artifactTypes) {
   if (project.isDefault()) return Collections.emptyList();
   Artifact[] artifacts = ArtifactManager.getInstance(project).getArtifacts();
   List<Artifact> supportedArtifacts = new ArrayList<>();
   Set<ArtifactType> typeSet = ContainerUtil.set(artifactTypes);
   for (Artifact artifact : artifacts) {
     if (typeSet.contains(artifact.getArtifactType())) {
       supportedArtifacts.add(artifact);
     }
   }
   return createArtifactDeploymentSources(project, supportedArtifacts);
 }
 @NotNull
 private static Artifact findOrCreateWebArtifact(AppEngineFacet appEngineFacet) {
   Module module = appEngineFacet.getModule();
   ArtifactType webArtifactType =
       AppEngineWebIntegration.getInstance().getAppEngineWebArtifactType();
   final Collection<Artifact> artifacts = ArtifactUtil.getArtifactsContainingModuleOutput(module);
   for (Artifact artifact : artifacts) {
     if (webArtifactType.equals(artifact.getArtifactType())) {
       return artifact;
     }
   }
   ArtifactManager artifactManager = ArtifactManager.getInstance(module.getProject());
   PackagingElementFactory elementFactory = PackagingElementFactory.getInstance();
   ArtifactRootElement<?> root = elementFactory.createArtifactRootElement();
   elementFactory
       .getOrCreateDirectory(root, "WEB-INF/classes")
       .addOrFindChild(elementFactory.createModuleOutput(module));
   return artifactManager.addArtifact(module.getName(), webArtifactType, root);
 }