Archived
Compare commits
12
Commits
v0.1.0
..
v0.1.2-rc3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27648a03a8 | ||
|
|
ccabf9d4c1 | ||
|
|
7b45fce813 | ||
|
|
461ebe44ab | ||
|
|
116f1fbb59 | ||
|
|
53f0991f6f | ||
|
|
05fb4c412b | ||
|
|
d6a27aab3b | ||
|
|
13655f5a54 | ||
|
|
165e363084 | ||
|
|
167292165a | ||
|
|
436d8ee840 |
No files matched your search
@@ -7,7 +7,7 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -19,82 +19,5 @@ jobs:
|
|||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
cache: 'maven'
|
cache: 'maven'
|
||||||
|
|
||||||
- name: Run tests
|
- name: Build and test
|
||||||
run: mvn verify -Dspotbugs.skip=true -Dpmd.skip=true
|
run: mvn verify -Dspotbugs.skip=true -Dpmd.skip=true
|
||||||
|
|
||||||
- name: Upload test results
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: test-results
|
|
||||||
path: target/surefire-reports/
|
|
||||||
|
|
||||||
build-jar:
|
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up JDK 21
|
|
||||||
uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
java-version: '21'
|
|
||||||
distribution: 'temurin'
|
|
||||||
cache: 'maven'
|
|
||||||
|
|
||||||
- name: Build JAR
|
|
||||||
run: mvn package -DskipTests -Dspotbugs.skip=true -Dpmd.skip=true
|
|
||||||
|
|
||||||
- name: Upload JAR
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: barn-jar
|
|
||||||
path: target/barn-*.jar
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
build-native:
|
|
||||||
needs: test
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- os: ubuntu-latest
|
|
||||||
artifact: barn-linux-x64
|
|
||||||
- os: ubuntu-24.04-arm
|
|
||||||
artifact: barn-linux-arm64
|
|
||||||
- os: macos-latest
|
|
||||||
artifact: barn-macos-arm64
|
|
||||||
- os: windows-latest
|
|
||||||
artifact: barn-windows-x64
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up GraalVM
|
|
||||||
uses: graalvm/setup-graalvm@v1
|
|
||||||
with:
|
|
||||||
java-version: '21'
|
|
||||||
distribution: 'graalvm'
|
|
||||||
cache: 'maven'
|
|
||||||
|
|
||||||
- name: Build native image (Unix)
|
|
||||||
if: runner.os != 'Windows'
|
|
||||||
run: |
|
|
||||||
mvn package -Pnative -DskipTests -Dspotbugs.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true
|
|
||||||
mv target/barn target/${{ matrix.artifact }}
|
|
||||||
|
|
||||||
- name: Build native image (Windows)
|
|
||||||
if: runner.os == 'Windows'
|
|
||||||
shell: pwsh
|
|
||||||
run: |
|
|
||||||
mvn package -Pnative -DskipTests "-Dspotbugs.skip=true" "-Dpmd.skip=true" "-Dcheckstyle.skip=true"
|
|
||||||
Move-Item -Path "target\barn.exe" -Destination "target\${{ matrix.artifact }}.exe" -Force
|
|
||||||
Get-ChildItem target\*.exe
|
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.artifact }}
|
|
||||||
path: target/${{ matrix.artifact }}*
|
|
||||||
retention-days: 7
|
|
||||||
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/).
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
||||||
|
|
||||||
|
## [0.1.2] - 2026-01-21
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- IPC communication fails in native binary due to missing Jackson reflection config
|
||||||
|
|
||||||
|
## [0.1.1] - 2026-01-21
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Native binary crashes on startup due to missing picocli reflection config
|
||||||
|
|
||||||
## [0.1.0] - 2026-01-21
|
## [0.1.0] - 2026-01-21
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
@@ -22,4 +32,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|||||||
- Jobs that fail to start now properly transition to FAILED state
|
- Jobs that fail to start now properly transition to FAILED state
|
||||||
- Startup errors are written to stderr.log for visibility
|
- Startup errors are written to stderr.log for visibility
|
||||||
|
|
||||||
|
[0.1.2]: https://github.com/samson-media/barn/releases/tag/v0.1.2
|
||||||
|
[0.1.1]: https://github.com/samson-media/barn/releases/tag/v0.1.1
|
||||||
[0.1.0]: https://github.com/samson-media/barn/releases/tag/v0.1.0
|
[0.1.0]: https://github.com/samson-media/barn/releases/tag/v0.1.0
|
||||||
@@ -610,6 +610,174 @@ mvn compile spotbugs:gui
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Pre-Release Testing Checklist (MANDATORY)
|
||||||
|
|
||||||
|
Before creating ANY release tag, you MUST test ALL subcommands with the native binary locally.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
1. **Build the native image locally:**
|
||||||
|
```bash
|
||||||
|
export JAVA_HOME="/Library/Java/JavaVirtualMachines/graalvm-25.jdk/Contents/Home"
|
||||||
|
mvn package -Pnative -DskipTests -Dspotbugs.skip=true -Dpmd.skip=true -Dcheckstyle.skip=true -Djacoco.skip=true
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Verify the binary exists:**
|
||||||
|
```bash
|
||||||
|
ls -la target/barn
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test Every Subcommand
|
||||||
|
|
||||||
|
Run each command and verify the expected output. **Do NOT skip any command.**
|
||||||
|
|
||||||
|
#### Basic Commands
|
||||||
|
```bash
|
||||||
|
# Should show usage/help
|
||||||
|
./target/barn
|
||||||
|
# Expected: Shows "Usage: barn [-hV] [COMMAND]" and lists all subcommands
|
||||||
|
|
||||||
|
./target/barn --help
|
||||||
|
# Expected: Same as above
|
||||||
|
|
||||||
|
./target/barn --version
|
||||||
|
# Expected: Shows "barn X.Y.Z"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Service Commands (Start service first)
|
||||||
|
```bash
|
||||||
|
# Stop any existing service
|
||||||
|
./target/barn service stop 2>/dev/null || true
|
||||||
|
|
||||||
|
# Start the service
|
||||||
|
./target/barn service start
|
||||||
|
# Expected: "Barn service started (PID: XXXXX)"
|
||||||
|
|
||||||
|
# Check service status
|
||||||
|
./target/barn service status
|
||||||
|
# Expected: Shows "Status: running", PID, uptime, job counts
|
||||||
|
|
||||||
|
# Test reload (reloads config without restart)
|
||||||
|
./target/barn service reload
|
||||||
|
# Expected: "Configuration reloaded"
|
||||||
|
|
||||||
|
# View logs
|
||||||
|
./target/barn service logs
|
||||||
|
# Expected: Shows recent log entries or "No logs found"
|
||||||
|
|
||||||
|
# Restart the service
|
||||||
|
./target/barn service restart
|
||||||
|
# Expected: "Barn service restarted"
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Job Commands (Service must be running)
|
||||||
|
```bash
|
||||||
|
# Run a test job
|
||||||
|
./target/barn run -- echo "test from native binary"
|
||||||
|
# Expected: "Job created: job-XXXXXXXX" with state: queued
|
||||||
|
|
||||||
|
# Wait a moment, then check status
|
||||||
|
sleep 2
|
||||||
|
./target/barn status
|
||||||
|
# Expected: Shows table with jobs, including the new job as "succeeded"
|
||||||
|
|
||||||
|
# Get the job ID from status output, then describe it
|
||||||
|
./target/barn describe <job-id>
|
||||||
|
# Expected: Shows detailed job info including timestamps, exit code, files
|
||||||
|
|
||||||
|
# Check resource usage
|
||||||
|
./target/barn usage <job-id>
|
||||||
|
# Expected: Shows CPU/memory/disk usage samples
|
||||||
|
|
||||||
|
# Test kill on a non-running job (should fail gracefully)
|
||||||
|
./target/barn kill <job-id>
|
||||||
|
# Expected: "Error: Job is not running: SUCCEEDED"
|
||||||
|
|
||||||
|
# Clean with dry-run
|
||||||
|
./target/barn clean --dry-run
|
||||||
|
# Expected: "Would clean X jobs:" followed by list
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Config Commands
|
||||||
|
```bash
|
||||||
|
./target/barn config show
|
||||||
|
# Expected: Shows configuration with all sections (service, jobs, cleanup, storage)
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Autocompletion Commands
|
||||||
|
```bash
|
||||||
|
./target/barn autocompletion --bash | head -5
|
||||||
|
# Expected: Shows bash completion script starting with "#!/usr/bin/env bash"
|
||||||
|
|
||||||
|
./target/barn autocompletion --zsh | head -5
|
||||||
|
# Expected: Shows zsh completion script
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Service Stop (Clean up)
|
||||||
|
```bash
|
||||||
|
./target/barn service stop
|
||||||
|
# Expected: "Barn service stopped"
|
||||||
|
|
||||||
|
./target/barn service status
|
||||||
|
# Expected: "Barn service is not running"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Checklist Summary
|
||||||
|
|
||||||
|
Copy this checklist and verify each item:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
## Pre-Release Testing for vX.Y.Z
|
||||||
|
|
||||||
|
### Build
|
||||||
|
- [ ] Native image builds successfully
|
||||||
|
- [ ] Binary exists at target/barn
|
||||||
|
|
||||||
|
### Basic Commands
|
||||||
|
- [ ] `barn` shows help
|
||||||
|
- [ ] `barn --help` shows help
|
||||||
|
- [ ] `barn --version` shows correct version
|
||||||
|
|
||||||
|
### Service Commands
|
||||||
|
- [ ] `barn service start` starts the service
|
||||||
|
- [ ] `barn service status` shows running status
|
||||||
|
- [ ] `barn service reload` reloads config
|
||||||
|
- [ ] `barn service logs` shows logs
|
||||||
|
- [ ] `barn service restart` restarts cleanly
|
||||||
|
- [ ] `barn service stop` stops the service
|
||||||
|
|
||||||
|
### Job Commands (with service running)
|
||||||
|
- [ ] `barn run -- echo test` creates a job
|
||||||
|
- [ ] `barn status` shows job list
|
||||||
|
- [ ] `barn describe <id>` shows job details
|
||||||
|
- [ ] `barn usage <id>` shows resource usage
|
||||||
|
- [ ] `barn kill <id>` handles non-running job gracefully
|
||||||
|
- [ ] `barn clean --dry-run` shows what would be cleaned
|
||||||
|
|
||||||
|
### Config Commands
|
||||||
|
- [ ] `barn config show` displays configuration
|
||||||
|
|
||||||
|
### Autocompletion
|
||||||
|
- [ ] `barn autocompletion --bash` generates bash script
|
||||||
|
- [ ] `barn autocompletion --zsh` generates zsh script
|
||||||
|
|
||||||
|
### Final
|
||||||
|
- [ ] All commands return expected output
|
||||||
|
- [ ] No crashes or exceptions
|
||||||
|
- [ ] Service starts and stops cleanly
|
||||||
|
```
|
||||||
|
|
||||||
|
### Only After All Tests Pass
|
||||||
|
|
||||||
|
1. Commit any fixes
|
||||||
|
2. Push to main
|
||||||
|
3. Wait for CI to pass
|
||||||
|
4. Create the release tag: `git tag vX.Y.Z && git push origin vX.Y.Z`
|
||||||
|
|
||||||
|
**NEVER create a release tag without completing this checklist.**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Questions to Ask Before Implementing
|
## Questions to Ask Before Implementing
|
||||||
|
|
||||||
1. Have I read the relevant documentation?
|
1. Have I read the relevant documentation?
|
||||||
|
|||||||
@@ -40,6 +40,63 @@ This project treats FFmpeg jobs as **first-class managed units of work**, not sh
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### macOS
|
||||||
|
|
||||||
|
**Homebrew (recommended):**
|
||||||
|
```bash
|
||||||
|
brew install samson-media/tap/barn
|
||||||
|
```
|
||||||
|
|
||||||
|
**Manual download:**
|
||||||
|
```bash
|
||||||
|
curl -L -o barn https://github.com/samson-media/barn/releases/latest/download/barn-macos-arm64
|
||||||
|
chmod +x barn
|
||||||
|
sudo mv barn /usr/local/bin/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Linux
|
||||||
|
|
||||||
|
**Download the binary:**
|
||||||
|
```bash
|
||||||
|
# For x64
|
||||||
|
curl -L -o barn https://github.com/samson-media/barn/releases/latest/download/barn-linux-x64
|
||||||
|
|
||||||
|
# For ARM64
|
||||||
|
curl -L -o barn https://github.com/samson-media/barn/releases/latest/download/barn-linux-arm64
|
||||||
|
|
||||||
|
chmod +x barn
|
||||||
|
sudo mv barn /usr/local/bin/
|
||||||
|
```
|
||||||
|
|
||||||
|
### Windows
|
||||||
|
|
||||||
|
**PowerShell (recommended):**
|
||||||
|
```powershell
|
||||||
|
# Create install directory
|
||||||
|
New-Item -ItemType Directory -Force -Path "$env:LOCALAPPDATA\Programs\barn"
|
||||||
|
|
||||||
|
# Download
|
||||||
|
Invoke-WebRequest -Uri "https://github.com/samson-media/barn/releases/latest/download/barn-windows-x64.exe" -OutFile "$env:LOCALAPPDATA\Programs\barn\barn.exe"
|
||||||
|
|
||||||
|
# Add to PATH (current user)
|
||||||
|
$path = [Environment]::GetEnvironmentVariable("Path", "User")
|
||||||
|
if ($path -notlike "*$env:LOCALAPPDATA\Programs\barn*") {
|
||||||
|
[Environment]::SetEnvironmentVariable("Path", "$path;$env:LOCALAPPDATA\Programs\barn", "User")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Restart your terminal after installation.
|
||||||
|
|
||||||
|
### Verify Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
barn --version
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Barn command
|
## Barn command
|
||||||
|
|
||||||
This project creates a simple CLI commandlet with sub-comands.
|
This project creates a simple CLI commandlet with sub-comands.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.samsonmedia</groupId>
|
<groupId>com.samsonmedia</groupId>
|
||||||
<artifactId>barn</artifactId>
|
<artifactId>barn</artifactId>
|
||||||
<version>0.1.0</version>
|
<version>0.1.2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>Barn</name>
|
<name>Barn</name>
|
||||||
@@ -135,6 +135,16 @@
|
|||||||
<arg>-Xlint:-processing</arg>
|
<arg>-Xlint:-processing</arg>
|
||||||
<arg>-Werror</arg>
|
<arg>-Werror</arg>
|
||||||
</compilerArgs>
|
</compilerArgs>
|
||||||
|
<annotationProcessorPaths>
|
||||||
|
<path>
|
||||||
|
<groupId>info.picocli</groupId>
|
||||||
|
<artifactId>picocli-codegen</artifactId>
|
||||||
|
<version>${picocli.version}</version>
|
||||||
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
|
<compilerArgs combine.children="append">
|
||||||
|
<arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
|
||||||
|
</compilerArgs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
@@ -383,6 +393,7 @@
|
|||||||
<buildArg>--no-fallback</buildArg>
|
<buildArg>--no-fallback</buildArg>
|
||||||
<buildArg>-H:+ReportExceptionStackTraces</buildArg>
|
<buildArg>-H:+ReportExceptionStackTraces</buildArg>
|
||||||
<buildArg>--enable-url-protocols=https</buildArg>
|
<buildArg>--enable-url-protocols=https</buildArg>
|
||||||
|
<buildArg>-march=compatibility</buildArg>
|
||||||
</buildArgs>
|
</buildArgs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import picocli.CommandLine.Spec;
|
|||||||
@Command(
|
@Command(
|
||||||
name = "barn",
|
name = "barn",
|
||||||
mixinStandardHelpOptions = true,
|
mixinStandardHelpOptions = true,
|
||||||
version = "barn 0.1.0-SNAPSHOT",
|
version = "barn 0.1.2",
|
||||||
description = "Cross-platform job daemon for media processing",
|
description = "Cross-platform job daemon for media processing",
|
||||||
subcommands = {
|
subcommands = {
|
||||||
RunCommand.class,
|
RunCommand.class,
|
||||||
|
|||||||
@@ -113,16 +113,7 @@ public class ServiceRestartCommand extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int startService(Path effectiveBarnDir) throws IOException {
|
private int startService(Path effectiveBarnDir) throws IOException {
|
||||||
String javaHome = System.getProperty("java.home");
|
ProcessBuilder pb = buildDaemonCommand(effectiveBarnDir);
|
||||||
String classPath = System.getProperty("java.class.path");
|
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder(
|
|
||||||
Path.of(javaHome, "bin", "java").toString(),
|
|
||||||
"-cp", classPath,
|
|
||||||
"com.samsonmedia.barn.Main",
|
|
||||||
"service", "start", "--foreground",
|
|
||||||
"--barn-dir", effectiveBarnDir.toString()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (globalOptions != null && globalOptions.getConfigPath().isPresent()) {
|
if (globalOptions != null && globalOptions.getConfigPath().isPresent()) {
|
||||||
pb.command().add("--config");
|
pb.command().add("--config");
|
||||||
@@ -162,4 +153,33 @@ public class ServiceRestartCommand extends BaseCommand {
|
|||||||
}
|
}
|
||||||
return ConfigDefaults.getDefaultBaseDir();
|
return ConfigDefaults.getDefaultBaseDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ProcessBuilder buildDaemonCommand(Path effectiveBarnDir) {
|
||||||
|
// Check if running as a native image
|
||||||
|
if (isNativeImage()) {
|
||||||
|
// In native image, re-exec the current executable
|
||||||
|
String executable = ProcessHandle.current().info().command().orElse("barn");
|
||||||
|
return new ProcessBuilder(
|
||||||
|
executable,
|
||||||
|
"service", "start", "--foreground",
|
||||||
|
"--barn-dir", effectiveBarnDir.toString()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Running in JVM, use java command
|
||||||
|
String javaHome = System.getProperty("java.home");
|
||||||
|
String classPath = System.getProperty("java.class.path");
|
||||||
|
return new ProcessBuilder(
|
||||||
|
Path.of(javaHome, "bin", "java").toString(),
|
||||||
|
"-cp", classPath,
|
||||||
|
"com.samsonmedia.barn.Main",
|
||||||
|
"service", "start", "--foreground",
|
||||||
|
"--barn-dir", effectiveBarnDir.toString()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isNativeImage() {
|
||||||
|
// GraalVM sets this property when running as native image
|
||||||
|
return System.getProperty("org.graalvm.nativeimage.imagecode") != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -99,18 +99,9 @@ public class ServiceStartCommand extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int startDaemon(Path effectiveBarnDir) throws IOException {
|
private int startDaemon(Path effectiveBarnDir) throws IOException {
|
||||||
// For daemonizing, we re-exec with --foreground and nohup
|
// For daemonizing, we re-exec with --foreground
|
||||||
// This is a simplified approach; production would use proper daemon techniques
|
// This is a simplified approach; production would use proper daemon techniques
|
||||||
String javaHome = System.getProperty("java.home");
|
ProcessBuilder pb = buildDaemonCommand(effectiveBarnDir);
|
||||||
String classPath = System.getProperty("java.class.path");
|
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder(
|
|
||||||
Path.of(javaHome, "bin", "java").toString(),
|
|
||||||
"-cp", classPath,
|
|
||||||
"com.samsonmedia.barn.Main",
|
|
||||||
"service", "start", "--foreground",
|
|
||||||
"--barn-dir", effectiveBarnDir.toString()
|
|
||||||
);
|
|
||||||
|
|
||||||
if (globalOptions != null && globalOptions.getConfigPath().isPresent()) {
|
if (globalOptions != null && globalOptions.getConfigPath().isPresent()) {
|
||||||
pb.command().add("--config");
|
pb.command().add("--config");
|
||||||
@@ -186,4 +177,33 @@ public class ServiceStartCommand extends BaseCommand {
|
|||||||
}
|
}
|
||||||
return ConfigDefaults.getDefaultBaseDir();
|
return ConfigDefaults.getDefaultBaseDir();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ProcessBuilder buildDaemonCommand(Path effectiveBarnDir) {
|
||||||
|
// Check if running as a native image
|
||||||
|
if (isNativeImage()) {
|
||||||
|
// In native image, re-exec the current executable
|
||||||
|
String executable = ProcessHandle.current().info().command().orElse("barn");
|
||||||
|
return new ProcessBuilder(
|
||||||
|
executable,
|
||||||
|
"service", "start", "--foreground",
|
||||||
|
"--barn-dir", effectiveBarnDir.toString()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Running in JVM, use java command
|
||||||
|
String javaHome = System.getProperty("java.home");
|
||||||
|
String classPath = System.getProperty("java.class.path");
|
||||||
|
return new ProcessBuilder(
|
||||||
|
Path.of(javaHome, "bin", "java").toString(),
|
||||||
|
"-cp", classPath,
|
||||||
|
"com.samsonmedia.barn.Main",
|
||||||
|
"service", "start", "--foreground",
|
||||||
|
"--barn-dir", effectiveBarnDir.toString()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isNativeImage() {
|
||||||
|
// GraalVM sets this property when running as native image
|
||||||
|
return System.getProperty("org.graalvm.nativeimage.imagecode") != null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -28,11 +28,13 @@ public final class ConfigDefaults {
|
|||||||
/**
|
/**
|
||||||
* Gets the default IPC socket path.
|
* Gets the default IPC socket path.
|
||||||
*
|
*
|
||||||
|
* <p>Windows 10 version 1803+ supports Unix domain sockets with file paths.
|
||||||
|
*
|
||||||
* @return the default IPC socket path
|
* @return the default IPC socket path
|
||||||
*/
|
*/
|
||||||
public static Path getDefaultIpcSocket() {
|
public static Path getDefaultIpcSocket() {
|
||||||
return switch (OperatingSystem.current()) {
|
return switch (OperatingSystem.current()) {
|
||||||
case WINDOWS -> Path.of("\\\\.\\pipe\\barn");
|
case WINDOWS -> Path.of(System.getenv("TEMP"), "barn", "barn.sock");
|
||||||
case LINUX, MACOS -> Path.of("/tmp/barn/barn.sock");
|
case LINUX, MACOS -> Path.of("/tmp/barn/barn.sock");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,187 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcMessage",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcRequest$RunJob",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcRequest$GetStatus",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcRequest$GetJob",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcRequest$KillJob",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcRequest$CleanJobs",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcRequest$GetServiceStatus",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcRequest$Shutdown",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcRequest$Reload",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcResponse$Ok",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.ipc.IpcResponse$Error",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.jobs.Job",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.jobs.JobManifest",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.state.JobState",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.execution.ResourceUsage",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.config.Config",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.config.ServiceConfig",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.config.StorageConfig",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.config.JobsConfig",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "com.samsonmedia.barn.config.CleanupConfig",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true,
|
||||||
|
"allDeclaredMethods": true,
|
||||||
|
"allPublicMethods": true,
|
||||||
|
"allDeclaredFields": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "java.util.LinkedHashMap",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "java.util.HashMap",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "java.util.ArrayList",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "java.util.ImmutableCollections$ListN",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "java.util.ImmutableCollections$List12",
|
||||||
|
"allDeclaredConstructors": true,
|
||||||
|
"allPublicConstructors": true
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -86,6 +86,6 @@ class MainTest {
|
|||||||
// Assert
|
// Assert
|
||||||
String output = outContent.toString();
|
String output = outContent.toString();
|
||||||
assertThat(output).contains("barn");
|
assertThat(output).contains("barn");
|
||||||
assertThat(output).contains("0.1.0");
|
assertThat(output).containsPattern("\\d+\\.\\d+\\.\\d+");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ class BarnCommandTest {
|
|||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
String output = outWriter.toString();
|
String output = outWriter.toString();
|
||||||
assertThat(output).contains("0.1.0");
|
assertThat(output).containsPattern("\\d+\\.\\d+\\.\\d+");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in new issue
Block a user