buildr-as3 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
data/buildr-as3.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{buildr-as3}
8
- s.version = "0.1.4"
8
+ s.version = "0.1.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Dominic Graefen"]
12
- s.date = %q{2011-01-25}
12
+ s.date = %q{2011-01-26}
13
13
  s.description = %q{Build like you code - now supporting ActionScript 3 & Flex}
14
14
  s.email = %q{dominic @nospam@ devboy.org}
15
15
  s.extra_rdoc_files = [
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  "VERSION",
26
26
  "buildr-as3.gemspec",
27
27
  "lib/buildr/as3.rb",
28
+ "lib/buildr/as3/alchemytk.rb",
28
29
  "lib/buildr/as3/compiler.rb",
29
30
  "lib/buildr/as3/doc.rb",
30
31
  "lib/buildr/as3/flexsdk.rb",
@@ -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
+ module Buildr
23
+ module Compiler
24
+ class AlchemyToolkit
25
+
26
+ attr_reader :home, :achacks, :gcc, :flex_sdk, :alchemy_setup, :bin
27
+
28
+ def initialize( flex_sdk )
29
+
30
+ @flex_sdk = flex_sdk
31
+
32
+ toolkit_version = "1.0.0"
33
+ toolkit_url = "http://download.macromedia.com/pub/labs/alchemy/alchemy_sdk_darwin_p1_121008.zip"
34
+
35
+ toolkit_zip = Buildr::artifact("com.adobe.alchemy:toolkit:zip:#{toolkit_version}").from(Buildr::download(toolkit_url))
36
+ toolkit_zip.invoke unless File.exists? toolkit_zip.to_s
37
+
38
+ toolkit_dir = File.join(File.dirname(toolkit_zip.to_s), "toolkit-#{toolkit_version}")
39
+
40
+ unless File.exists? toolkit_dir
41
+ puts "Unzipping Alchemy Toolkit, this may take a while."
42
+ Buildr::unzip("#{toolkit_dir}"=>toolkit_zip.to_s).target.invoke
43
+ end
44
+
45
+ @home = "#{toolkit_dir}/alchemy-darwin-v0.5a"
46
+ @achacks = "#{@home}/achacks"
47
+ @gcc = "#{@achacks}/gcc"
48
+ @alchemy_setup = "#{@home}/alchemy-setup"
49
+ @config = "#{@home}/config"
50
+ @bin = "#{@home}/bin"
51
+
52
+ # Run config script if alchemy-setup doesn't exist
53
+ unless File.exists? @alchemy_setup
54
+ project_dir = Dir.getwd
55
+ ENV["PATH"] = "#{ENV["PATH"]}:#{flex_sdk.bin}"
56
+ Dir.chdir @home
57
+ system("sh ./config")
58
+ Dir.chdir project_dir
59
+ end
60
+
61
+ end
62
+ end
63
+ end
64
+ end
@@ -120,7 +120,7 @@ public class Build
120
120
 
121
121
  include BuildInfo
122
122
  def compile(sources, target, dependencies)
123
- write_build_info_class sources[0], project
123
+ # write_build_info_class sources[0], project
124
124
  flex_sdk = options[:flexsdk]
125
125
  main = options[:main]
126
126
  mainfile = File.basename(main, File.extname(main))
@@ -233,7 +233,7 @@ public class Build
233
233
  end
234
234
 
235
235
  def compile(sources, target, dependencies)
236
- write_build_info_class sources[0], project
236
+ # write_build_info_class sources[0], project
237
237
  flex_sdk = options[:flexsdk]
238
238
  output = (options[:output] || "#{target}/#{project.to_s}.swc")
239
239
  cmd_args = []
@@ -309,9 +309,83 @@ public class Build
309
309
  end
310
310
  end
311
311
  end
312
+ class AlcGcc < Base
313
+ specify :language => :c,
314
+ :sources => :c, :source_ext => :c,
315
+ :target => "bin", :target_ext => "swc",
316
+ :packaging => :swc
317
+
318
+ attr_reader :project
319
+
320
+ def initialize(project, options)
321
+ super
322
+ @project = project
323
+ end
324
+
325
+
326
+ include NeededTools
327
+ def needed?(sources, target, dependencies)
328
+ true
329
+ # main = options[:main]
330
+ # mainfile = File.basename(main, File.extname(main))
331
+ # output = (options[:output] || "#{target}/#{mainfile}.swf")
332
+ # sources.each do |source|
333
+ # if is_output_outdated?(output, source)
334
+ # puts "Recompile needed: Sources are newer than target"
335
+ # return true
336
+ # end
337
+ # end
338
+ # dependencies.each do |dependency|
339
+ # if is_output_outdated?(output, dependency)
340
+ # puts "Recompile needed: Dependencies are newer than target"
341
+ # return true
342
+ # end
343
+ # end
344
+ # puts "Recompile not needed"
345
+ # false
346
+ end
347
+
348
+
349
+ include BuildInfo
350
+ def compile(sources, target, dependencies)
351
+ alchemy_tk = options[:alchemytk]
352
+ flex_sdk = alchemy_tk.flex_sdk
353
+ output = (options[:output] || "#{target}/#{project.to_s}.swc")
354
+
355
+ # gcc stringecho.c -O3 -Wall -swc -o stringecho.swc
356
+ cmd_args = []
357
+ cmd_args << "gcc"
358
+ cmd_args << File.basename(options[:main])
359
+ cmd_args << "-O3 -Wall -swc"
360
+ cmd_args << "-o #{File.basename output}"
361
+
362
+ reserved = [:flexsdk,:main,:alchemytk]
363
+ options.to_hash.reject { |key, value| reserved.include?(key) }.
364
+ each do |key, value|
365
+ cmd_args << "-#{key}=#{value}"
366
+ end
367
+
368
+ unless Buildr.application.options.dryrun
369
+ ENV["ALCHEMY_HOME"]= alchemy_tk.home
370
+ ENV["ALCHEMY_VER"] = "0.4a"
371
+ ENV["PATH"] = "#{alchemy_tk.bin}:#{ENV["PATH"]}"
372
+ ENV["ASC"]="#{alchemy_tk.home}/bin/asc.jar"
373
+ ENV["SWFBRIDGE"]="#{alchemy_tk.home}/bin/swfbridge"
374
+ ENV["PATH"] = "#{alchemy_tk.achacks}:#{ENV["PATH"]}"
375
+ ENV["PATH"] = "#{ENV["PATH"]}:#{flex_sdk.bin}"
376
+ project_dir = Dir.getwd
377
+ Dir.chdir File.dirname options[:main]
378
+ puts "working-dir: ", Dir.getwd
379
+ system(cmd_args.join(" "))
380
+ File.copy( File.basename(output), output)
381
+ Dir.chdir project_dir
382
+ end
383
+ end
384
+ end
312
385
  end
313
386
  end
314
387
  Buildr::Compiler.compilers << Buildr::Compiler::Mxmlc
315
388
  Buildr::Compiler.compilers << Buildr::Compiler::Compc
316
389
  Buildr::Compiler.compilers << Buildr::Compiler::AirMxmlc
317
- Buildr::Compiler.compilers << Buildr::Compiler::AirCompc
390
+ Buildr::Compiler.compilers << Buildr::Compiler::AirCompc
391
+ Buildr::Compiler.compilers << Buildr::Compiler::AlcGcc
@@ -23,7 +23,7 @@ module Buildr
23
23
  module Compiler
24
24
  class Flex4SDK
25
25
 
26
- attr_reader :home, :mxmlc_jar, :compc_jar, :asdoc_jar, :fcsh_jar, :flex_config, :asdoc_templates, :default_options, :air_config
26
+ attr_reader :home, :mxmlc_jar, :compc_jar, :asdoc_jar, :fcsh_jar, :flex_config, :asdoc_templates, :default_options, :air_config, :bin
27
27
 
28
28
  attr_writer :flex_config, :air_config, :asdoc_templates
29
29
 
@@ -51,6 +51,7 @@ module Buildr
51
51
  @fcsh_jar = "#{@home}/lib/fcsh.jar"
52
52
  @flex_config = "#{@home}/frameworks/flex-config.xml"
53
53
  @air_config = "#{@home}/frameworks/air-config.xml"
54
+ @bin = "#{@home}/bin"
54
55
  end
55
56
 
56
57
  protected
data/lib/buildr/as3.rb CHANGED
@@ -22,4 +22,5 @@
22
22
  require "#{File.dirname(__FILE__)}/as3/compiler"
23
23
  require "#{File.dirname(__FILE__)}/as3/packaging"
24
24
  require "#{File.dirname(__FILE__)}/as3/flexsdk"
25
- require "#{File.dirname(__FILE__)}/as3/doc"
25
+ require "#{File.dirname(__FILE__)}/as3/doc"
26
+ require "#{File.dirname(__FILE__)}/as3/alchemytk"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildr-as3
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 4
10
- version: 0.1.4
9
+ - 5
10
+ version: 0.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dominic Graefen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-25 00:00:00 +01:00
18
+ date: 2011-01-26 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -112,6 +112,7 @@ files:
112
112
  - VERSION
113
113
  - buildr-as3.gemspec
114
114
  - lib/buildr/as3.rb
115
+ - lib/buildr/as3/alchemytk.rb
115
116
  - lib/buildr/as3/compiler.rb
116
117
  - lib/buildr/as3/doc.rb
117
118
  - lib/buildr/as3/flexsdk.rb