Skip to content

Commit 55c3847

Browse files
committed
Merge 68677262-missing-indexes to master
[Completes #68677262]
2 parents 9bb2d79 + 2905caf commit 55c3847

7 files changed

Lines changed: 23 additions & 14 deletions

File tree

lib/java_buildpack/framework/spring_insight.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def find_insight_agent
156156
uri = credentials['dashboard_url']
157157
id = credentials['agent_username']
158158
pass = credentials['agent_password']
159-
return version, uri, id, pass # rubocop:disable RedundantReturn
159+
[version, uri, id, pass]
160160
end
161161

162162
def insight_directory

lib/java_buildpack/jre/memory/weight_balancing_memory_heuristic.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def normalise_stack_bucket(stack_bucket, buckets)
109109
stack_memory = weighted_proportion(stack_bucket, buckets)
110110
num_threads = [stack_memory / stack_bucket.default_size, 1].max
111111
normalised_bucket = MemoryBucket.new('normalised stack', stack_bucket.weighting, stack_bucket.range * num_threads)
112-
return normalised_bucket, num_threads # rubocop:disable RedundantReturn
112+
[normalised_bucket, num_threads]
113113
end
114114

115115
def balance_buckets(buckets)
@@ -138,7 +138,7 @@ def balance_remainder(remaining_buckets, remaining_memory)
138138
end
139139
remaining_memory -= allocated_memory
140140
fail "Total memory #{@memory_limit} exceeded by configured memory #{@sizes}" if remaining_memory < 0
141-
return remaining_memory, deleted # rubocop:disable RedundantReturn
141+
[remaining_memory, deleted]
142142
end
143143

144144
def constrain_bucket_size(allocated_memory, bucket, size)

lib/java_buildpack/repository/repository_index.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
require 'java_buildpack/logging/logger_factory'
1818
require 'java_buildpack/repository'
1919
require 'java_buildpack/repository/version_resolver'
20-
require 'java_buildpack/util/configuration_utils'
20+
require 'java_buildpack/util/cache'
2121
require 'java_buildpack/util/cache/download_cache'
22+
require 'java_buildpack/util/configuration_utils'
2223
require 'rbconfig'
2324
require 'yaml'
2425

@@ -37,7 +38,7 @@ def initialize(repository_root)
3738
@default_repository_root = JavaBuildpack::Util::ConfigurationUtils.load('repository')['default_repository_root']
3839
.chomp('/')
3940

40-
JavaBuildpack::Util::Cache::DownloadCache.new.get("#{canonical repository_root}#{INDEX_PATH}") do |file|
41+
cache.get("#{canonical repository_root}#{INDEX_PATH}") do |file|
4142
@index = YAML.load_file(file)
4243
@logger.debug { @index }
4344
end
@@ -51,7 +52,7 @@ def initialize(repository_root)
5152
def find_item(version)
5253
version = VersionResolver.resolve(version, @index.keys)
5354
uri = @index[version.to_s]
54-
return version, uri # rubocop:disable RedundantReturn
55+
[version, uri]
5556
end
5657

5758
private
@@ -62,6 +63,11 @@ def architecture
6263
`uname -m`.strip
6364
end
6465

66+
def cache
67+
JavaBuildpack::Util::Cache::DownloadCache.new(Pathname.new(Dir.tmpdir),
68+
JavaBuildpack::Util::Cache::CACHED_RESOURCES_DIRECTORY)
69+
end
70+
6571
def canonical(raw)
6672
cooked = raw
6773
.gsub(/\{default.repository.root\}/, @default_repository_root)

lib/java_buildpack/util/cache.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,17 @@
1515
# limitations under the License.
1616

1717
require 'java_buildpack/util'
18+
require 'pathname'
1819

1920
module JavaBuildpack
2021
module Util
2122

2223
# A module encapsulating all of the utility components for caching
2324
module Cache
25+
26+
# The location to find cached resources in the buildpack
27+
CACHED_RESOURCES_DIRECTORY = Pathname.new(File.expand_path('../../../../resources/cache', __FILE__))
28+
2429
end
2530

2631
end

lib/java_buildpack/util/cache/application_cache.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,9 @@ class ApplicationCache < DownloadCache
3131
def initialize
3232
application_cache_directory = ARGV[1]
3333
fail 'Application cache directory is undefined' if application_cache_directory.nil?
34-
super(Pathname.new(application_cache_directory), RESOURCES_DIRECTORY)
34+
super(Pathname.new(application_cache_directory), CACHED_RESOURCES_DIRECTORY)
3535
end
3636

37-
private
38-
39-
RESOURCES_DIRECTORY = Pathname.new(File.expand_path('../../../../../resources/cache', __FILE__))
40-
4137
end
4238

4339
end

lib/java_buildpack/util/tokenized_version.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def <=>(other)
6060
# Convert this to a string
6161
#
6262
# @return [String] a string representation of this tokenized version
63-
def to_s # rubocop:disable TrivialAccessors
63+
def to_s
6464
@version
6565
end
6666

@@ -93,7 +93,7 @@ def major_or_minor_and_tail(s)
9393
fail "Invalid major or minor version '#{major_or_minor}'" unless valid_major_minor_or_micro major_or_minor
9494
end
9595

96-
return major_or_minor, tail # rubocop:disable RedundantReturn
96+
[major_or_minor, tail]
9797
end
9898

9999
def micro_and_qualifier(s)
@@ -109,7 +109,7 @@ def micro_and_qualifier(s)
109109
fail "Invalid qualifier '#{qualifier}'" unless valid_qualifier qualifier
110110
end
111111

112-
return micro, qualifier # rubocop:disable RedundantReturn
112+
[micro, qualifier]
113113
end
114114

115115
def minimum_qualifier_length(a, b)

rakelib/dependency_cache_task.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ def uris(configurations)
137137

138138
configurations.each do |configuration|
139139
index_uris(configuration).each do |index_uri|
140+
multitask PACKAGE_NAME => [cache_task(index_uri)]
141+
140142
@cache.get(index_uri) do |f|
141143
index = YAML.load f
142144
uris << index[version(configuration, index).to_s]

0 commit comments

Comments
 (0)