Hello,

I am working on a project for which I need to generate client-specific
builds. I would like to automate this by creating a nice Buildr
script.
Only I am having trouble how to define a project which gets build 28
times with only three changes to a class of the project. I already
have
written some code for in Buildfile which generates the class for each
client. Only now I am having the problem how to force the building 28
times of the project.
I don't really want to copy the project definition and its source code
28 times. This can only cause problems.

I have tried the following without much luck:

define "application", :layout => layout do
      # Create build for Client 1
      client= "client1"
      app = _(:src, "application_" + client + ".as")
      client_options =  {'client' => client, 'client_key' => 'XXXXXX',
'client_secret' => 'XYZXYZXYZ'}
      generate_configuration_class(project, client_options)
      compile.using( :mxmlc, :main => app, :flexsdk => flexsdk, :args
=> args, :debug => false).
            with( _(:library, :swc, 'assets.swc'))
      compile.options[:output] = application_" + client + ".swf"
      compile.into _(:target, :bin)
      package :swf

      # Create build for Client 2
      client= "client2"
      app = _(:src, "application_" + client + ".as")
      client_options =  {'client' => client, 'client_key' => 'XXXXXX',
'client_secret' => 'XYZXYZXYZ'}
      generate_configuration_class(project, client_options)
      compile.using( :mxmlc, :main => app, :flexsdk => flexsdk, :args
=> args, :debug => false).
            with( _(:library, :swc, 'assets.swc'))
      compile.options[:output] = application_" + client + ".swf"
      compile.into _(:target, :bin)
      package :swf

      # Create build for Client 3
      client= "client3"
      app = _(:src, "application_" + client + ".as")
      client_options =  {'client' => client, 'client_key' => 'XXXXXX',
'client_secret' => 'XYZXYZXYZ'}
      generate_configuration_class(project, client_options)
      compile.using( :mxmlc, :main => app, :flexsdk => flexsdk, :args
=> args, :debug => false).
            with( _(:library, :swc, 'assets.swc'))
      compile.options[:output] = application_" + client + ".swf"
      compile.into _(:target, :bin)
      package :swf
end

Now if I run this script I am having a few problems. First of all my
generate_configuration_class gets run too early in the process and
just before compilation time. Next, it also only executes the the last
compile definition in my project definition. Can I also define
projects and use a different project location? E.g. have a client1
project which has its sources in a totally different location? If so I
could define multiple projects and hard-code the source code to main
source directory of the application. Or are there better approaches?

Looking forward to hear form you,

Weyert de Boer

Reply via email to