Skip to content

(feat) Add test-specific policy overrides and multi-directory support#65

Merged
nknize merged 1 commit intomainfrom
feature/policyOverrides
Jan 28, 2026
Merged

(feat) Add test-specific policy overrides and multi-directory support#65
nknize merged 1 commit intomainfrom
feature/policyOverrides

Conversation

@nknize
Copy link
Contributor

@nknize nknize commented Jan 28, 2026

Description

Agent changes:

  • AgentConfig now supports multiple override directories via comma-separated -Djguard.policy.override=dir1,dir2 (later directories take precedence)
  • PolicyReloader watches all override directories for hot reload
  • PolicyDiscovery scans directories on classpath, not just JARs

Gradle plugin changes:

  • Add compileTestPolicies task for src/test/jguard/*.jguard files
  • Test tasks automatically pass both external and test policy directories
  • Default testPoliciesSourceDir: src/test/jguard
  • Default testPoliciesOutputDir: build/test-policies

This enables clean separation of concerns:

  • src/main/java/module-info.jguard → Production policy (minimal)
  • src/test/jguard/*.jguard → Module-specific test extensions
  • buildSrc external policies → Third-party libraries

Agent changes:
- AgentConfig now supports multiple override directories via comma-separated
  -Djguard.policy.override=dir1,dir2 (later directories take precedence)
- PolicyReloader watches all override directories for hot reload
- PolicyDiscovery scans directories on classpath, not just JARs

Gradle plugin changes:
- Add compileTestPolicies task for src/test/jguard/*.jguard files
- Test tasks automatically pass both external and test policy directories
- Default testPoliciesSourceDir: src/test/jguard
- Default testPoliciesOutputDir: build/test-policies

This enables clean separation of concerns:
- src/main/java/module-info.jguard → Production policy (minimal)
- src/test/jguard/*.jguard → Module-specific test extensions
- buildSrc external policies → Third-party libraries

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
@nknize nknize merged commit f9a00e7 into main Jan 28, 2026
8 checks passed
@nknize nknize deleted the feature/policyOverrides branch January 28, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant