filament 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +13 -0
- data/bin/filament +1 -6
- data/bin/filament-dbg +1 -1
- data/bin/filament-opt +1 -1
- data/bin/filament-test +1 -1
- data/lib/filament/package.rb +1 -2
- data/lib/filament/plugin.rb +8 -0
- data/lib/filament/target.rb +3 -4
- data/lib/filament.rb +109 -146
- data/plugins/00util/lib/filament/plugins/util.rb +59 -0
- data/plugins/00util/lib/init.rb +4 -47
- data/plugins/01java/lib/filament/plugins/java.rb +9 -0
- data/plugins/01java/lib/init.rb +5 -1
- data/plugins/02javame/lib/filament/javame/platform.rb +2 -58
- data/plugins/05push/lib/filament/plugins/push.rb +20 -0
- data/plugins/05push/lib/init.rb +2 -14
- data/plugins/10svn/lib/filament/package/svn.rb +121 -0
- data/plugins/10svn/lib/filament/plugins/svn.rb +28 -0
- data/plugins/10svn/lib/init.rb +3 -0
- data/{lib → plugins/10svn/lib}/svn.rb +8 -0
- metadata +37 -18
- data/bin/init +0 -4
- data/lib/filament/package/svn.rb +0 -123
- data/lib/filament/plugins.rb +0 -32
- data/tests/build/artifact_name_test.rb +0 -85
- data/tests/build/artifact_test.rb +0 -23
- data/tests/gen/java/block_test.rb +0 -42
- data/tests/gen/java/callable_test.rb +0 -23
- data/tests/gen/java/method_test.rb +0 -25
- data/tests/gen/java/statement_test.rb +0 -16
- data/tests/java/tools_test.rb +0 -8
data/CHANGELOG
CHANGED
@@ -1,3 +1,16 @@
|
|
1
|
+
0.2.0:
|
2
|
+
Filament:
|
3
|
+
- removed old tests
|
4
|
+
- Using cmdparse gem; One action per command
|
5
|
+
- added dependency on memoize gem
|
6
|
+
- general cleanup
|
7
|
+
All Plugins:
|
8
|
+
- Plugins now extend Filament::Plugin where necessary
|
9
|
+
JavaME Plugin:
|
10
|
+
- Moved vendor-specific stuff to tasks.rb in //vendor/libraries/javame
|
11
|
+
SVN Plugin:
|
12
|
+
- Created svn plugin, should make it easier to support other version control schemes in the future
|
13
|
+
|
1
14
|
0.1.2:
|
2
15
|
JavaME Plugin:
|
3
16
|
- Changed the default for obfuscating JavaME::Suite targets to false.
|
data/bin/filament
CHANGED
data/bin/filament-dbg
CHANGED
data/bin/filament-opt
CHANGED
data/bin/filament-test
CHANGED
data/lib/filament/package.rb
CHANGED
@@ -21,14 +21,13 @@ module Filament
|
|
21
21
|
klass.new(name, &block)
|
22
22
|
end
|
23
23
|
|
24
|
-
attr_reader :parent, :name, :realpath, :workspace, :package_resolver, :target_resolver, :build_context
|
24
|
+
attr_reader :parent, :name, :realpath, :workspace, :package_resolver, :target_resolver, :build_context, :scm
|
25
25
|
alias :pathname :realpath
|
26
26
|
|
27
27
|
def initialize(h)
|
28
28
|
@parent = h[:parent]
|
29
29
|
@workspace = h[:workspace]
|
30
30
|
|
31
|
-
|
32
31
|
if @workspace.nil?
|
33
32
|
unless @parent.nil?
|
34
33
|
@workspace = @parent.workspace
|
data/lib/filament/target.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
require 'filament/util/lazy_list'
|
2
2
|
|
3
|
-
# TODO quick fixes..
|
4
|
-
# switch to package.rb
|
5
|
-
|
6
3
|
module Filament
|
7
4
|
class TargetList < LazyList
|
8
5
|
def initialize(*args)
|
@@ -89,9 +86,11 @@ module Filament
|
|
89
86
|
alias :[] :get_output
|
90
87
|
|
91
88
|
# builds this specific target (and all dependencies)
|
92
|
-
|
89
|
+
# after building, it executes the provided block in the build context
|
90
|
+
def build(&block)
|
93
91
|
@package.build_context.execute do
|
94
92
|
invoke
|
93
|
+
block.call unless block.nil?
|
95
94
|
end
|
96
95
|
end
|
97
96
|
|
data/lib/filament.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require 'set'
|
3
3
|
|
4
|
+
|
4
5
|
# rake stuff
|
5
6
|
begin
|
6
7
|
require 'rake'
|
@@ -8,11 +9,18 @@ rescue LoadError
|
|
8
9
|
require 'rubygems'
|
9
10
|
require_gem 'rake'
|
10
11
|
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'cmdparse'
|
15
|
+
rescue LoadError
|
16
|
+
require 'rubygems'
|
17
|
+
require_gem 'cmdparse'
|
18
|
+
end
|
19
|
+
|
11
20
|
require 'rake/clean'
|
12
21
|
|
13
22
|
require 'filament/workspace'
|
14
23
|
require 'filament/platform'
|
15
|
-
require 'filament/plugins'
|
16
24
|
require 'filament/package'
|
17
25
|
require 'filament/target'
|
18
26
|
require 'filament/artifact'
|
@@ -44,172 +52,127 @@ module Filament
|
|
44
52
|
def verbose(on)
|
45
53
|
RakeFileUtils.verbose(false)
|
46
54
|
$verbose = on
|
47
|
-
# if on
|
48
|
-
# trace_var :$context, lambda { |c|
|
49
|
-
# puts "$context is now #{c}"
|
50
|
-
# }
|
51
|
-
# else
|
52
|
-
# untrace_var :$context
|
53
|
-
# end
|
54
55
|
end
|
55
56
|
|
56
|
-
$actions ||= []
|
57
|
-
|
58
57
|
class Application
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
58
|
+
@@plugins = []
|
59
|
+
|
60
|
+
def self.plugin(klass)
|
61
|
+
@@plugins << klass
|
62
|
+
end
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
64
|
+
def initialize
|
65
|
+
@cmd = CmdParse::CommandParser.new(true)
|
66
|
+
@cmd.program_name = "filament"
|
67
|
+
@cmd.program_version = [0, 2, 0]
|
68
|
+
@cmd.add_command(CmdParse::HelpCommand.new)
|
69
|
+
@cmd.add_command(CmdParse::VersionCommand.new)
|
70
|
+
@cmd.options = CmdParse::OptionParserWrapper.new do |opt|
|
71
|
+
opt.separator "Global options"
|
72
|
+
opt.on("--verbose", "Dump lots of stuff") { |t| verbose(true) }
|
73
|
+
opt.on("--trace", "Turn on tracing") { |t| $trace = true; verbose(true) }
|
74
|
+
end
|
75
|
+
|
76
|
+
@@plugins.each do |plugin|
|
77
|
+
plugin.new(self)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def subcommand(name, short_desc, &block)
|
82
|
+
subcommand = CmdParse::Command.new(name, false)
|
83
|
+
subcommand.short_desc = short_desc
|
84
|
+
subcommand.set_execution_block(&block)
|
85
|
+
@cmd.add_command(subcommand)
|
86
|
+
end
|
79
87
|
|
80
|
-
|
81
|
-
|
82
|
-
|
88
|
+
def run(args)
|
89
|
+
verbose(false)
|
90
|
+
|
91
|
+
this_package = $workspace.package_for_realpath(Pathname.pwd.realpath)
|
92
|
+
this_package.execute do
|
93
|
+
log "ROOT PACKAGES: #{$context[:package_resolver].root_package_names.join(', ')}"
|
94
|
+
# do it.
|
95
|
+
@cmd.parse(args)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
class << self
|
101
|
+
def get_plugin_dirs(path)
|
102
|
+
pn = Pathname.new(path)
|
103
|
+
return pn.children.sort
|
104
|
+
end
|
105
|
+
|
106
|
+
def update_env(plugin_base_dir)
|
107
|
+
plugin_dirs = get_plugin_dirs(plugin_base_dir)
|
108
|
+
script_dirs = plugin_dirs.collect {|dir| dir + 'script' }
|
109
|
+
ENV['PATH'] = script_dirs.join(':') + ':' + ENV['PATH']
|
110
|
+
end
|
83
111
|
|
84
|
-
def
|
85
|
-
|
86
|
-
|
87
|
-
|
112
|
+
def load_plugins(plugin_base_dir)
|
113
|
+
update_env(plugin_base_dir)
|
114
|
+
|
115
|
+
plugins = []
|
116
|
+
dirs = get_plugin_dirs(plugin_base_dir)
|
117
|
+
dirs.each do |child|
|
118
|
+
ln = child + 'lib'
|
119
|
+
|
120
|
+
if ln.exist?
|
121
|
+
$LOAD_PATH << ln.realpath
|
122
|
+
cn = ln + 'init.rb'
|
123
|
+
raise "cannot init filament plugin '#{child}'" unless cn.exist?
|
124
|
+
load cn.realpath
|
125
|
+
plugins << child.basename.to_s
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
log "PLUGINS: #{plugins.join(', ')}"
|
130
|
+
end
|
131
|
+
|
132
|
+
def partition_args
|
88
133
|
vars = {}
|
134
|
+
args = []
|
89
135
|
ARGV.each do |arg|
|
90
136
|
if arg =~ /^(\w+)=(.*)$/
|
91
137
|
vars[$1] = $2
|
92
|
-
elsif arg =~ /^[^\/^:]/
|
93
|
-
actions << arg.to_sym
|
94
138
|
else
|
95
|
-
|
96
|
-
if arg =~ /^\/[^:]/
|
97
|
-
packages << arg
|
98
|
-
end
|
139
|
+
args << arg
|
99
140
|
end
|
100
141
|
end
|
101
142
|
return { :vars => vars,
|
102
|
-
:
|
103
|
-
:packages => packages,
|
104
|
-
:actions => actions }
|
143
|
+
:args => args }
|
105
144
|
end
|
106
145
|
|
107
|
-
def
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
verbose(true)
|
112
|
-
else
|
113
|
-
fail "Unknown option: #{opt}"
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def command_line_options
|
118
|
-
OPTIONS.collect { |lst| lst[0..-2] }
|
119
|
-
end
|
120
|
-
|
121
|
-
def handle_options
|
122
|
-
opts = GetoptLong.new(*command_line_options)
|
123
|
-
opts.each { |opt, value| do_option(opt, value) }
|
124
|
-
end
|
125
|
-
|
126
|
-
def run(&block)
|
127
|
-
verbose(false)
|
146
|
+
def run
|
147
|
+
h = partition_args
|
148
|
+
vars = h[:vars]
|
149
|
+
args = h[:args]
|
128
150
|
|
129
|
-
|
130
|
-
|
131
|
-
begin
|
132
|
-
other_args = collect_other_args
|
133
|
-
vars = other_args[:vars]
|
134
|
-
|
135
|
-
vars.each do |key, val|
|
136
|
-
ENV[key] = val
|
137
|
-
end
|
138
|
-
|
139
|
-
actions = $actions + other_args[:actions]
|
140
|
-
actions.compact!
|
141
|
-
|
142
|
-
workspace_path = ENV['WR'] || Filament::find_dir(Pathname.pwd, '.workspace')
|
143
|
-
$workspace = Workspace.new(workspace_path)
|
144
|
-
$target_platform = (ENV['TARGET_PLATFORM'] || :mpp_sdk || :i860 || :wt2_2).to_sym
|
145
|
-
|
146
|
-
build_type = (ENV['BUILD_TYPE'] || :DBG).to_sym
|
147
|
-
dirs = { :TEST => 'test', # this is a folder for testing targets to use
|
148
|
-
:DBG => 'dbg', # final jars, binaries, etc. are placed in these
|
149
|
-
:OPT => 'opt' } # this is for obfuscated, compressed, releasable versions
|
150
|
-
|
151
|
-
raise "unknown build type: '#{build_type}'" unless dirs.key?(build_type)
|
152
|
-
|
153
|
-
$build_dir_prefix = "#{dirs[build_type]}/#{$target_platform.to_s}"
|
154
|
-
|
155
|
-
pn = Pathname.new(__FILE__).parent.parent + 'plugins'
|
156
|
-
Filament::load_plugins(pn.realpath)
|
157
|
-
|
158
|
-
$workspace.load_tasks
|
159
|
-
this_package = $workspace.package_for_realpath(Pathname.pwd.realpath)
|
160
|
-
|
161
|
-
this_package.execute do
|
162
|
-
targets = TargetList.new(*other_args[:targets])
|
163
|
-
packages = PackageList.new(*other_args[:packages])
|
164
|
-
|
165
|
-
if targets.empty?
|
166
|
-
log "assuming default target of '#{this_package.uri}'"
|
167
|
-
targets.include(this_package.uri)
|
168
|
-
end
|
169
|
-
|
170
|
-
if packages.empty?
|
171
|
-
log "assuming default package of '#{this_package.uri}'"
|
172
|
-
packages.include(this_package.uri)
|
173
|
-
end
|
174
|
-
|
175
|
-
if block.nil?
|
176
|
-
target_blocks = []
|
177
|
-
package_blocks = []
|
178
|
-
|
179
|
-
actions.each do |action|
|
180
|
-
if TARGET_ACTIONS.key?(action)
|
181
|
-
target_blocks << TARGET_ACTIONS[action]
|
182
|
-
elsif PACKAGE_ACTIONS.key?(action)
|
183
|
-
package_blocks << PACKAGE_ACTIONS[action]
|
184
|
-
else
|
185
|
-
raise "Unknown action: #{action}"
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
# some debug
|
190
|
-
root_packages = $context[:package_resolver].root_packages.collect { |p| p.full_name }
|
191
|
-
puts "ACTIONS: #{actions.join(', ')}"
|
192
|
-
puts "PACKAGE_RESOLVER: #{root_packages.join(', ')}"
|
193
|
-
|
194
|
-
target_blocks.each { |b| b.call(targets) }
|
195
|
-
package_blocks.each { |b| b.call(packages) }
|
196
|
-
else
|
197
|
-
targets.each(&block)
|
198
|
-
end
|
199
|
-
end
|
200
|
-
rescue Exception => ex
|
201
|
-
puts "Build aborted!"
|
202
|
-
puts ex.message
|
203
|
-
if $trace
|
204
|
-
puts ex.backtrace.join("\n")
|
205
|
-
else
|
206
|
-
puts ex.backtrace.find {|str| str =~ /rakefile.rb/ } || ""
|
207
|
-
end
|
208
|
-
exit(1)
|
151
|
+
vars.each do |key, val|
|
152
|
+
ENV[key] = val
|
209
153
|
end
|
154
|
+
|
155
|
+
workspace_path = ENV['WORKSPACE_PATH'] || Filament::find_dir(Pathname.pwd, '.workspace')
|
156
|
+
|
157
|
+
$target_platform = (ENV['TARGET_PLATFORM'] || :mpp_sdk || :i860 || :wt2_2).to_sym
|
158
|
+
$build_type = (ENV['BUILD_TYPE'] || :DBG || :OPT || :TEST).to_sym
|
159
|
+
raise "unknown build type: '#{$build_type}'" unless [:DBG, :OPT, :TEST].member?($build_type)
|
160
|
+
# :TEST => this is a folder for testing targets to use
|
161
|
+
# :DBG => final jars, binaries, etc. are placed in these
|
162
|
+
# :OPT => this is for obfuscated, compressed, releasable versions
|
163
|
+
$build_dir_prefix = "#{$build_type.to_s.downcase}/#{$target_platform.to_s}"
|
164
|
+
|
165
|
+
pn = Pathname.new(__FILE__).parent.parent + 'plugins'
|
166
|
+
Filament::load_plugins(pn.realpath)
|
167
|
+
|
168
|
+
$workspace = Workspace.new(workspace_path)
|
169
|
+
$workspace.load_tasks
|
170
|
+
|
171
|
+
Filament::Application.new.run(args)
|
210
172
|
end
|
211
173
|
end
|
212
174
|
end
|
213
175
|
|
214
176
|
include Filament::Platform
|
215
177
|
include Filament
|
178
|
+
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'filament/plugin'
|
2
|
+
|
3
|
+
module Filament::Plugins
|
4
|
+
class Util < Plugin
|
5
|
+
def initialize(app)
|
6
|
+
app.subcommand('build', "Build the given targets") do |args|
|
7
|
+
targets = TargetList.new(*args)
|
8
|
+
targets.each { |target| target.build }
|
9
|
+
end
|
10
|
+
|
11
|
+
app.subcommand('clobber', "Clobber the generated files for the given packages") do |args|
|
12
|
+
packages = PackageList.new(*args)
|
13
|
+
packages.each { |package| package.clobber }
|
14
|
+
end
|
15
|
+
|
16
|
+
app.subcommand('execute', "Executes the target, if it is executable") do |args|
|
17
|
+
targets = TargetList.new(*args)
|
18
|
+
targets.each do |target|
|
19
|
+
target.build do
|
20
|
+
block = target[:execute]
|
21
|
+
block.call unless block.nil?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
app.subcommand('targets', "Shows targets of given package") do |args|
|
27
|
+
packages = PackageList.new(*args)
|
28
|
+
packages.each do |package|
|
29
|
+
puts " #{package.full_name}"
|
30
|
+
package.targets.each do |target|
|
31
|
+
puts " #{target.uri}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
app.subcommand('prereqs', "Shows prerequisites of given packages") do |args|
|
37
|
+
targets = TargetList.new(*args)
|
38
|
+
targets.each do |target|
|
39
|
+
puts " #{target.uri}"
|
40
|
+
target.deps.each do |dep|
|
41
|
+
puts " #{dep.uri}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
app.subcommand('list', "Lists subpackages of given packages") do |args|
|
47
|
+
packages = PackageList.new(*args)
|
48
|
+
packages.each do |package|
|
49
|
+
package.list
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
app.subcommand('workspace', "Creates a filament workspace at the provided path (or the working directory)") do |args|
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/plugins/00util/lib/init.rb
CHANGED
@@ -1,47 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
package.list
|
6
|
-
end
|
7
|
-
},
|
8
|
-
:update => Proc.new { |packages|
|
9
|
-
packages.each do |package|
|
10
|
-
package.update
|
11
|
-
end
|
12
|
-
},
|
13
|
-
:status => Proc.new { |packages|
|
14
|
-
packages.each do |package|
|
15
|
-
package.status
|
16
|
-
end
|
17
|
-
},
|
18
|
-
:commit => Proc.new { |packages|
|
19
|
-
packages.each do |package|
|
20
|
-
package.commit
|
21
|
-
end
|
22
|
-
},
|
23
|
-
#Display the targets and dependencies, then exit.
|
24
|
-
:targets => Proc.new { |packages|
|
25
|
-
packages.each do |package|
|
26
|
-
puts " #{package.full_name}"
|
27
|
-
package.targets.each do |target|
|
28
|
-
puts " #{target.uri}"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
}
|
32
|
-
}
|
33
|
-
|
34
|
-
target_actions = {
|
35
|
-
:prereqs => Proc.new { |targets|
|
36
|
-
targets.each do |target|
|
37
|
-
puts " #{target.uri}"
|
38
|
-
target.deps.each do |dep|
|
39
|
-
puts " #{dep.uri}"
|
40
|
-
end
|
41
|
-
end
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
Application::PACKAGE_ACTIONS.merge!(package_actions)
|
46
|
-
Application::TARGET_ACTIONS.merge!(target_actions)
|
47
|
-
end
|
1
|
+
require 'filament'
|
2
|
+
require 'filament/plugins/util'
|
3
|
+
|
4
|
+
Filament::Application::plugin(Filament::Plugins::Util)
|
data/plugins/01java/lib/init.rb
CHANGED
@@ -2,64 +2,8 @@ require 'filament/platform'
|
|
2
2
|
|
3
3
|
module Filament::JavaME
|
4
4
|
module Tools
|
5
|
-
|
6
|
-
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.jsr_classpath(jsr)
|
10
|
-
return ["#{vendor_dir('jsr')}/#{jsr}/#{jsr}.jar"]
|
11
|
-
end
|
12
|
-
|
13
|
-
SUN_DIR = vendor_dir('sun')
|
14
|
-
MPP_DIR = vendor_dir('mpp-sdk')
|
15
|
-
MOTOROLA_DIR = vendor_dir('motorola')
|
16
|
-
|
17
|
-
TAGS = {
|
18
|
-
:midp1 => ["#{SUN_DIR}/midpapi10.jar"],
|
19
|
-
:midp2 => ["#{SUN_DIR}/midpapi20.jar"],
|
20
|
-
:jsr_75 => jsr_classpath(75),
|
21
|
-
:jsr_82 => jsr_classpath(82),
|
22
|
-
:jsr_120 => jsr_classpath(120),
|
23
|
-
:jsr_135 => jsr_classpath(135),
|
24
|
-
:jsr_172 => jsr_classpath(172),
|
25
|
-
:jsr_184 => jsr_classpath(184),
|
26
|
-
}
|
27
|
-
|
28
|
-
TARGET_PLATFORMS[:wtk2_2] = {
|
29
|
-
:tags => [:wtk, :midp2, :jsr_82],
|
30
|
-
:cldc_version => 1.1
|
31
|
-
}
|
32
|
-
|
33
|
-
TARGET_PLATFORMS[:mpp_sdk] = {
|
34
|
-
:tags => [:mpp, :midp2, :jsr_82],
|
35
|
-
:cldc_version => 1.1
|
36
|
-
}
|
37
|
-
|
38
|
-
TARGET_PLATFORMS[:a1000] = {
|
39
|
-
:tags => [:midp2, :jsr_82, :jsr_120, :jsr_185, :jsr_135],
|
40
|
-
:cldc_version => 1.0
|
41
|
-
}
|
42
|
-
|
43
|
-
TARGET_PLATFORMS[:weme] = {
|
44
|
-
:tags => [:midp2, :jsr_75, :jsr_172],
|
45
|
-
:cldc_version => 1.1
|
46
|
-
}
|
47
|
-
|
48
|
-
TARGET_PLATFORMS[:i860] = {
|
49
|
-
:tags => [:iden],
|
50
|
-
:cldc_version => 1.0,
|
51
|
-
:classpath => ["#{MOTOROLA_DIR}/i860/i860.jar"]
|
52
|
-
}
|
53
|
-
|
54
|
-
TARGET_PLATFORMS[:e398] = {
|
55
|
-
:tags => [:midp2, :jsr_120, :jsr_135],
|
56
|
-
:cldc_version => 1.0
|
57
|
-
}
|
58
|
-
|
59
|
-
TARGET_PLATFORMS[:e680] = {
|
60
|
-
:tags => [:midp2, :jsr_120, :jsr_135, :jsr_184, :jsr_185],
|
61
|
-
:cldc_version => 1.0
|
62
|
-
}
|
5
|
+
TAGS = {}
|
6
|
+
TARGET_PLATFORMS = {}
|
63
7
|
|
64
8
|
class << self
|
65
9
|
def platform(model)
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'filament/plugin'
|
2
|
+
|
3
|
+
module Filament::Plugins
|
4
|
+
class Push < Plugin
|
5
|
+
def initialize(app)
|
6
|
+
app.subcommand('push', "Pushes deployables to selected PUSH_CONDUIT") do |args|
|
7
|
+
targets = TargetList.new(*args)
|
8
|
+
push_conduit = ENV['PUSH_CONDUIT'] || :Filter
|
9
|
+
|
10
|
+
targets.each do |target|
|
11
|
+
target.build do
|
12
|
+
klass = eval(push_conduit.to_s + 'Conduit')
|
13
|
+
conduit = klass.new
|
14
|
+
conduit.push_targets(targets)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/plugins/05push/lib/init.rb
CHANGED
@@ -10,20 +10,8 @@ require 'filament/push/conduits/bluetooth_conduit'
|
|
10
10
|
require 'filament/push/conduits/scp_conduit'
|
11
11
|
require 'filament/push/conduits/filter_conduit'
|
12
12
|
|
13
|
-
|
14
|
-
Application::TARGET_ACTIONS[:push] = Proc.new { |targets|
|
15
|
-
push_conduit = ENV['PUSH_CONDUIT'] || :Filter
|
16
|
-
|
17
|
-
targets.each do |target|
|
18
|
-
target.build
|
19
|
-
end
|
20
|
-
|
21
|
-
klass = eval(push_conduit.to_s + 'Conduit')
|
22
|
-
conduit = klass.new
|
23
|
-
|
24
|
-
conduit.push_targets(targets)
|
25
|
-
}
|
26
|
-
end
|
13
|
+
require 'filament/plugins/push'
|
27
14
|
|
15
|
+
Filament::Application::plugin(Filament::Plugins::Push)
|
28
16
|
|
29
17
|
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'filament/package'
|
2
|
+
|
3
|
+
module Filament
|
4
|
+
class Package
|
5
|
+
# returns true if this package is under svn control
|
6
|
+
def svn?
|
7
|
+
p = @realpath + '.svn'
|
8
|
+
return p.exist?
|
9
|
+
end
|
10
|
+
|
11
|
+
def revision
|
12
|
+
return svn_revision
|
13
|
+
end
|
14
|
+
|
15
|
+
def update
|
16
|
+
return svn_update
|
17
|
+
end
|
18
|
+
|
19
|
+
def status
|
20
|
+
return svn_status
|
21
|
+
end
|
22
|
+
|
23
|
+
def commit(msg)
|
24
|
+
return svn_commit(msg)
|
25
|
+
end
|
26
|
+
|
27
|
+
def svn_info
|
28
|
+
stream = IO.popen("svn info #{@pathname.realpath}")
|
29
|
+
return YAML.load(stream)
|
30
|
+
end
|
31
|
+
|
32
|
+
def svn_revision
|
33
|
+
return 0 unless svn?
|
34
|
+
return svn_info['Last Changed Rev'].to_i
|
35
|
+
end
|
36
|
+
|
37
|
+
def svn_url
|
38
|
+
return nil unless svn?
|
39
|
+
return svn_info['URL']
|
40
|
+
end
|
41
|
+
|
42
|
+
def svn_base_url
|
43
|
+
return url.gsub(/\/(trunk|branches\/[.^\/]*|tags\/[.^\/]*)$/, '')
|
44
|
+
end
|
45
|
+
|
46
|
+
# if this package is under version control, it will update it
|
47
|
+
# if this package has subpackages, it will update them
|
48
|
+
def svn_update
|
49
|
+
if svn?
|
50
|
+
puts full_name
|
51
|
+
system('svn update')
|
52
|
+
end
|
53
|
+
subpackages.each { |s| s.update }
|
54
|
+
end
|
55
|
+
|
56
|
+
# if this package is under version control, it will print its status
|
57
|
+
# if this package has subpackages it will print their status
|
58
|
+
def svn_status
|
59
|
+
if svn?
|
60
|
+
puts full_name
|
61
|
+
system('svn status')
|
62
|
+
end
|
63
|
+
subpackages.each { |s| s.status }
|
64
|
+
end
|
65
|
+
|
66
|
+
# if this package is under version control, it will commit it with the
|
67
|
+
# given msg
|
68
|
+
# if this package has subpackages it will commit them
|
69
|
+
def svn_commit(msg)
|
70
|
+
if svn?
|
71
|
+
puts full_name
|
72
|
+
system("svn ci -m \"#{msg}\"")
|
73
|
+
end
|
74
|
+
subpackages.each { |s| s.commit(msg) }
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.build_uri(h)
|
78
|
+
uri = h[:uri]
|
79
|
+
|
80
|
+
return uri unless @uri.nil?
|
81
|
+
|
82
|
+
package_path = h[:package_path]
|
83
|
+
base_uri = h[:root_uri] || ENV['BASE_SVN_URL']
|
84
|
+
|
85
|
+
tag = h[:tag]
|
86
|
+
branch = h[:branch]
|
87
|
+
|
88
|
+
return "#{base_uri}/tags/#{package_path}/#{tag}" unless tag.nil?
|
89
|
+
return "#{base_uri}/branches/#{package_path}/#{branch}" unless branch.nil?
|
90
|
+
return "#{base_uri}/trunk/#{package_path}"
|
91
|
+
end
|
92
|
+
|
93
|
+
# checks out the package into the current wd (preserving its path)
|
94
|
+
def self.checkout(h)
|
95
|
+
uri = Package.build_uri(h)
|
96
|
+
pkg = Package.create(h)
|
97
|
+
pkg.system("svn co #{uri} .")
|
98
|
+
return pkg
|
99
|
+
end
|
100
|
+
|
101
|
+
# exports a url to a given dir
|
102
|
+
def self.export(h)
|
103
|
+
uri = Package.build_uri(h)
|
104
|
+
pkg = Package.create(h)
|
105
|
+
pkg.system("svn export #{uri} .")
|
106
|
+
return pkg
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
#class URI::Generic
|
113
|
+
# def to_package
|
114
|
+
# s = SVN.new(uri)
|
115
|
+
# raise "not an svn uri" unless s.valid?
|
116
|
+
# pkg = export(:package_path => s.path,
|
117
|
+
# :uri => s.uri,
|
118
|
+
# :root_dir => Filament::Package.CACHE_DIR)
|
119
|
+
# return pkg
|
120
|
+
# end
|
121
|
+
#end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'filament/package/svn'
|
2
|
+
require 'svn'
|
3
|
+
|
4
|
+
module Filament::Plugins
|
5
|
+
class SvnPlugin < Plugin
|
6
|
+
def initialize(app)
|
7
|
+
app.subcommand('update', "Updates given package and subpackages") do |args|
|
8
|
+
packages = PackageList.new(*args)
|
9
|
+
packages.each do |package|
|
10
|
+
package.update
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
app.subcommand('status', "Shows status given of package and subpackages") do |args|
|
15
|
+
packages = PackageList.new(*args)
|
16
|
+
packages.each do |package|
|
17
|
+
package.status
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
app.subcommand('checkout', "Checks out a package into the workspace") do |args|
|
22
|
+
url, package_uri = *args
|
23
|
+
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -75,4 +75,12 @@ class SVN
|
|
75
75
|
SVN.new("#{@uri}/#{child}")
|
76
76
|
end
|
77
77
|
end
|
78
|
+
|
79
|
+
def checkout(path)
|
80
|
+
raise "error checking out to #{path}" unless system("svn co #{@uri} #{path}")
|
81
|
+
end
|
82
|
+
|
83
|
+
def export(path)
|
84
|
+
raise "error exporting to #{path}" unless system("svn export #{@uri} #{path}")
|
85
|
+
end
|
78
86
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: filament
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2006-03-
|
6
|
+
version: 0.2.0
|
7
|
+
date: 2006-03-17 00:00:00 -05:00
|
8
8
|
summary: A flexible dependency-based build platform based on Rake
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -32,35 +32,20 @@ files:
|
|
32
32
|
- bin/filament-dbg
|
33
33
|
- bin/filament-opt
|
34
34
|
- bin/filament-test
|
35
|
-
- bin/init
|
36
|
-
- tests/build
|
37
|
-
- tests/gen
|
38
|
-
- tests/java
|
39
35
|
- tests/platform_test.rb
|
40
36
|
- tests/root
|
41
|
-
- tests/build/artifact_name_test.rb
|
42
|
-
- tests/build/artifact_test.rb
|
43
|
-
- tests/gen/java
|
44
|
-
- tests/gen/java/block_test.rb
|
45
|
-
- tests/gen/java/callable_test.rb
|
46
|
-
- tests/gen/java/method_test.rb
|
47
|
-
- tests/gen/java/statement_test.rb
|
48
|
-
- tests/java/tools_test.rb
|
49
37
|
- lib/filament
|
50
38
|
- lib/filament.rb
|
51
39
|
- lib/inflector.rb
|
52
|
-
- lib/svn.rb
|
53
40
|
- lib/filament/artifact.rb
|
54
41
|
- lib/filament/context.rb
|
55
|
-
- lib/filament/package
|
56
42
|
- lib/filament/package.rb
|
57
43
|
- lib/filament/platform.rb
|
58
|
-
- lib/filament/
|
44
|
+
- lib/filament/plugin.rb
|
59
45
|
- lib/filament/resolver.rb
|
60
46
|
- lib/filament/target.rb
|
61
47
|
- lib/filament/util
|
62
48
|
- lib/filament/workspace.rb
|
63
|
-
- lib/filament/package/svn.rb
|
64
49
|
- lib/filament/util/filelist2.rb
|
65
50
|
- lib/filament/util/fileutils.rb
|
66
51
|
- lib/filament/util/lazy_list.rb
|
@@ -68,12 +53,17 @@ files:
|
|
68
53
|
- plugins/01java
|
69
54
|
- plugins/02javame
|
70
55
|
- plugins/05push
|
56
|
+
- plugins/10svn
|
71
57
|
- plugins/00util/lib
|
58
|
+
- plugins/00util/lib/filament
|
72
59
|
- plugins/00util/lib/init.rb
|
60
|
+
- plugins/00util/lib/filament/plugins
|
61
|
+
- plugins/00util/lib/filament/plugins/util.rb
|
73
62
|
- plugins/01java/lib
|
74
63
|
- plugins/01java/lib/filament
|
75
64
|
- plugins/01java/lib/init.rb
|
76
65
|
- plugins/01java/lib/filament/java
|
66
|
+
- plugins/01java/lib/filament/plugins
|
77
67
|
- plugins/01java/lib/filament/java/mixins
|
78
68
|
- plugins/01java/lib/filament/java/tools
|
79
69
|
- plugins/01java/lib/filament/java/tools.rb
|
@@ -82,6 +72,7 @@ files:
|
|
82
72
|
- plugins/01java/lib/filament/java/tools/execute.rb
|
83
73
|
- plugins/01java/lib/filament/java/tools/jar.rb
|
84
74
|
- plugins/01java/lib/filament/java/tools/proguard.rb
|
75
|
+
- plugins/01java/lib/filament/plugins/java.rb
|
85
76
|
- plugins/02javame/lib
|
86
77
|
- plugins/02javame/lib/filament
|
87
78
|
- plugins/02javame/lib/init.rb
|
@@ -105,12 +96,22 @@ files:
|
|
105
96
|
- plugins/05push/lib/bluetooth.rb
|
106
97
|
- plugins/05push/lib/filament
|
107
98
|
- plugins/05push/lib/init.rb
|
99
|
+
- plugins/05push/lib/filament/plugins
|
108
100
|
- plugins/05push/lib/filament/push
|
109
101
|
- plugins/05push/lib/filament/push.rb
|
102
|
+
- plugins/05push/lib/filament/plugins/push.rb
|
110
103
|
- plugins/05push/lib/filament/push/conduits
|
111
104
|
- plugins/05push/lib/filament/push/conduits/bluetooth_conduit.rb
|
112
105
|
- plugins/05push/lib/filament/push/conduits/filter_conduit.rb
|
113
106
|
- plugins/05push/lib/filament/push/conduits/scp_conduit.rb
|
107
|
+
- plugins/10svn/lib
|
108
|
+
- plugins/10svn/lib/filament
|
109
|
+
- plugins/10svn/lib/init.rb
|
110
|
+
- plugins/10svn/lib/svn.rb
|
111
|
+
- plugins/10svn/lib/filament/package
|
112
|
+
- plugins/10svn/lib/filament/plugins
|
113
|
+
- plugins/10svn/lib/filament/package/svn.rb
|
114
|
+
- plugins/10svn/lib/filament/plugins/svn.rb
|
114
115
|
- README
|
115
116
|
- CHANGELOG
|
116
117
|
test_files: []
|
@@ -136,3 +137,21 @@ dependencies:
|
|
136
137
|
- !ruby/object:Gem::Version
|
137
138
|
version: 0.7.0
|
138
139
|
version:
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: cmdparse
|
142
|
+
version_requirement:
|
143
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
144
|
+
requirements:
|
145
|
+
- - ">="
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
version: 2.0.0
|
148
|
+
version:
|
149
|
+
- !ruby/object:Gem::Dependency
|
150
|
+
name: memoize
|
151
|
+
version_requirement:
|
152
|
+
version_requirements: !ruby/object:Gem::Version::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: 1.2.2
|
157
|
+
version:
|
data/bin/init
DELETED
data/lib/filament/package/svn.rb
DELETED
@@ -1,123 +0,0 @@
|
|
1
|
-
require 'filament/package'
|
2
|
-
|
3
|
-
module Filament
|
4
|
-
class Package
|
5
|
-
# returns true if this package is under svn control
|
6
|
-
def svn?
|
7
|
-
p = @pathname + '.svn'
|
8
|
-
return p.exist?
|
9
|
-
end
|
10
|
-
|
11
|
-
def revision
|
12
|
-
return svn_revision
|
13
|
-
end
|
14
|
-
|
15
|
-
def update
|
16
|
-
return svn_update
|
17
|
-
end
|
18
|
-
|
19
|
-
def status
|
20
|
-
return svn_status
|
21
|
-
end
|
22
|
-
|
23
|
-
def commit(msg)
|
24
|
-
return svn_commit(msg)
|
25
|
-
end
|
26
|
-
|
27
|
-
def svn_info
|
28
|
-
stream = IO.popen("svn info #{@pathname.realpath}")
|
29
|
-
return YAML.load(stream)
|
30
|
-
end
|
31
|
-
|
32
|
-
def svn_revision
|
33
|
-
return 0 unless svn?
|
34
|
-
return svn_info['Last Changed Rev'].to_i
|
35
|
-
end
|
36
|
-
|
37
|
-
def svn_url
|
38
|
-
return nil unless svn?
|
39
|
-
return svn_info['URL']
|
40
|
-
end
|
41
|
-
|
42
|
-
def svn_base_url
|
43
|
-
return url.gsub(/\/(trunk|branches\/[.^\/]*|tags\/[.^\/]*)$/, '')
|
44
|
-
end
|
45
|
-
|
46
|
-
# if this package is under version control, it will update it
|
47
|
-
# if this package has subpackages, it will update them
|
48
|
-
def svn_update
|
49
|
-
if svn?
|
50
|
-
puts full_name
|
51
|
-
system('svn update')
|
52
|
-
end
|
53
|
-
subpackages.each { |s| s.update }
|
54
|
-
end
|
55
|
-
|
56
|
-
# if this package is under version control, it will print its status
|
57
|
-
# if this package has subpackages it will print their status
|
58
|
-
def svn_status
|
59
|
-
if svn?
|
60
|
-
puts full_name
|
61
|
-
system('svn status')
|
62
|
-
end
|
63
|
-
subpackages.each { |s| s.status }
|
64
|
-
end
|
65
|
-
|
66
|
-
# if this package is under version control, it will commit it with the
|
67
|
-
# given msg
|
68
|
-
# if this package has subpackages it will commit them
|
69
|
-
def svn_commit(msg)
|
70
|
-
if svn?
|
71
|
-
puts full_name
|
72
|
-
system("svn ci -m \"#{msg}\"")
|
73
|
-
end
|
74
|
-
subpackages.each { |s| s.commit(msg) }
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
def self.build_uri(h)
|
79
|
-
uri = h[:uri]
|
80
|
-
|
81
|
-
return uri unless @uri.nil?
|
82
|
-
|
83
|
-
package_path = h[:package_path]
|
84
|
-
base_uri = h[:root_uri] || ENV['BASE_SVN_URL']
|
85
|
-
|
86
|
-
tag = h[:tag]
|
87
|
-
branch = h[:branch]
|
88
|
-
|
89
|
-
return "#{base_uri}/tags/#{package_path}/#{tag}" unless tag.nil?
|
90
|
-
return "#{base_uri}/branches/#{package_path}/#{branch}" unless branch.nil?
|
91
|
-
return "#{base_uri}/trunk/#{package_path}"
|
92
|
-
end
|
93
|
-
|
94
|
-
# checks out the package into the current wd (preserving its path)
|
95
|
-
def self.checkout(h)
|
96
|
-
uri = Package.build_uri(h)
|
97
|
-
pkg = Package.create(h)
|
98
|
-
pkg.system("svn co #{uri} .")
|
99
|
-
return pkg
|
100
|
-
end
|
101
|
-
|
102
|
-
# exports a url to a given dir
|
103
|
-
def self.export(h)
|
104
|
-
uri = Package.build_uri(h)
|
105
|
-
pkg = Package.create(h)
|
106
|
-
pkg.system("svn export #{uri} .")
|
107
|
-
return pkg
|
108
|
-
end
|
109
|
-
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
|
114
|
-
#class URI::Generic
|
115
|
-
# def to_package
|
116
|
-
# s = SVN.new(uri)
|
117
|
-
# raise "not an svn uri" unless s.valid?
|
118
|
-
# pkg = export(:package_path => s.path,
|
119
|
-
# :uri => s.uri,
|
120
|
-
# :root_dir => Filament::Package.CACHE_DIR)
|
121
|
-
# return pkg
|
122
|
-
# end
|
123
|
-
#end
|
data/lib/filament/plugins.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
module Filament
|
2
|
-
def self.get_plugin_dirs(path)
|
3
|
-
pn = Pathname.new(path)
|
4
|
-
return pn.children.sort
|
5
|
-
end
|
6
|
-
|
7
|
-
def self.load_plugins(plugin_base_dir)
|
8
|
-
update_env(plugin_base_dir)
|
9
|
-
|
10
|
-
plugins = []
|
11
|
-
dirs = get_plugin_dirs(plugin_base_dir)
|
12
|
-
dirs.each do |child|
|
13
|
-
ln = child + 'lib'
|
14
|
-
|
15
|
-
if ln.exist?
|
16
|
-
$LOAD_PATH << ln.realpath
|
17
|
-
cn = ln + 'init.rb'
|
18
|
-
raise "cannot init filament plugin '#{child}'" unless cn.exist?
|
19
|
-
load cn.realpath
|
20
|
-
plugins << child.basename.to_s
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
puts "PLUGINS: #{plugins.join(', ')}"
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.update_env(plugin_base_dir)
|
28
|
-
plugin_dirs = get_plugin_dirs(plugin_base_dir)
|
29
|
-
script_dirs = plugin_dirs.collect {|dir| dir + 'script' }
|
30
|
-
ENV['PATH'] = script_dirs.join(':') + ':' + ENV['PATH']
|
31
|
-
end
|
32
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require 'build/artifact_lib'
|
4
|
-
|
5
|
-
class ArtifactNameTest < Test::Unit::TestCase
|
6
|
-
def test_parse
|
7
|
-
bad_an = [nil,
|
8
|
-
'',
|
9
|
-
'blah',
|
10
|
-
':target',
|
11
|
-
'package:target']
|
12
|
-
|
13
|
-
bad_an.each do |an|
|
14
|
-
assert_nil(Build::ArtifactName.parse(an))
|
15
|
-
end
|
16
|
-
|
17
|
-
good_an = [['//package', 'package', 'package'],
|
18
|
-
['//package/sub_package', 'package/sub_package', 'sub_package'],
|
19
|
-
['//package/sub_package:target', 'package/sub_package', 'target'],
|
20
|
-
['//package:target', 'package', 'target'],
|
21
|
-
['//j2me_util', 'j2me_util', 'j2me_util']]
|
22
|
-
|
23
|
-
good_an.each do |an, pn, tn|
|
24
|
-
a = Build::ArtifactName.parse(an)
|
25
|
-
assert_not_nil(a, "'#{an}' should not parse to nil")
|
26
|
-
assert_equal(pn, a.package)
|
27
|
-
assert_equal(tn, a.target)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
def test_target_name
|
32
|
-
bad_tn = [nil,
|
33
|
-
'',
|
34
|
-
'blah',
|
35
|
-
'//package']
|
36
|
-
bad_tn.each do |tn|
|
37
|
-
assert_equal(false,
|
38
|
-
Build::ArtifactName.target_name?(tn),
|
39
|
-
"'#{tn}' should not be a valid target name.")
|
40
|
-
end
|
41
|
-
|
42
|
-
good_tn = [':target']
|
43
|
-
good_tn.each do |tn|
|
44
|
-
assert(Build::ArtifactName.target_name?(tn),
|
45
|
-
"'#{tn}' should be a valid target name.")
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_package_name
|
50
|
-
bad_pn = [nil,
|
51
|
-
'',
|
52
|
-
'blah',
|
53
|
-
':target',
|
54
|
-
'//package:target']
|
55
|
-
bad_pn.each do |pn|
|
56
|
-
assert_equal(false,
|
57
|
-
Build::ArtifactName.package_name?(pn),
|
58
|
-
"'#{pn}' should not be a valid package name.")
|
59
|
-
end
|
60
|
-
|
61
|
-
good_pn = ['//package',
|
62
|
-
'//package/sub_package']
|
63
|
-
|
64
|
-
good_pn.each do |pn|
|
65
|
-
assert(Build::ArtifactName.package_name?(pn),
|
66
|
-
"'#{pn}' should be a valid package name.")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def test_strip
|
71
|
-
stripped = [['package', '//package'],
|
72
|
-
['package/sub_package', '//package/sub_package'],
|
73
|
-
['target', ':target'],
|
74
|
-
['blah', 'blah'],
|
75
|
-
['//package:target', '//package:target']]
|
76
|
-
|
77
|
-
stripped.each do |val, arg|
|
78
|
-
assert_equal(val, Build::ArtifactName.strip(arg))
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_fetch
|
83
|
-
an = Build::ArtifactName.new(:target => 'target', :package => 'package')
|
84
|
-
end
|
85
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require 'build/artifact'
|
4
|
-
|
5
|
-
class ArtifactTest < Test::Unit::TestCase
|
6
|
-
def test_flatten_deps
|
7
|
-
a1 = Build::Artifact.define_artifact(:a1, :p)
|
8
|
-
a2 = Build::Artifact.define_artifact(:a2, :p)
|
9
|
-
b1 = Build::Artifact.define_artifact(:b1, :p, ['//p:a1'])
|
10
|
-
b2 = Build::Artifact.define_artifact(:b2, :p, ['//p:a1', '//p:a2'])
|
11
|
-
c = Build::Artifact.define_artifact(:a1, :p, ['//p:b1', '//p:b2'])
|
12
|
-
|
13
|
-
all_deps = Build::Artifact.flatten_deps(c).collect do |artifact|
|
14
|
-
artifact.name.to_s
|
15
|
-
end
|
16
|
-
all_deps.sort!
|
17
|
-
|
18
|
-
answer = ['//p:a1', '//p:a2', '//p:b1', '//p:b2']
|
19
|
-
answer.sort!
|
20
|
-
|
21
|
-
assert_equal(answer, all_deps)
|
22
|
-
end
|
23
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require 'gen/java/block'
|
4
|
-
|
5
|
-
class JavaBlockTest < Test::Unit::TestCase
|
6
|
-
include Gen::Java
|
7
|
-
|
8
|
-
STATEMENTS = ['int a = 0;',
|
9
|
-
'int b = a + 2;',
|
10
|
-
'//start',
|
11
|
-
'System.out.println(b);',
|
12
|
-
'//end']
|
13
|
-
|
14
|
-
def test_append
|
15
|
-
jb = JavaBlock.new
|
16
|
-
STATEMENTS.each do |s|
|
17
|
-
jb << s
|
18
|
-
end
|
19
|
-
|
20
|
-
assert_equal(STATEMENTS,
|
21
|
-
jb.statements)
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_parse
|
25
|
-
text = ""
|
26
|
-
STATEMENTS.each do |s|
|
27
|
-
text << s << "\n"
|
28
|
-
end
|
29
|
-
|
30
|
-
assert_equal(STATEMENTS,
|
31
|
-
JavaBlock.parse(text).statements)
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_to_s
|
35
|
-
j = ['a = b;',
|
36
|
-
'b = c;']
|
37
|
-
|
38
|
-
s = "{\n a = b;\n b = c;\n }"
|
39
|
-
assert_equal(s,
|
40
|
-
JavaBlock.new(:statements => j).to_s(1))
|
41
|
-
end
|
42
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require 'gen/java/variable'
|
4
|
-
require 'gen/java/callable'
|
5
|
-
|
6
|
-
class JavaCallableTest < Test::Unit::TestCase
|
7
|
-
include Gen::Java
|
8
|
-
|
9
|
-
def test_to_s
|
10
|
-
jb = JavaBlock.new(:indent => 1,
|
11
|
-
:statements => ['a = b;',
|
12
|
-
'b = c;'])
|
13
|
-
a = JavaVariable.new(:int, :a)
|
14
|
-
b = JavaVariable.new(:String, :b)
|
15
|
-
|
16
|
-
s = "callable(int a, String b) {\n a = b;\n b = c;\n }"
|
17
|
-
|
18
|
-
assert_equal(s,
|
19
|
-
JavaCallable.new(:name => :callable,
|
20
|
-
:params => [a, b],
|
21
|
-
:block => jb).to_s(1))
|
22
|
-
end
|
23
|
-
end
|
@@ -1,25 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require 'gen/java/method'
|
4
|
-
|
5
|
-
class JavaMethodTest < Test::Unit::TestCase
|
6
|
-
include Gen::Java
|
7
|
-
|
8
|
-
def test_to_s
|
9
|
-
jb = JavaBlock.new(:indent => 1,
|
10
|
-
:statements => ['a = b;',
|
11
|
-
'b = c;'])
|
12
|
-
a = JavaVariable.new(:int, :a)
|
13
|
-
b = JavaVariable.new(:String, :b)
|
14
|
-
|
15
|
-
s = "private int callable(int a, String b) {\n a = b;\n b = c;\n}"
|
16
|
-
|
17
|
-
assert_equal(s,
|
18
|
-
JavaMethod.new(:type => :int,
|
19
|
-
:visibility => :private,
|
20
|
-
:name => :callable,
|
21
|
-
:params => [a, b],
|
22
|
-
:block => jb).to_s)
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'test/unit'
|
2
|
-
|
3
|
-
require 'gen/java/statement'
|
4
|
-
|
5
|
-
class JavaStatementTest < Test::Unit::TestCase
|
6
|
-
include Gen::Java
|
7
|
-
|
8
|
-
def test_comment?
|
9
|
-
js = JavaStatement.new('a = b;')
|
10
|
-
|
11
|
-
assert(!js.comment?, "#{js.to_s} should not be considered a comment")
|
12
|
-
|
13
|
-
js = JavaStatement.new('//asdf')
|
14
|
-
assert(js.comment?, "#{js.to_s} should be considered a comment")
|
15
|
-
end
|
16
|
-
end
|