filament 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +26 -0
- data/lib/filament/os.rb +77 -0
- data/lib/filament/package.rb +76 -26
- data/lib/filament/platform.rb +81 -78
- data/lib/filament/target.rb +50 -11
- data/lib/filament/util/filelist2.rb +10 -2
- data/lib/filament/util/fileutils.rb +1 -1
- data/lib/filament.rb +48 -24
- data/plugins/00util/lib/filament/plugins/util.rb +7 -7
- data/plugins/01java/lib/filament/java/mixins/classpath.rb +11 -0
- data/plugins/01java/lib/filament/java/tools/compile.rb +3 -1
- data/plugins/01java/lib/filament/java/tools/execute.rb +3 -1
- data/plugins/01java/lib/filament/java/tools/jar.rb +16 -12
- data/plugins/01java/lib/filament/java/tools/proguard.rb +2 -0
- data/plugins/01java/lib/filament/java/tools.rb +18 -18
- data/plugins/01java/lib/filament/plugins/java.rb +1 -1
- data/plugins/02javame/lib/filament/javame/library.rb +79 -16
- data/plugins/02javame/lib/filament/javame/suite.rb +75 -16
- data/plugins/02javame/lib/filament/javame/tasks/library_task.rb +190 -0
- data/plugins/02javame/lib/filament/javame/tools/emulator.rb +1 -1
- data/plugins/02javame/lib/filament/javame/tools/external/mpp_sdk.rb +0 -1
- data/plugins/02javame/lib/filament/javame/tools/external/wtk.rb +0 -1
- data/plugins/02javame/lib/filament/javame/{platform.rb → tools/platform.rb} +6 -5
- data/plugins/02javame/lib/filament/javame/tools/preverifier.rb +1 -1
- data/plugins/02javame/lib/filament/javame/tools.rb +1 -1
- data/plugins/02javame/lib/init.rb +6 -19
- data/plugins/04spin/lib/filament/spin/sji.rb +36 -0
- data/plugins/04spin/lib/filament/spin/tasks/sji_task.rb +86 -0
- data/plugins/04spin/lib/init.rb +4 -0
- data/plugins/04spin/lib/spin/sji.rb +339 -0
- data/plugins/05push/lib/filament/plugins/push.rb +3 -3
- data/plugins/10svn/lib/filament/plugins/svn.rb +3 -3
- data/plugins/10svn/lib/filament/scm/svn.rb +7 -13
- data/plugins/10svn/lib/init.rb +1 -1
- data/plugins/11http/lib/filament/plugins/http.rb +6 -0
- data/plugins/11http/lib/filament/scm/http.rb +67 -0
- data/plugins/11http/lib/init.rb +5 -0
- metadata +34 -8
- data/lib/filament/artifact.rb +0 -49
- data/plugins/01java/lib/filament/java/mixins/java_mixin.rb +0 -19
- data/plugins/02javame/lib/filament/javame/mixins/library_mixin.rb +0 -181
- data/plugins/02javame/lib/filament/javame/mixins/suite_mixin.rb +0 -114
data/CHANGELOG
CHANGED
@@ -1,3 +1,29 @@
|
|
1
|
+
0.3.0:
|
2
|
+
Filament:
|
3
|
+
- Updated Target#output to optionally take a block as output value
|
4
|
+
- Renamed Scm => SCM
|
5
|
+
- Created CompoundSCM to manage many SCMs
|
6
|
+
- Moved Filament::Platform module to Filament::OS
|
7
|
+
- Created Platform class, to manage platforms - use Platform.import(<yaml>)
|
8
|
+
- Replaced Artifact with Target
|
9
|
+
- FileList2 now has a tag attribute, allowing to set the tag it uses to resolve targets
|
10
|
+
- Added dependence on mechanize gem
|
11
|
+
- [FIXED] create scms with realpath, not package
|
12
|
+
HTTP Plugin:
|
13
|
+
- Uses mechanize to crawl a page for links
|
14
|
+
- Added plugin to manage pulling stuff from the web
|
15
|
+
- Future support may include pushing stuff to the web (over webdav)
|
16
|
+
Spin Plugin:
|
17
|
+
- Added libs for generating sji (both java and spin) interfaces
|
18
|
+
- creates a target with :java and :spin source outputs
|
19
|
+
- outputs a jad_proc to add entries for interpreter startup
|
20
|
+
|
21
|
+
Java Plugin:
|
22
|
+
- Dropped use of JAVAC, JAR, etc. to just use java_bin('javac'), etc.
|
23
|
+
JavaME Plugin:
|
24
|
+
- Merged Library and Suite functionality into a single rake tasklib
|
25
|
+
- Simplified Library and Suite artifacts
|
26
|
+
|
1
27
|
0.2.3:
|
2
28
|
SVN Plugin:
|
3
29
|
- Fixed an svn include problem
|
data/lib/filament/os.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
module Filament::OS
|
2
|
+
TARGET_PLATFORMS = {}
|
3
|
+
|
4
|
+
def darwin?
|
5
|
+
return ! PLATFORM.index("darwin").nil?
|
6
|
+
end
|
7
|
+
|
8
|
+
def windows?
|
9
|
+
return cygwin?
|
10
|
+
end
|
11
|
+
|
12
|
+
def cygwin?
|
13
|
+
return ! PLATFORM.index("cygwin").nil?
|
14
|
+
end
|
15
|
+
|
16
|
+
def sys(c)
|
17
|
+
log c
|
18
|
+
raise "!!! Error executing '#{c}'" unless system(c)
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_unix_path(path)
|
22
|
+
return nil if path.nil?
|
23
|
+
if cygwin?
|
24
|
+
return path unless /:\\/ === path
|
25
|
+
drive, path = path.split(":\\", 2)
|
26
|
+
path.gsub!(/\\/, '/')
|
27
|
+
return "/cygdrive/#{drive}/#{path}"
|
28
|
+
end
|
29
|
+
return path
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_exec_path(path)
|
33
|
+
return nil if path.nil?
|
34
|
+
return to_unix_path(path) if cygwin?
|
35
|
+
return path
|
36
|
+
end
|
37
|
+
|
38
|
+
def to_windows_path(path)
|
39
|
+
return nil if path.nil?
|
40
|
+
if path.index('cygdrive').nil?
|
41
|
+
puts "#{path}\n"
|
42
|
+
return path
|
43
|
+
end
|
44
|
+
|
45
|
+
path = path.chomp.sub(/\/cygdrive\//, '')
|
46
|
+
drive, path = path.split(/\//, 2)
|
47
|
+
|
48
|
+
return "#{drive}:/#{path}"
|
49
|
+
end
|
50
|
+
|
51
|
+
def fix_paths(paths)
|
52
|
+
return nil if paths.nil?
|
53
|
+
|
54
|
+
if cygwin?
|
55
|
+
paths = paths.to_a.collect do |path|
|
56
|
+
to_windows_path(path)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
return paths.to_a
|
61
|
+
end
|
62
|
+
|
63
|
+
def join_paths(paths)
|
64
|
+
return nil if paths.nil?
|
65
|
+
|
66
|
+
if windows?
|
67
|
+
joined = fix_paths(paths).join(';')
|
68
|
+
return "'#{joined}'"
|
69
|
+
end
|
70
|
+
|
71
|
+
return fix_paths(paths).join(':')
|
72
|
+
end
|
73
|
+
|
74
|
+
alias :u :to_unix_path
|
75
|
+
alias :w :to_windows_path
|
76
|
+
alias :fix :fix_paths
|
77
|
+
end
|
data/lib/filament/package.rb
CHANGED
@@ -17,33 +17,72 @@ module Filament
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
def initialize(package)
|
26
|
-
@package = package
|
27
|
-
end
|
20
|
+
module SCM
|
21
|
+
class Base
|
22
|
+
def self.applies?(path)
|
23
|
+
return false
|
24
|
+
end
|
28
25
|
|
29
|
-
|
26
|
+
def initialize(path)
|
27
|
+
@realpath = Pathname.new(path)
|
28
|
+
raise "path must be absolute" unless @realpath.absolute?
|
29
|
+
end
|
30
|
+
|
31
|
+
def revision; return nil; end
|
32
|
+
|
33
|
+
def update; end
|
30
34
|
|
31
|
-
|
32
|
-
|
35
|
+
def status; end
|
36
|
+
|
37
|
+
def commit(msg); end
|
33
38
|
end
|
34
39
|
|
35
|
-
|
36
|
-
|
40
|
+
class CompoundSCM
|
41
|
+
def initialize
|
42
|
+
@scms = []
|
43
|
+
end
|
44
|
+
|
45
|
+
def <<(scm)
|
46
|
+
@scms << scm
|
47
|
+
end
|
48
|
+
|
49
|
+
def update
|
50
|
+
@scms.each {|s| s.update}
|
51
|
+
end
|
52
|
+
|
53
|
+
def status
|
54
|
+
@scms.each {|s| s.status}
|
55
|
+
end
|
56
|
+
|
57
|
+
def commit(msg)
|
58
|
+
@scms.each {|s| s.commit(msg)}
|
59
|
+
end
|
60
|
+
|
61
|
+
def empty?
|
62
|
+
return @scms.empty?
|
63
|
+
end
|
37
64
|
end
|
65
|
+
|
66
|
+
class PackageSCM
|
67
|
+
def initialize(package)
|
68
|
+
@package = package
|
69
|
+
end
|
70
|
+
|
71
|
+
def update
|
72
|
+
@package.subpackages.each {|s| s.scm.update}
|
73
|
+
end
|
38
74
|
|
39
|
-
|
40
|
-
|
75
|
+
def status
|
76
|
+
@package.subpackages.each {|s| s.scm.status}
|
77
|
+
end
|
78
|
+
|
79
|
+
def commit(msg)
|
80
|
+
@package.subpackages.each {|s| s.scm.commit(msg)}
|
81
|
+
end
|
41
82
|
end
|
42
83
|
end
|
43
84
|
|
44
85
|
class Package
|
45
|
-
include Memoize
|
46
|
-
|
47
86
|
@@package_scms = []
|
48
87
|
def self.scm(klass)
|
49
88
|
@@package_scms << klass
|
@@ -53,12 +92,12 @@ module Filament
|
|
53
92
|
klass.new(name, &block)
|
54
93
|
end
|
55
94
|
|
95
|
+
attr_accessor2 :scm
|
96
|
+
|
56
97
|
attr_reader :parent, :name, :realpath, :workspace, :package_resolver, :target_resolver, :build_context
|
57
98
|
alias :pathname :realpath
|
58
99
|
|
59
100
|
def initialize(h)
|
60
|
-
memoize :scm
|
61
|
-
|
62
101
|
@parent = h[:parent]
|
63
102
|
@workspace = h[:workspace]
|
64
103
|
|
@@ -104,6 +143,8 @@ module Filament
|
|
104
143
|
|
105
144
|
@execution_context = ExecutionContext.new(self)
|
106
145
|
@build_context = BuildContext.new(self)
|
146
|
+
|
147
|
+
@scm = SCM::CompoundSCM.new
|
107
148
|
end
|
108
149
|
|
109
150
|
def exist?
|
@@ -293,12 +334,18 @@ module Filament
|
|
293
334
|
|
294
335
|
# returns the scm for this package
|
295
336
|
def scm
|
337
|
+
load
|
338
|
+
|
339
|
+
return @scm unless @scm.empty?
|
340
|
+
|
341
|
+
@scm << Filament::SCM::PackageSCM.new(self)
|
342
|
+
|
296
343
|
@@package_scms.each do |scm|
|
297
|
-
|
344
|
+
@scm << scm.new(@realpath) if scm.applies?(self)
|
298
345
|
end
|
299
346
|
|
300
347
|
# default to the simplest scm
|
301
|
-
return
|
348
|
+
return @scm
|
302
349
|
end
|
303
350
|
|
304
351
|
# executes cmd with this packages as the wd, and with $this_package set to self
|
@@ -317,7 +364,7 @@ module Filament
|
|
317
364
|
end
|
318
365
|
|
319
366
|
### Target-related stuff
|
320
|
-
def
|
367
|
+
def loaded?
|
321
368
|
return @descriptor_loaded
|
322
369
|
end
|
323
370
|
|
@@ -330,14 +377,17 @@ module Filament
|
|
330
377
|
return self
|
331
378
|
end
|
332
379
|
|
333
|
-
def load
|
334
|
-
return if
|
380
|
+
def load(fail_on_missing=false)
|
381
|
+
return if loaded?
|
335
382
|
@descriptor_loaded = true
|
336
383
|
|
337
384
|
pn = Pathname.new(descriptor)
|
338
385
|
unless pn.exist?
|
339
|
-
|
340
|
-
|
386
|
+
unless parent? or not fail_on_missing
|
387
|
+
raise "package descriptor for #{@realpath} does not exist '#{pn}'"
|
388
|
+
end
|
389
|
+
|
390
|
+
return
|
341
391
|
end
|
342
392
|
|
343
393
|
@execution_context.execute { instance_eval(pn.read, pn.realpath) }
|
data/lib/filament/platform.rb
CHANGED
@@ -1,79 +1,82 @@
|
|
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
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Filament
|
4
|
+
class Platform
|
5
|
+
def self.property(*attrs)
|
6
|
+
attrs.each do |a|
|
7
|
+
attr_writer(a)
|
8
|
+
define_method(a) do
|
9
|
+
value = @attributes[a]
|
10
|
+
return value unless value.nil?
|
11
|
+
prototypes.each do |p|
|
12
|
+
value = p.send(a)
|
13
|
+
break if value.nil?
|
14
|
+
end
|
15
|
+
return value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.property_list(*attrs)
|
21
|
+
attrs.each do |a|
|
22
|
+
attr_writer(a)
|
23
|
+
define_method(a) do
|
24
|
+
value = @attributes[a] || []
|
25
|
+
value = value.to_a
|
26
|
+
prototypes.each {|p| value += p.send(a)}
|
27
|
+
return value
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.import(data)
|
33
|
+
platforms = YAML.load(data)
|
34
|
+
|
35
|
+
platforms.each do |name, map|
|
36
|
+
attributes = {}
|
37
|
+
map.each do |key, value|
|
38
|
+
attributes[key.to_sym] = value
|
39
|
+
end
|
40
|
+
|
41
|
+
create(name, attributes)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.create(name, attributes)
|
46
|
+
name = name.to_sym
|
47
|
+
|
48
|
+
prototypes = attributes.delete(:inherit) || []
|
49
|
+
prototypes = prototypes.to_a
|
50
|
+
|
51
|
+
platform = new(name, prototypes, attributes)
|
52
|
+
@@platforms ||= {}
|
53
|
+
@@platforms[name] = platform
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.find(h)
|
57
|
+
name = h[:name].to_sym
|
58
|
+
|
59
|
+
@@platforms ||= {}
|
60
|
+
return @@platforms[name]
|
61
|
+
end
|
62
|
+
|
63
|
+
property_list :tags, :classpath
|
64
|
+
property :javame_configuration, :javame_configuration_version
|
65
|
+
|
66
|
+
attr_reader :name
|
67
|
+
|
68
|
+
def prototypes
|
69
|
+
return @prototypes.collect {|p| Platform.find(:name => p)}
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
def initialize(name, prototypes, attributes)
|
74
|
+
@name = name
|
75
|
+
@attributes = attributes
|
76
|
+
@prototypes = prototypes
|
77
|
+
|
78
|
+
tags = @attributes[:tags] || []
|
79
|
+
@attributes[:tags] = tags.to_a.collect {|tag| tag.to_sym}
|
80
|
+
end
|
81
|
+
end
|
79
82
|
end
|
data/lib/filament/target.rb
CHANGED
@@ -28,7 +28,7 @@ module Filament
|
|
28
28
|
|
29
29
|
@package = h[:package] || $context[:this_package]
|
30
30
|
@invoked = false
|
31
|
-
@
|
31
|
+
@proc = Proc.new {}
|
32
32
|
@outputs = {}
|
33
33
|
@deployables = []
|
34
34
|
|
@@ -36,6 +36,27 @@ module Filament
|
|
36
36
|
raise 'targets must have a package' if @package.nil?
|
37
37
|
|
38
38
|
@package << self
|
39
|
+
|
40
|
+
init
|
41
|
+
|
42
|
+
@proc = Proc.new do
|
43
|
+
instance_eval(&block)
|
44
|
+
define
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def init; end
|
49
|
+
|
50
|
+
def define; end
|
51
|
+
|
52
|
+
def working_dir(subdir=nil)
|
53
|
+
base = "#{$context[:working_dir]}/#{package.path}/#{name}"
|
54
|
+
|
55
|
+
return subdir.nil? ? base : "#{base}/#{subdir.to_s}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def output_dir
|
59
|
+
return "#{$context[:output_dir]}/#{package.path}"
|
39
60
|
end
|
40
61
|
|
41
62
|
def uri
|
@@ -48,8 +69,9 @@ module Filament
|
|
48
69
|
end
|
49
70
|
|
50
71
|
# walks tree of dependencies, returns a complete list
|
51
|
-
def flattened_deps
|
72
|
+
def flattened_deps(include_weak=false)
|
52
73
|
all = @deps.to_a.clone
|
74
|
+
all += @weak_deps.to_a.clone if include_weak
|
53
75
|
|
54
76
|
fd = []
|
55
77
|
until all.empty?
|
@@ -57,33 +79,43 @@ module Filament
|
|
57
79
|
unless fd.include?(d)
|
58
80
|
fd << d
|
59
81
|
all += d.deps
|
82
|
+
all += d.weak_deps if include_weak
|
60
83
|
end
|
61
84
|
end
|
62
85
|
return fd
|
63
86
|
end
|
64
87
|
|
65
88
|
# adds some :output to the given :tag
|
89
|
+
# if a block is given, assume that's the output
|
66
90
|
# if :deployable is true, also adds :output to deployables
|
67
|
-
def output(h)
|
91
|
+
def output(h, &block)
|
68
92
|
tag = h[:tag]
|
69
|
-
|
93
|
+
h[:output] ||= block
|
70
94
|
if tag.respond_to?(:to_ary)
|
71
95
|
tag.to_ary.each do |t|
|
72
|
-
|
96
|
+
h2 = h.clone
|
97
|
+
h2[:tag] = t
|
98
|
+
output(h2)
|
73
99
|
end
|
74
100
|
else
|
75
|
-
@outputs[tag] =
|
101
|
+
@outputs[tag] = h
|
76
102
|
end
|
77
103
|
|
78
|
-
@deployables << output if h[:deployable]
|
104
|
+
@deployables << h[:output] if h[:deployable]
|
79
105
|
end
|
80
106
|
|
81
107
|
# returns the value in the output hash for the given tag
|
82
|
-
def
|
108
|
+
def [](tag)
|
83
109
|
invoke
|
84
|
-
|
110
|
+
|
111
|
+
o = @outputs[tag]
|
112
|
+
|
113
|
+
return nil if o.nil?
|
114
|
+
|
115
|
+
tasks = o[:tasks]
|
116
|
+
tasks.each {|t| t.invoke} unless tasks.nil?
|
117
|
+
return o[:output]
|
85
118
|
end
|
86
|
-
alias :[] :get_output
|
87
119
|
|
88
120
|
# builds this specific target (and all dependencies)
|
89
121
|
# after building, it executes the provided block in the build context
|
@@ -106,8 +138,15 @@ module Filament
|
|
106
138
|
@package.execute do
|
107
139
|
@weak_deps.each {|t| t.invoke}
|
108
140
|
@deps.each {|t| t.invoke}
|
141
|
+
|
109
142
|
puts ">>> BUILDING #{uri} (#{@package.pathname}, #{self})"
|
110
|
-
instance_eval(&@
|
143
|
+
instance_eval(&@proc)
|
144
|
+
|
145
|
+
@outputs.values.select{|h| h.key?(:tasks)}.collect{|h| h[:tasks]}.each do |tasks|
|
146
|
+
tasks.each do |t|
|
147
|
+
t.invoke
|
148
|
+
end
|
149
|
+
end
|
111
150
|
end
|
112
151
|
end
|
113
152
|
end
|
@@ -2,21 +2,29 @@ require 'filament/target'
|
|
2
2
|
|
3
3
|
module Filament
|
4
4
|
class FileList2 < FileList
|
5
|
+
attr_accessor :tag
|
6
|
+
attr_reader :targets
|
7
|
+
|
5
8
|
def initialize(*args)
|
6
9
|
super(*args)
|
7
10
|
@target_resolver = $context[:target_resolver]
|
11
|
+
@tag = :default
|
12
|
+
@targets = []
|
8
13
|
end
|
9
14
|
|
10
15
|
def resolve_filament_uris(*entries)
|
11
16
|
files = []
|
12
17
|
entries.each do |entry|
|
13
18
|
if entry.respond_to? :to_ary
|
14
|
-
|
19
|
+
resolve_filament_uris(*entry.to_ary)
|
15
20
|
else
|
16
21
|
if @target_resolver.valid_uri?(entry)
|
17
22
|
target = @target_resolver.resolve(entry)
|
23
|
+
|
18
24
|
raise "target does not exist: #{entry}" if target.nil?
|
19
|
-
|
25
|
+
@targets << target
|
26
|
+
|
27
|
+
include(*target[@tag].to_a)
|
20
28
|
else
|
21
29
|
files << entry
|
22
30
|
end
|