Skip to content

Commit b8fecd8

Browse files
committed
Merge branch '3.x'
2 parents f1ace32 + 91d0a6e commit b8fecd8

36 files changed

Lines changed: 1406 additions & 399 deletions

.idea/codeStyleSettings.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Metrics/LineLength:
2222
Metrics/MethodLength:
2323
Max: 18
2424
Metrics/ParameterLists:
25-
Max: 6
25+
Max: 8
2626
Metrics/PerceivedComplexity:
2727
Max: 10
2828
RSpec/ExampleLength:

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ To learn how to configure various properties of the buildpack, follow the "Confi
7373
* [Tomcat](docs/container-tomcat.md) ([Configuration](docs/container-tomcat.md#configuration))
7474
* Standard Frameworks
7575
* [AppDynamics Agent](docs/framework-app_dynamics_agent.md) ([Configuration](docs/framework-app_dynamics_agent.md#configuration))
76-
* [Container Certificate Trust Store](docs/framework-container_certificate_trust_store.md) ([Configuration](docs/framework-container_certificate_trust_store.md#configuration))
7776
* [Container Customizer](docs/framework-container_customizer.md) ([Configuration](docs/framework-container_customizer.md#configuration))
7877
* [Debug](docs/framework-debug.md) ([Configuration](docs/framework-debug.md#configuration))
7978
* [Dyadic EKM Security Provider](docs/framework-dyadic_ekm_security_provider.md) ([Configuration](docs/framework-dyadic_ekm_security_provider.md#configuration))

config/components.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jres:
3737
# command after any Java Opts added by previous frameworks.
3838
frameworks:
3939
- "JavaBuildpack::Framework::AppDynamicsAgent"
40-
- "JavaBuildpack::Framework::ContainerCertificateTrustStore"
4140
- "JavaBuildpack::Framework::ContainerCustomizer"
41+
- "JavaBuildpack::Framework::ContainerSecurityProvider"
4242
- "JavaBuildpack::Framework::Debug"
4343
- "JavaBuildpack::Framework::DynatraceAppmonAgent"
4444
- "JavaBuildpack::Framework::DynatraceOneAgent"

config/container_certificate_trust_store.yml renamed to config/container_security_provider.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
# Container certificate truststore configuration
16+
# Container security provider configuration
1717
---
18-
version: 2.+
19-
repository_root: "{default.repository.root}/container-certificate-trust-store"
20-
enabled: true
18+
version: 1.+
19+
repository_root: "{default.repository.root}/container-security-provider"

docs/framework-container_certificate_trust_store.md

Lines changed: 0 additions & 26 deletions
This file was deleted.

lib/java_buildpack/buildpack.rb

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
require 'java_buildpack/component/application'
2020
require 'java_buildpack/component/droplet'
2121
require 'java_buildpack/component/environment_variables'
22+
require 'java_buildpack/component/extension_directories'
2223
require 'java_buildpack/component/immutable_java_home'
2324
require 'java_buildpack/component/java_opts'
2425
require 'java_buildpack/component/mutable_java_home'
26+
require 'java_buildpack/component/security_providers'
2527
require 'java_buildpack/logging/logger_factory'
2628
require 'java_buildpack/util/configuration_utils'
2729
require 'java_buildpack/util/constantize'
@@ -58,9 +60,11 @@ def compile
5860

5961
container = component_detection('container', @containers, true).first
6062
no_container unless container
63+
jre = component_detection('JRE', @jres, true).first
64+
frameworks = component_detection('framework', @frameworks, false)
6165

62-
component_detection('JRE', @jres, true).first.compile
63-
component_detection('framework', @frameworks, false).each(&:compile)
66+
frameworks.each(&:compile)
67+
jre.compile
6468
container.compile
6569
end
6670

@@ -71,10 +75,13 @@ def compile
7175
def release
7276
container = component_detection('container', @containers, true).first
7377
no_container unless container
78+
jre = component_detection('JRE', @jres, true).first
79+
frameworks = component_detection('framework', @frameworks, false)
80+
81+
frameworks.map(&:release)
7482

7583
commands = []
76-
commands << component_detection('JRE', @jres, true).first.release
77-
component_detection('framework', @frameworks, false).map(&:release)
84+
commands << jre.release
7885
commands << container.release
7986

8087
command = commands.flatten.compact.join(' && ')
@@ -111,11 +118,13 @@ def initialize(app_dir, application)
111118
immutable_java_home = Component::ImmutableJavaHome.new mutable_java_home, app_dir
112119

113120
component_info = {
114-
'additional_libraries' => Component::AdditionalLibraries.new(app_dir),
115-
'application' => application,
116-
'env_vars' => Component::EnvironmentVariables.new(app_dir),
117-
'java_opts' => Component::JavaOpts.new(app_dir),
118-
'app_dir' => app_dir
121+
'additional_libraries' => Component::AdditionalLibraries.new(app_dir),
122+
'app_dir' => app_dir,
123+
'application' => application,
124+
'env_vars' => Component::EnvironmentVariables.new(app_dir),
125+
'extension_directories' => Component::ExtensionDirectories.new(app_dir),
126+
'java_opts' => Component::JavaOpts.new(app_dir),
127+
'security_providers' => Component::SecurityProviders.new
119128
}
120129

121130
instantiate_components(mutable_java_home, immutable_java_home, component_info)
@@ -163,8 +172,9 @@ def instantiate(components, java_home, component_info)
163172
application: component_info['application'],
164173
configuration: Util::ConfigurationUtils.load(component_id),
165174
droplet: Component::Droplet.new(component_info['additional_libraries'], component_id,
166-
component_info['env_vars'], java_home,
167-
component_info['java_opts'], component_info['app_dir'])
175+
component_info['env_vars'], component_info['extension_directories'],
176+
java_home, component_info['java_opts'], component_info['app_dir'],
177+
component_info['security_providers'])
168178
}
169179
component.constantize.new(context)
170180
end

lib/java_buildpack/component/additional_libraries.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
require 'fileutils'
1617
require 'java_buildpack/component'
1718
require 'java_buildpack/util/qualify_path'
1819

@@ -29,7 +30,6 @@ class AdditionalLibraries < Array
2930
#
3031
# @param [Pathname] droplet_root the root directory of the droplet
3132
def initialize(droplet_root)
32-
@paths = []
3333
@droplet_root = droplet_root
3434
end
3535

lib/java_buildpack/component/droplet.rb

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ class Droplet
4141
# @return [EnvironmentVariables] the shared +EnvironmentVariables+ instance for all components
4242
attr_reader :environment_variables
4343

44+
# @!attribute [r] extension_directories
45+
# @return [ExtensionDirectories] the shared +ExtensionDirectories+ instance for all components
46+
attr_reader :extension_directories
47+
4448
# @!attribute [r] java_home
4549
# @return [ImmutableJavaHome, MutableJavaHome] the shared +JavaHome+ instance for all components. If the
4650
# component using this instance is a jre, then this will be an
@@ -61,36 +65,48 @@ class Droplet
6165
# @return [Pathname] the root of the component's sandbox
6266
attr_reader :sandbox
6367

68+
# @!attribute [r] security_providers
69+
# @return [SecurityProviders] the shared +SecurityProviders+ instance for all components
70+
attr_reader :security_providers
71+
6472
# Creates a new instance of the droplet abstraction
6573
#
6674
# @param [AdditionalLibraries] additional_libraries the shared +AdditionalLibraries+ instance for all
6775
# components
6876
# @param [String] component_id the id of the component that will use this +Droplet+
6977
# @param [EnvironmentVariables] env_vars the shared +EnvironmentVariables+ instance for all
7078
# components
79+
# @param [ExtensionDirectories] extension_directories the shared +ExtensionDirectories+ instance for all
80+
# components
7181
# @param [ImmutableJavaHome, MutableJavaHome] java_home the shared +JavaHome+ instance for all components. If the
7282
# component using this instance is a jre, then this should
7383
# be an instance of +MutableJavaHome+. Otherwise it should
7484
# be an instance of +ImmutableJavaHome+.
7585
# @param [JavaOpts] java_opts the shared +JavaOpts+ instance for all components
7686
# @param [Pathname] root the root of the droplet
77-
def initialize(additional_libraries, component_id, env_vars, java_home, java_opts, root)
87+
# @param [SecurityProviders] security_providers the shared +SecurityProviders+ instance for all components
88+
def initialize(additional_libraries, component_id, env_vars, extension_directories, java_home, java_opts, root,
89+
security_providers)
90+
7891
@additional_libraries = additional_libraries
7992
@component_id = component_id
8093
@environment_variables = env_vars
94+
@extension_directories = extension_directories
8195
@java_home = java_home
8296
@java_opts = java_opts
8397
@logger = JavaBuildpack::Logging::LoggerFactory.instance.get_logger Droplet
8498

8599
buildpack_root = root + '.java-buildpack'
86100
sandbox_root = buildpack_root + component_id
87101

88-
@sandbox = JavaBuildpack::Util::FilteringPathname.new(sandbox_root, ->(path) { in?(path, sandbox_root) }, true)
89-
@root = JavaBuildpack::Util::FilteringPathname.new(
102+
@sandbox = JavaBuildpack::Util::FilteringPathname.new(sandbox_root,
103+
->(path) { in?(path, sandbox_root) }, true)
104+
@root = JavaBuildpack::Util::FilteringPathname.new(
90105
root,
91106
->(path) { !in?(path, buildpack_root) || in?(path, @sandbox) },
92107
true
93108
)
109+
@security_providers = security_providers
94110
end
95111

96112
# Copy resources from a components resources directory to a directory
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Cloud Foundry Java Buildpack
2+
# Copyright 2013-2017 the original author or authors.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
require 'java_buildpack/component'
17+
require 'java_buildpack/util/qualify_path'
18+
19+
module JavaBuildpack
20+
module Component
21+
22+
# An abstraction around the extension directories provided to a droplet by components.
23+
#
24+
# A new instance of this type should be created once for the application.
25+
class ExtensionDirectories < Array
26+
include JavaBuildpack::Util
27+
28+
# Creates an instance of the +JAVA_OPTS+ abstraction.
29+
#
30+
# @param [Pathname] droplet_root the root directory of the droplet
31+
def initialize(droplet_root)
32+
@droplet_root = droplet_root
33+
end
34+
35+
# Returns the contents of the collection as a colon-delimited paths formatted as +<value1>:<value2>+
36+
#
37+
# @return [String] the contents of the collection as a colon-delimited collection of paths
38+
def as_paths
39+
qualified_paths = sort.map { |path| qualify_path path }
40+
qualified_paths.join ':' unless empty?
41+
end
42+
43+
end
44+
45+
end
46+
end

0 commit comments

Comments
 (0)