use of com.android.build.gradle.internal.dsl.PackagingOptions in project atlas by alibaba.
the class AwoPackageConfigAction method execute.
@Override
public void execute(PackageApplication packageApp) {
final GradleVariantConfiguration config = scope.getVariantConfiguration();
packageApp.setAndroidBuilder(scope.getGlobalScope().getAndroidBuilder());
packageApp.setVariantName(scope.getVariantConfiguration().getFullName());
packageApp.setMinSdkVersion(config.getMinSdkVersion());
setFieldValueByReflection(packageApp, "dexPackagingPolicy", DexPackagingPolicy.STANDARD);
setFieldValueByReflection(packageApp, "instantRunContext", new InstantRunBuildContext());
ConventionMappingHelper.map(packageApp, "resourceFile", new Callable<File>() {
@Override
public File call() {
return libVariantContext.getOutputResouceAP();
}
});
ConventionMappingHelper.map(packageApp, "dexFolders", new Callable<Set<File>>() {
@Override
public Set<File> call() {
File outFolder = libVariantContext.getDexFolder();
Set<File> folders = Sets.newHashSet();
folders.add(outFolder);
return folders;
}
});
ConventionMappingHelper.map(packageApp, "javaResourceFiles", new Callable<Set<File>>() {
@Override
public Set<File> call() throws Exception {
return Collections.<File>emptySet();
}
});
// TODO: 增加abiFilter的支持
ConventionMappingHelper.map(packageApp, "jniFolders", new Callable<Set<File>>() {
@Override
public Set<File> call() {
File jniFolder = awbBundle.getJniFolder();
Set<File> folders = Sets.newHashSet();
folders.add(jniFolder);
return folders;
}
});
ConventionMappingHelper.map(packageApp, "abiFilters", new Callable<Set<String>>() {
@Override
public Set<String> call() throws Exception {
Set<String> supportedAbis = config.getSupportedAbis();
if (supportedAbis != null) {
return supportedAbis;
}
return ImmutableSet.of("armeabi", "x86");
}
});
ConventionMappingHelper.map(packageApp, "jniDebugBuild", new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return config.getBuildType().isJniDebuggable();
}
});
ConventionMappingHelper.map(packageApp, "packagingOptions", new Callable<PackagingOptions>() {
@Override
public PackagingOptions call() throws Exception {
return scope.getGlobalScope().getExtension().getPackagingOptions();
}
});
ConventionMappingHelper.map(packageApp, "outputFile", new Callable<File>() {
@Override
public File call() throws Exception {
return libVariantContext.getPackageFile();
}
});
//setFieldValueByReflection(packageApp, "markerFile",
// PrePackageApplication.ConfigAction.getMarkerFile(scope));
setFieldValueByReflection(packageApp, "inOldMode", AndroidGradleOptions.useOldPackaging(scope.getGlobalScope().getProject()));
}
Aggregations