filament 0.2.3 → 0.3.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/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
@@ -0,0 +1,190 @@
|
|
1
|
+
require 'rake'
|
2
|
+
|
3
|
+
module Filament::JavaME::Tasks
|
4
|
+
class LibraryTask < Filament::Task
|
5
|
+
def initialize
|
6
|
+
@bootclasspath = []
|
7
|
+
@classpath = []
|
8
|
+
@cldc_version = nil
|
9
|
+
@defaultmidlet_class = nil
|
10
|
+
@is_suite = false
|
11
|
+
@jad_proc = Proc.new {}
|
12
|
+
@me_configuration = 'CLDC-1.0'
|
13
|
+
@me_profile = 'MIDP-2.0'
|
14
|
+
@midlets= []
|
15
|
+
@name = nil
|
16
|
+
@output_dir = nil
|
17
|
+
@proguard_proc = nil
|
18
|
+
@resources = []
|
19
|
+
@should_obfuscate = false # TODO should be based on $build_type
|
20
|
+
@srcs = []
|
21
|
+
@suite_icon = nil
|
22
|
+
@suite_name = nil
|
23
|
+
@suite_vendor = nil
|
24
|
+
@suite_version = nil
|
25
|
+
@task_deps = []
|
26
|
+
@working_dir = nil
|
27
|
+
|
28
|
+
instance_variables.each do |var_sym|
|
29
|
+
attr_name = var_sym.gsub(/^@/,'')
|
30
|
+
|
31
|
+
self.class.send(:define_method, attr_name.to_sym) do
|
32
|
+
instance_variable_get(var_sym)
|
33
|
+
end
|
34
|
+
|
35
|
+
self.class.send(:define_method, "#{attr_name}=".to_sym) do |value|
|
36
|
+
instance_variable_set(var_sym, value)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
yield self if block_given?
|
41
|
+
|
42
|
+
define
|
43
|
+
end
|
44
|
+
|
45
|
+
def jar_path
|
46
|
+
return "#{output_dir}/#{@name}.jar"
|
47
|
+
end
|
48
|
+
|
49
|
+
def jad_path
|
50
|
+
return "#{output_dir}/#{name}.jad"
|
51
|
+
end
|
52
|
+
|
53
|
+
def tasks
|
54
|
+
tasks = []
|
55
|
+
tasks << @jar_task
|
56
|
+
tasks << @jad_task if suite?
|
57
|
+
|
58
|
+
return tasks
|
59
|
+
end
|
60
|
+
|
61
|
+
def invoke
|
62
|
+
tasks.each{|t| t.invoke}
|
63
|
+
end
|
64
|
+
|
65
|
+
def verify
|
66
|
+
end
|
67
|
+
|
68
|
+
def define
|
69
|
+
verify
|
70
|
+
|
71
|
+
directory output_dir
|
72
|
+
compiled_dir = work(:compiled)
|
73
|
+
preverified_dir = work(:preverified)
|
74
|
+
package_dir = work(:package)
|
75
|
+
proguard_dir = work(:proguard)
|
76
|
+
proguard_preverified_dir = work(:proguard_preverified)
|
77
|
+
|
78
|
+
unless @srcs.empty?
|
79
|
+
task compiled_dir => @task_deps + @srcs + @classpath + @bootclasspath do
|
80
|
+
# compile to the unverified directory
|
81
|
+
Filament::Java::Tools::Compile.new(@srcs, compiled_dir) do |c|
|
82
|
+
c.source_version = 1.2
|
83
|
+
c.target_version = 1.1
|
84
|
+
c.classpath = @classpath
|
85
|
+
c.bootclasspath = @bootclasspath
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
task preverified_dir => [compiled_dir] + @bootclasspath + @classpath do
|
90
|
+
# preverify to the preverified directory
|
91
|
+
Filament::JavaME::Tools::preverify(compiled_dir, preverified_dir) do |j|
|
92
|
+
j.cldc_version = @cldc_version
|
93
|
+
j.classpath = @classpath + @bootclasspath
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
task package_dir => [preverified_dir] + @resources do
|
99
|
+
package_files = FileList.new
|
100
|
+
|
101
|
+
# package up verified classes
|
102
|
+
package_files.add("#{preverified_dir}/*")
|
103
|
+
|
104
|
+
# package up resources
|
105
|
+
package_files.add(*@resources) unless @resources.empty?
|
106
|
+
package_files.each do |f|
|
107
|
+
p = Pathname.new(f)
|
108
|
+
|
109
|
+
if p.extname == '.jar'
|
110
|
+
Filament::Java::Tools::Jar.extract(f, package_dir)
|
111
|
+
else
|
112
|
+
Filament::cp_r_if(f, package_dir) { |p| !(p =~ /\.svn$/) }
|
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'
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
task proguard_preverified_dir => [proguard_dir] + @classpath + @bootclasspath do
|
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
|
152
|
+
end
|
153
|
+
|
154
|
+
@jad_task = file jad_path => [@jar_task, output_dir] do |t|
|
155
|
+
full_config = Proc.new do |d|
|
156
|
+
d.suite_version = @suite_version
|
157
|
+
d.suite_name = @suite_name
|
158
|
+
d.suite_icon = @suite_icon
|
159
|
+
d.suite_vendor = @suite_vendor
|
160
|
+
d.me_configuration = @me_configuration
|
161
|
+
d.me_profile = @me_profile
|
162
|
+
|
163
|
+
@midlets.each {|midlet| d.add_midlet(midlet)}
|
164
|
+
|
165
|
+
@jad_proc.call(d)
|
166
|
+
end
|
167
|
+
|
168
|
+
manifest_path = "#{working_dir}/MANIFEST.MF"
|
169
|
+
Filament::JavaME::Tools::write_manifest(manifest_path, &full_config)
|
170
|
+
|
171
|
+
Filament::Java::Tools::Jar.new(jar_path) do |jar|
|
172
|
+
jar.update = true
|
173
|
+
jar.manifest = manifest_path
|
174
|
+
end
|
175
|
+
|
176
|
+
Filament::JavaME::Tools::write_jad(jad_path, jar_path, &full_config)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
def suite?
|
181
|
+
return @is_suite
|
182
|
+
end
|
183
|
+
|
184
|
+
private
|
185
|
+
|
186
|
+
def obfuscate?
|
187
|
+
return @should_obfuscate
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
@@ -7,23 +7,24 @@ module Filament::JavaME
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
def platform(model)
|
10
|
-
p =
|
11
|
-
raise "Unknown target platform #{model}" if p.nil?
|
10
|
+
p = Filament::Platform.find(:name => model)
|
11
|
+
raise "Unknown target platform: #{model}" if p.nil?
|
12
|
+
raise "Not a JavaME platform: #{p.inspect}, #{p.tags.inspect}" unless p.tags.include?(:javame)
|
12
13
|
return p
|
13
14
|
end
|
14
15
|
|
15
16
|
def tags_for(model)
|
16
|
-
return platform(model)
|
17
|
+
return platform(model).tags.clone
|
17
18
|
end
|
18
19
|
|
19
20
|
def cldc_version_for(model)
|
20
|
-
return platform(model)
|
21
|
+
return platform(model).javame_configuration_version
|
21
22
|
end
|
22
23
|
|
23
24
|
def classpath_for(model)
|
24
25
|
cldc_version = cldc_version_for(model)
|
25
26
|
|
26
|
-
base_classpath = platform(model)
|
27
|
+
base_classpath = platform(model).classpath
|
27
28
|
|
28
29
|
classpath = []
|
29
30
|
classpath += base_classpath unless base_classpath.nil?
|
@@ -1,27 +1,14 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
|
3
|
-
require 'filament/
|
3
|
+
require 'filament/os'
|
4
4
|
|
5
|
-
module Filament::JavaME
|
6
|
-
HOME = Pathname.new(__FILE__).parent.parent.realpath
|
7
|
-
end
|
8
5
|
require 'filament/javame/tools'
|
9
6
|
require 'filament/javame/tasks'
|
10
7
|
|
11
|
-
|
12
|
-
return :MppSdk if darwin?
|
13
|
-
return :Wtk
|
14
|
-
end
|
8
|
+
include Filament::OS
|
15
9
|
|
16
|
-
|
17
|
-
|
18
|
-
return :Wtk
|
19
|
-
end
|
10
|
+
emulator = ENV['JAVAME_EMULATOR'] || :MppSdk
|
11
|
+
Filament::JavaME::Tools::Emulator::set_type(emulator.to_sym)
|
20
12
|
|
21
|
-
|
22
|
-
|
23
|
-
Tools::Emulator::set_type(emulator.to_sym)
|
24
|
-
|
25
|
-
preverifier = ENV['JAVAME_PREVERIFIER'] || default_preverifier
|
26
|
-
Tools::Preverifier::set_type(preverifier.to_sym)
|
27
|
-
end
|
13
|
+
preverifier = ENV['JAVAME_PREVERIFIER'] || darwin? ? :MppSdk : :Wtk
|
14
|
+
Filament::JavaME::Tools::Preverifier::set_type(preverifier.to_sym)
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'filament/java/mixins/classpath'
|
3
|
+
require 'filament/spin/tasks/sji_task'
|
4
|
+
|
5
|
+
module Filament::Spin
|
6
|
+
class SJI < Filament::Target
|
7
|
+
include Filament::Java::Mixins::Classpath
|
8
|
+
|
9
|
+
attr_reader :srcs
|
10
|
+
attr_accessor2 :java_gen_package
|
11
|
+
|
12
|
+
def init
|
13
|
+
@srcs = Filament::FileList2.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def define
|
17
|
+
@sji = Filament::Spin::Tasks::SJITask.new do |sji|
|
18
|
+
define_sji(sji)
|
19
|
+
end
|
20
|
+
|
21
|
+
output :tag => :java, :output => @sji.java_files, :tasks => @sji.tasks
|
22
|
+
output :tag => :spin, :output => @sji.spin_files, :tasks => @sji.tasks
|
23
|
+
output :tag => :jad_proc do |d|
|
24
|
+
d.append_entries('spin.bindings' => @sji.bindings.collect {|binding| "#{binding.keys}: #{binding.values}"}.join(';'))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def define_sji(sji)
|
29
|
+
sji.working_dir = working_dir
|
30
|
+
sji.srcs = srcs
|
31
|
+
sji.java_gen_package = @java_gen_package
|
32
|
+
sji.java_gen_dir = working_dir(:java_gen)
|
33
|
+
sji.spin_gen_dir = working_dir(:spin_gen)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'filament/javame/tasks/library_task'
|
2
|
+
require 'spin/sji'
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
module Filament::Spin
|
6
|
+
module Tasks
|
7
|
+
class SJITask < Filament::Task
|
8
|
+
attr_accessor :java_gen_package, :working_dir, :java_gen_dir, :spin_gen_dir, :srcs
|
9
|
+
|
10
|
+
attr_reader :sji, :bindings
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@srcs = []
|
14
|
+
@sji = nil
|
15
|
+
@working_dir = nil
|
16
|
+
|
17
|
+
@java_gen_dir = nil
|
18
|
+
@spin_gen_dir = nil
|
19
|
+
|
20
|
+
@java_gen_package = nil
|
21
|
+
|
22
|
+
@bindings = []
|
23
|
+
|
24
|
+
@spin_gen_dir = nil
|
25
|
+
@java_gen_dir = nil
|
26
|
+
|
27
|
+
yield self if block_given?
|
28
|
+
|
29
|
+
define
|
30
|
+
end
|
31
|
+
|
32
|
+
def verify
|
33
|
+
raise 'java_gen_package must be set' if @java_gen_package.nil?
|
34
|
+
|
35
|
+
raise 'spin_gen_dir must be set' if @spin_gen_dir.nil?
|
36
|
+
raise 'java_gen_dir must be set' if @java_gen_dir.nil?
|
37
|
+
raise 'working_dir must be set' if @working_dir.nil?
|
38
|
+
|
39
|
+
raise 'srcs must not be empty' if @srcs.empty?
|
40
|
+
end
|
41
|
+
|
42
|
+
def tasks
|
43
|
+
return [@gen_spin_task, @gen_java_task]
|
44
|
+
end
|
45
|
+
|
46
|
+
def java_files
|
47
|
+
return @gen_java_files
|
48
|
+
end
|
49
|
+
|
50
|
+
def spin_files
|
51
|
+
return @gen_spin_files
|
52
|
+
end
|
53
|
+
|
54
|
+
def define
|
55
|
+
verify
|
56
|
+
|
57
|
+
@sji = Spin::SpinJavaInterface.new
|
58
|
+
|
59
|
+
srcs.each do |src|
|
60
|
+
@sji.load(src)
|
61
|
+
end
|
62
|
+
|
63
|
+
impls = []
|
64
|
+
|
65
|
+
@sji.prototypes.each do |prototype|
|
66
|
+
impls << s = Spin::JavaMethodImpl.new(prototype)
|
67
|
+
s.java_impl_package = @java_gen_package
|
68
|
+
@bindings << { (prototype.anonymous? ? '' : prototype.name) => s.full_class_name }
|
69
|
+
end
|
70
|
+
|
71
|
+
@gen_spin_files = impls.collect{|impl| impl.spin_file(spin_gen_dir)}
|
72
|
+
@gen_java_files = impls.collect{|impl| impl.java_file(java_gen_dir)}
|
73
|
+
|
74
|
+
directory spin_gen_dir
|
75
|
+
@gen_spin_task = task spin_gen_dir => srcs do
|
76
|
+
impls.each{|impl| impl.write_spin(spin_gen_dir)}
|
77
|
+
end
|
78
|
+
|
79
|
+
directory java_gen_dir
|
80
|
+
@gen_java_task = task java_gen_dir => srcs do
|
81
|
+
impls.each{|impl| impl.write_java(java_gen_dir)}
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|