Commits
Tarun Sukhani authored 2b24fbe28c1
fix: make the play shim's not-an-app-directory guidance reachable
find_gradle fell through to a system `gradle` from any directory, so running
`play start` one level above an application handed off to Gradle and produced
Gradle's own message:
Directory '/private/tmp/play-smoke' does not contain a Gradle build.
To create a new Gradle build in this directory run 'gradle init'
which is both wrong advice here and hides what the shim already knew how to
say. Its "cd into your Play 1 application, or run `play new <name>`" text was
only emitted on the final fallthrough, reached solely when `gradle` is absent
from PATH -- so the guidance was unreachable for exactly the people most likely
to have Gradle installed.
Decide whether the directory is a Gradle build before picking a runner, using
the same file set Gradle itself looks for, and only then fall through to a
system gradle. A directory that genuinely is a Gradle build still falls through,
so `gradle`'s own diagnostics are preserved where they are accurate.
The message now names the offending directory and, since standing one level too
high is the usual way to get here, lists any application sitting directly below
it -- turning the fix into the next line the user reads:
play: /tmp/play-smoke is not a Play application directory.
...
There is an application directly below this one:
cd smokeapp
Written for the script's POSIX /bin/sh and its `set -e`: explicit if-blocks
rather than `cmd && action` lists, and the suggestion helper always returns 0.
`play new` and `play help` are unaffected -- neither calls find_gradle -- and
both were re-run from a non-application directory to confirm it.
Verified by hand across six cases: the original parent-directory failure (now
exits 1 with the suggestion), an empty directory (message, no bogus suggestion),
a real application directory (unchanged, exits 0), a Gradle build with no
wrapper (still falls through to gradle), plus play new and play help from
outside an application.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JTvjeSmGVe7RFyx8ZJXRAx