use of org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties 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);
}
use of org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties in project android by JetBrains.
the class AndroidBuilderTest method testCustomManifestPackage.
public void testCustomManifestPackage() 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.CUSTOM_MANIFEST_PACKAGE = "dev";
checkMakeUpToDate(executor);
props.USE_CUSTOM_MANIFEST_PACKAGE = true;
makeAll().assertSuccessful();
checkBuildLog(executor, "expected_log");
checkMakeUpToDate(executor);
props.CUSTOM_MANIFEST_PACKAGE = "dev1";
makeAll().assertSuccessful();
checkBuildLog(executor, "expected_log_1");
checkMakeUpToDate(executor);
}
use of org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties in project android by JetBrains.
the class AndroidBuilderTest method test5.
public void test5() 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;
rebuildAll();
checkBuildLog(executor, "expected_log");
checkMakeUpToDate(executor);
appModule.getDependenciesList().addModuleDependency(libModule);
makeAll().assertSuccessful();
checkBuildLog(executor, "expected_log_1");
checkMakeUpToDate(executor);
final JpsAndroidModuleExtension appExtension = AndroidJpsUtil.getExtension(appModule);
assert appExtension != null;
final JpsAndroidModuleProperties appProps = ((JpsAndroidModuleExtensionImpl) appExtension).getProperties();
appProps.myIncludeAssetsFromLibraries = true;
makeAll();
checkBuildLog(executor, "expected_log_2");
checkMakeUpToDate(executor);
rebuildAll();
checkBuildLog(executor, "expected_log_7");
checkMakeUpToDate(executor);
change(getProjectPath("lib/assets/lib_asset.txt"));
makeAll();
checkBuildLog(executor, "expected_log_3");
checkMakeUpToDate(executor);
change(getProjectPath("app/assets/app_asset.txt"));
makeAll();
checkBuildLog(executor, "expected_log_3");
checkMakeUpToDate(executor);
change(getProjectPath("lib/res/values/strings.xml"));
makeAll();
checkBuildLog(executor, "expected_log_4");
checkMakeUpToDate(executor);
change(getProjectPath("app/res/values/strings.xml"));
makeAll();
checkBuildLog(executor, "expected_log_5");
checkMakeUpToDate(executor);
assertTrue(FileUtil.delete(new File(getProjectPath("lib/assets"))));
makeAll();
checkBuildLog(executor, "expected_log_6");
checkMakeUpToDate(executor);
}
use of org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties in project android by JetBrains.
the class AndroidBuilderTest method testResOverlay.
public void testResOverlay() throws Exception {
final MyExecutor executor = new MyExecutor("com.example.simple");
final JpsModule module = setUpSimpleAndroidStructure(ArrayUtil.EMPTY_STRING_ARRAY, executor, null).getFirst();
final JpsAndroidModuleProperties props = ((JpsAndroidModuleExtensionImpl) AndroidJpsUtil.getExtension(module)).getProperties();
props.RES_OVERLAY_FOLDERS = Arrays.asList("/res-overlay");
rebuildAll();
checkBuildLog(executor, "expected_log");
checkMakeUpToDate(executor);
props.RES_OVERLAY_FOLDERS = Collections.emptyList();
makeAll().assertSuccessful();
checkBuildLog(executor, "expected_log_1");
}
use of org.jetbrains.jps.android.model.impl.JpsAndroidModuleProperties in project android by JetBrains.
the class AndroidBuilderTest method test7.
public void test7() throws Exception {
final boolean[] class1Deleted = { false };
final MyExecutor executor = new MyExecutor("com.example.simple") {
@Override
protected void doCheckJar(@NotNull String jarId, @NotNull String jarPath) {
if ("library_package_jar".equals(jarId)) {
File tmpDir = null;
try {
tmpDir = FileUtil.createTempDirectory("library_package_jar_checking", "tmp");
final File jar = new File(tmpDir, "file.jar");
FileUtil.copy(new File(jarPath), jar);
TestFileSystemBuilder fs = TestFileSystemItem.fs().archive("file.jar").dir("lib").file("MyLibClass.class");
if (!class1Deleted[0]) {
fs = fs.file("MyLibClass1.class");
}
assertOutput(tmpDir.getPath(), fs);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
if (tmpDir != null) {
FileUtil.delete(tmpDir);
}
}
}
}
};
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", new String[] { "src" }, "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;
rebuildAll();
checkBuildLog(executor, "expected_log");
assertEquals(Collections.singleton("library_package_jar"), executor.getCheckedJars());
checkMakeUpToDate(executor);
appModule.getDependenciesList().addModuleDependency(libModule);
makeAll();
checkBuildLog(executor, "expected_log_1");
assertTrue(executor.getCheckedJars().isEmpty());
checkMakeUpToDate(executor);
change(getProjectPath("lib/src/lib/MyLibClass.java"));
makeAll();
checkBuildLog(executor, "expected_log_2");
assertEquals(Collections.singleton("library_package_jar"), executor.getCheckedJars());
checkMakeUpToDate(executor);
assertTrue(FileUtil.delete(new File(getProjectPath("lib/src/lib/MyLibClass1.java"))));
class1Deleted[0] = true;
makeAll();
checkBuildLog(executor, "expected_log_2");
assertEquals(Collections.singleton("library_package_jar"), executor.getCheckedJars());
checkMakeUpToDate(executor);
assertTrue(FileUtil.delete(new File(getProjectPath("lib/src/lib/MyLibClass.java"))));
makeAll();
checkBuildLog(executor, "expected_log_3");
assertTrue(executor.getCheckedJars().isEmpty());
checkMakeUpToDate(executor);
final JpsLibrary appLib = appModule.addModuleLibrary("appLib", JpsJavaLibraryType.INSTANCE);
appLib.addRoot(getProjectPath("lib/external_jar.jar"), JpsOrderRootType.COMPILED);
appModule.getDependenciesList().addLibraryDependency(appLib);
final JpsLibrary libLib = libModule.addModuleLibrary("libLib", JpsJavaLibraryType.INSTANCE);
libLib.addRoot(new File(getProjectPath("lib/external_jar.jar")), JpsOrderRootType.COMPILED);
libModule.getDependenciesList().addLibraryDependency(libLib);
makeAll().assertSuccessful();
checkBuildLog(executor, "expected_log_4");
assertTrue(executor.getCheckedJars().isEmpty());
checkMakeUpToDate(executor);
}
Aggregations