rant 0.4.6 → 0.4.8
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/INSTALL +44 -0
- data/NEWS +30 -0
- data/README +6 -46
- data/Rantfile +38 -7
- data/doc/c.rdoc +2 -0
- data/doc/command.rdoc +210 -0
- data/doc/examples/c_dependencies/Rantfile +1 -1
- data/doc/examples/directedrule/Rantfile +1 -1
- data/doc/homepage/index.html +12 -1
- data/doc/rant-import.rdoc +5 -0
- data/doc/rant_vs_rake.rdoc +107 -0
- data/doc/rantfile.rdoc +17 -17
- data/doc/rubyproject.rdoc +45 -45
- data/doc/subdirs.rdoc +1 -1
- data/lib/rant/coregen.rb +62 -22
- data/lib/rant/import/archive.rb +1 -0
- data/lib/rant/import/command.rb +206 -0
- data/lib/rant/import/nodes/default.rb +12 -6
- data/lib/rant/import/nodes/signed.rb +3 -3
- data/lib/rant/import/signedfile.rb +14 -15
- data/lib/rant/import/win32/rubycmdwrapper.rb +1 -0
- data/lib/rant/import.rb +52 -4
- data/lib/rant/metautils.rb +119 -0
- data/lib/rant/node.rb +11 -2
- data/lib/rant/rantenv.rb +5 -2
- data/lib/rant/rantlib.rb +30 -46
- data/lib/rant/rantsys.rb +81 -13
- data/lib/rant/rantvar.rb +1 -76
- data/lib/rant.rb +2 -2
- data/misc/TODO +21 -0
- data/test/deprecated/test_0_5_2.rb +28 -0
- data/test/deprecated/test_0_6_0.rb +24 -0
- data/test/dyn_dependencies.rf +25 -0
- data/test/import/command/Rantfile +102 -0
- data/test/import/command/test_command.rb +597 -0
- data/test/rant-import/test_rant-import.rb +23 -1
- data/test/rule.rf +2 -0
- data/test/test_dyn_dependencies.rb +45 -0
- data/test/test_env.rb +5 -4
- data/test/test_filelist.rb +60 -3
- data/test/test_rant_interface.rb +5 -0
- data/test/test_sys.rb +53 -2
- data/test/tutil.rb +14 -6
- metadata +17 -6
- data/test/deprecated/test_0_4_8.rb +0 -41
data/INSTALL
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
|
2
|
+
== Installing Rant
|
3
|
+
|
4
|
+
Of course you need Ruby to run rant. You can get the latest Ruby
|
5
|
+
package from the {Ruby hompage}[http://www.ruby-lang.org/en/].
|
6
|
+
|
7
|
+
There are two ways to install Rant on your system:
|
8
|
+
|
9
|
+
=== Installing Rant as a RubyGem
|
10
|
+
|
11
|
+
RubyGems has to be installed on your system. Check this by trying
|
12
|
+
the _gem_ command:
|
13
|
+
% gem
|
14
|
+
If this prints a help message, RubyGems should work. Otherwise
|
15
|
+
install Rant as described in the next section.
|
16
|
+
Now the following command:
|
17
|
+
% gem install --remote rant
|
18
|
+
will download and install Rant. Depending on the RubyGems
|
19
|
+
configuration, you will probably need superuser privileges.
|
20
|
+
Then try to run:
|
21
|
+
% rant --version
|
22
|
+
which should print name and version of the _rant_ command. If this
|
23
|
+
is done, you have successfully installed Rant. Congratulations!
|
24
|
+
|
25
|
+
=== Conventional installation
|
26
|
+
|
27
|
+
First download the latest version of Rant from
|
28
|
+
http://rubyforge.org/frs/?group_id=615. Choose the .zip or .tar.gz
|
29
|
+
file, whatever you like, with the highest version number. Then unpack
|
30
|
+
the archive, cd to the new directory and run the install.rb script.
|
31
|
+
This could look like:
|
32
|
+
% tar -xzf rant-<version>.tar.gz
|
33
|
+
% cd rant-<version>
|
34
|
+
% ruby install.rb
|
35
|
+
Depending on your Ruby installation, you'll probably need superuser
|
36
|
+
privileges for the last command.
|
37
|
+
Finally try to run
|
38
|
+
% rant --version
|
39
|
+
to verify Rant was installed correctly.
|
40
|
+
|
41
|
+
If you aren't already reading this documentation in html format, you
|
42
|
+
can generate it with:
|
43
|
+
% rant doc
|
44
|
+
The output will be in doc/html.
|
data/NEWS
CHANGED
@@ -1,6 +1,36 @@
|
|
1
1
|
|
2
2
|
= Rant NEWS
|
3
3
|
|
4
|
+
== Rant 0.4.8
|
5
|
+
|
6
|
+
Incompatible changes:
|
7
|
+
* The filenames <tt>Rantfile.rb</tt> and <tt>rantfile.rb</tt> which
|
8
|
+
were deprecated since the last release aren't recognized anymore.
|
9
|
+
Use +Rantfile+, +rantfile+ or <tt>root.rant</tt> instead.
|
10
|
+
|
11
|
+
Deprecated:
|
12
|
+
* The two undocumented Array methods <tt>ary.arglist</tt> and
|
13
|
+
<tt>ary.shell_pathes</tt> are deprecated. Use <tt>sys.sp(ary)</tt>
|
14
|
+
in Rantfiles instead.
|
15
|
+
* <tt>rant-import -v</tt> option. Use <tt>-V</tt> or
|
16
|
+
<tt>--version</tt> instead.
|
17
|
+
|
18
|
+
Fixes and minor improvements:
|
19
|
+
* Fix output of <tt>rant -T</tt> for descriptions with more than two lines.
|
20
|
+
* Filelists: Same handling of files starting with a dot with all
|
21
|
+
supported ruby versions (1.8.0 - 1.9).
|
22
|
+
* The <tt>sys.ruby</tt> method uses an absolute path to start the Ruby
|
23
|
+
interpreter. Thus <tt>sys.ruby</tt> also works if ruby is not on the
|
24
|
+
PATH.
|
25
|
+
* Fix for latest ruby 1.9, which renamed +fcall+ to +funcall+.
|
26
|
+
|
27
|
+
New features:
|
28
|
+
* <tt>rant-import</tt> supports <tt>--zip</tt> (<tt>-z</tt>) option
|
29
|
+
for zip-compression now.
|
30
|
+
* Tasks with command change recognition. Read
|
31
|
+
doc/command.rdoc[link:files/doc/command_rdoc.html]
|
32
|
+
* Improved rule support.
|
33
|
+
|
4
34
|
== Rant 0.4.6
|
5
35
|
|
6
36
|
Incompatible changes:
|
data/README
CHANGED
@@ -18,6 +18,7 @@ Rant currently features:
|
|
18
18
|
additional software.
|
19
19
|
* Optional recognition of file changes based on MD5 checksums instead
|
20
20
|
of file modification times.
|
21
|
+
* Tasks with command change recognition.
|
21
22
|
* Primitive support for compiling C# sources portably with csc, cscc
|
22
23
|
and mcs.
|
23
24
|
* Dependency checking for C/C++ source files.
|
@@ -41,7 +42,7 @@ Running rant in the directory of this file:
|
|
41
42
|
will ensure that the "data" file in the "backup" directory is up to
|
42
43
|
date.
|
43
44
|
|
44
|
-
This document was written for version 0.4.
|
45
|
+
This document was written for version 0.4.8 of Rant. Most things
|
45
46
|
described here will work for older/newer versions of Rant, but look at
|
46
47
|
the README file in the Rant distribution you've installed for exact
|
47
48
|
documentation of your Rant version.
|
@@ -62,7 +63,7 @@ mailto:langstefan@gmx.at.
|
|
62
63
|
== Roadmap
|
63
64
|
|
64
65
|
Installing Rant::
|
65
|
-
read
|
66
|
+
read INSTALL[link:files/INSTALL.html]
|
66
67
|
License::
|
67
68
|
read the section _Copying_ in this document
|
68
69
|
Invoking *rant*::
|
@@ -83,6 +84,8 @@ Compiling C/C++::
|
|
83
84
|
read doc/c.rdoc[link:files/doc/c_rdoc.html]
|
84
85
|
Buildfiles in subdirectories::
|
85
86
|
read doc/subdirs.rdoc[link:files/doc/subdirs_rdoc.html]
|
87
|
+
Tasks with command change recognition::
|
88
|
+
read doc/command.rdoc[link:files/doc/command_rdoc.html]
|
86
89
|
Using the Configure plugin::
|
87
90
|
read doc/configure.rdoc[link:files/doc/configure_rdoc.html]
|
88
91
|
Compiling C#::
|
@@ -91,50 +94,6 @@ Upgrading::
|
|
91
94
|
read the NEWS[link:files/NEWS.html] for new features, not
|
92
95
|
backwards compatible changes and other issues.
|
93
96
|
|
94
|
-
== Installation
|
95
|
-
|
96
|
-
Of course you need Ruby to run rant. You can get the latest Ruby
|
97
|
-
package from the {Ruby hompage}[http://www.ruby-lang.org/en/].
|
98
|
-
|
99
|
-
There are two ways to install Rant on your system:
|
100
|
-
|
101
|
-
=== Installing Rant as a RubyGem
|
102
|
-
|
103
|
-
RubyGems has to be installed on your system. Check this by trying
|
104
|
-
the _gem_ command:
|
105
|
-
% gem
|
106
|
-
If this prints a help message, RubyGems should work. Otherwise
|
107
|
-
install Rant as described in the next section.
|
108
|
-
Now the following command:
|
109
|
-
% gem install --remote rant
|
110
|
-
will download and install Rant. Depending on the RubyGems
|
111
|
-
configuration, you will probably need superuser privileges.
|
112
|
-
Then try to run:
|
113
|
-
% rant --version
|
114
|
-
which should print name and version of the _rant_ command. If this
|
115
|
-
is done, you have successfully installed Rant. Congratulations!
|
116
|
-
|
117
|
-
=== Conventional installation
|
118
|
-
|
119
|
-
First download the latest version of Rant from
|
120
|
-
http://rubyforge.org/frs/?group_id=615. Choose the .zip or .tar.gz
|
121
|
-
file, whatever you like, with the highest version number. Then unpack
|
122
|
-
the archive, cd to the new directory and run the install.rb script.
|
123
|
-
This could look like:
|
124
|
-
% tar -xzf rant-<version>.tar.gz
|
125
|
-
% cd rant-<version>
|
126
|
-
% ruby install.rb
|
127
|
-
Depending on your Ruby installation, you'll probably need superuser
|
128
|
-
privileges for the last command.
|
129
|
-
Finally try to run
|
130
|
-
% rant --version
|
131
|
-
to verify Rant was installed correctly.
|
132
|
-
|
133
|
-
If you aren't already reading this documentation in html format, you
|
134
|
-
can generate it with:
|
135
|
-
% rant doc
|
136
|
-
The output will be in doc/html.
|
137
|
-
|
138
97
|
== Copying
|
139
98
|
|
140
99
|
Copyright (C) 2005 Stefan Lang
|
@@ -215,6 +174,7 @@ Rant was tested on:
|
|
215
174
|
1.8.1
|
216
175
|
1.8.2
|
217
176
|
1.8.3
|
177
|
+
1.8.4
|
218
178
|
1.9
|
219
179
|
MacOS X 1.8.2
|
220
180
|
Windows XP 1.8.2 (OneClick Installer)
|
data/Rantfile
CHANGED
@@ -9,10 +9,9 @@ task :default => :test
|
|
9
9
|
dist_files = sys["{bin,lib,test,doc,misc}/**/*"]
|
10
10
|
dist_files.shun("html", "coverage")
|
11
11
|
dist_files += sys["*"].no_dir.exclude("InstalledFiles", "Session.vim")
|
12
|
-
dist_files.exclude("bench-*")
|
12
|
+
dist_files.exclude("mk", "bench-*")
|
13
13
|
hp_files = sys["doc/homepage/*"]
|
14
|
-
|
15
|
-
extra_rdoc_files.no_dir("pkg").no_dir("test")
|
14
|
+
rdoc_files = sys["README", "NEWS", "INSTALL", "doc/*.rdoc"]
|
16
15
|
|
17
16
|
# remove when compiler stuff is getting useful...
|
18
17
|
dist_files.exclude "lib/rant/compiler*", "lib/rant/import/c/program.rb"
|
@@ -20,7 +19,7 @@ dist_files.exclude "lib/rant/compiler*", "lib/rant/import/c/program.rb"
|
|
20
19
|
rdoc_opts = %w(-S -c UTF-8 --title Rant --main README)
|
21
20
|
|
22
21
|
gen RubyPackage, "rant#{var :pkg_ext}" do |t|
|
23
|
-
t.version = `#{Env::
|
22
|
+
t.version = `#{sys.sp Env::RUBY_EXE} run_rant --version`.split[1]
|
24
23
|
t.summary = "Rant is a Ruby based build tool."
|
25
24
|
t.files = dist_files
|
26
25
|
t.bindir = "bin"
|
@@ -29,7 +28,8 @@ gen RubyPackage, "rant#{var :pkg_ext}" do |t|
|
|
29
28
|
t.email = "langstefan@gmx.at"
|
30
29
|
t.rubyforge_project = "make"
|
31
30
|
t.homepage = "http://make.rubyforge.org"
|
32
|
-
t.
|
31
|
+
t.has_rdoc = false
|
32
|
+
t.gem_extra_rdoc_files = rdoc_files
|
33
33
|
t.gem_rdoc_options = rdoc_opts
|
34
34
|
desc "Create packages for distribution."
|
35
35
|
t.package_task
|
@@ -39,7 +39,7 @@ desc "Generate documentation."
|
|
39
39
|
gen RubyDoc do |g|
|
40
40
|
g.verbose = true
|
41
41
|
g.dir = "doc/html"
|
42
|
-
g.files
|
42
|
+
g.files = rdoc_files
|
43
43
|
g.opts = rdoc_opts + %w(-T doc/jamis.rb)
|
44
44
|
end
|
45
45
|
|
@@ -139,7 +139,12 @@ end
|
|
139
139
|
task :t180 do |t|
|
140
140
|
# my installed testrb version doesn't work with ruby-1.8.0
|
141
141
|
sys.cd "test"
|
142
|
-
|
142
|
+
if var[:TEST]
|
143
|
+
sys "ruby180", "-rtest/unit", "-I", sys.expand_path("@lib"),
|
144
|
+
"-I", sys.expand_path("."), var[:TEST].sub(/^test\//, '')
|
145
|
+
else
|
146
|
+
sys "ruby180 ts_all.rb"
|
147
|
+
end
|
143
148
|
end
|
144
149
|
|
145
150
|
desc "Remove autogenerated files."
|
@@ -189,4 +194,30 @@ task "svn-clean" do
|
|
189
194
|
}
|
190
195
|
end
|
191
196
|
|
197
|
+
task "check-168" do
|
198
|
+
rbfiles = sys["bin/rant*", "lib/**/*.rb"]
|
199
|
+
ok = []
|
200
|
+
bad = []
|
201
|
+
rbfiles.each { |fn|
|
202
|
+
sys "ruby168 -c #{fn}" do |ps|
|
203
|
+
(ps.exitstatus == 0 ? ok : bad) << fn
|
204
|
+
end
|
205
|
+
}
|
206
|
+
puts "Bad files:"
|
207
|
+
bad.each { |b| puts " #{b}" }
|
208
|
+
puts "#{ok.size} of #{rbfiles.size} are OK"
|
209
|
+
end
|
210
|
+
|
211
|
+
task "fetch-svn-dump" do
|
212
|
+
require 'net/http'
|
213
|
+
require 'uri'
|
214
|
+
url = URI.parse("http://svn.berlios.de/svndumps/rant-repos.gz")
|
215
|
+
req = Net::HTTP::Get.new(url.path)
|
216
|
+
puts "Starting download from: #{url}"
|
217
|
+
res = Net::HTTP.start(url.host, url.port) { |http|
|
218
|
+
http.request(req)
|
219
|
+
}
|
220
|
+
sys.write_to_file "../rant-repos.gz", res.body
|
221
|
+
end
|
222
|
+
|
192
223
|
# vim:ft=ruby
|
data/doc/c.rdoc
CHANGED
@@ -60,5 +60,7 @@ Rantfile basics::
|
|
60
60
|
doc/rantfile.rdoc[link:files/doc/rantfile_rdoc.html]
|
61
61
|
Advanced Rantfiles::
|
62
62
|
doc/advanced.rdoc[link:files/doc/advanced_rdoc.html]
|
63
|
+
Tasks with command change recognition::
|
64
|
+
doc/command.rdoc[link:files/doc/command_rdoc.html]
|
63
65
|
Rant Overview::
|
64
66
|
README[link:files/README.html]
|
data/doc/command.rdoc
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
|
2
|
+
== Command change recognition
|
3
|
+
|
4
|
+
A +Command+ task is similar to a +file+ task: It is intended to create
|
5
|
+
on file which may depend on other files. But instead of creating the
|
6
|
+
file by executing a block of Ruby code, the +Command+ task creates the
|
7
|
+
target file by executing a shell command.
|
8
|
+
|
9
|
+
A +file+ task rebuilds the target file if at least one of the
|
10
|
+
following two conditions is met:
|
11
|
+
1. The target file doesn't exist.
|
12
|
+
2. One of the prerequisites changed since the last build.
|
13
|
+
|
14
|
+
A +Command+ task rebuilds the target file if at least one of the
|
15
|
+
following three conditions is met:
|
16
|
+
1. The target file doesn't exist.
|
17
|
+
2. One of the prerequisites changed since the last build.
|
18
|
+
3. The command to create the target file changed since the last build.
|
19
|
+
|
20
|
+
=== General usage
|
21
|
+
|
22
|
+
Consider the following Rantfile for rant 0.4.6:
|
23
|
+
|
24
|
+
var :CFLAGS => "-g -O2" # can be overriden from commandline
|
25
|
+
|
26
|
+
file "foo" => ["foo.o", "util.o"] do |t|
|
27
|
+
sys "cc -o #{t.name} #{var :CFLAGS} #{t.prerequisites.join(' ')}"
|
28
|
+
end
|
29
|
+
|
30
|
+
gen Rule, ".o" => ".c" do |t|
|
31
|
+
sys "cc -c -o #{t.name} #{var :CFLAGS} #{t.source}"
|
32
|
+
end
|
33
|
+
|
34
|
+
The problem with this buildfile is, that it won't recognize
|
35
|
+
a change of CFLAGS, i.e. foo.o, util.o and foo should get
|
36
|
+
rebuilt whenever CFLAGS changes.
|
37
|
+
|
38
|
+
Since Rant 0.4.8, it is possible to do the following:
|
39
|
+
|
40
|
+
import "command"
|
41
|
+
|
42
|
+
var :CFLAGS => "-g -O2" # can be overriden from commandline
|
43
|
+
|
44
|
+
gen Command, "foo" => ["foo.o", "util.o"] do |t|
|
45
|
+
# notice: we're not calling the sys method, we
|
46
|
+
# are returning a string from the block
|
47
|
+
"cc -o #{t.name} #{var :CFLAGS} #{t.prerequisites.join(' ')}"
|
48
|
+
end
|
49
|
+
|
50
|
+
# if the block to Rule takes two arguments,
|
51
|
+
# it is expected to return a task
|
52
|
+
gen Rule, ".o" => ".c" do |target, sources|
|
53
|
+
gen Command, target => sources do |t|
|
54
|
+
"cc -c -o #{t.name} #{var :CFLAGS} #{t.source}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
Now, whenever the command to build foo or a *.o file changes,
|
59
|
+
it will be rebuilt.
|
60
|
+
|
61
|
+
There is also a more concise syntax:
|
62
|
+
|
63
|
+
import "command"
|
64
|
+
|
65
|
+
var :CFLAGS => "-g -O2"
|
66
|
+
|
67
|
+
# first argument (string) is the task/file name, second
|
68
|
+
# argument (string, array or filelist) is a list of
|
69
|
+
# prerequisites (notice: no `target => prereqs' syntax!)
|
70
|
+
# third argument is a command string, which will be
|
71
|
+
# executed by a subshell.
|
72
|
+
gen Command, "foo", ["foo.o", "util.o"],
|
73
|
+
'cc -o $(>) $[CFLAGS] $(<)'
|
74
|
+
|
75
|
+
gen Rule, ".o" => ".c" do |target, sources|
|
76
|
+
gen Command, target, sources,
|
77
|
+
'cc -c -o $(<) $[CFLAGS] $(-)'
|
78
|
+
end
|
79
|
+
|
80
|
+
For the last syntax:
|
81
|
+
|
82
|
+
=== Interpolation of variables into command strings:
|
83
|
+
|
84
|
+
==== Which variables are interpolated?
|
85
|
+
|
86
|
+
1. Instance variables (mostly for internal usage), e.g.:
|
87
|
+
@cc = "cc"
|
88
|
+
|
89
|
+
2. "var" variables (can be set from commandline, easy
|
90
|
+
synchronization with environment variables), e.g.:
|
91
|
+
var :cc => "cc"
|
92
|
+
|
93
|
+
3. Special, task specific variables
|
94
|
+
"name" (symbol equivalent ">")::
|
95
|
+
task name
|
96
|
+
"prerequisites" (symbol equivalent "<")::
|
97
|
+
all prerequisites seperated by spaces
|
98
|
+
"source" (symbol equivalent "-")::
|
99
|
+
first prerequisite
|
100
|
+
more task specific variables might get added later
|
101
|
+
|
102
|
+
==== Syntax of variable interpolation
|
103
|
+
|
104
|
+
Variable names must consist only of "word characters",
|
105
|
+
i.e. matching \w in Ruby regexes.
|
106
|
+
|
107
|
+
1. Plain interpolation.
|
108
|
+
Example command:
|
109
|
+
"echo $[ARGS]"
|
110
|
+
The contents of variable ARGS (either <tt>@ARGS</tt> or
|
111
|
+
<tt>var[:ARGS]</tt>) are converted to a string and interpolated.
|
112
|
+
If the variable contains an array, <tt>ARGS.join(' ')</tt> is
|
113
|
+
interpolated.
|
114
|
+
|
115
|
+
2. Escaped interpolation.
|
116
|
+
Example command:
|
117
|
+
"echo ${ARGS}"
|
118
|
+
Like plain interpolation, but spaces will be escaped
|
119
|
+
(system dependent).
|
120
|
+
Consider this Rantfile:
|
121
|
+
|
122
|
+
import "command"
|
123
|
+
@args = ["a b", "c d", "ef"]
|
124
|
+
@sh_puts = "ruby -e \"puts ARGV\""
|
125
|
+
gen Command, "foo", '$[sh_puts] ${args} > $(>)'
|
126
|
+
|
127
|
+
Running rant will give on Windows:
|
128
|
+
ruby -e "puts ARGV" "a b" "c d" ef > foo
|
129
|
+
and on other systems:
|
130
|
+
ruby -e "puts ARGV" a\ b c\ d ef > foo
|
131
|
+
|
132
|
+
3. Path interpolation.
|
133
|
+
Example command:
|
134
|
+
"echo $(ARGS)"
|
135
|
+
Like escaped interpolation, but additionally, forward slashes
|
136
|
+
(as used for filenames in Rantfiles) will be replaced with
|
137
|
+
backslashes on Windows.
|
138
|
+
|
139
|
+
==== More on semantics of variable interpolation
|
140
|
+
|
141
|
+
Interpolation is recursive, except for special target variables.
|
142
|
+
|
143
|
+
There is a small semantic difference between the verbose
|
144
|
+
special target variables (+name+ +prerequisites+ +source+) and
|
145
|
+
the symbolic ones (<tt><</tt> <tt>></tt> <tt>-</tt>):
|
146
|
+
The symbolic ones are interpolated *after* checking if the command
|
147
|
+
has changed since the last build, the verbose forms are interpolated
|
148
|
+
*before*.
|
149
|
+
|
150
|
+
Consider this (artifical, using the Unix tool "cat") example:
|
151
|
+
Rantfile (symbolic special target vars):
|
152
|
+
|
153
|
+
import "command"
|
154
|
+
@src = ["src1", "src2"]
|
155
|
+
@src = var[:SRC].split if var[:SRC]
|
156
|
+
gen Command, "foo", @src, 'cat $(<) > $(>)'
|
157
|
+
|
158
|
+
% echo a > src1
|
159
|
+
% echo b > src2
|
160
|
+
% echo b > src3
|
161
|
+
% rant
|
162
|
+
cat src1 src2 > foo
|
163
|
+
|
164
|
+
"foo" didn't exist, so it was built anyway. Now let us
|
165
|
+
change the prerequisite list:
|
166
|
+
|
167
|
+
% rant "SRC=src1 src3"
|
168
|
+
|
169
|
+
won't cause a rebuild of foo. Dependencies of foo changed from
|
170
|
+
<tt>["src1", "src2"]</tt> to <tt>["src1", "src3"]</tt> but since src2
|
171
|
+
and src3 have the same content and <tt>$(<)</tt> isn't expanded for
|
172
|
+
command change recognition, rant considers foo up to date.
|
173
|
+
|
174
|
+
Now change Rantfile to (verbose special target vars):
|
175
|
+
|
176
|
+
import "command"
|
177
|
+
@src = ["src1", "src2"]
|
178
|
+
@src = var[:SRC].split if var[:SRC]
|
179
|
+
gen Command, "foo", @src, 'cat $(prerequisites) > $(name)'
|
180
|
+
|
181
|
+
Starting from scratch:
|
182
|
+
% echo a > src1
|
183
|
+
% echo b > src2
|
184
|
+
% echo b > src3
|
185
|
+
% rant
|
186
|
+
cat src1 src2 > foo
|
187
|
+
% rant "SRC=src1 src3"
|
188
|
+
cat src1 src3 > foo
|
189
|
+
|
190
|
+
This time, Rant expanded <tt>$(prerequisites)</tt> for command change
|
191
|
+
recognition, and since the prerequsite list changed, it caused a
|
192
|
+
rebuild.
|
193
|
+
|
194
|
+
== See also
|
195
|
+
|
196
|
+
If you want more details, look in the <tt>test/import/command</tt>
|
197
|
+
directory of the Rant distribution.
|
198
|
+
|
199
|
+
Using MD5 checksums instead of file modification times::
|
200
|
+
doc/md5.rdoc[link:files/doc/md5_rdoc.html]
|
201
|
+
Advanced Rantfiles::
|
202
|
+
doc/advanced.rdoc[link:files/doc/advanced_rdoc.html]
|
203
|
+
Support for C/C++::
|
204
|
+
doc/c.rdoc[link:files/doc/c_rdoc.html]
|
205
|
+
Packaging::
|
206
|
+
doc/package.rdoc[link:files/doc/package_rdoc.html]
|
207
|
+
Ruby project howto::
|
208
|
+
doc/rubyproject.rdoc[link:files/doc/rubyproject_rdoc.html]
|
209
|
+
Rant Overview::
|
210
|
+
README[link:files/README.html]
|
@@ -3,7 +3,7 @@ import %w(c/dependencies clean autoclean)
|
|
3
3
|
|
4
4
|
desc "Compile hello world program."
|
5
5
|
file "hello" => %w(src/main.o src/util.o) do |t|
|
6
|
-
sys "cc -Wall -o #{t.name} #{t.prerequisites
|
6
|
+
sys "cc -Wall -o #{t.name} #{sys.sp t.prerequisites}"
|
7
7
|
end
|
8
8
|
|
9
9
|
gen Rule, :o => :c do |t|
|
data/doc/homepage/index.html
CHANGED
@@ -80,7 +80,7 @@
|
|
80
80
|
<h2>Links</h2>
|
81
81
|
<p>
|
82
82
|
<a href="files/NEWS.html">ChangeLog</a><br/>
|
83
|
-
|
83
|
+
<!--a href="api.html">API docs</a><br/-->
|
84
84
|
<a href="http://rubyforge.org/projects/make/">Project page</a><br/>
|
85
85
|
<a title="Subscribe to mailing list"
|
86
86
|
href="http://rubyforge.org/mailman/listinfo/make-cafe">Mailing list</a><br/>
|
@@ -88,6 +88,8 @@
|
|
88
88
|
href="http://rubyforge.org/pipermail/make-cafe/">List archives</a><br/>
|
89
89
|
<a
|
90
90
|
href="http://rubyforge.org/tracker/?func=add&group_id=615&atid=2428">Report a bug</a><br/>
|
91
|
+
<a title="Subversion repository for Rant development"
|
92
|
+
href="http://developer.berlios.de/svn/?group_id=5046">Repository</a><br/>
|
91
93
|
</p>
|
92
94
|
</div>
|
93
95
|
|
@@ -101,12 +103,21 @@
|
|
101
103
|
before installing a newer version of Rant. It describes
|
102
104
|
non-backwards compatible changes and new features.
|
103
105
|
</p>
|
106
|
+
<h2>Rant vs. Rake</h2>
|
107
|
+
<p>
|
108
|
+
<a href="files/doc/rant_vs_rake_rdoc.html">Read comparison</a>
|
109
|
+
</p>
|
104
110
|
</div>
|
105
111
|
|
106
112
|
<p>
|
107
113
|
<a href="http://validator.w3.org/check?uri=referer"><img
|
108
114
|
src="http://www.w3.org/Icons/valid-xhtml10"
|
109
115
|
alt="Valid XHTML 1.0!" height="31" width="88" /></a>
|
116
|
+
<a href="http://developer.berlios.de" title="BerliOS
|
117
|
+
Developer"> <img
|
118
|
+
src="http://developer.berlios.de/bslogo.php?group_id=5046"
|
119
|
+
width="124px" height="32px" border="0" alt="BerliOS
|
120
|
+
Developer Logo"></a>
|
110
121
|
</p>
|
111
122
|
|
112
123
|
<!-- BlueRobot was here. -->
|
data/doc/rant-import.rdoc
CHANGED
@@ -8,11 +8,14 @@ run rant-import).
|
|
8
8
|
|
9
9
|
Just run the command with the <tt>--help</tt> option to get a brief
|
10
10
|
help message:
|
11
|
+
|
11
12
|
% rant-import --help
|
12
13
|
|
13
14
|
Probably the easiest way to create your monolithic rant script is with
|
14
15
|
the <tt>--auto</tt> option:
|
16
|
+
|
15
17
|
% rant-import --auto ant
|
18
|
+
|
16
19
|
This will write a monolithic rant script to the file +ant+ in the
|
17
20
|
current directory. To determine which plugins and imports your project
|
18
21
|
is using, it performs step 2 of the rant command as described in
|
@@ -20,7 +23,9 @@ doc/rant.rdoc[link:files/doc/rant_rdoc.html], which means that it
|
|
20
23
|
loads the Rantfile in the current directory.
|
21
24
|
|
22
25
|
That one command should be enough, try it out:
|
26
|
+
|
23
27
|
% ruby ant
|
28
|
+
|
24
29
|
This script has the same behaviour as the rant command. Distribute it
|
25
30
|
with your project and nobody else but you needs an Rant installation.
|
26
31
|
|
@@ -0,0 +1,107 @@
|
|
1
|
+
|
2
|
+
== Rant vs. Rake
|
3
|
+
|
4
|
+
Since many people (especially Ruby programmers) that know Rake ask for
|
5
|
+
a Rake/Rant comparison, I'll spend a few paragraphs on this topic.
|
6
|
+
|
7
|
+
This comparison is for Rant 0.4.8 and Rake 0.6.2. If not stated
|
8
|
+
otherwise, this document assumes a standard Ruby 1.8/1.9 installation
|
9
|
+
without additional libraries (except for Rant and Rake).
|
10
|
+
|
11
|
+
=== Feature comparison
|
12
|
+
|
13
|
+
Generally speaking, Rant has all major features of Rake and more.
|
14
|
+
Especially the following major Rant features aren't available for
|
15
|
+
Rake:
|
16
|
+
|
17
|
+
* Optional use of MD5 checksums instead of timestamps.
|
18
|
+
To enable it, one import statement at the top of the Rantfile is
|
19
|
+
enough:
|
20
|
+
|
21
|
+
import "md5"
|
22
|
+
|
23
|
+
* Easy and portable tgz/zip file creation on Linux/MacOS X/Windows
|
24
|
+
(and probably most other platforms where ruby runs). No additional
|
25
|
+
libraries necessary!
|
26
|
+
|
27
|
+
* Create a script, tailored to the needs of a project, which
|
28
|
+
can be used instead of an Rant installation => Distribute this
|
29
|
+
script with your project and users and other developers don't need
|
30
|
+
an Rant installation.
|
31
|
+
|
32
|
+
Try the <tt>rant-import</tt> command:
|
33
|
+
|
34
|
+
% rant-import --auto make.rb
|
35
|
+
|
36
|
+
rant-import reads the Rantfile in the current directory, determines
|
37
|
+
what code of the Rant distribution (and custom imports) is needed
|
38
|
+
and writes a script that supports all required Rant features and
|
39
|
+
depends only on a standard Ruby (1.8.0 or newer) installation to the
|
40
|
+
file <tt>make.rb</tt>. Users and other developers don't need an Rant
|
41
|
+
installation anymore. Instead of typing:
|
42
|
+
|
43
|
+
% rant foo
|
44
|
+
|
45
|
+
they can type:
|
46
|
+
|
47
|
+
% ruby make.rb foo
|
48
|
+
|
49
|
+
* It is possible to split up the build specification into
|
50
|
+
multiple files in different directories. (=> no such thing as
|
51
|
+
"recursive make" necessary).
|
52
|
+
|
53
|
+
* Dependency checking for C/C++ source files (integrated makedepend
|
54
|
+
replacement).
|
55
|
+
|
56
|
+
* The <tt>--force-run</tt> (<tt>-a</tt>) option forces the rebuild of
|
57
|
+
a target and all its dependencies. E.g.:
|
58
|
+
|
59
|
+
% rant -a foo
|
60
|
+
|
61
|
+
Let's say +foo+ depends on <tt>foo.o</tt> and <tt>util.o</tt>. Then
|
62
|
+
the above command will cause a rebuild of <tt>foo.o</tt>,
|
63
|
+
<tt>util.o</tt> and +foo+, no matter if Rant considers these files
|
64
|
+
up to date or not.
|
65
|
+
|
66
|
+
* Tasks with command change recognition. Example code:
|
67
|
+
|
68
|
+
import "command"
|
69
|
+
|
70
|
+
var :CFLAGS => "-g -O2" # can be overridden from commandline
|
71
|
+
|
72
|
+
gen Command, "foo", ["foo.o", "util.o"],
|
73
|
+
"cc $[CFLAGS] -o $(name) $(prerequisites)"
|
74
|
+
|
75
|
+
The last two lines tell Rant, that the file +foo+ depends on the
|
76
|
+
files <tt>foo.o</tt> and <tt>util.o</tt> and that +foo+ can be built
|
77
|
+
by running the command in the last line ("cc ...") in a subshell.
|
78
|
+
If at least one of the following three conditions is met, +foo+ will
|
79
|
+
be rebuilt:
|
80
|
+
1. +foo+ doesn't exist.
|
81
|
+
2. <tt>foo.o</tt> or <tt>util.o</tt> changed since the last build of
|
82
|
+
+foo+.
|
83
|
+
3. The command (most probably +CFLAGS+) changed since the last build
|
84
|
+
of +foo+.
|
85
|
+
|
86
|
+
Some other goodies: The +make+ method, the SubFile and AutoClean
|
87
|
+
tasks, special variables and more. Most of this is documented in
|
88
|
+
doc/advanced.rdoc[link:files/doc/advanced_rdoc.html]
|
89
|
+
|
90
|
+
=== Internals
|
91
|
+
|
92
|
+
* Rake defines many methods (task, file, desc, FileUtils methods, etc.)
|
93
|
+
in the Object class (i.e. accessible from *each* line of Ruby code)
|
94
|
+
which can get problematic at least if you want to use Rake as a
|
95
|
+
library.
|
96
|
+
|
97
|
+
Rant solves this problem by evaluating Rantfiles in a special
|
98
|
+
context (with +instance_eval+).
|
99
|
+
|
100
|
+
* Rake uses global variables and class/class instance variables to
|
101
|
+
store state (tasks, etc.). The effect of this is, that you can have
|
102
|
+
only one Rake application per Ruby interpreter (process) at a time.
|
103
|
+
|
104
|
+
Rant stores application state in a class instance. It is possible to
|
105
|
+
instantiate as many "Rant applications" at the same time as needed.
|
106
|
+
On the other hand, there is currently no public and documented
|
107
|
+
interface to do so (but it will come at least with Rant 1.0.0).
|