浏览代码

增加xml混淆

JustryDeng 4 年之前
父节点
当前提交
b9aaab7f33

+ 3 - 3
class-winter-core/src/main/java/winter/com/ideaaedi/classwinter/Forward.java

@@ -28,7 +28,7 @@ public class Forward {
         String excludePrefix = parseValueByPrefixFromTail("excludePrefix=", args);
         String includeXmlPrefix = parseValueByPrefixFromTail("includeXmlPrefix=", args);
         String excludeXmlPrefix = parseValueByPrefixFromTail("excludeXmlPrefix=", args);
-        String toClearChildElementName = parseValueByPrefixFromTail("toClearChildElementName=", args);
+        String toCleanChildElementName = parseValueByPrefixFromTail("toCleanChildElementName=", args);
         String finalName = parseValueByPrefixFromTail("finalName=", args);
         String password = parseValueByPrefixFromTail("password=", args);
         String includeLibs = parseValueByPrefixFromTail("includeLibs=", args);
@@ -43,7 +43,7 @@ public class Forward {
         Logger.debug(Forward.class, "You input arg excludePrefix -> " + excludePrefix);
         Logger.debug(Forward.class, "You input arg includeXmlPrefix -> " + includeXmlPrefix);
         Logger.debug(Forward.class, "You input arg excludeXmlPrefix -> " + excludeXmlPrefix);
-        Logger.debug(Forward.class, "You input arg toClearChildElementName -> " + toClearChildElementName);
+        Logger.debug(Forward.class, "You input arg toCleanChildElementName -> " + toCleanChildElementName);
         Logger.debug(Forward.class, "You input arg finalName -> " + finalName);
         Logger.debug(Forward.class, "You input arg password -> " + password);
         Logger.debug(Forward.class, "You input arg includeLibs -> " + includeLibs);
@@ -59,7 +59,7 @@ public class Forward {
                 .excludePrefix(excludePrefix)
                 .includeXmlPrefix(includeXmlPrefix)
                 .excludeXmlPrefix(excludeXmlPrefix)
-                .toClearChildElementName(toClearChildElementName)
+                .toCleanChildElementName(toCleanChildElementName)
                 .finalName(finalName)
                 .password(password)
                 .includeLibs(includeLibs)

+ 11 - 11
class-winter-core/src/main/java/winter/com/ideaaedi/classwinter/executor/EncryptExecutor.java

@@ -122,7 +122,7 @@ public class EncryptExecutor {
     /**
      * xml中要清除的(根节点的)子节点名称
      */
-    private final Set<String> toClearChildElementNameSet;
+    private final Set<String> toCleanChildElementNameSet;
 
     
     /**
@@ -199,7 +199,7 @@ public class EncryptExecutor {
     
     private EncryptExecutor(String originJarOrWar, boolean originIsJar, String finalName, String targetRootDir,
                             String targetLibDir, String targetClassesDir, String password,
-                            Set<String> includeXmlPrefixSet, Set<String> excludeXmlPrefixSet, Set<String> toClearChildElementNameSet,
+                            Set<String> includeXmlPrefixSet, Set<String> excludeXmlPrefixSet, Set<String> toCleanChildElementNameSet,
                             Set<String> includePrefixSet, Set<String> excludePrefixSet, Set<String> includeLibSet,
                             Set<Pair<String, String>> alreadyProtectedLibSet, String supportFile) {
         this.originJarOrWar = originJarOrWar;
@@ -211,7 +211,7 @@ public class EncryptExecutor {
         this.password = password;
         this.includeXmlPrefixSet = includeXmlPrefixSet;
         this.excludeXmlPrefixSet = excludeXmlPrefixSet;
-        this.toClearChildElementNameSet = toClearChildElementNameSet;
+        this.toCleanChildElementNameSet = toCleanChildElementNameSet;
         this.includePrefixSet = includePrefixSet;
         this.excludePrefixSet = excludePrefixSet;
         this.includeLibSet = includeLibSet;
@@ -345,7 +345,7 @@ public class EncryptExecutor {
         // 清空原xml文件的关键节点
         for (String zipEntryName : encryptNonClassFileSet) {
             byte[] bytes = IOUtil.readFileFromWorkbenchRoot(targetRootDirFile, zipEntryName);
-            String cleanedXml = clearXml(new String(bytes, StandardCharsets.UTF_8), Constant.XML_PADDING_COMMENT, toClearChildElementNameSet);
+            String cleanedXml = clearXml(new String(bytes, StandardCharsets.UTF_8), Constant.XML_PADDING_COMMENT, toCleanChildElementNameSet);
             IOUtil.writeContentToFile(cleanedXml, new File(targetRootDir, zipEntryName));
         }
     }
@@ -908,7 +908,7 @@ public class EncryptExecutor {
                 ", excludePrefixSet=" + excludePrefixSet +
                 ", includeXmlPrefixSet=" + includeXmlPrefixSet +
                 ", excludeXmlPrefixSet=" + excludeXmlPrefixSet +
-                ", toClearChildElementNameSet=" + toClearChildElementNameSet +
+                ", toCleanChildElementNameSet=" + toCleanChildElementNameSet +
                 ", includeLibSet=" + includeLibSet +
                 ", alreadyProtectedLibSet=" + alreadyProtectedLibSet +
                 '}';
@@ -937,7 +937,7 @@ public class EncryptExecutor {
         
         private String excludeXmlPrefix;
         
-        private String toClearChildElementName;
+        private String toCleanChildElementName;
         
         private String includeLibs;
         
@@ -984,8 +984,8 @@ public class EncryptExecutor {
             return this;
         }
         
-        public Builder toClearChildElementName(String toClearChildElementName) {
-            this.toClearChildElementName = toClearChildElementName;
+        public Builder toCleanChildElementName(String toCleanChildElementName) {
+            this.toCleanChildElementName = toCleanChildElementName;
             return this;
         }
         
@@ -1104,10 +1104,10 @@ public class EncryptExecutor {
             // xml相关参数解析
             Set<String> includeXmlPrefixSet = StrUtil.strToSet(includeXmlPrefix);
             Set<String> excludeXmlPrefixSet = StrUtil.strToSet(excludeXmlPrefix);
-            toClearChildElementName = StrUtil.isBlank(toClearChildElementName) ? Constant.DEFAULT_XML_NODE_NAMES : toClearChildElementName;
-            Set<String> toClearChildElementNameSet = StrUtil.strToSet(toClearChildElementName);
+            toCleanChildElementName = StrUtil.isBlank(toCleanChildElementName) ? Constant.DEFAULT_XML_NODE_NAMES : toCleanChildElementName;
+            Set<String> toCleanChildElementNameSet = StrUtil.strToSet(toCleanChildElementName);
             return new EncryptExecutor(this.originJarOrWar, originIsJar, this.finalName, targetRootDir, targetLibDir, targetClassesDir,
-                    password, includeXmlPrefixSet, excludeXmlPrefixSet, toClearChildElementNameSet, includePrefixSet, excludePrefixSet, includeLibSet, alreadyProtectedLibSet, this.supportFile);
+                    password, includeXmlPrefixSet, excludeXmlPrefixSet, toCleanChildElementNameSet, includePrefixSet, excludePrefixSet, includeLibSet, alreadyProtectedLibSet, this.supportFile);
         }
     
         /**

+ 3 - 3
class-winter-maven-plugin/src/main/java/winter/com/ideaaedi/classwinter/plugin/ClassWinterPlugin.java

@@ -48,7 +48,7 @@ public class ClassWinterPlugin extends AbstractMojo {
     private String excludeXmlPrefix;
     
     @Parameter
-    private String toClearChildElementName;
+    private String toCleanChildElementName;
     
     @Parameter
     private String includeLibs;
@@ -76,7 +76,7 @@ public class ClassWinterPlugin extends AbstractMojo {
         Logger.debug("You config arg excludePrefix -> " + excludePrefix);
         Logger.debug("You config arg includeXmlPrefix -> " + includeXmlPrefix);
         Logger.debug("You config arg excludeXmlPrefix -> " + excludeXmlPrefix);
-        Logger.debug("You config arg toClearChildElementName -> " + toClearChildElementName);
+        Logger.debug("You config arg toCleanChildElementName -> " + toCleanChildElementName);
         Logger.debug("You config arg finalName -> " + finalName);
         Logger.debug("You config arg password -> " + password);
         Logger.debug("You config arg includeLibs -> " + includeLibs);
@@ -96,7 +96,7 @@ public class ClassWinterPlugin extends AbstractMojo {
                 .excludePrefix(excludePrefix)
                 .includeXmlPrefix(includeXmlPrefix)
                 .excludeXmlPrefix(excludeXmlPrefix)
-                .toClearChildElementName(toClearChildElementName)
+                .toCleanChildElementName(toCleanChildElementName)
                 .includeLibs(includeLibs)
                 .alreadyProtectedLibs(alreadyProtectedLibs)
                 .supportFile(supportFile)