You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2014/07/31 07:12:19 UTC
[05/50] git commit: BUILDR-689 - Ensure that war file includes
generated assets rather than the "source" assets that may have been filtered.
BUILDR-689 - Ensure that war file includes generated assets rather than the "source" assets that may have been filtered.
git-svn-id: https://svn.apache.org/repos/asf/buildr/trunk@1534859 13f79535-47bb-0310-9956-ffa450edef68
Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/8c8483ee
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/8c8483ee
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/8c8483ee
Branch: refs/heads/master
Commit: 8c8483eed5d60ac2f02e5e9ea86894e6238c53fe
Parents: dbb367c
Author: Peter Donald <do...@apache.org>
Authored: Tue Oct 22 23:50:23 2013 +0000
Committer: Peter Donald <do...@apache.org>
Committed: Tue Oct 22 23:50:23 2013 +0000
----------------------------------------------------------------------
CHANGELOG | 3 +++
lib/buildr/java/packaging.rb | 9 +++------
spec/java/packaging_spec.rb | 17 +++++++++++++++++
3 files changed, 23 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/buildr/blob/8c8483ee/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index baf854f..9fe26f5 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,7 @@
1.4.15 (Pending)
+* Fixed: BUILDR-689 - Ensure that war file includes generated
+ assets rather than the "source" assets that may have
+ been filtered.
* Fixed: BUILDR-689 - Define assets task before the project is
defined to avoid "undefined method `project='" if the
project attempts to generate into the same directory.
http://git-wip-us.apache.org/repos/asf/buildr/blob/8c8483ee/lib/buildr/java/packaging.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/java/packaging.rb b/lib/buildr/java/packaging.rb
index 79b4606..8a2b292 100644
--- a/lib/buildr/java/packaging.rb
+++ b/lib/buildr/java/packaging.rb
@@ -684,12 +684,9 @@ module Buildr #:nodoc:
# Add libraries in WEB-INF lib, and classes in WEB-INF classes
war.with :classes=>[compile.target, resources.target].compact
war.with :libs=>compile.dependencies
- # Add included files, or the webapp directory.
- assets.paths.each do |asset|
- war.tap do |war|
- war.enhance([asset])
- end
- war.include asset, :as => '.'
+ war.enhance([assets])
+ if !assets.paths.empty? || File.exist?(_(:source, :main, :webapp))
+ war.include assets.to_s, :as => '.'
end
end
end
http://git-wip-us.apache.org/repos/asf/buildr/blob/8c8483ee/spec/java/packaging_spec.rb
----------------------------------------------------------------------
diff --git a/spec/java/packaging_spec.rb b/spec/java/packaging_spec.rb
index 4257566..18b9de9 100644
--- a/spec/java/packaging_spec.rb
+++ b/spec/java/packaging_spec.rb
@@ -550,6 +550,23 @@ describe Packaging, 'war' do
inspect_war { |files| files.should include('test.html') }
end
+ it 'should allow filtering into target directory' do
+ write 'src/main/webapp/test.html', '${version}'
+ define('foo', :version => '1.0') do
+ target_webapp = file("target/webapp") do |task|
+ filter('src/main/webapp/').
+ into(task.to_s).using('version' => '999').
+ run
+ end
+ package(:war)
+ end
+ inspect_war { |files| files.should include('test.html') }
+ cp project('foo').package(:war).to_s, '/tmp/x.zip'
+ Zip::ZipFile.open(project('foo').package(:war).to_s, false) do |war|
+ war.get_input_stream('test.html').read.should eql('999')
+ end
+ end
+
it 'should accept files from :classes option' do
write 'src/main/java/Test.java', 'class Test {}'
write 'classes/test'