use of com.android.build.gradle.internal.scope.VariantScope in project atlas by alibaba.
the class AtlasAppTaskManager method repalceAndroidBuilder.
private void repalceAndroidBuilder(ApplicationVariant applicationVariant) {
try {
if (applicationVariant instanceof ApplicationVariantImpl) {
VariantScope variantScope = ((ApplicationVariantImpl) applicationVariant).getVariantData().getScope();
GlobalScope globalScope = variantScope.getGlobalScope();
// ReflectUtils.updateField(globalScope, "androidBuilder", AtlasBuildContext.androidBuilderMap.get(globalScope.getProject()));
// Field f = ProjectOptions.class.getDeclaredField("booleanOptions");
// f.setAccessible(true);
// Map map = (Map) f.get(((ApplicationVariantImpl) applicationVariant).getVariantData().getScope().getGlobalScope().getProjectOptions());
// map.put(BooleanOption.ENABLE_AAPT2, false);
AtlasBuildContext.androidBuilderMap.get(globalScope.getProject()).initAapt(globalScope.getProjectOptions());
}
} catch (Exception e) {
logger.error(e, "write globalScope androidBuilder field failed!");
}
}
Aggregations