Re: [Scons-dev] What should I return from generator function?

2012-10-05 Thread Left Right
 The generator should return an Action or something that can be turned
 into an Action.
 See http://www.scons.org/doc/HTML/scons-user/x3755.html

 The only things that can be turned into Actions are a string (which is
 a command to be executed), or a python function (which gets run when
 the action is executed), or lists thereof.

 (see http://www.scons.org/doc/production/HTML/scons-api/index.html if
 you really care.)

 --
 Gary

Thanks for ongoing help, but I'm more puzzled then before :)
_execute function runs from _inside_ the action. And the action that
runs this function expects it to return... another action (this is a
plausible scenario if actions have to be chained, but in my case they
are not)?
I actually could get it working, but in a way, which is probably very
bad... I've overridden the _execute() function in BuilderBase and
removed all mentions of generator and action + all calls that would
cause any reference to either one of these. Now, I'm probably missing
a whole lot of things, if I'm not using action or / and executor, but
I fail to understand how to use them...
One thing I'm concerned with is - it was trying to generate file nodes
from the files, and this went down the drain too... was it important?
How important is it?

So, what are the consequences of not using any of these?
To elaborate: a typical build process of a project is somewhat
involved - you certainly cannot describe it as a single command-line
operation (so action as string is not an option). And I'm having
problems using a function inside the action for two reasons:
- calling the function in this way doesn't let me access associated
builder info (and this is the very important part of the process),
while what it passes into action-function is not important / I could
absolutely do without it.
- I can only prevent the calling action from expecting me to return
another action by weird hack in the BuilderBase. I'm specifically
talking about _do_create_action - this function is called despite my
best effort of avoiding it...
___
Scons-dev mailing list
Scons-dev@scons.org
http://two.pairlist.net/mailman/listinfo/scons-dev


Re: [Scons-dev] Possible minor bug + how to get (or assign) a builder to a file node?

2012-10-05 Thread Left Right
 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).
- 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).
- 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)
- 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.

 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 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.

 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()? 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 

Re: [Scons-dev] How to get variables passed to Env(variables = whatever)?

2012-10-05 Thread William Deegan
Oleg,

If all you're looking to do is have foo in the shell environment of the 
commands you run, then you don't need to use Variables at all.
If you want to pass foo on the scons command line and have that affect the 
Environment(), though not the shell environment unless you explicitly copy the 
value:
env=Environment()
env['ENV']['foo']=env['foo']
Then Variables is useful.

Sounds like you really need to do a thorough read of the users guide and the 
man page.

-Bill

On Oct 5, 2012, at 9:42 AM, Kenny, Jason L jason.l.ke...@intel.com wrote:

 Variable objects are a defined type that allow for some basic validation, and 
 conversion. With Variables you can control logic for example on how to deal 
 with unknown values. This was meant to be an improvement over just taking the 
 arguments and passing them in to the Environment.  
 
 Jason
 
 -Original Message-
 From: scons-dev-boun...@scons.org [mailto:scons-dev-boun...@scons.org] On 
 Behalf Of Left Right
 Sent: Friday, October 05, 2012 11:14 AM
 To: scons-dev@scons.org
 Subject: Re: [Scons-dev] How to get variables passed to Env(variables = 
 whatever)?
 
 Nope, it doesn't. It was a typo, in the original code it was Environment, not 
 Env.
 I can, however, do it like so:
 
 env = Environment(ENV = { 'foo' : 42 })
 env['ENV']['foo'] --- this works then
 
 But was curious of the reason why not allow to do it via Variables?
 
 Thanks.
 
 Oleg
 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 http://two.pairlist.net/mailman/listinfo/scons-dev
 ___
 Scons-dev mailing list
 Scons-dev@scons.org
 http://two.pairlist.net/mailman/listinfo/scons-dev

___
Scons-dev mailing list
Scons-dev@scons.org
http://two.pairlist.net/mailman/listinfo/scons-dev