• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java JpsPathUtil类的典型用法和代码示例

java 4次浏览

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

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

示例1: computeRootDescriptors

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@NotNull
@Override
public List<JavaSourceRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
  List<JavaSourceRootDescriptor> roots = new ArrayList<JavaSourceRootDescriptor>();
  JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE;
  Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders = JpsServiceManager.getInstance().getExtensions(ExcludedJavaSourceRootProvider.class);
  final Set<File> moduleExcludes = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
  moduleExcludes.addAll(index.getModuleExcludes(myModule));

  roots_loop:
  for (JpsTypedModuleSourceRoot<JavaSourceRootProperties> sourceRoot : myModule.getSourceRoots(type)) {
    if (JpsPathUtil.isUnder(moduleExcludes, sourceRoot.getFile())) {
      continue;
    }
    for (ExcludedJavaSourceRootProvider provider : excludedRootProviders) {
      if (provider.isExcludedFromCompilation(myModule, sourceRoot)) {
        continue roots_loop;
      }
    }
    final String packagePrefix = sourceRoot.getProperties().getPackagePrefix();
    roots.add(new JavaSourceRootDescriptor(sourceRoot.getFile(), this, false, false, packagePrefix,
                                           computeRootExcludes(sourceRoot.getFile(), index)));
  }
  return roots;
}
 

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

示例2: setUp

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();

  baseDir = new File(PathManagerEx.getTestDataPath(getClass()) + File.separator + "compileServer" + File.separator + "incremental" + File.separator + groupName + File.separator + getProjectName());
  workDir = FileUtil.createTempDirectory("jps-build", null);

  FileUtil.copyDir(baseDir, workDir, new FileFilter() {
    @Override
    public boolean accept(File file) {
      String name = file.getName();
      return !name.endsWith(".new") && !name.endsWith(".delete");
    }
  });

  String outputPath = getAbsolutePath("out");
  JpsJavaExtensionService.getInstance().getOrCreateProjectExtension(myProject).setOutputUrl(JpsPathUtil.pathToUrl(outputPath));
}
 

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

示例3: getRootUrls

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@Override
public List<String> getRootUrls(JpsOrderRootType rootType) {
  List<String> urls = new ArrayList<String>();
  for (JpsLibraryRoot root : getRoots(rootType)) {
    switch (root.getInclusionOptions()) {
      case ROOT_ITSELF:
        urls.add(root.getUrl());
        break;
      case ARCHIVES_UNDER_ROOT:
        collectArchives(JpsPathUtil.urlToFile(root.getUrl()), false, urls);
        break;
      case ARCHIVES_UNDER_ROOT_RECURSIVELY:
        collectArchives(JpsPathUtil.urlToFile(root.getUrl()), true, urls);
        break;
    }
  }
  return urls;
}
 

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

示例4: collectArchives

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
private static void collectArchives(File file, boolean recursively, List<String> result) {
  final File[] children = file.listFiles();
  if (children != null) {
    for (File child : children) {
      final String extension = FileUtilRt.getExtension(child.getName());
      if (child.isDirectory()) {
        if (recursively) {
          collectArchives(child, recursively, result);
        }
      }
      // todo [nik] get list of extensions mapped to Archive file type from IDE settings
      else if (AR_EXTENSIONS.contains(extension)) {
        result.add(JpsPathUtil.getLibraryRootUrl(child));
      }
    }
  }
}
 

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

示例5: setModuleOutput

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
private String setModuleOutput(JpsModule module, boolean tests) {
  try {
    File file = FileUtil.createTempDirectory(module.getName(), tests ? "testSrc" : "src");
    JpsJavaModuleExtension extension = getJavaService().getOrCreateModuleExtension(module);
    String url = JpsPathUtil.getLibraryRootUrl(file);
    if (tests) {
      extension.setTestOutputUrl(url);
    }
    else {
      extension.setOutputUrl(url);
    }
    return url;
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 

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

示例6: getMainContentRoot

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@Nullable
public static File getMainContentRoot(@NotNull JpsAndroidModuleExtension extension) throws IOException {
  final JpsModule module = extension.getModule();

  final List<String> contentRoots = module.getContentRootsList().getUrls();

  if (contentRoots.size() == 0) {
    return null;
  }
  final File manifestFile = extension.getManifestFile();

  if (manifestFile != null) {
    for (String rootUrl : contentRoots) {
      final File root = JpsPathUtil.urlToFile(rootUrl);

      if (FileUtil.isAncestor(root, manifestFile, true)) {
        return root;
      }
    }
  }
  return JpsPathUtil.urlToFile(contentRoots.get(0));
}
 

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

示例7: getSourceRootsForModuleAndDependencies

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@NotNull
public static File[] getSourceRootsForModuleAndDependencies(@NotNull JpsModule rootModule) {
  final Set<File> result = new HashSet<File>();

  for (JpsModule module : getRuntimeModuleDeps(rootModule)) {
    final JpsAndroidModuleExtension extension = getExtension(module);
    File resDir = null;
    File resDirForCompilation = null;

    if (extension != null) {
      resDir = extension.getResourceDir();
      resDirForCompilation = extension.getResourceDirForCompilation();
    }

    for (JpsModuleSourceRoot root : module.getSourceRoots()) {
      final File rootDir = JpsPathUtil.urlToFile(root.getUrl());

      if ((JavaSourceRootType.SOURCE.equals(root.getRootType())
           || JavaSourceRootType.TEST_SOURCE.equals(root.getRootType()) && extension != null && extension.isPackTestCode())
          && !FileUtil.filesEqual(rootDir, resDir) && !rootDir.equals(resDirForCompilation)) {
        result.add(rootDir);
      }
    }
  }
  return result.toArray(new File[result.size()]);
}
 

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

示例8: getProguardConfigFiles

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@Nullable
@Override
public List<File> getProguardConfigFiles(@NotNull JpsModule module) throws IOException {
  final JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> sdk = module.getSdk(JpsAndroidSdkType.INSTANCE);
  final String sdkHomePath = sdk != null ? FileUtil.toSystemIndependentName(sdk.getHomePath()) : null;
  final List<String> urls = myProperties.myProGuardCfgFiles;

  if (urls == null) {
    return null;
  }
  if (urls.isEmpty()) {
    return Collections.emptyList();
  }
  final List<File> result = new ArrayList<File>();

  for (String url : urls) {
    if (sdkHomePath != null) {
      url = StringUtil.replace(url, AndroidCommonUtils.SDK_HOME_MACRO, sdkHomePath);
    }
    result.add(JpsPathUtil.urlToFile(url));
  }
  return result;
}
 

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

示例9: getOutputDir

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@Nullable
public static File getOutputDir(@Nullable File moduleOutput, ResourceRootConfiguration config, @Nullable String outputDirectory) {
  if(outputDirectory != null) {
    moduleOutput = JpsPathUtil.urlToFile(outputDirectory);
  }

  if (moduleOutput == null) {
    return null;
  }
  String targetPath = config.targetPath;
  if (StringUtil.isEmptyOrSpaces(targetPath)) {
    return moduleOutput;
  }
  final File targetPathFile = new File(targetPath);
  final File outputFile = targetPathFile.isAbsolute() ? targetPathFile : new File(moduleOutput, targetPath);
  return new File(FileUtil.toCanonicalPath(outputFile.getPath()));
}
 

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

示例10: loadExtension

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@Override
public void loadExtension(@NotNull JpsGlobal global, @NotNull Element componentTag) {
  for (Element antTag : JDOMUtil.getChildren(componentTag.getChild("registeredAnts"), "ant")) {
    String name = getValueAttribute(antTag, "name");
    String homeDir = getValueAttribute(antTag, "homeDir");
    List<String> classpath = new ArrayList<String>();
    List<String> jarDirectories = new ArrayList<String>();
    for (Element classpathItemTag : JDOMUtil.getChildren(antTag.getChild("classpath"), "classpathItem")) {
      String fileUrl = classpathItemTag.getAttributeValue("path");
      String dirUrl = classpathItemTag.getAttributeValue("dir");
      if (fileUrl != null) {
        classpath.add(JpsPathUtil.urlToPath(fileUrl));
      }
      else if (dirUrl != null) {
        jarDirectories.add(JpsPathUtil.urlToPath(dirUrl));
      }
    }

    if (name != null && homeDir != null) {
      JpsAntExtensionService.addAntInstallation(global, new JpsAntInstallationImpl(new File(homeDir), name, classpath, jarDirectories));
    }
  }
}
 

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

示例11: getBindingFileList

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
private String[] getBindingFileList(final ModuleChunk moduleChunk) {
    HashSet<String> bindings = new HashSet<String>();
    for (JpsModule module : moduleChunk.getModules()){
        for (String rootUrl : module.getContentRootsList().getUrls()){
            File root = JpsPathUtil.urlToFile(rootUrl);
            File jibxRoot = new File(root, "jibx");
            if (jibxRoot.exists() && jibxRoot.isDirectory()){
                File[] files = jibxRoot.listFiles();
                if (files != null) {
                    for (File binding : files) {
                        bindings.add(binding.getAbsolutePath());
                    }
                }
            }
        }
    }
    return bindings.toArray(new String[bindings.size()]);
}
 

开发者ID:aweigold,
项目名称:idea-plugin-jibx,
代码行数:19,
代码来源:JibxBuilder.java

示例12: computeRootDescriptors

点赞 3

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@NotNull
@Override
public List<JavaSourceRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
  List<JavaSourceRootDescriptor> roots = new ArrayList<JavaSourceRootDescriptor>();
  JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE;
  Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders = JpsServiceManager.getInstance().getExtensions(ExcludedJavaSourceRootProvider.class);
  final Set<File> moduleExcludes = new THashSet<File>(FileUtil.FILE_HASHING_STRATEGY);
  moduleExcludes.addAll(index.getModuleExcludes(myModule));

  roots_loop:
  for (JpsTypedModuleSourceRoot<JpsSimpleElement<JavaSourceRootProperties>> sourceRoot : myModule.getSourceRoots(type)) {
    if (JpsPathUtil.isUnder(moduleExcludes, sourceRoot.getFile())) {
      continue;
    }
    for (ExcludedJavaSourceRootProvider provider : excludedRootProviders) {
      if (provider.isExcludedFromCompilation(myModule, sourceRoot)) {
        continue roots_loop;
      }
    }
    final String packagePrefix = sourceRoot.getProperties().getData().getPackagePrefix();
    roots.add(new JavaSourceRootDescriptor(sourceRoot.getFile(), this, false, false, packagePrefix,
                                           computeRootExcludes(sourceRoot.getFile(), index)));
  }
  return roots;
}
 

开发者ID:lshain-android-source,
项目名称:tools-idea,
代码行数:26,
代码来源:ModuleBuildTarget.java

示例13: generateModuleOutputInstructions

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
private static void generateModuleOutputInstructions(@Nullable String outputUrl,
                                                     @NotNull ArtifactCompilerInstructionCreator creator,
                                                     @NotNull JpsPackagingElement contextElement) {
  if (outputUrl != null) {
    File directory = JpsPathUtil.urlToFile(outputUrl);
    creator.addDirectoryCopyInstructions(directory, null, creator.getInstructionsBuilder().createCopyingHandler(directory, contextElement));
  }
}
 

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

示例14: computeModuleCharsetMap

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
private Map<JpsModule, Set<String>> computeModuleCharsetMap() {
  final Map<JpsModule, Set<String>> map = new THashMap<JpsModule, Set<String>>();
  final Iterable<JavaBuilderExtension> builderExtensions = JpsServiceManager.getInstance().getExtensions(JavaBuilderExtension.class);
  for (Map.Entry<String, String> entry : myUrlToCharset.entrySet()) {
    final String fileUrl = entry.getKey();
    final String charset = entry.getValue();
    File file = JpsPathUtil.urlToFile(fileUrl);
    if (charset == null || (!file.isDirectory() && !shouldHonorEncodingForCompilation(builderExtensions, file))) continue;

    final JavaSourceRootDescriptor rootDescriptor = myRootsIndex.findJavaRootDescriptor(null, file);
    if (rootDescriptor == null) continue;

    final JpsModule module = rootDescriptor.target.getModule();
    Set<String> set = map.get(module);
    if (set == null) {
      set = new LinkedHashSet<String>();
      map.put(module, set);

      final File sourceRoot = rootDescriptor.root;
      File current = FileUtilRt.getParentFile(file);
      String parentCharset = null;
      while (current != null) {
        final String currentCharset = myUrlToCharset.get(FileUtil.toSystemIndependentName(current.getAbsolutePath()));
        if (currentCharset != null) {
          parentCharset = currentCharset;
        }
        if (FileUtil.filesEqual(current, sourceRoot)) {
          break;
        }
        current = FileUtilRt.getParentFile(current);
      }
      if (parentCharset != null) {
        set.add(parentCharset);
      }
    }
    set.add(charset);
  }

  return map;
}
 

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

示例15: getSourceRootsWithDependents

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
/**
 *
 * @param chunk
 * @return mapping "sourceRoot" -> "package prefix" Package prefix uses slashes instead of dots and ends with trailing slash
 */
@NotNull
public static Map<File, String> getSourceRootsWithDependents(ModuleChunk chunk) {
  final boolean includeTests = chunk.containsTests();
  final Map<File, String> result = new LinkedHashMap<File, String>();
  processModulesRecursively(chunk, JpsJavaClasspathKind.compile(includeTests), new Consumer<JpsModule>() {
    @Override
    public void consume(JpsModule module) {
      for (JpsModuleSourceRoot root : module.getSourceRoots()) {
        if (root.getRootType().equals(JavaSourceRootType.SOURCE) ||
            includeTests && root.getRootType().equals(JavaSourceRootType.TEST_SOURCE)) {
          String prefix = ((JavaSourceRootProperties)root.getProperties()).getPackagePrefix();
          if (!prefix.isEmpty()) {
            prefix = prefix.replace('.', '/');
            if (!prefix.endsWith("/")) {
              prefix += "/";
            }
          }
          else {
            prefix = null;
          }
          result.put(JpsPathUtil.urlToFile(root.getUrl()), prefix);
        }
      }
    }
  });
  return result;
}
 

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

示例16: getAnnotationProcessorGeneratedSourcesOutputDir

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@Nullable
public static File getAnnotationProcessorGeneratedSourcesOutputDir(JpsModule module, final boolean forTests, ProcessorConfigProfile profile) {
  final String sourceDirName = profile.getGeneratedSourcesDirectoryName(forTests);
  if (profile.isOutputRelativeToContentRoot()) {
    List<String> roots = module.getContentRootsList().getUrls();
    if (roots.isEmpty()) {
      return null;
    }
    if (roots.size() > 1) {
      roots = new ArrayList<String>(roots); // sort roots to get deterministic result
      Collections.sort(roots, new Comparator<String>() {
        @Override
        public int compare(String o1, String o2) {
          return o1.compareTo(o2);
        }
      });
    }
    final File parent = JpsPathUtil.urlToFile(roots.get(0));
    return StringUtil.isEmpty(sourceDirName)? parent : new File(parent, sourceDirName);
  }

  final File outputDir = getModuleOutputDir(module, forTests);
  if (outputDir == null) {
    return null;
  }
  return StringUtil.isEmpty(sourceDirName)? outputDir : new File(outputDir, sourceDirName);
}
 

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

示例17: testExcludeProjectOutput

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
public void testExcludeProjectOutput() throws IOException {
  File out = new File(myRoot, "out");
  getJavaService().getOrCreateProjectExtension(myProject).setOutputUrl(JpsPathUtil.pathToUrl(out.getAbsolutePath()));
  JpsModule module1 = addModule();
  getJavaService().getOrCreateModuleExtension(module1).setInheritOutput(true);
  JpsModule module2 = addModule();
  module2.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(out.getAbsolutePath()));
  getJavaService().getOrCreateModuleExtension(module2).setInheritOutput(true);

  assertNotExcluded(myRoot);
  assertExcluded(out);
  assertEmpty(getModuleExcludes(module1));
  assertSameElements(getModuleExcludes(module2), out);
}
 

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

示例18: testExcludeModuleOutput

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
public void testExcludeModuleOutput() {
  File out = new File(myRoot, "out");
  JpsModule module = addModule();
  JpsJavaModuleExtension extension = getJavaService().getOrCreateModuleExtension(module);
  extension.setExcludeOutput(true);
  extension.setOutputUrl(JpsPathUtil.pathToUrl(out.getAbsolutePath()));

  assertNotExcluded(myRoot);
  assertExcluded(out);
  assertSameElements(getModuleExcludes(module), out);

  extension.setExcludeOutput(false);
  assertNotExcluded(out);
  assertEmpty(getModuleExcludes(module));
}
 

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

示例19: testExcludeExcludedFolder

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
public void testExcludeExcludedFolder() {
  File exc = new File(myRoot, "exc");
  JpsModule module = addModule();
  module.getExcludeRootsList().addUrl(JpsPathUtil.pathToUrl(exc.getAbsolutePath()));

  assertNotExcluded(myRoot);
  assertExcluded(exc);
  assertSameElements(getModuleExcludes(module), exc);
}
 

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

示例20: testDoNotCleanIfContainsArtifactRoot

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
public void testDoNotCleanIfContainsArtifactRoot() {
  JpsModule m = addModule("m");
  String resDir = PathUtil.getParentPath(createFile("res/a.txt"));
  m.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(resDir));
  JpsArtifact a = addArtifact(root().dirCopy(resDir));
  a.setOutputPath(resDir);
  buildArtifacts(a);
  assertOutput(a, fs().file("a.txt"));

  createFile("res/b.txt");
  rebuildAll();
  assertOutput(a, fs().file("a.txt").file("b.txt"));
}
 

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

示例21: testCopyExcludedFolder

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
public void testCopyExcludedFolder() {
  //explicitly added excluded files should be copied (e.g. compile output)
  final String file = createFile("xxx/excluded/a.txt");
  createFile("xxx/excluded/CVS");
  final String excluded = PathUtil.getParentPath(file);
  final String dir = PathUtil.getParentPath(excluded);

  final JpsModule module = addModule("myModule");
  module.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(dir));
  module.getExcludeRootsList().addUrl(JpsPathUtil.pathToUrl(excluded));

  final JpsArtifact a = addArtifact(root().dirCopy(excluded));
  buildAll();
  assertOutput(a, fs().file("a.txt"));
}
 

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

示例22: testCopyExcludedFile

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
public void testCopyExcludedFile() {
  //excluded files under non-excluded directory should not be copied
  final String file = createFile("xxx/excluded/a.txt");
  createFile("xxx/b.txt");
  createFile("xxx/CVS");
  final String dir = PathUtil.getParentPath(PathUtil.getParentPath(file));

  JpsModule module = addModule("myModule");
  module.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(dir));
  module.getExcludeRootsList().addUrl(JpsPathUtil.pathToUrl(PathUtil.getParentPath(file)));

  final JpsArtifact a = addArtifact(root().dirCopy(dir));
  buildAll();
  assertOutput(a, fs().file("b.txt"));
}
 

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

示例23: testExtractDirectoryFromExcludedJar

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
public void testExtractDirectoryFromExcludedJar() throws IOException {
  String jarPath = createFile("dir/lib/j.jar");
  FileUtil.copy(new File(getJUnitJarPath()), new File(jarPath));
  JpsModule module = addModule("m");
  String libDir = PathUtil.getParentPath(jarPath);
  module.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(PathUtil.getParentPath(libDir)));
  module.getExcludeRootsList().addUrl(JpsPathUtil.pathToUrl(libDir));
  final JpsArtifact a = addArtifact("a", root().extractedDir(jarPath, "/junit/textui/"));
  buildAll();
  assertOutput(a, fs().file("ResultPrinter.class")
                      .file("TestRunner.class"));
}
 

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

示例24: testTestOnProductionDependency

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
public void testTestOnProductionDependency() {
  String depRoot = PathUtil.getParentPath(createFile("dep/A.java", "class A{}"));
  String testRoot = PathUtil.getParentPath(createFile("test/B.java", "class B extends A{}"));
  JpsModule main = addModule("main");
  main.addSourceRoot(JpsPathUtil.pathToUrl(testRoot), JavaSourceRootType.TEST_SOURCE);
  JpsModule dep = addModule("dep", depRoot);
  main.getDependenciesList().addModuleDependency(dep);
  rebuildAll();
}
 

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

示例25: testResourceRoot

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
public void testResourceRoot() {
  String file = createFile("res/A.java", "xxx");
  JpsModule m = addModule("m");
  m.addSourceRoot(JpsPathUtil.pathToUrl(PathUtil.getParentPath(file)), JavaResourceRootType.RESOURCE);
  rebuildAll();
  assertOutput(m, fs().file("A.java", "xxx"));
}
 

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

示例26: addJdk

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
protected JpsSdk<JpsDummyElement> addJdk(final String name, final String path) {
  String homePath = System.getProperty("java.home");
  String versionString = System.getProperty("java.version");
  JpsTypedLibrary<JpsSdk<JpsDummyElement>> jdk = myModel.getGlobal().addSdk(name, homePath, versionString, JpsJavaSdkType.INSTANCE);
  jdk.addRoot(JpsPathUtil.pathToUrl(path), JpsOrderRootType.COMPILED);
  return jdk.getProperties();
}
 

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

示例27: addModule

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
protected <T extends JpsElement> JpsModule addModule(String moduleName,
                                                     String[] srcPaths,
                                                     @Nullable String outputPath,
                                                     @Nullable String testOutputPath,
                                                     JpsSdk<T> sdk) {
  JpsModule module = myProject.addModule(moduleName, JpsJavaModuleType.INSTANCE);
  final JpsSdkType<T> sdkType = sdk.getSdkType();
  final JpsSdkReferencesTable sdkTable = module.getSdkReferencesTable();
  sdkTable.setSdkReference(sdkType, sdk.createReference());

  if (sdkType instanceof JpsJavaSdkTypeWrapper) {
    final JpsSdkReference<T> wrapperRef = sdk.createReference();
    sdkTable.setSdkReference(JpsJavaSdkType.INSTANCE, JpsJavaExtensionService.
      getInstance().createWrappedJavaSdkReference((JpsJavaSdkTypeWrapper)sdkType, wrapperRef));
  }
  module.getDependenciesList().addSdkDependency(sdkType);
  if (srcPaths.length > 0 || outputPath != null) {
    for (String srcPath : srcPaths) {
      module.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(srcPath));
      module.addSourceRoot(JpsPathUtil.pathToUrl(srcPath), JavaSourceRootType.SOURCE);
    }
    JpsJavaModuleExtension extension = JpsJavaExtensionService.getInstance().getOrCreateModuleExtension(module);
    if (outputPath != null) {
      extension.setOutputUrl(JpsPathUtil.pathToUrl(outputPath));
      if (!StringUtil.isEmpty(testOutputPath)) {
        extension.setTestOutputUrl(JpsPathUtil.pathToUrl(testOutputPath));
      }
      else {
        extension.setTestOutputUrl(extension.getOutputUrl());
      }
    }
    else {
      extension.setInheritOutput(true);
    }
  }
  return module;
}
 

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

示例28: getRoots

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@Override
public Collection<File> getRoots() {
  final Set<File> files = new LinkedHashSet<File>();
  processUrls(new Consumer<String>() {
    @Override
    public void consume(String url) {
      files.add(JpsPathUtil.urlToFile(url));
    }
  });
  return files;
}
 

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

示例29: getFiles

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@Override
public List<File> getFiles(final JpsOrderRootType rootType) {
  List<String> urls = getRootUrls(rootType);
  List<File> files = new ArrayList<File>(urls.size());
  for (String url : urls) {
    if (!url.startsWith("jrt://")) {
      files.add(JpsPathUtil.urlToFile(url));
    }
  }
  return files;
}
 

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

示例30: addSourceRoot

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
private static String addSourceRoot(JpsModule module, boolean tests) {
  try {
    File file = FileUtil.createTempDirectory(module.getName(), tests ? "testSrc" : "src");
    return module.addSourceRoot(JpsPathUtil.getLibraryRootUrl(file), tests ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE).getUrl();
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 

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

示例31: doTest

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
private void doTest(final String path) {
  loadProject(path);
  JpsJavaCompilerConfiguration configuration = JpsJavaExtensionService.getInstance().getCompilerConfiguration(myProject);
  assertNotNull(configuration);
  assertFalse(configuration.isClearOutputDirectoryOnRebuild());
  assertFalse(configuration.isAddNotNullAssertions());
  ProcessorConfigProfile defaultProfile = configuration.getDefaultAnnotationProcessingProfile();
  assertTrue(defaultProfile.isEnabled());
  assertFalse(defaultProfile.isObtainProcessorsFromClasspath());
  assertEquals(FileUtil.toSystemDependentName(JpsPathUtil.urlToPath(getUrl("src"))), defaultProfile.getProcessorPath());
  assertEquals("b", defaultProfile.getProcessorOptions().get("a"));
  assertEquals("d", defaultProfile.getProcessorOptions().get("c"));
  assertEquals("gen", defaultProfile.getGeneratedSourcesDirectoryName(false));
  JpsCompilerExcludes excludes = configuration.getCompilerExcludes();
  assertFalse(isExcluded(excludes, "src/nonrec/x/Y.java"));
  assertTrue(isExcluded(excludes, "src/nonrec/Y.java"));
  assertTrue(isExcluded(excludes, "src/rec/x/Y.java"));
  assertTrue(isExcluded(excludes, "src/rec/Y.java"));
  assertTrue(isExcluded(excludes, "src/A.java"));
  assertFalse(isExcluded(excludes, "src/B.java"));
  
  JpsJavaCompilerOptions options = configuration.getCurrentCompilerOptions();
  assertNotNull(options);
  assertEquals(512, options.MAXIMUM_HEAP_SIZE);
  assertFalse(options.DEBUGGING_INFO);
  assertTrue(options.GENERATE_NO_WARNINGS);
  assertEquals("-Xlint", options.ADDITIONAL_OPTIONS_STRING);
}
 

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

示例32: fileGenerated

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
public void fileGenerated(String outputRoot, String relativePath) {
  if (StringUtil.endsWith(relativePath, ".class") && JpsPathUtil.isUnder(myOutputRoots, new File(outputRoot))) {
    // collect only classes
    final Map<String, List<String>> map = myGeneratedPaths.get();
    List<String> paths = map.get(outputRoot);
    if (paths == null) {
      paths = new ArrayList<String>();
      map.put(outputRoot, paths);
    }
    paths.add(relativePath);
  }
}
 

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

示例33: getOutputDir

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
protected static File getOutputDir(Module module, boolean forTests) {
  CompilerModuleExtension extension = CompilerModuleExtension.getInstance(module);
  Assert.assertNotNull(extension);
  String outputUrl = forTests? extension.getCompilerOutputUrlForTests() : extension.getCompilerOutputUrl();
  Assert.assertNotNull((forTests? "Test output" : "Output") +" directory for module '" + module.getName() + "' isn't specified", outputUrl);
  return JpsPathUtil.urlToFile(outputUrl);
}
 

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

示例34: urlsToFiles

点赞 2

import org.jetbrains.jps.util.JpsPathUtil; //导入依赖的package包/类
@NotNull
public static List<File> urlsToFiles(@NotNull List<String> urls) {
  if (urls.isEmpty()) {
    return Collections.emptyList();
  }
  final List<File> result = new ArrayList<File>();

  for (String path : urls) {
    result.add(JpsPathUtil.urlToFile(path));
  }
  return result;
}
 

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


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)