buildr 1.3.5-x86-mswin32 → 1.4.0-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +153 -8
- data/README.rdoc +1 -1
- data/addon/buildr/antlr.rb +5 -5
- data/addon/buildr/drb.rb +18 -18
- data/addon/buildr/hibernate.rb +18 -14
- data/addon/buildr/javacc.rb +4 -4
- data/addon/buildr/jetty.rb +5 -5
- data/addon/buildr/nailgun.rb +23 -23
- data/addon/buildr/openjpa.rb +1 -1
- data/addon/buildr/org/apache/buildr/BuildrNail$Main.class +0 -0
- data/addon/buildr/org/apache/buildr/BuildrNail.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$1.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper$BuildrHandler.class +0 -0
- data/addon/buildr/org/apache/buildr/JettyWrapper.class +0 -0
- data/addon/buildr/protobuf.rb +75 -0
- data/addon/buildr/xmlbeans.rb +5 -5
- data/buildr.buildfile +2 -2
- data/buildr.gemspec +8 -7
- data/doc/_layouts/default.html +2 -2
- data/doc/artifacts.textile +4 -4
- data/doc/building.textile +35 -3
- data/doc/contributing.textile +5 -0
- data/doc/download.textile +16 -5
- data/doc/extending.textile +38 -12
- data/doc/installing.textile +6 -5
- data/doc/languages.textile +182 -42
- data/doc/more_stuff.textile +2 -2
- data/doc/packaging.textile +14 -15
- data/doc/projects.textile +7 -2
- data/doc/quick_start.textile +4 -4
- data/doc/scripts/buildr-git.rb +63 -63
- data/doc/scripts/gitflow.rb +21 -21
- data/doc/settings_profiles.textile +9 -2
- data/doc/testing.textile +16 -5
- data/etc/KEYS +38 -0
- data/lib/buildr.rb +1 -1
- data/lib/buildr/core.rb +1 -0
- data/lib/buildr/core/application.rb +33 -27
- data/lib/buildr/core/build.rb +41 -28
- data/lib/buildr/core/cc.rb +172 -0
- data/lib/buildr/core/checks.rb +1 -1
- data/lib/buildr/core/common.rb +7 -6
- data/lib/buildr/core/compile.rb +7 -8
- data/lib/buildr/core/doc.rb +263 -0
- data/lib/buildr/core/environment.rb +6 -6
- data/lib/buildr/core/filter.rb +77 -35
- data/lib/buildr/core/generate.rb +7 -7
- data/lib/buildr/core/help.rb +1 -1
- data/lib/buildr/core/osx.rb +6 -6
- data/lib/buildr/core/progressbar.rb +4 -4
- data/lib/buildr/core/project.rb +144 -36
- data/lib/buildr/core/shell.rb +34 -34
- data/lib/buildr/core/test.rb +89 -20
- data/lib/buildr/core/transports.rb +8 -7
- data/lib/buildr/core/util.rb +77 -23
- data/lib/buildr/groovy/bdd.rb +5 -5
- data/lib/buildr/groovy/compiler.rb +19 -15
- data/lib/buildr/groovy/shell.rb +6 -6
- data/lib/buildr/ide/eclipse.rb +148 -75
- data/lib/buildr/ide/eclipse/java.rb +3 -3
- data/lib/buildr/ide/eclipse/plugin.rb +8 -5
- data/lib/buildr/ide/eclipse/scala.rb +4 -2
- data/lib/buildr/ide/idea.rb +2 -2
- data/lib/buildr/ide/idea7x.rb +23 -4
- data/lib/buildr/java.rb +1 -0
- data/lib/buildr/java/ant.rb +4 -4
- data/lib/buildr/java/bdd.rb +51 -54
- data/lib/buildr/java/cobertura.rb +57 -35
- data/lib/buildr/java/commands.rb +14 -5
- data/lib/buildr/java/compiler.rb +3 -217
- data/lib/buildr/java/deprecated.rb +4 -4
- data/lib/buildr/java/doc.rb +70 -0
- data/lib/buildr/java/emma.rb +22 -22
- data/lib/buildr/java/jruby.rb +4 -4
- data/lib/buildr/java/jtestr_runner.rb.erb +27 -25
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
- data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +8 -3
- data/lib/buildr/java/packaging.rb +30 -29
- data/lib/buildr/java/pom.rb +4 -4
- data/lib/buildr/java/rjb.rb +6 -6
- data/lib/buildr/java/test_result.rb +61 -85
- data/lib/buildr/java/tests.rb +44 -27
- data/lib/buildr/java/version_requirement.rb +8 -8
- data/lib/buildr/packaging/archive.rb +55 -22
- data/lib/buildr/packaging/artifact.rb +75 -36
- data/lib/buildr/packaging/artifact_namespace.rb +90 -78
- data/lib/buildr/packaging/artifact_search.rb +5 -5
- data/lib/buildr/packaging/gems.rb +11 -7
- data/lib/buildr/packaging/package.rb +10 -7
- data/lib/buildr/packaging/tar.rb +14 -14
- data/lib/buildr/packaging/version_requirement.rb +30 -10
- data/lib/buildr/packaging/ziptask.rb +51 -13
- data/lib/buildr/scala.rb +1 -0
- data/lib/buildr/scala/bdd.rb +25 -20
- data/lib/buildr/scala/compiler.rb +87 -40
- data/lib/buildr/scala/doc.rb +106 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.java +57 -0
- data/lib/buildr/scala/shell.rb +14 -9
- data/lib/buildr/scala/tests.rb +33 -26
- data/lib/buildr/shell.rb +33 -33
- data/rakelib/all-in-one.rake +113 -0
- data/rakelib/checks.rake +1 -1
- data/rakelib/doc.rake +7 -0
- data/rakelib/package.rake +1 -1
- data/rakelib/release.rake +9 -6
- data/rakelib/rspec.rake +26 -7
- data/rakelib/setup.rake +15 -3
- data/rakelib/stage.rake +18 -11
- data/spec/addon/drb_spec.rb +25 -25
- data/spec/core/application_spec.rb +111 -21
- data/spec/core/build_spec.rb +16 -15
- data/spec/core/cc_spec.rb +174 -0
- data/spec/core/checks_spec.rb +34 -34
- data/spec/core/common_spec.rb +51 -5
- data/spec/core/compile_spec.rb +89 -14
- data/spec/core/extension_spec.rb +127 -19
- data/spec/core/generate_spec.rb +2 -2
- data/spec/core/project_spec.rb +10 -10
- data/spec/core/test_spec.rb +144 -35
- data/spec/core/transport_spec.rb +8 -8
- data/spec/core/util_spec.rb +63 -5
- data/spec/groovy/bdd_spec.rb +5 -5
- data/spec/groovy/compiler_spec.rb +29 -18
- data/spec/ide/eclipse_spec.rb +185 -9
- data/spec/ide/idea7x_spec.rb +22 -10
- data/spec/java/ant_spec.rb +9 -5
- data/spec/java/bdd_spec.rb +29 -37
- data/spec/java/cobertura_spec.rb +12 -12
- data/spec/java/commands_spec.rb +34 -0
- data/spec/java/compiler_spec.rb +53 -53
- data/spec/java/emma_spec.rb +11 -11
- data/spec/java/java_spec.rb +10 -10
- data/spec/java/packaging_spec.rb +67 -20
- data/spec/java/test_coverage_helper.rb +18 -18
- data/spec/java/tests_spec.rb +13 -9
- data/spec/packaging/archive_spec.rb +187 -20
- data/spec/packaging/artifact_namespace_spec.rb +172 -83
- data/spec/packaging/artifact_spec.rb +83 -18
- data/spec/packaging/packaging_spec.rb +41 -14
- data/spec/sandbox.rb +23 -12
- data/spec/scala/bdd_spec.rb +13 -8
- data/spec/scala/compiler_spec.rb +18 -13
- data/spec/scala/scala.rb +3 -3
- data/spec/scala/tests_spec.rb +46 -24
- data/spec/spec_helpers.rb +28 -10
- data/spec/version_requirement_spec.rb +25 -11
- metadata +149 -133
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
- data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +0 -35
- data/rakelib/stage.rake~ +0 -213
data/lib/buildr/groovy/bdd.rb
CHANGED
@@ -20,7 +20,7 @@ module Buildr::Groovy
|
|
20
20
|
# To use in your project:
|
21
21
|
#
|
22
22
|
# test.using :easyb
|
23
|
-
#
|
23
|
+
#
|
24
24
|
# This framework will search in your project for:
|
25
25
|
# src/spec/groovy/**/*Story.groovy
|
26
26
|
# src/spec/groovy/**/*Specification.groovy
|
@@ -69,7 +69,7 @@ module Buildr::Groovy
|
|
69
69
|
|
70
70
|
def run(tests, dependencies) #:nodoc:
|
71
71
|
options = { :format => :txt }.merge(self.options).only(*OPTIONS)
|
72
|
-
|
72
|
+
|
73
73
|
if :txt == options[:format]
|
74
74
|
easyb_format, ext = 'txtstory', '.txt'
|
75
75
|
elsif :xml == options[:format]
|
@@ -77,7 +77,7 @@ module Buildr::Groovy
|
|
77
77
|
else
|
78
78
|
raise "Invalid format #{options[:format]} expected one of :txt :xml"
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
cmd_args = [ 'org.disco.easyb.BehaviorRunner' ]
|
82
82
|
cmd_options = { :properties => options[:properties],
|
83
83
|
:java_args => options[:java_args],
|
@@ -98,9 +98,9 @@ module Buildr::Groovy
|
|
98
98
|
end
|
99
99
|
end
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
end # EasyB
|
103
|
-
|
103
|
+
|
104
104
|
end
|
105
105
|
|
106
106
|
Buildr::TestFramework << Buildr::Groovy::EasyB
|
@@ -33,9 +33,9 @@ module Buildr::Groovy
|
|
33
33
|
# * :encoding -- Encoding of source files
|
34
34
|
# * :verbose -- Asks the compiler for verbose output, true when running in verbose mode.
|
35
35
|
# * :fork -- Whether to execute groovyc using a spawned instance of the JVM; defaults to no
|
36
|
-
# * :memoryInitialSize -- The initial size of the memory for the underlying VM, if using fork mode; ignored otherwise.
|
36
|
+
# * :memoryInitialSize -- The initial size of the memory for the underlying VM, if using fork mode; ignored otherwise.
|
37
37
|
# Defaults to the standard VM memory setting. (Examples: 83886080, 81920k, or 80m)
|
38
|
-
# * :memoryMaximumSize -- The maximum size of the memory for the underlying VM, if using fork mode; ignored otherwise.
|
38
|
+
# * :memoryMaximumSize -- The maximum size of the memory for the underlying VM, if using fork mode; ignored otherwise.
|
39
39
|
# Defaults to the standard VM memory setting. (Examples: 83886080, 81920k, or 80m)
|
40
40
|
# * :listfiles -- Indicates whether the source files to be compiled will be listed; defaults to no
|
41
41
|
# * :stacktrace -- If true each compile error message will contain a stacktrace
|
@@ -49,20 +49,20 @@ module Buildr::Groovy
|
|
49
49
|
# * :javac -- Hash of options passed to the ant javac task
|
50
50
|
#
|
51
51
|
class Groovyc < Compiler::Base
|
52
|
-
|
52
|
+
|
53
53
|
# The groovyc compiler jars are added to classpath at load time,
|
54
54
|
# if you want to customize artifact versions, you must set them on the
|
55
55
|
#
|
56
|
-
# artifact_ns['Buildr::Compiler::Groovyc'].groovy = '1.
|
56
|
+
# artifact_ns['Buildr::Compiler::Groovyc'].groovy = '1.7.1'
|
57
57
|
#
|
58
58
|
# namespace before this file is required.
|
59
59
|
REQUIRES = ArtifactNamespace.for(self) do |ns|
|
60
|
-
ns.groovy! 'org.codehaus.groovy:groovy:jar:>=1.
|
61
|
-
ns.commons_cli! 'commons-cli:commons-cli:jar:>=1.
|
62
|
-
ns.asm! 'asm:asm:jar:>=
|
60
|
+
ns.groovy! 'org.codehaus.groovy:groovy:jar:>=1.7.1'
|
61
|
+
ns.commons_cli! 'commons-cli:commons-cli:jar:>=1.2'
|
62
|
+
ns.asm! 'asm:asm:jar:>=3.2'
|
63
63
|
ns.antlr! 'antlr:antlr:jar:>=2.7.7'
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
ANT_TASK = 'org.codehaus.groovy.ant.Groovyc'
|
67
67
|
GROOVYC_OPTIONS = [:encoding, :verbose, :fork, :memoryInitialSize, :memoryMaximumSize, :listfiles, :stacktrace]
|
68
68
|
JAVAC_OPTIONS = [:optimise, :warnings, :debug, :deprecation, :source, :target, :javac]
|
@@ -80,10 +80,14 @@ module Buildr::Groovy
|
|
80
80
|
paths.any? { |path| !Dir["#{path}/**/*.groovy"].empty? }
|
81
81
|
end
|
82
82
|
end
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
83
|
+
|
84
|
+
# Groovy dependencies don't need to go into JVM's system classpath.
|
85
|
+
# In fact, if they end up there it causes trouble because Groovy has issues
|
86
|
+
# loading other classes such as test frameworks (e.g. JUnit).
|
87
|
+
#
|
88
|
+
# Java.classpath << lambda { dependencies }
|
89
|
+
|
90
|
+
specify :language => :groovy, :sources => [:groovy, :java], :source_ext => [:groovy, :java],
|
87
91
|
:target => 'classes', :target_ext => 'class', :packaging => :jar
|
88
92
|
|
89
93
|
def initialize(project, options) #:nodoc:
|
@@ -100,7 +104,7 @@ module Buildr::Groovy
|
|
100
104
|
def compile(sources, target, dependencies) #:nodoc:
|
101
105
|
return if Buildr.application.options.dryrun
|
102
106
|
Buildr.ant 'groovyc' do |ant|
|
103
|
-
classpath = dependencies
|
107
|
+
classpath = dependencies
|
104
108
|
ant.taskdef :name => 'groovyc', :classname => ANT_TASK, :classpath => classpath.join(File::PATH_SEPARATOR)
|
105
109
|
ant.groovyc groovyc_options(sources, target) do
|
106
110
|
sources.each { |src| ant.src :path => src }
|
@@ -112,7 +116,7 @@ module Buildr::Groovy
|
|
112
116
|
end
|
113
117
|
end
|
114
118
|
|
115
|
-
private
|
119
|
+
private
|
116
120
|
def groovyc_options(sources, target)
|
117
121
|
check_options options, OPTIONS
|
118
122
|
groovyc_options = options.to_hash.only(*GROOVYC_OPTIONS)
|
@@ -129,7 +133,7 @@ module Buildr::Groovy
|
|
129
133
|
javac_options.merge!(other)
|
130
134
|
javac_options
|
131
135
|
end
|
132
|
-
|
136
|
+
|
133
137
|
end
|
134
138
|
end
|
135
139
|
|
data/lib/buildr/groovy/shell.rb
CHANGED
@@ -19,24 +19,24 @@ module Buildr
|
|
19
19
|
module Groovy
|
20
20
|
class GroovySH < Buildr::Shell::Base
|
21
21
|
SUFFIX = if Util.win_os? then '.bat' else '' end
|
22
|
-
|
22
|
+
|
23
23
|
class << self
|
24
24
|
def lang
|
25
25
|
:groovy
|
26
26
|
end
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def launch
|
30
30
|
fail 'Are we forgetting something? GROOVY_HOME not set.' unless groovy_home
|
31
|
-
|
32
|
-
cp = project.compile.dependencies.join(File::PATH_SEPARATOR) +
|
31
|
+
|
32
|
+
cp = project.compile.dependencies.join(File::PATH_SEPARATOR) +
|
33
33
|
File::PATH_SEPARATOR + project.path_to(:target, :classes)
|
34
|
-
|
34
|
+
|
35
35
|
cmd_args = " -classpath '#{cp}'"
|
36
36
|
trace "groovysh #{cmd_args}"
|
37
37
|
system(File.expand_path("bin#{File::SEPARATOR}groovysh#{SUFFIX}", groovy_home) + cmd_args)
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
private
|
41
41
|
def groovy_home
|
42
42
|
@home ||= ENV['GROOVY_HOME']
|
data/lib/buildr/ide/eclipse.rb
CHANGED
@@ -31,6 +31,29 @@ module Buildr
|
|
31
31
|
@options = Options.new(project)
|
32
32
|
end
|
33
33
|
|
34
|
+
# :call-seq:
|
35
|
+
# classpath_variables { :VAR => '/path/to/location' }
|
36
|
+
# Sets classpath variables to be used for library path substitution
|
37
|
+
# on the project.
|
38
|
+
#
|
39
|
+
def classpath_variables(*values)
|
40
|
+
fail "eclipse.classpath_variables expects a single hash argument" if values.size > 1
|
41
|
+
if values.size == 1
|
42
|
+
fail "eclipse.classpath_variables expects a Hash argument" unless values[0].is_a? Hash
|
43
|
+
# convert keys to strings
|
44
|
+
values = values[0].inject({}) { |h, (k,v)| h[k.to_s] = @project.path_to(v); h }
|
45
|
+
@variables = values.merge(@variables || {})
|
46
|
+
end
|
47
|
+
@variables || (@project.parent ? @project.parent.eclipse.classpath_variables : default_classpath_variables)
|
48
|
+
end
|
49
|
+
|
50
|
+
def default_classpath_variables
|
51
|
+
vars = {}
|
52
|
+
vars[:SCALA_HOME] = ENV['SCALA_HOME'] if ENV['SCALA_HOME']
|
53
|
+
vars[:JAVA_HOME] = ENV['JAVA_HOME'] if ENV['JAVA_HOME']
|
54
|
+
vars
|
55
|
+
end
|
56
|
+
|
34
57
|
# :call-seq:
|
35
58
|
# natures=(natures)
|
36
59
|
# Sets the Eclipse project natures on the project.
|
@@ -49,7 +72,7 @@ module Buildr
|
|
49
72
|
def natures(*values)
|
50
73
|
if values.size > 0
|
51
74
|
@natures ||= []
|
52
|
-
@natures += values
|
75
|
+
@natures += values.flatten
|
53
76
|
else
|
54
77
|
@natures || (@project.parent ? @project.parent.eclipse.natures : [])
|
55
78
|
end
|
@@ -74,12 +97,32 @@ module Buildr
|
|
74
97
|
def classpath_containers(*values)
|
75
98
|
if values.size > 0
|
76
99
|
@classpath_containers ||= []
|
77
|
-
@classpath_containers += values
|
100
|
+
@classpath_containers += values.flatten
|
78
101
|
else
|
79
102
|
@classpath_containers || (@project.parent ? @project.parent.eclipse.classpath_containers : [])
|
80
103
|
end
|
81
104
|
end
|
82
105
|
|
106
|
+
# :call-seq:
|
107
|
+
# exclude_libs() => [lib1, lib2]
|
108
|
+
# Returns the an array of libraries to be excluded from the generated Eclipse classpath
|
109
|
+
def exclude_libs(*values)
|
110
|
+
if values.size > 0
|
111
|
+
@exclude_libs ||= []
|
112
|
+
@exclude_libs += values.flatten
|
113
|
+
else
|
114
|
+
@exclude_libs || (@project.parent ? @project.parent.eclipse.exclude_libs : [])
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
# :call-seq:
|
119
|
+
# exclude_libs=(lib1, lib2)
|
120
|
+
# Sets libraries to be excluded from the generated Eclipse classpath
|
121
|
+
#
|
122
|
+
def exclude_libs=(libs)
|
123
|
+
@exclude_libs = arrayfy(libs)
|
124
|
+
end
|
125
|
+
|
83
126
|
# :call-seq:
|
84
127
|
# builders=(builders)
|
85
128
|
# Sets the Eclipse project builders on the project.
|
@@ -98,7 +141,7 @@ module Buildr
|
|
98
141
|
def builders(*values)
|
99
142
|
if values.size > 0
|
100
143
|
@builders ||= []
|
101
|
-
@builders += values
|
144
|
+
@builders += values.flatten
|
102
145
|
else
|
103
146
|
@builders || (@project.parent ? @project.parent.eclipse.builders : [])
|
104
147
|
end
|
@@ -147,80 +190,99 @@ module Buildr
|
|
147
190
|
project.recursive_task('eclipse')
|
148
191
|
end
|
149
192
|
|
150
|
-
after_define do |project|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
193
|
+
after_define(:eclipse => :package) do |project|
|
194
|
+
# Need to enhance because using project.projects during load phase of the
|
195
|
+
# buildfile has harmful side-effects on project definition order
|
196
|
+
project.enhance do
|
197
|
+
eclipse = project.task('eclipse')
|
198
|
+
# We don't create the .project and .classpath files if the project contains projects.
|
199
|
+
if project.projects.empty?
|
200
|
+
|
201
|
+
eclipse.enhance [ file(project.path_to('.classpath')), file(project.path_to('.project')) ]
|
202
|
+
|
203
|
+
# The only thing we need to look for is a change in the Buildfile.
|
204
|
+
file(project.path_to('.classpath')=>Buildr.application.buildfile) do |task|
|
205
|
+
if (project.eclipse.natures.reject { |x| x.is_a?(Symbol) }.size > 0)
|
206
|
+
info "Writing #{task.name}"
|
207
|
+
|
208
|
+
m2repo = Buildr::Repositories.instance.local
|
209
|
+
|
210
|
+
File.open(task.name, 'w') do |file|
|
211
|
+
classpathentry = ClasspathEntryWriter.new project, file
|
212
|
+
classpathentry.write do
|
213
|
+
# Note: Use the test classpath since Eclipse compiles both "main" and "test" classes using the same classpath
|
214
|
+
cp = project.test.compile.dependencies.map(&:to_s) - [ project.compile.target.to_s, project.resources.target.to_s ]
|
215
|
+
cp = cp.uniq
|
216
|
+
|
217
|
+
# Convert classpath elements into applicable Project objects
|
218
|
+
cp.collect! { |path| Buildr.projects.detect { |prj| prj.packages.detect { |pkg| pkg.to_s == path } } || path }
|
219
|
+
|
220
|
+
# Remove excluded libs
|
221
|
+
cp -= project.eclipse.exclude_libs.map(&:to_s)
|
222
|
+
|
223
|
+
# project_libs: artifacts created by other projects
|
224
|
+
project_libs, others = cp.partition { |path| path.is_a?(Project) }
|
225
|
+
|
226
|
+
# Separate artifacts under known classpath variable paths
|
227
|
+
# including artifacts located in local Maven2 repository
|
228
|
+
vars = []
|
229
|
+
project.eclipse.classpath_variables.merge(project.eclipse.options.m2_repo_var => m2repo).each do |name, path|
|
230
|
+
matching, others = others.partition { |f| File.expand_path(f.to_s).index(path) == 0 }
|
231
|
+
matching.each do |m|
|
232
|
+
vars << [m, name, path]
|
233
|
+
end
|
234
|
+
end
|
168
235
|
|
169
|
-
|
170
|
-
|
236
|
+
# Generated: Any non-file classpath elements in the project are assumed to be generated
|
237
|
+
libs, generated = others.partition { |path| File.file?(path.to_s) }
|
171
238
|
|
172
|
-
|
173
|
-
|
239
|
+
classpathentry.src project.compile.sources + generated
|
240
|
+
classpathentry.src project.resources
|
174
241
|
|
175
|
-
|
176
|
-
|
242
|
+
if project.test.compile.target
|
243
|
+
classpathentry.src project.test.compile
|
244
|
+
classpathentry.src project.test.resources
|
245
|
+
end
|
177
246
|
|
178
|
-
|
179
|
-
|
247
|
+
# Classpath elements from other projects
|
248
|
+
classpathentry.src_projects project_libs
|
180
249
|
|
181
|
-
|
182
|
-
|
250
|
+
classpathentry.output project.compile.target if project.compile.target
|
251
|
+
classpathentry.lib libs
|
252
|
+
classpathentry.var vars
|
183
253
|
|
184
|
-
|
185
|
-
|
186
|
-
|
254
|
+
project.eclipse.classpath_containers.each { |container|
|
255
|
+
classpathentry.con container
|
256
|
+
}
|
257
|
+
end
|
187
258
|
end
|
188
|
-
|
189
|
-
# Classpath elements from other projects
|
190
|
-
classpathentry.src_projects project_libs
|
191
|
-
|
192
|
-
classpathentry.output project.compile.target if project.compile.target
|
193
|
-
classpathentry.lib libs
|
194
|
-
classpathentry.var m2_libs, project.eclipse.options.m2_repo_var, m2repo
|
195
|
-
|
196
|
-
project.eclipse.classpath_containers.each { |container|
|
197
|
-
classpathentry.con container
|
198
|
-
}
|
199
259
|
end
|
200
260
|
end
|
201
|
-
end
|
202
|
-
end
|
203
261
|
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
262
|
+
# The only thing we need to look for is a change in the Buildfile.
|
263
|
+
file(project.path_to('.project')=>Buildr.application.buildfile) do |task|
|
264
|
+
info "Writing #{task.name}"
|
265
|
+
File.open(task.name, 'w') do |file|
|
266
|
+
xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
|
267
|
+
xml.projectDescription do
|
268
|
+
xml.name project.id
|
269
|
+
xml.projects
|
270
|
+
unless project.eclipse.builders.empty?
|
271
|
+
xml.buildSpec do
|
272
|
+
project.eclipse.builders.each { |builder|
|
273
|
+
xml.buildCommand do
|
274
|
+
xml.name builder
|
275
|
+
end
|
276
|
+
}
|
217
277
|
end
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
278
|
+
end
|
279
|
+
unless project.eclipse.natures.empty?
|
280
|
+
xml.natures do
|
281
|
+
project.eclipse.natures.each { |nature|
|
282
|
+
xml.nature nature unless nature.is_a? Symbol
|
283
|
+
}
|
284
|
+
end
|
285
|
+
end
|
224
286
|
end
|
225
287
|
end
|
226
288
|
end
|
@@ -251,7 +313,7 @@ module Buildr
|
|
251
313
|
|
252
314
|
def lib libs
|
253
315
|
libs.map(&:to_s).sort.uniq.each do |path|
|
254
|
-
@xml.classpathentry :kind=>'lib', :path=>path
|
316
|
+
@xml.classpathentry :kind=>'lib', :path=>relative(path)
|
255
317
|
end
|
256
318
|
end
|
257
319
|
|
@@ -282,24 +344,35 @@ module Buildr
|
|
282
344
|
# * +var_name+ is a variable name as defined in Eclipse (e.g., 'M2_REPO').
|
283
345
|
# * +var_value+ is the value of this variable (e.g., '/home/me/.m2').
|
284
346
|
# E.g., <tt>var([lib1, lib2], 'M2_REPO', '/home/me/.m2/repo')</tt>
|
285
|
-
def var
|
286
|
-
libs.each do |lib_path|
|
347
|
+
def var(libs)
|
348
|
+
libs.each do |lib_path, var_name, var_value|
|
287
349
|
lib_artifact = file(lib_path)
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
350
|
+
relative_lib_path = lib_path.sub(var_value, var_name.to_s)
|
351
|
+
if lib_artifact.respond_to? :sources_artifact
|
352
|
+
source_path = lib_artifact.sources_artifact.to_s
|
353
|
+
relative_source_path = source_path.sub(var_value, var_name)
|
354
|
+
@xml.classpathentry :kind=>'var', :path=>relative_lib_path, :sourcepath=>relative_source_path
|
355
|
+
else
|
356
|
+
@xml.classpathentry :kind=>'var', :path=>relative_lib_path
|
357
|
+
end
|
292
358
|
end
|
293
359
|
end
|
294
360
|
|
295
361
|
private
|
296
362
|
|
297
|
-
# Find a path relative to the project's root directory.
|
363
|
+
# Find a path relative to the project's root directory if possible. If the
|
364
|
+
# two paths do not share the same root the absolute path is returned. This
|
365
|
+
# can happen on Windows, for instance, when the two paths are not on the
|
366
|
+
# same drive.
|
298
367
|
def relative path
|
299
368
|
path or raise "Invalid path '#{path.inspect}'"
|
300
369
|
msg = [:to_path, :to_str, :to_s].find { |msg| path.respond_to? msg }
|
301
370
|
path = path.__send__(msg)
|
302
|
-
|
371
|
+
begin
|
372
|
+
Util.relative_path(File.expand_path(path), @project.path_to)
|
373
|
+
rescue ArgumentError
|
374
|
+
File.expand_path(path)
|
375
|
+
end
|
303
376
|
end
|
304
377
|
|
305
378
|
def src_from_task task
|
@@ -38,9 +38,9 @@ module Buildr
|
|
38
38
|
|
39
39
|
# :java nature explicitly set
|
40
40
|
if eclipse.natures.include? :java
|
41
|
-
eclipse.natures += NATURE unless eclipse.natures.include? NATURE
|
42
|
-
eclipse.classpath_containers += CONTAINER unless eclipse.classpath_containers.include? CONTAINER
|
43
|
-
eclipse.builders += BUILDER unless eclipse.builders.include? BUILDER
|
41
|
+
eclipse.natures += [NATURE] unless eclipse.natures.include? NATURE
|
42
|
+
eclipse.classpath_containers += [CONTAINER] unless eclipse.classpath_containers.include? CONTAINER
|
43
|
+
eclipse.builders += [BUILDER] unless eclipse.builders.include? BUILDER
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|