-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
71 lines (50 loc) · 2.31 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Purpose of this project:
Seamless integration between Rake and Ant environments.
Quick Start:
To run examples cd into samples and do a command-line like:
jruby -I../lib simple_compile.rb
Also the top-level Rakefile also uses these features to build the
ant tasks so just running 'jruby -S rake' will use the ant features.
Lastly, if you want to play with the <rake/> task, you can run ant
itself in the project directory:
CLASSPATH=lib/jruby-complete.jar ant call-rakefile-setup
CLASSPATH=lib/jruby-complete.jar ant call-rakefile
The first example calls a low-level task in the Rakefile called setup.
The second example calls default which will end up calling compile. This
example is a little more trippy than the others since it is actually using
ant tasks to run javac.
As should be apparent in the previous examples, you need a copy of jruby-
complete.jar to run these targets. Put it into the project lib dir.
More info:
1. Allow Rakefiles to call ant tasks
ant.java(:classname => "org.hsqldb.util.DatabaseManager", :fork => "yes") do
classpath :refid => "project.class.path"
arg :value => "-driver"
arg :value => "org.hsqldb.jdbcDriver"
arg :value => "-url"
arg :value => "jdbc:hsqldb:#{data_dir}/music"
arg :value => "-user"
arg :value => "sa"
end
2. Allow Rakefiles to be executed from ant. The first task is merely
a callout task:
<rake/>
<rake file="Rakefile"/>
<rake file="Rakefile" task="compile"/>
This just runs a rakefile and executes a Rake task. If you omit the optional
parameters then it will use the file 'Rakefile' and the task 'default'.
The second task allows you to import all your rake tasks as ant targets.
This allows you to mix and match between ant targets and rake tasks using
ants target dependency management:
<rake_import file="Rakefile"/>
If your ant build.xml has compile and it depends on setup and setup is
defined in your Rakefile then compile will call setup as a dependency.
3. The same as number 2, but the other direction:
Invoke ant:
ant '-f build.xml my_target'
This just executes ant as a command. You can also pass in an array if
you so desire:
args = ['-f', 'my_build.xml', 'my_target1']
ant args
Import ant targets into rake:
ant_import 'build.xml'