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


Java PsiTestUtil.setCompilerOutputPath方法代码示例

本文整理汇总了Java中com.intellij.testFramework.PsiTestUtil.setCompilerOutputPath方法的典型用法代码示例。如果您正苦于以下问题:Java PsiTestUtil.setCompilerOutputPath方法的具体用法?Java PsiTestUtil.setCompilerOutputPath怎么用?Java PsiTestUtil.setCompilerOutputPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.testFramework.PsiTestUtil的用法示例。


在下文中一共展示了PsiTestUtil.setCompilerOutputPath方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addOutputs

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
private static String[] addOutputs(Module module, int index) {
  String[] outputs = new String[2];
  String prefix = "outputs" + File.separatorChar;
  VirtualFile generalOutput = findFile(prefix + "general " + index);
  VirtualFile testOutput = findFile(prefix + "tests" + index);
  outputs[0] = generalOutput.getPresentableUrl();
  outputs[1] = testOutput.getPresentableUrl();
  PsiTestUtil.setCompilerOutputPath(module, generalOutput.getUrl(), false);
  PsiTestUtil.setCompilerOutputPath(module, testOutput.getUrl(), true);
  return outputs;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:ConfigurationsTest.java

示例2: testTest1

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testTest1() {
  final String rootPath = PathManagerEx.getTestDataPath() + "/moduleRootManager/roots/" + "test1";
  final VirtualFile[] rootFileBox = new VirtualFile[1];
  ApplicationManager.getApplication().runWriteAction(() -> {
    rootFileBox[0] =
    LocalFileSystem.getInstance().refreshAndFindFileByPath(rootPath.replace(File.separatorChar, '/'));
  });
  final VirtualFile rootFile = rootFileBox[0];
  final VirtualFile classesFile = rootFile.findChild("classes");
  assertNotNull(classesFile);
  final VirtualFile childOfContent = rootFile.findChild("x.txt");
  assertNotNull(childOfContent);
  final VirtualFile childOfClasses = classesFile.findChild("y.txt");
  assertNotNull(childOfClasses);

  final ModuleRootManager rootManager = ModuleRootManager.getInstance(myModule);


  PsiTestUtil.addContentRoot(myModule, rootFile);
  PsiTestUtil.setCompilerOutputPath(myModule, classesFile.getUrl(), false);
  PsiTestUtil.setExcludeCompileOutput(myModule, false);
  assertTrue(rootManager.getFileIndex().isInContent(childOfContent));
  assertTrue(rootManager.getFileIndex().isInContent(childOfClasses));

  PsiTestUtil.setExcludeCompileOutput(myModule, true);
  assertTrue(rootManager.getFileIndex().isInContent(childOfContent));
  assertFalse(rootManager.getFileIndex().isInContent(childOfClasses));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:RootsTest.java

示例3: testModuleOutput

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testModuleOutput() throws IOException {
  VirtualFile output = createChildDirectory(myContentRoot, "out");
  PsiTestUtil.setCompilerOutputPath(myModule, output.getUrl(), false);
  getChangeListManager().convertExcludedToIgnored();
  assertFalse(getChangeListManager().isIgnoredFile(myContentRoot));
  assertTrue(getChangeListManager().isIgnoredFile(output));
  assertIgnored(output);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ConvertExcludedToIgnoredTest.java

示例4: testModuleOutputUnderProjectOutput

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testModuleOutputUnderProjectOutput() throws IOException {
  VirtualFile output = getVirtualFile(createTempDir("projectOutput"));
  CompilerProjectExtension.getInstance(getProject()).setCompilerOutputUrl(output.getUrl());
  VirtualFile moduleOutput = createChildDirectory(output, "module");
  PsiTestUtil.setCompilerOutputPath(myModule, moduleOutput.getUrl(), false);
  getChangeListManager().convertExcludedToIgnored();
  assertTrue(getChangeListManager().isIgnoredFile(output));
  assertTrue(getChangeListManager().isIgnoredFile(moduleOutput));
  assertIgnored(output);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ConvertExcludedToIgnoredTest.java

示例5: testModuleOutputUnderExcluded

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testModuleOutputUnderExcluded() throws IOException {
  VirtualFile excluded = createChildDirectory(myContentRoot, "target");
  PsiTestUtil.addExcludedRoot(myModule, excluded);
  VirtualFile moduleOutput = createChildDirectory(excluded, "classes");
  PsiTestUtil.setCompilerOutputPath(myModule, moduleOutput.getUrl(), false);
  getChangeListManager().convertExcludedToIgnored();
  assertTrue(getChangeListManager().isIgnoredFile(excluded));
  assertTrue(getChangeListManager().isIgnoredFile(moduleOutput));
  assertIgnored(excluded);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ConvertExcludedToIgnoredTest.java

示例6: setModulesOutput

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
private void setModulesOutput(final VirtualFile output, final String... moduleNames) {
  AccessToken accessToken = WriteAction.start();
  try {
    for (String each : moduleNames) {
      PsiTestUtil.setCompilerOutputPath(getModule(each), output.getUrl(), false);
      PsiTestUtil.setCompilerOutputPath(getModule(each), output.getUrl(), true);
    }
  }
  finally {
    accessToken.finish();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ResourceCopyingTest.java

示例7: testSameSourceAndOutput

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testSameSourceAndOutput() {
  PsiTestUtil.setCompilerOutputPath(myModule, mySrcDir1.getUrl(), false);
  assertExcluded(mySrcDir1, myModule);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:DirectoryIndexTest.java

示例8: testExcludedDirShouldBeExcludedRightAfterItsCreation

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testExcludedDirShouldBeExcludedRightAfterItsCreation() throws Exception {
  VirtualFile excluded = createChildDirectory(myModule1Dir, "excluded");
  VirtualFile projectOutput = createChildDirectory(myModule1Dir, "projectOutput");
  VirtualFile module2Output = createChildDirectory(myModule1Dir, "module2Output");
  VirtualFile module2TestOutput = createChildDirectory(myModule2Dir, "module2TestOutput");

  assertInProject(excluded);
  assertInProject(projectOutput);
  assertInProject(module2Output);
  assertInProject(module2TestOutput);

  getCompilerProjectExtension().setCompilerOutputUrl(projectOutput.getUrl());

  PsiTestUtil.addExcludedRoot(myModule, excluded);
  PsiTestUtil.setCompilerOutputPath(myModule2, module2Output.getUrl(), false);
  PsiTestUtil.setCompilerOutputPath(myModule2, module2TestOutput.getUrl(), true);
  PsiTestUtil.setExcludeCompileOutput(myModule2, true);

  assertExcluded(excluded, myModule);
  assertExcluded(projectOutput, myModule);
  assertExcluded(module2Output, myModule);
  assertExcluded(module2TestOutput, myModule2);

  delete(excluded);
  delete(projectOutput);
  delete(module2Output);
  delete(module2TestOutput);

  final List<VirtualFile> created = new ArrayList<VirtualFile>();
  VirtualFileListener l = new VirtualFileAdapter() {
    @Override
    public void fileCreated(@NotNull VirtualFileEvent e) {
      VirtualFile file = e.getFile();
      String fileName = e.getFileName();
      assertExcluded(file, fileName.contains("module2TestOutput") ? myModule2 : myModule);
      created.add(file);
    }
  };
  VirtualFileManager.getInstance().addVirtualFileListener(l, getTestRootDisposable());

  excluded = createChildDirectory(myModule1Dir, excluded.getName());
  assertExcluded(excluded, myModule);

  projectOutput = createChildDirectory(myModule1Dir, projectOutput.getName());
  assertExcluded(projectOutput, myModule);

  module2Output = createChildDirectory(myModule1Dir, module2Output.getName());
  assertExcluded(module2Output, myModule);

  module2TestOutput = createChildDirectory(myModule2Dir, module2TestOutput.getName());
  assertExcluded(module2TestOutput, myModule2);

  assertEquals(created.toString(), 4, created.size());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:55,代码来源:DirectoryIndexTest.java

示例9: testExcludeCompilerOutputOutsideOfContentRoot

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testExcludeCompilerOutputOutsideOfContentRoot() throws Exception {
  assertTrue(myFileIndex.isExcluded(myOutputDir));
  assertFalse(myFileIndex.isUnderIgnored(myOutputDir));
  assertTrue(myFileIndex.isExcluded(myModule1OutputDir));
  assertFalse(myFileIndex.isExcluded(myOutputDir.getParent()));
  assertExcludedFromProject(myOutputDir);
  assertExcludedFromProject(myModule1OutputDir);
  String moduleOutputUrl = myModule1OutputDir.getUrl();

  delete(myOutputDir);

  PsiTestUtil.setCompilerOutputPath(myModule, moduleOutputUrl, false);
  myOutputDir = createChildDirectory(myRootVFile, "out");
  myModule1OutputDir = createChildDirectory(myOutputDir, "module1");

  assertExcludedFromProject(myOutputDir);
  assertExcludedFromProject(myModule1OutputDir);
  assertTrue(myFileIndex.isExcluded(myModule1OutputDir));

  PsiTestUtil.setCompilerOutputPath(myModule, moduleOutputUrl, true);
  PsiTestUtil.setCompilerOutputPath(myModule2, moduleOutputUrl, false);
  PsiTestUtil.setCompilerOutputPath(myModule2, moduleOutputUrl, true);
  PsiTestUtil.setCompilerOutputPath(myModule3, moduleOutputUrl, false);
  PsiTestUtil.setCompilerOutputPath(myModule3, moduleOutputUrl, true);
  
  // now no module inherits project output dir, but it still should be project-excluded
  assertExcludedFromProject(myOutputDir);

  // project output inside module content shouldn't be projectExcludeRoot
  VirtualFile projectOutputUnderContent = createChildDirectory(myModule1Dir, "projectOutputUnderContent");
  getCompilerProjectExtension().setCompilerOutputUrl(projectOutputUnderContent.getUrl());
  fireRootsChanged();

  assertNotExcluded(myOutputDir);
  assertExcluded(projectOutputUnderContent, myModule);

  delete(projectOutputUnderContent);
  projectOutputUnderContent = createChildDirectory(myModule1Dir, "projectOutputUnderContent");
  assertNotExcluded(myOutputDir);
  assertExcluded(projectOutputUnderContent, myModule);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:DirectoryIndexTest.java

示例10: setCompilerOutput

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
private static String setCompilerOutput(Module module, String path, boolean testOutput) {
  VirtualFile output = ModuleRootManager.getInstance(module).getContentEntries()[0].getFile().findChild(path);
  assertNotNull(output);
  PsiTestUtil.setCompilerOutputPath(module, output.getUrl(), testOutput);
  return output.getPath().replace('/', File.separatorChar);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:ConfigurationsTest.java

示例11: testContentWrite

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testContentWrite() throws Exception {
  File content = getTestRoot();
  File source = new File(content, "source");
  File testSource = new File(content, "testSource");
  File exclude = new File(content, "exclude");
  File classes = new File(content, "classes");
  File testClasses = new File(content, "testClasses");
  final VirtualFile contentFile = LocalFileSystem.getInstance().findFileByIoFile(content);
  assertNotNull(contentFile);
  final VirtualFile sourceFile = LocalFileSystem.getInstance().findFileByIoFile(source);
  assertNotNull(sourceFile);
  final VirtualFile testSourceFile = LocalFileSystem.getInstance().findFileByIoFile(testSource);
  assertNotNull(testSourceFile);
  final VirtualFile excludeFile = LocalFileSystem.getInstance().findFileByIoFile(exclude);

  assertNotNull(excludeFile);
  final VirtualFile classesFile = LocalFileSystem.getInstance().findFileByIoFile(classes);

  assertNotNull(classesFile);
  final VirtualFile testClassesFile = LocalFileSystem.getInstance().findFileByIoFile(testClasses);

  assertNotNull(testClassesFile);

  final File moduleFile = new File(content, "test.iml");
  final Module module = createModule(moduleFile);
  final ModuleRootManagerImpl moduleRootManager =
    (ModuleRootManagerImpl)ModuleRootManager.getInstance(module);

  PsiTestUtil.addContentRoot(module, contentFile);
  PsiTestUtil.addSourceRoot(module, sourceFile);
  PsiTestUtil.addSourceRoot(module, testSourceFile, true);
  ModuleRootModificationUtil.setModuleSdk(module, IdeaTestUtil.getMockJdk17());
  PsiTestUtil.addExcludedRoot(module, excludeFile);
  PsiTestUtil.setCompilerOutputPath(module, classesFile.getUrl(), false);
  PsiTestUtil.setCompilerOutputPath(module, testClassesFile.getUrl(), true);

  final Element element = new Element("root");
  moduleRootManager.getState().writeExternal(element);
  assertElementEquals(element,
                      "<root inherit-compiler-output=\"false\">" +
                      "<output url=\"file://$MODULE_DIR$/classes\" />" +
                      "<output-test url=\"file://$MODULE_DIR$/testClasses\" />" +
                      "<exclude-output />" +
                      "<content url=\"file://$MODULE_DIR$\">" +
                      "<sourceFolder url=\"file://$MODULE_DIR$/source\" isTestSource=\"false\" />" +
                      "<sourceFolder url=\"file://$MODULE_DIR$/testSource\" isTestSource=\"true\" />" +
                      "<excludeFolder url=\"file://$MODULE_DIR$/exclude\" />" +
                      "</content>" +
                      "<orderEntry type=\"jdk\" jdkName=\"java 1.7\" jdkType=\"JavaSDK\" />" +
                      "<orderEntry type=\"sourceFolder\" forTests=\"false\" />" +
                      "</root>",
                      module);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:54,代码来源:ModuleRootsExternalizationTest.java

示例12: setModuleOutput

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
protected VirtualFile setModuleOutput(final Module module, final boolean test) throws IOException {
  final VirtualFile output = getVirtualFile(createTempDir(module.getName() + (test ? "Test" : "Prod") + "Output"));
  PsiTestUtil.setCompilerOutputPath(module, output != null ? output.getUrl() : null, test);
  return output;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ModuleRootManagerTestCase.java

示例13: testP1

import com.intellij.testFramework.PsiTestUtil; //导入方法依赖的package包/类
public void testP1() throws Exception {
  final VirtualFile parent = myModule.getModuleFile().getParent();
  assertNotNull(parent);
  PsiTestUtil.setCompilerOutputPath(myModule, parent.getUrl() + "/classes", false);
  checkJarTarget(new ModuleChunk(new Module[]{getModule()}));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:GenerateAntTest.java


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