Search in sources :

Example 11 with JpsModule

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));
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) File(java.io.File) JpsJavaModuleExtension(org.jetbrains.jps.model.java.JpsJavaModuleExtension)

Example 12 with JpsModule

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));
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) ModuleExcludeIndexImpl(org.jetbrains.jps.indices.impl.ModuleExcludeIndexImpl) File(java.io.File)

Example 13 with JpsModule

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());
        }
    }
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) CompilerEncodingConfiguration(org.jetbrains.jps.incremental.CompilerEncodingConfiguration)

Example 14 with JpsModule

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());
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsSdk(org.jetbrains.jps.model.library.sdk.JpsSdk)

Example 15 with JpsModule

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());
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule)

Aggregations

JpsModule (org.jetbrains.jps.model.module.JpsModule)128 File (java.io.File)33 NotNull (org.jetbrains.annotations.NotNull)15 CompilerMessage (org.jetbrains.jps.incremental.messages.CompilerMessage)15 JpsAndroidModuleExtension (org.jetbrains.jps.android.model.JpsAndroidModuleExtension)14 JpsAndroidModuleExtensionImpl (org.jetbrains.jps.android.model.impl.JpsAndroidModuleExtensionImpl)13 JpsAndroidModuleProperties (org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties)13 THashSet (gnu.trove.THashSet)11 JpsLibrary (org.jetbrains.jps.model.library.JpsLibrary)11 ProgressMessage (org.jetbrains.jps.incremental.messages.ProgressMessage)10 JpsSimpleElement (org.jetbrains.jps.model.JpsSimpleElement)10 JpsArtifact (org.jetbrains.jps.model.artifact.JpsArtifact)10 ArrayList (java.util.ArrayList)9 HashMap (com.intellij.util.containers.HashMap)8 IOException (java.io.IOException)8 TObjectLongHashMap (gnu.trove.TObjectLongHashMap)7 JpsDependencyElement (org.jetbrains.jps.model.module.JpsDependencyElement)7 JpsDummyElement (org.jetbrains.jps.model.JpsDummyElement)6 Pair (com.intellij.openapi.util.Pair)5 Nullable (org.jetbrains.annotations.Nullable)5