use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.
the class ModuleExcludeIndexTest method testModuleOutput.
public void testModuleOutput() {
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));
}
use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.
the class ModuleExcludeIndexTest method testInnerModules.
public void testInnerModules() {
File outerRoot = new File(myRoot, "outer");
File inner1Root = new File(outerRoot, "inner1");
File inner2Root = new File(outerRoot, "inner2");
JpsModule outer = addModule("outer");
addContentRoot(outer, outerRoot);
JpsModule inner1 = addModule("inner1");
JpsModule inner2 = addModule("inner2");
addContentRoot(inner1, inner1Root);
addContentRoot(inner2, inner2Root);
assertNotExcluded(outerRoot);
assertNotExcluded(inner1Root);
assertNotExcluded(inner2Root);
assertSameElements(getModuleExcludes(outer), inner1Root, inner2Root);
assertEmpty(getModuleExcludes(inner1));
assertEmpty(getModuleExcludes(inner2));
ModuleExcludeIndexImpl index = createIndex();
assertTrue(index.isExcludedFromModule(inner1Root, outer));
assertTrue(index.isExcludedFromModule(inner2Root, outer));
assertFalse(index.isExcludedFromModule(inner1Root, inner1));
assertFalse(index.isExcludedFromModule(inner2Root, inner2));
}
use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.
the class CompilerEncodingConfigurationTest method test.
public void test() {
loadProject("/jps/jps-builders/testData/compilerEncoding/compilerEncoding.ipr");
JpsEncodingProjectConfiguration projectConfig = JpsEncodingConfigurationService.getInstance().getEncodingConfiguration(myProject);
assertNotNull(projectConfig);
// overridden by file's internal encoding
assertEncoding("UTF-8", "moduleA/src/dir/with-encoding.xml", projectConfig);
assertEncoding("windows-1251", "moduleA/src/dir/with-encoding.txt", projectConfig);
assertEncoding("UTF-8", "moduleA/src/dir/without-encoding.xml", projectConfig);
assertEncoding("UTF-8", "moduleA/src/dir/without-encoding.txt", projectConfig);
assertEncoding("UTF-8", "moduleA/src/dir/non-existent.xml", projectConfig);
assertEncoding("windows-1252", "moduleB/src/non-existent.xml", projectConfig);
final CompilerEncodingConfiguration compilerEncodingConfiguration = new CompilerEncodingConfiguration(myModel, myRootIndex);
for (JpsModule module : myProject.getModules()) {
final String moduleEncoding = compilerEncodingConfiguration.getPreferredModuleEncoding(module);
if ("moduleA".equals(module.getName())) {
assertEquals("UTF-8", moduleEncoding);
} else if ("moduleB".equals(module.getName())) {
assertNull(moduleEncoding);
} else if ("moduleC".equals(module.getName())) {
assertEquals("windows-1252", moduleEncoding);
} else {
fail("Unexpected module in project: " + module.getName());
}
}
}
use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.
the class JpsDependenciesEnumeratorTest method testDoNotAddJdkRootsFromModuleDependency.
public void testDoNotAddJdkRootsFromModuleDependency() {
JpsModule dep = addModule("dep");
JpsTypedLibrary<JpsSdk<JpsDummyElement>> jdk8 = addJdk("1.8");
JpsModuleRootModificationUtil.addDependency(myModule, dep);
JpsModuleRootModificationUtil.setModuleSdk(dep, jdk8.getProperties());
assertClassRoots(dependencies(myModule).recursively(), getRtJarJdk17());
assertClassRoots(dependencies(dep).recursively(), getRtJarJdk18());
}
use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.
the class JpsJavaExtensionTest method testModule.
public void testModule() {
final JpsModule module = addModule();
final JpsJavaModuleExtension extension = getJavaService().getOrCreateModuleExtension(module);
extension.setOutputUrl("file://path");
JpsJavaModuleExtension moduleExtension = getJavaService().getModuleExtension(module);
assertNotNull(moduleExtension);
assertEquals("file://path", moduleExtension.getOutputUrl());
}
Aggregations