Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Update compile #2

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
**Please note:** This buildpack is an experimental project and is not officially supported.

# ASP.NET 5 Buildpack

This is a [Heroku buildpack](http://devcenter.heroku.com/articles/buildpack) for building [ASP.NET 5](http://www.asp.net/vnext/overview/aspnet-vnext/aspnet-5-overview) apps using [`project.json` files](https://github.com/aspnet/Home/wiki/Project.json-file) and the [kpm package manager](https://github.com/aspnet/Home/wiki/Package-Manager).
Expand Down
22 changes: 6 additions & 16 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export_env_dir ${ENV_DIR}
: ${MONO_VERSION:="4.0.1.44"}
: ${MONO_DOWNLOAD_LOCATION:="https://github.com/friism/mono-builder/releases/download/v${MONO_VERSION}/mono-${MONO_VERSION}.tar.gz"}
: ${LIBUV_VERSION:="1.6.0"}
: ${NODE_VERSION:="0.12.2"}
: ${DNVM_BRANCH:="dev"}
: ${DNX_VERSION:="latest"}

Expand All @@ -47,6 +46,9 @@ SRC_DIR=`mktemp -d`
(
shopt -s dotglob
mv ${BUILD_DIR}/* ${SRC_DIR}
if [ -d "${SRC_DIR}/.heroku" ]; then
mv ${SRC_DIR}/.heroku ${BUILD_DIR}
fi
)

mkdir -p ${CACHE_DIR}
Expand All @@ -63,18 +65,6 @@ export LD_LIBRARY_PATH="/app/mono/lib:${LD_LIBRARY_PATH}"
mozroots --import --sync --quiet
cp -r ~/.config ${BUILD_DIR}/.

# TODO: This test doesn't seen to actually work
# TODO: Maybe just run `npm install -g` and if anything is missing, install it after
if [[ -n $(find . -type f -iname package.json -o -iname bower.json -o -iname gruntfile.js) ]]
then
# Install Node and grunt-cli
NODE_PATH=`mktemp -d`
curl https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz -Ls \
| tar xz -C ${NODE_PATH}
export PATH="${NODE_PATH}/node-v${NODE_VERSION}-linux-x64/bin:${PATH}"
npm install -g grunt-cli bower gulp
fi

# Install DNX
# TODO: consider making this not dependent on GitHub being up
touch ~/.profile
Expand All @@ -88,7 +78,7 @@ mkdir -p ${DNVM_RUNTIME_CACHE_LOCATION}
ln -s ${DNVM_RUNTIME_CACHE_LOCATION} ${DNVM_RUNTIME_LOCAL_CACHE}/runtimes

# TODO: extract DNX version from global.json
dnvm install $DNX_VERSION $DNVM_FLAGS -a default
dnvm install $DNX_VERSION $DNVM_FLAGS -alias default

# Add DNX to the build output
DNX_BUILD_LOCATION=${BUILD_DIR}/.dnx/runtimes/
Expand Down Expand Up @@ -120,7 +110,7 @@ dnu restore $DNU_FLAGS ${PROJECT_JSON_FILE}
dnu publish --out ${BUILD_DIR} $DNU_FLAGS --no-source --configuration Release ${PROJECT_JSON_FILE}

# Clean out core-stuff that we don't need in the slug
find ${BUILD_DIR} -iname dnxcore50 -print0 | xargs -r -0 rm --
find ${BUILD_DIR} -iname dnxcore50 -print0 | xargs -r -0 rm -r --

mkdir -p ${BUILD_DIR}/.profile.d
cp -n ${BUILDPACK_DIR}/.profile.d/* ${BUILD_DIR}/.profile.d/
Expand All @@ -134,7 +124,7 @@ else
if [ $( echo "${ROOTS}" | wc -l ) -gt 0 ]; then
APP_ROOT=$(echo "$ROOTS" | head -1)
cat << EOT >> ${BUILD_DIR}/Procfile
web: ./kestrel --server.urls http://+:\$PORT
web: ./approot/web --server.urls http://+:\$PORT
EOT
fi
fi
2 changes: 1 addition & 1 deletion bin/util
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function conditional_download() {

function export_env_dir() {
local env_dir=$1
local whitelist_regex=${2:-'(DEPENDENCY_S3_BUCKET_PATH|MONO_VERSION|LIBUV_VERSION|NODE_VERSION|PROJECT|BUILD_DEBUG|DNVM_BRANCH|DNX_VERSION)$'}
local whitelist_regex=${2:-'(DEPENDENCY_S3_BUCKET_PATH|MONO_VERSION|LIBUV_VERSION|NODE_VERSION|NODE_ENV|PROJECT|BUILD_DEBUG|DNVM_BRANCH|DNX_VERSION)$'}
local blacklist_regex=${3:-'^(PATH|GIT_DIR|CPATH|CPPATH|LD_PRELOAD|LIBRARY_PATH)$'}
if [ -d "$env_dir" ]; then
for e in $(ls $env_dir); do
Expand Down