Search in sources :

Example 1 with AndroidApplicationArtifactType

use of org.jetbrains.android.compiler.artifact.AndroidApplicationArtifactType 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;
}
Also used : AndroidApplicationArtifactProperties(org.jetbrains.android.compiler.artifact.AndroidApplicationArtifactProperties) Module(com.intellij.openapi.module.Module) AndroidApplicationArtifactType(org.jetbrains.android.compiler.artifact.AndroidApplicationArtifactType) AndroidFacet(org.jetbrains.android.facet.AndroidFacet) Artifact(com.intellij.packaging.artifacts.Artifact)

Aggregations

Module (com.intellij.openapi.module.Module)1 Artifact (com.intellij.packaging.artifacts.Artifact)1 AndroidApplicationArtifactProperties (org.jetbrains.android.compiler.artifact.AndroidApplicationArtifactProperties)1 AndroidApplicationArtifactType (org.jetbrains.android.compiler.artifact.AndroidApplicationArtifactType)1 AndroidFacet (org.jetbrains.android.facet.AndroidFacet)1