Search in sources :

Example 21 with JpsAndroidModuleProperties

use of org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties in project android by JetBrains.

the class AndroidBuilderTest method testFilteredResources.

public void testFilteredResources() throws Exception {
    final MyExecutor executor = new MyExecutor("com.example.simple");
    final JpsModule module = setUpSimpleAndroidStructure(new String[] { "src" }, executor, null).getFirst();
    final JpsAndroidModuleProperties props = ((JpsAndroidModuleExtensionImpl) AndroidJpsUtil.getExtension(module)).getProperties();
    rebuildAll();
    checkMakeUpToDate(executor);
    props.USE_CUSTOM_APK_RESOURCE_FOLDER = true;
    props.CUSTOM_APK_RESOURCE_FOLDER = "/target/filtered-res";
    makeAll();
    checkBuildLog(executor, "expected_log");
    checkMakeUpToDate(executor);
    change(getProjectPath("target/filtered-res/values/strings.xml"));
    makeAll();
    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)

Example 22 with JpsAndroidModuleProperties

use of org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties in project android by JetBrains.

the class AndroidBuilderTest method testPreDexing.

public void testPreDexing() 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("lib2", new String[] { "src" }, "lib", "lib2", androidSdk).getFirst();
    final JpsModule libModule1 = addAndroidModule("lib1", new String[] { "src" }, "lib1", "lib1", androidSdk).getFirst();
    final JpsAndroidModuleExtension libExtension = AndroidJpsUtil.getExtension(libModule);
    assert libExtension != null;
    final JpsAndroidModuleProperties libProps = ((JpsAndroidModuleExtensionImpl) libExtension).getProperties();
    libProps.PROJECT_TYPE = PROJECT_TYPE_LIBRARY;
    final JpsAndroidModuleExtension libExtension1 = AndroidJpsUtil.getExtension(libModule1);
    assert libExtension1 != null;
    final JpsAndroidModuleProperties libProps1 = ((JpsAndroidModuleExtensionImpl) libExtension1).getProperties();
    libProps1.PROJECT_TYPE = PROJECT_TYPE_LIBRARY;
    appModule.getDependenciesList().addModuleDependency(libModule);
    libModule.getDependenciesList().addModuleDependency(libModule1);
    final JpsLibrary lib = appModule.addModuleLibrary("ext_lib", JpsJavaLibraryType.INSTANCE);
    lib.addRoot(new File(getProjectPath("app/libs/external_jar.jar")), JpsOrderRootType.COMPILED);
    appModule.getDependenciesList().addLibraryDependency(lib);
    final JpsLibrary lib1 = appModule.addModuleLibrary("ext_lib_1", JpsJavaLibraryType.INSTANCE);
    lib1.addRoot(new File(getProjectPath("lib/libs/external_jar_1.jar")), JpsOrderRootType.COMPILED);
    libModule.getDependenciesList().addLibraryDependency(lib1);
    doBuild(CompileScopeTestBuilder.rebuild().allModules().targetTypes(AndroidManifestMergingTarget.MyTargetType.INSTANCE, AndroidDexBuildTarget.MyTargetType.INSTANCE, AndroidResourceCachingBuildTarget.MyTargetType.INSTANCE, AndroidResourcePackagingBuildTarget.MyTargetType.INSTANCE, AndroidPackagingBuildTarget.MyTargetType.INSTANCE, AndroidLibraryPackagingTarget.MyTargetType.INSTANCE, AndroidPackagingBuildTarget.MyTargetType.INSTANCE)).assertSuccessful();
    checkBuildLog(executor, "expected_log");
    executor.clear();
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_1");
    executor.clear();
    doBuild(CompileScopeTestBuilder.make().allModules().targetTypes(AndroidManifestMergingTarget.MyTargetType.INSTANCE, AndroidDexBuildTarget.MyTargetType.INSTANCE, AndroidResourceCachingBuildTarget.MyTargetType.INSTANCE, AndroidResourcePackagingBuildTarget.MyTargetType.INSTANCE, AndroidPackagingBuildTarget.MyTargetType.INSTANCE, AndroidLibraryPackagingTarget.MyTargetType.INSTANCE, AndroidPackagingBuildTarget.MyTargetType.INSTANCE)).assertUpToDate();
    executor.clear();
    rebuildAll();
    checkBuildLog(executor, "expected_log_2");
    final JpsAndroidModuleExtension appExtension = AndroidJpsUtil.getExtension(appModule);
    assert appExtension != null;
    final JpsAndroidModuleProperties appProps = ((JpsAndroidModuleExtensionImpl) appExtension).getProperties();
    checkMakeUpToDate(executor);
    appProps.ENABLE_PRE_DEXING = false;
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_3");
    checkMakeUpToDate(executor);
    appProps.ENABLE_PRE_DEXING = true;
    makeAll().assertSuccessful();
    checkBuildLog(executor, "expected_log_4");
}
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 23 with JpsAndroidModuleProperties

use of org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties in project android by JetBrains.

the class NonGradleApkProviderDependenciesTest method setIdAndApk.

/** For testing convenience, quickly specify a facet's package and APK. */
private static void setIdAndApk(AndroidFacet facet, String appId, String apk) {
    JpsAndroidModuleProperties properties = facet.getProperties();
    properties.APK_PATH = "/" + apk;
    properties.USE_CUSTOM_MANIFEST_PACKAGE = true;
    properties.CUSTOM_MANIFEST_PACKAGE = appId;
}
Also used : JpsAndroidModuleProperties(org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties)

Aggregations

JpsAndroidModuleProperties (org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties)23 JpsAndroidModuleExtensionImpl (org.jetbrains.jps.android.model.impl.JpsAndroidModuleExtensionImpl)13 JpsModule (org.jetbrains.jps.model.module.JpsModule)13 JpsSimpleElement (org.jetbrains.jps.model.JpsSimpleElement)7 JpsLibrary (org.jetbrains.jps.model.library.JpsLibrary)5 NotNull (org.jetbrains.annotations.NotNull)4 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)3 AndroidModuleModel (com.android.tools.idea.gradle.project.model.AndroidModuleModel)2 Module (com.intellij.openapi.module.Module)2 File (java.io.File)2 BaseArtifact (com.android.builder.model.BaseArtifact)1 SourceProvider (com.android.builder.model.SourceProvider)1 GradleBuildFile (com.android.tools.idea.gradle.parser.GradleBuildFile)1 GradleSettingsFile (com.android.tools.idea.gradle.parser.GradleSettingsFile)1 GradleFacet (com.android.tools.idea.gradle.project.facet.gradle.GradleFacet)1 JavaFacet (com.android.tools.idea.gradle.project.facet.java.JavaFacet)1 NdkFacet (com.android.tools.idea.gradle.project.facet.ndk.NdkFacet)1 NdkModuleModel (com.android.tools.idea.gradle.project.model.NdkModuleModel)1 GradleSyncState (com.android.tools.idea.gradle.project.sync.GradleSyncState)1 AndroidModel (com.android.tools.idea.model.AndroidModel)1