Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
heowc authored May 1, 2024
2 parents 1534a13 + e2bb5f8 commit 56ea8a0
Show file tree
Hide file tree
Showing 36 changed files with 2,389 additions and 1 deletion.
1,129 changes: 1,129 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI
on:
push:
branches:
- main
tags-ignore:
- heo-*
pull_request:
jobs:
ci:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: graalvm/setup-graalvm@v1
with:
java-version: '21' # See 'Options' section below for all supported versions
distribution: 'graalvm' # See 'Options' section below for all available distributions
- name: Check Gradle Version
run: |
chmod +x gradlew
./gradlew --version
- name: Test task with Gradle Wrapper
run: |
./gradlew --parallel --max-workers=4 build
- name: Create report file
if: success()
run: |
sudo apt install -y graphviz
JAR_FILE=$(ls -al ./build/libs/ | tail -1 | awk '{print $9}')
java -jar ./build/libs/$JAR_FILE -d $(pwd) -p com.heowc.heo.core -o ${{ github.event.pull_request.number }}.png
- name: Create self test report
if: success() && github.event.pull_request.number != ''
uses: actions/upload-artifact@v4
with:
path: ${{ github.event.pull_request.number }}.png
name: interg-reports
retention-days: 7

- name: If failure then upload test reports
if: failure()
uses: actions/upload-artifact@v4
with:
path: '*/build/reports/tests'
name: test-reports
retention-days: 7
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
6 changes: 6 additions & 0 deletions .sdkmanrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Use sdkman to run "sdk env" to initialize with correct JDK version
# Enable auto-env through the sdkman_auto_env config
# See https://sdkman.io/usage#config
# A summary is to add the following to ~/.sdkman/etc/config
# sdkman_auto_env=true
java=21.0.2-graalce
45 changes: 44 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,44 @@
# heo
# heo

Tools to analyze package-level structure and visualize it

# install

Download the latest jar file from the [release](https://github.com/heowc/heo/releases)

This tool relies on [graphviz](https://graphviz.org/). Please install graphviz first.

# usage

- `d`: Enter the directory path.
- `p`: Enter the package path.
- `o`: Enter the destination file path.

```bash
java -jar heo-0.0.1.jar -d /Users/heowc/Projects/heo -p com.heowc.heo
```

```text
$ java -jar heo-0.0.1.jar -d /Users/heowc/Projects/heo -p com.heowc.heo
__ __ _______ _______
| | | || || |
| |_| || ___|| _ |
| || |___ | | | |
| || ___|| |_| |
| _ || |___ | |
|__| |__||_______||_______|
2024-05-01T17:23:52.031+09:00 INFO 72099 --- [ main] c.h.h.c.l.a.ModuleLoaderService : Loading com.heowc.heo from ./
2024-05-01T17:23:52.044+09:00 INFO 72099 --- [ main] c.h.h.c.a.a.DependencyAnalysisService : Analysing project dependencies for modules. size=0
2024-05-01T17:23:52.445+09:00 INFO 72099 --- [ main] c.h.h.c.v.ReportVisualizationService : Report file created (file:///Users/heowc/Projects/heo/result-1714551832030.png)
```

## Result

![image sample](./docs/sample.png)

# What's next

- Support native
- See https://github.com/oracle/graal/issues/8273
- Support plugin (gradle, maven etc)
79 changes: 79 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.2.4'
id 'io.spring.dependency-management' version '1.1.4'
id 'org.graalvm.buildtools.native' version '0.9.16'
id 'maven-publish'
}

group = 'com.heowc'
version = '0.0.1'

java {
sourceCompatibility = '17'
}

repositories {
mavenCentral()
}

ext {
set('springShellVersion', "3.2.3")
}

dependencies {
implementation 'org.springframework.shell:spring-shell-starter'
implementation 'guru.nidi:graphviz-java:0.18.1'
implementation 'guru.nidi:graphviz-java-min-deps:0.18.1'

implementation 'org.jgrapht:jgrapht-core:1.5.2'
implementation 'org.jgrapht:jgrapht-io:1.5.2'

implementation 'com.github.javaparser:javaparser-core:3.25.10'

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.shell:spring-shell-test'
testImplementation 'org.springframework.shell:spring-shell-test-autoconfigure'
}

dependencyManagement {
imports {
mavenBom "org.springframework.shell:spring-shell-dependencies:${springShellVersion}"
}
}

graalvmNative {
metadataRepository {
enabled = true
}
binaries {
main {
buildArgs.add('--verbose')
buildArgs.add('-H:IncludeResources=.*js$')
buildArgs.add("-H:ReflectionConfigurationFiles=${projectDir}/src/main/resources/META-INF/native-image/reflect-config.json")
buildArgs.add("-H:ResourceConfigurationFiles=${projectDir}/src/main/resources/META-INF/native-image/resource-config.json")
}
}
}

tasks.named('test') {
useJUnitPlatform()
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/heowc/heo")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
}
}
}
publications {
gpr(MavenPublication) {
from(components.java)
}
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 56ea8a0

Please sign in to comment.