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());
}
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);
}
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);
}
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;
}
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);
}
Aggregations