buildr-as3 0.1.20 → 0.1.28
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/README.rdoc +14 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/buildr-as3 +27 -0
- data/buildr-as3.gemspec +29 -10
- data/lib/buildr/as3.rb +7 -8
- data/lib/buildr/as3/compiler.rb +9 -260
- data/lib/buildr/as3/compiler/aircompc.rb +52 -0
- data/lib/buildr/as3/compiler/airmxmlc.rb +54 -0
- data/lib/buildr/as3/compiler/base.rb +78 -0
- data/lib/buildr/as3/compiler/compc.rb +64 -0
- data/lib/buildr/as3/compiler/mxmlc.rb +73 -0
- data/lib/buildr/as3/doc.rb +5 -41
- data/lib/buildr/as3/doc/asdoc.rb +75 -0
- data/lib/buildr/as3/ide.rb +23 -0
- data/lib/buildr/as3/ide/fdt4.rb +1 -1
- data/lib/buildr/as3/packaging.rb +4 -188
- data/lib/buildr/as3/packaging/air.rb +120 -0
- data/lib/buildr/as3/packaging/airi.rb +114 -0
- data/lib/buildr/as3/packaging/swc.rb +79 -0
- data/lib/buildr/as3/packaging/swf.rb +79 -0
- data/lib/buildr/as3/project.rb +34 -0
- data/lib/buildr/as3/test.rb +29 -0
- data/lib/buildr/as3/test/base.rb +47 -0
- data/lib/buildr/as3/test/flexunit4.rb +127 -0
- data/lib/buildr/as3/toolkits.rb +28 -0
- data/lib/buildr/as3/{alchemy.rb → toolkits/alchemy.rb} +13 -54
- data/lib/buildr/as3/{apparat.rb → toolkits/apparat.rb} +27 -54
- data/lib/buildr/as3/toolkits/base.rb +84 -0
- data/lib/buildr/as3/{flexsdk.rb → toolkits/flexsdk.rb} +18 -46
- metadata +32 -15
- data/lib/buildr/as3/tests.rb +0 -54
@@ -0,0 +1,52 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2011 by Dominic Graefen / http://devboy.org
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#
|
22
|
+
|
23
|
+
module Buildr
|
24
|
+
module AS3
|
25
|
+
module Compiler
|
26
|
+
# AirCompc compiler:
|
27
|
+
# compile.using(:aircompc)
|
28
|
+
#
|
29
|
+
# Accepts the following options:
|
30
|
+
# * :warnings -- Issue warnings when compiling. Defaults to "true"
|
31
|
+
# * :debug -- Generates bytecode with debugging information. Set from the debug
|
32
|
+
# environment variable/global option.
|
33
|
+
# * :flexsdk -- Specify an FlexSDK Artifact of the type Buildr::AS3::Flex::FlexSDK
|
34
|
+
# * :apparat -- Specify an Apparat Artifact of the type Buildr::AS3::Apparat::ApparatToolkit
|
35
|
+
# (this is only necessary if you want to make use of the apparat-toolkit)
|
36
|
+
# * :other -- Array of options passed to the compiler
|
37
|
+
# (e.g. ['-compiler.incremental=true', '-static-link-runtime-shared-libraries=true', '-optimize'])
|
38
|
+
class AirCompc < Compc
|
39
|
+
|
40
|
+
specify :language => :actionscript,
|
41
|
+
:sources => [:as3, :mxml], :source_ext => [:as, :mxml],
|
42
|
+
:target => "bin", :target_ext => "swc",
|
43
|
+
:packaging => :swc
|
44
|
+
|
45
|
+
def compile(sources, target, dependencies) #:nodoc:
|
46
|
+
@air = true
|
47
|
+
super
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2011 by Dominic Graefen / http://devboy.org
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#
|
22
|
+
|
23
|
+
module Buildr
|
24
|
+
module AS3
|
25
|
+
module Compiler
|
26
|
+
# AirMxmlc compiler:
|
27
|
+
# compile.using(:airmxmlc)
|
28
|
+
#
|
29
|
+
# Accepts the following options:
|
30
|
+
# * :main -- Pass the absolute path to the *.as/*.mxml file you want to have as your main-/document-class
|
31
|
+
# (you can use )
|
32
|
+
# * :warnings -- Issue warnings when compiling. Defaults to "true"
|
33
|
+
# * :debug -- Generates bytecode with debugging information. Set from the debug
|
34
|
+
# environment variable/global option.
|
35
|
+
# * :flexsdk -- Specify an FlexSDK Artifact of the type Buildr::AS3::Flex::FlexSDK
|
36
|
+
# * :apparat -- Specify an Apparat Artifact of the type Buildr::AS3::Apparat::ApparatToolkit
|
37
|
+
# (this is only necessary if you want to make use of the apparat-toolkit)
|
38
|
+
# * :other -- Array of options passed to the compiler
|
39
|
+
# (e.g. ['-compiler.incremental=true', '-static-link-runtime-shared-libraries=true', '-optimize'])
|
40
|
+
class AirMxmlc < Mxmlc
|
41
|
+
|
42
|
+
specify :language => :actionscript,
|
43
|
+
:sources => [:as3, :mxml], :source_ext => [:as, :mxml],
|
44
|
+
:target => "bin", :target_ext => "swf",
|
45
|
+
:packaging => :swf
|
46
|
+
|
47
|
+
def compile(sources, target, dependencies) #:nodoc:
|
48
|
+
@air = true
|
49
|
+
super
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2011 by Dominic Graefen / http://devboy.org
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#
|
22
|
+
|
23
|
+
require 'buildr/core/compile'
|
24
|
+
|
25
|
+
module Buildr
|
26
|
+
module AS3
|
27
|
+
module Compiler
|
28
|
+
class FlexCompilerBase < Buildr::Compiler::Base #:nodoc:
|
29
|
+
|
30
|
+
COMPILE_OPTIONS = [:warnings, :debug, :other, :flexsdk, :apparat]
|
31
|
+
|
32
|
+
def initialize(project, options) #:nodoc:
|
33
|
+
super
|
34
|
+
options[:debug] = Buildr.options.debug if options[:debug].nil?
|
35
|
+
options[:warnings] ||= true
|
36
|
+
end
|
37
|
+
|
38
|
+
def compile(sources, target, dependencies) #:nodoc:
|
39
|
+
check_options options, COMPILE_OPTIONS
|
40
|
+
flex_sdk = options[:flexsdk].invoke
|
41
|
+
output = @project.get_as3_output( target, options )
|
42
|
+
cmd_args = []
|
43
|
+
cmd_args << "-jar" << @compiler_jar
|
44
|
+
cmd_args << "+flexlib" << "#{flex_sdk.home}/frameworks"
|
45
|
+
cmd_args << "-output" << output
|
46
|
+
cmd_args << "+configname=air" if @air
|
47
|
+
cmd_args << @main unless @main.nil?
|
48
|
+
cmd_args << "-define+=CONFIG::debug,#{options[:debug]}"
|
49
|
+
cmd_args << "-define+=CONFIG::environment,\"#{Buildr.environment}\""
|
50
|
+
cmd_args << "-load-config" << flex_sdk.flex_config
|
51
|
+
cmd_args += generate_source_args sources
|
52
|
+
cmd_args += generate_dependency_args dependencies
|
53
|
+
cmd_args += flex_compiler_args
|
54
|
+
unless Buildr.application.options.dryrun
|
55
|
+
trace(cmd_args.join(' '))
|
56
|
+
Java::Commands.java cmd_args
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def needed?(sources, target, dependencies)
|
61
|
+
return true unless File.exist?(@project.get_as3_output(target, options))
|
62
|
+
Dir.glob(FileList[sources,dependencies].to_a.collect{ |file| file += "**/*" } ).
|
63
|
+
map{|file| File.stat(file).mtime}.max > File.stat(@project.get_as3_output(target, options)).mtime
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
def flex_compiler_args #:nodoc:
|
69
|
+
args = []
|
70
|
+
args << '-warnings=false' unless options[:warnings]
|
71
|
+
args << '-debug=true' if options[:debug]
|
72
|
+
args + Array(options[:other]) + Array(options[:flexsdk].default_options)
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2011 by Dominic Graefen / http://devboy.org
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#
|
22
|
+
|
23
|
+
module Buildr
|
24
|
+
module AS3
|
25
|
+
module Compiler
|
26
|
+
# Compc compiler:
|
27
|
+
# compile.using(:compc)
|
28
|
+
#
|
29
|
+
# Accepts the following options:
|
30
|
+
# * :warnings -- Issue warnings when compiling. Defaults to "true"
|
31
|
+
# * :debug -- Generates bytecode with debugging information. Set from the debug environment variable/global option.
|
32
|
+
# * :flexsdk -- Specify an FlexSDK Artifact of the type Buildr::AS3::Flex::FlexSDK
|
33
|
+
# * :apparat -- Specify an Apparat Artifact of the type Buildr::AS3::Apparat::ApparatToolkit (this is only necessary if you want to make use of the apparat-toolkit)
|
34
|
+
# * :other -- Array of options passed to the compiler (e.g. ['-compiler.incremental=true', '-static-link-runtime-shared-libraries=true', '-optimize'])
|
35
|
+
class Compc < FlexCompilerBase
|
36
|
+
|
37
|
+
specify :language => :actionscript,
|
38
|
+
:sources => [:as3, :mxml], :source_ext => [:as, :mxml],
|
39
|
+
:target => "bin", :target_ext => "swc",
|
40
|
+
:packaging => :swc
|
41
|
+
|
42
|
+
def compile(sources, target, dependencies) #:nodoc:
|
43
|
+
@compiler_jar = options[:flexsdk].compc_jar
|
44
|
+
super
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def generate_source_args(sources) #:nodoc:
|
50
|
+
source_args = []
|
51
|
+
sources.each { |source| source_args << "-include-sources+=#{source}" }
|
52
|
+
source_args
|
53
|
+
end
|
54
|
+
|
55
|
+
def generate_dependency_args(dependencies) #:nodoc:
|
56
|
+
dependency_args = []
|
57
|
+
dependencies.each { |source| dependency_args << "-library-path+=#{source}" }
|
58
|
+
dependency_args
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2011 by Dominic Graefen / http://devboy.org
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#
|
22
|
+
|
23
|
+
module Buildr
|
24
|
+
module AS3
|
25
|
+
module Compiler
|
26
|
+
# Mxmlc compiler:
|
27
|
+
# compile.using(:mxmlc)
|
28
|
+
# Used by default if .as or .mxml files are found in the src/main/as3 directory (or src/test/as3)
|
29
|
+
# and sets the target directory to target/bin (or target/test/bin).
|
30
|
+
#
|
31
|
+
# Accepts the following options:
|
32
|
+
# * :main -- Pass the absolute path to the *.as/*.mxml file you want to have as your main-/document-class
|
33
|
+
# (you can use )
|
34
|
+
# * :warnings -- Issue warnings when compiling. Defaults to "true"
|
35
|
+
# * :debug -- Generates bytecode with debugging information. Set from the debug
|
36
|
+
# environment variable/global option.
|
37
|
+
# * :flexsdk -- Specify an FlexSDK Artifact of the type Buildr::AS3::Flex::FlexSDK
|
38
|
+
# * :apparat -- Specify an Apparat Artifact of the type Buildr::AS3::Apparat::ApparatToolkit
|
39
|
+
# (this is only necessary if you want to make use of the apparat-toolkit)
|
40
|
+
# * :other -- Array of options passed to the compiler
|
41
|
+
# (e.g. ['-compiler.incremental=true', '-static-link-runtime-shared-libraries=true', '-optimize'])
|
42
|
+
class Mxmlc < FlexCompilerBase
|
43
|
+
|
44
|
+
specify :language => :actionscript,
|
45
|
+
:sources => [:as3, :mxml], :source_ext => [:as, :mxml],
|
46
|
+
:target => "bin", :target_ext => "swf",
|
47
|
+
:packaging => :swf
|
48
|
+
|
49
|
+
def compile(sources, target, dependencies) #:nodoc:
|
50
|
+
@compiler_jar = options[:flexsdk].mxmlc_jar
|
51
|
+
COMPILE_OPTIONS << :main
|
52
|
+
@main = options[:main]
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def generate_source_args(sources) #:nodoc:
|
59
|
+
source_args = []
|
60
|
+
sources.each { |source| source_args << "-source-path+=#{source}" }
|
61
|
+
source_args
|
62
|
+
end
|
63
|
+
|
64
|
+
def generate_dependency_args(dependencies) #:nodoc:
|
65
|
+
dependency_args = []
|
66
|
+
dependencies.each { |source| dependency_args << "-library-path+=#{source}" }
|
67
|
+
dependency_args
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/lib/buildr/as3/doc.rb
CHANGED
@@ -19,47 +19,11 @@
|
|
19
19
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
20
|
# THE SOFTWARE.
|
21
21
|
#
|
22
|
-
require 'buildr/core/doc'
|
23
22
|
|
24
|
-
|
25
|
-
module AS3
|
26
|
-
module Doc
|
27
|
-
class Asdoc < Buildr::Doc::Base
|
23
|
+
require "buildr"
|
28
24
|
|
29
|
-
|
30
|
-
:source_ext => :as
|
25
|
+
require "#{File.dirname(__FILE__)}/doc/asdoc"
|
31
26
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
flex_sdk = options[:flexsdk]
|
36
|
-
output = (options[:output] || "#{target}")
|
37
|
-
cmd_args = []
|
38
|
-
cmd_args << "-classpath" << "#{flex_sdk.home}/lib/xalan.jar"
|
39
|
-
cmd_args << "-classpath" << flex_sdk.asdoc_jar
|
40
|
-
cmd_args << "flex2.tools.ASDoc"
|
41
|
-
cmd_args << "+flexlib" << "#{flex_sdk.home}/frameworks"
|
42
|
-
cmd_args << "-load-config" << flex_sdk.flex_config
|
43
|
-
cmd_args << "-output" << output
|
44
|
-
cmd_args << "-source-path" << sources.join(" ")
|
45
|
-
cmd_args << "-doc-sources" << sources.join(" ")
|
46
|
-
cmd_args << "-templates-path" << flex_sdk.asdoc_templates
|
47
|
-
cmd_args << "-library-path+=#{dependencies.join(",")}" unless dependencies.empty?
|
48
|
-
reserved = [:flexsdk, :main, :classpath, :sourcepath]
|
49
|
-
options.to_hash.reject { |key, value| reserved.include?(key) }.
|
50
|
-
each do |key, value|
|
51
|
-
cmd_args << "-#{key}=#{value}"
|
52
|
-
end
|
53
|
-
flex_sdk.default_options.each do |key, value|
|
54
|
-
cmd_args << "-#{key}=#{value}"
|
55
|
-
end
|
56
|
-
unless Buildr.application.options.dryrun
|
57
|
-
Java::Commands.java cmd_args
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
Buildr::Doc.engines << Buildr::AS3::Doc::Asdoc
|
27
|
+
class Buildr::Project
|
28
|
+
include Buildr::AS3::Doc::AsDoc
|
29
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (C) 2011 by Dominic Graefen / http://devboy.org
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#
|
22
|
+
|
23
|
+
require 'buildr'
|
24
|
+
|
25
|
+
module Buildr
|
26
|
+
module AS3
|
27
|
+
module Doc
|
28
|
+
module AsDoc
|
29
|
+
|
30
|
+
include Buildr::Extension
|
31
|
+
|
32
|
+
first_time do
|
33
|
+
desc "Generates asdoc documentation."
|
34
|
+
Project.local_task('asdoc')
|
35
|
+
end
|
36
|
+
|
37
|
+
before_define do |project|
|
38
|
+
project.recursive_task("asdoc")
|
39
|
+
end
|
40
|
+
|
41
|
+
after_define("asdoc" => :doc) do |project|
|
42
|
+
project.task("asdoc") do
|
43
|
+
|
44
|
+
if project.compile.language == :actionscript
|
45
|
+
|
46
|
+
sources = project.compile.sources
|
47
|
+
dependencies = project.compile.dependencies
|
48
|
+
|
49
|
+
flex_sdk = project.compile.options[:flexsdk].invoke
|
50
|
+
output = project.base_dir + "/target/docs"
|
51
|
+
cmd_args = []
|
52
|
+
cmd_args << "-classpath" << "#{flex_sdk.home}/lib/xalan.jar"
|
53
|
+
cmd_args << "-classpath" << flex_sdk.asdoc_jar
|
54
|
+
cmd_args << "flex2.tools.ASDoc"
|
55
|
+
cmd_args << "+flexlib" << "#{flex_sdk.home}/frameworks"
|
56
|
+
cmd_args << "-load-config" << flex_sdk.flex_config
|
57
|
+
cmd_args << "-output" << output
|
58
|
+
sources.each { |source| cmd_args << "-source-path+=#{source}" }
|
59
|
+
sources.each { |source| cmd_args << "-doc-sources+=#{source}" }
|
60
|
+
cmd_args << "-templates-path" << flex_sdk.asdoc_templates
|
61
|
+
cmd_args << "-library-path+=#{dependencies.join(",")}" unless dependencies.empty?
|
62
|
+
|
63
|
+
unless Buildr.application.options.dryrun
|
64
|
+
trace "java #{cmd_args.join(" ")}"
|
65
|
+
Java::Commands.java cmd_args
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|