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/lib/filament.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'pathname'
|
2
2
|
require 'set'
|
3
3
|
|
4
|
-
|
5
4
|
# rake stuff
|
6
5
|
begin
|
7
6
|
require 'rake'
|
@@ -19,16 +18,11 @@ end
|
|
19
18
|
|
20
19
|
require 'rake/clean'
|
21
20
|
|
22
|
-
require 'filament/workspace'
|
23
|
-
require 'filament/platform'
|
24
|
-
require 'filament/package'
|
25
|
-
require 'filament/target'
|
26
|
-
require 'filament/artifact'
|
27
|
-
|
28
|
-
require 'filament/util/filelist2'
|
29
|
-
require 'filament/util/fileutils'
|
30
|
-
|
31
21
|
class Module
|
22
|
+
# creates a reader and a writer for the given attributes.
|
23
|
+
# both reader and writer are the same method. if the method
|
24
|
+
# is called without arguments, the current value is returned
|
25
|
+
# if it is called with a single arguemnt, the value is set.
|
32
26
|
def attr_accessor2(*symbols)
|
33
27
|
# attr_writer(*symbols)
|
34
28
|
symbols.each do |sym|
|
@@ -37,23 +31,57 @@ class Module
|
|
37
31
|
if val.empty?
|
38
32
|
return instance_variable_get(attr_sym)
|
39
33
|
else
|
40
|
-
|
34
|
+
val = val.first if val.size == 1
|
35
|
+
return instance_variable_set(attr_sym, val)
|
41
36
|
end
|
42
37
|
end
|
43
38
|
end
|
44
39
|
end
|
40
|
+
|
41
|
+
# temporarily intercepts a given method, evaluating the
|
42
|
+
# given block
|
43
|
+
def intercept_method(method, temporary_result)
|
44
|
+
original_method = "#{Time.now.to_i}_#{method}"
|
45
|
+
alias_method original_method, method
|
46
|
+
|
47
|
+
# Not enough room for a ternary ;_;
|
48
|
+
t = if temporary_result.respond_to?(:to_proc)
|
49
|
+
temporary_result.to_proc
|
50
|
+
else
|
51
|
+
Proc.new { temporary_result }
|
52
|
+
end
|
53
|
+
|
54
|
+
define_method(method, t)
|
55
|
+
yield
|
56
|
+
alias_method method, original_method
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
require 'filament/workspace'
|
61
|
+
require 'filament/os'
|
62
|
+
require 'filament/package'
|
63
|
+
require 'filament/target'
|
64
|
+
|
65
|
+
require 'filament/util/filelist2'
|
66
|
+
require 'filament/util/fileutils'
|
67
|
+
|
68
|
+
def log(msg)
|
69
|
+
puts msg if $verbose
|
70
|
+
end
|
71
|
+
|
72
|
+
def verbose(on)
|
73
|
+
RakeFileUtils.verbose(false)
|
74
|
+
$verbose = on
|
45
75
|
end
|
46
76
|
|
47
77
|
module Filament
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
$verbose = on
|
78
|
+
class Task
|
79
|
+
def work(s)
|
80
|
+
d = @working_dir + '/' + s.to_s
|
81
|
+
directory d
|
82
|
+
return d
|
83
|
+
end
|
55
84
|
end
|
56
|
-
|
57
85
|
class Application
|
58
86
|
@@plugins = []
|
59
87
|
|
@@ -64,7 +92,7 @@ module Filament
|
|
64
92
|
def initialize
|
65
93
|
@cmd = CmdParse::CommandParser.new(true)
|
66
94
|
@cmd.program_name = "filament"
|
67
|
-
@cmd.program_version = [0,
|
95
|
+
@cmd.program_version = [0, 3, 0]
|
68
96
|
@cmd.add_command(CmdParse::HelpCommand.new)
|
69
97
|
@cmd.add_command(CmdParse::VersionCommand.new)
|
70
98
|
@cmd.options = CmdParse::OptionParserWrapper.new do |opt|
|
@@ -185,7 +213,3 @@ module Filament
|
|
185
213
|
end
|
186
214
|
end
|
187
215
|
end
|
188
|
-
|
189
|
-
include Filament::Platform
|
190
|
-
include Filament
|
191
|
-
|
@@ -2,20 +2,20 @@ require 'cmdparse'
|
|
2
2
|
require 'filament/plugin'
|
3
3
|
|
4
4
|
module Filament::Plugins
|
5
|
-
class Util < Plugin
|
5
|
+
class Util < Filament::Plugin
|
6
6
|
def initialize(app)
|
7
7
|
app.subcommand('build', "Build the given targets") do |args|
|
8
|
-
targets = TargetList.new(*args)
|
8
|
+
targets = Filament::TargetList.new(*args)
|
9
9
|
targets.each { |target| target.build }
|
10
10
|
end
|
11
11
|
|
12
12
|
app.subcommand('clobber', "Clobber the generated files for the given packages") do |args|
|
13
|
-
packages = PackageList.new(*args)
|
13
|
+
packages = Filament::PackageList.new(*args)
|
14
14
|
packages.each { |package| package.clobber }
|
15
15
|
end
|
16
16
|
|
17
17
|
app.subcommand('execute', "Executes the target, if it is executable") do |args|
|
18
|
-
targets = TargetList.new(*args)
|
18
|
+
targets = Filament::TargetList.new(*args)
|
19
19
|
targets.each do |target|
|
20
20
|
target.build do
|
21
21
|
block = target[:execute]
|
@@ -25,7 +25,7 @@ module Filament::Plugins
|
|
25
25
|
end
|
26
26
|
|
27
27
|
app.subcommand('targets', "Shows targets of given package") do |args|
|
28
|
-
packages =
|
28
|
+
packages = Filament::PackageList.new(*args)
|
29
29
|
packages.each do |package|
|
30
30
|
puts " #{package.full_name}"
|
31
31
|
package.targets.each do |target|
|
@@ -35,7 +35,7 @@ module Filament::Plugins
|
|
35
35
|
end
|
36
36
|
|
37
37
|
app.subcommand('prereqs', "Shows prerequisites of given packages") do |args|
|
38
|
-
targets = TargetList.new(*args)
|
38
|
+
targets = Filament::TargetList.new(*args)
|
39
39
|
targets.each do |target|
|
40
40
|
puts " #{target.uri}"
|
41
41
|
target.deps.each do |dep|
|
@@ -45,7 +45,7 @@ module Filament::Plugins
|
|
45
45
|
end
|
46
46
|
|
47
47
|
app.subcommand('list', "Lists subpackages of given packages") do |args|
|
48
|
-
packages = PackageList.new(*args)
|
48
|
+
packages = Filament::PackageList.new(*args)
|
49
49
|
packages.each do |package|
|
50
50
|
package.list
|
51
51
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Filament::Java::Mixins
|
2
|
+
module Classpath
|
3
|
+
def flattened_deps_jars(include_weak=false)
|
4
|
+
return flattened_deps(include_weak).collect{|dep| dep[:jar]}.compact
|
5
|
+
end
|
6
|
+
|
7
|
+
def classpath
|
8
|
+
return @custom_classpath + flattened_deps_jars(true)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Filament::Java::Tools
|
2
2
|
class Compile
|
3
|
+
include Filament::Java::Tools
|
4
|
+
|
3
5
|
attr_writer :sources, :output_dir, :source_version, :target_version,
|
4
6
|
:classpath, :bootclasspath
|
5
7
|
|
@@ -25,7 +27,7 @@ module Filament::Java::Tools
|
|
25
27
|
bootclasspath = join_paths(@bootclasspath)
|
26
28
|
output_dir = fix_paths(@output_dir)
|
27
29
|
sources = fix_paths(@sources).join(' ')
|
28
|
-
c = "#{
|
30
|
+
c = "#{java_bin('javac')}"
|
29
31
|
c << " -classpath #{classpath}" unless @classpath.empty?
|
30
32
|
c << " -bootclasspath #{bootclasspath}" unless @bootclasspath.empty?
|
31
33
|
c << " -source #{@source_version}" unless @source_version.nil?
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Filament::Java::Tools
|
2
2
|
class Execute
|
3
|
+
include Filament::Java::Tools
|
4
|
+
|
3
5
|
attr_writer :classpath, :properties, :mainclass, :args, :jar
|
4
6
|
|
5
7
|
def initialize(mainclass=nil)
|
@@ -14,7 +16,7 @@ module Filament::Java::Tools
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def execute
|
17
|
-
c = "#{
|
19
|
+
c = "#{java_bin('java')} "
|
18
20
|
|
19
21
|
classpath = join_paths(@classpath)
|
20
22
|
c << "-cp #{classpath} " unless @classpath.nil? or @classpath.empty?
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Filament::Java::Tools
|
2
2
|
class Jar
|
3
|
+
include Filament::Java::Tools
|
4
|
+
|
3
5
|
attr_writer :jar_file, :base_dir, :manifest, :index, :update
|
4
6
|
attr_accessor :package_files
|
5
7
|
|
@@ -19,7 +21,7 @@ module Filament::Java::Tools
|
|
19
21
|
end
|
20
22
|
|
21
23
|
def jar
|
22
|
-
c = "#{
|
24
|
+
c = "#{java_bin('jar')} "
|
23
25
|
c << 'v' if $verbose
|
24
26
|
c << 'f'
|
25
27
|
if @update
|
@@ -41,17 +43,19 @@ module Filament::Java::Tools
|
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
46
|
+
class << self
|
47
|
+
def extract(jar_file, output_dir)
|
48
|
+
cd output_dir do |dir|
|
49
|
+
if windows?
|
50
|
+
# using jar is too slow
|
51
|
+
c = "#{Filament::Java::Tools::java_bin('jar')} xf #{fix_paths(jar_file)}"
|
52
|
+
sys c
|
53
|
+
else
|
54
|
+
c = 'unzip '
|
55
|
+
c << '-q ' unless $verbose
|
56
|
+
c << "-o #{fix_paths(jar_file)}"
|
57
|
+
sys c
|
58
|
+
end
|
55
59
|
end
|
56
60
|
end
|
57
61
|
end
|
@@ -2,24 +2,24 @@ require 'filament/platform'
|
|
2
2
|
|
3
3
|
module Filament
|
4
4
|
module Java
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
5
|
+
module Tools
|
6
|
+
include Filament::OS
|
7
|
+
|
8
|
+
def java_bin(path=nil)
|
9
|
+
java_home_env = ENV['JAVA_HOME']
|
10
|
+
unless java_home_env.nil?
|
11
|
+
java_bin = "#{java_home_env}/bin"
|
12
|
+
return java_bin if path.nil?
|
13
|
+
return to_exec_path("#{java_bin}/#{path}")
|
14
|
+
else
|
15
|
+
# assume it's in the path
|
16
|
+
return path
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
extend self
|
21
|
+
end
|
22
|
+
end
|
23
23
|
end
|
24
24
|
|
25
25
|
require 'filament/java/tools/jar'
|
@@ -1,16 +1,79 @@
|
|
1
|
-
require 'filament/
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
require 'filament/java/mixins/classpath'
|
2
|
+
require 'filament/javame/tasks/library_task'
|
3
|
+
|
4
|
+
module Filament::JavaME
|
5
|
+
class Library < Filament::Target
|
6
|
+
include Filament::Java::Mixins::Classpath
|
7
|
+
|
8
|
+
attr_accessor2 :obfuscate
|
9
|
+
|
10
|
+
attr_writer :should_package_deps
|
11
|
+
attr_reader :srcs, :resources, :platform, :cldc_version
|
12
|
+
|
13
|
+
def custom_entries(h)
|
14
|
+
@custom_entries.merge!(h)
|
15
|
+
end
|
16
|
+
|
17
|
+
def append_entries(h)
|
18
|
+
h.keys.each do |key|
|
19
|
+
@append_entries[key] ||= []
|
20
|
+
entry = h[key]
|
21
|
+
if entry.is_a?(Array)
|
22
|
+
@append_entries[key] += entry
|
23
|
+
else
|
24
|
+
@append_entries[key] << entry
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def init
|
30
|
+
@srcs = Filament::FileList2.new
|
31
|
+
@srcs.tag = :java
|
32
|
+
|
33
|
+
@resources = Filament::FileList2.new
|
34
|
+
@should_package_deps = false
|
35
|
+
|
36
|
+
@platform = Filament::JavaME::Tools.tags_for($target_platform)
|
37
|
+
@cldc_version = Filament::JavaME::Tools.cldc_version_for($target_platform)
|
38
|
+
@bootclasspath = Filament::JavaME::Tools.classpath_for($target_platform)
|
39
|
+
|
40
|
+
@custom_classpath = []
|
41
|
+
|
42
|
+
@append_entries = {}
|
43
|
+
@custom_entries = {}
|
44
|
+
end
|
45
|
+
|
46
|
+
def define
|
47
|
+
@library = Filament::JavaME::Tasks::LibraryTask.new do |l|
|
48
|
+
define_library(l)
|
49
|
+
end
|
50
|
+
|
51
|
+
output :tag => [:default, :jar],
|
52
|
+
:output => @library.jar_path,
|
53
|
+
:deployable => true,
|
54
|
+
:tasks => @library.tasks
|
55
|
+
|
56
|
+
output :tag => :jad_proc do |d|
|
57
|
+
d.append_entries(@append_entries)
|
58
|
+
d.custom_entries(@custom_entries)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def define_library(l)
|
63
|
+
l.working_dir = working_dir
|
64
|
+
l.output_dir = output_dir
|
65
|
+
l.name = name
|
66
|
+
l.classpath = classpath
|
67
|
+
l.bootclasspath = @bootclasspath
|
68
|
+
l.srcs = @srcs
|
69
|
+
|
70
|
+
l.resources = @resources + (@should_package_deps ? flattened_deps_jars : [])
|
71
|
+
|
72
|
+
l.task_deps << package.descriptor
|
73
|
+
|
74
|
+
l.proguard_proc = Proc.new do |o|
|
75
|
+
flattened_deps.collect{|dep| dep[:proguard_proc]}.compact.each{|p| p.call(o)}
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -1,16 +1,75 @@
|
|
1
|
-
require 'filament/javame/
|
2
|
-
|
3
|
-
module Filament::JavaME
|
4
|
-
class Suite <
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
require 'filament/javame/library'
|
2
|
+
|
3
|
+
module Filament::JavaME
|
4
|
+
class Suite < Library
|
5
|
+
attr_accessor2 :defaultmidlet_class,
|
6
|
+
:suite_version, :suite_name, :suite_icon, :suite_vendor,
|
7
|
+
:me_configuration, :me_profile
|
8
|
+
|
9
|
+
# adds a midlet hash with keys :icon, :classname, and :name
|
10
|
+
def add_midlet(midlet)
|
11
|
+
if midlet == :default
|
12
|
+
midlet = { :classname => defaultmidlet_class,
|
13
|
+
:icon => suite_icon,
|
14
|
+
:name => suite_name }
|
15
|
+
end
|
16
|
+
|
17
|
+
@midlets << midlet
|
18
|
+
end
|
19
|
+
|
20
|
+
def jad_proc(&block)
|
21
|
+
@jad_proc = block
|
22
|
+
end
|
23
|
+
|
24
|
+
def init
|
25
|
+
super
|
26
|
+
@jad_proc = Proc.new {}
|
27
|
+
@should_package_deps = true
|
28
|
+
@should_obfuscate = false # TODO should be based on $build_type
|
29
|
+
@midlets = []
|
30
|
+
end
|
31
|
+
|
32
|
+
def define
|
33
|
+
super
|
34
|
+
|
35
|
+
output :tag => :jad,
|
36
|
+
:output => @library.jad_path,
|
37
|
+
:deployable => true,
|
38
|
+
:tasks => @library.tasks
|
39
|
+
|
40
|
+
output :tag => :execute,
|
41
|
+
:tasks => @library.tasks do
|
42
|
+
emulate
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def define_library(l)
|
47
|
+
super(l)
|
48
|
+
|
49
|
+
l.suite_version = @suite_version
|
50
|
+
l.suite_name = @suite_name
|
51
|
+
l.suite_icon = @suite_icon
|
52
|
+
l.suite_vendor = @suite_vendor
|
53
|
+
l.should_obfuscate = @should_obfuscate
|
54
|
+
l.midlets = @midlets
|
55
|
+
l.is_suite = true
|
56
|
+
|
57
|
+
l.jad_proc = Proc.new do |d|
|
58
|
+
all_jad_procs.each {|p| p.call(d)}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
def emulate(midletclass=@defaultmidlet_class)
|
64
|
+
Filament::JavaME::Tools::emulate(@library.jad_path, midletclass)
|
65
|
+
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
|
+
end
|
75
|
+
end
|