use of com.intellij.packaging.artifacts.Artifact in project android by JetBrains.
the class AndroidBuildTargetScopeProvider method isProGuardUsed.
private static boolean isProGuardUsed(@NotNull Project project, @NotNull CompileScope scope) {
for (Module module : scope.getAffectedModules()) {
final AndroidFacet facet = AndroidFacet.getInstance(module);
if (facet != null && facet.getProperties().RUN_PROGUARD) {
return true;
}
}
final String proguardCfgPathsStr = scope.getUserData(AndroidCompileUtil.PROGUARD_CFG_PATHS_KEY);
if (proguardCfgPathsStr != null && proguardCfgPathsStr.length() > 0) {
return true;
}
final Set<Artifact> artifacts = ArtifactCompileScope.getArtifactsToBuild(project, scope, false);
for (Artifact artifact : artifacts) {
if (artifact.getArtifactType() instanceof AndroidApplicationArtifactType) {
final ArtifactProperties<?> properties = artifact.getProperties(AndroidArtifactPropertiesProvider.getInstance());
if (properties instanceof AndroidApplicationArtifactProperties) {
final AndroidApplicationArtifactProperties p = (AndroidApplicationArtifactProperties) properties;
if (p.isRunProGuard()) {
return true;
}
}
}
}
return false;
}
use of com.intellij.packaging.artifacts.Artifact in project android by JetBrains.
the class NonGradleApkProvider method addApk.
private void addApk(@NotNull List<ApkInfo> apkList, @NotNull String packageName, @NotNull AndroidFacet facet) throws ApkProvisionException {
final Module module = facet.getModule();
String localPath;
if (myArtifactName != null && myArtifactName.length() > 0) {
final Artifact artifact = ArtifactManager.getInstance(facet.getModule().getProject()).findArtifact(myArtifactName);
if (artifact == null) {
throw new ApkProvisionException("ERROR: cannot find artifact \"" + myArtifactName + '"');
}
if (!AndroidArtifactUtil.isRelatedArtifact(artifact, facet.getModule())) {
throw new ApkProvisionException("ERROR: artifact \"" + myArtifactName + "\" doesn't contain packaged module \"" + facet.getModule().getName() + '"');
}
final String artifactOutPath = artifact.getOutputFilePath();
if (artifactOutPath == null || artifactOutPath.length() == 0) {
throw new ApkProvisionException("ERROR: output path is not specified for artifact \"" + myArtifactName + '"');
}
localPath = FileUtil.toSystemDependentName(artifactOutPath);
} else {
localPath = AndroidRootUtil.getApkPath(facet);
}
if (localPath == null) {
throw new ApkProvisionException("ERROR: APK path is not specified for module \"" + module.getName() + '"');
}
apkList.add(new ApkInfo(new File(localPath), packageName));
}
Aggregations