Skip to content

Commit

Permalink
Pass cache_dir to jvm buildpack so that system.properties file can be…
Browse files Browse the repository at this point in the history
… cached

Update changelog
  • Loading branch information
jkutner committed Feb 15, 2019
1 parent 8e19167 commit db89ce6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## master

+ Cache system.properties file

## 63

+ Add support for MAVEN_HEROKU_CI_GOAL

## 62
Expand Down
2 changes: 1 addition & 1 deletion bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ source <(curl -s --retry 3 -L $BUILDPACK_STDLIB_URL)

export_env $ENV_DIR "." "JAVA_OPTS|JAVA_TOOL_OPTIONS"

install_jdk ${BUILD_DIR}
install_jdk "${BUILD_DIR}" "${CACHE_DIR}"

[ -n "$(find ${BUILD_DIR} -type f -name "*.kt")" ] && mcount "kotlin.source"
[ -n "$(find ${BUILD_DIR} -type f -name "*.groovy")" ] && mcount "groovy.source"
Expand Down
3 changes: 2 additions & 1 deletion lib/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ cache_copy() {

install_jdk() {
local install_dir=${1}
local cache_dir=${2}

let start=$(nowms)
JVM_COMMON_BUILDPACK=${JVM_COMMON_BUILDPACK:-https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/jvm.tgz}
Expand All @@ -101,6 +102,6 @@ install_jdk() {
mtime "jvm-common.install.time" "${start}"

let start=$(nowms)
install_java_with_overlay ${install_dir}
install_java_with_overlay "${install_dir}" "${cache_dir}"
mtime "jvm.install.time" "${start}"
}
5 changes: 4 additions & 1 deletion test/compile_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ testCompileWithoutSystemProperties() {
assertCaptured "Installing JDK 1.8"
assertTrue "Java should be present in runtime." "[ -d ${BUILD_DIR}/.jdk ]"
assertTrue "Java version file should be present." "[ -f ${BUILD_DIR}/.jdk/version ]"
assertTrue "system.properties was not cached" "[ -f $CACHE_DIR/system.properties ]"
}

testCompile()
Expand All @@ -151,6 +152,8 @@ testCompile()
assertCapturedSuccess

_assertMavenLatest
assertTrue "system.properties was not cached" "[ -f $CACHE_DIR/system.properties ]"
assertContains "system.properties contains the wrong version" "java.runtime.version=1.8" "$(cat $CACHE_DIR/system.properties)"
}

testCompilationFailure()
Expand All @@ -167,8 +170,8 @@ testNewAppsRemoveM2Cache()
{
createPom
rm -r ${CACHE_DIR} # simulate a brand new app without a cache dir

assertFalse "Precondition: New apps should not have a CACHE_DIR prior to running" "[ -d ${CACHE_DIR} ]"
mkdir ${CACHE_DIR}

compile

Expand Down

0 comments on commit db89ce6

Please sign in to comment.