Skip to content

Commit

Permalink
#4 Upgrade lib, Package with mvn
Browse files Browse the repository at this point in the history
  • Loading branch information
amosshi committed Dec 17, 2022
1 parent 622ca4f commit 72205d4
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 20 deletions.
54 changes: 54 additions & 0 deletions BinaryInternalsViewer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

<name>freeinternals :: BinaryInternalsViewer</name>

<properties>
<maven.build.timestamp.format>yyyyMMdd.HHmmss</maven.build.timestamp.format>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
Expand Down Expand Up @@ -56,6 +60,8 @@
</dependencies>

<build>
<finalName>${project.artifactId}-${project.version}-${git.commit.id.abbrev}-${maven.build.timestamp}</finalName>

<plugins>

<!-- Copy dependencies libraries to Target folder -->
Expand Down Expand Up @@ -94,6 +100,54 @@
</configuration>
</plugin>

<!-- Git revision -->
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>${git-commit-id-maven-plugin.version}</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<includeOnlyProperties>
<includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
<includeOnlyProperty>^git.commit.id.(abbrev|full)$</includeOnlyProperty>
</includeOnlyProperties>
<commitIdGenerationMode>full</commitIdGenerationMode>
</configuration>
</plugin>

<!-- Package -->
<!-- https://maven.apache.org/plugins/maven-assembly-plugin/usage.html -->
<!-- https://maven.apache.org/plugins/maven-assembly-plugin/assembly.html -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven-assembly-plugin.version}</version>
<configuration>
<descriptors>
<descriptor>src/assembly/bin.xml</descriptor>
</descriptors>
<outputDirectory>${project.parent.basedir}${file.separator}dist</outputDirectory>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>
</project>
36 changes: 36 additions & 0 deletions BinaryInternalsViewer/src/assembly/bin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<assembly
xmlns="http://maven.apache.org/ASSEMBLY/2.1.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.1.1 https://maven.apache.org/xsd/assembly-2.1.1.xsd">
<id>bin</id>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory>/</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/libs</directory>
<outputDirectory>libs</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>
<!-- TODO change output directory -->
</assembly>
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ Download
User guide

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

Dependency

* This application do not rely on any 3rd party libraries other than JDK, easy to add it to your project

Build the Source Code

* Prerequisite
Expand All @@ -39,12 +36,18 @@ Build the Source Code
* Set `JAVA_HOME` environment variable
* If not set use the export statements in the `build.sh` script
* Build scripts
* 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.
* Windows: `build.cmd`
* Linux/MacOS/Windows Git Bash:
* `./build.sh` Do a quickly build, or
* `./full-lifecycle-build.sh` do a full build via execute all targets like checkstyle, spotbugs, etc.
* Windows CMD: `build.cmd`
* Test Case for Java `.class` format
* `./format-class-masstest.sh` Parse all `.class` files in Ubuntu linux system `default-java` folder
* We can edit the `JAVA_FOLDER` variable in the script if want to test with other Java versions

Dependency

* This application do not rely on 3rd party libraries other than JDK, easy to add it to your project

Legacy note

* The original `Java Class Viewer` has been retired and merged into `Binary Internals Viewer` since Apr 2021
17 changes: 7 additions & 10 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@
# Set java home on MacOS
#JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.0.3.1.jdk/Contents/Home

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

java -version

git log -1 --format='%H %aI' > BinaryInternalsViewer/VERSION.log

mvn clean package install
mvn javadoc:aggregate
mvn jdeps:jdkinternals
mvn versions:display-dependency-updates

# Package
# Add git revision info to version.log
# Save to dist folder

mkdir -p dist
cd BinaryInternalsViewer/target && pwd
git log -1 --format='%H %aI' > version.log
zip -r "../../dist/BinaryInternalsViewer-3.5_$(date '+%Y-%m-%d_%H.%M.%S').zip" BinaryInternalsViewer-3.5.jar libs/ version.log

echo "$0 Finished"

LTS
9 changes: 6 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@
<properties>
<maven.compiler.release>11</maven.compiler.release>
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version><!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-jar-plugin -->
<maven-assembly-plugin.version>3.4.2</maven-assembly-plugin.version><!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-assembly-plugin -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spotbugs.version>4.7.3</spotbugs.version><!-- https://mvnrepository.com/artifact/com.github.spotbugs/spotbugs-annotations -->

<revision>3.5</revision>
<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 -->
</properties>

<dependencies>
Expand Down Expand Up @@ -80,7 +81,7 @@
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>10.4</version><!-- https://mvnrepository.com/artifact/com.puppycrawl.tools/checkstyle -->
<version>10.5.0</version><!-- https://mvnrepository.com/artifact/com.puppycrawl.tools/checkstyle -->
</dependency>
</dependencies>
<configuration>
Expand Down Expand Up @@ -133,7 +134,7 @@
</executions>
</plugin>

<!-- Javadoc and Source -->
<!-- Generate Javadocs -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand All @@ -160,6 +161,8 @@
</execution>
</executions>
</plugin>

<!-- Creates a jar archive of the source files of the current project -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
Expand Down

0 comments on commit 72205d4

Please sign in to comment.