Skip to content

Instantly share code, notes, and snippets.

@newtriks
Created January 7, 2013 21:25
Show Gist options
  • Save newtriks/4478581 to your computer and use it in GitHub Desktop.
Save newtriks/4478581 to your computer and use it in GitHub Desktop.
An example Flex buildfile for Buildr-AS3
require "fileutils"
require "buildr/as3" # needs - gem install buildr-as3 -v "0.2.30.pre"
# Version number for this release will become dynamic
VERSION_NUMBER = "0.0.1"
# Group identifier for your projects
GROUP = "com.newtriks"
COPYRIGHT = "newtriks.com"
# Specify Maven 2.0 remote repositories here, like this:
repositories.remote << "http://artifacts.devboy.org" << "http://repo2.maven.org/maven2"
# My personal preference for directory layout: root/src and root/test
layout = Layout::Default.new
layout[:source, :main, :as3] = "src"
layout[:source, :test, :as3] = "test"
desc "The example project"
define "Example", :layout => layout do
project.version = VERSION_NUMBER
project.group = GROUP
args = ["-warnings=false", "-optimize=true"]
app = _(:src, "Main.mxml")
compile.using( :mxmlc, :main => app, :flexsdk => flexsdk, :args => args, :debug => false ).
with( _(:lib,"as3-signals-v0.8.swc"),
_(:lib,"robotlegs-framework-v1.4.0.swc"),
_(:lib,"SwiftSuspenders-v1.5.1.swc") )
compile.into _(:bin, :swf)
testrunner = _(:source, :test, :as3, "MainTestRunner.mxml")
test.using(:flexunit4 => true, :headless => false, :version => "4.1.0-8", :verbose => true)
test.compile.using( :main => testrunner, :args => [] ).
with( FlexUnit4.swcs("4.1.0-8", "4.1.0.16076", :flex),
_(:lib,"tdd/fluint-extensions-4.1.0-8-4.1.0.16076.swc"),
_(:lib,"tdd/hamcrest-as3-flex-1.1.3.swc"),
_(:lib,"tdd/mockolate-0.12.2-flex.swc") )
test.compile.from _(:src)
end
def flexsdk
version = "4.5.0.20967"
@flexsdk ||= begin
# should be using the flex sdk version from user.properties (if it exists) or environment
flexsdk = FlexSDK.new(version)
flexsdk.default_options << ["-keep-as3-metadata+=Inject",
"-keep-as3-metadata+=PostConstruct",
"-allow-source-path-overlap=true",
"-locale=en_US",
"-source-path=locale/{locale}",
"-source-path+=support",
"-default-size=800,600",
"-define=CONFIG::DevServer,false"]
flexsdk
end
end
@newtriks
Copy link
Author

Example using SDK that requires downloading from external site

def flexsdk
  version = "4.6.0.23201B"
  @flexsdk ||= begin
    # should be using the flex sdk version from user.properties (if it exists) or environment
    flexsdk = FlexSDK.new(version)
    flexsdk.default_options  << ["-keep-as3-metadata+=Inject",
                                "-keep-as3-metadata+=PostConstruct",
                                "-allow-source-path-overlap=true",
                                "-locale=en_US",
                                "-source-path=locale/{locale}",
                                "-source-path+=lib/utils",
                                "-source-path+=support",
                                "-default-size=940,614",
                                "-define=CONFIG::LocalDebug,false"]
    flexsdk.from("http://fpdownload.adobe.com/pub/flex/sdk/builds/flex4.6/flex_sdk_"+version+".zip")
  end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment