Skip to content

Commit dbcaf77

Browse files
author
David O'Sullivan
committed
fixes bug with logic for SAR
1 parent 0023891 commit dbcaf77

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

lib/java_buildpack/framework/java_cf_env.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ def compile
4141
# (see JavaBuildpack::Component::BaseComponent#release)
4242
def release
4343
@droplet.additional_libraries << (@droplet.sandbox + jar_name)
44-
@droplet.environment_variables.add_environment_variable 'SPRING_PROFILES_INCLUDE', 'cloud'
44+
@droplet.environment_variables.add_environment_variable \
45+
'SPRING_PROFILES_INCLUDE', '$SPRING_PROFILES_INCLUDE,cloud'
4546
end
4647

4748
protected

lib/java_buildpack/framework/spring_auto_reconfiguration.rb

+9-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ def initialize(context)
3333
# (see JavaBuildpack::Component::BaseComponent#compile)
3434
def compile
3535
log_warning_scc_manual if spring_cloud_connectors?
36+
return if java_cf_env_framework?
3637

3738
download_jar
3839
@droplet.additional_libraries << (@droplet.sandbox + jar_name)
@@ -42,6 +43,8 @@ def compile
4243

4344
# (see JavaBuildpack::Component::BaseComponent#release)
4445
def release
46+
return if java_cf_env_framework?
47+
4548
@droplet.additional_libraries << (@droplet.sandbox + jar_name)
4649
end
4750

@@ -59,8 +62,12 @@ def spring?
5962
end
6063

6164
def java_cfenv?
62-
(@droplet.root + '**/*java-cfenv*.jar').glob.any? || @droplet.additional_libraries.any? do |additional_library|
63-
additional_library.instance_variable_get(:@pathname).fnmatch?('*java-cfenv*.jar')
65+
(@droplet.root + '**/*java-cfenv*.jar').glob.any? || java_cf_env_framework?
66+
end
67+
68+
def java_cf_env_framework?
69+
@droplet.additional_libraries.any? do |additional_library|
70+
additional_library.instance_variable_get(:@pathname).fnmatch?('*java_cf_env*.jar')
6471
end
6572
end
6673

spec/java_buildpack/framework/java_cfenv_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@
7979

8080
component.release
8181

82-
expect(environment_variables).to include('SPRING_PROFILES_INCLUDE=cloud')
82+
expect(environment_variables).to include('SPRING_PROFILES_INCLUDE=$SPRING_PROFILES_INCLUDE,cloud')
8383
end
8484
end

spec/java_buildpack/framework/spring_auto_reconfiguration_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@
107107
context('when java-cfenv injects its lib') do
108108

109109
before do
110-
additional_libraries.insert 0, additional_libs_directory + 'stub-java-cfenv.jar'
110+
additional_libraries.insert 0, additional_libs_directory + 'java_cf_env.jar'
111111
end
112112

113113
after do
114-
additional_libraries.delete additional_libs_directory + 'stub-java-cfenv.jar'
114+
additional_libraries.delete additional_libs_directory + 'java_cf_env.jar'
115115
end
116116

117117
it 'does not detect with Spring JAR and injected cfenv',

0 commit comments

Comments
 (0)