https://github.com/adoptopenjdk/jsplitpkgscan
JDK 9+ split package analysis tool
https://github.com/adoptopenjdk/jsplitpkgscan
Last synced: 9 months ago
JSON representation
JDK 9+ split package analysis tool
- Host: GitHub
- URL: https://github.com/adoptopenjdk/jsplitpkgscan
- Owner: AdoptOpenJDK
- License: gpl-2.0
- Created: 2016-11-15T12:51:11.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-02-25T23:41:47.000Z (almost 5 years ago)
- Last Synced: 2025-03-20T19:07:37.820Z (10 months ago)
- Language: Java
- Homepage:
- Size: 402 KB
- Stars: 22
- Watchers: 12
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= OpenJDK split package scanner
Patrick Reinhart
:project-name: jsplitpkgscan
:group-name: org.adoptopenjdk
:jsplitpkgscan-version: 1.1.0-SNAPSHOT
:project-full-path: AdoptOpenJDK/{project-name}
:github-branch: master
:jdk-version: 11
:jdk-url: https://jdk.java.net/{jdk-version}
:adoptopenjdk-url: https://adoptopenjdk.net
image:https://img.shields.io/badge/license-GPL2+CPE-blue.svg["GNU General Public License, version 2, with the Classpath Exception", link="https://github.com/{project-full-path}/blob/{github-branch}/LICENSE"]
image:https://img.shields.io/badge/Java-{jdk-version}-blue.svg["Supported Versions", link="https://travis-ci.org/{project-full-path}"]
image:https://github.com/{project-full-path}/actions/workflows/gradle.yml/badge.svg["Java CI with Gradle", link="https://github.com/{project-full-path}/actions/workflows/gradle.yml"]
image:https://img.shields.io/maven-central/v/{group-name}/{project-name}.svg?label=Maven%20Central["Maven Central", link="https://search.maven.org/search?q=g:%22{group-name}%22%20AND%20a:%22{project-name}%22"]
This project contains a proposal for http://openjdk.java.net[OpenJDK] split package scanner addition.
The diving force starting this tool was the lack of tooling to prepare existing class path based modules
for later migration to modules. For split packages with the current _JDK_, they will be shown by the `jdeps`
tool as of today, but not class path based modules so far.
The `jsplitpgkscan` utility will search for split packages within all given `.jar` files and the modules
known to the _JDK_ itself and report them.
== Build and run
To build the tool you need to have a actual _JDK_ build that you can get from
{jdk-url}[{jdk-url}], {adoptopenjdk-url}[{adoptopenjdk-url}] or other providers.
Make sure that you have at least version _jdk-{jdk-version}_ installed.
To build use:
[source, bash]
----
./gradlew clean build
----
After the build was successful you can now start it using:
[source, bash, subs="attributes"]
----
java -p build/libs/jsplitpkgscan-{jsplitpkgscan-version}.jar -m jdk.jsplitpkgscan
----
The usage is as follows
[source]
----
Usage: jsplitpkgscan ]
can be a pathname to a JAR/WAR/RAR file or exploded JAR/WAR/RAR file.
Possible options include:
-h -? --help Print this usage message
-a Report all packages for each found JAR/RAR/WAR
file or exploded directory
-d Directory containing JAR/RAR/WAR files or
exploded directories to scan
(scans subdirectories as well)
-f File containing a list of JAR/RAR/WAR files
or exploded directories to scan
-p Package prefix to report only split packages
that matches this prefix
--dot-output Destination directory for DOT file output
----
In order to create your own distribution using jlink you can enter the following command
if you have `JAVA_HOME` set:
[source, bash]
----
$JAVA_HOME/bin/jlink --module-path $JAVA_HOME/jmods:build/libs --add-modules jsplitpkgscan \
--launcher jsplitpkgscan=jsplitpkgscan --output /tmp/jsplitpkgscan
----
For using the tool from inside you're code, you can access it looking it up a an
`java.util.spi.ToolProvider` implementation as follows:
[source, java]
----
int rc = ToolProvider.findFirst("jsplitpgkscan")
.ifPresent(tool -> tool.run(System.out, System.err, "-h")
----
== Create DOT graphic
To get a `.png` graphic for any `.dot` file output for directed graphs you could use:
[source, bash]
----
dot -Tpng summary.dot -O -Gratio=0.5
----
If your experience problems due undirected graphs you could also use this command:
[source, bash]
----
twopi -Tpng summary.dot -O -Gratio=0.5 -Goverlap=false
----
== Contribute
Contributions are always welcome.
== License
This project is licensed under the https://github.com/{project-full-path}/blob/{github-branch}/LICENSE[GNU General Public License, version 2 with the Classpath Exception]