Search in sources :

Example 51 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)

Example 52 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project android by JetBrains.

the class AndroidBuilderTest method testManifestMerging.

public void testManifestMerging() throws Exception {
    final MyExecutor executor = new MyExecutor("com.example.simple");
    final JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> androidSdk = addJdkAndAndroidSdk();
    addPathPatterns(executor, androidSdk);
    final JpsModule appModule = addAndroidModule("app", new String[] { "src" }, "app", "app", androidSdk).getFirst();
    final JpsModule libModule = addAndroidModule("lib", ArrayUtil.EMPTY_STRING_ARRAY, "lib", "lib", androidSdk).getFirst();
    final JpsAndroidModuleExtension libExtension = AndroidJpsUtil.getExtension(libModule);
    assert libExtension != null;
    final JpsAndroidModuleProperties libProps = ((JpsAndroidModuleExtensionImpl) libExtension).getProperties();
    libProps.PROJECT_TYPE = PROJECT_TYPE_LIBRARY;
    appModule.getDependenciesList().addModuleDependency(libModule);
    final JpsAndroidModuleExtension appExtension = AndroidJpsUtil.getExtension(appModule);
    assert appExtension != null;
    final JpsAndroidModuleProperties appProps = ((JpsAndroidModuleExtensionImpl) appExtension).getProperties();
    appProps.ENABLE_MANIFEST_MERGING = true;
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log");
    checkMakeUpToDate(executor);
    appProps.ENABLE_MANIFEST_MERGING = false;
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_1");
    checkMakeUpToDate(executor);
    appProps.ENABLE_MANIFEST_MERGING = true;
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_2");
    checkMakeUpToDate(executor);
    change(getProjectPath("app/AndroidManifest.xml"));
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_3");
    checkMakeUpToDate(executor);
    change(getProjectPath("lib/AndroidManifest.xml"));
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_4");
    checkMakeUpToDate(executor);
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsAndroidModuleExtensionImpl(org.jetbrains.jps.android.model.impl.JpsAndroidModuleExtensionImpl) JpsSimpleElement(org.jetbrains.jps.model.JpsSimpleElement) JpsAndroidModuleProperties(org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties)

Example 53 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project android by JetBrains.

the class AndroidBuilderTest method testMaven1.

public void testMaven1() throws Exception {
    createMavenConfigFile();
    final MyExecutor executor = new MyExecutor("com.example.simple");
    final JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> androidSdk = addJdkAndAndroidSdk();
    addPathPatterns(executor, androidSdk);
    copyToProject(getDefaultTestDataDirForCurrentTest() + "/project/myaar", "root/myaar");
    final JpsModule appModule = addAndroidModule("app", new String[] { "src" }, "app", "app", androidSdk).getFirst();
    final JpsModule libModule = addAndroidModule("lib", new String[] { "src" }, "lib", "lib", androidSdk).getFirst();
    JpsMavenExtensionService.getInstance().getOrCreateExtension(appModule);
    final MavenProjectConfiguration mavenConf = ((JpsMavenExtensionServiceImpl) JpsMavenExtensionService.getInstance()).getMavenProjectConfiguration(myDataStorageRoot);
    addMavenResourcesConf(mavenConf, "app");
    addMavenResourcesConf(mavenConf, "lib");
    final JpsAndroidModuleExtension libExtension = AndroidJpsUtil.getExtension(libModule);
    assert libExtension != null;
    final JpsAndroidModuleProperties libProps = ((JpsAndroidModuleExtensionImpl) libExtension).getProperties();
    libProps.PROJECT_TYPE = PROJECT_TYPE_LIBRARY;
    appModule.getDependenciesList().addModuleDependency(libModule);
    rebuildAll();
    checkMakeUpToDate(executor);
    final JpsLibrary appAarLib = appModule.addModuleLibrary("app_arr", JpsJavaLibraryType.INSTANCE);
    appAarLib.addRoot(getProjectPath("myaar/classes.jar"), JpsOrderRootType.COMPILED);
    appModule.getDependenciesList().addLibraryDependency(appAarLib);
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log");
    checkMakeUpToDate(executor);
    appAarLib.addRoot(getProjectPath("myaar/res"), JpsOrderRootType.COMPILED);
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_1");
    checkMakeUpToDate(executor);
    final JpsLibrary libAarLib = libModule.addModuleLibrary("lib_arr", JpsJavaLibraryType.INSTANCE);
    libAarLib.addRoot(getProjectPath("myaar/classes.jar"), JpsOrderRootType.COMPILED);
    libAarLib.addRoot(getProjectPath("myaar/res"), JpsOrderRootType.COMPILED);
    libModule.getDependenciesList().addLibraryDependency(libAarLib);
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_2");
    checkMakeUpToDate(executor);
    final JpsAndroidModuleExtension appExtension = AndroidJpsUtil.getExtension(appModule);
    final JpsAndroidModuleProperties appProps = ((JpsAndroidModuleExtensionImpl) appExtension).getProperties();
    appProps.myIncludeAssetsFromLibraries = true;
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_3");
    checkMakeUpToDate(executor);
    appAarLib.addRoot(getProjectPath("myaar/libs/myjar.jar"), JpsOrderRootType.COMPILED);
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_4");
    checkMakeUpToDate(executor);
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsAndroidModuleExtensionImpl(org.jetbrains.jps.android.model.impl.JpsAndroidModuleExtensionImpl) JpsSimpleElement(org.jetbrains.jps.model.JpsSimpleElement) JpsAndroidModuleProperties(org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties) JpsLibrary(org.jetbrains.jps.model.library.JpsLibrary)

Example 54 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project android by JetBrains.

the class AndroidPreDexBuildTarget method computeRootDescriptors.

@NotNull
@Override
public List<AndroidPreDexBuildTarget.MyRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
    final List<AndroidPreDexBuildTarget.MyRootDescriptor> result = new ArrayList<AndroidPreDexBuildTarget.MyRootDescriptor>();
    final Set<JpsModule> libModules = new HashSet<JpsModule>();
    final Set<String> externalJars = new HashSet<String>();
    for (JpsModule module : myProject.getModules()) {
        final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);
        if (extension != null && !extension.isLibrary() && extension.isPreDexingEnabled()) {
            final AndroidPlatform platform = AndroidJpsUtil.getAndroidPlatform(module, null, null);
            if (platform != null) {
                fillDepsRecursively(module, libModules, externalJars, dataPaths, platform);
            }
        }
    }
    for (JpsModule libModule : libModules) {
        final File classesJarFile = new AndroidLibraryPackagingTarget(libModule).getOutputFile(dataPaths);
        result.add(new MyRootDescriptor(this, classesJarFile, libModule.getName()));
    }
    for (String externalJarPath : externalJars) {
        result.add(new MyRootDescriptor(this, new File(externalJarPath), null));
    }
    return result;
}
Also used : AndroidPlatform(org.jetbrains.jps.android.AndroidPlatform) JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsAndroidModuleExtension(org.jetbrains.jps.android.model.JpsAndroidModuleExtension) File(java.io.File) HashSet(com.intellij.util.containers.HashSet) NotNull(org.jetbrains.annotations.NotNull)

Example 55 with JpsModule

use of org.jetbrains.jps.model.module.JpsModule in project android by JetBrains.

the class AndroidBuilderTest method testAdditionalParameters.

public void testAdditionalParameters() throws Exception {
    final MyExecutor executor = new MyExecutor("com.example.simple");
    final JpsModule module = setUpSimpleAndroidStructure(new String[] { "src" }, executor, null, "8").getFirst();
    rebuildAll();
    checkMakeUpToDate(executor);
    final JpsAndroidModuleExtensionImpl extension = (JpsAndroidModuleExtensionImpl) AndroidJpsUtil.getExtension(module);
    assert extension != null;
    final JpsAndroidModuleProperties props = extension.getProperties();
    props.ADDITIONAL_PACKAGING_COMMAND_LINE_PARAMETERS = "-0 xml";
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log");
    checkMakeUpToDate(executor);
    props.ADDITIONAL_PACKAGING_COMMAND_LINE_PARAMETERS = "-0 txt";
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_1");
    checkMakeUpToDate(executor);
}
Also used : JpsModule(org.jetbrains.jps.model.module.JpsModule) JpsAndroidModuleExtensionImpl(org.jetbrains.jps.android.model.impl.JpsAndroidModuleExtensionImpl) JpsAndroidModuleProperties(org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties)

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