[Scons-users] clarification on Depends()
Matthew Marinets
Matthew.Marinets at Kardium.com
Tue Jun 5 17:17:15 EDT 2018
In the little bit of code at the end, that would be inside the Java emitter.
SCons.Tool.Javac, function emit_java_classes(target, source, env)
This would go right at the end of the emitter (perhaps my example should have used tlist). target represents the processed list of expected outputs.
def customJavaEmitter(target, source, env):
# some processing
for t in processedListOfTargets:
t.add_dependency(env.get(‘JAVACLASSPATH’, []))
return processedListOfTargets, processedListOfSources
I have a custom Java builder emitter based off the SCons built-in, so I was thinking of the wrong variable names. In the SCons.Tool.Javac module, it refers to it as tlist or full_tlist.
So here target is whatever node list I pass to the Java() builder.
-Matthew
From: Scons-users <scons-users-bounces at scons.org> On Behalf Of Bill Deegan
Sent: June 5, 2018 14:09
To: SCons users mailing list <scons-users at scons.org>
Subject: Re: [Scons-users] clarification on Depends()
Matthew,
What's target for you?
The output of some other builder?
-Bill
On Tue, Jun 5, 2018 at 1:20 PM, Matthew Marinets <Matthew.Marinets at kardium.com<mailto:Matthew.Marinets at kardium.com>> wrote:
When should Depends() be used?
I’m using SCons to compile a lot of Java (*gasp* it’s not well supported, I know), and I need to make sure jars in the classpath are built before the javac command is run.
My understanding is that there are three kinds of dependencies:
* Sources
* Implicit dependencies (from running scanners)
* Explicit dependencies (specified with Depends())
A Jar is not a source, at least not in the same sense as a .java file, so jar files shouldn’t go there. It’s more of an implicit dependency, but you can’t determine the name of the jar file by scanning either the .java or .class files.
So I have to use Depends(), right? Currently, I’ve added a line to the Java emitter that creates an explicit dependency using env.Depends() in my project, but should that be the solution? And is there a better way of invoking it than env.Depends; say:
for t in target
t.add_dependency(env.get(‘JAVACLASSPATH’, []))
-Matthew
From: Scons-users <scons-users-bounces at scons.org<mailto:scons-users-bounces at scons.org>> On Behalf Of Bill Deegan
Sent: June 5, 2018 12:29
To: Jason Kenny <dragon512 at live.com<mailto:dragon512 at live.com>>
Cc: SCons users mailing list <scons-users at scons.org<mailto:scons-users at scons.org>>
Subject: Re: [Scons-users] clarification on Depends()
The caution I'd have about Depends as a the goto solution for this is that proper scanner/emitter/builder's may not be created.
Do you have a specific example you can share?
Also the users can do something like.
Depends('filename.$SHOBSUFFIX','fake.txt')
On Tue, Jun 5, 2018 at 12:09 PM, Jason Kenny <dragon512 at live.com<mailto:dragon512 at live.com>> wrote:
In my example fake.txt is nothing more than something to show a behavior independent of the scanner. The point of Depends is to make a mapping that we did not scan for some reason. The question I get a lot is why Depends did nothing. It seems to be because one has to make a depends mapping on the target node not the source node. However for certain complex builders chains this "middle" targets are not known to the user.
Jason
________________________________
From: Scons-users <scons-users-bounces at scons.org<mailto:scons-users-bounces at scons.org>> on behalf of Bill Deegan <bill at baddogconsulting.com<mailto:bill at baddogconsulting.com>>
Sent: Tuesday, June 5, 2018 1:16 PM
To: SCons users mailing list
Subject: Re: [Scons-users] clarification on Depends()
Jason,
In your example how does fake.txt invalidate the C file?
Is the C file being generated?
-Bill
On Tue, Jun 5, 2018 at 10:10 AM, Jason Kenny <dragon512 at live.com<mailto:dragon512 at live.com>> wrote:
I wanted to clarify this.. as I think it sort of broken. builders like SharedLibrary() that chain different builder sets make it hard to know what the internal target is to map the Depends() to.
Jason
________________________________
From: Jason Kenny
Sent: Tuesday, June 5, 2018 9:44 AM
To: SCons users mailing list
Subject: RE: [Scons-users] clarification on Depends()
Opps.. Yes that is correct,
The second example should be
Depends(["hello.o")],["fake.txt"])
Program("hello","hello.c")
Jason
From: Scons-users <scons-users-bounces at scons.org<mailto:scons-users-bounces at scons.org>> On Behalf Of Bill Deegan
Sent: Monday, June 4, 2018 11:28 PM
To: SCons users mailing list <scons-users at scons.org<mailto:scons-users at scons.org>>
Subject: Re: [Scons-users] clarification on Depends()
I think you mistyped your second Depend example?
Shouldn't it be this?
Depends('hello.o',['fake.txt'])
On Mon, Jun 4, 2018 at 9:05 PM, Jason Kenny <dragon512 at live.com<mailto:dragon512 at live.com>> wrote:
HI,
I just want to clarify behavior of Depends() in SCons.
I have a small sample:
Depends(["hello.c")],["fake.txt"])
Program("hello","hello.c")
If I run this sample “hello” will build. If I change fake.txt, nothing will rebuild.
I have a tree like this:
+-hello
| +-hello.o
| | +-hello.c
| | +-fake.txt
| | +-/usr/bin/gcc
| +-/usr/bin/gcc
If I change the sample to this ( depends() is not hello.o vs hello.c)
Depends(["hello.c")],["fake.txt"])
Program("hello","hello.c")
Now when I change fake.txt hello.o will rebuild. The tree here looks like:
+-hello
| +-hello.o
| | +-hello.c
| | +-fake.txt
| | +-/usr/bin/gcc
| +-/usr/bin/gcc
Is this right… I have to know the target of a builder to use? I cannot use the source of a builder?
Jason
_______________________________________________
Scons-users mailing list
Scons-users at scons.org<mailto:Scons-users at scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C348497e92d47473ecc2508d5ca9ccc53%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636637697138253587&sdata=aWPtqrgr6pb%2FpCBMdzZ%2B%2F%2BCPFtJAK%2B8BZNr00gX0MX0%3D&reserved=0>
_______________________________________________
Scons-users mailing list
Scons-users at scons.org<mailto:Scons-users at scons.org>
https://pairlist4.pair.net/mailman/listinfo/scons-users<https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpairlist4.pair.net%2Fmailman%2Flistinfo%2Fscons-users&data=02%7C01%7C%7C9e970bac7e574714f79608d5cb10805b%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636638194081737688&sdata=cH8x5eU5isozHTqCJx4HG5fCTtlfmZhKCoDVMAstyZY%3D&reserved=0>
_______________________________________________
Scons-users mailing list
Scons-users at scons.org<mailto: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/20180605/fc3d1b34/attachment-0001.html>
More information about the Scons-users
mailing list