Skip to content

Commit 72205d4

Browse files
committed
#4 Upgrade lib, Package with mvn
1 parent 622ca4f commit 72205d4

File tree

5 files changed

+113
-20
lines changed

5 files changed

+113
-20
lines changed

BinaryInternalsViewer/pom.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212

1313
<name>freeinternals :: BinaryInternalsViewer</name>
1414

15+
<properties>
16+
<maven.build.timestamp.format>yyyyMMdd.HHmmss</maven.build.timestamp.format>
17+
</properties>
18+
1519
<dependencies>
1620
<dependency>
1721
<groupId>${project.groupId}</groupId>
@@ -56,6 +60,8 @@
5660
</dependencies>
5761

5862
<build>
63+
<finalName>${project.artifactId}-${project.version}-${git.commit.id.abbrev}-${maven.build.timestamp}</finalName>
64+
5965
<plugins>
6066

6167
<!-- Copy dependencies libraries to Target folder -->
@@ -94,6 +100,54 @@
94100
</configuration>
95101
</plugin>
96102

103+
<!-- Git revision -->
104+
<plugin>
105+
<groupId>io.github.git-commit-id</groupId>
106+
<artifactId>git-commit-id-maven-plugin</artifactId>
107+
<version>${git-commit-id-maven-plugin.version}</version>
108+
<executions>
109+
<execution>
110+
<id>get-the-git-infos</id>
111+
<goals>
112+
<goal>revision</goal>
113+
</goals>
114+
<phase>initialize</phase>
115+
</execution>
116+
</executions>
117+
<configuration>
118+
<generateGitPropertiesFile>true</generateGitPropertiesFile>
119+
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
120+
<includeOnlyProperties>
121+
<includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
122+
<includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
123+
</includeOnlyProperties>
124+
<commitIdGenerationMode>full</commitIdGenerationMode>
125+
</configuration>
126+
</plugin>
127+
128+
<!-- Package -->
129+
<!-- https://maven.apache.org/plugins/maven-assembly-plugin/usage.html -->
130+
<!-- https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html -->
131+
<plugin>
132+
<groupId>org.apache.maven.plugins</groupId>
133+
<artifactId>maven-assembly-plugin</artifactId>
134+
<version>${maven-assembly-plugin.version}</version>
135+
<configuration>
136+
<descriptors>
137+
<descriptor>src/assembly/bin.xml</descriptor>
138+
</descriptors>
139+
<outputDirectory>${project.parent.basedir}${file.separator}dist</outputDirectory>
140+
</configuration>
141+
<executions>
142+
<execution>
143+
<phase>package</phase>
144+
<goals>
145+
<goal>single</goal>
146+
</goals>
147+
</execution>
148+
</executions>
149+
</plugin>
150+
97151
</plugins>
98152
</build>
99153
</project>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<assembly
2+
xmlns="http://maven.apache.org/ASSEMBLY/2.1.1"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.1 https://maven.apache.org/xsd/assembly-2.1.1.xsd">
5+
<id>bin</id>
6+
<formats>
7+
<format>tar.gz</format>
8+
<format>zip</format>
9+
</formats>
10+
<fileSets>
11+
<fileSet>
12+
<directory>${project.basedir}</directory>
13+
<outputDirectory>/</outputDirectory>
14+
<includes>
15+
<include>README*</include>
16+
<include>LICENSE*</include>
17+
<include>NOTICE*</include>
18+
</includes>
19+
</fileSet>
20+
<fileSet>
21+
<directory>${project.build.directory}</directory>
22+
<outputDirectory>/</outputDirectory>
23+
<includes>
24+
<include>*.jar</include>
25+
</includes>
26+
</fileSet>
27+
<fileSet>
28+
<directory>${project.build.directory}/libs</directory>
29+
<outputDirectory>libs</outputDirectory>
30+
<includes>
31+
<include>*.jar</include>
32+
</includes>
33+
</fileSet>
34+
</fileSets>
35+
<!-- TODO change output directory -->
36+
</assembly>

README.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,11 @@ Download
2323
User guide
2424

2525
* We need the `java` command to run this tool
26-
* `java -jar BinaryInternalsViewer-3.5.jar`
26+
* `java -jar BinaryInternalsViewer-3.5-gitcommitid.jar`
27+
* Where `gitcommitid` is the auto-generated `git` commit id
2728
* Menu item: `File` > `Open...`
2829
* Choose the binary file to view
2930

30-
Dependency
31-
32-
* This application do not rely on any 3rd party libraries other than JDK, easy to add it to your project
33-
3431
Build the Source Code
3532

3633
* Prerequisite
@@ -39,12 +36,18 @@ Build the Source Code
3936
* Set `JAVA_HOME` environment variable
4037
* If not set use the export statements in the `build.sh` script
4138
* Build scripts
42-
* Linux/MacOS: `./build.sh` Do a quickly build, or `./full-lifecycle-build.sh` do a full build via execute all targets like checkstyle, spotbugs, etc.
43-
* Windows: `build.cmd`
39+
* Linux/MacOS/Windows Git Bash:
40+
* `./build.sh` Do a quickly build, or
41+
* `./full-lifecycle-build.sh` do a full build via execute all targets like checkstyle, spotbugs, etc.
42+
* Windows CMD: `build.cmd`
4443
* Test Case for Java `.class` format
4544
* `./format-class-masstest.sh` Parse all `.class` files in Ubuntu linux system `default-java` folder
4645
* We can edit the `JAVA_FOLDER` variable in the script if want to test with other Java versions
4746

47+
Dependency
48+
49+
* This application do not rely on 3rd party libraries other than JDK, easy to add it to your project
50+
4851
Legacy note
4952

5053
* The original `Java Class Viewer` has been retired and merged into `Binary Internals Viewer` since Apr 2021

build.sh

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,18 @@
1515
# Set java home on MacOS
1616
#JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.0.3.1.jdk/Contents/Home
1717

18+
# Set java home on Windows
19+
# - Reference: https://www.theserverside.com/feature/How-to-set-JAVA_HOME-in-Windows-and-echo-the-result
20+
# - Example value: JAVA_HOME=C:\data\tools\jdk
21+
1822
java -version
1923

24+
git log -1 --format='%H %aI' > BinaryInternalsViewer/VERSION.log
25+
2026
mvn clean package install
2127
mvn javadoc:aggregate
2228
mvn jdeps:jdkinternals
2329
mvn versions:display-dependency-updates
2430

25-
# Package
26-
# Add git revision info to version.log
27-
# Save to dist folder
28-
29-
mkdir -p dist
30-
cd BinaryInternalsViewer/target && pwd
31-
git log -1 --format='%H %aI' > version.log
32-
zip -r "../../dist/BinaryInternalsViewer-3.5_$(date '+%Y-%m-%d_%H.%M.%S').zip" BinaryInternalsViewer-3.5.jar libs/ version.log
33-
3431
echo "$0 Finished"
35-
32+
LTS

pom.xml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@
4141
<properties>
4242
<maven.compiler.release>11</maven.compiler.release>
4343
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version><!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin -->
44+
<maven-assembly-plugin.version>3.4.2</maven-assembly-plugin.version><!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin -->
4445
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4546
<spotbugs.version>4.7.3</spotbugs.version><!-- https://mvnrepository.com/artifact/com.github.spotbugs/spotbugs-annotations -->
46-
4747
<revision>3.5</revision>
48+
<git-commit-id-maven-plugin.version>5.0.0</git-commit-id-maven-plugin.version><!-- https://mvnrepository.com/artifact/io.github.git-commit-id/git-commit-id-maven-plugin -->
4849
</properties>
4950

5051
<dependencies>
@@ -80,7 +81,7 @@
8081
<dependency>
8182
<groupId>com.puppycrawl.tools</groupId>
8283
<artifactId>checkstyle</artifactId>
83-
<version>10.4</version><!-- https://mvnrepository.com/artifact/com.puppycrawl.tools/checkstyle -->
84+
<version>10.5.0</version><!-- https://mvnrepository.com/artifact/com.puppycrawl.tools/checkstyle -->
8485
</dependency>
8586
</dependencies>
8687
<configuration>
@@ -133,7 +134,7 @@
133134
</executions>
134135
</plugin>
135136

136-
<!-- Javadoc and Source -->
137+
<!-- Generate Javadocs -->
137138
<plugin>
138139
<groupId>org.apache.maven.plugins</groupId>
139140
<artifactId>maven-javadoc-plugin</artifactId>
@@ -160,6 +161,8 @@
160161
</execution>
161162
</executions>
162163
</plugin>
164+
165+
<!-- Creates a jar archive of the source files of the current project -->
163166
<plugin>
164167
<groupId>org.apache.maven.plugins</groupId>
165168
<artifactId>maven-source-plugin</artifactId>

0 commit comments

Comments
 (0)