Skip to content

Commit a1bbd7a

Browse files
authored
Merge pull request #852 from ghaug/improve_offline_bp
Allow for additional components (JREs) in the cache
2 parents 5389df6 + 09b1672 commit a1bbd7a

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,11 @@ The offline package is a version of the buildpack designed to run without access
158158

159159
To pin the version of dependencies used by the buildpack to the ones currently resolvable use the `PINNED=true` argument. This will update the [`config/` directory][] to contain exact version of each dependency instead of version ranges.
160160

161+
Only packages referenced in the [`config/components.yml` file][] will be cached. Additional packages may be added using the `ADD_TO_CACHE` argument. It has to be set to the name of a `.yml` file in the [`config/` directory][]). Multiple file names may be separated by colons. This is useful to add additional JREs.
162+
161163
```bash
162164
$ bundle install
163-
$ bundle exec rake clean package OFFLINE=true PINNED=true
165+
$ bundle exec rake clean package OFFLINE=true PINNED=true ADD_TO_CACHE=sap_machine_jre
164166
...
165167
Creating build/java-buildpack-offline-cfd6b17.zip
166168
```

rakelib/dependency_cache_task.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,13 @@ def cache_task(uri)
109109
end
110110

111111
def component_ids
112-
configuration('components').values.flatten.map { |component| component.split('::').last.snake_case }
112+
conf = configuration('components').values.flatten.map { |component| component.split('::').last.snake_case }
113+
offline_cache = ENV['ADD_TO_CACHE']
114+
if !offline_cache.nil?
115+
offline_cache = offline_cache.split(':')
116+
(conf << offline_cache).flatten!.uniq!
117+
end
118+
conf
113119
end
114120

115121
def configuration(id)

0 commit comments

Comments
 (0)