本文整理汇总了Java中org.jetbrains.jps.model.java.JavaSourceRootType类的典型用法代码示例。如果您正苦于以下问题:Java JavaSourceRootType类的具体用法?Java JavaSourceRootType怎么用?Java JavaSourceRootType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JavaSourceRootType类属于org.jetbrains.jps.model.java包,在下文中一共展示了JavaSourceRootType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureBackOfficeRoots
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
protected void configureBackOfficeRoots(
@NotNull final HybrisModuleDescriptor moduleDescriptor,
@NotNull final ContentEntry contentEntry
) {
Validate.notNull(moduleDescriptor);
Validate.notNull(contentEntry);
final File backOfficeModuleDirectory = new File(
moduleDescriptor.getRootDirectory(), BACK_OFFICE_MODULE_DIRECTORY
);
final File backOfficeSrcDirectory = new File(backOfficeModuleDirectory, SRC_DIRECTORY);
contentEntry.addSourceFolder(
VfsUtil.pathToUrl(backOfficeSrcDirectory.getAbsolutePath()),
JavaSourceRootType.SOURCE
);
addTestSourceRoots(contentEntry, backOfficeModuleDirectory);
final File hmcResourcesDirectory = new File(backOfficeModuleDirectory, RESOURCES_DIRECTORY);
contentEntry.addSourceFolder(
VfsUtil.pathToUrl(hmcResourcesDirectory.getAbsolutePath()),
JavaResourceRootType.RESOURCE
);
excludeDirectory(contentEntry, new File(backOfficeModuleDirectory, CLASSES_DIRECTORY));
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:27,代码来源:RegularContentRootConfigurator.java
示例2: suitableTestSourceFolders
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
@Nullable
private static SourceFolder suitableTestSourceFolders(Project project, Module module) {
ContentEntry[] contentEntries = ModuleRootManager.getInstance(module).getContentEntries();
for (ContentEntry contentEntry : contentEntries) {
List<SourceFolder> testSourceFolders =
contentEntry.getSourceFolders(JavaSourceRootType.TEST_SOURCE);
for (SourceFolder testSourceFolder : testSourceFolders) {
if (testSourceFolder.getFile() != null) {
if (!JavaProjectRootsUtil.isInGeneratedCode(testSourceFolder.getFile(), project)) {
return testSourceFolder;
}
}
}
}
return null;
}
示例3: checkForTestRoots
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
protected static void checkForTestRoots(Module srcModule, Set<VirtualFile> testFolders) {
List<VirtualFile> sourceRoots = ModuleRootManager.getInstance(srcModule).getSourceRoots(JavaSourceRootType.TEST_SOURCE);
for (VirtualFile sourceRoot : sourceRoots) {
if (!JavaProjectRootsUtil.isInGeneratedCode(sourceRoot, srcModule.getProject())) {
testFolders.add(sourceRoot);
}
}
//create test in the same module
if (!testFolders.isEmpty()) return;
//suggest to choose from all dependencies modules
final HashSet<Module> modules = new HashSet<Module>();
ModuleUtilCore.collectModulesDependsOn(srcModule, modules);
for (Module module : modules) {
testFolders.addAll(ModuleRootManager.getInstance(module).getSourceRoots(JavaSourceRootType.TEST_SOURCE));
}
}
示例4: setupConfigurationFromContext
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
@Override
protected boolean setupConfigurationFromContext(JUnitConfiguration configuration,
ConfigurationContext context,
Ref<PsiElement> sourceElement) {
final Project project = configuration.getProject();
final PsiElement element = context.getPsiLocation();
if (!(element instanceof PsiDirectory)) return false;
final PsiPackage aPackage = JavaRuntimeConfigurationProducerBase.checkPackage(element);
if (aPackage == null) return false;
final VirtualFile virtualFile = ((PsiDirectory)element).getVirtualFile();
final Module module = ModuleUtilCore.findModuleForFile(virtualFile, project);
if (module == null) return false;
if (!ModuleRootManager.getInstance(module).getFileIndex().isInTestSourceContent(virtualFile)) return false;
int testRootCount = ModuleRootManager.getInstance(module).getSourceRoots(JavaSourceRootType.TEST_SOURCE).size();
if (testRootCount < 2) return false;
if (!LocationUtil.isJarAttached(context.getLocation(), aPackage, JUnitUtil.TESTCASE_CLASS)) return false;
setupConfigurationModule(context, configuration);
final JUnitConfiguration.Data data = configuration.getPersistentData();
data.setDirName(virtualFile.getPath());
data.TEST_OBJECT = JUnitConfiguration.TEST_DIRECTORY;
configuration.setGeneratedName();
return true;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AbstractAllInDirectoryConfigurationProducer.java
示例5: testDoesNotExcludeRegisteredSources
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
public void testDoesNotExcludeRegisteredSources() throws Exception {
importProject("<groupId>test</groupId>" +
"<artifactId>project</artifactId>" +
"<version>1</version>");
new File(myProjectRoot.getPath(), "target/foo").mkdirs();
final File sourceDir = new File(myProjectRoot.getPath(), "target/src");
sourceDir.mkdirs();
ApplicationManager.getApplication().runWriteAction(new Runnable() {
public void run() {
MavenRootModelAdapter adapter = new MavenRootModelAdapter(myProjectsTree.findProject(myProjectPom),
getModule("project"),
new IdeModifiableModelsProviderImpl(myProject));
adapter.addSourceFolder(sourceDir.getPath(), JavaSourceRootType.SOURCE);
adapter.getRootModel().commit();
}
});
updateProjectFolders();
assertSources("project", "target/src");
assertExcludes("project", "target/foo");
}
示例6: checkForTestRoots
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
protected static void checkForTestRoots(Module srcModule, Set<VirtualFile> testFolders) {
testFolders.addAll(ModuleRootManager.getInstance(srcModule).getSourceRoots(JavaSourceRootType.TEST_SOURCE));
removeGenerated(testFolders);
//create test in the same module
if (!testFolders.isEmpty()) return;
//suggest to choose from all dependencies modules
final HashSet<Module> modules = new HashSet<Module>();
ModuleUtilCore.collectModulesDependsOn(srcModule, modules);
for (Module module : modules) {
testFolders.addAll(ModuleRootManager.getInstance(module).getSourceRoots(JavaSourceRootType.TEST_SOURCE));
}
removeGenerated(testFolders);
}
示例7: testWelcomeTest
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
public void testWelcomeTest() throws Throwable {
doImport("examples/tests/scala/org/pantsbuild/example/hello/welcome");
assertFirstSourcePartyModules(
"examples_src_resources_org_pantsbuild_example_hello_hello",
"examples_src_java_org_pantsbuild_example_hello_greet_greet",
"examples_src_scala_org_pantsbuild_example_hello_welcome_welcome",
"examples_tests_scala_org_pantsbuild_example_hello_welcome_welcome"
);
final ContentEntry[] contentRoots = getContentRoots("examples_tests_scala_org_pantsbuild_example_hello_welcome_welcome");
assertSize(1, contentRoots);
final List<SourceFolder> testSourceRoots = contentRoots[0].getSourceFolders(JavaSourceRootType.TEST_SOURCE);
assertSize(1, testSourceRoots);
assertPantsCompileExecutesAndSucceeds(pantsCompileProject());
findClassAndAssert("org.pantsbuild.example.hello.welcome.WelSpec");
assertScalaLibrary("examples_tests_scala_org_pantsbuild_example_hello_welcome_welcome");
}
示例8: computeRootDescriptors
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
@NotNull
@Override
public List<ResourceRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
List<ResourceRootDescriptor> roots = new ArrayList<ResourceRootDescriptor>();
JavaSourceRootType type = isTests() ? JavaSourceRootType.TEST_SOURCE : JavaSourceRootType.SOURCE;
Iterable<ExcludedJavaSourceRootProvider> excludedRootProviders = JpsServiceManager.getInstance().getExtensions(ExcludedJavaSourceRootProvider.class);
roots_loop:
for (JpsTypedModuleSourceRoot<JpsSimpleElement<JavaSourceRootProperties>> sourceRoot : myModule.getSourceRoots(type)) {
for (ExcludedJavaSourceRootProvider provider : excludedRootProviders) {
if (provider.isExcludedFromCompilation(myModule, sourceRoot)) {
continue roots_loop;
}
}
final String packagePrefix = sourceRoot.getProperties().getData().getPackagePrefix();
final File rootFile = sourceRoot.getFile();
roots.add(new ResourceRootDescriptor(rootFile, this, false, packagePrefix, computeRootExcludes(rootFile, index)));
}
return roots;
}
示例9: updateModule
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
private void updateModule(Module module) {
if (module == null) {
return;
}
myComboRunnerClasses.removeAllItems();
ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
List<VirtualFile> roots = rootManager.getSourceRoots(JavaSourceRootType.TEST_SOURCE);
List<HaxeClass> classList = new ArrayList<HaxeClass>();
for (VirtualFile testSourceRoot : roots) {
classList.addAll(UsefulPsiTreeUtil.getClassesInDirectory(module.getProject(), testSourceRoot));
}
classList.size();
for (HaxeClass haxeClass : classList) {
myComboRunnerClasses.addItem(haxeClass);
}
}
示例10: configureCommonRoots
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
protected void configureCommonRoots(
@NotNull final HybrisModuleDescriptor moduleDescriptor,
@NotNull final ContentEntry contentEntry
) {
Validate.notNull(moduleDescriptor);
Validate.notNull(contentEntry);
// https://hybris-integration.atlassian.net/browse/IIP-354
// Do not register acceleratorstorefrontcommons/src as source root because it references not existent class
// GeneratedAcceleratorstorefrontcommonsConstants and it breaks compilation from Intellij
if (!ACCELERATOR_STOREFRONT_COMMONS_EXTENSION_NAME.equals(moduleDescriptor.getName())) {
final File srcDirectory = new File(moduleDescriptor.getRootDirectory(), SRC_DIRECTORY);
contentEntry.addSourceFolder(
VfsUtil.pathToUrl(srcDirectory.getAbsolutePath()),
JavaSourceRootType.SOURCE
);
}
final File genSrcDirectory = new File(moduleDescriptor.getRootDirectory(), GEN_SRC_DIRECTORY);
contentEntry.addSourceFolder(
VfsUtil.pathToUrl(genSrcDirectory.getAbsolutePath()),
JavaSourceRootType.SOURCE,
JpsJavaExtensionService.getInstance().createSourceRootProperties("", true)
);
addTestSourceRoots(contentEntry, moduleDescriptor.getRootDirectory());
final File resourcesDirectory = new File(moduleDescriptor.getRootDirectory(), RESOURCES_DIRECTORY);
contentEntry.addSourceFolder(
VfsUtil.pathToUrl(resourcesDirectory.getAbsolutePath()),
JavaResourceRootType.RESOURCE
);
excludeCommonNeedlessDirs(contentEntry, moduleDescriptor);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:36,代码来源:RegularContentRootConfigurator.java
示例11: configureAdditionalRoots
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
protected void configureAdditionalRoots(
@NotNull final HybrisModuleDescriptor moduleDescriptor,
@NotNull final String directoryName,
@NotNull final ContentEntry contentEntry,
@NotNull final File parentDirectory
) {
Validate.notNull(moduleDescriptor);
Validate.notNull(directoryName);
Validate.notNull(contentEntry);
Validate.notNull(parentDirectory);
final File additionalModuleDirectory = new File(parentDirectory, directoryName);
if (!additionalModuleDirectory.exists() || additionalModuleDirectory.isFile()) {
return;
}
final File additionalSrcDirectory = new File(additionalModuleDirectory, SRC_DIRECTORY);
contentEntry.addSourceFolder(
VfsUtil.pathToUrl(additionalSrcDirectory.getAbsolutePath()),
JavaSourceRootType.SOURCE
);
final File additionalResourcesDirectory = new File(additionalModuleDirectory, RESOURCES_DIRECTORY);
contentEntry.addSourceFolder(
VfsUtil.pathToUrl(additionalResourcesDirectory.getAbsolutePath()),
JavaResourceRootType.RESOURCE
);
excludeDirectory(contentEntry, new File(additionalModuleDirectory, CLASSES_DIRECTORY));
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:30,代码来源:RegularContentRootConfigurator.java
示例12: configureWebModuleRoots
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
protected void configureWebModuleRoots(
@NotNull final HybrisModuleDescriptor moduleDescriptor,
final @NotNull ContentEntry contentEntry,
final File webModuleDirectory
) {
Validate.notNull(moduleDescriptor);
final File webSrcDirectory = new File(webModuleDirectory, SRC_DIRECTORY);
contentEntry.addSourceFolder(
VfsUtil.pathToUrl(webSrcDirectory.getAbsolutePath()),
JavaSourceRootType.SOURCE
);
final File webGenSrcDirectory = new File(webModuleDirectory, GEN_SRC_DIRECTORY);
contentEntry.addSourceFolder(
VfsUtil.pathToUrl(webGenSrcDirectory.getAbsolutePath()),
JavaSourceRootType.SOURCE,
JpsJavaExtensionService.getInstance().createSourceRootProperties("", true)
);
addTestSourceRoots(contentEntry, webModuleDirectory);
excludeSubDirectories(contentEntry, webModuleDirectory, Arrays.asList(
ADDON_SRC_DIRECTORY, TEST_CLASSES_DIRECTORY, COMMON_WEB_SRC_DIRECTORY
));
configureWebInf(contentEntry, moduleDescriptor, webModuleDirectory);
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:29,代码来源:RegularContentRootConfigurator.java
示例13: addTestSourceRoots
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
private static void addTestSourceRoots(final @NotNull ContentEntry contentEntry, @NotNull final File dir) {
for (String testSrcDirName : TEST_SRC_DIR_NAMES) {
contentEntry.addSourceFolder(
VfsUtil.pathToUrl(new File(dir, testSrcDirName).getAbsolutePath()),
JavaSourceRootType.TEST_SOURCE
);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:9,代码来源:RegularContentRootConfigurator.java
示例14: isExcludedFromCompilation
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的package包/类
@Override
public boolean isExcludedFromCompilation(@NotNull JpsModule module, @NotNull JpsModuleSourceRoot root) {
final JpsJavaCompilerConfiguration compilerConfig = JpsJavaExtensionService.getInstance().getOrCreateCompilerConfiguration(module.getProject());
final ProcessorConfigProfile profile = compilerConfig.getAnnotationProcessingProfile(module);
if (!profile.isEnabled()) {
return false;
}
final File outputDir =
ProjectPaths.getAnnotationProcessorGeneratedSourcesOutputDir(module, JavaSourceRootType.TEST_SOURCE == root.getRootType(), profile);
return outputDir != null && FileUtil.filesEqual(outputDir, root.getFile());
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:AnnotationsExcludedJavaSourceRootProvider.java
示例15: testTestOnProductionDependency
import org.jetbrains.jps.model.java.JavaSourceRootType; //导入依赖的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();
}