use of com.taobao.android.builder.dependency.AtlasDependencyTree in project atlas by alibaba.
the class JavacAwbsTask method run.
@TaskAction
void run() throws ExecutionException, InterruptedException {
AtlasDependencyTree atlasDependencyTree = AtlasBuildContext.androidDependencyTrees.get(getVariantName());
if (null == atlasDependencyTree) {
return;
}
BaseExtension androidExtension = appVariantOutputContext.getVariantContext().getAppExtension();
boolean isDatabindEnabled = null != androidExtension.getDataBinding() && androidExtension.getDataBinding().isEnabled();
ExecutorServicesHelper executorServicesHelper = new ExecutorServicesHelper(taskName, getLogger(), 0);
ExecutorServicesHelper executorServicesHelper2 = new ExecutorServicesHelper(taskName + "databinding", getLogger(), 1);
List<Runnable> runnables = new ArrayList<>();
List<Runnable> runnables2 = new ArrayList<>();
for (final AwbBundle awbBundle : atlasDependencyTree.getAwbBundles()) {
if (awbBundle.isMBundle) {
continue;
}
Runnable runnable = new Runnable() {
@Override
public void run() {
try {
AwbJavaCompileConfigAction awbJavaCompileConfigAction = new AwbJavaCompileConfigAction(awbBundle, appVariantOutputContext);
AwbAndroidJavaCompile awbJavaCompile = TaskCreater.create(getProject(), awbJavaCompileConfigAction.getName(), awbJavaCompileConfigAction.getType());
awbJavaCompileConfigAction.execute(awbJavaCompile);
awbJavaCompile.execute();
AwbTransform awbTransform = appVariantOutputContext.getAwbTransformMap().get(awbBundle.getName());
awbTransform.addDir(awbJavaCompile.getDestinationDir());
} catch (Throwable e) {
e.printStackTrace();
throw new GradleException("javac " + awbBundle.getName() + " failed");
}
}
};
if (appVariantOutputContext.getVariantContext().isDataBindEnabled(awbBundle)) {
runnables2.add(runnable);
} else {
runnables.add(runnable);
}
}
executorServicesHelper.execute(runnables);
executorServicesHelper2.execute(runnables2);
}
use of com.taobao.android.builder.dependency.AtlasDependencyTree in project atlas by alibaba.
the class MergeAssetAwbsConfigAction method execute.
@Override
public void execute(MtlParallelTask parallelTask) {
super.execute(parallelTask);
AtlasDependencyTree atlasDependencyTree = AtlasBuildContext.androidDependencyTrees.get(parallelTask.getVariantName());
if (null == atlasDependencyTree) {
return;
}
List<DefaultTask> tasks = new ArrayList<DefaultTask>();
for (final AwbBundle awbBundle : atlasDependencyTree.getAwbBundles()) {
if (awbBundle.isMBundle) {
continue;
}
MergeAwbAssets.MergeAwbAssetConfigAction mergeAwbAssetConfigAction = new MergeAwbAssets.MergeAwbAssetConfigAction(appVariantContext, baseVariantOutput, awbBundle);
MergeAwbAssets mergeTask = TaskCreater.create(appVariantContext.getProject(), mergeAwbAssetConfigAction.getName(), mergeAwbAssetConfigAction.getType());
mergeAwbAssetConfigAction.execute(mergeTask);
tasks.add(mergeTask);
}
parallelTask.parallelTask = tasks;
parallelTask.concurrent = false;
parallelTask.uniqueTaskName = getName();
}
use of com.taobao.android.builder.dependency.AtlasDependencyTree in project atlas by alibaba.
the class MergeResV4Dir method taskAction.
@TaskAction
public void taskAction() throws IOException {
File resDir = variantScope.getFinalResourcesDir();
moveFiles(resDir);
AtlasDependencyTree atlasDependencyTree = AtlasBuildContext.androidDependencyTrees.get(getVariantName());
if (null != atlasDependencyTree) {
for (final AwbBundle awbBundle : atlasDependencyTree.getAwbBundles()) {
File awbResDir = variantContext.getMergeResources(awbBundle);
moveFiles(awbResDir);
}
}
}
use of com.taobao.android.builder.dependency.AtlasDependencyTree in project atlas by alibaba.
the class AppVariantOutputContext method getAwbTransformMap.
public synchronized Map<String, AwbTransform> getAwbTransformMap() {
// TODO
if (awbTransformMap.isEmpty()) {
AtlasDependencyTree dependencyTree = AtlasBuildContext.androidDependencyTrees.get(variantContext.getVariantName());
for (AwbBundle awbBundle : dependencyTree.getAwbBundles()) {
// Generate the AwbTransform object
AwbTransform awbTransform = new AwbTransform(awbBundle);
// awbTransform.setInputDir(awbJavaCompile.getDestinationDir());
// ADD R.class
awbTransform.getInputLibraries().addAll(awbBundle.getLibraryJars());
// awbTransform.getInputLibraries().addAll(appVariantOutputContext.getJAwbavaOutputDir
// (awbBundle));
awbTransformMap.put(awbBundle.getName(), awbTransform);
}
}
return awbTransformMap;
}
use of com.taobao.android.builder.dependency.AtlasDependencyTree in project atlas by alibaba.
the class AtlasProguardHelper method applyBundleInOutConfigration.
public static File applyBundleInOutConfigration(final AppVariantContext appVariantContext, ProGuardTransform proGuardTransform) {
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 {
configs = awbProguardConfiguration.printConfigFile(awbInOutConfig);
} catch (IOException e) {
throw new GradleException("", e);
}
proGuardTransform.setConfigurationFiles(appVariantContext.getScope().getGlobalScope().getProject().files(awbInOutConfig));
}
return awbInOutConfig;
}
Aggregations