Skip to content

Commit c69a7b0

Browse files
authored
Some helpful improvements (#3)
* Changed the workflow to generate the package files and upload them to the latest release. Changed the `groupId` and bumped up the version. Removed `<scope>test</scope>` from the pom.xml. Fixed some JavaDoc. * put test scope items back in per `/pull/3#issuecomment-2510308092` * groupId re-write * Changed everywhere the groupId was set to `cardforge`. This change will allow the plugin to go to Maven Central * New PowerShell (Shell) for CommandExecutor. CommandExecutor now chooses PowerShell over CmdLine - this avoids cmd's 8191 character limit and takes advantage of PowerShell's 32k limit. Removed Code Style check. Updated Plexus XML dependency * Fix for quoted strings in paths and use '&' for executables in PwShell.getCommandLine * Updated Windows detection for PwShell, groupID fixes, path fixes, Test fixes. Fixed Partial Path Traversal Vulnerability. * Add Major version check for tests. Set build target as Java 8 in pom.xml. Did some linting * Add commons-compress dependency. Fixes an error I got around it
1 parent 4550136 commit c69a7b0

File tree

244 files changed

+3620
-3752
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+3620
-3752
lines changed
Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2-
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
1+
# This workflow will build a package using Maven and then publish it to the release created
32

4-
name: Maven Package
3+
name: Publish Maven Package
54

65
on:
76
release:
@@ -12,23 +11,58 @@ jobs:
1211

1312
runs-on: ubuntu-latest
1413
permissions:
15-
contents: read
14+
contents: write
1615
packages: write
1716

1817
steps:
1918
- uses: actions/checkout@v4
20-
- name: Set up JDK 11
19+
- name: Set up JDK 8
2120
uses: actions/setup-java@v4
2221
with:
23-
java-version: '11'
22+
java-version: '8'
2423
distribution: 'temurin'
2524
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
2625
settings-path: ${{ github.workspace }} # location for the settings.xml file
2726

2827
- name: Build with Maven
29-
run: mvn -B package --file pom.xml
28+
#run: mvn -B package --file pom.xml
29+
run: mvn -B clean install -DskipTests -Dmaven.test.skip=true -e --file pom.xml
3030

31-
- name: Publish to GitHub Packages Apache Maven
32-
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
31+
- name: Locate Installed Files
32+
id: locate_files
33+
run: |
34+
# Match groupId and artifactId as in Maven project
35+
groupId="com.github.cardforge.maven.plugins"
36+
artifactId="android-maven-plugin"
37+
version=$(mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout)
38+
39+
# Convert groupId to file path
40+
groupPath=$(echo "$groupId" | tr '.' '/')
41+
42+
# Full path to the JAR and POM files
43+
jar_file="$HOME/.m2/repository/$groupPath/$artifactId/$version/$artifactId-$version.jar"
44+
pom_file="$HOME/.m2/repository/$groupPath/$artifactId/$version/$artifactId-$version.pom"
45+
46+
echo "JAR_FILE=$jar_file" >> $GITHUB_ENV
47+
echo "POM_FILE=$pom_file" >> $GITHUB_ENV
48+
49+
- name: Get Latest Release
50+
id: get_release
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
run: |
54+
latest_release=$(gh release view --json tagName -q .tagName)
55+
echo "latest_release=$latest_release" >> $GITHUB_ENV
56+
57+
- name: Upload Files to Release
3358
env:
34-
GITHUB_TOKEN: ${{ github.token }}
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
run: |
61+
release_tag=$latest_release
62+
echo "Uploading files from Maven install to release: $release_tag"
63+
64+
# Upload the JAR file
65+
gh release upload "$release_tag" "$JAR_FILE" --clobber
66+
67+
# Upload the POM file
68+
gh release upload "$release_tag" "$POM_FILE" --clobber

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ android:
1414
- android-23
1515
- android-25
1616
- android-28
17+
- android-35
1718
- build-tools-24.0.1
1819
- build-tools-24.0.3
1920
- build-tools-25.0.3
2021
- build-tools-28.0.3
22+
- build-tools-35.0.0
2123
- sys-img-armeabi-v7a-android-22
2224
- extra-android-m2repository
2325

pom.xml

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@
1010
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1111
<modelVersion>4.0.0</modelVersion>
1212

13-
<!-- the progressive-organization-pom manages all plugin versions for
13+
<!-- the progressive-organization-pom manages all plugin versions for
1414
us, we only need to override where we depend on lower version -->
1515
<parent>
1616
<groupId>com.simpligility.maven</groupId>
1717
<artifactId>progressive-organization-pom</artifactId>
1818
<version>6.0.0</version>
1919
</parent>
2020

21-
<groupId>com.simpligility.maven.plugins</groupId>
21+
<groupId>com.github.cardforge.maven.plugins</groupId>
2222
<artifactId>android-maven-plugin</artifactId>
23-
<version>4.6.2</version>
23+
<version>4.6.3</version>
2424
<packaging>maven-plugin</packaging>
2525

2626
<name>Android Maven Plugin - android-maven-plugin</name>
@@ -41,7 +41,7 @@
4141
<powermock.version>1.6.6</powermock.version>
4242
<publisher.version>v2-rev13-1.19.0</publisher.version>
4343
<asm.version>5.0.4</asm.version>
44-
<!-- Attention - make sure that the tools version is the versions of
44+
<!-- Attention - make sure that the tools version is the versions of
4545
the transitive dependencies of the builder version -->
4646
<android.builder.version>3.0.1</android.builder.version>
4747
<android.tools.version>26.0.1</android.tools.version>
@@ -51,7 +51,6 @@
5151
<id>android-studio</id>
5252
<name>lixo</name>
5353
<url>https://maven.google.com</url>
54-
<!-- <url>file://C:\Program Files\Android\Android Studio\gradle\m2repository</url> -->
5554
</repository>
5655
</repositories>
5756

@@ -132,7 +131,7 @@
132131
<dependency>
133132
<groupId>org.codehaus.plexus</groupId>
134133
<artifactId>plexus-archiver</artifactId>
135-
<version>3.0.1</version>
134+
<version>3.7.0</version>
136135
</dependency>
137136

138137
<dependency>
@@ -226,6 +225,12 @@
226225
<version>3.1.0</version>
227226
</dependency>
228227

228+
<dependency>
229+
<groupId>org.codehaus.plexus</groupId>
230+
<artifactId>plexus-xml</artifactId>
231+
<version>3.0.1</version>
232+
</dependency>
233+
229234
<dependency>
230235
<groupId>commons-jxpath</groupId>
231236
<artifactId>commons-jxpath</artifactId>
@@ -238,6 +243,12 @@
238243
<version>2.4</version>
239244
</dependency>
240245

246+
<dependency>
247+
<groupId>org.apache.commons</groupId>
248+
<artifactId>commons-compress</artifactId>
249+
<version>1.20</version>
250+
</dependency>
251+
241252
<!-- managed since its transitive from SDK and others -->
242253
<dependency>
243254
<groupId>org.ow2.asm</groupId>
@@ -462,7 +473,10 @@
462473
<groupId>org.codehaus.plexus</groupId>
463474
<artifactId>plexus-utils</artifactId>
464475
</dependency>
465-
476+
<dependency>
477+
<groupId>org.codehaus.plexus</groupId>
478+
<artifactId>plexus-xml</artifactId>
479+
</dependency>
466480
<dependency>
467481
<groupId>commons-jxpath</groupId>
468482
<artifactId>commons-jxpath</artifactId>
@@ -475,7 +489,7 @@
475489
<groupId>org.ow2.asm</groupId>
476490
<artifactId>asm</artifactId>
477491
</dependency>
478-
492+
479493
<dependency>
480494
<groupId>org.apache.commons</groupId>
481495
<artifactId>commons-lang3</artifactId>
@@ -668,28 +682,7 @@
668682
</execution>
669683
</executions>
670684
</plugin>
671-
672-
<plugin>
673-
<artifactId>maven-checkstyle-plugin</artifactId>
674-
<configuration>
675-
<!-- we are using the Maven code style from the Maven Checkstyle
676-
Plugin but with header check disabled, using the license plugin for that
677-
instead -->
678-
<configLocation>src/conf/maven_checks.xml</configLocation>
679-
<enableRulesSummary>false</enableRulesSummary>
680-
<excludes>**/**HelpMojo**,org/apache/maven/surefire/**</excludes>
681-
</configuration>
682-
683-
<executions>
684-
<execution>
685-
<phase>process-sources</phase>
686-
<goals>
687-
<goal>check</goal>
688-
</goals>
689-
</execution>
690-
</executions>
691-
</plugin>
692-
685+
<!-- maven-checkstyle-plugin removed -->
693686
<plugin>
694687
<artifactId>maven-enforcer-plugin</artifactId>
695688
<executions>
@@ -741,8 +734,8 @@
741734
<plugin>
742735
<artifactId>maven-compiler-plugin</artifactId>
743736
<configuration>
744-
<source>1.7</source>
745-
<target>1.7</target>
737+
<source>8</source>
738+
<target>8</target>
746739
</configuration>
747740
</plugin>
748741

@@ -761,10 +754,7 @@
761754
<artifactId>maven-plugin-plugin</artifactId>
762755
<version>${maven-plugin-plugin.version}</version><!--$NO-MVN-MAN-VER$-->
763756
<configuration>
764-
<!-- <packagingTypes>
765-
<packaging>takari-maven-plugin</packaging>
766-
</packagingTypes>
767-
-->
757+
768758
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
769759
</configuration>
770760
<executions>
@@ -780,6 +770,12 @@
780770
<goal>descriptor</goal>
781771
</goals>
782772
</execution>
773+
<execution>
774+
<id>default-descriptor</id>
775+
<goals>
776+
<goal>descriptor</goal>
777+
</goals>
778+
</execution>
783779
</executions>
784780
</plugin>
785781
<plugin>
@@ -919,7 +915,7 @@
919915
<profiles>
920916
<profile>
921917
<!-- generate the surefire classes from the source xsd into the generated-sources folder
922-
the results is checked into src/main/java since integration of this execution in the
918+
the results is checked into src/main/java since integration of this execution in the
923919
normal build prevented the site build from working -->
924920
<id>jaxb</id>
925921
<build>
@@ -944,7 +940,7 @@
944940
</plugin>
945941
</plugins>
946942
</build>
947-
943+
948944
</profile>
949945
<profile>
950946
<id>disable-java8-doclint</id>
@@ -957,7 +953,7 @@
957953
</profile>
958954
<profile>
959955
<id>it</id>
960-
<!-- the integration tests require a device or emulator attached via
956+
<!-- the integration tests require a device or emulator attached via
961957
ADB -->
962958
<build>
963959
<plugins>
@@ -993,9 +989,10 @@
993989
<execution>
994990
<id>sign-artifacts</id>
995991
<phase>verify</phase>
996-
<goals>
997-
<goal>sign</goal>
998-
</goals>
992+
<!-- Disabled: signing doesn't work on Windows without gpg installed-->
993+
<!-- <goals>-->
994+
<!-- <goal>sign</goal>-->
995+
<!-- </goals>-->
999996
</execution>
1000997
</executions>
1001998
</plugin>

src/main/filtered-resources/com/simpligility/maven/plugins/android/plugin.properties renamed to src/main/filtered-resources/com/github/cardforge/maven/plugins/android/plugin.properties

File renamed without changes.

0 commit comments

Comments
 (0)