Commits
Tarun Sukhani authored 41cf6054c7a
fix(launcher): host env beats certs/.env; forward JVM module options (PF-184, PF-183) Two defects in what a Play JVM is started with. They land together because the bundle launcher's share of each lives in one script, behind one warning helper, with one test class. PF-184. With a variable set both in certs/.env and in the host environment, play start and play autotest gave the app the host's value while play run, play test, play precompile and the bundle launcher gave it the file's. A value passed with `docker run -e` therefore lost to a certs/.env in the image, the opposite of what the scaffolded .env.example promises. The bundle also sourced the file, so `pa$$word` reached the JVM with the shell's pid in it and $(...) was executed. There is now one rule: a variable the host environment defines, even as the empty string, is never overridden, and the file is literal KEY=VALUE text. registerPlayJvmTask sets an entry only when the build's environment lacks the key. bundle-play.sh reads the file line by line with loadDotEnv's grammar (split at the first '=', trimmed, one quote pair removed, last duplicate wins) and never evaluates it. It loads the file before computing its own defaults, so PLAY_ID and PLAY_PID_FILE from the file are defaults the host and the --%<id> / --pid-file flags override; entries are exported only immediately before the exec, so a key such as IFS or PATH cannot change what the launcher itself does. A key that is not a variable name, `export FOO=bar` included, is skipped with a warning that gives the line number and never the value. PF-183. The bundle launcher forwarded six forms of JVM option and discarded every other argument without a word, so --add-modules=..., --enable-preview and -ea never reached the JVM. It now forwards the module options in their =-joined form, --enable-preview and the assertion switches, and names each argument it does drop in one line on stderr, once per invocation including restart. The help text lists what is forwarded. Tests: DotEnvPrecedenceTest runs playRun, playStart and playAutotest for real with the variable in both places, only in the file, and set empty on the host. BundleLauncherTest covers the launcher's grammar, the precedence, the literal values, the warnings and the forwarded options, including a key check that used to fail under a locale whose collation leaves letters out of A-Z on bash before 5. Verified on a real bundle: the host value wins, `pa$$word#1 $(touch PWNED)` arrives unchanged with nothing executed, and --add-modules=jdk.incubator.vector reaches the JVM. The manual documents certs/.env, its syntax and the precedence rule, and what the bundle launcher forwards. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>