Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
613dd63
Native image
ComputerDaddyGuy Oct 17, 2025
676ea25
Merge branch 'develop' into feature/cli
ComputerDaddyGuy Oct 17, 2025
a61c7c9
Use tar instead of zip
ComputerDaddyGuy Oct 17, 2025
af2a6cb
Fix native executable github action
ComputerDaddyGuy Oct 17, 2025
3e99f29
Fix zip for Windows
ComputerDaddyGuy Oct 17, 2025
6b4a85a
Fix MacOS native build + doc
ComputerDaddyGuy Oct 17, 2025
bbf493e
Fix MacOS native build
ComputerDaddyGuy Oct 17, 2025
552e720
Fix Windows native build
ComputerDaddyGuy Oct 17, 2025
9e99471
Fix Windows native build
ComputerDaddyGuy Oct 17, 2025
11441eb
Fix Windows native build
ComputerDaddyGuy Oct 17, 2025
cfcc647
Run release only on main branch
ComputerDaddyGuy Oct 17, 2025
7162c3b
Fix control
ComputerDaddyGuy Oct 17, 2025
4cbdec6
Fix control
ComputerDaddyGuy Oct 17, 2025
3e5e0b6
Fix control
ComputerDaddyGuy Oct 17, 2025
7f0cd4d
Update doc
ComputerDaddyGuy Oct 17, 2025
3371861
CLI: Work in progress
ComputerDaddyGuy Oct 19, 2025
b193b5d
CLI: Work in progress
ComputerDaddyGuy Oct 21, 2025
152f1a5
Fix Sonar
ComputerDaddyGuy Oct 29, 2025
a0d46fc
Fix Sonar
ComputerDaddyGuy Oct 29, 2025
4e8610d
Map external child limit
ComputerDaddyGuy Oct 29, 2025
23cf113
Work in progress
ComputerDaddyGuy Nov 4, 2025
5f05047
Refactor & tests
ComputerDaddyGuy Nov 6, 2025
b63e1fb
More CLI external features
ComputerDaddyGuy Nov 7, 2025
ad033a2
Fix Sonar
ComputerDaddyGuy Nov 7, 2025
64813e0
Fix Sonar
ComputerDaddyGuy Nov 7, 2025
f77bbf0
Exclude java tests from sonar
ComputerDaddyGuy Nov 8, 2025
8609ad1
Exclude java tests from sonar
ComputerDaddyGuy Nov 8, 2025
3ed83d3
Split + mvn test OK
ComputerDaddyGuy Nov 8, 2025
9d3216c
mvn native compilation ok
ComputerDaddyGuy Nov 8, 2025
73034c0
Renamed "examples" module + project structure picture update
ComputerDaddyGuy Nov 8, 2025
1711c39
Fix GH actions for multi-module
ComputerDaddyGuy Nov 8, 2025
87dc5de
Adapt pom.xml for maven central
ComputerDaddyGuy Nov 8, 2025
d48c1d9
Update readme resource urls
ComputerDaddyGuy Nov 8, 2025
ec6fb64
GH: testing actions
ComputerDaddyGuy Nov 8, 2025
97f7924
Prepare for v0.1.1
ComputerDaddyGuy Nov 8, 2025
497c54a
Prepare for v0.1.1
ComputerDaddyGuy Nov 8, 2025
a85a421
Fix Maven release GH action
ComputerDaddyGuy Nov 8, 2025
c9b2266
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
dda07c0
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
1fa222f
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
e3539e4
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
9a17f8d
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
a48f4a8
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
1bdd56f
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
ccda21b
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
a43e0a6
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
3231372
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
c4e2edd
flatten maven plugin only when release
ComputerDaddyGuy Nov 8, 2025
c6c9490
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
fa85310
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
e7c5730
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
4df1aab
Re-adapt sonar test exclusions
ComputerDaddyGuy Nov 8, 2025
102e7a6
Rework unit tests
ComputerDaddyGuy Nov 10, 2025
8642174
Fix Sonar issue
ComputerDaddyGuy Nov 10, 2025
50fbd32
Fix Sonar issue
ComputerDaddyGuy Nov 10, 2025
29a7d33
Sonar config
ComputerDaddyGuy Nov 10, 2025
5706858
Fix Sonar issue
ComputerDaddyGuy Nov 10, 2025
b1a6c48
Docs
ComputerDaddyGuy Nov 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
141 changes: 141 additions & 0 deletions .github/workflows/create-github-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Create Github release

on:
push:
tags:
- "v*.*.*" # triggers on tags like vX.Y.Z

jobs:

run-only-on-main-branch:
name: Verify main branch
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check if tag is on main
run: |
git fetch origin main
if git merge-base --is-ancestor $GITHUB_SHA origin/main; then
echo "Tag is on main"
else
echo "Tag is NOT on main, skipping"
#exit 1
fi

build-native:
Comment on lines 11 to 28

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 4 months ago

The fix is to explicitly add a permissions block for the run-only-on-main-branch job, constraining it to the minimum required privilege. Since this job only checks the ancestry of a tag (via git), it does not require write access—just read access to the repository contents. Therefore, you should add permissions: contents: read to the run-only-on-main-branch job (under jobs: run-only-on-main-branch: and above steps:). No other changes are required. Repeat this pattern for any other similar jobs lacking permission specification, but in this snippet, only the flagged job needs to be changed.


Suggested changeset 1
.github/workflows/create-github-release.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/create-github-release.yaml b/.github/workflows/create-github-release.yaml
--- a/.github/workflows/create-github-release.yaml
+++ b/.github/workflows/create-github-release.yaml
@@ -10,6 +10,8 @@
   run-only-on-main-branch:
     name: Verify main branch
     runs-on: ubuntu-latest
+    permissions:
+      contents: read
 
     steps:
       - name: Checkout repository
EOF
@@ -10,6 +10,8 @@
run-only-on-main-branch:
name: Verify main branch
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
Copilot is powered by AI and may make mistakes. Always verify output.
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: run-only-on-main-branch
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up GraalVM
uses: graalvm/setup-graalvm@eec48106e0bf45f2976c2ff0c3e22395cced8243
with:
java-version: "21"
distribution: "graalvm"

- name: Build native image
run: mvn -B clean package -Pnative

- name: Locate built executable
id: find_exe
shell: bash
run: |
mkdir dist

OS_NAME=${{ matrix.os }}
if [[ "$OS_NAME" == "windows-latest" ]]; then
BIN_PATH=$(find jfiletreeprettyprinter-cli/target -type f -name "jfiletreeprettyprinter.exe")
else
BIN_PATH=$(find jfiletreeprettyprinter-cli/target -type f -name "jfiletreeprettyprinter")
fi

echo "Found binary: $BIN_PATH"
cp "$BIN_PATH" dist/
echo "bin_path=$BIN_PATH" >> $GITHUB_OUTPUT

- name: Zip executable
id: zip_exe
shell: bash
run: |
VERSION=${GITHUB_REF_NAME}
OS_NAME=${{ matrix.os }}
case "$OS_NAME" in
ubuntu-latest) SAFE_OS_NAME="linux" ;;
windows-latest) SAFE_OS_NAME="windows" ;;
macos-latest) SAFE_OS_NAME="macos" ;;
*) SAFE_OS_NAME="$OS_NAME" ;;
esac
ZIP_NAME="jfiletreeprettyprinter-${VERSION}-${SAFE_OS_NAME}.zip"
echo "Zip to create: $ZIP_NAME"

cd dist
if [[ "$SAFE_OS_NAME" == "windows" ]]; then
powershell Compress-Archive -Path * -DestinationPath "$ZIP_NAME"
else
tar -a -c -f "$ZIP_NAME" *
fi
echo "zip_path=dist/$ZIP_NAME" >> $GITHUB_OUTPUT
cd ..

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: release-zips-${{ matrix.os }}
path: ${{ steps.zip_exe.outputs.zip_path }}

release:
Comment on lines 29 to 96

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 4 months ago

The best and most secure way to resolve this problem is to add a permissions: block to the build-native job in the workflow YAML file at .github/workflows/create-github-release.yaml. Since the build-native job only performs code checkout, builds code, and uploads artifacts (but does not push code, manage releases, or require administrative privileges), the minimal contents: read permission is appropriate here. This limits the token permissions and aligns with GitHub's least privilege recommendations. No functional change or additional methods/imports are required—simply add:

permissions:
  contents: read

under the build-native: job, at the same indentation level as name: ..., runs-on: ..., and strategy:.

Suggested changeset 1
.github/workflows/create-github-release.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/create-github-release.yaml b/.github/workflows/create-github-release.yaml
--- a/.github/workflows/create-github-release.yaml
+++ b/.github/workflows/create-github-release.yaml
@@ -29,6 +29,8 @@
     name: Build on ${{ matrix.os }}
     runs-on: ${{ matrix.os }}
     needs: run-only-on-main-branch
+    permissions:
+      contents: read
     strategy:
       matrix:
         os: [windows-latest, ubuntu-latest, macos-latest]
EOF
@@ -29,6 +29,8 @@
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: run-only-on-main-branch
permissions:
contents: read
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
Copilot is powered by AI and may make mistakes. Always verify output.
name: Create GitHub Release
runs-on: ubuntu-latest
needs: build-native
permissions:
contents: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Download build artifacts
uses: actions/download-artifact@v4
with:
path: release_zips

- name: Extract changelog for current version
id: changelog
shell: bash
run: |
TAG="${GITHUB_REF_NAME#v}" # Remove leading "v" (e.g. vX.Y.Z → X.Y.Z)
echo "Extracting changelog for version $TAG"

# Extract section for this version up to the next version header
awk "/## \\[$TAG\\]/,/^---/" CHANGELOG.md > release_notes.tmp

# Clean up formatting (remove trailing ---)
sed -i '/^---/d' release_notes.tmp

# Verify
echo "==== Extracted release notes ===="
cat release_notes.tmp
echo "================================"

echo "body_path=release_notes.tmp" >> $GITHUB_OUTPUT

- name: Create GitHub Release
uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090
with:
name: "JFileTreePrettyPrinter ${{ github.ref_name }}"
body_path: ${{ steps.changelog.outputs.body_path }}
files: release_zips/**/*.zip
draft: true
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

- name: Update pom.xml to release version
run: |
mvn versions:set -DnewVersion=${{ env.RELEASE_VERSION }} -B -q
mvn versions:set-property -Dproperty=revision -DnewVersion=${{ env.RELEASE_VERSION }} -B -q
git commit -am "Set version to ${{ env.RELEASE_VERSION }}" || echo "No changes"
git push origin HEAD:main
env:
Expand All @@ -60,7 +60,7 @@ jobs:
run: mvn clean verify -B

- name: Publish RELEASE to Maven Central
run: mvn deploy -P release -B -DskipTests
run: mvn deploy -pl jfiletreeprettyprinter-core -P release -B -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
Expand All @@ -73,6 +73,6 @@ jobs:
NEXT_PATCH=$((PATCH+1))
NEXT_VERSION="$MAJOR.$MINOR.$NEXT_PATCH-SNAPSHOT"
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
mvn versions:set -DnewVersion=$NEXT_VERSION -B -q
mvn versions:set-property -Dproperty=revision -DnewVersion=$NEXT_VERSION -B -q
git commit -am "Set version to $NEXT_VERSION" || echo "No changes"
git push origin HEAD:main
2 changes: 1 addition & 1 deletion .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Publish SNAPSHOT to Maven Central
run: |
mvn -P release --batch-mode deploy -am -DskipTests
mvn -pl jfiletreeprettyprinter-core -P release --batch-mode deploy -am -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,6 @@ jobs:
- name: Build and analyze
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.host.url="https://sonarcloud.io" -Dsonar.organization=computerdaddyguy -Dsonar.projectKey=ComputerDaddyGuy_JFileTreePrettyPrinter
run: |
mvn clean install
mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,5 @@ target/failsafe-reports/
.github/workflows/cache/

# Specific
!/src/example/resources/emojis/**
.flattened-pom.xml
!**/src/*/resources/emojis/**
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

---
## [0.2.0] - 2025-11-12 - Native executable

> [!IMPORTANT]
> Maven artifactId of Java lib changed from `jfiletreeprettyprinter` to `jfiletreeprettyprinter-core`

### Added
- Run JFileTreePrettyPrinter in command line, using native executable on Windows, Linux, MacOS (see Github release attachments):
`$ jfiletreeprettyprinter myFolder`
- Scanning and rendering options in external file:
`$ jfiletreeprettyprinter myFolder --options myOptions.json`

### Changed
- Split code into 3 sub-modules: cli, core and examples

---
## [0.1.1] - 2025-11-08 - Native executable (POC)

> [!CAUTION]
> Do not use this version (was for proof of concept only).

---
## [0.1.0] - 2025-10-13 - First beta release

Expand Down
Loading
Loading