filament 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG +26 -0
  2. data/lib/filament/os.rb +77 -0
  3. data/lib/filament/package.rb +76 -26
  4. data/lib/filament/platform.rb +81 -78
  5. data/lib/filament/target.rb +50 -11
  6. data/lib/filament/util/filelist2.rb +10 -2
  7. data/lib/filament/util/fileutils.rb +1 -1
  8. data/lib/filament.rb +48 -24
  9. data/plugins/00util/lib/filament/plugins/util.rb +7 -7
  10. data/plugins/01java/lib/filament/java/mixins/classpath.rb +11 -0
  11. data/plugins/01java/lib/filament/java/tools/compile.rb +3 -1
  12. data/plugins/01java/lib/filament/java/tools/execute.rb +3 -1
  13. data/plugins/01java/lib/filament/java/tools/jar.rb +16 -12
  14. data/plugins/01java/lib/filament/java/tools/proguard.rb +2 -0
  15. data/plugins/01java/lib/filament/java/tools.rb +18 -18
  16. data/plugins/01java/lib/filament/plugins/java.rb +1 -1
  17. data/plugins/02javame/lib/filament/javame/library.rb +79 -16
  18. data/plugins/02javame/lib/filament/javame/suite.rb +75 -16
  19. data/plugins/02javame/lib/filament/javame/tasks/library_task.rb +190 -0
  20. data/plugins/02javame/lib/filament/javame/tools/emulator.rb +1 -1
  21. data/plugins/02javame/lib/filament/javame/tools/external/mpp_sdk.rb +0 -1
  22. data/plugins/02javame/lib/filament/javame/tools/external/wtk.rb +0 -1
  23. data/plugins/02javame/lib/filament/javame/{platform.rb → tools/platform.rb} +6 -5
  24. data/plugins/02javame/lib/filament/javame/tools/preverifier.rb +1 -1
  25. data/plugins/02javame/lib/filament/javame/tools.rb +1 -1
  26. data/plugins/02javame/lib/init.rb +6 -19
  27. data/plugins/04spin/lib/filament/spin/sji.rb +36 -0
  28. data/plugins/04spin/lib/filament/spin/tasks/sji_task.rb +86 -0
  29. data/plugins/04spin/lib/init.rb +4 -0
  30. data/plugins/04spin/lib/spin/sji.rb +339 -0
  31. data/plugins/05push/lib/filament/plugins/push.rb +3 -3
  32. data/plugins/10svn/lib/filament/plugins/svn.rb +3 -3
  33. data/plugins/10svn/lib/filament/scm/svn.rb +7 -13
  34. data/plugins/10svn/lib/init.rb +1 -1
  35. data/plugins/11http/lib/filament/plugins/http.rb +6 -0
  36. data/plugins/11http/lib/filament/scm/http.rb +67 -0
  37. data/plugins/11http/lib/init.rb +5 -0
  38. metadata +34 -8
  39. data/lib/filament/artifact.rb +0 -49
  40. data/plugins/01java/lib/filament/java/mixins/java_mixin.rb +0 -19
  41. data/plugins/02javame/lib/filament/javame/mixins/library_mixin.rb +0 -181
  42. data/plugins/02javame/lib/filament/javame/mixins/suite_mixin.rb +0 -114
@@ -1,181 +0,0 @@
1
- require 'filament/java/mixins/java_mixin'
2
-
3
- module Filament::JavaME::Mixins
4
- module LibraryMixin
5
- include Java::Mixins::JavaMixin
6
-
7
- attr_accessor2 :obfuscate
8
-
9
- attr_writer :package_deps
10
- attr_reader :srcs, :resources, :manifest, :platform, :cldc_version
11
-
12
- def init_library
13
- init_java
14
- @srcs = FileList2.new
15
- @resources = FileList2.new
16
- @manifest = nil
17
- @package_deps = false
18
- @obfuscate = false
19
- @platform = JavaME::Tools.tags_for($target_platform)
20
- @cldc_version = JavaME::Tools.cldc_version_for($target_platform)
21
- @bootclasspath = JavaME::Tools.classpath_for($target_platform)
22
- @classpath = []
23
-
24
- @append_entries = {}
25
- @custom_entries = {}
26
-
27
- @jad_config = Proc.new do |d|
28
- d.append_entries(@append_entries)
29
- d.custom_entries(@custom_entries)
30
- end
31
- end
32
-
33
- def custom_entries(h)
34
- h.keys.each do |key|
35
- @custom_entries[key] = h[key]
36
- end
37
- end
38
-
39
- def append_entries(h)
40
- h.keys.each do |key|
41
- @append_entries[key] ||= []
42
-
43
- entry = h[key]
44
-
45
- if entry.is_a?(Array)
46
- @append_entries[key] += entry
47
- else
48
- @append_entries[key] << entry
49
- end
50
- end
51
- end
52
-
53
- def jar_path
54
- return "#{output_dir}/#{@name}.jar"
55
- end
56
-
57
- def define_library(target)
58
- compiled_dir = directory(:compiled)
59
- obfuscated_dir = directory(:obfuscated)
60
- preverified_dir = directory(:preverified)
61
- package_dir = directory(:package)
62
- proguard_dir = directory(:proguard)
63
- proguard_preverified_dir = directory(:proguard_preverified)
64
-
65
- cp = classpath(target)
66
- # prune empty entries from src
67
- @srcs.compact!
68
-
69
- if @package_deps
70
- target.flattened_deps.each do |dep|
71
- j = dep[:jar]
72
- unless j.nil?
73
- @resources.include(j)
74
- end
75
- end
76
- end
77
-
78
- jar_deps = @srcs + @resources + directories + cp + @bootclasspath
79
-
80
- desc = target.package.descriptor
81
- if File.exist?(desc)
82
- jar_deps << desc
83
- end
84
-
85
- unless @manifest.nil?
86
- jar_deps += @manifest
87
- end
88
-
89
- jar_task = file(jar_path => jar_deps) do |t|
90
- package_files = FileList.new
91
- unless @srcs.empty?
92
- # compile to the unverified directory
93
- Java::Tools::Compile.new(@srcs, compiled_dir) do |c|
94
- c.source_version = 1.2
95
- c.target_version = 1.1
96
- c.classpath = cp
97
- c.bootclasspath = @bootclasspath
98
- end
99
-
100
- # preverify to the preverified directory
101
- JavaME::Tools::preverify(compiled_dir, preverified_dir) do |j|
102
- j.cldc_version = @cldc_version
103
- j.classpath = cp + @bootclasspath
104
- end
105
-
106
- # package up verified classes
107
- package_files.add("#{preverified_dir}/*")
108
- end
109
-
110
- # package up resources
111
- package_files.add(*@resources) unless @resources.empty?
112
- package_files.each do |f|
113
- p = Pathname.new(f)
114
-
115
- if p.extname == '.jar'
116
- Java::Tools::Jar.extract(f, package_dir)
117
- else
118
- cp_r_if(f, package_dir) { |p| !(p =~ /\.svn$/) }
119
- end
120
- end
121
-
122
- # remove svn files we may have copied
123
- exclude_files = FileList.new
124
- exclude_files.clear_exclude
125
- exclude_files.add("#{package_dir}/META-INF")
126
-
127
- exclude_files.each do |file|
128
- rm_rf(file)
129
- end
130
-
131
- # obfuscate, if necessary
132
- if @obfuscate
133
- Java::Tools::proguard(package_dir, proguard_dir) do |o|
134
- (@classpath + @bootclasspath).each do |libraryjar|
135
- o.libraryjars libraryjar
136
- end
137
-
138
- target.flattened_deps.each do |dep|
139
- b = dep[:proguard]
140
- b.call(o) unless b.nil?
141
- end
142
-
143
- o.defaultpackage "''"
144
- o.dontusemixedcaseclassnames
145
- o.allowaccessmodification
146
- o.keep 'public class * extends javax.microedition.midlet.MIDlet'
147
- end
148
-
149
- FileList.new("#{proguard_dir}/*").each do |f|
150
- cp_r_if(f, proguard_preverified_dir) { |p| !(p =~ /\.class$/) }
151
- end
152
-
153
- JavaME::Tools::preverify(proguard_dir, proguard_preverified_dir) do |j|
154
- j.cldc_version = @cldc_version
155
- j.classpath = cp + @bootclasspath
156
- end
157
-
158
- Java::Tools::Jar.new(jar_path, FileList.new(proguard_preverified_dir)) do |jar|
159
- jar.manifest = @manifest
160
- end
161
- else
162
- Java::Tools::Jar.new(jar_path, FileList.new(package_dir)) do |jar|
163
- jar.manifest = @manifest
164
- end
165
- end
166
- end
167
-
168
- target.output :tag => [:default, :jar],
169
- :output => jar_path,
170
- :deployable => true
171
-
172
- target.output :tag => :jad_config,
173
- :output => @jad_config,
174
- :deployable => false
175
-
176
- @tasks << jar_task
177
-
178
- return jar_task
179
- end
180
- end
181
- end
@@ -1,114 +0,0 @@
1
- require 'filament/javame/mixins/library_mixin'
2
-
3
- module Filament::JavaME::Mixins
4
- module SuiteMixin
5
- include JavaME::Mixins::LibraryMixin
6
-
7
- attr_accessor2 :defaultmidlet_class,
8
- :suite_version, :suite_name, :suite_icon, :suite_vendor,
9
- :me_configuration, :me_profile
10
-
11
- # adds a midlet hash with keys :icon, :classname, and :name
12
- def add_midlet(midlet)
13
- if midlet == :default
14
- midlet = { :classname => defaultmidlet_class,
15
- :icon => suite_icon,
16
- :name => suite_name }
17
- end
18
-
19
- @midlets << midlet
20
- end
21
-
22
- def init_suite
23
- init_library
24
- @descriptor_config = Proc.new {}
25
- @package_deps = true
26
- @obfuscate = false # TODO should be based on $build_type
27
- @defaultmidlet_class = nil
28
- @midlets = []
29
-
30
- @me_configuration = 'CLDC-1.0'
31
- @me_profile = 'MIDP-2.0'
32
- end
33
-
34
- def jad_path
35
- jad_name = Pathname.new(jar_path).basename(".*").to_s + '.jad'
36
- return "#{output_dir}/#{jad_name}"
37
- end
38
-
39
- def manifest_path
40
- return "#{working_dir}/MANIFEST.MF"
41
- end
42
-
43
- def descriptor_config(&block)
44
- @descriptor_config = block
45
- end
46
-
47
- def define_jad(target)
48
- # create a list for imported jad configs
49
- configs = []
50
-
51
- # start with this target
52
- config = target[:jad_config]
53
- configs << config unless config.nil?
54
-
55
- target.flattened_deps.each do |dep|
56
- # ask each dep for its contribution
57
- config = dep[:jad_config]
58
- configs << config unless config.nil?
59
- end
60
-
61
- full_config = Proc.new do |d|
62
- d.suite_version = @suite_version
63
- d.suite_name = @suite_name
64
- d.suite_icon = @suite_icon
65
- d.suite_vendor = @suite_vendor
66
- d.me_configuration = @me_configuration
67
- d.me_profile = @me_profile
68
-
69
- @midlets.each do |midlet|
70
- d.add_midlet(midlet)
71
- end
72
-
73
- @descriptor_config.call(d)
74
-
75
- configs.each do |config|
76
- config.call(d)
77
- end
78
- end
79
-
80
- jad_task = file jad_path => jar_path do |t|
81
- JavaME::Tools::write_manifest(manifest_path, &full_config)
82
- Java::Tools::Jar.new(jar_path) do |jar|
83
- jar.update = true
84
- jar.manifest = manifest_path
85
- end
86
- JavaME::Tools::write_jad(jad_path, jar_path, &full_config)
87
- end
88
-
89
- target.output :tag => :jad,
90
- :output => jad_path,
91
- :deployable => true
92
-
93
- @tasks << jad_task
94
- return jad_task
95
- end
96
-
97
- def define_suite(target)
98
- # define all the tasks
99
- # and add extra dependencies
100
-
101
- jad_task = define_jad(target)
102
- library_task = define_library(target)
103
-
104
- target.output(:tag => :execute,
105
- :output => Proc.new do; emulate; end)
106
-
107
- return jad_task, library_task
108
- end
109
-
110
- def emulate(midletclass=@defaultmidlet_class)
111
- JavaME::Tools::emulate(jad_path, midletclass)
112
- end
113
- end
114
- end