use of org.jetbrains.jps.android.model.JpsAndroidModuleExtension in project android by JetBrains.
the class AndroidFinalPackageElementBuilder method getApkPath.
@Nullable
private static String getApkPath(JpsAndroidFinalPackageElement element) {
final JpsModuleReference ref = element.getModuleReference();
final JpsModule module = ref != null ? ref.resolve() : null;
if (module == null) {
return null;
}
final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);
if (extension == null) {
return null;
}
return getApkPath(extension);
}
use of org.jetbrains.jps.android.model.JpsAndroidModuleExtension in project android by JetBrains.
the class AndroidLibraryPackagingBuilder method doBuild.
private static boolean doBuild(CompileContext context, JpsModule module, BuildOutputConsumer outputConsumer) throws IOException {
final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(module);
if (extension == null || !extension.isLibrary()) {
return true;
}
File outputDir = AndroidJpsUtil.getDirectoryForIntermediateArtifacts(context, module);
outputDir = AndroidJpsUtil.createDirIfNotExist(outputDir, context, BUILDER_NAME);
if (outputDir == null) {
return false;
}
final File classesDir = ProjectPaths.getModuleOutputDir(module, false);
if (classesDir == null || !classesDir.isDirectory()) {
return true;
}
final Set<String> subdirs = new HashSet<String>();
AndroidJpsUtil.addSubdirectories(classesDir, subdirs);
if (subdirs.size() > 0) {
context.processMessage(new ProgressMessage(AndroidJpsBundle.message("android.jps.progress.library.packaging", module.getName())));
final File outputJarFile = new File(outputDir, AndroidCommonUtils.CLASSES_JAR_FILE_NAME);
final List<String> srcFiles;
try {
srcFiles = AndroidCommonUtils.packClassFilesIntoJar(ArrayUtil.EMPTY_STRING_ARRAY, ArrayUtil.toStringArray(subdirs), outputJarFile);
} catch (IOException e) {
AndroidJpsUtil.reportExceptionError(context, null, e, BUILDER_NAME);
return false;
}
final AndroidBuildTestingManager testingManager = AndroidBuildTestingManager.getTestingManager();
if (testingManager != null && outputJarFile.isFile()) {
testingManager.getCommandExecutor().checkJarContent("library_package_jar", outputJarFile.getPath());
}
if (srcFiles.size() > 0) {
outputConsumer.registerOutputFile(outputJarFile, srcFiles);
}
}
return true;
}
use of org.jetbrains.jps.android.model.JpsAndroidModuleExtension in project android by JetBrains.
the class AndroidBuildTarget method computeDependencies.
@Override
public Collection<BuildTarget<?>> computeDependencies(final BuildTargetRegistry registry, TargetOutputIndex outputIndex) {
final List<BuildTarget<?>> result = new ArrayList<BuildTarget<?>>(3);
fillDependencies(result);
result.add(new ModuleBuildTarget(myModule, JavaModuleBuildTargetType.PRODUCTION));
final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(myModule);
if (extension != null && extension.isPackTestCode()) {
result.add(new ModuleBuildTarget(myModule, JavaModuleBuildTargetType.TEST));
}
return result;
}
use of org.jetbrains.jps.android.model.JpsAndroidModuleExtension in project android by JetBrains.
the class AndroidPackagingBuildTarget method collectNativeLibsFolders.
@NotNull
public static String[] collectNativeLibsFolders(@NotNull JpsAndroidModuleExtension extension, boolean checkExistence) {
final List<String> result = new ArrayList<String>();
final File libsDir = extension.getNativeLibsDir();
if (libsDir != null && (!checkExistence || libsDir.exists())) {
result.add(libsDir.getPath());
}
for (JpsAndroidModuleExtension depExtension : AndroidJpsUtil.getAllAndroidDependencies(extension.getModule(), true)) {
final File depLibsDir = depExtension.getNativeLibsDir();
if (depLibsDir != null && (!checkExistence || depLibsDir.exists())) {
result.add(depLibsDir.getPath());
}
}
return ArrayUtil.toStringArray(result);
}
use of org.jetbrains.jps.android.model.JpsAndroidModuleExtension in project android by JetBrains.
the class AndroidManifestMergingTarget method computeRootDescriptors.
@NotNull
@Override
public List<MyRootDescriptor> computeRootDescriptors(JpsModel model, ModuleExcludeIndex index, IgnoredFileIndex ignoredFileIndex, BuildDataPaths dataPaths) {
final JpsAndroidModuleExtension extension = AndroidJpsUtil.getExtension(myModule);
assert extension != null;
final List<MyRootDescriptor> result = new ArrayList<MyRootDescriptor>();
final File manifestFile = AndroidJpsUtil.getManifestFileForCompilationPath(extension);
if (manifestFile != null) {
result.add(new MyRootDescriptor(this, manifestFile, false));
}
for (JpsAndroidModuleExtension libExtension : AndroidJpsUtil.getAllAndroidDependencies(myModule, true)) {
final File libManifest = AndroidJpsUtil.getManifestFileForCompilationPath(libExtension);
if (libManifest != null && libManifest.exists()) {
result.add(new MyRootDescriptor(this, libManifest, true));
}
}
return result;
}
Aggregations