use of com.taobao.android.builder.dependency.model.AwbBundle in project atlas by alibaba.
the class MergeManifestAwbsConfigAction method execute.
@Override
public void execute(MtlParallelTask parallelTask) {
super.execute(parallelTask);
AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(parallelTask.getVariantName());
if (null == androidDependencyTree) {
return;
}
List<DefaultTask> tasks = new ArrayList<DefaultTask>();
AppVariantOutputContext appVariantOutputContext = getAppVariantOutputContext();
for (final AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
List<ManifestMerger2.Invoker.Feature> optionalFeatures = ImmutableList.<ManifestMerger2.Invoker.Feature>of();
MergeAwbManifests.ConfigAction configAction = new MergeAwbManifests.ConfigAction(appVariantOutputContext.getOutputScope(), awbBundle, optionalFeatures, appVariantOutputContext);
MergeAwbManifests mergeAwbManifests = TaskCreater.create(appVariantContext.getProject(), configAction.getName(), configAction.getType());
configAction.execute(mergeAwbManifests);
tasks.add(mergeAwbManifests);
}
parallelTask.parallelTask = tasks;
parallelTask.uniqueTaskName = getName();
}
use of com.taobao.android.builder.dependency.model.AwbBundle in project atlas by alibaba.
the class PrepareAwoBundleTask method doFullTaskAction.
@TaskAction
public void doFullTaskAction() throws IOException {
AwbBundle awbBundle = libVariantContext.getAwbBundle();
prepare(awbBundle.getBundle(), awbBundle.getFolder(), true);
List<SoLibrary> soLibraries = awbBundle.getSoLibraries();
for (final SoLibrary soLibrary : soLibraries) {
prepare(soLibrary.getSoLibFile(), soLibrary.getFolder(), false);
}
List<? extends AndroidLibrary> aarBundles = awbBundle.getLibraryDependencies();
for (final AndroidLibrary libraryDependency : aarBundles) {
if (libraryDependency instanceof AarBundle) {
AarBundle aarBundle = (AarBundle) libraryDependency;
prepare(aarBundle.getBundle(), aarBundle.getFolder(), true);
}
}
}
use of com.taobao.android.builder.dependency.model.AwbBundle in project atlas by alibaba.
the class ApkFileListUtils method recordApkFileInfos.
/**
* 记录apk文件的资源信息
*/
public static void recordApkFileInfos(AppVariantContext appVariantContext) {
if (inited) {
return;
}
inited = true;
List<File> mainBundleResFolders = new ArrayList<File>();
mainBundleResFolders.add(appVariantContext.getScope().getVariantData().mergeResourcesTask.getOutputDir());
prepareApkFileList(appVariantContext.getScope().getVariantData().mergeAssetsTask.getOutputDir(), "assets");
for (File resFolder : mainBundleResFolders) {
prepareApkFileList(resFolder, "res");
}
// 记录各自bundle的资源信息
AndroidDependencyTree dependencyTree = AtlasBuildContext.androidDependencyTrees.get(appVariantContext.getScope().getVariantConfiguration().getFullName());
if (null == dependencyTree) {
throw new StopExecutionException("DependencyTree cannot be null!");
}
List<AwbBundle> libs = dependencyTree.getAwbBundles();
for (AwbBundle awbLib : libs) {
File mergeAssertFolder = appVariantContext.getMergeAssets(awbLib);
File mergeResFolder = appVariantContext.getMergeResources(awbLib);
String awbName = awbLib.getName();
prepareApkFileList(mergeAssertFolder, "assets", awbName);
prepareApkFileList(mergeResFolder, "res", awbName);
}
}
use of com.taobao.android.builder.dependency.model.AwbBundle in project atlas by alibaba.
the class BundleInfoUtils method setupAwbBundleInfos.
public static void setupAwbBundleInfos(AppVariantContext appVariantContext) throws IOException, DocumentException {
String apkVersion = appVariantContext.getVariantConfiguration().getVersionName();
AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(appVariantContext.getScope().getVariantConfiguration().getFullName());
/**
* name 是artifictId
*/
Map<String, BundleInfo> bundleInfoMap = getBundleInfoMap(appVariantContext);
for (AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
update(awbBundle, bundleInfoMap, appVariantContext, apkVersion);
}
}
use of com.taobao.android.builder.dependency.model.AwbBundle in project atlas by alibaba.
the class DiffBundleInfoTask method getArtifactBundleInfo.
private Set<ArtifactBundleInfo> getArtifactBundleInfo(DependencyDiff dependencyDiff, File mainfestFile, File apDir) throws IOException, DocumentException {
Set<ArtifactBundleInfo> artifactBundleInfos = new HashSet<ArtifactBundleInfo>();
if (null == apDir) {
throw new GradleException("No Ap dependency found!");
}
File apManifest = new File(apDir, "AndroidManifest.xml");
String apVersion = null;
try {
apVersion = ManifestFileUtils.getVersionName(apManifest);
} catch (Exception e) {
throw new GradleException(e.getMessage(), e);
}
// 1. 首先添加主bundle
ArtifactBundleInfo mainBundleInfo = getMainArtifactBundInfo(mainfestFile);
mainBundleInfo.setBaseVersion(apVersion);
mainBundleInfo.setMainBundle(true);
mainBundleInfo.setVersion(appVariantOutputContext.getVariantContext().getVariantConfiguration().getVersionName());
if (dependencyDiff.getMainDexDiffs().size() > 0) {
mainBundleInfo.setDiffType(DiffType.MODIFY);
} else {
mainBundleInfo.setDiffType(DiffType.NONE);
}
artifactBundleInfos.add(mainBundleInfo);
// 2. 添加各自的bundle
AndroidDependencyTree androidDependencyTree = AtlasBuildContext.androidDependencyTrees.get(appVariantOutputContext.getVariantContext().getVariantConfiguration().getFullName());
for (AwbBundle awbBundle : androidDependencyTree.getAwbBundles()) {
BundleInfo bundleInfo = awbBundle.bundleInfo;
ArtifactBundleInfo awbBundleInfo = new ArtifactBundleInfo();
awbBundleInfo.setMainBundle(false);
awbBundleInfo.setDependency(bundleInfo.getDependency());
awbBundleInfo.setPkgName(bundleInfo.getPkgName());
awbBundleInfo.setApplicationName(bundleInfo.getApplicationName());
awbBundleInfo.setArtifactId(awbBundle.getResolvedCoordinates().getArtifactId());
awbBundleInfo.setName(bundleInfo.getName());
String version = bundleInfo.getVersion();
if (version.indexOf("@") > 0) {
String[] arr = version.split("@");
version = arr[arr.length - 1];
}
awbBundleInfo.setVersion(version);
String libBundleName = getBundleName(awbBundle);
if (dependencyDiff.getAwbDiffs().contains(libBundleName)) {
if (dependencyDiff.getNewAwbs().contains(libBundleName)) {
awbBundleInfo.setDiffType(DiffType.ADD);
} else {
awbBundleInfo.setDiffType(DiffType.MODIFY);
}
} else {
awbBundleInfo.setDiffType(DiffType.NONE);
}
artifactBundleInfos.add(awbBundleInfo);
}
return artifactBundleInfos;
}
Aggregations