Search in sources :

Example 1 with KeepConverter

use of com.taobao.android.builder.tools.proguard.dump.KeepConverter in project atlas by alibaba.

the class AtlasProguardHelper method generateKeepFile.

@NotNull
private static File generateKeepFile(List<AwbBundle> awbBundles, File dir) throws IOException {
    KeepConverter refClazzContainer = new KeepConverter();
    for (AwbBundle awbBundle : awbBundles) {
        if (null != awbBundle.getKeepProguardFile() && awbBundle.getKeepProguardFile().exists()) {
            String json = FileUtils.readFileToString(awbBundle.getKeepProguardFile());
            Map<String, ClazzRefInfo> refClazzMap = JSON.parseObject(json, new TypeReference<Map<String, ClazzRefInfo>>() {
            });
            refClazzContainer.addRefClazz(refClazzMap);
        } else {
            sLogger.error("missing " + awbBundle.getKeepProguardFile().getAbsolutePath());
        }
    }
    File maindexkeep = new File(dir, "maindexkeep.cfg");
    FileUtils.writeLines(maindexkeep, refClazzContainer.convertToKeeplines());
    return maindexkeep;
}
Also used : KeepConverter(com.taobao.android.builder.tools.proguard.dump.KeepConverter) ClazzRefInfo(com.taobao.android.builder.tools.proguard.dump.ClazzRefInfo) AwbBundle(com.taobao.android.builder.dependency.model.AwbBundle) JarFile(java.util.jar.JarFile) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

AwbBundle (com.taobao.android.builder.dependency.model.AwbBundle)1 ClazzRefInfo (com.taobao.android.builder.tools.proguard.dump.ClazzRefInfo)1 KeepConverter (com.taobao.android.builder.tools.proguard.dump.KeepConverter)1 File (java.io.File)1 JarFile (java.util.jar.JarFile)1 NotNull (org.jetbrains.annotations.NotNull)1