|
| 1 | +#!/usr/bin/env ruby |
| 2 | +# Encoding: utf-8 |
| 3 | +# ASP.NET Core Buildpack |
| 4 | +# Copyright 2014-2016 the original author or authors. |
| 5 | +# |
| 6 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +# you may not use this file except in compliance with the License. |
| 8 | +# You may obtain a copy of the License at |
| 9 | +# |
| 10 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +# |
| 12 | +# Unless required by applicable law or agreed to in writing, software |
| 13 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +# See the License for the specific language governing permissions and |
| 16 | +# limitations under the License. |
| 17 | +# |
| 18 | +build_dir = ARGV[0] |
| 19 | +cache_dir = ARGV[1] |
| 20 | +deps_dir = ARGV[2] |
| 21 | +deps_idx = ARGV[3] |
| 22 | +buildpack_dir = File.join(File.dirname(__FILE__), '..') |
| 23 | +$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) |
| 24 | + |
| 25 | +require 'buildpack' |
| 26 | +require 'open3' |
| 27 | + |
| 28 | +if deps_dir |
| 29 | + stdout, stderr, status = Open3.capture3("#{buildpack_dir}/compile-extensions/bin/build_path_from_supply #{deps_dir}") |
| 30 | + |
| 31 | + if status.exitstatus.nonzero? |
| 32 | + puts "build_path_from_supply script failed: #{stdout} \n====\n #{stderr}" |
| 33 | + exit 1 |
| 34 | + end |
| 35 | + |
| 36 | + stdout.split("\n").each do |line| |
| 37 | + var, val = line.split('=') |
| 38 | + ENV[var] = val |
| 39 | + end |
| 40 | +end |
| 41 | + |
| 42 | +if AspNetCoreBuildpack.finalize(build_dir, cache_dir, deps_dir, deps_idx) |
| 43 | + system("#{buildpack_dir}/compile-extensions/bin/store_buildpack_metadata #{buildpack_dir} #{cache_dir}") |
| 44 | + if deps_dir |
| 45 | + stdout, stderr, status = Open3.capture3("#{buildpack_dir}/compile-extensions/bin/write_profiled_from_supply #{deps_dir} #{build_dir}") |
| 46 | + if status.exitstatus.nonzero? |
| 47 | + puts "write_profiled_from_supply failed: #{stdout} \n====\n #{stderr}" |
| 48 | + exit 1 |
| 49 | + end |
| 50 | + end |
| 51 | + exit 0 |
| 52 | +else |
| 53 | + exit 1 |
| 54 | +end |
0 commit comments