Skip to content

Commit a25b652

Browse files
committed
add flightRecordingSettings and PrintInlining
1 parent 65f6595 commit a25b652

File tree

2 files changed

+32
-71
lines changed

2 files changed

+32
-71
lines changed

README.md

Lines changed: 19 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ ant -Dwebroot="/path/to/your/project" -Dexecute="yourscript.cfm"
2727
ant -buildfile="/path/to/script-runner/build.xml" -Dwebroot="." -Dexecute="yourscript.cfm"
2828

2929
# From any directory with absolute paths
30-
ant -buildfile="C:\tools\script-runner\build.xml" -Dwebroot="C:\work\myproject" -Dexecute="test.cfm"
30+
ant -buildfile "C:\tools\script-runner\build.xml" -Dwebroot="C:\work\myproject" -Dexecute="test.cfm"
3131

3232
# execute a script below the webroot
33-
ant -buildfile="C:\tools\script-runner\build.xml" -Dwebroot="C:\work\myproject" -Dexecute="extended/index.cfm"
33+
ant -buildfile "C:\tools\script-runner\build.xml" -Dwebroot="C:\work\myproject" -Dexecute="extended/index.cfm"
3434
```
3535

3636
**Key Points:**
@@ -52,7 +52,7 @@ Default `ant` will run the `sample/index.cfm` file
5252

5353
- `-DluceeVersion=` - Lucee version (default: `6.2.2.91`). Examples: `6.2.2.91`, `light-6.2.2.91`, `zero-6.2.2.91`
5454
- `-DluceeVersionQuery=` - Query-based version (optional, overrides luceeVersion). Format: `(version)/(stable/rc/snapshot)/(jar/light/zero)`. Example: `5.4/stable/light`
55-
- `-DluceeJar=` - Path to custom Lucee JAR (optional, overrides both luceeVersion and luceeVersionQuery). Example: `/full-path/to/lucee.jar`
55+
- `-DluceeJar=` - Path to custom Lucee JAR (optional, overrides both luceeVersion and luceeVersionQuery). Example: `/full-path/to/lucee.jar`, but make sure you use the exact filename for the jar.
5656

5757
#### Paths and Execution
5858

@@ -145,7 +145,7 @@ The `jfr` command-line tool is included in the JDK bin directory. For visual ana
145145
| Shell | Example Command |
146146
|--------------- |------------------------------------------------------------------------------------------------------------------|
147147
| PowerShell | `ant -buildfile "C:\tools\script-runner\build.xml" -Dwebroot="C:\work\my project" -Dexecute="test.cfm" -DuniqueWorkingDir=true` |
148-
| Command Prompt | `ant -buildfile=C:\tools\script-runner\build.xml -Dwebroot=C:\work\myproject -Dexecute=test.cfm -DuniqueWorkingDir=true` |
148+
| Command Prompt | `ant -buildfile "C:\tools\script-runner\build.xml" -Dwebroot="C:\work\myproject" -Dexecute="test.cfm" -DuniqueWorkingDir=true` |
149149
| Bash/WSL | `ant -buildfile /mnt/d/work/script-runner/build.xml -Dwebroot=/mnt/d/work/myproject -Dexecute=test.cfm -DuniqueWorkingDir=true` |
150150

151151
**PowerShell:** Use double quotes for paths with spaces. Single quotes also work (especially in scripts to avoid variable expansion). Don’t mix and match.
@@ -161,73 +161,22 @@ The `jfr` command-line tool is included in the JDK bin directory. For visual ana
161161

162162
---
163163

164-
**Pro tip:** If you don’t know what you want, use `true` for CI or parallel runs, `false` for local dev.
165-
166-
167-
168-
**Command Prompt (Windows):**
169-
170-
Quotes are only needed if the path contains spaces. You can either quote just the value, or the entire parameter (both are valid). See the examples below:
171-
172-
- **No spaces in paths (no quotes needed):**
173-
174-
```cmd
175-
ant -buildfile=C:\tools\script-runner\build.xml -Dwebroot=C:\work\myproject -Dexecute=test.cfm -DuniqueWorkingDir=true
176-
```
177-
178-
- **Spaces in paths (quotes required):**
179-
180-
```cmd
181-
ant -buildfile="C:\tools\script-runner\build.xml" -Dwebroot="C:\work\my project" -Dexecute="test.cfm" -DuniqueWorkingDir=true
182-
183-
REM Or quote the entire parameter (especially useful in batch files):
184-
ant "-buildfile=C:\Program Files\script-runner\build.xml" "-Dwebroot=C:\My Projects\test" -Dexecute=test.cfm
185-
```
186-
187-
**Bash/WSL (Linux):**
188-
189-
- Use forward slashes and Linux-style paths.
190-
191-
Quotes are only needed if the path contains spaces. See the two examples below:
192-
193-
- **No spaces in paths (no quotes needed):**
194-
195-
```bash
196-
ant -buildfile /mnt/d/work/script-runner/build.xml -Dwebroot=/mnt/d/work/myproject -Dexecute=test.cfm -DuniqueWorkingDir=true
197-
```
198-
199-
- **Spaces in paths (quotes required):**
200-
201-
```bash
202-
ant -buildfile "/mnt/d/work/script-runner/build.xml" -Dwebroot="/mnt/d/work/my project" -Dexecute="test.cfm" -DuniqueWorkingDir=true
203-
```
204-
205-
**Quick Reference Table:**
206-
207-
| Shell | Example Command |
208-
|--------------- |------------------------------------------------------------------------------------------------------------------|
209-
| PowerShell | `ant -buildfile "C:\tools\script-runner\build.xml" -Dwebroot="C:\work\my project" -Dexecute="test.cfm" -DuniqueWorkingDir=true` |
210-
| Command Prompt | `ant -buildfile=C:\tools\script-runner\build.xml -Dwebroot=C:\work\myproject -Dexecute=test.cfm -DuniqueWorkingDir=true` |
211-
| Bash/WSL | `ant -buildfile /mnt/d/work/script-runner/build.xml -Dwebroot=/mnt/d/work/myproject -Dexecute=test.cfm -DuniqueWorkingDir=true` |
212-
213-
---
214-
215164
### Quick Reference Examples
216165

217166

218167
```bash
219168
# Testing Lucee Spreadsheet from its directory
220169
cd D:\work\lucee-spreadsheet
221-
ant -buildfile=D:\work\script-runner\build.xml -Dwebroot=. -Dexecute=/test/index.cfm
170+
ant -buildfile "D:\work\script-runner\build.xml" -Dwebroot=. -Dexecute=/test/index.cfm
222171

223172
# Testing with specific Lucee version
224-
ant -buildfile=D:\work\script-runner\build.xml -DluceeVersionQuery=6.2/stable/jar -Dwebroot=D:\work\lucee-spreadsheet -Dexecute=/test/index.cfm
173+
ant -buildfile "D:\work\script-runner\build.xml" -DluceeVersionQuery=6.2/stable/jar -Dwebroot="D:\work\lucee-spreadsheet" -Dexecute=/test/index.cfm
225174

226175
# Testing with a locally built Lucee JAR (for Lucee developers)
227-
ant -buildfile=D:\work\script-runner\build.xml -DluceeJar="D:\work\lucee\loader\target\lucee.jar" -Dwebroot=D:\work\lucee-spreadsheet -Dexecute=/test/index.cfm
176+
ant -buildfile "D:\work\script-runner\build.xml" -DluceeJar="D:\work\lucee\loader\target\lucee.jar" -Dwebroot="D:\work\lucee-spreadsheet" -Dexecute=/test/index.cfm
228177

229178
# With unique working directory for concurrent runs
230-
ant -buildfile=D:\work\script-runner\build.xml -DuniqueWorkingDir=true -Dwebroot=D:\work\lucee-spreadsheet -Dexecute=/test/index.cfm
179+
ant -buildfile "D:\work\script-runner\build.xml" -DuniqueWorkingDir=true -Dwebroot="D:\work\lucee-spreadsheet" -Dexecute=/test/index.cfm
231180
```
232181

233182
### Working Directory Behavior
@@ -307,7 +256,7 @@ systemOutput(serializeJSON(myData, "struct"), true);
307256

308257
```bash
309258
# ✅ Correct - specify script-runner location
310-
ant -buildfile="C:\tools\script-runner\build.xml" -Dwebroot="." -Dexecute="test.cfm"
259+
ant -buildfile "C:\tools\script-runner\build.xml" -Dwebroot="." -Dexecute="test.cfm"
311260

312261
# ❌ Wrong - looking for build.xml in current directory
313262
ant -Dwebroot="." -Dexecute="/test.cfm"
@@ -327,17 +276,16 @@ ant -buildfile="/path/to/script-runner/build.xml" -Dwebroot="/your/project" -Dex
327276

328277
```bash
329278
# ✅ Correct - Windows Command Prompt (no quotes needed for paths without spaces)
330-
ant -buildfile=d:\work\script-runner\build.xml -Dwebroot=D:\work\project -Dexecute=test.cfm
279+
ant -buildfile "d:\work\script-runner\build.xml" -Dwebroot="D:\work\project" -Dexecute="test.cfm"
331280

332-
# ✅ Correct - Windows with spaces in paths (use quotes around entire parameter)
333-
ant "-buildfile=C:\Program Files\script-runner\build.xml" "-Dwebroot=C:\My Projects\test" -Dexecute=test.cfm
281+
# ✅ Correct - Windows with spaces in paths
282+
ant -buildfile "C:\Program Files\script-runner\build.xml" -Dwebroot="C:\My Projects\test" -Dexecute="test.cfm"
334283

335-
# ✅ Correct - PowerShell (use single quotes to avoid variable expansion)
336-
ant -buildfile='d:\work\script-runner\build.xml' -Dwebroot='D:\work\project' -Dexecute='test.cfm'
284+
# ✅ Correct - PowerShell (single quotes work too, avoid variable expansion)
285+
ant -buildfile 'd:\work\script-runner\build.xml' -Dwebroot 'D:\work\project' -Dexecute 'test.cfm'
337286

338287
# ❌ Wrong - excessive escaping or nested quotes
339288
ant -buildfile=\"d:\work\script-runner\" -Dwebroot=\"D:\work\project\"
340-
341289
```
342290

343291

@@ -350,9 +298,12 @@ ant -buildfile=\"d:\work\script-runner\" -Dwebroot=\"D:\work\project\"
350298

351299
If no webroot is specfied, you can run the provided debug script, to see which extensions are available and all the env / sys properties
352300

353-
`ant -buildfile="C:\work\script-runner" -Dexecute="debug.cfm"`
301+
```bash
302+
ant -buildfile "C:\work\script-runner\build.xml" -Dexecute="debug.cfm"
354303

355-
`ant -buildfile="C:\work\script-runner" -Dexecute="debug.cfm" -DluceeVersion="light-6.2.2.91"` (`light` has no bundled extensions, `zero` has no extension or admin)
304+
# With light version (no bundled extensions) or zero version (no extension or admin)
305+
ant -buildfile "C:\work\script-runner\build.xml" -Dexecute="debug.cfm" -DluceeVersion="light-6.2.2.91"
306+
```
356307

357308
## As a GitHub Action
358309

build.xml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
<property name="FlightRecording" value=""/>
3131
<!-- custom FlightRecording filename -->
3232
<property name="FlightRecordingFilename" value=""/>
33+
<!-- custom FlightRecording settings file (default: profile) -->
34+
<property name="FlightRecordingSettings" value="profile"/>
3335
<!-- delete the Lucee working dir before -->
3436
<property name="preCleanup" value="true"/>
3537
<!-- delete the Lucee working dir afterwards -->
@@ -130,10 +132,13 @@
130132
<echo message="Using custom working directory: ${uniqueTempDir}"/>
131133
</sequential>
132134

133-
<!-- Race condition check: fail if directory already exists -->
135+
<!-- Race condition check: fail if directory already exists (only when preCleanup is true) -->
134136
<fail message="Race condition detected: Working directory ${uniqueTempDir} already exists!">
135137
<condition>
136-
<available file="${uniqueTempDir}" type="dir"/>
138+
<and>
139+
<istrue value="${preCleanup}"/>
140+
<available file="${uniqueTempDir}" type="dir"/>
141+
</and>
137142
</condition>
138143
</fail>
139144
</sequential>
@@ -312,6 +317,7 @@
312317
<arg value="${basedir}/build-run-cfml.xml"/>
313318
<jvmarg value="-Dlucee.base.dir=${tempDir}/lucee"/>
314319
<jvmarg value="-Dlucee.web.dir=${tempDir}/lucee/web"/>
320+
<jvmarg value="-Dlucee.cli.contextRoot=${webroot.abs}"/>
315321
<jvmarg value="-Dwebroot=${webroot.abs}"/>
316322
<jvmarg value="-Dexecute=${execute}"/>
317323
<jvmarg value="-DexecuteScriptByInclude=${executeScriptByInclude}"/>
@@ -327,13 +333,17 @@
327333
<jvmarg value="-XX:+UnlockExperimentalVMOptions" if:true="${UseEpsilonGC}"/>
328334
<jvmarg value="-XX:+UseEpsilonGC" if:true="${UseEpsilonGC}"/>
329335
<jvmarg value="-XX:+AlwaysPreTouch" if:true="${UseEpsilonGC}"/>
330-
<jvmarg value="-XX:StartFlightRecording=disk=true,dumponexit=true,filename=${jfrLogname},maxsize=1024m,maxage=1d,settings=profile,path-to-gc-roots=true" if:true="${FlightRecording}"/>
336+
<jvmarg value="-XX:StartFlightRecording=disk=true,dumponexit=true,filename=${jfrLogname},maxsize=1024m,maxage=1d,settings=${FlightRecordingSettings},path-to-gc-roots=true" if:true="${FlightRecording}"/>
331337
<jvmarg value="-XX:FlightRecorderOptions=stackdepth=128" if:true="${FlightRecording}"/>
332338
<jvmarg value="--add-exports=jdk.jfr/jdk.jfr=ALL-UNNAMED" if:true="${jfrExports}"/>
333339
<jvmarg value="--add-opens=jdk.jfr/jdk.jfr=ALL-UNNAMED" if:true="${jfrExports}"/>
334340
<jvmarg value="-XX:+PrintGCDetails" if:true="${PrintGCDetails}"/>
335341
<jvmarg value="-Dproperties.filename=${jvmProperties}" if:set="jvmProperties"/>
342+
<jvmarg value="-XX:+UnlockDiagnosticVMOptions" if:true="${PrintInlining}"/>
343+
<jvmarg value="-XX:+PrintInlining" if:true="${PrintInlining}"/>
344+
<jvmarg value="-XX:+PrintCompilation" if:true="${PrintInlining}"/>
336345
<jvmarg value="-XX:+UnlockExperimentalVMOptions" />
346+
<jvmarg value="-XX:+HeapDumpOnOutOfMemoryError" />
337347

338348
<!--
339349

0 commit comments

Comments
 (0)