Skip to content

Commit

Permalink
Merge branch '530-java-9-endorsed'
Browse files Browse the repository at this point in the history
  • Loading branch information
nebhale committed Feb 12, 2018
2 parents 233ffe2 + cf14da4 commit 75b6e73
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 11 deletions.
26 changes: 19 additions & 7 deletions lib/java_buildpack/container/tomcat/tomcat_logging_support.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,12 @@ class TomcatLoggingSupport < JavaBuildpack::Component::VersionedDependencyCompon

# (see JavaBuildpack::Component::BaseComponent#compile)
def compile
download_jar(jar_name, endorsed)
download_jar(jar_name, bin)
write_set_env
end

# (see JavaBuildpack::Component::BaseComponent#release)
def release
@droplet.java_opts.add_system_property 'java.endorsed.dirs',
"$PWD/#{endorsed.relative_path_from(@droplet.root)}"
end
def release; end

protected

Expand All @@ -43,14 +41,28 @@ def supports?

private

def endorsed
@droplet.sandbox + 'endorsed'
def bin
@droplet.sandbox + 'bin'
end

def jar_name
"tomcat_logging_support-#{@version}.jar"
end

def setenv
bin + 'setenv.sh'
end

def write_set_env
setenv.open('w') do |f|
f.write <<~SH
#!/bin/sh
CLASSPATH=$CLASSPATH:#{(bin + jar_name).relative_path_from(@droplet.root)}
SH
end
end

end

end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,20 @@

component.compile

expect(sandbox + "endorsed/tomcat_logging_support-#{version}.jar").to exist
expect(sandbox + "bin/tomcat_logging_support-#{version}.jar").to exist
end

it 'sets java.endorsed.dirs during release' do
component.release
it 'creates setenv.sh',
cache_fixture: 'stub-logging-support.jar' do

component.compile

expect(sandbox + 'bin/setenv.sh').to exist
expect((sandbox + 'bin/setenv.sh').read).to eq <<~SH
#!/bin/sh
expect(java_opts).to include('-Djava.endorsed.dirs=$PWD/.java-buildpack/tomcat/endorsed')
CLASSPATH=$CLASSPATH:#{(sandbox + "bin/tomcat_logging_support-#{version}.jar").relative_path_from(app_dir)}
SH
end

end

0 comments on commit 75b6e73

Please sign in to comment.