diff options
author | Robb Kidd <rkidd@chef.io> | 2020-04-27 18:10:14 -0400 |
---|---|---|
committer | Robb Kidd <rkidd@chef.io> | 2020-04-28 11:50:00 -0400 |
commit | b07a6d088c01d4ff6a186ab89632bf57e758b6b5 (patch) | |
tree | 8cb1fc28db291890b6b000ba126dc2ee60bbc0b9 /habitat | |
parent | 42560ab8650f5534c603967cd7ad554b00e680b0 (diff) | |
download | chef-b07a6d088c01d4ff6a186ab89632bf57e758b6b5.tar.gz |
include Chef DLLs in the Habitat Windows packagerobb/reorder-gem-installs-in-hab-build
Chef needs some DLLs on Windows. Normally, the libraries get copied to
the directory where the current Ruby executable is located when
bundle install is run.
We don't want that in Habitat land. The Ruby executable lives in another
package and package namespace. We want the libraries included in *this*
package. So, here we copy the DLLs during plan build to a lib directory
within this package and set an environment variable to disable the copy
occuring during bundle install. We push the library path onto
RUBY_DLL_PATH to inform whichever Ruby interpreter that will be running
Chef where to find our DLLs.
Signed-off-by: Robb Kidd <robb@thekidds.org>
Diffstat (limited to 'habitat')
-rw-r--r-- | habitat/plan.ps1 | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/habitat/plan.ps1 b/habitat/plan.ps1 index db7760d651..704b736048 100644 --- a/habitat/plan.ps1 +++ b/habitat/plan.ps1 @@ -28,6 +28,7 @@ function Invoke-Begin { function Invoke-SetupEnvironment { Push-RuntimeEnv -IsPath GEM_PATH "$pkg_prefix/vendor" + Push-RuntimeEnv -IsPath RUBY_DLL_PATH "$pkg_prefix/lib" Set-RuntimeEnv APPBUNDLER_ALLOW_RVM "true" # prevent appbundler from clearing out the carefully constructed runtime GEM_PATH Set-RuntimeEnv FORCE_FFI_YAJL "ext" # Always use the C-extensions because we use MRI on all the things and C is fast. @@ -76,6 +77,11 @@ function Invoke-Build { try { Push-Location "${HAB_CACHE_SRC_PATH}/${pkg_dirname}" + Write-BuildLine " ** Copying Chef DLLs" + New-Item -ItemType Directory -Force -Path "$pkg_prefix/lib" + Get-ChildItem ./distro/ruby_bin_folder -Filter "*.dll" | Copy-Item -Destination "$pkg_prefix/lib" + $env:_BUNDER_WINDOWS_DLLS_COPIED = "1" + Write-BuildLine " ** Using bundler to retrieve the Ruby dependencies" bundle install if (-not $?) { throw "unable to install gem dependencies" } |