Add support for using dependencies provided by a supply buildpack
@@ -20,9 +20,11 @@ $stderr.sync = true
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'buildpack'
+require 'open3'
build_dir = ARGV[0]
cache_dir = ARGV[1]
+deps_dir = ARGV[3]
buildpack_dir = File.join(File.dirname(__FILE__), '..')
version = File.read(File.join(buildpack_dir, 'VERSION')).strip
@@ -30,6 +32,25 @@ puts "-----> Buildpack version #{version}"
system("#{buildpack_dir}/compile-extensions/bin/check_buildpack_version #{buildpack_dir} #{cache_dir}")
+if deps_dir
+ stdout, stderr, status = Open3.capture3("#{buildpack_dir}/compile-extensions/bin/build_path_from_supply #{deps_dir}")
+
+ if status.exitstatus != 0
+ puts "build_path_from_supply script failed: #{stdout} \n====\n #{stderr}"
+ exit 1
+ end
+
+ stdout.split("\n").each do |line|
+ var, val = line.split('=')
+ ENV[var] = val
+ end
+
+ stdout, stderr, status = Open3.capture3("#{buildpack_dir}/compile-extensions/bin/write_profiled_from_supply #{deps_dir} #{build_dir}")
+ if status.exitstatus != 0
+ puts "write_profiled_from_supply failed: #{stdout} \n====\n #{stderr}"
+ end
+end
+
if AspNetCoreBuildpack.compile(build_dir, cache_dir)
system("#{buildpack_dir}/compile-extensions/bin/store_buildpack_metadata #{buildpack_dir} #{cache_dir}")
exit 0
