[Scons-users] Scons and ant

Bill Deegan bill at baddogconsulting.com
Tue Mar 3 01:05:41 EST 2015


Owen,

The reason it stops is because when you run SCons without any arguments it
defaults to building all targets under the current directory. Since
/Users/dev/.pic
is not under the current directory, scons will stop once it's built
everything that is under it, thus stopping after it builds the .apk.

>From the manpage:

By default, the command
>
> scons
>
> will build all target files in or below the current directory. Explicit
> default targets (to be built when no targets are specified on the command
> line) may be defined the SConscript file(s) using the *Default()*
> function, described below.
>

Further the section on Default()

Default(targets) , env.Default(targets)
>
> This specifies a list of default targets, which will be built by scons if
> no explicit targets are given on the command line. Multiple calls to
> Default are legal, and add to the list of default targets.
>
> Multiple targets should be specified as separate arguments to the Default
> method, or as a list. Default will also accept the Node returned by any
> of a construction environment's builder methods.
>
> Examples:
>
> Default('foo', 'bar', 'baz')
> env.Default(['a', 'b', 'c'])
> hello = env.Program('hello', 'hello.c')
> env.Default(hello)
>
> An argument to Default of None will clear all default targets. Later
> calls to Default will add to the (now empty) default-target list like
> normal.
>
> The current list of targets added using the Default function or method is
> available in the DEFAULT_TARGETS list; see below.
>

I would sugguest using env.install() as your means to copy all files around
rather than Copy() and also shutil.

Also:
env_android.Command('#platform/android/java/libs/armeabi/libpic_android.so',
dir, Copy('platform/android/java/libs/armeabi/libpic_android.so', output))

Uses the source as the dir. This will not cause changes in the directory to
rerun this command.
Directory nodes have some special properties. This is a common SCons new
user mistake.  You should use Glob(dir+"/*") and if there are files in
subdirectories, then you'll want to add those via Glob(dir+"*/*") and so on.

Hope this helps!
-Bill

On Mon, Mar 2, 2015 at 9:36 PM, Owen Alanzo Hogarth <gurenchan at gmail.com>
wrote:

> I have read those and though it would work but it just seems to stop right
> after the ant build, no messages about installing or anything.
>
> I even tried aliasing as well but nothing, the build just stops.
>
> On Tue, Mar 3, 2015 at 1:20 PM, William Blevins <wblevins001 at gmail.com>
> wrote:
>
>> Owen,
>>
>> Well, I'm not sure how you were trying to do this looking at your code.
>> You never call the SCons Install builder though I suppose you could use
>> Copy:
>> http://www.scons.org/doc/production/HTML/scons-user.html#idp14496624
>> Copy as a command or an Execute will always be invoked, and you may not
>> desire that behavior.
>>
>> You should be able to simply "env_android.Install( '/Users/dev/.pic', '#
>> platform/android/java/bin/PIC-release-unsigned.apk' )":
>> http://www.scons.org/doc/production/HTML/scons-user.html#chap-install
>>
>> Then of course you run this builder doing "scons /Users/dev/.pic" since
>> the install location is the target.  I usually alias all my install files
>> to something convenient like "install" via the Alias command:
>> http://www.scons.org/doc/production/HTML/scons-user.html#chap-alias
>>
>> If you want to rename the file, then use InstallAs instead.
>>
>> V/R,
>> William
>>
>>
>>
>> On Tue, Mar 3, 2015 at 12:02 AM, Owen Alanzo Hogarth <gurenchan at gmail.com
>> > wrote:
>>
>>> Here's a pastebin of my scons build file: http://pastebin.com/36H6PeAi
>>>
>>> towards the bottom there's an ANT_TARGET=
>>> "/Users/dev/pic/src/platform/android/java/bin/PIC-release-unsigned.apk"
>>>
>>> That gets built.
>>>
>>> Now I would like to move that to a directory that's not located inside
>>> the SConstruct folder structure.
>>>
>>> to /Users/dev/.pic/
>>>
>>> No matter what, I cannot seem to actually move the file
>>> "/Users/dev/pic/src/platform/android/java/bin/PIC-release-unsigned.apk"
>>> to my desired location
>>> /Users/dev/.pic/
>>>
>>> Anything that I can do to do this last step?
>>>
>>> On Tue, Mar 3, 2015 at 10:57 AM, William Blevins <wblevins001 at gmail.com>
>>> wrote:
>>>
>>>> Owen,
>>>>
>>>> Can you give a concrete example?
>>>>
>>>> I don't know the context for "It tacks on the install location at the
>>>> end of my current directory".
>>>>
>>>> Please define Install command source X and target Y, plus said
>>>> directory Z, or better yet, paste your SConscript?
>>>>
>>>> If I do, Install('/usr/bin', hello) then the target "hello" will be
>>>> installed in "/usr/bin".
>>>>
>>>> V/R,
>>>> William
>>>>
>>>> On Mon, Mar 2, 2015 at 9:45 PM, Owen Alanzo Hogarth <
>>>> gurenchan at gmail.com> wrote:
>>>>
>>>>> Hi Russel
>>>>>
>>>>> That was it, I ended up doing:
>>>>>
>>>>> env.Command(target='local.properties',
>>>>>        source='/Users/dev/pic/src/platform/android/java/build.xml',
>>>>>        action='/usr/local/bin/ant release -f $SOURCE')
>>>>>
>>>>> for anyone who might have issues in the future.
>>>>>
>>>>> One more question, when using the install builder I'll get my project
>>>>> installed like:
>>>>>
>>>>> /Users/dev/pic/src/platform/android/java/usr/bin
>>>>>
>>>>> It tacks on the install location at the end of my current directory.
>>>>> The only thing that I can think of is that I am not building a Program
>>>>> but a SharedLibrary, but I don't see why that should make a difference.
>>>>>
>>>>>
>>>>> On Tue, Mar 3, 2015 at 1:08 AM, Russel Winder <russel at winder.org.uk>
>>>>> wrote:
>>>>>
>>>>>> On Mon, 2015-03-02 at 17:34 +0800, Owen Alanzo Hogarth wrote:
>>>>>> > […]
>>>>>> >
>>>>>> > env.Command('/usr/local/bin/ant release -f',
>>>>>> > ['/Users/dev/pic/src/platform/android/java/build.xml'],
>>>>>> > ['/Users/dev/pic/src/platform/android/java/bin'])
>>>>>> […]
>>>>>>
>>>>>> I think you misread the Command section of the manual. The first
>>>>>> parameter is the targets to be made, the second the sources, and the
>>>>>> third the command template string. Something more along the lines of:
>>>>>>
>>>>>>     env.Command('/Users/dev/pic/src/platform/android/java/bin/thing',
>>>>>>       ['/Users/dev/pic/src/platform/android/java/build.xml'] +
>>>>>> Glob('sources_pattern'),
>>>>>>       '/usr/local/bin/ant release -f')
>>>>>>
>>>>>> which would need a lot of doctoring for your situation, I have just
>>>>>> shown something that will fail but hopefully guides you to the right
>>>>>> thing.
>>>>>>
>>>>>> --
>>>>>> Russel.
>>>>>>
>>>>>> =============================================================================
>>>>>> Dr Russel Winder      t: +44 20 7585 2200   voip:
>>>>>> sip:russel.winder at ekiga.net
>>>>>> 41 Buckmaster Road    m: +44 7770 465 077   xmpp:
>>>>>> russel at winder.org.uk
>>>>>> London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
>>>>>>
>>>>>> _______________________________________________
>>>>>> Scons-users mailing list
>>>>>> Scons-users at scons.org
>>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Scons-users mailing list
>>>>> Scons-users at scons.org
>>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Scons-users mailing list
>>>> Scons-users at scons.org
>>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Scons-users mailing list
>>> Scons-users at scons.org
>>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>>
>>>
>>
>> _______________________________________________
>> Scons-users mailing list
>> Scons-users at scons.org
>> https://pairlist4.pair.net/mailman/listinfo/scons-users
>>
>>
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150302/a2b50e54/attachment-0001.html>


More information about the Scons-users mailing list