rake-ant 1.0.0
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.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +6 -0
- data/LICENSE +242 -0
- data/README.md +27 -0
- data/Rakefile +9 -0
- data/lib/ant.rb +1 -0
- data/lib/rake/ant.rb +65 -0
- data/lib/rake/ant/ant.rb +224 -0
- data/lib/rake/ant/element.rb +101 -0
- data/lib/rake/ant/project_converter.rb +100 -0
- data/lib/rake/ant/rake.rb +11 -0
- data/lib/rake/ant/target.rb +119 -0
- data/lib/rake/ant/tasks/raketasks.rb +29 -0
- data/lib/rake/ant/version.rb +5 -0
- data/rake-ant.gemspec +22 -0
- metadata +88 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: b268b6305910ec56200c3b3a4696252e55d71723432ed22c0b715d3d8eb5968b
|
|
4
|
+
data.tar.gz: fd5f7135ab14cf3ac350a77a51f565fd06014aca88c73ce9e9392c6bc676d4ec
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: '09b50775cc53fe00fcf6a728e6f5d2fa2a68cb43c9265203e3191ba64f6a0990a7e4e0561662cb0aea42edf2476e70e1223fb30d671969d15feeebd29754b46e'
|
|
7
|
+
data.tar.gz: '029787593404e745253840ff29ee98ff49e4203e0d28da9da274db2e6634ea6dfcab68b5ff98296c97590ef22cde31d882c9c766ee26a1b4e763cb04984d0909'
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
Eclipse Public License - v 1.0
|
|
2
|
+
|
|
3
|
+
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
|
|
4
|
+
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
|
|
5
|
+
OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
|
|
6
|
+
|
|
7
|
+
1. DEFINITIONS
|
|
8
|
+
|
|
9
|
+
"Contribution" means:
|
|
10
|
+
|
|
11
|
+
a) in the case of the initial Contributor, the initial code and
|
|
12
|
+
documentation distributed under this Agreement, and
|
|
13
|
+
|
|
14
|
+
b) in the case of each subsequent Contributor:
|
|
15
|
+
|
|
16
|
+
i) changes to the Program, and
|
|
17
|
+
|
|
18
|
+
ii) additions to the Program;
|
|
19
|
+
where such changes and/or additions to the Program
|
|
20
|
+
originate from and are distributed by that particular
|
|
21
|
+
Contributor. A Contribution 'originates' from a
|
|
22
|
+
Contributor if it was added to the Program by such
|
|
23
|
+
Contributor itself or anyone acting on such
|
|
24
|
+
Contributor's behalf. Contributions do not include
|
|
25
|
+
additions to the Program which: (i) are separate modules
|
|
26
|
+
of software distributed in conjunction with the Program
|
|
27
|
+
under their own license agreement, and (ii) are not
|
|
28
|
+
derivative works of the Program.
|
|
29
|
+
|
|
30
|
+
"Contributor" means any person or entity that distributes the Program.
|
|
31
|
+
|
|
32
|
+
"Licensed Patents" mean patent claims licensable by a Contributor
|
|
33
|
+
which are necessarily infringed by the use or sale of its
|
|
34
|
+
Contribution alone or when combined with the Program.
|
|
35
|
+
|
|
36
|
+
"Program" means the Contributions distributed in accordance with
|
|
37
|
+
this Agreement.
|
|
38
|
+
|
|
39
|
+
"Recipient" means anyone who receives the Program under this
|
|
40
|
+
Agreement, including all Contributors.
|
|
41
|
+
|
|
42
|
+
2. GRANT OF RIGHTS
|
|
43
|
+
|
|
44
|
+
a) Subject to the terms of this Agreement, each Contributor
|
|
45
|
+
hereby grants Recipient a non-exclusive, worldwide,
|
|
46
|
+
royalty-free copyright license to reproduce, prepare
|
|
47
|
+
derivative works of, publicly display, publicly perform,
|
|
48
|
+
distribute and sublicense the Contribution of such
|
|
49
|
+
Contributor, if any, and such derivative works, in source
|
|
50
|
+
code and object code form.
|
|
51
|
+
|
|
52
|
+
b) Subject to the terms of this Agreement, each Contributor
|
|
53
|
+
hereby grants Recipient a non-exclusive, worldwide,
|
|
54
|
+
royalty-free patent license under Licensed Patents to make,
|
|
55
|
+
use, sell, offer to sell, import and otherwise transfer the
|
|
56
|
+
Contribution of such Contributor, if any, in source code and
|
|
57
|
+
object code form. This patent license shall apply to the
|
|
58
|
+
combination of the Contribution and the Program if, at the
|
|
59
|
+
time the Contribution is added by the Contributor, such
|
|
60
|
+
addition of the Contribution causes such combination to be
|
|
61
|
+
covered by the Licensed Patents. The patent license shall not
|
|
62
|
+
apply to any other combinations which include the
|
|
63
|
+
Contribution. No hardware per se is licensed hereunder.
|
|
64
|
+
|
|
65
|
+
c) Recipient understands that although each Contributor grants
|
|
66
|
+
the licenses to its Contributions set forth herein, no
|
|
67
|
+
assurances are provided by any Contributor that the Program
|
|
68
|
+
does not infringe the patent or other intellectual property
|
|
69
|
+
rights of any other entity. Each Contributor disclaims any
|
|
70
|
+
liability to Recipient for claims brought by any other entity
|
|
71
|
+
based on infringement of intellectual property rights or
|
|
72
|
+
otherwise. As a condition to exercising the rights and
|
|
73
|
+
licenses granted hereunder, each Recipient hereby assumes
|
|
74
|
+
sole responsibility to secure any other intellectual property
|
|
75
|
+
rights needed, if any. For example, if a third party patent
|
|
76
|
+
license is required to allow Recipient to distribute the
|
|
77
|
+
Program, it is Recipient's responsibility to acquire that
|
|
78
|
+
license before distributing the Program.
|
|
79
|
+
|
|
80
|
+
d) Each Contributor represents that to its knowledge it has
|
|
81
|
+
sufficient copyright rights in its Contribution, if any, to
|
|
82
|
+
grant the copyright license set forth in this Agreement.
|
|
83
|
+
|
|
84
|
+
3. REQUIREMENTS
|
|
85
|
+
|
|
86
|
+
A Contributor may choose to distribute the Program in object code
|
|
87
|
+
form under its own license agreement, provided that:
|
|
88
|
+
|
|
89
|
+
a) it complies with the terms and conditions of this Agreement; and
|
|
90
|
+
|
|
91
|
+
b) its license agreement:
|
|
92
|
+
|
|
93
|
+
i) effectively disclaims on behalf of all Contributors all
|
|
94
|
+
warranties and conditions, express and implied, including
|
|
95
|
+
warranties or conditions of title and non-infringement,
|
|
96
|
+
and implied warranties or conditions of merchantability
|
|
97
|
+
and fitness for a particular purpose;
|
|
98
|
+
|
|
99
|
+
ii) effectively excludes on behalf of all Contributors all
|
|
100
|
+
liability for damages, including direct, indirect,
|
|
101
|
+
special, incidental and consequential damages, such as
|
|
102
|
+
lost profits;
|
|
103
|
+
|
|
104
|
+
iii) states that any provisions which differ from this
|
|
105
|
+
Agreement are offered by that Contributor alone and not
|
|
106
|
+
by any other party; and
|
|
107
|
+
|
|
108
|
+
iv) states that source code for the Program is available
|
|
109
|
+
from such Contributor, and informs licensees how to
|
|
110
|
+
obtain it in a reasonable manner on or through a medium
|
|
111
|
+
customarily used for software exchange.
|
|
112
|
+
|
|
113
|
+
When the Program is made available in source code form:
|
|
114
|
+
|
|
115
|
+
a) it must be made available under this Agreement; and
|
|
116
|
+
|
|
117
|
+
b) a copy of this Agreement must be included with each copy of
|
|
118
|
+
the Program.
|
|
119
|
+
|
|
120
|
+
Contributors may not remove or alter any copyright notices contained
|
|
121
|
+
within the Program.
|
|
122
|
+
|
|
123
|
+
Each Contributor must identify itself as the originator of its
|
|
124
|
+
Contribution, if any, in a manner that reasonably allows subsequent
|
|
125
|
+
Recipients to identify the originator of the Contribution.
|
|
126
|
+
|
|
127
|
+
4. COMMERCIAL DISTRIBUTION
|
|
128
|
+
|
|
129
|
+
Commercial distributors of software may accept certain
|
|
130
|
+
responsibilities with respect to end users, business partners and
|
|
131
|
+
the like. While this license is intended to facilitate the
|
|
132
|
+
commercial use of the Program, the Contributor who includes the
|
|
133
|
+
Program in a commercial product offering should do so in a manner
|
|
134
|
+
which does not create potential liability for other Contributors.
|
|
135
|
+
Therefore, if a Contributor includes the Program in a commercial
|
|
136
|
+
product offering, such Contributor ("Commercial Contributor") hereby
|
|
137
|
+
agrees to defend and indemnify every other Contributor ("Indemnified
|
|
138
|
+
Contributor") against any losses, damages and costs (collectively
|
|
139
|
+
"Losses") arising from claims, lawsuits and other legal actions
|
|
140
|
+
brought by a third party against the Indemnified Contributor to the
|
|
141
|
+
extent caused by the acts or omissions of such Commercial
|
|
142
|
+
Contributor in connection with its distribution of the Program in a
|
|
143
|
+
commercial product offering. The obligations in this section do not
|
|
144
|
+
apply to any claims or Losses relating to any actual or alleged
|
|
145
|
+
intellectual property infringement. In order to qualify, an
|
|
146
|
+
Indemnified Contributor must: a) promptly notify the Commercial
|
|
147
|
+
Contributor in writing of such claim, and b) allow the Commercial
|
|
148
|
+
Contributor to control, and cooperate with the Commercial
|
|
149
|
+
Contributor in, the defense and any related settlement negotiations.
|
|
150
|
+
The Indemnified Contributor may participate in any such claim at its
|
|
151
|
+
own expense.
|
|
152
|
+
|
|
153
|
+
For example, a Contributor might include the Program in a commercial
|
|
154
|
+
product offering, Product X. That Contributor is then a Commercial
|
|
155
|
+
Contributor. If that Commercial Contributor then makes performance
|
|
156
|
+
claims, or offers warranties related to Product X, those performance
|
|
157
|
+
claims and warranties are such Commercial Contributor's
|
|
158
|
+
responsibility alone. Under this section, the Commercial Contributor
|
|
159
|
+
would have to defend claims against the other Contributors related
|
|
160
|
+
to those performance claims and warranties, and if a court requires
|
|
161
|
+
any other Contributor to pay any damages as a result, the Commercial
|
|
162
|
+
Contributor must pay those damages.
|
|
163
|
+
|
|
164
|
+
5. NO WARRANTY
|
|
165
|
+
|
|
166
|
+
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
|
|
167
|
+
PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
|
168
|
+
ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
|
|
169
|
+
ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
|
|
170
|
+
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient
|
|
171
|
+
is solely responsible for determining the appropriateness of using
|
|
172
|
+
and distributing the Program and assumes all risks associated with
|
|
173
|
+
its exercise of rights under this Agreement , including but not
|
|
174
|
+
limited to the risks and costs of program errors, compliance with
|
|
175
|
+
applicable laws, damage to or loss of data, programs or equipment,
|
|
176
|
+
and unavailability or interruption of operations.
|
|
177
|
+
|
|
178
|
+
6. DISCLAIMER OF LIABILITY
|
|
179
|
+
|
|
180
|
+
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
|
|
181
|
+
NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
|
|
182
|
+
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
183
|
+
(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON
|
|
184
|
+
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
|
|
185
|
+
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
|
186
|
+
THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
|
|
187
|
+
GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
188
|
+
DAMAGES.
|
|
189
|
+
|
|
190
|
+
7. GENERAL
|
|
191
|
+
|
|
192
|
+
If any provision of this Agreement is invalid or unenforceable under
|
|
193
|
+
applicable law, it shall not affect the validity or enforceability
|
|
194
|
+
of the remainder of the terms of this Agreement, and without further
|
|
195
|
+
action by the parties hereto, such provision shall be reformed to
|
|
196
|
+
the minimum extent necessary to make such provision valid and
|
|
197
|
+
enforceable.
|
|
198
|
+
|
|
199
|
+
If Recipient institutes patent litigation against any entity
|
|
200
|
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
|
201
|
+
the Program itself (excluding combinations of the Program with other
|
|
202
|
+
software or hardware) infringes such Recipient's patent(s), then
|
|
203
|
+
such Recipient's rights granted under Section 2(b) shall terminate
|
|
204
|
+
as of the date such litigation is filed.
|
|
205
|
+
|
|
206
|
+
All Recipient's rights under this Agreement shall terminate if it
|
|
207
|
+
fails to comply with any of the material terms or conditions of this
|
|
208
|
+
Agreement and does not cure such failure in a reasonable period of
|
|
209
|
+
time after becoming aware of such noncompliance. If all Recipient's
|
|
210
|
+
rights under this Agreement terminate, Recipient agrees to cease use
|
|
211
|
+
and distribution of the Program as soon as reasonably practicable.
|
|
212
|
+
However, Recipient's obligations under this Agreement and any
|
|
213
|
+
licenses granted by Recipient relating to the Program shall continue
|
|
214
|
+
and survive.
|
|
215
|
+
|
|
216
|
+
Everyone is permitted to copy and distribute copies of this
|
|
217
|
+
Agreement, but in order to avoid inconsistency the Agreement is
|
|
218
|
+
copyrighted and may only be modified in the following manner. The
|
|
219
|
+
Agreement Steward reserves the right to publish new versions
|
|
220
|
+
(including revisions) of this Agreement from time to time. No one
|
|
221
|
+
other than the Agreement Steward has the right to modify this
|
|
222
|
+
Agreement. The Eclipse Foundation is the initial Agreement Steward.
|
|
223
|
+
The Eclipse Foundation may assign the responsibility to serve as the
|
|
224
|
+
Agreement Steward to a suitable separate entity. Each new version of
|
|
225
|
+
the Agreement will be given a distinguishing version number. The
|
|
226
|
+
Program (including Contributions) may always be distributed subject
|
|
227
|
+
to the version of the Agreement under which it was received. In
|
|
228
|
+
addition, after a new version of the Agreement is published,
|
|
229
|
+
Contributor may elect to distribute the Program (including its
|
|
230
|
+
Contributions) under the new version. Except as expressly stated in
|
|
231
|
+
Sections 2(a) and 2(b) above, Recipient receives no rights or
|
|
232
|
+
licenses to the intellectual property of any Contributor under this
|
|
233
|
+
Agreement, whether expressly, by implication, estoppel or otherwise.
|
|
234
|
+
All rights in the Program not expressly granted under this Agreement
|
|
235
|
+
are reserved.
|
|
236
|
+
|
|
237
|
+
This Agreement is governed by the laws of the State of New York and
|
|
238
|
+
the intellectual property laws of the United States of America. No
|
|
239
|
+
party to this Agreement will bring a legal action under this
|
|
240
|
+
Agreement more than one year after the cause of action arose. Each
|
|
241
|
+
party waives its rights to a jury trial in any resulting litigation.
|
|
242
|
+
|
data/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Rake::Ant
|
|
2
|
+
|
|
3
|
+
This package provides a wrapper and Rake tasks for using Ant from any Rake build.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'rake-ant'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install rake-ant
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Add usage info.
|
|
24
|
+
|
|
25
|
+
## Contributing
|
|
26
|
+
|
|
27
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jruby/rake-ant.
|
data/Rakefile
ADDED
data/lib/ant.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'rake/ant'
|
data/lib/rake/ant.rb
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
require "rake/ant/version"
|
|
2
|
+
|
|
3
|
+
class Rake::Ant
|
|
4
|
+
def self.load_from_ant
|
|
5
|
+
IO.popen("#{ant_script} -diagnostics") do |diag|
|
|
6
|
+
classpath_jars = []
|
|
7
|
+
listing_path = nil
|
|
8
|
+
jar_path = nil
|
|
9
|
+
diag.readlines.each do |line|
|
|
10
|
+
|
|
11
|
+
# workaround for JRUBY-4814 (IO.popen doesnt convert CRLF to LF on Windows)
|
|
12
|
+
line.chomp!
|
|
13
|
+
|
|
14
|
+
if line =~ /^ant\.home: (.*)$/ && !defined?(ANT_HOME)
|
|
15
|
+
const_set(:ANT_HOME, $1)
|
|
16
|
+
elsif line =~ /Tasks availability/
|
|
17
|
+
break
|
|
18
|
+
elsif line =~ /^ (.*) jar listing$/
|
|
19
|
+
listing_path = $1
|
|
20
|
+
elsif line =~ /^(.*\.home): (.*)$/
|
|
21
|
+
home_var, path = $1, $2
|
|
22
|
+
jar_path = listing_path.sub(home_var.upcase.sub('.','_'), path) if listing_path
|
|
23
|
+
elsif line =~ /^ant\.core\.lib: (.*)$/
|
|
24
|
+
classpath_jars << $1
|
|
25
|
+
elsif line =~ /^(.*\.jar) \(\d+ bytes\)/
|
|
26
|
+
classpath_jars << File.join(jar_path, $1)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
classpath_jars.uniq.each {|j| $CLASSPATH << j }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.load
|
|
34
|
+
if ENV['ANT_HOME'] && File.exist?(ENV['ANT_HOME'])
|
|
35
|
+
const_set(:ANT_HOME, ENV['ANT_HOME'])
|
|
36
|
+
Dir["#{ANT_HOME}/lib/*.jar"].each {|j| $CLASSPATH << j }
|
|
37
|
+
else
|
|
38
|
+
load_from_ant
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Explicitly add javac path to classpath.
|
|
42
|
+
# 'java.home' usually contains the JRE home on Windows and Linux. We
|
|
43
|
+
# want the directory above that which contains lib/tools.jar.
|
|
44
|
+
java_home = ENV['JAVA_HOME'] || ENV_JAVA['java.home'].sub(/\/jre$/,'')
|
|
45
|
+
if java_home && File.exist?(java_home)
|
|
46
|
+
const_set(:JAVA_HOME, java_home)
|
|
47
|
+
load_if_exist "#{java_home}/lib/tools.jar"
|
|
48
|
+
load_if_exist "#{java_home}/lib/classes.zip"
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def self.load_if_exist(jar)
|
|
53
|
+
$CLASSPATH << jar if File.exist?(jar)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.ant_script
|
|
57
|
+
require 'rbconfig'
|
|
58
|
+
RbConfig::CONFIG['host_os'] =~ /Windows|mswin/ ? 'ant.bat' : 'ant'
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
load
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
require 'rake/ant/ant'
|
|
65
|
+
require 'rake/ant/rake' if defined?(::Rake)
|
data/lib/rake/ant/ant.rb
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'rake/ant/element'
|
|
3
|
+
rescue NameError => ne
|
|
4
|
+
# uncaught, we should get a NameError, such as:
|
|
5
|
+
# NameError: uppercase package names not accessible this way (`org.apache.tools.ant.IntrospectionHelper')
|
|
6
|
+
# this probably means $ANT_HOME is not set properly
|
|
7
|
+
raise RuntimeError, "Caught NameError; examine $ANT_HOME"
|
|
8
|
+
end
|
|
9
|
+
require 'rake/ant/target'
|
|
10
|
+
|
|
11
|
+
class Ant
|
|
12
|
+
java_import org.apache.tools.ant.DefaultLogger
|
|
13
|
+
java_import org.apache.tools.ant.Location
|
|
14
|
+
java_import org.apache.tools.ant.Project
|
|
15
|
+
java_import org.apache.tools.ant.ProjectHelper
|
|
16
|
+
|
|
17
|
+
attr_reader :project, :log, :location
|
|
18
|
+
attr_accessor :current_target
|
|
19
|
+
|
|
20
|
+
def initialize(options={}, &block)
|
|
21
|
+
@options = options
|
|
22
|
+
@location = Ant.location_from_caller
|
|
23
|
+
@project = create_project options
|
|
24
|
+
@current_target = nil
|
|
25
|
+
generate_methods @project.data_type_definitions
|
|
26
|
+
generate_methods @project.task_definitions
|
|
27
|
+
process_arguments unless options[:run] == false || Ant.run || @location.file_name != $0
|
|
28
|
+
define_tasks(&block)
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def properties
|
|
32
|
+
@project.properties
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def define_tasks(&code)
|
|
36
|
+
code.arity == 1 ? code[self] : instance_eval(&code) if code
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Add a target (two forms)
|
|
40
|
+
# 1. Execute a block as a target: add_target "foo-target" { echo :message => "I am cool" }
|
|
41
|
+
# 2. Execute a rake task as a target: add_target Rake.application["default"]
|
|
42
|
+
def add_target(*options, &block)
|
|
43
|
+
target = options.first.respond_to?(:name) ? RakeTarget.new(self, options.first) : BlockTarget.new(self, *options, &block)
|
|
44
|
+
@project.add_target target
|
|
45
|
+
end
|
|
46
|
+
alias target add_target
|
|
47
|
+
|
|
48
|
+
def [](name)
|
|
49
|
+
if @project.targets.containsKey(name.to_s)
|
|
50
|
+
TargetWrapper.new(@project, name)
|
|
51
|
+
else
|
|
52
|
+
MissingWrapper.new(@project, name)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def execute_target(name)
|
|
57
|
+
self[name].execute
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def execute_default
|
|
61
|
+
@project.execute_target(@project.default_target)
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
def project_help
|
|
65
|
+
max_width = @project.targets.keys.max {|a,b| a.length <=> b.length}.length
|
|
66
|
+
@project.targets.values.select {|t|
|
|
67
|
+
t.description
|
|
68
|
+
}.sort{|a,b|
|
|
69
|
+
a.name <=> b.name
|
|
70
|
+
}.map {|t|
|
|
71
|
+
"%-#{max_width}s - %s" % [t.name, t.description]
|
|
72
|
+
}.join("\n")
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def ant(*args)
|
|
76
|
+
raise "ant is known to be broken and is unsupported in the ant library"
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def antcall(*args)
|
|
80
|
+
raise "antcall is known to be broken and is unsupported in the ant library"
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def _element(name, args = {}, &block)
|
|
84
|
+
Element.new(self, name).call(@current_target, args, &block)
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def method_missing(name, *args, &block)
|
|
88
|
+
project.log "invoking method_missing: #{name} on Ant instance", 5
|
|
89
|
+
_element(name, *args, &block)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def run(*targets)
|
|
93
|
+
if targets.length > 0
|
|
94
|
+
targets.each {|t| execute_target(t) }
|
|
95
|
+
else
|
|
96
|
+
execute_default
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def process_arguments(argv = ARGV, run_at_exit = true)
|
|
101
|
+
properties = []
|
|
102
|
+
targets = []
|
|
103
|
+
argv.each {|a| a =~ /^-D/ ? properties << a[2..-1] : targets << a }
|
|
104
|
+
properties.each do |p|
|
|
105
|
+
key, value = p.split('=', 2)
|
|
106
|
+
value ||= "true"
|
|
107
|
+
@project.set_user_property(key, value)
|
|
108
|
+
end
|
|
109
|
+
at_exit do
|
|
110
|
+
begin
|
|
111
|
+
run(*targets) if (!targets.empty? || @project.default_target) && !Ant.run
|
|
112
|
+
rescue => e
|
|
113
|
+
warn e.message
|
|
114
|
+
puts e.backtrace.join("\n") if $DEBUG
|
|
115
|
+
exit 1
|
|
116
|
+
end
|
|
117
|
+
end if run_at_exit
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
private
|
|
121
|
+
def create_project(options)
|
|
122
|
+
# If we are calling into a rakefile from ant then we already have a project to use
|
|
123
|
+
return $project if defined?($project) && $project
|
|
124
|
+
|
|
125
|
+
options[:basedir] ||= '.'
|
|
126
|
+
output_level = options.delete(:output_level) || 2
|
|
127
|
+
|
|
128
|
+
Project.new.tap do |p|
|
|
129
|
+
p.init
|
|
130
|
+
p.add_build_listener(DefaultLogger.new.tap do |log|
|
|
131
|
+
log.output_print_stream = Java::java.lang.System.out
|
|
132
|
+
log.error_print_stream = Java::java.lang.System.err
|
|
133
|
+
log.emacs_mode = true
|
|
134
|
+
log.message_output_level = output_level
|
|
135
|
+
@log = log
|
|
136
|
+
end)
|
|
137
|
+
helper = ProjectHelper.getProjectHelper
|
|
138
|
+
helper.import_stack.add(Java::java.io.File.new(@location.file_name))
|
|
139
|
+
p.addReference(ProjectHelper::PROJECTHELPER_REFERENCE, helper)
|
|
140
|
+
options.each_pair {|k,v| p.send("set_#{k}", v) if p.respond_to?("set_#{k}") }
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
def generate_methods(collection)
|
|
145
|
+
existing_methods = Ant.instance_methods(false)
|
|
146
|
+
collection.each do |name, clazz|
|
|
147
|
+
element = Element.new(self, name, clazz)
|
|
148
|
+
method_name = Ant.safe_method_name(name)
|
|
149
|
+
(class << self; self; end).send(:define_method, method_name) do |*a, &b|
|
|
150
|
+
element.call(@current_target, *a, &b)
|
|
151
|
+
end unless existing_methods.include?(method_name)
|
|
152
|
+
end
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
class << self
|
|
156
|
+
attr_accessor :run
|
|
157
|
+
|
|
158
|
+
def safe_method_name(element_name)
|
|
159
|
+
if element_name =~ /\A(and|or|not|do|end|if|else)\z/m
|
|
160
|
+
"_#{element_name}"
|
|
161
|
+
else
|
|
162
|
+
element_name
|
|
163
|
+
end
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
def location_from_caller
|
|
167
|
+
file, line = caller.detect{|el| el !~ /^#{File.dirname(__FILE__)}/ && el !~ /\.java:/}.split(/:(\d+):?/)
|
|
168
|
+
Location.new(file, line.to_i, 1)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def ant(options={}, &code)
|
|
172
|
+
if options.respond_to? :to_hash
|
|
173
|
+
@ant ||= Ant.new options.to_hash
|
|
174
|
+
@ant.define_tasks(&code)
|
|
175
|
+
@ant
|
|
176
|
+
else
|
|
177
|
+
options = options.join(" ") if options.respond_to? :to_ary
|
|
178
|
+
ant_bin = ENV['ANT_HOME'] ? File.join(ENV['ANT_HOME'], 'bin', 'ant') : 'ant' # find one on $PATH
|
|
179
|
+
system "#{ant_bin} #{options.to_s}" # FIXME: Make this more secure if using array form
|
|
180
|
+
end
|
|
181
|
+
rescue Exception => e
|
|
182
|
+
warn e.message
|
|
183
|
+
warn e.backtrace.join("\n")
|
|
184
|
+
end
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
|
|
188
|
+
# This method has three different uses:
|
|
189
|
+
#
|
|
190
|
+
# 1. Call an ant task or type directly:
|
|
191
|
+
# task :compile do # Rake task
|
|
192
|
+
# ant.javac { } # Look I am calling an ant task
|
|
193
|
+
# end
|
|
194
|
+
# 2. Provide a block to provide an impromptu ant session
|
|
195
|
+
# ant do
|
|
196
|
+
# javac {} # Everything executes as if in an executing ant target
|
|
197
|
+
# end
|
|
198
|
+
# 3. Provide arguments to execute ant as it's own build
|
|
199
|
+
# ant '-f my_build.xml my_target1'
|
|
200
|
+
#
|
|
201
|
+
# Additionally this may be passed in array format if you are worried about injection:
|
|
202
|
+
#
|
|
203
|
+
# args = ['-f', 'my_build.xml', 'my_target1']
|
|
204
|
+
# ant args
|
|
205
|
+
#
|
|
206
|
+
def ant(*args, &block)
|
|
207
|
+
Ant.ant(*args, &block)
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
# Need Rake DSL at top-level for "task" and other methods.
|
|
211
|
+
include Rake::DSL
|
|
212
|
+
|
|
213
|
+
def ant_import(filename = 'build.xml')
|
|
214
|
+
ant = Ant.ant
|
|
215
|
+
|
|
216
|
+
abs_name = File.expand_path(filename)
|
|
217
|
+
Ant::ProjectHelper.configure_project ant.project, java.io.File.new(abs_name)
|
|
218
|
+
|
|
219
|
+
ant.project.targets.each do |target_name, target|
|
|
220
|
+
name = Rake.application.lookup(target_name) ? "ant_" + target_name : target_name
|
|
221
|
+
|
|
222
|
+
task(name) { target.project.execute_target(target_name) }
|
|
223
|
+
end
|
|
224
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
class Ant
|
|
2
|
+
java_import org.apache.tools.ant.IntrospectionHelper
|
|
3
|
+
java_import org.apache.tools.ant.RuntimeConfigurable
|
|
4
|
+
java_import org.apache.tools.ant.UnknownElement
|
|
5
|
+
|
|
6
|
+
# preserve idempotence of Ruby wrapper as much as possible
|
|
7
|
+
UnknownElement.__persistent__ = true
|
|
8
|
+
|
|
9
|
+
class UnknownElement
|
|
10
|
+
attr_accessor :ant, :nesting
|
|
11
|
+
# undef some method names that might collide with ant task/type names
|
|
12
|
+
%w(test fail abort raise exec trap).each {|m| undef_method(m)}
|
|
13
|
+
Object.instance_methods.grep(/java/).each {|m| undef_method(m)}
|
|
14
|
+
|
|
15
|
+
def _element(name, args = {}, &block)
|
|
16
|
+
Element.new(ant, name).call(self, args, &block)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def method_missing(name, *args, &block)
|
|
20
|
+
ant.project.log "#{location.to_s}: #{' ' * nesting}#{task_name} -> #{name}", 5
|
|
21
|
+
_element(name, *args, &block)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# This is really the metadata of the element coupled with the logic for
|
|
26
|
+
# instantiating an instance of an element and evaluating it. My intention
|
|
27
|
+
# is to decouple these two pieces. This has extra value since we can then
|
|
28
|
+
# also make two types of instances for both top-level tasks and for targets
|
|
29
|
+
# since we have some conditionals which would then be eliminated
|
|
30
|
+
class Element
|
|
31
|
+
attr_reader :name
|
|
32
|
+
|
|
33
|
+
def initialize(ant, name, clazz = nil)
|
|
34
|
+
@ant, @name, @clazz = ant, name, clazz
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def call(parent, args={}, &code)
|
|
38
|
+
element = create_element(parent)
|
|
39
|
+
assign_attributes element, args
|
|
40
|
+
define_nested_elements element if @clazz
|
|
41
|
+
code.arity==1 ? code[element] : element.instance_eval(&code) if block_given?
|
|
42
|
+
if parent.respond_to? :add_child # Task
|
|
43
|
+
parent.add_child element
|
|
44
|
+
parent.runtime_configurable_wrapper.add_child element.runtime_configurable_wrapper
|
|
45
|
+
elsif parent.respond_to? :add_task # Target
|
|
46
|
+
parent.add_task element
|
|
47
|
+
else # Just run it now
|
|
48
|
+
@ant.project.log "#{element.location.to_s}: Executing #{name}", 5
|
|
49
|
+
element.owning_target = Target.new.tap {|t| t.name = ""}
|
|
50
|
+
element.maybe_configure
|
|
51
|
+
element.execute
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
def create_element(parent) # See ProjectHelper2.ElementHandler
|
|
57
|
+
UnknownElement.new(@name).tap do |e|
|
|
58
|
+
if parent.respond_to?(:nesting)
|
|
59
|
+
e.nesting = parent.nesting + 1
|
|
60
|
+
else
|
|
61
|
+
e.nesting = 1
|
|
62
|
+
end
|
|
63
|
+
e.ant = @ant
|
|
64
|
+
e.project = @ant.project
|
|
65
|
+
e.task_name = @name
|
|
66
|
+
e.location = Ant.location_from_caller
|
|
67
|
+
e.owning_target = @ant.current_target
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# This also subsumes configureId to only have to traverse args once
|
|
72
|
+
def assign_attributes(instance, args)
|
|
73
|
+
wrapper = RuntimeConfigurable.new instance, instance.task_name
|
|
74
|
+
args.each do |key, value|
|
|
75
|
+
wrapper.set_attribute to_string(key), @ant.project.replace_properties(to_string(value))
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def define_nested_elements(instance)
|
|
80
|
+
meta_class = class << instance; self; end
|
|
81
|
+
@helper = IntrospectionHelper.get_helper(@ant.project, @clazz)
|
|
82
|
+
@helper.get_nested_element_map.each do |element_name, clazz|
|
|
83
|
+
element = Element.new(@ant, element_name, clazz)
|
|
84
|
+
meta_class.send(:define_method, Ant.safe_method_name(element_name)) do |*args, &block|
|
|
85
|
+
instance.ant.project.log "#{instance.location.to_s}: #{' ' * instance.nesting}#{instance.task_name} . #{element_name}", 5
|
|
86
|
+
element.call(instance, *args, &block)
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def to_string(value)
|
|
92
|
+
if String === value
|
|
93
|
+
value
|
|
94
|
+
elsif value.respond_to?(:to_str)
|
|
95
|
+
value.to_str
|
|
96
|
+
else
|
|
97
|
+
value.to_s
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
101
|
+
end
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
require 'rexml/parsers/sax2parser'
|
|
2
|
+
require 'rexml/sax2listener'
|
|
3
|
+
require 'rake/ant'
|
|
4
|
+
|
|
5
|
+
class Ant
|
|
6
|
+
class ProjectConverter
|
|
7
|
+
include REXML::SAX2Listener
|
|
8
|
+
|
|
9
|
+
def initialize
|
|
10
|
+
@output = $stdout
|
|
11
|
+
@depth = 0
|
|
12
|
+
@seen = ['<DOC>', 0]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def start_element(uri, localname, qname, attributes)
|
|
16
|
+
emit_do(localname)
|
|
17
|
+
case localname
|
|
18
|
+
when "project"
|
|
19
|
+
@output.puts "require 'ant'"
|
|
20
|
+
emit "ant", attributes
|
|
21
|
+
when "description"
|
|
22
|
+
print_with_indent "project.description = "
|
|
23
|
+
else
|
|
24
|
+
emit localname, attributes
|
|
25
|
+
end
|
|
26
|
+
@depth += 1
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def end_element(uri, localname, qname)
|
|
30
|
+
@depth -= 1
|
|
31
|
+
emit_end(localname)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def characters(text)
|
|
35
|
+
@output.print value_inspect(text.strip) if text.strip.length > 0
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def emit_do(tag)
|
|
39
|
+
@output.puts " do" if @seen.last[1] != @depth
|
|
40
|
+
@seen << [tag, @depth]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def emit_end(tag)
|
|
44
|
+
level = @seen.last
|
|
45
|
+
if level[0] == tag && level[1] == @depth
|
|
46
|
+
@output.puts
|
|
47
|
+
else
|
|
48
|
+
print_with_indent "end\n"
|
|
49
|
+
@seen << ["/#{tag}", @depth]
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def emit(code, attributes = nil)
|
|
54
|
+
print_with_indent safe_method_name(code, attributes)
|
|
55
|
+
if attributes
|
|
56
|
+
first = true
|
|
57
|
+
attributes.each do |k,v|
|
|
58
|
+
@output.print "," unless first
|
|
59
|
+
@output.print " #{symbol_or_string(k)} => #{value_inspect(v)}"
|
|
60
|
+
first = false
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def print_with_indent(str)
|
|
66
|
+
@output.print " " * @depth
|
|
67
|
+
@output.print str
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
ID = /\A[a-zA-Z_][a-zA-Z0-9_]*\z/
|
|
71
|
+
|
|
72
|
+
def symbol_or_string(s)
|
|
73
|
+
if s =~ ID
|
|
74
|
+
":#{s}"
|
|
75
|
+
else
|
|
76
|
+
s.inspect
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def value_inspect(s)
|
|
81
|
+
s.inspect.gsub("\\n", "\n")
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def safe_method_name(s, attributes)
|
|
85
|
+
s = Ant.safe_method_name(s)
|
|
86
|
+
if s =~ ID
|
|
87
|
+
s
|
|
88
|
+
else
|
|
89
|
+
"_element #{s.inspect}#{attributes.nil? || attributes.empty? ? '' : ','}"
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def self.convert(file = "build.xml")
|
|
94
|
+
source = File.exists?(file) ? File.new(file) : $stdin
|
|
95
|
+
parser = REXML::Parsers::SAX2Parser.new source
|
|
96
|
+
parser.listen self.new
|
|
97
|
+
parser.parse
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
require 'java'
|
|
2
|
+
|
|
3
|
+
class Ant
|
|
4
|
+
java_import org.apache.tools.ant.Target
|
|
5
|
+
|
|
6
|
+
class RakeTarget < Target
|
|
7
|
+
ALREADY_DEFINED_PREFIX = "rake_"
|
|
8
|
+
|
|
9
|
+
def initialize(ant, rake_task)
|
|
10
|
+
super()
|
|
11
|
+
set_project ant.project
|
|
12
|
+
set_name generate_unique_target_name rake_task.name
|
|
13
|
+
|
|
14
|
+
rake_task.prerequisites.each { |prereq| add_dependency prereq }
|
|
15
|
+
|
|
16
|
+
@rake_task = rake_task
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def execute
|
|
20
|
+
@rake_task.execute
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
def generate_unique_target_name(name)
|
|
25
|
+
# FIXME: This is not guaranteed to be unique and may be a wonky naming convention?
|
|
26
|
+
if project.targets.get(name)
|
|
27
|
+
project.log "ant already defines #{name}. Redefining as #{ALREADY_DEFINED_PREFIX}#{name}"
|
|
28
|
+
name = ALREADY_DEFINED_PREFIX + name
|
|
29
|
+
end
|
|
30
|
+
name
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
class BlockTarget < Target
|
|
35
|
+
def initialize(ant, *options, &block)
|
|
36
|
+
super()
|
|
37
|
+
set_project ant.project
|
|
38
|
+
hash = extract_options(options)
|
|
39
|
+
hash.each_pair {|k,v| send("set_#{k}", v) }
|
|
40
|
+
@ant, @block = ant, block
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def execute
|
|
44
|
+
# Have to dupe this logic b/c Ant doesn't provide a way to
|
|
45
|
+
# override inner part of execute
|
|
46
|
+
if_cond, unless_cond = if_condition, unless_condition
|
|
47
|
+
if if_cond && unless_cond
|
|
48
|
+
execute_target
|
|
49
|
+
elsif !if_cond
|
|
50
|
+
project.log(self, "Skipped because property '#{if_cond}' not set.", Project::MSG_VERBOSE)
|
|
51
|
+
else
|
|
52
|
+
project.log(self, "Skipped because property '#{unless_cond}' set.", Project::MSG_VERBOSE)
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def defined_tasks
|
|
57
|
+
define_target.tasks
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
private
|
|
61
|
+
def extract_options(options)
|
|
62
|
+
hash = Hash === options.last ? options.pop : {}
|
|
63
|
+
hash[:name] = options[0].to_s if options[0]
|
|
64
|
+
hash[:description] = options[1].to_s if options[1]
|
|
65
|
+
hash
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def if_condition
|
|
69
|
+
cond = get_if
|
|
70
|
+
return true unless cond
|
|
71
|
+
val = project.replace_properties(cond)
|
|
72
|
+
project.get_property(val) && val
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
def unless_condition
|
|
76
|
+
cond = get_unless
|
|
77
|
+
return true unless cond
|
|
78
|
+
val = project.replace_properties(cond)
|
|
79
|
+
project.get_property(val).nil? && val
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def execute_target
|
|
83
|
+
@ant.instance_eval(&@block) if @block
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def define_target
|
|
87
|
+
Target.new.tap do |t|
|
|
88
|
+
t.name = ""
|
|
89
|
+
begin
|
|
90
|
+
@ant.current_target = t
|
|
91
|
+
execute_target
|
|
92
|
+
ensure
|
|
93
|
+
@ant.current_target = nil
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
class TargetWrapper
|
|
100
|
+
def initialize(project, name)
|
|
101
|
+
@project, @name = project, name
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def execute
|
|
105
|
+
@project.execute_target(@name)
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
class MissingWrapper
|
|
110
|
+
def initialize(project, name)
|
|
111
|
+
@project_name = project.name || "<anonymous>"
|
|
112
|
+
@name = name
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def execute
|
|
116
|
+
raise "Target `#{@name}' does not exist in project `#{@project_name}'"
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
require 'rubygems'
|
|
2
|
+
require 'rake'
|
|
3
|
+
require 'ant'
|
|
4
|
+
|
|
5
|
+
class RakeWrapper
|
|
6
|
+
def load_tasks(*args)
|
|
7
|
+
# FIXME: Use our arguments (this sucks...let's submit a patch for Rake
|
|
8
|
+
ARGV.clear
|
|
9
|
+
ARGV.concat args
|
|
10
|
+
|
|
11
|
+
Rake.application.tap do |application|
|
|
12
|
+
application.init
|
|
13
|
+
application.load_rakefile
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def execute(*args)
|
|
18
|
+
load_tasks(*args).top_level
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def invoke_task(task)
|
|
22
|
+
Rake.application[task].invoke
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def import(*args)
|
|
26
|
+
ant = Ant.new
|
|
27
|
+
load_tasks(*args).tasks.each { |rake_task| ant.add_target rake_task }
|
|
28
|
+
end
|
|
29
|
+
end
|
data/rake-ant.gemspec
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "rake/ant/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "rake-ant"
|
|
8
|
+
spec.version = Rake::Ant::VERSION
|
|
9
|
+
spec.authors = ["Thomas E Enebo", "Charles Oliver Nutter"]
|
|
10
|
+
spec.email = ["tom.enebo@gmail.com", "headius@headius.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Ant tasks and integration for Rake}
|
|
13
|
+
spec.homepage = "https://github.com/jruby/rake-ant"
|
|
14
|
+
|
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
16
|
+
f.match(%r{^(test|spec|features)/})
|
|
17
|
+
end
|
|
18
|
+
spec.require_paths = ["lib"]
|
|
19
|
+
|
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.15"
|
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
|
22
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rake-ant
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Thomas E Enebo
|
|
8
|
+
- Charles Oliver Nutter
|
|
9
|
+
autorequire:
|
|
10
|
+
bindir: bin
|
|
11
|
+
cert_chain: []
|
|
12
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
|
13
|
+
dependencies:
|
|
14
|
+
- !ruby/object:Gem::Dependency
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.15'
|
|
20
|
+
name: bundler
|
|
21
|
+
prerelease: false
|
|
22
|
+
type: :development
|
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
24
|
+
requirements:
|
|
25
|
+
- - "~>"
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: '1.15'
|
|
28
|
+
- !ruby/object:Gem::Dependency
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
name: rake
|
|
35
|
+
prerelease: false
|
|
36
|
+
type: :development
|
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
+
requirements:
|
|
39
|
+
- - "~>"
|
|
40
|
+
- !ruby/object:Gem::Version
|
|
41
|
+
version: '10.0'
|
|
42
|
+
description:
|
|
43
|
+
email:
|
|
44
|
+
- tom.enebo@gmail.com
|
|
45
|
+
- headius@headius.com
|
|
46
|
+
executables: []
|
|
47
|
+
extensions: []
|
|
48
|
+
extra_rdoc_files: []
|
|
49
|
+
files:
|
|
50
|
+
- ".gitignore"
|
|
51
|
+
- Gemfile
|
|
52
|
+
- LICENSE
|
|
53
|
+
- README.md
|
|
54
|
+
- Rakefile
|
|
55
|
+
- lib/ant.rb
|
|
56
|
+
- lib/rake/ant.rb
|
|
57
|
+
- lib/rake/ant/ant.rb
|
|
58
|
+
- lib/rake/ant/element.rb
|
|
59
|
+
- lib/rake/ant/project_converter.rb
|
|
60
|
+
- lib/rake/ant/rake.rb
|
|
61
|
+
- lib/rake/ant/target.rb
|
|
62
|
+
- lib/rake/ant/tasks/raketasks.rb
|
|
63
|
+
- lib/rake/ant/version.rb
|
|
64
|
+
- rake-ant.gemspec
|
|
65
|
+
homepage: https://github.com/jruby/rake-ant
|
|
66
|
+
licenses: []
|
|
67
|
+
metadata: {}
|
|
68
|
+
post_install_message:
|
|
69
|
+
rdoc_options: []
|
|
70
|
+
require_paths:
|
|
71
|
+
- lib
|
|
72
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
73
|
+
requirements:
|
|
74
|
+
- - ">="
|
|
75
|
+
- !ruby/object:Gem::Version
|
|
76
|
+
version: '0'
|
|
77
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - ">="
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '0'
|
|
82
|
+
requirements: []
|
|
83
|
+
rubyforge_project:
|
|
84
|
+
rubygems_version: 2.6.13
|
|
85
|
+
signing_key:
|
|
86
|
+
specification_version: 4
|
|
87
|
+
summary: Ant tasks and integration for Rake
|
|
88
|
+
test_files: []
|