From 6fb24720904ebd6aa808ed83c27a6a9fc1c1b673 Mon Sep 17 00:00:00 2001 From: lasselindqvist Date: Mon, 27 Sep 2021 21:58:49 +0300 Subject: [PATCH 1/4] Start development of 2.5.2 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8e3fa074..856cb1f9 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ com.github.wvengen proguard-maven-plugin proguard-maven-plugin - 2.5.1 + 2.5.2-SNAPSHOT maven-plugin Maven 3 Plugin for ProGuard From 259c5c22916aec21251ba18947468c1aecf40f3f Mon Sep 17 00:00:00 2001 From: "akira.asakawa" Date: Fri, 7 Feb 2020 11:13:15 +0900 Subject: [PATCH 2/4] Keep dependency injar archive if outjar is a directory --- .../wvengen/maven/proguard/ProGuardMojo.java | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/github/wvengen/maven/proguard/ProGuardMojo.java b/src/main/java/com/github/wvengen/maven/proguard/ProGuardMojo.java index 3ebfcae1..3bf4324a 100644 --- a/src/main/java/com/github/wvengen/maven/proguard/ProGuardMojo.java +++ b/src/main/java/com/github/wvengen/maven/proguard/ProGuardMojo.java @@ -481,6 +481,8 @@ public void execute() throws MojoExecutionException, MojoFailureException { inJarFile = baseFile; } + boolean outJarArchive = isArchive(outJarFile); + ArrayList args = new ArrayList(); ArrayList libraryJars = new ArrayList(); @@ -528,25 +530,31 @@ public void execute() throws MojoExecutionException, MojoFailureException { for (Entry entry : injars.entrySet()) { log.info("--- ADD injars:" + entry.getKey().getArtifactId()); - File file = getClasspathElement(entry.getKey(), mavenProject); + File file = getClasspathElement(entry.getKey(), mavenProject, !outJarArchive); inPath.add(file.toString()); StringBuilder filter = new StringBuilder(fileToString(file)); - filter.append("(!META-INF/MANIFEST.MF"); + int start = filter.length(); + if (outJarArchive) { + filter.append("(!META-INF/MANIFEST.MF"); + } if (!addMavenDescriptor) { - filter.append(","); + filter.append(filter.length() > start ? "," : "("); filter.append("!META-INF/maven/**"); } if (entry.getValue().filter != null) { - filter.append(",").append(entry.getValue().filter); + filter.append(filter.length() > start ? "," : "("); + filter.append(entry.getValue().filter); + } + if (filter.length() > start) { + filter.append(")"); } - filter.append(")"); args.add("-injars"); args.add(filter.toString()); } for (Entry entry : libraryjars.entrySet()) { log.info("--- ADD libraryjars:" + entry.getKey().getArtifactId()); - File file = getClasspathElement(entry.getKey(), mavenProject); + File file = getClasspathElement(entry.getKey(), mavenProject, false); hasInclusionLibrary = true; inPath.add(file.toString()); if (putLibraryJarsInTempDir) { @@ -590,7 +598,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { if (isExclusion(artifact)) { continue; } - File file = getClasspathElement(artifact, mavenProject); + File file = getClasspathElement(artifact, mavenProject, includeDependencyInjar && !outJarArchive); if (inPath.contains(file.toString())) { log.debug("--- ignore library since one in injar:" + artifact.getArtifactId()); @@ -766,7 +774,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { jarArchiver.addArchivedFileSet(baseFile); for (Entry entry : libraryjars.entrySet()) { File file; - file = getClasspathElement(entry.getKey(), mavenProject); + file = getClasspathElement(entry.getKey(), mavenProject, false); if (file.isDirectory()) { getLog().info("merge project: " + entry.getKey() + " " + file); jarArchiver.addDirectory(file); @@ -1062,6 +1070,25 @@ private boolean deleteFileOrDirectory(File path) throws MojoFailureException { } } + private boolean isArchive(File path) { + String name = path.getName(); + int separator = name.lastIndexOf('.'); + if (separator > 0) { + // https://www.guardsquare.com/en/products/proguard/manual/usage#classpath + String extension = name.substring(separator + 1).toLowerCase(); + if (extension.equals("apk") + || extension.equals("jar") + || extension.equals("aar") + || extension.equals("war") + || extension.equals("ear") + || extension.equals("jmod") + || extension.equals("zip")) { + return true; + } + } + return false; + } + private Set getDependencies(final Inclusion inc, MavenProject mavenProject) throws MojoExecutionException { @SuppressWarnings("unchecked") @@ -1090,8 +1117,8 @@ private boolean isExclusion(Artifact artifact) { return false; } - private File getClasspathElement(Artifact artifact, MavenProject mavenProject) throws MojoExecutionException { - if (artifact.getClassifier() != null) { + private File getClasspathElement(Artifact artifact, MavenProject mavenProject, boolean preferFile) throws MojoExecutionException { + if (artifact.getClassifier() != null || (preferFile && artifact.getFile().exists())) { return artifact.getFile(); } String refId = artifact.getGroupId() + ":" + artifact.getArtifactId() + ":" + artifact.getVersion(); From 66ea95869d882b3de8c1153450b853a04bfab25d Mon Sep 17 00:00:00 2001 From: "akira.asakawa" Date: Fri, 8 Oct 2021 10:33:23 +0900 Subject: [PATCH 3/4] =?UTF-8?q?=E3=83=AD=E3=83=BC=E3=82=AB=E3=83=AB?= =?UTF-8?q?=E3=83=AA=E3=83=AA=E3=83=BC=E3=82=B9=E5=90=91=E3=81=91=E3=81=AB?= =?UTF-8?q?groupId=E3=81=A8version=E3=82=92=E5=A4=89=E6=9B=B4=E3=81=97?= =?UTF-8?q?=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 856cb1f9..266112b0 100644 --- a/pom.xml +++ b/pom.xml @@ -13,10 +13,10 @@ - com.github.wvengen + net.astah.maven.plugin proguard-maven-plugin proguard-maven-plugin - 2.5.2-SNAPSHOT + 2.5.2 maven-plugin Maven 3 Plugin for ProGuard From befc40394f72c665937aa99ad6e67a4ef11703db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Oct 2021 23:17:49 +0000 Subject: [PATCH 4/4] Bump ant from 1.10.11 to 1.10.12 Bumps ant from 1.10.11 to 1.10.12. --- updated-dependencies: - dependency-name: org.apache.ant:ant dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 266112b0..f7d48a35 100644 --- a/pom.xml +++ b/pom.xml @@ -97,7 +97,7 @@ org.apache.ant ant - 1.10.11 + 1.10.12