[Scons-dev] Possible minor bug + how to get (or assign) a builder to a file node?
William Deegan
bill at baddogconsulting.com
Fri Oct 5 14:12:34 EDT 2012
Please respond to questions in line rather than a big blob at the end of the message filled with questions.
It's very hard to follow otherwise.
(See more comments inline below)
On Oct 5, 2012, at 7:59 AM, Left Right <olegsivokon at gmail.com> wrote:
>> 1. What are your inputs?
>> 2. What are your outputs?
>> 3. How do you determine flags for "compiling"?
>
>> Based on your previous emails:
>
>> "the compiler does almost all the job, it find the required sources
>> by inferring from the code what it should be looking for"
>
>
>> So it parses the sources looking for info on it's dependencies?
>
>> "For instance, the compiler has a concept of modules, so it would
>> compile a group of files, and then would compile a module using the
>> first group in a similar way you'd use headers in C, when linking
>> dynamic libraries."
>
>> How does it determine the modules?
>
>> "Step 1: I've overridden _execute in FlashBuilderBase in order to be
>> able to gather some important information about the project (often
>> times Flash comes with Eclipse-style project files, so I'm parsing
>> the project file, and interpret the information I find in it in a
>> way it will be useful later during the build)."
>
>> Is the project file for all sources you're trying to compile, or per
>> module, or some other grouping?
>
>> As Gary stated in another email, you probably can use a separate
>> environment per group of code to get the appropriate flags to them.
>
>> -Bill
>
> The inputs fall under 5 major categories:
> - Eclipse-style project
> -- Flash Builder project
> -- FDT project
> These are usually XML files that describe a project, they contain
> compilation settings, maybe for multiple sub-projects, this is more
> like SLN files in MSVS. So, I'm parsing these and trying to come up
> with a way to run the compiler (+ some other tools some times) to
> replicate what would IDE do during the compilation process.
>
> - FlashDevelop project
> This is similar to Eclipse projects except for there may be multiple
> projects in the same directory.
>
> - Single source file as an input (possible variants are *.as, *.mxml or *.css)
>
> - Multiple source files or a manifest containing a list of files to compile.
>
> - AIR project is a kind of project which uses a special manifest file.
> Using this manifest file it packages what was compiled from other
> sources.
>
> - Documentation generator, this is very similar to multi-source one.
>
>
> The outputs may be:
> - a single SWF or SWC files (an applet binary or a library)
> - multiple codependent SWFs or SWCs.
> - documentation (multiple HTML files)
> - AIR executables, Android installers and iOS installers
>
> Flags for compiling:
> The compiler comes with a file with most of the defaults set in some
> way, there are these possible ways to override these defaults:
> - provide an additional (xml) file with settings (that's how I'm going
> to go about compilation).
Does this file have a static name and/or belong in a fixed place relative to the source file or the project file?
(In essence this file becomes a source, since changing it should cause a recompile)
> - specify these settings on command line when calling the compiler (in
> the worst case you risk to overload the command line, it may easily
> get too long).
This wouldn't apply to a SCons build right? You might specify FLEX_FLAGS or something like that that the user my alter in their scons logic.
> - read some of them from the source code - there are some particular
> compiler metadata that instructs it about project settings / parts
> (none of my concerns, the compiler will do here on its own)
Does this impact the generated files from such a source file? (Does it change the name or produce more or less files?)
> - some, however very few can be set as environment variables, this is
> not an idiomatic way to do it, and only very few (basically, only the
> compiler location and some Java-related settings) can be set in this
> way - again, none of my concerns. The script would however very likely
> need to read the compiler location from user in some way - it's
> uncommon to install compiler on PATH / alias it for availability or
> similar. It is rather more common to have multiple version installed
> simultaneously.
SCons by design is set to avoid having the user's shell environment impact the build.
(Thus insuring repeatable builds).
So any such variables would have to be explicitly copied if you wanted to use them, like such:
env['ENV']['variable_I_care_about'] = os.environ['variable_I_care_about']
>
>> So it parses the sources looking for info on it's dependencies?
> It's not that simple... some times you need to "help" it. I.e. you may
> force including a source, which isn't referenced directly from code,
> or you may ask it to not link statically a particular source, because
> you will provide it at runtime. And, in case when you compile a
> library, you will most certainly be looking for the list of sources on
> your own (just list all sources in a directory is what will do in most
> cases).
How do you "Help"? How do you force including a source,etc.. (as you state above)
>
>> How does it determine the modules?
> It knows certain classes that extend certain other classes to be the
> modules. But this is a lot of parsing! I'm not doing it no way! :) But
> if it comes in a shape of Eclipse project, I'll have that info from
> the project settings.
Generally most builders include scanners to add dependencies (and outputs).
Sounds like perhaps you should create a builder per project file type.
FlexEclipseProject(),etc.. and use those to determine the files which get built and how they output.
>
>> Is the project file for all sources you're trying to compile, or per
>> module, or some other grouping?
>
> Well, there are different kinds of projects... FlashDevelop projects
> have only one target per project and don't define modules. Only
> FlashBuilder or FDT projects do. In all other cases users would have
> to mimic what projects do on their own. I.e. they would define two
> projects as depending on each other etc.
>
> There's a lot more stuff I hoped to do at some point (alternative
> compilers, linkers, transcoders etc) but I won't go into details now.
>
> Re' environment. I'm not sure yet... can I somehow make users create a
> different environment, when they do Env()?
Not sure what you mean by this at all, can you restate it? (or clarify)
> To be honest, I can't find
> a way to change anything about this object, I took it for granted that
> this is what I'm to deal with. I mean, in a builder I can at least
> redo things that don't work in the way I need, but I don't think I'm
> able to affect the environment object, besides using it as is. For
> example, if I try to add environment variables - it just filters them
> away for some reason :|
Can you paste some code for this so we can see what you're doing?
Hope that helps!
-Bill
More information about the Scons-dev
mailing list