<commit_before>#!/usr/bin/env ruby
# Encoding: utf-8
# ASP.NET Core Buildpack
# Copyright 2014-2016 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
build_dir = ARGV[0]
cache_dir = ARGV[1]
deps_dir = ARGV[2]
deps_idx = ARGV[3]
buildpack_dir = File.join(File.dirname(__FILE__), '..')
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

require 'buildpack'
require 'open3'

if deps_dir
  stdout, stderr, status = Open3.capture3("#{buildpack_dir}/compile-extensions/bin/build_path_from_supply #{deps_dir}")

  if status.exitstatus.nonzero?
    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
end

if AspNetCoreBuildpack.finalize(build_dir, cache_dir, deps_dir, deps_idx)
  system("#{buildpack_dir}/compile-extensions/bin/store_buildpack_metadata #{buildpack_dir} #{cache_dir}")
  if deps_dir
    stdout, stderr, status = Open3.capture3("#{buildpack_dir}/compile-extensions/bin/write_profiled_from_supply #{deps_dir} #{build_dir}")
    if status.exitstatus.nonzero?
      puts "write_profiled_from_supply failed: #{stdout} \n====\n #{stderr}"
      exit 1
    end
  end
  exit 0
else
  exit 1
end
<commit_msg>Pass profile.d dir through to finalize [#151381690]<commit_after>#!/usr/bin/env ruby
# Encoding: utf-8
# ASP.NET Core Buildpack
# Copyright 2014-2016 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
build_dir = ARGV[0]
cache_dir = ARGV[1]
deps_dir = ARGV[2]
deps_idx = ARGV[3]
profile_dir = ARGV[4]
buildpack_dir = File.join(File.dirname(__FILE__), '..')
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

require 'buildpack'
require 'open3'

if deps_dir
  stdout, stderr, status = Open3.capture3("#{buildpack_dir}/compile-extensions/bin/build_path_from_supply #{deps_dir}")

  if status.exitstatus.nonzero?
    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
end

if AspNetCoreBuildpack.finalize(build_dir, cache_dir, deps_dir, deps_idx)
  system("#{buildpack_dir}/compile-extensions/bin/store_buildpack_metadata #{buildpack_dir} #{cache_dir}")
  if deps_dir
    stdout, stderr, status = Open3.capture3("#{buildpack_dir}/compile-extensions/bin/write_profiled_from_supply #{deps_dir} #{build_dir} #{profile_dir}")
    if status.exitstatus.nonzero?
      puts "write_profiled_from_supply failed: #{stdout} \n====\n #{stderr}"
      exit 1
    end
  end
  exit 0
else
  exit 1
end

{'fraction_non_alphanumeric': 0.12020953956437827, 'fraction_numerical': 0.017094017094017096, 'mean_word_length': 4.5474006116207955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4176724', 'n_tokens_mistral': 1248, 'n_tokens_neox': 1194, 'n_words': 353}