buildr 1.4.7-x86-mswin32 → 1.4.8-x86-mswin32
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 +41 -0
- data/Rakefile +0 -6
- data/addon/buildr/bnd.rb +13 -3
- data/addon/buildr/checkstyle.rb +1 -1
- data/addon/buildr/git_auto_version.rb +33 -0
- data/addon/buildr/{gwt.rake → gwt.rb} +0 -0
- data/addon/buildr/jacoco.rb +194 -0
- data/buildr.buildfile +1 -1
- data/buildr.gemspec +23 -16
- data/doc/_layouts/default.html +0 -2
- data/doc/contributing.textile +47 -0
- data/doc/download.textile +24 -0
- data/doc/index.textile +43 -23
- data/doc/languages.textile +65 -6
- data/doc/more_stuff.textile +12 -0
- data/doc/packaging.textile +2 -0
- data/doc/settings_profiles.textile +1 -1
- data/lib/buildr.rb +0 -4
- data/lib/buildr/core/application.rb +41 -8
- data/lib/buildr/core/build.rb +102 -1
- data/lib/buildr/core/cc.rb +14 -8
- data/lib/buildr/core/generate.rb +148 -7
- data/lib/buildr/core/util.rb +3 -3
- data/lib/buildr/ide/eclipse.rb +114 -0
- data/lib/buildr/ide/idea.rb +95 -1
- data/lib/buildr/java/commands.rb +1 -1
- data/lib/buildr/java/rjb.rb +5 -4
- data/lib/buildr/packaging/artifact.rb +1 -1
- data/lib/buildr/packaging/ziptask.rb +2 -2
- data/lib/buildr/scala.rb +1 -1
- data/lib/buildr/scala/bdd.rb +9 -2
- data/lib/buildr/scala/compiler.rb +94 -4
- data/lib/buildr/scala/doc.rb +17 -5
- data/lib/buildr/scala/tests.rb +15 -4
- data/lib/buildr/version.rb +1 -1
- data/rakelib/all-in-one.rake +50 -47
- data/rakelib/checks.rake +4 -4
- data/rakelib/doc.rake +85 -88
- data/rakelib/metrics.rake +9 -9
- data/rakelib/package.rake +13 -34
- data/rakelib/release.rake +11 -12
- data/rakelib/rspec.rake +71 -76
- data/rakelib/stage.rake +25 -51
- data/spec/addon/bnd_spec.rb +61 -7
- data/spec/core/build_spec.rb +117 -0
- data/spec/core/cc_spec.rb +36 -22
- data/spec/core/common_spec.rb +3 -2
- data/spec/core/compile_spec.rb +3 -3
- data/spec/core/generate_from_eclipse_spec.rb +280 -0
- data/spec/java/bdd_spec.rb +2 -2
- data/spec/java/packaging_spec.rb +2 -1
- data/spec/packaging/archive_spec.rb +25 -2
- data/spec/packaging/artifact_spec.rb +2 -2
- data/spec/sandbox.rb +3 -2
- data/spec/scala/compiler_spec.rb +41 -0
- data/spec/scala/doc_spec.rb +22 -3
- data/spec/scala/scala.rb +2 -2
- data/spec/scala/tests_spec.rb +2 -2
- metadata +223 -194
- data/addon/buildr/jdepend.rb.orig +0 -178
- data/doc/installing.textile.orig +0 -282
- data/doc/more_stuff.textile.orig +0 -1004
- data/lib/buildr/ide/eclipse/java.rb +0 -49
- data/lib/buildr/ide/eclipse/plugin.rb +0 -67
- data/lib/buildr/ide/eclipse/scala.rb +0 -64
data/lib/buildr/core/cc.rb
CHANGED
@@ -53,21 +53,27 @@ module Buildr
|
|
53
53
|
build_failed(project, ex)
|
54
54
|
end
|
55
55
|
|
56
|
-
|
56
|
+
srcs = []
|
57
57
|
each_project do |p|
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
srcs += p.compile.sources.map(&:to_s)
|
59
|
+
srcs += p.test.compile.sources.map(&:to_s)
|
60
|
+
srcs += p.resources.sources.map(&:to_s)
|
61
61
|
end
|
62
|
-
if
|
63
|
-
info "Monitoring directory: #{
|
62
|
+
if srcs.length == 1
|
63
|
+
info "Monitoring directory: #{srcs.first}"
|
64
64
|
else
|
65
|
-
info "Monitoring directories: [#{
|
65
|
+
info "Monitoring directories: [#{srcs.join ', '}]"
|
66
66
|
end
|
67
67
|
|
68
68
|
timestamps = lambda do
|
69
69
|
times = {}
|
70
|
-
|
70
|
+
srcs.each do |a|
|
71
|
+
if File.directory? a
|
72
|
+
Dir.glob("#{a}/**/*").map { |f| times[f] = File.mtime f }
|
73
|
+
elsif File.exist? a
|
74
|
+
times[a] = File.mtime a
|
75
|
+
end
|
76
|
+
end
|
71
77
|
times
|
72
78
|
end
|
73
79
|
|
data/lib/buildr/core/generate.rb
CHANGED
@@ -20,7 +20,7 @@ module Buildr
|
|
20
20
|
script = nil
|
21
21
|
choose do |menu|
|
22
22
|
menu.header = "To use Buildr you need a buildfile. Do you want me to create one?"
|
23
|
-
|
23
|
+
menu.choice("From eclipse .project files") { script = Generate.from_eclipse(Dir.pwd).join("\n") } if has_eclipse_project?
|
24
24
|
menu.choice("From maven2 pom file") { script = Generate.from_maven2_pom('pom.xml').join("\n") } if File.exists?("pom.xml")
|
25
25
|
menu.choice("From directory structure") { script = Generate.from_directory(Dir.pwd).join("\n") }
|
26
26
|
menu.choice("Skip") { }
|
@@ -35,14 +35,40 @@ module Buildr
|
|
35
35
|
|
36
36
|
class << self
|
37
37
|
|
38
|
+
def compatibility_option(path)
|
39
|
+
# compile.options.target = '1.5'
|
40
|
+
end
|
41
|
+
|
42
|
+
def get_project_natures(projectFile)
|
43
|
+
return nil unless File.exists?(projectFile)
|
44
|
+
File.open(projectFile) do |f|
|
45
|
+
root = REXML::Document.new(f).root
|
46
|
+
return nil if root == nil
|
47
|
+
natures = root.elements.collect("natures/nature") { |n| n.text }
|
48
|
+
return natures if natures
|
49
|
+
end
|
50
|
+
return nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def get_build_property(path, propertyName)
|
54
|
+
propertiesFile = File.join(path, 'build.properties')
|
55
|
+
return nil unless File.exists?(propertiesFile)
|
56
|
+
inhalt = Hash.from_java_properties(File.read(propertiesFile))
|
57
|
+
binDef = inhalt[propertyName]
|
58
|
+
end
|
59
|
+
|
60
|
+
def has_eclipse_project?
|
61
|
+
candidates = Dir.glob("**/.project")
|
62
|
+
return false if candidates.size == 0
|
63
|
+
candidates.find { |x| get_project_natures(x) }
|
64
|
+
return candidates.size > 0
|
65
|
+
end
|
66
|
+
|
67
|
+
|
38
68
|
HEADER = "# Generated by Buildr #{Buildr::VERSION}, change to your liking\n\n"
|
39
69
|
|
40
|
-
def
|
41
|
-
|
42
|
-
name = File.basename(path)
|
43
|
-
if root
|
44
|
-
script = HEADER.split("\n")
|
45
|
-
header = <<-EOF
|
70
|
+
def getEclipseBuildfileHeader(path, name)
|
71
|
+
x = <<-EOF
|
46
72
|
#{"require 'buildr/scala'\n" if Dir.glob(path + "/**/*.scala").size > 0}
|
47
73
|
#{"require 'buildr/groovy'\n" if Dir.glob(path + "/**/*.groovy").size > 0}
|
48
74
|
# Version number for this release
|
@@ -61,6 +87,121 @@ define "#{name}" do
|
|
61
87
|
project.group = GROUP
|
62
88
|
manifest["Implementation-Vendor"] = COPYRIGHT
|
63
89
|
EOF
|
90
|
+
return x
|
91
|
+
end
|
92
|
+
|
93
|
+
def setLayout(source=nil, output = nil)
|
94
|
+
script = ""
|
95
|
+
if source
|
96
|
+
source = source.sub(/\/$/, '') # remove trailing /
|
97
|
+
script += <<-EOF
|
98
|
+
layout[:source, :main, :java] = "#{source}"
|
99
|
+
layout[:source, :main, :scala] = "#{source}"
|
100
|
+
EOF
|
101
|
+
end
|
102
|
+
if output
|
103
|
+
output = output.sub(/\/$/, '') # remove trailing /
|
104
|
+
script += <<-EOF
|
105
|
+
layout[:target, :main] = "#{output}"
|
106
|
+
layout[:target, :main, :java] = "#{output}"
|
107
|
+
layout[:target, :main, :scala] = "#{output}"
|
108
|
+
EOF
|
109
|
+
end
|
110
|
+
return script
|
111
|
+
end
|
112
|
+
|
113
|
+
# tries to read as much information as needed at the moment from an existing Eclipse workspace
|
114
|
+
# Here are some links to the relevant information
|
115
|
+
# * http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.pde.doc.user/reference/pde_feature_generating_build.htm
|
116
|
+
# * http://wiki.eclipse.org/FAQ_What_is_the_plug-in_manifest_file_%28plugin.xml%29%3F
|
117
|
+
# * http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/bundle_manifest.html
|
118
|
+
# * http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/misc/plugin_manifest.html
|
119
|
+
# * http://help.eclipse.org/juno/index.jsp?topic=/org.eclipse.pde.doc.user/tasks/pde_compilation_env.htm
|
120
|
+
def from_eclipse(path = Dir.pwd, root = true)
|
121
|
+
# We need two passes to be able to determine the dependencies correctly
|
122
|
+
Dir.chdir(path) do
|
123
|
+
name = File.basename(path)
|
124
|
+
dot_projects = []
|
125
|
+
mf = nil # avoid reloading manifest
|
126
|
+
if root
|
127
|
+
@@allProjects = Hash.new
|
128
|
+
@@topDir = File.expand_path(Dir.pwd)
|
129
|
+
script = HEADER.split("\n")
|
130
|
+
script << "require 'buildr/ide/eclipse'"
|
131
|
+
header = getEclipseBuildfileHeader(path, name)
|
132
|
+
script += header.split("\n")
|
133
|
+
script << " # you may see hints about which jars are missing and should resolve them correctly"
|
134
|
+
script << " # dependencies << 'junit should be commented out and replace by correct ARTIFACT definition. Eg"
|
135
|
+
script << " # dependencies << 'junit:junit:jar:3.8.2'"
|
136
|
+
script << setLayout('src', 'bin') # default values for eclipse
|
137
|
+
dot_projects = Dir.glob('**/.project').find_all { |dot_project| get_project_natures(dot_project) }
|
138
|
+
dot_projects.sort.each { |dot_project| from_eclipse(File.dirname(dot_project), false) } if dot_projects
|
139
|
+
else
|
140
|
+
# Skip fragments. Buildr cannot handle it without the help of buildr4osgi
|
141
|
+
return [""] if File.exists?('fragment.xml')
|
142
|
+
projectName = name
|
143
|
+
version = ""
|
144
|
+
mfName = File.join('META-INF', 'MANIFEST.MF')
|
145
|
+
if File.exists?(mfName)
|
146
|
+
mf = Packaging::Java::Manifest.parse(IO.readlines(mfName).join(''))
|
147
|
+
if mf.main['Bundle-SymbolicName']
|
148
|
+
projectName = mf.main['Bundle-SymbolicName'].split(';')[0]
|
149
|
+
bundleVersion = mf.main['Bundle-Version']
|
150
|
+
version = ", :version => \"#{bundleVersion}\"" unless "1.0.0".eql?(bundleVersion)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
# in the first run we just want to know that we exist
|
154
|
+
unless @@allProjects[projectName]
|
155
|
+
@@allProjects[projectName] = Dir.pwd
|
156
|
+
return
|
157
|
+
end
|
158
|
+
base_dir = ""
|
159
|
+
unless File.join(@@topDir, projectName).eql?(File.expand_path(Dir.pwd))
|
160
|
+
base_dir = ", :base_dir => \"#{File.expand_path(Dir.pwd).sub(@@topDir+File::SEPARATOR, '')}\""
|
161
|
+
end
|
162
|
+
script = [%{define "#{projectName}"#{version}#{base_dir} do}]
|
163
|
+
end
|
164
|
+
natures = get_project_natures('.project')
|
165
|
+
if natures && natures.index('org.eclipse.pde.PluginNature')
|
166
|
+
script << " package(:jar)"
|
167
|
+
end
|
168
|
+
if mf && mf.main['Require-Bundle']
|
169
|
+
mf.main['Require-Bundle'].split(',').each do
|
170
|
+
|bundle|
|
171
|
+
requiredName = bundle.split(';')[0]
|
172
|
+
if @@allProjects.has_key?(requiredName)
|
173
|
+
script << " dependencies << projects(\"#{requiredName}\")"
|
174
|
+
else
|
175
|
+
script << " # dependencies << '#{requiredName}'"
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
script << " compile.with dependencies # Add more classpath dependencies" if Dir.glob(File.join('src', '**', '*.java')).size > 0
|
180
|
+
script << " resources" if File.exist?("rsc")
|
181
|
+
sourceProp = get_build_property('.', 'source..')
|
182
|
+
outputProp = get_build_property('.', 'output..')
|
183
|
+
if (sourceProp && !/src\/+/.match(sourceProp)) or (outputProp && !/bin\/+/.match(outputProp))
|
184
|
+
setLayout(sourceProp, outputProp) # default values are overridden in this project
|
185
|
+
end
|
186
|
+
unless dot_projects.empty?
|
187
|
+
script << ""
|
188
|
+
dot_projects.sort.each do |dot_project|
|
189
|
+
next if File.dirname(File.expand_path(dot_project)).eql?(File.expand_path(Dir.pwd))
|
190
|
+
next unless get_project_natures(dot_project)
|
191
|
+
script << from_eclipse(File.dirname(dot_project), false).flatten.map { |line| " " + line } << ""
|
192
|
+
end
|
193
|
+
end
|
194
|
+
script << "end\n\n"
|
195
|
+
script.flatten
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
def from_directory(path = Dir.pwd, root = true)
|
200
|
+
Dir.chdir(path) do
|
201
|
+
name = File.basename(path)
|
202
|
+
if root
|
203
|
+
script = HEADER.split("\n")
|
204
|
+
header = getEclipseBuildfileHeader(path, name)
|
64
205
|
script += header.split("\n")
|
65
206
|
else
|
66
207
|
script = [ %{define "#{name}" do} ]
|
data/lib/buildr/core/util.rb
CHANGED
@@ -308,7 +308,7 @@ if Buildr::Util.java_platform?
|
|
308
308
|
|
309
309
|
module RakeFileUtils #:nodoc:
|
310
310
|
def rake_merge_option(args, defaults)
|
311
|
-
defaults[:verbose] = false if defaults[:verbose] ==
|
311
|
+
defaults[:verbose] = false if defaults[:verbose] == Rake::FileUtilsExt::DEFAULT
|
312
312
|
|
313
313
|
if Hash === args.last
|
314
314
|
defaults.update(args.last)
|
@@ -396,7 +396,7 @@ if Buildr::Util.java_platform?
|
|
396
396
|
ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
|
397
397
|
}
|
398
398
|
end
|
399
|
-
if RakeFileUtils.verbose_flag ==
|
399
|
+
if RakeFileUtils.verbose_flag == Rake::FileUtilsExt::DEFAULT
|
400
400
|
options[:verbose] = false
|
401
401
|
else
|
402
402
|
options[:verbose] ||= RakeFileUtils.verbose_flag
|
@@ -440,7 +440,7 @@ else
|
|
440
440
|
ok or fail "Command failed with status (#{status.exitstatus}): [#{show_command}]"
|
441
441
|
}
|
442
442
|
end
|
443
|
-
if RakeFileUtils.verbose_flag ==
|
443
|
+
if RakeFileUtils.verbose_flag == Rake::FileUtilsExt::DEFAULT
|
444
444
|
options[:verbose] = false
|
445
445
|
else
|
446
446
|
options[:verbose] ||= RakeFileUtils.verbose_flag
|
data/lib/buildr/ide/eclipse.rb
CHANGED
@@ -413,12 +413,126 @@ module Buildr
|
|
413
413
|
end
|
414
414
|
end
|
415
415
|
|
416
|
+
module Plugin
|
417
|
+
include Extension
|
418
|
+
|
419
|
+
NATURE = 'org.eclipse.pde.PluginNature'
|
420
|
+
CONTAINER = 'org.eclipse.pde.core.requiredPlugins'
|
421
|
+
BUILDERS = ['org.eclipse.pde.ManifestBuilder', 'org.eclipse.pde.SchemaBuilder']
|
422
|
+
|
423
|
+
after_define do |project|
|
424
|
+
eclipse = project.eclipse
|
425
|
+
|
426
|
+
# smart defaults
|
427
|
+
if eclipse.natures.empty? && (
|
428
|
+
(File.exists? project.path_to("plugin.xml")) ||
|
429
|
+
(File.exists? project.path_to("OSGI-INF")) ||
|
430
|
+
(File.exists?(project.path_to("META-INF/MANIFEST.MF")) && File.read(project.path_to("META-INF/MANIFEST.MF")).match(/^Bundle-SymbolicName:/)))
|
431
|
+
eclipse.natures = [NATURE, Buildr::Eclipse::Java::NATURE]
|
432
|
+
eclipse.classpath_containers = [CONTAINER, Buildr::Eclipse::Java::CONTAINER] if eclipse.classpath_containers.empty?
|
433
|
+
eclipse.builders = BUILDERS + [Buildr::Eclipse::Java::BUILDER] if eclipse.builders.empty?
|
434
|
+
end
|
435
|
+
|
436
|
+
# :plugin nature explicitly set
|
437
|
+
if eclipse.natures.include? :plugin
|
438
|
+
unless eclipse.natures.include? NATURE
|
439
|
+
# plugin nature must be before java nature
|
440
|
+
eclipse.natures += [Buildr::Eclipse::Java::NATURE] unless eclipse.natures.include? Buildr::Eclipse::Java::NATURE
|
441
|
+
index = eclipse.natures.index(Buildr::Eclipse::Java::NATURE) || -1
|
442
|
+
eclipse.natures = eclipse.natures.insert(index, NATURE)
|
443
|
+
end
|
444
|
+
unless eclipse.classpath_containers.include? CONTAINER
|
445
|
+
# plugin container must be before java container
|
446
|
+
index = eclipse.classpath_containers.index(Buildr::Eclipse::Java::CONTAINER) || -1
|
447
|
+
eclipse.classpath_containers = eclipse.classpath_containers.insert(index, CONTAINER)
|
448
|
+
end
|
449
|
+
unless (eclipse.builders.include?(BUILDERS[0]) && eclipse.builders.include?(BUILDERS[1]))
|
450
|
+
# plugin builder must be before java builder
|
451
|
+
index = eclipse.classpath_containers.index(Buildr::Eclipse::Java::BUILDER) || -1
|
452
|
+
eclipse.builders = eclipse.builders.insert(index, BUILDERS[1]) unless eclipse.builders.include? BUILDERS[1]
|
453
|
+
index = eclipse.classpath_containers.index(BUILDERS[1]) || -1
|
454
|
+
eclipse.builders = eclipse.builders.insert(index, BUILDERS[0]) unless eclipse.builders.include? BUILDERS[0]
|
455
|
+
end
|
456
|
+
end
|
457
|
+
end
|
458
|
+
end
|
459
|
+
|
460
|
+
module Scala
|
461
|
+
include Extension
|
462
|
+
|
463
|
+
NATURE = 'ch.epfl.lamp.sdt.core.scalanature'
|
464
|
+
CONTAINER = 'ch.epfl.lamp.sdt.launching.SCALA_CONTAINER'
|
465
|
+
BUILDER = 'ch.epfl.lamp.sdt.core.scalabuilder'
|
466
|
+
|
467
|
+
after_define :eclipse => :eclipse_scala
|
468
|
+
after_define :eclipse_scala do |project|
|
469
|
+
eclipse = project.eclipse
|
470
|
+
# smart defaults
|
471
|
+
if eclipse.natures.empty? && (project.compile.language == :scala || project.test.compile.language == :scala)
|
472
|
+
eclipse.natures = [NATURE, Buildr::Eclipse::Java::NATURE]
|
473
|
+
eclipse.classpath_containers = [CONTAINER, Buildr::Eclipse::Java::CONTAINER] if eclipse.classpath_containers.empty?
|
474
|
+
eclipse.builders = BUILDER if eclipse.builders.empty?
|
475
|
+
eclipse.exclude_libs += Buildr::Scala::Scalac.dependencies
|
476
|
+
end
|
477
|
+
|
478
|
+
# :scala nature explicitly set
|
479
|
+
if eclipse.natures.include? :scala
|
480
|
+
unless eclipse.natures.include? NATURE
|
481
|
+
# scala nature must be before java nature
|
482
|
+
eclipse.natures += [Buildr::Eclipse::Java::NATURE] unless eclipse.natures.include? Buildr::Eclipse::Java::NATURE
|
483
|
+
index = eclipse.natures.index(Buildr::Eclipse::Java::NATURE) || -1
|
484
|
+
eclipse.natures = eclipse.natures.insert(index, NATURE)
|
485
|
+
end
|
486
|
+
unless eclipse.classpath_containers.include? CONTAINER
|
487
|
+
# scala container must be before java container
|
488
|
+
index = eclipse.classpath_containers.index(Buildr::Eclipse::Java::CONTAINER) || -1
|
489
|
+
eclipse.classpath_containers = eclipse.classpath_containers.insert(index, CONTAINER)
|
490
|
+
end
|
491
|
+
unless eclipse.builders.include? BUILDER
|
492
|
+
# scala builder overrides java builder
|
493
|
+
eclipse.builders -= [Buildr::Eclipse::Java::BUILDER]
|
494
|
+
eclipse.builders += [BUILDER]
|
495
|
+
end
|
496
|
+
eclipse.exclude_libs += Buildr::Scala::Scalac.dependencies
|
497
|
+
end
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
501
|
+
module Java
|
502
|
+
include Extension
|
503
|
+
|
504
|
+
NATURE = 'org.eclipse.jdt.core.javanature'
|
505
|
+
CONTAINER = 'org.eclipse.jdt.launching.JRE_CONTAINER'
|
506
|
+
BUILDER = 'org.eclipse.jdt.core.javabuilder'
|
507
|
+
|
508
|
+
after_define do |project|
|
509
|
+
eclipse = project.eclipse
|
510
|
+
|
511
|
+
# smart defaults
|
512
|
+
if project.compile.language == :java || project.test.compile.language == :java
|
513
|
+
eclipse.natures = NATURE if eclipse.natures.empty?
|
514
|
+
eclipse.classpath_containers = CONTAINER if eclipse.classpath_containers.empty?
|
515
|
+
eclipse.builders = BUILDER if eclipse.builders.empty?
|
516
|
+
end
|
517
|
+
|
518
|
+
# :java nature explicitly set
|
519
|
+
if eclipse.natures.include? :java
|
520
|
+
eclipse.natures += [NATURE] unless eclipse.natures.include? NATURE
|
521
|
+
eclipse.classpath_containers += [CONTAINER] unless eclipse.classpath_containers.include? CONTAINER
|
522
|
+
eclipse.builders += [BUILDER] unless eclipse.builders.include? BUILDER
|
523
|
+
end
|
524
|
+
end
|
525
|
+
end
|
526
|
+
|
416
527
|
end
|
417
528
|
|
418
529
|
end # module Buildr
|
419
530
|
|
420
531
|
class Buildr::Project
|
421
532
|
include Buildr::Eclipse
|
533
|
+
include Buildr::Eclipse::Plugin
|
534
|
+
include Buildr::Eclipse::Scala
|
535
|
+
include Buildr::Eclipse::Java
|
422
536
|
end
|
423
537
|
|
424
538
|
|
data/lib/buildr/ide/idea.rb
CHANGED
@@ -268,7 +268,8 @@ module Buildr
|
|
268
268
|
url_base = options[:url_base] || "/"
|
269
269
|
default_webroots = [buildr_project._(:source, :main, :webapp)]
|
270
270
|
webroots = options[:webroots] || default_webroots
|
271
|
-
|
271
|
+
default_web_xml = "#{buildr_project._(:source, :main, :webapp)}/WEB-INF/web.xml"
|
272
|
+
web_xml = options[:web_xml] || default_web_xml
|
272
273
|
version = options[:version] || "3.0"
|
273
274
|
|
274
275
|
add_facet(name, "web") do |f|
|
@@ -611,6 +612,77 @@ module Buildr
|
|
611
612
|
end
|
612
613
|
end
|
613
614
|
|
615
|
+
def add_exploded_ear_artifact(project, options ={})
|
616
|
+
|
617
|
+
artifact_name = options[:name] || project.iml.id
|
618
|
+
build_on_make = options[:build_on_make].nil? ? true : options[:build_on_make]
|
619
|
+
|
620
|
+
add_artifact(artifact_name, "exploded-ear", build_on_make) do |xml|
|
621
|
+
dependencies = (options[:dependencies] || ([project] + project.compile.dependencies)).flatten
|
622
|
+
libraries, projects = partition_dependencies(dependencies)
|
623
|
+
|
624
|
+
## The content here can not be indented
|
625
|
+
output_dir = options[:output_dir] || project._(:artifacts, artifact_name)
|
626
|
+
xml.tag!('output-path', output_dir)
|
627
|
+
|
628
|
+
xml.root :id => "root" do
|
629
|
+
|
630
|
+
xml.element :id => "module-output", :name => project.iml.id
|
631
|
+
|
632
|
+
projects.each do |p|
|
633
|
+
xml.element :id => "directory", :name => p.iml.id do
|
634
|
+
xml.element :id => "module-output", :name => p.iml.id
|
635
|
+
end
|
636
|
+
end
|
637
|
+
|
638
|
+
xml.element :id => "directory", :name => "lib" do
|
639
|
+
libraries.each(&:invoke).map(&:to_s).each do |dependency_path|
|
640
|
+
xml.element :id => "file-copy", :path => resolve_path(dependency_path)
|
641
|
+
end
|
642
|
+
end
|
643
|
+
|
644
|
+
end
|
645
|
+
end
|
646
|
+
end
|
647
|
+
|
648
|
+
def add_exploded_ejb_artifact(project, options = {})
|
649
|
+
|
650
|
+
artifact_name = options[:name] || project.iml.id
|
651
|
+
build_on_make = options[:build_on_make].nil? ? true : options[:build_on_make]
|
652
|
+
|
653
|
+
add_artifact(artifact_name, "exploded-ejb", build_on_make) do |xml|
|
654
|
+
dependencies = (options[:dependencies] || ([project] + project.compile.dependencies)).flatten
|
655
|
+
libraries, projects = partition_dependencies(dependencies)
|
656
|
+
|
657
|
+
## The content here can not be indented
|
658
|
+
output_dir = options[:output_dir] || project._(:artifacts, artifact_name)
|
659
|
+
xml.tag!('output-path', output_dir)
|
660
|
+
|
661
|
+
xml.root :id => "root" do
|
662
|
+
|
663
|
+
xml.element :id => "module-output", :name => project.iml.id
|
664
|
+
|
665
|
+
if options[:enable_jpa]
|
666
|
+
module_names = options[:jpa_module_names] || [project.iml.id]
|
667
|
+
module_names.each do |module_name|
|
668
|
+
facet_name = options[:jpa_facet_name] || "JPA"
|
669
|
+
xml.element :id => "jpa-descriptors", :facet => "#{module_name}/jpa/#{facet_name}"
|
670
|
+
end
|
671
|
+
end
|
672
|
+
|
673
|
+
if options[:enable_ejb].nil? || options[:enable_ejb]
|
674
|
+
module_names = options[:ejb_module_names] || [project.iml.id]
|
675
|
+
module_names.each do |module_name|
|
676
|
+
facet_name = options[:ejb_facet_name] || "EJB"
|
677
|
+
xml.element :id => "javaee-facet-resources", :facet => "#{module_name}/ejb/#{facet_name}"
|
678
|
+
end
|
679
|
+
end
|
680
|
+
|
681
|
+
end
|
682
|
+
end
|
683
|
+
end
|
684
|
+
|
685
|
+
|
614
686
|
def add_gwt_configuration(launch_page, project, options = {})
|
615
687
|
name = options[:name] || "Run #{launch_page}"
|
616
688
|
shell_parameters = options[:shell_parameters] || ""
|
@@ -727,6 +799,28 @@ module Buildr
|
|
727
799
|
def resolve_path(path)
|
728
800
|
resolve_path_from_base(path, "$PROJECT_DIR$")
|
729
801
|
end
|
802
|
+
|
803
|
+
private
|
804
|
+
|
805
|
+
def partition_dependencies(dependencies)
|
806
|
+
libraries = []
|
807
|
+
projects = []
|
808
|
+
|
809
|
+
dependencies.each do |dependency|
|
810
|
+
artifacts = Buildr.artifacts(dependency)
|
811
|
+
artifacts_as_strings = artifacts.map(&:to_s)
|
812
|
+
project = Buildr.projects.detect do |project|
|
813
|
+
[project.packages, project.compile.target, project.resources.target, project.test.compile.target, project.test.resources.target].flatten.
|
814
|
+
detect { |component| artifacts_as_strings.include?(component.to_s) }
|
815
|
+
end
|
816
|
+
if project
|
817
|
+
projects << project
|
818
|
+
else
|
819
|
+
libraries += artifacts
|
820
|
+
end
|
821
|
+
end
|
822
|
+
return libraries.uniq, projects.uniq
|
823
|
+
end
|
730
824
|
end
|
731
825
|
|
732
826
|
module ProjectExtension
|