buildr 1.3.3-java → 1.3.4-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +76 -0
- data/NOTICE +1 -1
- data/README.rdoc +9 -21
- data/Rakefile +17 -34
- data/_buildr +3 -12
- data/{doc/print.toc.yaml → _jbuildr} +14 -14
- data/addon/buildr/cobertura.rb +5 -219
- data/addon/buildr/drb.rb +281 -0
- data/addon/buildr/emma.rb +5 -221
- data/addon/buildr/nailgun.rb +93 -689
- data/bin/buildr +0 -9
- data/buildr.buildfile +4 -4
- data/buildr.gemspec +27 -21
- data/doc/_layouts/default.html +82 -0
- data/doc/_layouts/preface.html +22 -0
- data/doc/{pages/artifacts.textile → artifacts.textile} +82 -42
- data/doc/{pages/building.textile → building.textile} +89 -47
- data/doc/{pages/contributing.textile → contributing.textile} +53 -45
- data/doc/css/default.css +6 -5
- data/doc/css/print.css +17 -24
- data/doc/css/syntax.css +7 -36
- data/doc/download.textile +68 -0
- data/doc/{pages/extending.textile → extending.textile} +45 -24
- data/doc/{pages/getting_started.textile → getting_started.textile} +158 -88
- data/doc/images/asf-logo.gif +0 -0
- data/doc/images/note.png +0 -0
- data/doc/index.textile +47 -0
- data/doc/{pages/languages.textile → languages.textile} +108 -54
- data/doc/mailing_lists.textile +25 -0
- data/doc/{pages/more_stuff.textile → more_stuff.textile} +152 -73
- data/doc/{pages/packaging.textile → packaging.textile} +181 -96
- data/doc/preface.textile +28 -0
- data/doc/{pages/projects.textile → projects.textile} +55 -40
- data/doc/scripts/buildr-git.rb +364 -264
- data/doc/scripts/gitflow.rb +296 -0
- data/doc/scripts/install-jruby.sh +2 -2
- data/doc/scripts/install-linux.sh +6 -6
- data/doc/scripts/install-osx.sh +2 -2
- data/doc/{pages/settings_profiles.textile → settings_profiles.textile} +83 -45
- data/doc/{pages/testing.textile → testing.textile} +77 -41
- data/lib/buildr.rb +5 -5
- data/lib/buildr/core.rb +2 -0
- data/lib/buildr/core/application.rb +321 -151
- data/lib/buildr/core/build.rb +298 -167
- data/lib/buildr/core/checks.rb +4 -132
- data/lib/buildr/core/common.rb +1 -5
- data/lib/buildr/core/compile.rb +3 -9
- data/lib/buildr/core/environment.rb +12 -3
- data/lib/buildr/core/filter.rb +20 -18
- data/lib/buildr/core/generate.rb +36 -36
- data/lib/buildr/core/help.rb +2 -1
- data/lib/buildr/core/osx.rb +46 -0
- data/lib/buildr/core/progressbar.rb +1 -1
- data/lib/buildr/core/project.rb +7 -34
- data/lib/buildr/core/test.rb +12 -6
- data/lib/buildr/core/transports.rb +13 -11
- data/lib/buildr/core/util.rb +14 -23
- data/lib/buildr/groovy/bdd.rb +3 -2
- data/lib/buildr/groovy/compiler.rb +1 -1
- data/lib/buildr/ide/eclipse.rb +31 -21
- data/lib/buildr/ide/idea.rb +3 -2
- data/lib/buildr/ide/idea7x.rb +6 -4
- data/lib/buildr/java/ant.rb +3 -1
- data/lib/buildr/java/bdd.rb +9 -7
- data/lib/buildr/java/cobertura.rb +243 -0
- data/lib/buildr/java/compiler.rb +5 -4
- data/lib/buildr/java/emma.rb +244 -0
- data/lib/buildr/java/packaging.rb +11 -8
- data/lib/buildr/java/pom.rb +0 -4
- data/lib/buildr/java/rjb.rb +1 -1
- data/lib/buildr/java/test_result.rb +5 -7
- data/lib/buildr/java/tests.rb +17 -11
- data/lib/buildr/packaging.rb +5 -2
- data/lib/buildr/packaging/archive.rb +488 -0
- data/lib/buildr/packaging/artifact.rb +48 -29
- data/lib/buildr/packaging/artifact_namespace.rb +6 -6
- data/lib/buildr/packaging/gems.rb +4 -4
- data/lib/buildr/packaging/package.rb +3 -2
- data/lib/buildr/packaging/tar.rb +85 -3
- data/lib/buildr/packaging/version_requirement.rb +172 -0
- data/lib/buildr/packaging/zip.rb +24 -682
- data/lib/buildr/packaging/ziptask.rb +313 -0
- data/lib/buildr/scala.rb +5 -0
- data/lib/buildr/scala/bdd.rb +100 -0
- data/lib/buildr/scala/compiler.rb +45 -4
- data/lib/buildr/scala/tests.rb +12 -59
- data/rakelib/checks.rake +57 -0
- data/rakelib/doc.rake +58 -68
- data/rakelib/jekylltask.rb +110 -0
- data/rakelib/package.rake +35 -37
- data/rakelib/release.rake +119 -35
- data/rakelib/rspec.rake +29 -39
- data/rakelib/setup.rake +21 -59
- data/rakelib/stage.rake +184 -26
- data/spec/addon/drb_spec.rb +328 -0
- data/spec/core/application_spec.rb +32 -25
- data/spec/core/build_spec.rb +336 -126
- data/spec/core/checks_spec.rb +292 -310
- data/spec/core/common_spec.rb +8 -2
- data/spec/core/compile_spec.rb +17 -1
- data/spec/core/generate_spec.rb +3 -3
- data/spec/core/project_spec.rb +18 -10
- data/spec/core/test_spec.rb +8 -1
- data/spec/core/transport_spec.rb +40 -3
- data/spec/core/util_spec.rb +67 -0
- data/spec/ide/eclipse_spec.rb +96 -28
- data/spec/ide/idea7x_spec.rb +84 -0
- data/spec/java/ant.rb +5 -0
- data/spec/java/bdd_spec.rb +12 -3
- data/spec/{addon → java}/cobertura_spec.rb +6 -6
- data/spec/{addon → java}/emma_spec.rb +5 -6
- data/spec/java/java_spec.rb +12 -2
- data/spec/java/packaging_spec.rb +31 -2
- data/spec/{addon → java}/test_coverage_spec.rb +3 -3
- data/spec/java/tests_spec.rb +5 -0
- data/spec/packaging/archive_spec.rb +11 -1
- data/spec/{core → packaging}/artifact_namespace_spec.rb +10 -2
- data/spec/packaging/artifact_spec.rb +44 -3
- data/spec/packaging/packaging_spec.rb +1 -1
- data/spec/sandbox.rb +17 -14
- data/spec/scala/bdd_spec.rb +150 -0
- data/spec/scala/compiler_spec.rb +27 -0
- data/spec/scala/scala.rb +38 -0
- data/spec/scala/tests_spec.rb +78 -33
- data/spec/spec_helpers.rb +29 -5
- data/spec/version_requirement_spec.rb +6 -0
- metadata +176 -172
- data/DISCLAIMER +0 -7
- data/doc/images/apache-incubator-logo.png +0 -0
- data/doc/pages/download.textile +0 -51
- data/doc/pages/index.textile +0 -42
- data/doc/pages/mailing_lists.textile +0 -17
- data/doc/pages/recipes.textile +0 -103
- data/doc/pages/troubleshooting.textile +0 -103
- data/doc/pages/whats_new.textile +0 -323
- data/doc/print.haml +0 -51
- data/doc/site.haml +0 -56
- data/doc/site.toc.yaml +0 -47
- data/etc/git-svn-authors +0 -16
- data/lib/buildr/core/application_cli.rb +0 -139
- data/rakelib/apache.rake +0 -191
- data/rakelib/changelog.rake +0 -57
- data/rakelib/rubyforge.rake +0 -53
- data/rakelib/scm.rake +0 -49
data/lib/buildr/core/project.rb
CHANGED
|
@@ -240,18 +240,19 @@ module Buildr
|
|
|
240
240
|
rake_check_options options, :scope if options
|
|
241
241
|
raise ArgumentError, 'Only one project name at a time' unless args.size == 1
|
|
242
242
|
@projects ||= {}
|
|
243
|
-
name = args.first
|
|
243
|
+
name = args.first.to_s
|
|
244
|
+
# Make sure parent project is evaluated (e.g. if looking for foo:bar, find foo first)
|
|
245
|
+
unless @projects[name]
|
|
246
|
+
parts = name.split(':')
|
|
247
|
+
project(parts.first, options || {}) if parts.size > 1
|
|
248
|
+
end
|
|
244
249
|
if options && options[:scope]
|
|
245
250
|
# We assume parent project is evaluated.
|
|
246
251
|
project = options[:scope].split(':').inject([[]]) { |scopes, scope| scopes << (scopes.last + [scope]) }.
|
|
247
252
|
map { |scope| @projects[(scope + [name]).join(':')] }.
|
|
248
253
|
select { |project| project }.last
|
|
249
254
|
end
|
|
250
|
-
|
|
251
|
-
# Parent project not evaluated.
|
|
252
|
-
name.split(':').tap { |parts| @projects[parts.first].invoke if parts.size > 1 }
|
|
253
|
-
project = @projects[name]
|
|
254
|
-
end
|
|
255
|
+
project ||= @projects[name] # Not found in scope.
|
|
255
256
|
raise "No such project #{name}" unless project
|
|
256
257
|
project.invoke
|
|
257
258
|
project
|
|
@@ -861,32 +862,4 @@ module Buildr
|
|
|
861
862
|
Project.projects *args
|
|
862
863
|
end
|
|
863
864
|
|
|
864
|
-
# Forces all the projects to be evaluated before executing any other task.
|
|
865
|
-
# If we don't do that, we don't get to have tasks available when running Rake.
|
|
866
|
-
namespace 'buildr' do
|
|
867
|
-
task 'initialize' do
|
|
868
|
-
projects
|
|
869
|
-
end
|
|
870
|
-
|
|
871
|
-
desc "Freeze the Buildfile so it always uses Buildr version #{Buildr::VERSION}"
|
|
872
|
-
task 'freeze' do
|
|
873
|
-
puts "Freezing the Buildfile so it always uses Buildr version #{Buildr::VERSION}"
|
|
874
|
-
original = File.read(Buildr.application.buildfile)
|
|
875
|
-
if original =~ /gem\s*(["'])buildr\1/
|
|
876
|
-
modified = original.sub(/gem\s*(["'])buildr\1\s*,\s*(["']).*\2/, %{gem "buildr", "#{Buildr::VERSION}"})
|
|
877
|
-
else
|
|
878
|
-
modified = %{gem "buildr", "#{Buildr::VERSION}"\n} + original
|
|
879
|
-
end
|
|
880
|
-
File.open(Buildr.application.buildfile, "w") { |file| file.write modified }
|
|
881
|
-
end
|
|
882
|
-
|
|
883
|
-
desc 'Unfreeze the Buildfile to use the latest version of Buildr'
|
|
884
|
-
task 'unfreeze' do
|
|
885
|
-
puts 'Unfreezing the Buildfile to use the latest version of Buildr from your Gems repository.'
|
|
886
|
-
modified = File.read(Buildr.application.buildfile).sub(/^\s*gem\s*(["'])buildr\1.*\n/, "")
|
|
887
|
-
File.open(Buildr.application.buildfile, "w") { |file| file.write modified }
|
|
888
|
-
end
|
|
889
|
-
end
|
|
890
|
-
|
|
891
|
-
|
|
892
865
|
end
|
data/lib/buildr/core/test.rb
CHANGED
|
@@ -442,7 +442,13 @@ module Buildr
|
|
|
442
442
|
@passed_tests, @failed_tests = [], []
|
|
443
443
|
else
|
|
444
444
|
info "Running tests in #{@project.name}"
|
|
445
|
-
|
|
445
|
+
begin
|
|
446
|
+
@passed_tests = @framework.run(@tests, dependencies)
|
|
447
|
+
rescue Exception=>ex
|
|
448
|
+
error "Test framework error: #{ex.message}"
|
|
449
|
+
error ex.backtrace.join("\n") if Buildr.application.options.trace
|
|
450
|
+
@passed_tests = []
|
|
451
|
+
end
|
|
446
452
|
@failed_tests = @tests - @passed_tests
|
|
447
453
|
unless @failed_tests.empty?
|
|
448
454
|
error "The following tests failed:\n#{@failed_tests.join("\n")}"
|
|
@@ -592,8 +598,8 @@ module Buildr
|
|
|
592
598
|
project.build test unless test.options[:integration]
|
|
593
599
|
|
|
594
600
|
project.clean do
|
|
595
|
-
rm_rf test.compile.target.to_s
|
|
596
|
-
rm_rf test.report_to.to_s
|
|
601
|
+
rm_rf test.compile.target.to_s if test.compile.target
|
|
602
|
+
rm_rf test.report_to.to_s
|
|
597
603
|
end
|
|
598
604
|
end
|
|
599
605
|
|
|
@@ -629,9 +635,9 @@ module Buildr
|
|
|
629
635
|
# Use this method to return the integration tests task, or enhance it with a block to execute.
|
|
630
636
|
#
|
|
631
637
|
# There is one integration tests task you can execute directly, or as a result of running the package
|
|
632
|
-
# task (or tasks that depend on it, like install and
|
|
638
|
+
# task (or tasks that depend on it, like install and upload). It contains all the tests marked with
|
|
633
639
|
# :integration=>true, all other tests are considered unit tests and run by the test task before packaging.
|
|
634
|
-
# So essentially: build=>test=>packaging=>integration=>install/
|
|
640
|
+
# So essentially: build=>test=>packaging=>integration=>install/upload.
|
|
635
641
|
#
|
|
636
642
|
# You add new tests from projects that define integration tests using the regular test task,
|
|
637
643
|
# but with the following addition:
|
|
@@ -658,7 +664,7 @@ module Buildr
|
|
|
658
664
|
class Options
|
|
659
665
|
|
|
660
666
|
# Runs tests after the build when true (default). This forces tests to execute
|
|
661
|
-
# after the build, including when running build related tasks like install,
|
|
667
|
+
# after the build, including when running build related tasks like install, upload and release.
|
|
662
668
|
#
|
|
663
669
|
# Set to false to not run any tests. Set to :all to run all tests, ignoring failures.
|
|
664
670
|
#
|
|
@@ -14,18 +14,18 @@
|
|
|
14
14
|
# the License.
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
require '
|
|
17
|
+
require 'uri'
|
|
18
18
|
require 'net/http'
|
|
19
|
-
|
|
19
|
+
Net.autoload :HTTPS, 'net/https'
|
|
20
20
|
# PATCH: On Windows, Net::SSH 2.0.2 attempts to load the Pageant DLLs which break on JRuby.
|
|
21
21
|
$LOADED_FEATURES << 'net/ssh/authentication/pageant.rb' if RUBY_PLATFORM =~ /java/
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
gem 'net-ssh' ; Net.autoload :SSH, 'net/ssh'
|
|
23
|
+
gem 'net-sftp' ; Net.autoload :SFTP, 'net/sftp'
|
|
24
|
+
autoload :CGI, 'cgi'
|
|
24
25
|
require 'digest/md5'
|
|
25
26
|
require 'digest/sha1'
|
|
26
27
|
require 'stringio'
|
|
27
|
-
|
|
28
|
-
require 'buildr/core/progressbar'
|
|
28
|
+
autoload :ProgressBar, 'buildr/core/progressbar'
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
# Not quite open-uri, but similar. Provides read and write methods for the resource represented by the URI.
|
|
@@ -37,8 +37,8 @@ module URI
|
|
|
37
37
|
class NotFoundError < RuntimeError
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
-
# How many bytes to read/write at once.
|
|
41
|
-
RW_CHUNK_SIZE =
|
|
40
|
+
# How many bytes to read/write at once. Do not change without checking BUILDR-214 first.
|
|
41
|
+
RW_CHUNK_SIZE = 128 * 1024 #:nodoc:
|
|
42
42
|
|
|
43
43
|
class << self
|
|
44
44
|
|
|
@@ -154,7 +154,7 @@ module URI
|
|
|
154
154
|
read({:progress=>verbose}.merge(options || {}).merge(:modified=>modified)) { |chunk| temp.write chunk }
|
|
155
155
|
end
|
|
156
156
|
mkpath File.dirname(target)
|
|
157
|
-
|
|
157
|
+
mv temp.path, target
|
|
158
158
|
when File
|
|
159
159
|
read({:progress=>verbose}.merge(options || {}).merge(:modified=>target.mtime)) { |chunk| target.write chunk }
|
|
160
160
|
target.flush
|
|
@@ -289,7 +289,9 @@ module URI
|
|
|
289
289
|
when Net::HTTPRedirection
|
|
290
290
|
# Try to download from the new URI, handle relative redirects.
|
|
291
291
|
trace "Redirected to #{response['Location']}"
|
|
292
|
-
|
|
292
|
+
rself = self + URI.parse(response['Location'])
|
|
293
|
+
rself.user, rself.password = self.user, self.password
|
|
294
|
+
return rself.read(options, &block)
|
|
293
295
|
when Net::HTTPOK
|
|
294
296
|
info "Downloading #{self}"
|
|
295
297
|
result = nil
|
|
@@ -547,7 +549,7 @@ module URI
|
|
|
547
549
|
end
|
|
548
550
|
real_path.tap do |path|
|
|
549
551
|
mkpath File.dirname(path)
|
|
550
|
-
|
|
552
|
+
mv temp.path, path
|
|
551
553
|
end
|
|
552
554
|
end
|
|
553
555
|
|
data/lib/buildr/core/util.rb
CHANGED
|
@@ -16,7 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
require 'rbconfig'
|
|
18
18
|
require 'pathname'
|
|
19
|
-
|
|
19
|
+
autoload :Tempfile, 'tempfile'
|
|
20
|
+
autoload :YAML, 'yaml'
|
|
21
|
+
autoload :REXML, 'rexml/document'
|
|
22
|
+
gem 'xml-simple' ; autoload :XmlSimple, 'xmlsimple'
|
|
23
|
+
gem 'builder' ; autoload :Builder, 'builder' # A different kind of buildr, one we use to create XML.
|
|
24
|
+
require 'highline/import'
|
|
20
25
|
|
|
21
26
|
|
|
22
27
|
module Buildr
|
|
@@ -31,7 +36,7 @@ module Buildr
|
|
|
31
36
|
# In order to determine if we are running on a windows OS,
|
|
32
37
|
# prefer this function instead of using Gem.win_platform?.
|
|
33
38
|
#
|
|
34
|
-
# Gem.win_platform? only checks
|
|
39
|
+
# Gem.win_platform? only checks these RUBY_PLATFORM global,
|
|
35
40
|
# that in some cases like when running on JRuby is not
|
|
36
41
|
# succifient for our purpose:
|
|
37
42
|
#
|
|
@@ -55,8 +60,10 @@ module Buildr
|
|
|
55
60
|
end
|
|
56
61
|
cmd << ruby_bin
|
|
57
62
|
cmd << '-S' << options.delete(:command) if options[:command]
|
|
58
|
-
|
|
59
|
-
|
|
63
|
+
cmd.concat args.flatten
|
|
64
|
+
cmd.push options
|
|
65
|
+
sh *cmd do |ok, status|
|
|
66
|
+
ok or fail "Command ruby failed with status (#{status ? status.exitstatus : 'unknown'}): [#{cmd.join(" ")}]"
|
|
60
67
|
end
|
|
61
68
|
end
|
|
62
69
|
|
|
@@ -109,7 +116,7 @@ module Buildr
|
|
|
109
116
|
end
|
|
110
117
|
|
|
111
118
|
# Utility methods for running gem commands
|
|
112
|
-
module Gems
|
|
119
|
+
module Gems #:nodoc:
|
|
113
120
|
extend self
|
|
114
121
|
|
|
115
122
|
# Install gems specified by each Gem::Dependency if they are missing. This method prompts the user
|
|
@@ -186,24 +193,8 @@ end
|
|
|
186
193
|
class OpenObject < Hash
|
|
187
194
|
|
|
188
195
|
def initialize(source=nil, &block)
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
end
|
|
192
|
-
|
|
193
|
-
def [](key)
|
|
194
|
-
@hash[key]
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
def []=(key, value)
|
|
198
|
-
@hash[key] = value
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
def delete(key)
|
|
202
|
-
@hash.delete(key)
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
def to_hash
|
|
206
|
-
@hash.clone
|
|
196
|
+
super &block
|
|
197
|
+
update source if source
|
|
207
198
|
end
|
|
208
199
|
|
|
209
200
|
def method_missing(symbol, *args)
|
data/lib/buildr/groovy/bdd.rb
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# License for the specific language governing permissions and limitations under
|
|
14
14
|
# the License.
|
|
15
15
|
|
|
16
|
+
|
|
16
17
|
module Buildr::Groovy
|
|
17
18
|
|
|
18
19
|
# EasyB is a Groovy based BDD framework.
|
|
@@ -85,7 +86,7 @@ module Buildr::Groovy
|
|
|
85
86
|
tests.inject([]) do |passed, test|
|
|
86
87
|
name = test.sub(/.*?groovy[\/\\]/, '').pathmap('%X')
|
|
87
88
|
report = File.join(task.report_to.to_s, name + ext)
|
|
88
|
-
mkpath report.pathmap('%d')
|
|
89
|
+
mkpath report.pathmap('%d')
|
|
89
90
|
begin
|
|
90
91
|
Java::Commands.java cmd_args,
|
|
91
92
|
"-#{easyb_format}", report,
|
|
@@ -102,4 +103,4 @@ module Buildr::Groovy
|
|
|
102
103
|
|
|
103
104
|
end
|
|
104
105
|
|
|
105
|
-
Buildr::TestFramework << Buildr::Groovy::EasyB
|
|
106
|
+
Buildr::TestFramework << Buildr::Groovy::EasyB
|
|
@@ -19,7 +19,7 @@ module Buildr::Groovy
|
|
|
19
19
|
# Groovyc compiler:
|
|
20
20
|
# compile.using(:groovyc)
|
|
21
21
|
#
|
|
22
|
-
# You need to require 'buildr/
|
|
22
|
+
# You need to require 'buildr/groovy/compiler' if you need to use this compiler.
|
|
23
23
|
#
|
|
24
24
|
# Used by default if .groovy files are found in the src/main/groovy directory (or src/test/groovy)
|
|
25
25
|
# and sets the target directory to target/classes (or target/test/classes).
|
data/lib/buildr/ide/eclipse.rb
CHANGED
|
@@ -25,16 +25,16 @@ module Buildr
|
|
|
25
25
|
|
|
26
26
|
first_time do
|
|
27
27
|
# Global task "eclipse" generates artifacts for all projects.
|
|
28
|
-
desc
|
|
29
|
-
Project.local_task
|
|
28
|
+
desc 'Generate Eclipse artifacts for all projects'
|
|
29
|
+
Project.local_task 'eclipse'=>'artifacts'
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
before_define do |project|
|
|
33
|
-
project.recursive_task(
|
|
33
|
+
project.recursive_task('eclipse')
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
after_define do |project|
|
|
37
|
-
eclipse = project.task(
|
|
37
|
+
eclipse = project.task('eclipse')
|
|
38
38
|
|
|
39
39
|
# Check if project has scala facet
|
|
40
40
|
scala = project.compile.language == :scala
|
|
@@ -42,17 +42,18 @@ module Buildr
|
|
|
42
42
|
# Only for projects that we support
|
|
43
43
|
supported_languages = [:java, :scala]
|
|
44
44
|
supported_packaging = %w(jar war rar mar aar)
|
|
45
|
-
if (supported_languages.include?
|
|
45
|
+
if (supported_languages.include?(project.compile.language) ||
|
|
46
|
+
supported_languages.include?(project.test.compile.language) ||
|
|
46
47
|
project.packages.detect { |pkg| supported_packaging.include?(pkg.type.to_s) })
|
|
47
|
-
eclipse.enhance [ file(project.path_to(
|
|
48
|
+
eclipse.enhance [ file(project.path_to('.classpath')), file(project.path_to('.project')) ]
|
|
48
49
|
|
|
49
50
|
# The only thing we need to look for is a change in the Buildfile.
|
|
50
|
-
file(project.path_to(
|
|
51
|
+
file(project.path_to('.classpath')=>Buildr.application.buildfile) do |task|
|
|
51
52
|
info "Writing #{task.name}"
|
|
52
53
|
|
|
53
54
|
m2repo = Buildr::Repositories.instance.local
|
|
54
55
|
|
|
55
|
-
File.open(task.name,
|
|
56
|
+
File.open(task.name, 'w') do |file|
|
|
56
57
|
classpathentry = ClasspathEntryWriter.new project, file
|
|
57
58
|
classpathentry.write do
|
|
58
59
|
# Note: Use the test classpath since Eclipse compiles both "main" and "test" classes using the same classpath
|
|
@@ -82,7 +83,7 @@ module Buildr
|
|
|
82
83
|
# Classpath elements from other projects
|
|
83
84
|
classpathentry.src_projects project_libs
|
|
84
85
|
|
|
85
|
-
classpathentry.output project.compile.target
|
|
86
|
+
classpathentry.output project.compile.target if project.compile.target
|
|
86
87
|
classpathentry.lib libs
|
|
87
88
|
classpathentry.var m2_libs, 'M2_REPO', m2repo
|
|
88
89
|
|
|
@@ -93,9 +94,9 @@ module Buildr
|
|
|
93
94
|
end
|
|
94
95
|
|
|
95
96
|
# The only thing we need to look for is a change in the Buildfile.
|
|
96
|
-
file(project.path_to(
|
|
97
|
+
file(project.path_to('.project')=>Buildr.application.buildfile) do |task|
|
|
97
98
|
info "Writing #{task.name}"
|
|
98
|
-
File.open(task.name,
|
|
99
|
+
File.open(task.name, 'w') do |file|
|
|
99
100
|
xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
|
|
100
101
|
xml.projectDescription do
|
|
101
102
|
xml.name project.id
|
|
@@ -103,17 +104,17 @@ module Buildr
|
|
|
103
104
|
xml.buildSpec do
|
|
104
105
|
if scala
|
|
105
106
|
xml.buildCommand do
|
|
106
|
-
xml.name
|
|
107
|
+
xml.name 'ch.epfl.lamp.sdt.core.scalabuilder'
|
|
107
108
|
end
|
|
108
109
|
else
|
|
109
110
|
xml.buildCommand do
|
|
110
|
-
xml.name
|
|
111
|
+
xml.name 'org.eclipse.jdt.core.javabuilder'
|
|
111
112
|
end
|
|
112
113
|
end
|
|
113
114
|
end
|
|
114
115
|
xml.natures do
|
|
115
|
-
xml.nature
|
|
116
|
-
xml.nature
|
|
116
|
+
xml.nature 'ch.epfl.lamp.sdt.core.scalanature' if scala
|
|
117
|
+
xml.nature 'org.eclipse.jdt.core.javanature'
|
|
117
118
|
end
|
|
118
119
|
end
|
|
119
120
|
end
|
|
@@ -126,7 +127,7 @@ module Buildr
|
|
|
126
127
|
# It converts tasks to paths.
|
|
127
128
|
# It converts absolute paths to relative paths.
|
|
128
129
|
# It ignores duplicate directories.
|
|
129
|
-
class ClasspathEntryWriter
|
|
130
|
+
class ClasspathEntryWriter #:nodoc:
|
|
130
131
|
def initialize project, target
|
|
131
132
|
@project = project
|
|
132
133
|
@xml = Builder::XmlMarkup.new(:target=>target, :indent=>2)
|
|
@@ -149,7 +150,7 @@ module Buildr
|
|
|
149
150
|
end
|
|
150
151
|
|
|
151
152
|
# Write a classpathentry of kind 'src'.
|
|
152
|
-
#
|
|
153
|
+
# Accept an array of absolute paths or a task.
|
|
153
154
|
def src arg
|
|
154
155
|
if [:sources, :target].all? { |message| arg.respond_to?(message) }
|
|
155
156
|
src_from_task arg
|
|
@@ -159,10 +160,10 @@ module Buildr
|
|
|
159
160
|
end
|
|
160
161
|
|
|
161
162
|
# Write a classpathentry of kind 'src' for dependent projects.
|
|
162
|
-
#
|
|
163
|
+
# Accept an array of projects.
|
|
163
164
|
def src_projects project_libs
|
|
164
165
|
project_libs.map(&:id).sort.uniq.each do |project_id|
|
|
165
|
-
@xml.classpathentry :kind=>'src', :combineaccessrules=>
|
|
166
|
+
@xml.classpathentry :kind=>'src', :combineaccessrules=>'false', :path=>"/#{project_id}"
|
|
166
167
|
end
|
|
167
168
|
end
|
|
168
169
|
|
|
@@ -170,9 +171,18 @@ module Buildr
|
|
|
170
171
|
@xml.classpathentry :kind=>'output', :path=>relative(target)
|
|
171
172
|
end
|
|
172
173
|
|
|
174
|
+
# Write a classpathentry of kind 'var' (variable) for a library in a local repo.
|
|
175
|
+
# * +libs+ is an array of library paths.
|
|
176
|
+
# * +var_name+ is a variable name as defined in Eclipse (e.g., 'M2_REPO').
|
|
177
|
+
# * +var_value+ is the value of this variable (e.g., '/home/me/.m2').
|
|
178
|
+
# E.g., <tt>var([lib1, lib2], 'M2_REPO', '/home/me/.m2/repo')</tt>
|
|
173
179
|
def var libs, var_name, var_value
|
|
174
|
-
libs.
|
|
175
|
-
|
|
180
|
+
libs.each do |lib_path|
|
|
181
|
+
lib_artifact = file(lib_path)
|
|
182
|
+
source_path = lib_artifact.sources_artifact.to_s
|
|
183
|
+
relative_lib_path = lib_path.sub(var_value, var_name)
|
|
184
|
+
relative_source_path = source_path.sub(var_value, var_name)
|
|
185
|
+
@xml.classpathentry :kind=>'var', :path=>relative_lib_path, :sourcepath=>relative_source_path
|
|
176
186
|
end
|
|
177
187
|
end
|
|
178
188
|
|
data/lib/buildr/ide/idea.rb
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
require 'buildr/core/project'
|
|
18
18
|
require 'buildr/packaging'
|
|
19
19
|
require 'stringio'
|
|
20
|
-
require 'rexml/document'
|
|
21
20
|
|
|
22
21
|
|
|
23
22
|
module Buildr
|
|
@@ -130,7 +129,9 @@ module Buildr
|
|
|
130
129
|
xml.root :url=>"jar://#{path}!/"
|
|
131
130
|
end
|
|
132
131
|
xml.JAVADOC
|
|
133
|
-
xml.SOURCES
|
|
132
|
+
xml.SOURCES do
|
|
133
|
+
xml.root :url=>"jar://#{path.sub(/\.jar$/, "-sources.jar")}!/"
|
|
134
|
+
end
|
|
134
135
|
end
|
|
135
136
|
end
|
|
136
137
|
end
|
data/lib/buildr/ide/idea7x.rb
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
require 'buildr/core/project'
|
|
18
18
|
require 'buildr/packaging'
|
|
19
19
|
require 'stringio'
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
|
|
22
22
|
module Buildr
|
|
23
23
|
module Idea7x #:nodoc:
|
|
@@ -160,7 +160,9 @@ module Buildr
|
|
|
160
160
|
xml.root :url=> path
|
|
161
161
|
end
|
|
162
162
|
xml.JAVADOC
|
|
163
|
-
xml.SOURCES
|
|
163
|
+
xml.SOURCES do
|
|
164
|
+
xml.root :url=>"jar://#{path.sub(/\.jar$/, "-sources.jar")}!/"
|
|
165
|
+
end
|
|
164
166
|
end
|
|
165
167
|
end
|
|
166
168
|
end
|
|
@@ -179,8 +181,8 @@ module Buildr
|
|
|
179
181
|
xml.modules do
|
|
180
182
|
project.projects.each do |subp|
|
|
181
183
|
module_name = subp.name.gsub(":", "-")
|
|
182
|
-
module_path = subp.
|
|
183
|
-
|
|
184
|
+
module_path = subp.base_dir ? subp.base_dir.gsub(/^#{project.base_dir}\//, '') :
|
|
185
|
+
subp.name.split(":")[1 .. -1].join(FILE::SEPARATOR)
|
|
184
186
|
path = "#{module_path}/#{module_name}#{IML_SUFFIX}"
|
|
185
187
|
xml.module :fileurl=>"#{PROJECT_DIR_URL}/#{path}", :filepath=>"#{PROJECT_DIR}/#{path}"
|
|
186
188
|
end
|