use of com.taobao.android.builder.tools.jarmerge.JarMergerWithOverride in project atlas by alibaba.
the class DexBuildTask method doFullTaskAction.
@TaskAction
public void doFullTaskAction() throws IOException {
classJar = getClassJar();
dependencyJars = getDependencyJars();
File mergeJar = new File(classJar.getParentFile(), "merge.jar");
JarMergerWithOverride jarMergerWithOverride = new JarMergerWithOverride(mergeJar);
jarMergerWithOverride.addJar(classJar);
for (File file : dependencyJars) {
jarMergerWithOverride.addJar(file);
}
jarMergerWithOverride.close();
ClassPool classPool = initClassPool(mergeJar);
String jarFileName = classJar.getName();
String outFileName = FilenameUtils.getBaseName(jarFileName) + "-inject.jar";
File outPutJar = new File(classJar.getParentFile(), outFileName);
CodeInjectByJavassist.inject(classPool, mergeJar, outPutJar, new InjectParam());
getOutputDexFile().getParentFile().mkdirs();
outputDexFile = DexBuilderUtils.buildDexInJvm(outPutJar, getOutputDexFile(), new ArrayList<String>());
}
Aggregations