buildr 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/lib/buildr.rb +2 -3
- data/lib/core/transports.rb +2 -0
- data/lib/java/idea.rb +124 -0
- data/lib/tasks/zip.rb +2 -2
- metadata +10 -9
data/CHANGELOG
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
1.1.3 (6/12/2007)
|
2
|
+
* Added: Long awaited idea project files generation. Very early code, the iml seems to be generated okay but needs testing. The ipr is still missing but will come in due time (and it's not always necessary anyway).
|
3
|
+
*Fixed: Doc bug: unzip doesn't have an into(dir) method.
|
4
|
+
*Fixed: File names don't always have a dot.
|
5
|
+
*Fixed: For Jetty servers, http://foo//bar is not http://foo/bar
|
6
|
+
|
1
7
|
1.1.2 (5/29/2007)
|
2
8
|
* Added: Allow passing :java_args option to the junit task
|
3
9
|
* Added: Hibernate XDoclet and SchemaExport tasks. (Requires buildr/hibernate)
|
data/lib/buildr.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
require "highline"
|
2
|
-
# returning(obj)
|
3
|
-
require "facet/kernel/with"
|
4
2
|
# &:symbol goodness.
|
5
3
|
require "facet/symbol/to_proc"
|
6
4
|
# blank? on string and nil
|
@@ -19,6 +17,7 @@ require "facet/array/head"
|
|
19
17
|
require "facet/string/starts_with"
|
20
18
|
require "facet/openobject"
|
21
19
|
require "facets/core/kernel/tap"
|
20
|
+
require "facets/core/kernel/with"
|
22
21
|
# A different kind of buildr, one we use to create XML.
|
23
22
|
require "builder"
|
24
23
|
|
@@ -32,7 +31,7 @@ end
|
|
32
31
|
|
33
32
|
|
34
33
|
module Buildr
|
35
|
-
VERSION = "1.1.
|
34
|
+
VERSION = "1.1.3"
|
36
35
|
end
|
37
36
|
|
38
37
|
$LOAD_PATH.unshift __DIR__
|
data/lib/core/transports.rb
CHANGED
@@ -188,6 +188,7 @@ module Buildr
|
|
188
188
|
# Squeeze the filename into 30 characters.
|
189
189
|
if file_name.size > 30
|
190
190
|
base, ext = file_name.split(".")
|
191
|
+
ext ||= ""
|
191
192
|
truncated = "#{base[0..26-ext.size]}...#{ext}"
|
192
193
|
else
|
193
194
|
truncated = file_name
|
@@ -312,6 +313,7 @@ module Buildr
|
|
312
313
|
last_modified = File.stat(target).mtime.utc
|
313
314
|
headers = { "If-Modified-Since" => CGI.rfc1123_date(last_modified) }
|
314
315
|
end
|
316
|
+
path = path[1..-1] if path[0..0] == '/'
|
315
317
|
@http.request_get(@base_path + path, headers) do |response|
|
316
318
|
case response
|
317
319
|
when Net::HTTPNotModified
|
data/lib/java/idea.rb
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
require "pathname"
|
2
|
+
require "core/project"
|
3
|
+
require "java/artifact"
|
4
|
+
|
5
|
+
module Buildr
|
6
|
+
|
7
|
+
# Global task "idea" generates artifacts for all projects.
|
8
|
+
desc "Generate Idea artifacts for all projects"
|
9
|
+
Project.local_task "idea"=>"artifacts"
|
10
|
+
|
11
|
+
Project.on_define do |project|
|
12
|
+
idea = project.recursive_task("idea")
|
13
|
+
|
14
|
+
project.enhance do |project|
|
15
|
+
|
16
|
+
# We need paths relative to the top project's base directory.
|
17
|
+
root_path = lambda { |p| f = lambda { |p| p.parent ? f[p.parent] : p.base_dir } ; f[p] }[project]
|
18
|
+
# We want the Eclipse files changed every time the Rakefile changes, but also anything loaded by
|
19
|
+
# the Rakefile (buildr.rb, separate file listing dependencies, etc), so we add anything required
|
20
|
+
# after the Rakefile. So which don't know where Buildr shows up exactly, ignore files that show
|
21
|
+
# in $LOADED_FEATURES that we cannot resolve.
|
22
|
+
sources = ($LOADED_FEATURES - Buildr.instance_eval("@loaded_features_to_ignore")).
|
23
|
+
map { |file| File.expand_path(file) }.select { |file| File.exist?(file) }
|
24
|
+
sources << File.expand_path(Rake.application.rakefile, root_path) if Rake.application.rakefile
|
25
|
+
|
26
|
+
# Only for projects that are packagable.
|
27
|
+
if project.packages.detect { |pkg| pkg.type.to_s =~ /(jar)|(war)|(rar)|(mar)|(aar)/ }
|
28
|
+
task_name = project.path_to("#{project.name.sub(':', '-')}.iml")
|
29
|
+
idea.enhance [ file(task_name) ]
|
30
|
+
|
31
|
+
# The only thing we need to look for is a change in the Rakefile.
|
32
|
+
file(task_name=>sources) do |task|
|
33
|
+
puts "Writing #{task.name}" # if verbose
|
34
|
+
|
35
|
+
# Find a path relative to the project's root directory.
|
36
|
+
relative = lambda do |path|
|
37
|
+
msg = [:to_path, :to_str, :to_s].find { |msg| path.respond_to? msg }
|
38
|
+
path = path.__send__(msg)
|
39
|
+
Pathname.new(path).relative_path_from(Pathname.new(project.path_to)).to_s
|
40
|
+
end
|
41
|
+
|
42
|
+
m2repo = Buildr::Repositories.instance.local
|
43
|
+
excludes = [ '**/.svn/', '**/CVS/' ].join('|')
|
44
|
+
|
45
|
+
# Idea handles modules slightly differently if they're WARs
|
46
|
+
idea_types = {"jar"=>"JAVA_MODULE", "war"=>"J2EE_WEB_MODULE"}
|
47
|
+
idea_types["rar"] = idea_types["mar"] = idea_types["jar"]
|
48
|
+
|
49
|
+
# Note: Use the test classpath since Eclipse compiles both "main" and "test" classes using the same classpath
|
50
|
+
cp = project.test.compile.classpath.map(&:to_s) - [ project.compile.target.to_s ]
|
51
|
+
|
52
|
+
# Convert classpath elements into applicable Project objects
|
53
|
+
cp.collect! { |path| projects.detect { |prj| prj.packages.detect { |pkg| pkg.to_s == path } } || path }
|
54
|
+
|
55
|
+
# project_libs: artifacts created by other projects
|
56
|
+
project_libs, others = cp.partition { |path| path.is_a?(Project) }
|
57
|
+
|
58
|
+
# Separate artifacts from Maven2 repository
|
59
|
+
m2_libs, others = others.partition { |path| path.to_s.index(m2repo) == 0 }
|
60
|
+
|
61
|
+
# Generated: classpath elements in the project are assumed to be generated
|
62
|
+
generated, libs = others.partition { |path| path.to_s.index(project.path_to.to_s) == 0 }
|
63
|
+
|
64
|
+
File.open(task.name, "w") do |file|
|
65
|
+
xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
|
66
|
+
# Project type is going to be the first package type
|
67
|
+
xml.module(:version=>"4", :relativePaths=>"false", :type=>idea_types[project.packages.first.type.to_s]) do
|
68
|
+
|
69
|
+
xml.component :name=>"ModuleRootManager"
|
70
|
+
xml.component "name"=>"NewModuleRootManager", "inherit-compiler-output"=>"false" do
|
71
|
+
xml.output :url=>"file://$MODULE_DIR$/#{relative[project.compile.target]}"
|
72
|
+
|
73
|
+
# TODO project.test.target isn't recognized, what's the proper way to get the test compile path?
|
74
|
+
xml.tag! "output-test", :url=>"file://$MODULE_DIR$/target/test-classes"
|
75
|
+
xml.tag! "exclude-output"
|
76
|
+
|
77
|
+
xml.content do
|
78
|
+
srcs = project.compile.sources.map { |src| relative[src] } + generated.map { |src| relative[src] }
|
79
|
+
srcs.sort.uniq.each do |path|
|
80
|
+
xml.sourceFolder :url=>"file://$MODULE_DIR$/#{path}", :isTestSource=>"false"
|
81
|
+
end
|
82
|
+
test_sources = project.test.compile.sources.map { |src| relative[src] }
|
83
|
+
test_sources.each do |paths|
|
84
|
+
paths.sort.uniq.each do |path|
|
85
|
+
xml.sourceFolder :url=>"file://$MODULE_DIR$/#{path}", :isTestSource=>"true"
|
86
|
+
end
|
87
|
+
end
|
88
|
+
xml.excludeFolder :url=>"file://$MODULE_DIR$/#{relative[project.compile.target]}"
|
89
|
+
end
|
90
|
+
|
91
|
+
xml.orderEntry :type=>"sourceFolder", :forTests=>"false"
|
92
|
+
xml.orderEntry :type=>"inheritedJdk"
|
93
|
+
|
94
|
+
# Classpath elements from other projects
|
95
|
+
project_libs.map(&:id).sort.uniq.each do |project_id|
|
96
|
+
xml.orderEntry :type=>'module', :name=>project_id
|
97
|
+
end
|
98
|
+
|
99
|
+
# Libraries
|
100
|
+
ext_libs = libs.map {|path| "$MODULE_DIR$/#{path.to_s}" } +
|
101
|
+
m2_libs.map { |path| path.to_s.sub(m2repo, "$M2_REPO$") }
|
102
|
+
ext_libs.each do |path|
|
103
|
+
xml.orderEntry :type=>"module-library" do
|
104
|
+
xml.library do
|
105
|
+
xml.CLASSES do
|
106
|
+
xml.root :url=>"jar://#{path}!/"
|
107
|
+
end
|
108
|
+
xml.JAVADOC
|
109
|
+
xml.SOURCES
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
xml.orderEntryProperties
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
end # module Buildr
|
data/lib/tasks/zip.rb
CHANGED
@@ -461,11 +461,11 @@ module Buildr
|
|
461
461
|
# Expands the file relative to that path.
|
462
462
|
#
|
463
463
|
# For example:
|
464
|
-
# unzip("test.jar").
|
464
|
+
# unzip(Dir.pwd=>"test.jar").from_path("etc").include("LICENSE")
|
465
465
|
# will unzip etc/LICENSE into ./LICENSE.
|
466
466
|
#
|
467
467
|
# This is different from:
|
468
|
-
# unzip("test.jar").
|
468
|
+
# unzip(Dir.pwd=>"test.jar").include("etc/LICENSE")
|
469
469
|
# which unzips etc/LICENSE into ./etc/LICENSE.
|
470
470
|
def from_path(name)
|
471
471
|
@paths[name] ||= FromPath.new(name)
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: buildr
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.1.
|
7
|
-
date: 2007-
|
6
|
+
version: 1.1.3
|
7
|
+
date: 2007-06-12 00:00:00 -07:00
|
8
8
|
summary: A build system that doesn't suck
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -30,17 +30,16 @@ authors:
|
|
30
30
|
- Assaf Arkin
|
31
31
|
files:
|
32
32
|
- lib/tasks
|
33
|
-
- lib/core
|
34
|
-
- lib/buildr.rb
|
35
|
-
- lib/buildr
|
36
|
-
- lib/java
|
37
33
|
- lib/tasks/concat.rb
|
38
34
|
- lib/tasks/zip.rb
|
35
|
+
- lib/core
|
39
36
|
- lib/core/transports.rb
|
40
37
|
- lib/core/build.rb
|
41
38
|
- lib/core/project.rb
|
42
39
|
- lib/core/rake_ext.rb
|
43
40
|
- lib/core/common.rb
|
41
|
+
- lib/buildr.rb
|
42
|
+
- lib/buildr
|
44
43
|
- lib/buildr/jetty.rb
|
45
44
|
- lib/buildr/hibernate.rb
|
46
45
|
- lib/buildr/xmlbeans.rb
|
@@ -53,7 +52,9 @@ files:
|
|
53
52
|
- lib/buildr/jetty/JettyWrapper$1.class
|
54
53
|
- lib/buildr/jetty/JettyWrapper$BuildrHandler.class
|
55
54
|
- lib/buildr/jetty/JettyWrapper.class
|
55
|
+
- lib/java
|
56
56
|
- lib/java/test.rb
|
57
|
+
- lib/java/idea.rb
|
57
58
|
- lib/java/eclipse.rb
|
58
59
|
- lib/java/java.rb
|
59
60
|
- lib/java/ant.rb
|
@@ -117,7 +118,7 @@ dependencies:
|
|
117
118
|
requirements:
|
118
119
|
- - "="
|
119
120
|
- !ruby/object:Gem::Version
|
120
|
-
version: 1.1.
|
121
|
+
version: 1.1.1
|
121
122
|
version:
|
122
123
|
- !ruby/object:Gem::Dependency
|
123
124
|
name: net-sftp
|
@@ -153,7 +154,7 @@ dependencies:
|
|
153
154
|
requirements:
|
154
155
|
- - "="
|
155
156
|
- !ruby/object:Gem::Version
|
156
|
-
version: 1.0.
|
157
|
+
version: 1.0.4
|
157
158
|
version:
|
158
159
|
- !ruby/object:Gem::Dependency
|
159
160
|
name: Antwrap
|