[Scons-users] Chaining generated sources.

William Blevins wblevins001 at gmail.com
Thu Feb 20 20:01:40 EST 2014


Intro: I am using a custom builder to generate java file(s) via Google Proto
Compiler.

In most cases, one source file yields one target file in the same directory;
therefore, derived-source targets can most likely be "guessed"; however, this
assumption almost never works in Java. I could work around some of the issue by
enforcing a 1:1 source:target relationship via the ".proto" file(s); however, in
Java (at least), the target location would still be incorrect (IE. always
assumed as the root package location).

This should be repeatable with any N-tier (where N > 1) Java derived-source
target builds where any of the following apply:
1) Class not in the root package.
2) ".proto" (or other input) creates more than 1 target.

This may apply to more languages than Java, but I have no test cases
readily available.


If I remove the check in "SCons/tools/javac.py" in the scanner for
"sourceFile.is_derived",
so that the scanner will execute rather than guess, I may be able to
work around this if
I can force the execution of the builder immediately after construction,
but I am struggling to figure out how to do this. Scons supplies an
"Execute" function,
but I may not be building the Action correctly.

I am using a modified version of the Protoc builder written by Scott
Stafford >>http://www.scons.org/wiki/ProtocBuilder

Thanks,

William

Below are dependency tree examples regarding this issue:

*** The dependency tree scons generates (INVALID) ***

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
protoc -Isrc/proto --java_out=/<stuff>/WidgetBridge/src/proto/java/proto-widget
src/proto/Widget.proto src/proto/WidgetTypes.proto
src/proto/CommonBaseTypes.proto
javac -classpath /opt/common/protobuf/2.5.0/i686/jar/protobuf.jar -d
src/proto/java/build-proto-widget -sourcepath
src/proto/java/proto-widget/org/example/group/protobuf/widget
src/proto/java/proto-widget/org/example/group/protobuf/widget/Widget.java
src/proto/java/proto-widget/org/example/group/protobuf/widget/WidgetTypes.java
src/proto/java/proto-widget/org/example/group/protobuf/common/CommonBaseTypes.java
jar cf jar/protobuf-widget.jar -C src/proto/java/build-proto-widget .
+-.
+-jar
| +-jar/protobuf-widget.jar
| +-src/proto/java/build-proto-widget
| | +-src/proto/java/build-proto-widget/Widget.class
| | | +-src/proto/java/proto-widget/org/example/group/protobuf/widget/Widget.java
| | +-src/proto/java/build-proto-widget/WidgetTypes.class
| | |
+-src/proto/java/proto-widget/org/example/group/protobuf/widget/WidgetTypes.java
| | +-src/proto/java/build-proto-widget/CommonBaseTypes.class
| | +-src/proto/java/proto-widget/org/example/group/protobuf/common/CommonBaseTypes.java
| +-src/proto/java/build-proto-widget/Widget.class
| | +-src/proto/java/proto-widget/org/example/group/protobuf/widget/Widget.java
| +-src/proto/java/build-proto-widget/WidgetTypes.class
| | +-src/proto/java/proto-widget/org/example/group/protobuf/widget/WidgetTypes.java
| +-src/proto/java/build-proto-widget/CommonBaseTypes.class
|
+-src/proto/java/proto-widget/org/example/group/protobuf/common/CommonBaseTypes.java
+-src
+-src/proto
+-src/proto/java
+-src/proto/java/build-proto-widget
| +-src/proto/java/build-proto-widget/Widget.class
| | +-src/proto/java/proto-widget/org/example/group/protobuf/widget/Widget.java
| +-src/proto/java/build-proto-widget/WidgetTypes.class
| | +-src/proto/java/proto-widget/org/example/group/protobuf/widget/WidgetTypes.java
| +-src/proto/java/build-proto-widget/CommonBaseTypes.class
|
+-src/proto/java/proto-widget/org/example/group/protobuf/common/CommonBaseTypes.java
+-src/proto/java/proto-widget
+-src/proto/java/proto-widget/org
+-src/proto/java/proto-widget/org/example
+-src/proto/java/proto-widget/org/example/group
+-src/proto/java/proto-widget/org/example/group/protobuf

+-src/proto/java/proto-widget/org/example/group/protobuf/widget
|
+-src/proto/java/proto-widget/org/example/group/protobuf/widget/Widget.java
|
+-src/proto/java/proto-widget/org/example/group/protobuf/widget/WidgetTypes.java

+-src/proto/java/proto-widget/org/example/group/protobuf/common

+-src/proto/java/proto-widget/org/example/group/protobuf/common/CommonBaseTypes.java
scons: done building targets.

*** The dependency tree scons SHOULD generate (VALID) ***

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
jar cf jar/protobuf-widget.jar -C src/proto/java/build-proto-widget .
+-.
+-jar
| +-jar/protobuf-widget.jar
| +-src/proto/java/build-proto-widget
| | +-src/proto/java/build-proto-widget/org
| | +-src/proto/java/build-proto-widget/org/example
| | +-src/proto/java/build-proto-widget/org/example/group
| | +-src/proto/java/build-proto-widget/org/example/group/protobuf
| | +-src/proto/java/build-proto-widget/org/example/group/protobuf/widget
| | |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget$1.class
| | |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget$WidgetMessage$1.class
| | |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget$WidgetMessage$Builder.class
| | |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget.class
| | |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes$1.class
| | |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes$WidgetConnectionStatusType$1.class
| | |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes$WidgetConnectionStatusType$Builder.class
| | |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetType.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes$1.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes$Common_2TupleType$1.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes$Common_TimestampOrBuilder.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes.class
| +-src/proto/java/build-proto-widget/org
| +-src/proto/java/build-proto-widget/org/example
| +-src/proto/java/build-proto-widget/org/example/group
| +-src/proto/java/build-proto-widget/org/example/group/protobuf
| +-src/proto/java/build-proto-widget/org/example/group/protobuf/widget
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget$1.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget$WidgetMessage$1.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget$WidgetMessage$Builder.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes$1.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes$WidgetConnectionStatusType$1.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes$WidgetConnectionStatusType$Builder.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes.class
| +-src/proto/java/build-proto-widget/org/example/group/protobuf/common
|
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes$1.class
|
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes$Common_2TupleType$1.class
|
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes$Common_TimestampOrBuilder.class
|
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes.class
+-src
+-src/proto
+-src/proto/java
+-src/proto/java/build-proto-widget
| +-src/proto/java/build-proto-widget/org
| +-src/proto/java/build-proto-widget/org/example
| +-src/proto/java/build-proto-widget/org/example/group
| +-src/proto/java/build-proto-widget/org/example/group/protobuf
|
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget$1.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget$WidgetMessage$1.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget$WidgetMessage$Builder.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/Widget.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes$1.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes$WidgetConnectionStatusType$1.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes$WidgetConnectionStatusType$Builder.class
| |
+-src/proto/java/build-proto-widget/org/example/group/protobuf/widget/WidgetTypes.class
|
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common
|
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes$1.class
|
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes$Common_2TupleType$1.class
|
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes$Common_TimestampOrBuilder.class
|
+-src/proto/java/build-proto-widget/org/example/group/protobuf/common/CommonBaseTypes.class
+-src/proto/java/proto-widget
+-src/proto/java/proto-widget/org
+-src/proto/java/proto-widget/org/example
+-src/proto/java/proto-widget/org/example/group
+-src/proto/java/proto-widget/org/example/group/protobuf

+-src/proto/java/proto-widget/org/example/group/protobuf/widget

+-src/proto/java/proto-widget/org/example/group/protobuf/common

scons: done building targets.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140220/4bc85b84/attachment-0001.html


More information about the Scons-users mailing list