• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Artifact类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.packaging.artifacts.Artifact的典型用法代码示例。如果您正苦于以下问题:Java Artifact类的具体用法?Java Artifact怎么用?Java Artifact使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Artifact类属于com.intellij.packaging.artifacts包,在下文中一共展示了Artifact类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createDeploymentRuntime

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
@Override
public CloudDeploymentRuntime createDeploymentRuntime(DeploymentSource source,
                                                      CloudMultiSourceServerRuntimeInstance serverRuntime,
                                                      DeploymentTask<? extends CloudDeploymentNameConfiguration> deploymentTask,
                                                      DeploymentLogManager logManager)
  throws ServerRuntimeException {
  if (!(source instanceof ArtifactDeploymentSource)) {
    return null;
  }

  ArtifactDeploymentSource artifactSource = (ArtifactDeploymentSource)source;
  Artifact artifact = artifactSource.getArtifact();
  if (artifact == null) {
    throw new ServerRuntimeException("Artifact not found " + artifactSource.getArtifactPointer().getArtifactName());
  }

  String artifactPath = artifact.getOutputFilePath();
  if (artifactPath == null) {
    throw new ServerRuntimeException("Artifact output not found");
  }

  return doCreateDeploymentRuntime(artifactSource, new File(artifactPath), serverRuntime, deploymentTask, logManager);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ArtifactDeploymentRuntimeProviderBase.java


示例2: computeParentPathToArtifactMap

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
private MultiValuesMap<String, Artifact> computeParentPathToArtifactMap() {
  final MultiValuesMap<String, Artifact> result = new MultiValuesMap<String, Artifact>();
  for (final Artifact artifact : myArtifactManager.getArtifacts()) {
    ArtifactUtil.processFileOrDirectoryCopyElements(artifact, new PackagingElementProcessor<FileOrDirectoryCopyPackagingElement<?>>() {
      @Override
      public boolean process(@NotNull FileOrDirectoryCopyPackagingElement<?> element, @NotNull PackagingElementPath pathToElement) {
        String path = element.getFilePath();
        while (path.length() > 0) {
          result.put(path, artifact);
          path = PathUtil.getParentPath(path);
        }
        return true;
      }
    }, myArtifactManager.getResolvingContext(), false);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ArtifactVirtualFileListener.java


示例3: findArtifacts

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
@Override
public Collection<? extends Artifact> findArtifacts(@NotNull VirtualFile sourceFile) {
  final MultiValuesMap<VirtualFile, Artifact> map = getFileToArtifactsMap().getValue();
  if (map.isEmpty()) {
    return Collections.emptyList();
  }

  List<Artifact> result = null;
  VirtualFile file = sourceFile;
  while (file != null) {
    final Collection<Artifact> artifacts = map.get(file);
    if (artifacts != null) {
      if (result == null) {
        result = new SmartList<Artifact>();
      }
      result.addAll(artifacts);
    }
    file = file.getParent();
  }
  return result != null ? result : Collections.<Artifact>emptyList();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ArtifactBySourceFileFinderImpl.java


示例4: createOutputToArtifactMap

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
public static MultiMap<String, Artifact> createOutputToArtifactMap(final Project project) {
  final MultiMap<String, Artifact> result = MultiMap.create(FileUtil.PATH_HASHING_STRATEGY);
  new ReadAction() {
    protected void run(@NotNull final Result r) {
      for (Artifact artifact : ArtifactManager.getInstance(project).getArtifacts()) {
        String outputPath = artifact.getOutputFilePath();
        if (!StringUtil.isEmpty(outputPath)) {
          result.putValue(outputPath, artifact);
        }
      }
    }
  }.execute();


  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ArtifactCompilerUtil.java


示例5: reimportFacet

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
@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());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AppEngineFacetImporter.java


示例6: getNotAddedLibraries

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
private static List<? extends Library> getNotAddedLibraries(@NotNull final ArtifactEditorContext context, @NotNull Artifact artifact,
                                                           List<Library> librariesList) {
  final Set<VirtualFile> roots = new HashSet<VirtualFile>();
  ArtifactUtil.processPackagingElements(artifact, PackagingElementFactoryImpl.FILE_COPY_ELEMENT_TYPE, new Processor<FileCopyPackagingElement>() {
    @Override
    public boolean process(FileCopyPackagingElement fileCopyPackagingElement) {
      final VirtualFile root = fileCopyPackagingElement.getLibraryRoot();
      if (root != null) {
        roots.add(root);
      }
      return true;
    }
  }, context, true);
  final List<Library> result = new ArrayList<Library>();
  for (Library library : librariesList) {
    if (!roots.containsAll(Arrays.asList(library.getFiles(OrderRootType.CLASSES)))) {
      result.add(library);
    }
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ModulesAndLibrariesSourceItemsProvider.java


示例7: testCopyFormsRuntimeToArtifact

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:UiDesignerExternalBuildTest.java


示例8: initArtifacts

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
@Override
public void initArtifacts(Project project, GenerationOptions genOptions, CompositeGenerator generator) {
  final Collection<? extends Artifact> artifacts =
    ArtifactManager.getInstance(project).getArtifactsByType(JavaFxApplicationArtifactType.getInstance());
  if (artifacts.isEmpty()) return;
  final Sdk[] jdks = BuildProperties.getUsedJdks(project);
  Sdk javaSdk = null;
  for (Sdk jdk : jdks) {
    if (jdk.getSdkType() instanceof JavaSdkType) {
      javaSdk = jdk;
      break;
    }
  }
  if (javaSdk != null) {
    final Tag taskdef = new Tag("taskdef",
                                Couple.of("resource", "com/sun/javafx/tools/ant/antlib.xml"),
                                Couple.of("uri", "javafx:com.sun.javafx.tools.ant"),
                                Couple.of("classpath",
                                          BuildProperties
                                            .propertyRef(BuildProperties.getJdkHomeProperty(javaSdk.getName())) +
                                          "/lib/ant-javafx.jar"));
    generator.add(taskdef);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JavaFxChunkBuildExtension.java


示例9: getFileToArtifactsMap

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
public CachedValue<MultiValuesMap<VirtualFile, Artifact>> getFileToArtifactsMap() {
  if (myFile2Artifacts == null) {
    myFile2Artifacts =
      CachedValuesManager.getManager(myProject).createCachedValue(new CachedValueProvider<MultiValuesMap<VirtualFile, Artifact>>() {
        public Result<MultiValuesMap<VirtualFile, Artifact>> compute() {
          MultiValuesMap<VirtualFile, Artifact> result = computeFileToArtifactsMap();
          List<ModificationTracker> trackers = new ArrayList<ModificationTracker>();
          trackers.add(ArtifactManager.getInstance(myProject).getModificationTracker());
          for (ComplexPackagingElementType<?> type : PackagingElementFactory.getInstance().getComplexElementTypes()) {
            ContainerUtil.addIfNotNull(type.getAllSubstitutionsModificationTracker(myProject), trackers);
          }
          return Result.create(result, trackers.toArray(new ModificationTracker[trackers.size()]));
        }
      }, false);
  }
  return myFile2Artifacts;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ArtifactBySourceFileFinderImpl.java


示例10: getJarArtifacts

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
@Override
public Collection<? extends ArtifactEntry> getJarArtifacts(Project project) {
    if(project == null)
        return Collections.emptyList();
    ArtifactManager artifactManager = ArtifactManager.getInstance(project);
    final Collection<? extends Artifact> jarArtifacts = artifactManager.getArtifactsByType(ArtifactType.findById(JAR_ARTIFACT_TYPE));
    ArrayList<ArtifactEntry> artifactEntries = new ArrayList<>();
    for(Artifact artifact : jarArtifacts)
        artifactEntries.add(new ArtifactEntry(artifact));
    return artifactEntries;
}
 
开发者ID:satr,项目名称:intellij-idea-plugin-connector-for-aws-lambda,代码行数:12,代码来源:ProjectModelImpl.java


示例11: actionPerformed

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent event) {
    Project project = event.getProject();
    if (project == null) {
        show("There isn't a project!", NotificationType.ERROR);
        return;
    }

    Module module = findModule(event);
    if (module == null) return;
    String name = module.getName();
    ArtifactManager manager = ArtifactManager.getInstance(project);
    Artifact searchArtifact = manager.findArtifact(name);
    if (searchArtifact != null) {
        show("An artifact with this name already exists!", NotificationType.ERROR);
        return;
    }
    ArtifactType type = ArtifactType.findById("jar");
    if (type == null) {
        show("Error: Cannot find artifact type!", NotificationType.ERROR);
        return;
    }

    PackagingElementFactory elementFactory = PackagingElementFactory.getInstance();
    CompositePackagingElement<?> packagingElement = elementFactory.createArchive(name + ".jar");
    packagingElement.addOrFindChild(elementFactory.createModuleOutput(module));

    Artifact artifact = manager.addArtifact(name, type, packagingElement);

    if (artifact instanceof ModifiableArtifact) {
        ModifiableArtifact modArtifact = (ModifiableArtifact) artifact;
        modArtifact.setBuildOnMake(true);
    }

    show("Artifact with name \"" + name + "\" created!");
}
 
开发者ID:LukWebsForge,项目名称:FastArtifact,代码行数:37,代码来源:CreateArtifact.java


示例12: doBuild

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
private static void doBuild(@NotNull Project project, final @NotNull List<ArtifactPopupItem> items, boolean rebuild) {
  final Set<Artifact> artifacts = getArtifacts(items, project);
  final CompileScope scope = ArtifactCompileScope.createArtifactsScope(project, artifacts, rebuild);

  ArtifactsWorkspaceSettings.getInstance(project).setArtifactsToBuild(artifacts);
  //in external build we can set 'rebuild' flag per target type
  CompilerManager.getInstance(project).make(scope, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:BuildArtifactAction.java


示例13: setUpArtifact

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
@Override
public void setUpArtifact(@NotNull Artifact artifact, @NotNull NewArtifactConfiguration configuration) {
  final AndroidFacet facet = AndroidArtifactUtil.getPackagedFacet(myProject, artifact);

  if (facet != null) {
    final ArtifactProperties<?> properties = artifact.getProperties(AndroidArtifactPropertiesProvider.getInstance());

    if (properties instanceof AndroidApplicationArtifactProperties) {
      final AndroidApplicationArtifactProperties p = (AndroidApplicationArtifactProperties)properties;
      p.setProGuardCfgFiles(facet.getProperties().myProGuardCfgFiles);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AndroidApplicationArtifactType.java


示例14: createArtifactPlace

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
public Place createArtifactPlace(Artifact artifact) {
  Place place = createPlaceFor(myArtifactsStructureConfigurable);
  if (artifact != null) {
    place.putPath(BaseStructureConfigurable.TREE_NAME, artifact.getName());
  }
  return place;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ProjectStructureConfigurable.java


示例15: addArtifactToLayout

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
public static void addArtifactToLayout(final Project project, final Artifact parent, final Artifact toAdd) {
  new WriteAction() {
    @Override
    protected void run(@NotNull final Result result) {
      final ModifiableArtifactModel model = ArtifactManager.getInstance(project).createModifiableModel();
      final PackagingElement<?> artifactElement = PackagingElementFactory.getInstance().createArtifactElement(toAdd, project);
      model.getOrCreateModifiableArtifact(parent).getRootElement().addOrFindChild(artifactElement);
      model.commit();
    }
  }.execute();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ArtifactsTestUtil.java


示例16: findArtifact

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
public Artifact findArtifact(@NotNull String name) {
  if (myArtifactsMap == null) {
    myArtifactsMap = new HashMap<String, Artifact>();
    for (Artifact artifact : getArtifactsList()) {
      myArtifactsMap.put(artifact.getName(), artifact);
    }
  }
  return myArtifactsMap.get(name);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:ArtifactModelBase.java


示例17: createArtifactsScope

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
private CompileScope createArtifactsScope(String[] artifactNames) {
  List<Artifact> artifacts = new ArrayList<Artifact>();
  for (String name : artifactNames) {
    artifacts.add(ArtifactsTestUtil.findArtifact(myProject, name));
  }
  return ArtifactCompileScope.createArtifactsScope(myProject, artifacts);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:MavenCompilingTestCase.java


示例18: applyChanges

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
@Override
public void applyChanges(ModifiableArtifactModel artifactModel, final PackagingElementResolvingContext context) {
  myManifestFiles.saveManifestFiles();
  final List<Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>>> elementsToInclude =
    new ArrayList<Pair<? extends CompositePackagingElement<?>, List<PackagingElement<?>>>>();
  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());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ArtifactExternalDependenciesImporterImpl.java


示例19: addLibraryToArtifact

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
@Override
public void addLibraryToArtifact(@NotNull Library library, @NotNull Artifact artifact, @NotNull Project project) {
  final ArtifactManager artifactManager = ArtifactManager.getInstance(project);
  for (PackagingElement<?> element : PackagingElementFactory.getInstance().createLibraryElements(library)) {
    final String dir = element.getFilesKind(artifactManager.getResolvingContext()).containsDirectoriesWithClasses() ? "classes" : "lib";
    artifactManager.addElementsToDirectory(artifact, "WEB-INF/" + dir, element);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AppEngineCommunityWebIntegration.java


示例20: PlaceInArtifact

import com.intellij.packaging.artifacts.Artifact; //导入依赖的package包/类
public PlaceInArtifact(Artifact artifact, ArtifactsStructureConfigurableContext context, @Nullable String parentPath,
                       @Nullable PackagingElement<?> packagingElement) {
  myArtifact = artifact;
  myContext = context;
  myParentPath = parentPath;
  myPackagingElement = packagingElement;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PlaceInArtifact.java



注:本文中的com.intellij.packaging.artifacts.Artifact类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java IKeyLookup类代码示例发布时间:2022-05-22
下一篇:
Java SliceImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap