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

Java JpsProject类代码示例

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

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



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

示例1: loadProject

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
public static void loadProject(final JpsProject project, Map<String, String> pathVariables, String projectPath) throws IOException {
  File file = new File(FileUtil.toCanonicalPath(projectPath));
  if (file.isFile() && projectPath.endsWith(".ipr")) {
    new JpsProjectLoader(project, pathVariables, file.getParentFile()).loadFromIpr(file);
  }
  else {
    File dotIdea = new File(file, PathMacroUtil.DIRECTORY_STORE_NAME);
    File directory;
    if (dotIdea.isDirectory()) {
      directory = dotIdea;
    }
    else if (file.isDirectory() && file.getName().equals(PathMacroUtil.DIRECTORY_STORE_NAME)) {
      directory = file;
    }
    else {
      throw new IOException("Cannot find IntelliJ IDEA project files at " + projectPath);
    }
    new JpsProjectLoader(project, pathVariables, directory.getParentFile()).loadFromDirectory(directory);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:JpsProjectLoader.java


示例2: loadExtension

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
  String projectEncoding = null;
  Map<String, String> urlToEncoding = new HashMap<String, String>();
  for (Element fileTag : JDOMUtil.getChildren(componentTag, "file")) {
    String url = fileTag.getAttributeValue("url");
    String encoding = fileTag.getAttributeValue("charset");
    if (url.equals("PROJECT")) {
      projectEncoding = encoding;
    }
    else {
      urlToEncoding.put(url, encoding);
    }
  }
  JpsEncodingConfigurationService.getInstance().setEncodingConfiguration(project, projectEncoding, urlToEncoding);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JpsEncodingModelSerializerExtension.java


示例3: buildStarted

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public void buildStarted(CompileContext context) {
  final JpsProject project = context.getProjectDescriptor().getProject();
  final JpsJavaCompilerConfiguration config = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project);
  final String compilerId = config == null? JavaCompilers.JAVAC_ID : config.getJavaCompilerId();
  if (LOG.isDebugEnabled()) {
    LOG.debug("Java compiler ID: " + compilerId);
  }
  final boolean isJavac = JavaCompilers.JAVAC_ID.equalsIgnoreCase(compilerId) || JavaCompilers.JAVAC_API_ID.equalsIgnoreCase(compilerId);
  final boolean isEclipse = JavaCompilers.ECLIPSE_ID.equalsIgnoreCase(compilerId) || JavaCompilers.ECLIPSE_EMBEDDED_ID.equalsIgnoreCase(compilerId);
  IS_ENABLED.set(context, isJavac || isEclipse);
  String messageText = null;
  if (isJavac) {
    messageText = "Using javac " + System.getProperty("java.version") + " to compile java sources";
  }
  else if (isEclipse) {
    messageText = "Using eclipse compiler to compile java sources";
  }
  COMPILER_VERSION_INFO.set(context, new AtomicReference<String>(messageText));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:JavaBuilder.java


示例4: loadExtension

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
  Element fwList = componentTag.getChild("compilers");
  if (fwList != null) {
    Element fw = fwList.getChild("compiler");
    if (fw != null) {
      String url = fw.getAttributeValue("url");
      if (url != null) {
        boolean noWarn = toBoolean(fw.getAttributeValue("nowarn"));
        boolean strict = toBoolean(fw.getAttributeValue("strict"));
        boolean verbose = toBoolean(fw.getAttributeValue("verbose"));
        boolean recurse = toBoolean(fw.getAttributeValue("recurse"));
        boolean debug = toBoolean(fw.getAttributeValue("debug"));
        boolean allowNegKeys = toBoolean(fw.getAttributeValue("allownegkeys"));
        boolean allow64bitConsts = toBoolean(fw.getAttributeValue("allow64bitconsts"));

        ThriftConfig config = new ThriftConfig(url, noWarn, strict, verbose, recurse, debug, allowNegKeys, allow64bitConsts);
        project.getContainer().setChild(ThriftConfig.ROLE, config);
      }
    }
  }
}
 
开发者ID:fkorotkov,项目名称:intellij-thrift,代码行数:23,代码来源:ThriftProjectExtensionSerializer.java


示例5: buildStarted

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public void buildStarted(CompileContext context) {
  final JpsProject project = context.getProjectDescriptor().getProject();
  final JpsJavaCompilerConfiguration config = JpsJavaExtensionService.getInstance().getCompilerConfiguration(project);
  final String compilerId = config == null? JavaCompilers.JAVAC_ID : config.getJavaCompilerId();
  if (LOG.isDebugEnabled()) {
    LOG.debug("Java compiler ID: " + compilerId);
  }
  JavaCompilingTool compilingTool = JavaBuilderUtil.findCompilingTool(compilerId);
  COMPILING_TOOL.set(context, compilingTool);
  String messageText = compilingTool != null ? "Using " + compilingTool.getDescription() + " to compile java sources" : null;
  COMPILER_VERSION_INFO.set(context, new AtomicReference<String>(messageText));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JavaBuilder.java


示例6: createFileFilter

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@NotNull
@Override
public FileFilter createFileFilter() {
  final JpsProject project = getTarget().getModule().getProject();
  final JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project);
  final JpsCompilerExcludes excludes = configuration.getCompilerExcludes();
  return new FileFilter() {
    @Override
    public boolean accept(File file) {
      return !excludes.isExcluded(file) && configuration.isResourceFile(file, getRootFile());
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:FilteredResourceRootDescriptor.java


示例7: getOrCreateCompilerConfiguration

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@NotNull
@Override
public JpsJavaCompilerConfiguration getOrCreateCompilerConfiguration(@NotNull JpsProject project) {
  JpsJavaCompilerConfiguration configuration = getCompilerConfiguration(project);
  if (configuration == null) {
    configuration = project.getContainer().setChild(JpsJavaCompilerConfigurationImpl.ROLE, new JpsJavaCompilerConfigurationImpl());
  }
  return configuration;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JpsJavaExtensionServiceImpl.java


示例8: getSortedArtifacts

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public List<JpsArtifact> getSortedArtifacts(@NotNull JpsProject project) {
  List<JpsArtifact> artifacts = new ArrayList<JpsArtifact>(getArtifacts(project));
  Collections.sort(artifacts, new Comparator<JpsArtifact>() {
    @Override
    public int compare(JpsArtifact o1, JpsArtifact o2) {
      return o1.getName().compareToIgnoreCase(o2.getName());
    }
  });
  return artifacts;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JpsArtifactServiceImpl.java


示例9: addArtifact

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public <P extends JpsElement> JpsArtifact addArtifact(@NotNull JpsProject project,
                                                      @NotNull String name,
                                                      @NotNull JpsCompositePackagingElement rootElement,
                                                      @NotNull JpsArtifactType<P> type,
                                                      @NotNull P properties) {
  JpsArtifact artifact = createArtifact(name, rootElement, type, properties);
  return project.getContainer().getOrSetChild(JpsArtifactRole.ARTIFACT_COLLECTION_ROLE).addChild(artifact);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JpsArtifactServiceImpl.java


示例10: loadExtension

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
  JpsJavaProjectExtension extension = getService().getOrCreateProjectExtension(project);
  final Element output = componentTag.getChild(OUTPUT_TAG);
  if (output != null) {
    String url = output.getAttributeValue(URL_ATTRIBUTE);
    if (url != null) {
      extension.setOutputUrl(url);
    }
  }
  String languageLevel = componentTag.getAttributeValue(LANGUAGE_LEVEL_ATTRIBUTE);
  if (languageLevel != null) {
    extension.setLanguageLevel(LanguageLevel.valueOf(languageLevel));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:JpsJavaModelSerializerExtension.java


示例11: saveExtension

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public void saveExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
  JpsJavaProjectExtension extension = getService().getProjectExtension(project);
  if (extension == null) return;

  String outputUrl = extension.getOutputUrl();
  if (outputUrl != null) {
    componentTag.addContent(new Element(OUTPUT_TAG).setAttribute(URL_ATTRIBUTE, outputUrl));
  }
  LanguageLevel level = extension.getLanguageLevel();
  componentTag.setAttribute(LANGUAGE_LEVEL_ATTRIBUTE, level.name());
  componentTag.setAttribute("assert-keyword", Boolean.toString(level.compareTo(LanguageLevel.JDK_1_4) >= 0));
  componentTag.setAttribute("jdk-15", Boolean.toString(level.compareTo(LanguageLevel.JDK_1_5) >= 0));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:JpsJavaModelSerializerExtension.java


示例12: loadExtension

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
  JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project);
  EclipseCompilerOptions options = XmlSerializer.deserialize(componentTag, EclipseCompilerOptions.class);
  if (options == null) {
    options = new EclipseCompilerOptions();
  }
  configuration.setCompilerOptions(myCompilerId, options);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JpsEclipseCompilerOptionsSerializer.java


示例13: loadExtension

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public void loadExtension(@NotNull JpsProject project, @NotNull Element componentTag) {
  JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(project);
  String assertNotNull = JDOMExternalizerUtil.readField(componentTag, "ASSERT_NOT_NULL");
  if (assertNotNull != null) {
    configuration.setAddNotNullAssertions(Boolean.parseBoolean(assertNotNull));
  }
  String clearOutputDirectory = JDOMExternalizerUtil.readField(componentTag, "CLEAR_OUTPUT_DIRECTORY");
  configuration.setClearOutputDirectoryOnRebuild(clearOutputDirectory == null || Boolean.parseBoolean(clearOutputDirectory));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JpsJavaCompilerWorkspaceConfigurationSerializer.java


示例14: loadRunConfiguration

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
private static <P extends JpsElement> void loadRunConfiguration(final String name, Element configurationTag,
                                                                JpsRunConfigurationPropertiesSerializer<P> serializer,
                                                                JpsProject project) {
  P properties = serializer.loadProperties(configurationTag);
  project.addRunConfiguration(name, serializer.getType(), properties);

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:JpsRunConfigurationSerializer.java


示例15: getLibraryLevel

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
public String getLibraryLevel() {
  final JpsElementReference<? extends JpsCompositeElement> reference = myDependencyElement.getLibraryReference().getParentReference();
  final JpsCompositeElement parent = reference.resolve();
  if (parent instanceof JpsGlobal) return LibraryTablesRegistrar.APPLICATION_LEVEL;
  if (parent instanceof JpsProject) return LibraryTablesRegistrar.PROJECT_LEVEL;
  if (parent instanceof JpsModule) return LibraryTableImplUtil.MODULE_LEVEL;
  return LibraryTablesRegistrar.PROJECT_LEVEL;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JpsLibraryOrderEntry.java


示例16: hasAndroidGradleFacet

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
/**
 * Indicates whether any of the modules in the given IDEA project has the Android-Gradle facet.
 *
 * @param project the given IDEA project.
 * @return {@code true} if the project contains the Android-Gradle facet; {@code false} otherwise.
 */
public static boolean hasAndroidGradleFacet(@NotNull JpsProject project) {
  for (JpsModule module : project.getModules()) {
    if (getExtension(module) != null) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AndroidGradleJps.java


示例17: computeAllTargets

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
@NotNull
public List<AndroidGradleBuildTarget> computeAllTargets(@NotNull JpsModel model) {
  JpsProject project = model.getProject();
  if (!AndroidGradleJps.hasAndroidGradleFacet(project)) {
    return Collections.emptyList();
  }

  return Collections.singletonList(new AndroidGradleBuildTarget(project));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AndroidGradleBuildTarget.java


示例18: createLoader

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
@Override
@NotNull
public BuildTargetLoader<AndroidGradleBuildTarget> createLoader(@NotNull JpsModel model) {
  final JpsProject project = model.getProject();
  return new BuildTargetLoader<AndroidGradleBuildTarget>() {
    @Nullable
    @Override
    public AndroidGradleBuildTarget createTarget(@NotNull String targetId) {
      return AndroidGradleBuildTargetScopeProvider.TARGET_ID.equals(targetId) && AndroidGradleJps.hasAndroidGradleFacet(project)
             ? new AndroidGradleBuildTarget(project)
             : null;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:AndroidGradleBuildTarget.java


示例19: AndroidGradleBuilder

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
protected AndroidGradleBuilder() {
  super(BuilderCategory.TRANSLATOR);
  ResourcesBuilder.registerEnabler(new StandardResourceBuilderEnabler() {
    @Override
    public boolean isResourceProcessingEnabled(JpsModule module) {
      JpsProject project = module.getProject();
      return !AndroidGradleJps.hasAndroidGradleFacet(project);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:AndroidGradleBuilder.java


示例20: buildStarted

import org.jetbrains.jps.model.JpsProject; //导入依赖的package包/类
/**
 * Disables IDEA's Java and Android builders for Gradle-imported projects. They are no longer needed since we build with Gradle.
 */
@Override
public void buildStarted(CompileContext context) {
  JpsProject project = context.getProjectDescriptor().getProject();
  if (AndroidGradleJps.hasAndroidGradleFacet(project)) {
    JavaBuilder.IS_ENABLED.set(context, false);
    AndroidSourceGeneratingBuilder.IS_ENABLED.set(context, false);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AndroidGradleBuilder.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java RandomAccessFileDataSource类代码示例发布时间:2022-05-22
下一篇:
Java NPointer类代码示例发布时间: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