buildr-as3 0.1.11 → 0.1.12

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.11
1
+ 0.1.12
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.11"
8
+ s.version = "0.1.12"
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-02-03}
12
+ s.date = %q{2011-02-04}
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 = [
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
30
30
  "lib/buildr/as3/compiler.rb",
31
31
  "lib/buildr/as3/doc.rb",
32
32
  "lib/buildr/as3/flexsdk.rb",
33
+ "lib/buildr/as3/ide/fdt4.rb",
33
34
  "lib/buildr/as3/packaging.rb",
34
35
  "test/helper.rb",
35
36
  "test/test_buildr_as3.rb"
@@ -0,0 +1,139 @@
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 'fileutils'
24
+ module Buildr
25
+ module AS3
26
+ module IDE
27
+ module FDT4
28
+ module Tasks
29
+ include Buildr::Extension
30
+
31
+ first_time do
32
+ desc "Generates dependency file for FDT4 projects"
33
+ Project.local_task('as3:fdt4:generate')
34
+ end
35
+
36
+ before_define do |project|
37
+ project.recursive_task("as3:fdt4:generate")
38
+ end
39
+
40
+ after_define("as3:fdt4:generate" => :package) do |project|
41
+ project.task("as3:fdt4:generate") do
42
+ fail("Cannot create fdt4 projects on Windows machines, no support for symlinks.") unless !Buildr::Util.win_os?
43
+ if [:mxmlc,:compc,:airmxmlc,:aircompc].include? project.compile.compiler
44
+
45
+ output = project.base_dir + "/.settings/com.powerflasher.fdt.classpath"
46
+ puts "Writing FDT4 classpath file: #{output}"
47
+ puts "WARNING: This will create symlinks in #{project.path_to(:lib,:main,:as3)} as FDT4 doesn't support referencing files outside of the project folder."
48
+ sdk_based_libs = []
49
+ sdk_based_libs << "frameworks/libs/player/{playerVersion}/playerglobal.swc"
50
+ sdk_based_libs << "frameworks/libs/flex.swc"
51
+ sdk_based_libs << "frameworks/libs/textLayout.swc"
52
+ sdk_based_libs << "frameworks/libs/framework.swc"
53
+ sdk_based_libs << "frameworks/libs/framework.swc"
54
+ sdk_based_libs << "frameworks/libs/rpc.swc"
55
+ sdk_based_libs << "frameworks/libs/spark.swc"
56
+ sdk_based_libs << "frameworks/libs/sparkskins.swc"
57
+ sdk_based_libs << "frameworks/libs/datavisualization.swc"
58
+
59
+ if [:airmxmlc,:aircompc].include? project.compile.compiler
60
+ sdk_based_libs << "frameworks/libs/air/airglobal.swc"
61
+ sdk_based_libs << "frameworks/libs/air/airframework.swc"
62
+ sdk_based_libs << "frameworks/libs/air/airspark.swc"
63
+ sdk_based_libs << "frameworks/libs/air/applicationupdater.swc"
64
+ sdk_based_libs << "frameworks/libs/air/applicationupdater_ui.swc"
65
+ sdk_based_libs << "frameworks/libs/air/servicemonitor.swc"
66
+ end
67
+
68
+ contents = ""
69
+ classpath_xml = Builder::XmlMarkup.new(:target => contents, :indent => 4)
70
+ classpath_xml.instruct!
71
+ classpath_xml.AS3Classpath do
72
+ sdk_based_libs.each do |sdk_lib|
73
+ classpath_xml.AS3Classpath( sdk_lib, :generateProblems => false, :sdkBased => true, :type => "lib", :useAsSharedCode => "false" )
74
+ end
75
+ project.compile.sources.each do |source|
76
+ classpath_xml.AS3Classpath( project.get_eclipse_relative_path(project,source), :generateProblems => true, :sdkBased => false, :type => project.get_fdt4_classpath_type(source), :useAsSharedCode => "false" )
77
+ end
78
+ unless File.directory? project.path_to(:lib,:main,:as3)
79
+ #:dummy is just a bogus thing, it somehow stops creating the folders a layer to early
80
+ FileUtils.mkdir_p File.dirname(project.path_to(:lib,:main,:as3,:dummy))
81
+ end
82
+ project.compile.dependencies.each do |dependency|
83
+ dependency = project.create_fdt4_dependency_symlink( project, dependency )
84
+ classpath_xml.AS3Classpath( project.get_eclipse_relative_path(project,dependency), :generateProblems => false, :sdkBased => false, :type => project.get_fdt4_classpath_type(dependency), :useAsSharedCode => "false" )
85
+ end
86
+ end
87
+
88
+ unless File.directory? File.dirname(output)
89
+ Dir.mkdir File.dirname(output)
90
+ end
91
+ File.open(output, 'w') {|f| f.write(contents) }
92
+ end
93
+ end
94
+ end
95
+
96
+ def create_fdt4_dependency_symlink( project, dependency )
97
+ case source
98
+ when Buildr::Artifact then
99
+ path = dependency.name
100
+ else
101
+ path = dependency.to_s
102
+ end
103
+ target = project.path_to(:lib,:main,:as3) + "/" + File.basename(path)
104
+ File.delete(target) if File.exists?(target)
105
+ File.symlink path, target
106
+ target
107
+ end
108
+
109
+ def get_eclipse_relative_path( project, source )
110
+ case source
111
+ when Buildr::Artifact then
112
+ path = source.name
113
+ else
114
+ path = source.to_s
115
+ end
116
+ Util.relative_path(File.expand_path(path), project.base_dir)
117
+ end
118
+
119
+ def get_fdt4_classpath_type( source )
120
+ case source
121
+ when Buildr::Artifact then
122
+ return "source" if File.directory?( source.name )
123
+ return "lib" if File.extname(source.name) == ".swc"
124
+ else
125
+
126
+ return "source" if File.directory?( source.to_s )
127
+ return "lib" if File.extname(source.to_s) == ".swc"
128
+ end
129
+ "Could not guess type!"
130
+ end
131
+
132
+ end
133
+ end
134
+ end
135
+ end
136
+ class Project
137
+ include Buildr::AS3::IDE::FDT4::Tasks
138
+ end
139
+ end
data/lib/buildr/as3.rb CHANGED
@@ -25,6 +25,7 @@ require "#{File.dirname(__FILE__)}/as3/flexsdk"
25
25
  require "#{File.dirname(__FILE__)}/as3/doc"
26
26
  require "#{File.dirname(__FILE__)}/as3/alchemy"
27
27
  require "#{File.dirname(__FILE__)}/as3/apparat"
28
+ require "#{File.dirname(__FILE__)}/as3/ide/fdt4"
28
29
  include Buildr::AS3::Flex
29
30
  include Buildr::AS3::Apparat
30
31
  include Buildr::AS3::Alchemy
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: 13
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 11
10
- version: 0.1.11
9
+ - 12
10
+ version: 0.1.12
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-02-03 00:00:00 +01:00
18
+ date: 2011-02-04 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -117,6 +117,7 @@ files:
117
117
  - lib/buildr/as3/compiler.rb
118
118
  - lib/buildr/as3/doc.rb
119
119
  - lib/buildr/as3/flexsdk.rb
120
+ - lib/buildr/as3/ide/fdt4.rb
120
121
  - lib/buildr/as3/packaging.rb
121
122
  - test/helper.rb
122
123
  - test/test_buildr_as3.rb