use of com.android.build.gradle.options.ProjectOptions in project atlas by alibaba.
the class AwbGenerator method createAwbBundle.
public AwbBundle createAwbBundle(LibVariantContext libVariantContext) throws IOException {
String variantName = libVariantContext.getVariantName();
AtlasDependencyTree libDependencyTree = AtlasBuildContext.libDependencyTrees.get(variantName);
// TODO 2.3
if (null == libDependencyTree) {
libDependencyTree = new AtlasDepTreeParser(libVariantContext.getProject(), new ExtraModelInfo(new ProjectOptions(libVariantContext.getProject()), null), new HashSet<>()).parseDependencyTree(libVariantContext.getVariantDependency());
AtlasBuildContext.libDependencyTrees.put(variantName, libDependencyTree);
}
Project project = libVariantContext.getProject();
String groupName = (String) project.getGroup();
String name = "";
String version = (String) project.getVersion();
if (project.hasProperty("archivesBaseName")) {
name = (String) project.getProperties().get("archivesBaseName");
} else {
name = project.getName();
}
File explodedDir = project.file(project.getBuildDir().getAbsolutePath() + "/" + FD_INTERMEDIATES + "/exploded-awb/" + computeArtifactPath(groupName, name, version));
FileUtils.deleteDirectory(explodedDir);
MavenCoordinates mavenCoordinates = new MavenCoordinatesImpl(groupName, name, version, "awb", "");
ResolvedDependencyInfo resolvedDependencyInfo = new ResolvedDependencyInfo(groupName, name, version, "awb");
resolvedDependencyInfo.setVariantName(libVariantContext.getVariantName());
AwbBundle awbBundle = new AwbBundle(resolvedDependencyInfo, DependencyConvertUtils.toAndroidLibrary(mavenCoordinates, libVariantContext.getBundleTask().getArchivePath(), explodedDir));
awbBundle.getSoLibraries().addAll(libDependencyTree.getMainBundle().getSoLibraries());
awbBundle.getAndroidLibraries().addAll(libDependencyTree.getMainBundle().getAndroidLibraries());
awbBundle.getJavaLibraries().addAll(libDependencyTree.getMainBundle().getJavaLibraries());
return awbBundle;
}
use of com.android.build.gradle.options.ProjectOptions in project atlas by alibaba.
the class TransformReplacer method replaceDexArchiveBuilderTransform.
public void replaceDexArchiveBuilderTransform(BaseVariantOutput vod) {
List<TransformTask> list = TransformManager.findTransformTaskByTransformType(variantContext, DexArchiveBuilderTransform.class);
DefaultDexOptions dexOptions = variantContext.getAppExtension().getDexOptions();
boolean minified = variantContext.getScope().getCodeShrinker() != null;
ProjectOptions projectOptions = variantContext.getScope().getGlobalScope().getProjectOptions();
FileCache userLevelCache = getUserDexCache(minified, dexOptions.getPreDexLibraries());
for (TransformTask transformTask : list) {
AtlasDexArchiveBuilderTransform atlasDexArchiveBuilderTransform = new AtlasDexArchiveBuilderTransform(variantContext, vod, dexOptions, variantContext.getScope().getGlobalScope().getAndroidBuilder().getErrorReporter(), userLevelCache, variantContext.getScope().getMinSdkVersion().getFeatureLevel(), variantContext.getScope().getDexer(), projectOptions.get(BooleanOption.ENABLE_GRADLE_WORKERS), projectOptions.get(IntegerOption.DEXING_READ_BUFFER_SIZE), projectOptions.get(IntegerOption.DEXING_WRITE_BUFFER_SIZE), variantContext.getScope().getVariantConfiguration().getBuildType().isDebuggable());
atlasDexArchiveBuilderTransform.setTransformTask(transformTask);
ReflectUtils.updateField(transformTask, "transform", atlasDexArchiveBuilderTransform);
if (variantContext.getScope().getInstantRunBuildContext().isInInstantRunMode() && variantContext.getVariantConfiguration().getMinSdkVersion().getApiLevel() < 21) {
transformTask.doLast(task -> {
task.getLogger().info("generate maindexList......");
generateMainDexList(variantContext.getScope());
});
}
}
}
use of com.android.build.gradle.options.ProjectOptions in project atlas by alibaba.
the class AtlasConfigurationHelper method configDependencies.
public void configDependencies(File awbConfigFile) {
Set<String> awbs = getAwbs(awbConfigFile);
AtlasDependencyManager atlasDependencyManager = new AtlasDependencyManager(project, new ExtraModelInfo(new ProjectOptions(project), project.getLogger()), awbs);
VariantManager variantManager = getVariantManager();
if (variantManager != null) {
variantManager.getVariantScopes().stream().forEach(variantScope -> atlasDependencyManager.resolveDependencies(variantScope.getVariantDependencies()));
}
}
Aggregations