Skip to content

Commit a3554df

Browse files
authored
Merge pull request #17 from coldbox-modules/development
Version bump
2 parents 544c2b2 + 3be8038 commit a3554df

File tree

13 files changed

+178
-44
lines changed

13 files changed

+178
-44
lines changed

.github/copilot-instructions.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Copilot Instructions for AI Coding Agents — cbjavaloader
2+
3+
## What this project is
4+
5+
- A ColdBox module that embeds and exposes the JavaLoader library so CFML apps can dynamically load/compile Java classes and JARs.
6+
- Key pieces: `ModuleConfig.cfc` (module settings & DSL registration), `models/Loader.cfc` (public module API), `models/javaloader/` (JavaLoader, JavaProxy, JavaCompiler implementations), and `test-harness/` (integration test app).
7+
8+
## Quick dev workflows (explicit)
9+
10+
- Install deps: run the CommandBox installer at repo root and for the test harness:
11+
```bash
12+
box install
13+
cd test-harness && box install
14+
```
15+
- Build module (packaging, docs):
16+
```bash
17+
box task run taskFile=build/Build.cfc :projectName=`package show slug` :version=`package show version`
18+
```
19+
- Run tests (TestBox via provided VS Code tasks or CLI):
20+
```bash
21+
box testbox run bundles=test-harness/tests --!recurse
22+
# or use the workspace VS Code task "Run TestBox Bundle"
23+
```
24+
25+
## Project-specific conventions & patterns
26+
27+
- WireBox DSL: `ModuleConfig.cfc` registers a custom DSL `javaloader` via `wireBox.registerDSL(...)`. Use inject="javaloader:ClassName" for DSL injections.
28+
- Main WireBox mappings: `binder.map("jl@cbjavaloader")` (internal JavaLoader) and `loader@cbjavaloader` (public module proxy, see `models/Loader.cfc`). Use `getWireBox().getInstance("loader@cbjavaloader")` in tests or handlers.
29+
- Persistent loader instance: `models/Loader.cfc` stores the JavaLoader instance in `server` scope under a hashed static key and uses `lock` for safe init/re-init — avoid re-instantiating directly; call `Loader.setup(moduleSettings)` or `Loader.getJavaLoader()`.
30+
- Java compilation: `models/javaloader/JavaCompiler.cfc` expects a JVM `tools.jar` compiler on the classpath; compiled jars are placed by default in `models/javaloader/tmp` (see module `settings.compileDirectory`).
31+
32+
## Important files to consult (fast path)
33+
34+
- `ModuleConfig.cfc` — module settings defaults and DSL registration.
35+
- `models/Loader.cfc` — public API that other apps use (`create`, `appendPath`, `getLoadedURLs`).
36+
- `models/javaloader/JavaLoader.cfc` — upstream JavaLoader implementation (large file, primary behavior).
37+
- `models/javaloader/JavaCompiler.cfc` — dynamic compilation logic and compiler discovery.
38+
- `build/Build.cfc` and `box.json` — packaging, test runner URL and build scripts used by CI.
39+
- `test-harness/` — runnable ColdBox app for integration tests; `test-harness/tests/specs/LoaderTest.cfc` shows expected behavior usage.
40+
41+
## Integration points & external dependencies
42+
43+
- JARs bundled under `models/javaloader/lib/` and `models/javaloader/support/*/lib/`; additional jars for testing live in `test-harness/jars/`.
44+
- The module relies on CommandBox and TestBox for build/test automation. CI uses `.github/workflows/*` (see repo root).
45+
46+
## Safety, edge cases, and constraints agents must respect
47+
48+
- Do not remove or replace the `server`-scoped loader without using the `Loader` API — other code/tests expect the single instance.
49+
- Java compilation may fail when the JVM compiler is not available; surface clear errors and point to `JavaCompiler.cfc` and `tools.jar` classpath as remediation.
50+
51+
## Examples (from repo)
52+
53+
- Injecting via DSL (see README & examples):
54+
```cfml
55+
property name="hello" inject="javaloader:HelloWorld";
56+
// or via WireBox mapping
57+
property name="javaloader" inject="loader@cbjavaloader";
58+
```
59+
- Module settings (place in your app `ColdBox.cfc` under `moduleSettings.cbJavaLoader`): see `ModuleConfig.cfc` for keys like `loadPaths`, `sourceDirectories`, `compileDirectory`, `trustedSource`.
60+
61+
## What to do next when editing code
62+
63+
- When changing public behavior in `Loader.cfc` or DSL registration in `ModuleConfig.cfc`, update `test-harness/tests/specs/LoaderTest.cfc` or add a spec demonstrating the change.
64+
- Run `box testbox ...` after edits and ensure `test-harness` runner URL in `box.json` matches `build/Build.cfc` test runner if you rely on build tasks.
65+
66+
Please review and tell me if you'd like added examples (e.g., a minimal handler that uses the loader), or if I should fold in more lines from the module-template instructions.

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
updates:
3+
# GitHub Actions - updates uses: statements in workflows
4+
- package-ecosystem: "github-actions"
5+
directory: "/" # Where your .github/workflows/ folder is
6+
schedule:
7+
interval: "monthly"
8+
9+
# Gradle - updates dependencies in build.gradle or build.gradle.kts
10+
- package-ecosystem: "gradle"
11+
directory: "/" # Adjust if build.gradle is in a subfolder
12+
schedule:
13+
interval: "monthly"
14+
15+
# NPM
16+
- package-ecosystem: "npm"
17+
directory: "/" # adjust if needed
18+
schedule:
19+
interval: "monthly"

.github/workflows/pr.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ on:
66
- "main"
77
- "master"
88
- "development"
9+
- "releases/v*"
910
pull_request:
1011
branches:
12+
- "releases/v*"
1113
- development
1214

1315
jobs:
@@ -18,11 +20,11 @@ jobs:
1820
# Format PR
1921
format_check:
2022
name: Checks Source Code Formatting
21-
runs-on: ubuntu-24.04
23+
runs-on: ubuntu-latest
2224
steps:
2325
- name: Checkout Repository
24-
uses: actions/checkout@v4
26+
uses: actions/checkout@v5
2527

26-
- uses: Ortus-Solutions/[email protected].2
28+
- uses: Ortus-Solutions/[email protected].3
2729
with:
2830
cmd: run-script format:check

.github/workflows/release.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ jobs:
3030
##########################################################################################
3131
build:
3232
name: Build & Publish
33-
runs-on: ubuntu-24.04
33+
runs-on: ubuntu-latest
3434
permissions:
3535
checks: write
3636
pull-requests: write
3737
contents: write
3838
issues: write
3939
steps:
4040
- name: Checkout Repository
41-
uses: actions/checkout@v4
41+
uses: actions/checkout@v5
4242

4343
- name: Setup CommandBox
4444
uses: Ortus-Solutions/[email protected]
4545
with:
4646
forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }}
4747

4848
- name: Setup Java
49-
uses: actions/setup-java@v4
49+
uses: actions/setup-java@v5
5050
with:
5151
distribution: "temurin"
5252
java-version: ${{ env.JDK }}
@@ -133,7 +133,7 @@ jobs:
133133
box forgebox publish --force
134134
135135
- name: Create Github Release
136-
uses: taiki-e/create-gh-release-action@v1.8.2
136+
uses: taiki-e/create-gh-release-action@v1.9.1
137137
continue-on-error: true
138138
if: env.SNAPSHOT == 'false'
139139
with:
@@ -160,7 +160,7 @@ jobs:
160160
prep_next_release:
161161
name: Prep Next Release
162162
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
163-
runs-on: ubuntu-24.04
163+
runs-on: ubuntu-latest
164164
needs: [ build ]
165165
permissions:
166166
checks: write
@@ -170,7 +170,7 @@ jobs:
170170
steps:
171171
# Checkout development
172172
- name: Checkout Repository
173-
uses: actions/checkout@v4
173+
uses: actions/checkout@v5
174174
with:
175175
ref: development
176176

@@ -180,7 +180,7 @@ jobs:
180180
forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }}
181181

182182
- name: Download build artifacts
183-
uses: actions/download-artifact@v4
183+
uses: actions/download-artifact@v5
184184
with:
185185
name: ${{ env.MODULE_ID }}
186186
path: .tmp

.github/workflows/snapshot.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ jobs:
2525
##########################################################################################
2626
format:
2727
name: Code Auto-Formatting
28-
runs-on: ubuntu-24.04
28+
runs-on: ubuntu-latest
2929
permissions:
3030
contents: write
3131
checks: write
3232
steps:
33-
- uses: actions/checkout@v4
33+
- uses: actions/checkout@v5
3434

3535
- name: Auto-format
36-
uses: Ortus-Solutions/[email protected].2
36+
uses: Ortus-Solutions/[email protected].3
3737
with:
3838
cmd: run-script format
3939

4040
- name: Commit Format Changes
41-
uses: stefanzweifel/git-auto-commit-action@v5
41+
uses: stefanzweifel/git-auto-commit-action@v6
4242
with:
4343
commit_message: Apply cfformat changes
4444

.github/workflows/tests.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ on:
1010
jobs:
1111
tests:
1212
name: Tests
13-
runs-on: ubuntu-24.04
13+
runs-on: ubuntu-latest
1414
env:
1515
DB_USER: root
1616
DB_PASSWORD: root
1717
continue-on-error: ${{ matrix.experimental }}
1818
strategy:
1919
fail-fast: false
2020
matrix:
21-
cfengine: [ "boxlang-cfml@1", "lucee@5", "lucee@6", "adobe@2021", "adobe@2023" ]
21+
cfengine: [ "boxlang-cfml@1", "lucee@5", "lucee@6", "adobe@2023", "adobe@2025" ]
2222
coldboxVersion: [ "^7.0.0" ]
2323
experimental: [ false ]
2424
# Experimental: ColdBox BE vs All Engines
@@ -30,17 +30,17 @@ jobs:
3030
cfengine: "lucee@6"
3131
experimental: true
3232
- coldboxVersion: "be"
33-
cfengine: "adobe@2021"
33+
cfengine: "adobe@2025"
3434
experimental: true
3535
- coldboxVersion: "be"
36-
cfengine: "adobe@2023"
36+
cfengine: "boxlang-cfml@1"
3737
experimental: true
3838
- coldboxVersion: "be"
39-
cfengine: "boxlang-cfml@1"
39+
cfengine: "boxlang@1"
4040
experimental: true
4141
steps:
4242
- name: Checkout Repository
43-
uses: actions/checkout@v4
43+
uses: actions/checkout@v5
4444

4545
# DATABASE SETUP: uncomment if you need to setup a database
4646
# - name: Setup Database and Fixtures
@@ -50,7 +50,7 @@ jobs:
5050
# mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < test-harness/tests/resources/coolblog.sql
5151

5252
- name: Setup Java
53-
uses: actions/setup-java@v4
53+
uses: actions/setup-java@v5
5454
with:
5555
distribution: "temurin"
5656
java-version: "21"

box.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name":"JavaLoader",
33
"author":"Ortus Solutions.com <[email protected]>",
4-
"version":"2.2.0",
4+
"version":"2.3.0",
55
"location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbjavaloader/@build.version@/[email protected]@.zip",
66
"slug":"cbjavaloader",
77
"type":"modules",
@@ -24,7 +24,7 @@
2424
],
2525
"dependencies":{},
2626
"devDependencies":{
27-
"commandbox-boxlang":"*",
27+
"commandbox-boxlang":"*",
2828
"commandbox-cfformat":"*",
2929
"commandbox-docbox":"*"
3030
},
@@ -40,15 +40,9 @@
4040
"build:module":"task run taskFile=build/Build.cfc :projectName=`package show slug` :version=`package show version`",
4141
"build:docs":"task run taskFile=build/Build.cfc target=docs :projectName=`package show slug` :version=`package show version`",
4242
"install:dependencies":"install && cd test-harness && install",
43-
"release":"recipe build/release.boxr",
43+
"release":"recipe build/release.boxr",
4444
"format":"cfformat run helpers,models,test-harness/tests/,ModuleConfig.cfc --overwrite",
4545
"format:watch":"cfformat watch helpers,models,test-harness/tests/,ModuleConfig.cfc ./.cfformat.json",
46-
"format:check":"cfformat check helpers,models,test-harness/tests/,ModuleConfig.cfc ./.cfformat.json",
47-
"start:lucee" : "server start [email protected]",
48-
"start:2021" : "server start [email protected]",
49-
"stop:lucee" : "server stop [email protected]",
50-
"stop:2021" : "server stop [email protected]",
51-
"logs:lucee" : "server log [email protected] --follow",
52-
"logs:2021" : "server log [email protected] --follow"
46+
"format:check":"cfformat check helpers,models,test-harness/tests/,ModuleConfig.cfc ./.cfformat.json"
5347
}
5448
}

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Added
1515

16+
- BoxLang compat to alleviate ACF hardcoding of Java proxies
17+
- BoxLang Prime testing
18+
- Adobe 2025 testing
19+
20+
## [2.2.0] - 2025-02-19
21+
22+
### Added
23+
1624
- Github actions updated
1725
- ColdBox 7 Auto testing
1826
- Syntax formatting

models/javaloader/JavaLoader.cfc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,15 @@
114114
<cfargument name="className" hint="The name of the class to create" type="string" required="Yes">
115115
<cfscript>
116116
try {
117-
// do this in one line just for speed.
118-
return createJavaProxy( getURLClassLoader().loadClass( arguments.className ) );
117+
if ( server.keyExists( "boxlang" ) ) {
118+
// Boxlang's Dynamic object class handles all of our needs - we just need to retrieve the class through the module classloader
119+
return createObject( "java", "ortus.boxlang.runtime.interop.DynamicObject" ).of(
120+
getURLClassLoader().loadClass( arguments.className )
121+
);
122+
} else {
123+
// do this in one line just for speed.
124+
return createJavaProxy( getURLClassLoader().loadClass( arguments.className ) );
125+
}
119126
} catch ( java.lang.ClassNotFoundException exc ) {
120127
throwException(
121128
"javaloader.ClassNotFoundException",
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name":"cbjavaloader-adobe@2021",
2+
"name":"cbjavaloader-adobe@2025",
33
"app":{
4-
"serverHomeDirectory":".engine/adobe2021",
5-
"cfengine":"adobe@2021"
4+
"serverHomeDirectory":".engine/adobe2025",
5+
"cfengine":"adobe@2025"
66
},
77
"web":{
88
"http":{
@@ -13,15 +13,17 @@
1313
},
1414
"webroot": "test-harness",
1515
"aliases":{
16-
"/moduleroot/cbjavaloader":"./"
16+
"/moduleroot/cbjavaloader":"../"
1717
}
1818
},
1919
"jvm":{
20-
"heapSize":"1024",
21-
"javaVersion":"openjdk11_jre"
20+
"heapSize":"1024"
2221
},
2322
"openBrowser":"false",
24-
"scripts" : {
23+
"cfconfig": {
24+
"file" : ".cfconfig.json"
25+
},
26+
"scripts" : {
2527
"onServerInstall":"cfpm install zip,debugger"
2628
}
2729
}

0 commit comments

Comments
 (0)