当前位置: 首页>>代码示例>>Java>>正文


Java JpsProject类代码示例

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


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


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