Search in sources :

Example 1 with AwbProguardConfiguration

use of com.taobao.android.builder.tools.proguard.AwbProguardConfiguration in project atlas by alibaba.

the class DelegateProguardTransform method applyBundleInOutConfigration.

public File applyBundleInOutConfigration(final AppVariantContext appVariantContext) {
    VariantScope variantScope = appVariantContext.getScope();
    GlobalScope globalScope = variantScope.getGlobalScope();
    File proguardOut = new File(Joiner.on(File.separatorChar).join(String.valueOf(globalScope.getBuildDir()), FD_OUTPUTS, "mapping", variantScope.getVariantConfiguration().getDirName()));
    File awbInOutConfig = new File(proguardOut, "awb_inout_config.cfg");
    // Add awb configuration
    AtlasDependencyTree dependencyTree = AtlasBuildContext.androidDependencyTrees.get(variantScope.getVariantConfiguration().getFullName());
    if (dependencyTree.getAwbBundles().size() > 0) {
        BaseVariantOutput vod = (BaseVariantOutput) appVariantContext.getVariantOutputData().iterator().next();
        AppVariantOutputContext appVariantOutputContext = appVariantContext.getAppVariantOutputContext(ApkDataUtils.get(vod));
        File awbObfuscatedDir = new File(globalScope.getIntermediatesDir(), "/classes-proguard/" + variantScope.getVariantConfiguration().getDirName());
        AwbProguardConfiguration awbProguardConfiguration = new AwbProguardConfiguration(appVariantOutputContext.getAwbTransformMap().values(), awbObfuscatedDir, appVariantOutputContext);
        try {
            awbProguardConfiguration.printConfigFile(awbInOutConfig);
        } catch (IOException e) {
            throw new GradleException("", e);
        }
        defaultProguardFiles.add(awbInOutConfig);
    }
    return awbInOutConfig;
}
Also used : GlobalScope(com.android.build.gradle.internal.scope.GlobalScope) BaseVariantOutput(com.android.build.gradle.api.BaseVariantOutput) VariantScope(com.android.build.gradle.internal.scope.VariantScope) AwbProguardConfiguration(com.taobao.android.builder.tools.proguard.AwbProguardConfiguration) GradleException(org.gradle.api.GradleException) AppVariantOutputContext(com.android.build.gradle.internal.api.AppVariantOutputContext) IOException(java.io.IOException) File(java.io.File) AtlasDependencyTree(com.taobao.android.builder.dependency.AtlasDependencyTree)

Aggregations

BaseVariantOutput (com.android.build.gradle.api.BaseVariantOutput)1 AppVariantOutputContext (com.android.build.gradle.internal.api.AppVariantOutputContext)1 GlobalScope (com.android.build.gradle.internal.scope.GlobalScope)1 VariantScope (com.android.build.gradle.internal.scope.VariantScope)1 AtlasDependencyTree (com.taobao.android.builder.dependency.AtlasDependencyTree)1 AwbProguardConfiguration (com.taobao.android.builder.tools.proguard.AwbProguardConfiguration)1 File (java.io.File)1 IOException (java.io.IOException)1 GradleException (org.gradle.api.GradleException)1