filament 0.3.0 → 0.4.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.
- data/CHANGES +96 -0
- data/README +2 -2
- data/lib/filament.rb +1 -1
- data/lib/filament/block_object.rb +11 -0
- data/lib/filament/os.rb +0 -3
- data/lib/filament/platform.rb +16 -0
- data/lib/filament/resolver.rb +2 -1
- data/lib/filament/target.rb +118 -10
- data/lib/filament/util/filelist2.rb +1 -1
- data/lib/filament/util/lazy_list.rb +9 -9
- data/plugins/00util/lib/filament/plugins/util.rb +18 -0
- data/plugins/01java/lib/filament/java/library.rb +88 -0
- data/plugins/{02javame/lib/filament/javame → 01java/lib/filament/java}/tasks/library_task.rb +86 -63
- data/plugins/01java/lib/filament/java/tools.rb +1 -0
- data/plugins/01java/lib/filament/java/tools/compile.rb +2 -2
- data/plugins/01java/lib/filament/java/tools/execute.rb +16 -9
- data/plugins/01java/lib/filament/java/tools/jar.rb +1 -1
- data/plugins/01java/lib/filament/java/tools/javadoc.rb +22 -0
- data/plugins/01java/lib/filament/java/tools/proguard.rb +1 -0
- data/plugins/{02javame → 01java}/lib/filament/javame/suite.rb +20 -22
- data/plugins/{02javame → 01java}/lib/filament/javame/tasks.rb +0 -1
- data/plugins/{02javame → 01java}/lib/filament/javame/tools.rb +0 -1
- data/plugins/{02javame → 01java}/lib/filament/javame/tools/descriptor.rb +19 -7
- data/plugins/{02javame → 01java}/lib/filament/javame/tools/emulator.rb +0 -1
- data/plugins/{02javame → 01java}/lib/filament/javame/tools/external/mpp_sdk.rb +0 -0
- data/plugins/{02javame → 01java}/lib/filament/javame/tools/external/wtk.rb +0 -0
- data/plugins/{02javame → 01java}/lib/filament/javame/tools/preverifier.rb +0 -2
- data/plugins/01java/lib/filament/javase/application.rb +43 -0
- data/plugins/01java/lib/filament/javase/tasks.rb +1 -0
- data/plugins/01java/lib/init.rb +16 -0
- data/plugins/04spin/lib/filament/spin/sji.rb +17 -19
- data/plugins/04spin/lib/filament/spin/tasks/sji_task.rb +11 -10
- data/plugins/04spin/lib/spin/sji.rb +371 -170
- data/plugins/05push/lib/filament/plugins/push.rb +6 -9
- data/plugins/05push/lib/filament/push.rb +1 -1
- data/plugins/05push/lib/filament/push/conduits/filter_conduit.rb +1 -1
- metadata +74 -64
- data/CHANGELOG +0 -81
- data/plugins/02javame/lib/filament/javame/library.rb +0 -79
- data/plugins/02javame/lib/filament/javame/tools/platform.rb +0 -50
- data/plugins/02javame/lib/init.rb +0 -14
data/plugins/{02javame/lib/filament/javame → 01java/lib/filament/java}/tasks/library_task.rb
RENAMED
@@ -1,22 +1,34 @@
|
|
1
1
|
require 'rake'
|
2
2
|
|
3
|
-
|
3
|
+
class Rake::Task
|
4
|
+
def phase_h
|
5
|
+
@phase_h ||= Hash.new
|
6
|
+
return @phase_h
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
module Filament::Java::Tasks
|
4
12
|
class LibraryTask < Filament::Task
|
5
13
|
def initialize
|
6
14
|
@bootclasspath = []
|
7
15
|
@classpath = []
|
8
16
|
@cldc_version = nil
|
9
17
|
@defaultmidlet_class = nil
|
18
|
+
@doc_dir = nil
|
10
19
|
@is_suite = false
|
11
20
|
@jad_proc = Proc.new {}
|
21
|
+
@jvm_source_version = nil
|
22
|
+
@jvm_target_version = nil
|
12
23
|
@me_configuration = 'CLDC-1.0'
|
13
24
|
@me_profile = 'MIDP-2.0'
|
14
|
-
@midlets= []
|
25
|
+
@midlets = []
|
15
26
|
@name = nil
|
16
27
|
@output_dir = nil
|
17
28
|
@proguard_proc = nil
|
18
29
|
@resources = []
|
19
30
|
@should_obfuscate = false # TODO should be based on $build_type
|
31
|
+
@should_preverify = false
|
20
32
|
@srcs = []
|
21
33
|
@suite_icon = nil
|
22
34
|
@suite_name = nil
|
@@ -42,6 +54,10 @@ module Filament::JavaME::Tasks
|
|
42
54
|
define
|
43
55
|
end
|
44
56
|
|
57
|
+
def javadoc_dir
|
58
|
+
return doc_dir
|
59
|
+
end
|
60
|
+
|
45
61
|
def jar_path
|
46
62
|
return "#{output_dir}/#{@name}.jar"
|
47
63
|
end
|
@@ -54,7 +70,6 @@ module Filament::JavaME::Tasks
|
|
54
70
|
tasks = []
|
55
71
|
tasks << @jar_task
|
56
72
|
tasks << @jad_task if suite?
|
57
|
-
|
58
73
|
return tasks
|
59
74
|
end
|
60
75
|
|
@@ -65,41 +80,70 @@ module Filament::JavaME::Tasks
|
|
65
80
|
def verify
|
66
81
|
end
|
67
82
|
|
83
|
+
def phase(name, task_deps, &block)
|
84
|
+
dir = work(name).to_s
|
85
|
+
|
86
|
+
t = task(task_deps) do |t|
|
87
|
+
block.call(t, dir, t.phase_h)
|
88
|
+
t.phase_h[:last_dir] = dir
|
89
|
+
end
|
90
|
+
|
91
|
+
task(t => dir)
|
92
|
+
|
93
|
+
return t
|
94
|
+
end
|
95
|
+
|
96
|
+
|
68
97
|
def define
|
69
98
|
verify
|
70
99
|
|
71
100
|
directory output_dir
|
72
|
-
|
73
|
-
|
74
|
-
package_dir = work(:package)
|
75
|
-
proguard_dir = work(:proguard)
|
76
|
-
proguard_preverified_dir = work(:proguard_preverified)
|
101
|
+
|
102
|
+
@jar_task = file(jar_path => [output_dir] + @resources + @task_deps + @srcs + @classpath + @bootclasspath)
|
77
103
|
|
78
104
|
unless @srcs.empty?
|
79
|
-
|
105
|
+
phase :compile, jar_path do |t, dir, h|
|
80
106
|
# compile to the unverified directory
|
81
|
-
Filament::Java::Tools::Compile.new(@srcs,
|
82
|
-
c.source_version =
|
83
|
-
c.target_version =
|
107
|
+
Filament::Java::Tools::Compile.new(@srcs, dir) do |c|
|
108
|
+
c.source_version = @jvm_source_version
|
109
|
+
c.target_version = @jvm_target_version
|
84
110
|
c.classpath = @classpath
|
85
111
|
c.bootclasspath = @bootclasspath
|
86
112
|
end
|
87
113
|
end
|
88
114
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
115
|
+
# obfuscate, if necessary
|
116
|
+
if obfuscate?
|
117
|
+
phase :obfuscate, jar_path do |t, dir, h|
|
118
|
+
Filament::Java::Tools::proguard(h[:last_dir], dir) do |o|
|
119
|
+
(@classpath + @bootclasspath).each { |j| o.libraryjars j }
|
120
|
+
|
121
|
+
@proguard_proc.call(o) unless @proguard_proc.nil?
|
122
|
+
|
123
|
+
o.defaultpackage ''
|
124
|
+
o.dontusemixedcaseclassnames
|
125
|
+
o.allowaccessmodification
|
126
|
+
o.keep 'public class * extends javax.microedition.midlet.MIDlet'
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
if preverify?
|
132
|
+
phase :preverify, jar_path do |t, dir, h|
|
133
|
+
# preverify to the preverified directory
|
134
|
+
Filament::JavaME::Tools::preverify(h[:last_dir], dir) do |j|
|
135
|
+
j.cldc_version = @cldc_version
|
136
|
+
j.classpath = @classpath + @bootclasspath
|
137
|
+
end
|
94
138
|
end
|
95
139
|
end
|
96
140
|
end
|
97
141
|
|
98
|
-
|
142
|
+
phase :jar, jar_path do |t, dir, h|
|
99
143
|
package_files = FileList.new
|
100
144
|
|
101
145
|
# package up verified classes
|
102
|
-
package_files.add("#{
|
146
|
+
package_files.add("#{h[:last_dir]}/*") if h.key?(:last_dir)
|
103
147
|
|
104
148
|
# package up resources
|
105
149
|
package_files.add(*@resources) unless @resources.empty?
|
@@ -107,51 +151,16 @@ module Filament::JavaME::Tasks
|
|
107
151
|
p = Pathname.new(f)
|
108
152
|
|
109
153
|
if p.extname == '.jar'
|
110
|
-
Filament::Java::Tools::Jar.extract(f,
|
154
|
+
Filament::Java::Tools::Jar.extract(f, dir)
|
111
155
|
else
|
112
|
-
Filament::cp_r_if(f,
|
113
|
-
end
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
# obfuscate, if necessary
|
118
|
-
if obfuscate?
|
119
|
-
task proguard_dir => [package_dir] + @classpath + @bootclasspath do
|
120
|
-
Filament::Java::Tools::proguard(package_dir, proguard_dir) do |o|
|
121
|
-
(@classpath + @bootclasspath).each do |libraryjar|
|
122
|
-
o.libraryjars libraryjar
|
123
|
-
end
|
124
|
-
|
125
|
-
@proguard_proc.call(o) unless @proguard_proc.nil?
|
126
|
-
|
127
|
-
o.defaultpackage "''"
|
128
|
-
o.dontusemixedcaseclassnames
|
129
|
-
o.allowaccessmodification
|
130
|
-
o.keep 'public class * extends javax.microedition.midlet.MIDlet'
|
156
|
+
Filament::cp_r_if(f, dir) { |p| !(p =~ /\.svn$/) }
|
131
157
|
end
|
132
158
|
end
|
133
159
|
|
134
|
-
|
135
|
-
FileList.new("#{proguard_dir}/*").each do |f|
|
136
|
-
cp_r_if(f, proguard_preverified_dir) { |p| !(p =~ /\.class$/) }
|
137
|
-
end
|
138
|
-
|
139
|
-
Filament::JavaME::Tools::preverify(proguard_dir, proguard_preverified_dir) do |j|
|
140
|
-
j.cldc_version = @cldc_version
|
141
|
-
j.classpath = @classpath + @bootclasspath
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
@jar_task = file jar_path => [proguard_preverified_dir, output_dir] do |t|
|
146
|
-
Filament::Java::Tools::Jar.new(jar_path, FileList.new(proguard_preverified_dir))
|
147
|
-
end
|
148
|
-
else
|
149
|
-
@jar_task = file jar_path => [package_dir, output_dir] do |t|
|
150
|
-
Filament::Java::Tools::Jar.new(jar_path, FileList.new(package_dir))
|
151
|
-
end
|
160
|
+
Filament::Java::Tools::Jar.new(jar_path, FileList.new(dir))
|
152
161
|
end
|
153
|
-
|
154
|
-
@jad_task = file jad_path => [
|
162
|
+
|
163
|
+
@jad_task = file jad_path => [jar_path, output_dir] do |t|
|
155
164
|
full_config = Proc.new do |d|
|
156
165
|
d.suite_version = @suite_version
|
157
166
|
d.suite_name = @suite_name
|
@@ -182,9 +191,23 @@ module Filament::JavaME::Tasks
|
|
182
191
|
end
|
183
192
|
|
184
193
|
private
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
end
|
194
|
+
def preverify?; return @should_preverify; end
|
195
|
+
|
196
|
+
def obfuscate?; return @should_obfuscate; end
|
189
197
|
end
|
190
198
|
end
|
199
|
+
|
200
|
+
# task javadoc_dir do
|
201
|
+
# Filament::Java::Tools::Javadoc.new do |d|
|
202
|
+
# d.windowtitle 'some window title'
|
203
|
+
# d.doctitle 'some doc title'
|
204
|
+
# d.bottom 'some footer text'
|
205
|
+
# d.sourcepath 'dir with sources'
|
206
|
+
# d.overview '/../../overview.html'
|
207
|
+
# d.d javadoc_dir
|
208
|
+
# d.use
|
209
|
+
# d.splitindex
|
210
|
+
# end
|
211
|
+
# end
|
212
|
+
# # this sort of thing should be done for all major tasks, instead of using commands
|
213
|
+
# task :doc => javadoc_dir
|
@@ -8,7 +8,7 @@ module Filament::Java::Tools
|
|
8
8
|
def initialize(sources=[], output_dir=nil)
|
9
9
|
init(sources, output_dir)
|
10
10
|
yield self if block_given?
|
11
|
-
|
11
|
+
compile unless @sources.empty? or @output_dir.nil?
|
12
12
|
end
|
13
13
|
|
14
14
|
# loads initial, default values
|
@@ -32,7 +32,7 @@ module Filament::Java::Tools
|
|
32
32
|
c << " -bootclasspath #{bootclasspath}" unless @bootclasspath.empty?
|
33
33
|
c << " -source #{@source_version}" unless @source_version.nil?
|
34
34
|
c << " -target #{@target_version}" unless @target_version.nil?
|
35
|
-
|
35
|
+
c << " -Xlint:unchecked" if $verbose
|
36
36
|
c << " -d #{output_dir}"
|
37
37
|
c << " #{sources}"
|
38
38
|
|
@@ -2,24 +2,29 @@ module Filament::Java::Tools
|
|
2
2
|
class Execute
|
3
3
|
include Filament::Java::Tools
|
4
4
|
|
5
|
-
attr_writer :classpath, :properties, :
|
5
|
+
attr_writer :classpath, :properties, :main_class, :args, :jar
|
6
6
|
|
7
|
-
def initialize(
|
8
|
-
@
|
7
|
+
def initialize(main_class=nil)
|
8
|
+
@main_class = main_class
|
9
9
|
@jar = nil
|
10
10
|
@properties = {}
|
11
11
|
@classpath = []
|
12
12
|
@args = []
|
13
13
|
|
14
14
|
yield self if block_given?
|
15
|
-
execute unless @
|
15
|
+
execute unless @main_class.nil? and @jar.nil?
|
16
16
|
end
|
17
17
|
|
18
18
|
def execute
|
19
19
|
c = "#{java_bin('java')} "
|
20
20
|
|
21
|
-
classpath =
|
22
|
-
|
21
|
+
classpath = @classpath
|
22
|
+
unless @main_class.nil?
|
23
|
+
classpath << @jar
|
24
|
+
end
|
25
|
+
classpath = join_paths(classpath)
|
26
|
+
|
27
|
+
c << "-cp #{classpath} " unless classpath.nil? or classpath.empty?
|
23
28
|
|
24
29
|
unless @properties.nil?
|
25
30
|
@properties.each do |k,v|
|
@@ -27,9 +32,11 @@ module Filament::Java::Tools
|
|
27
32
|
end
|
28
33
|
end
|
29
34
|
|
30
|
-
|
31
|
-
|
32
|
-
|
35
|
+
if @main_class.nil?
|
36
|
+
c << "-jar #{fix_paths(@jar)} " unless @jar.nil?
|
37
|
+
else
|
38
|
+
c << @main_class << " "
|
39
|
+
end
|
33
40
|
|
34
41
|
c << @args.to_a.join(' ')
|
35
42
|
|
@@ -46,7 +46,7 @@ module Filament::Java::Tools
|
|
46
46
|
class << self
|
47
47
|
def extract(jar_file, output_dir)
|
48
48
|
cd output_dir do |dir|
|
49
|
-
if windows?
|
49
|
+
if not cygwin? and windows?
|
50
50
|
# using jar is too slow
|
51
51
|
c = "#{Filament::Java::Tools::java_bin('jar')} xf #{fix_paths(jar_file)}"
|
52
52
|
sys c
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Filament::Java::Tools
|
2
|
+
class Javadoc
|
3
|
+
include Filament::Java::Tools
|
4
|
+
|
5
|
+
def initialize()
|
6
|
+
@options = []
|
7
|
+
|
8
|
+
yield self if block_given?
|
9
|
+
|
10
|
+
javadoc
|
11
|
+
end
|
12
|
+
|
13
|
+
def javadoc
|
14
|
+
system "#{java_bin('javadoc')} #{@options.join(' ')}"
|
15
|
+
end
|
16
|
+
|
17
|
+
def method_missing(msg, *args)
|
18
|
+
option = msg.to_s.gsub(/=/, '')
|
19
|
+
@options << "-#{option} #{args}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'filament/
|
1
|
+
require 'filament/java/library'
|
2
2
|
|
3
3
|
module Filament::JavaME
|
4
|
-
class Suite < Library
|
4
|
+
class Suite < Filament::Java::Library
|
5
5
|
attr_accessor2 :defaultmidlet_class,
|
6
6
|
:suite_version, :suite_name, :suite_icon, :suite_vendor,
|
7
7
|
:me_configuration, :me_profile
|
@@ -23,23 +23,23 @@ module Filament::JavaME
|
|
23
23
|
|
24
24
|
def init
|
25
25
|
super
|
26
|
+
|
26
27
|
@jad_proc = Proc.new {}
|
27
28
|
@should_package_deps = true
|
28
29
|
@should_obfuscate = false # TODO should be based on $build_type
|
29
30
|
@midlets = []
|
30
|
-
end
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
on_define do
|
33
|
+
assert_tag :javame
|
34
34
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
35
|
+
task :execute => :build do
|
36
|
+
emulate
|
37
|
+
end
|
38
|
+
|
39
|
+
output :tag => :jad,
|
40
|
+
:output => @library.jad_path,
|
41
|
+
:deployable => true,
|
42
|
+
:tasks => @library.tasks
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
@@ -55,7 +55,13 @@ module Filament::JavaME
|
|
55
55
|
l.is_suite = true
|
56
56
|
|
57
57
|
l.jad_proc = Proc.new do |d|
|
58
|
-
|
58
|
+
collect_outputs(:append_entries).each do |h|
|
59
|
+
d.append_entries(h)
|
60
|
+
end
|
61
|
+
|
62
|
+
collect_outputs(:custom_entries).each do |h|
|
63
|
+
d.custom_entries(h)
|
64
|
+
end
|
59
65
|
end
|
60
66
|
end
|
61
67
|
|
@@ -63,13 +69,5 @@ module Filament::JavaME
|
|
63
69
|
def emulate(midletclass=@defaultmidlet_class)
|
64
70
|
Filament::JavaME::Tools::emulate(@library.jad_path, midletclass)
|
65
71
|
end
|
66
|
-
|
67
|
-
def all_jad_procs
|
68
|
-
configs = flattened_deps.collect{|dep| dep[:jad_proc]}
|
69
|
-
configs << self[:jad_proc]
|
70
|
-
configs << @jad_proc
|
71
|
-
# create a list for imported jad configs
|
72
|
-
return configs.compact
|
73
|
-
end
|
74
72
|
end
|
75
73
|
end
|
@@ -56,8 +56,8 @@ module Filament::JavaME::Tools
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def to_s(h = {})
|
59
|
-
raise "me_profile must be set!" if self.me_profile.nil?
|
60
|
-
raise "me_configuration must be set!" if self.me_configuration.nil?
|
59
|
+
# raise "me_profile must be set!" if self.me_profile.nil?
|
60
|
+
# raise "me_configuration must be set!" if self.me_configuration.nil?
|
61
61
|
|
62
62
|
s = ""
|
63
63
|
|
@@ -88,19 +88,24 @@ module Filament::JavaME::Tools
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def append_entries(h)
|
91
|
-
delim = h
|
91
|
+
delim = h.delete(:delim) || ', '
|
92
|
+
|
93
|
+
h2 = {}
|
92
94
|
h.keys.each do |key|
|
93
95
|
value = h[key]
|
96
|
+
|
94
97
|
if value.is_a?(Array)
|
95
98
|
value = value.join(delim)
|
96
99
|
end
|
100
|
+
|
101
|
+
key = key.to_sym
|
97
102
|
if @entries.key?(key)
|
98
|
-
|
103
|
+
h2[key] = @entries[key] + delim + value
|
99
104
|
else
|
100
|
-
|
105
|
+
h2[key] = value
|
101
106
|
end
|
102
107
|
end
|
103
|
-
custom_entries(
|
108
|
+
custom_entries(h2)
|
104
109
|
end
|
105
110
|
|
106
111
|
def custom(name, value=nil, symbol=nil)
|
@@ -124,7 +129,7 @@ module Filament::JavaME::Tools
|
|
124
129
|
end
|
125
130
|
end
|
126
131
|
|
127
|
-
class << self
|
132
|
+
class << self
|
128
133
|
def write_jad(*args, &block)
|
129
134
|
Descriptor.new(*args) do |d|
|
130
135
|
block.call(d)
|
@@ -132,6 +137,13 @@ module Filament::JavaME::Tools
|
|
132
137
|
end
|
133
138
|
end
|
134
139
|
|
140
|
+
def write_properties(*args, &block)
|
141
|
+
Descriptor.new(*args) do |d|
|
142
|
+
block.call(d)
|
143
|
+
d.write
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
135
147
|
def write_manifest(*args, &block)
|
136
148
|
Descriptor.new(*args) do |d|
|
137
149
|
block.call(d)
|