Skip to content

Commit

Permalink
Fix is_play for Play 3.0 (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
Malax authored Feb 14, 2024
1 parent a890f89 commit 1364c0a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [Unreleased]

* Fix Play Framework detection for Play >= `3.0.0`. ([#240](https://github.com/heroku/heroku-buildpack-scala/pull/240))

## [v97] - 2024-02-07

Expand Down
31 changes: 14 additions & 17 deletions lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,20 @@ detect_sbt() {
}

is_play() {
_has_playConfig $1
local app_dir=$1

case "${IS_PLAY_APP}" in
"true")
return 0
;;
"false")
return 1
;;
*)
[[ -f "${app_dir}/${PLAY_CONF_FILE:-conf/application.conf}" ]] ||
grep -E --quiet --no-messages '^\s*addSbtPlugin\(\s*("org\.playframework"|"com\.typesafe\.play")\s*%\s*"sbt-plugin"' "${app_dir}/project/plugins.sbt"
;;
esac
}

is_sbt_native_packager() {
Expand Down Expand Up @@ -50,22 +63,6 @@ _has_buildPropertiesFile() {
test -e $ctxDir/project/build.properties
}

_has_playConfig() {
local ctxDir=$1
test -e $ctxDir/conf/application.conf ||
test "$IS_PLAY_APP" = "true" ||
(test -n "$PLAY_CONF_FILE" &&
test -e "$PLAY_CONF_FILE" &&
test "$IS_PLAY_APP" != "false") ||
(# test for default Play 2.3 and 2.4 setup.
test -d $ctxDir/project &&
test -r $ctxDir/project/plugins.sbt &&
test -n "$(grep "addSbtPlugin(\"com.typesafe.play\" % \"sbt-plugin\"" $ctxDir/project/plugins.sbt | grep -v ".*//.*addSbtPlugin")" &&
test -r $ctxDir/build.sbt &&
test -n "$(grep "enablePlugins(Play" $ctxDir/build.sbt | grep -v ".*//.*enablePlugins(Play")" &&
test "$IS_PLAY_APP" != "false")
}

_has_playPluginsFile() {
local ctxDir=$1
test -e $ctxDir/project/plugins.sbt
Expand Down

0 comments on commit 1364c0a

Please sign in to comment.