[Scons-users] Chaining generated sources.

William Blevins wblevins001 at gmail.com
Sun Mar 2 15:49:32 EST 2014


Bill,

I made a patch which shows test case proof of concept.

The generalized test case fails as I expected, but I would like to make a
stronger test assumption than "test.up_to_date()". I am a little uncertain
on how to explicitly test against the "nodes" created by env.Java through
the TestSCons instance.

I may be able to write the node information to a file inside the SConstruct
and check the expected with "test.must_contain_exactly_lines", but this
seems round about. Any thoughts?

V/R,
William


On Sat, Mar 1, 2014 at 12:36 AM, Bill Deegan <bill at baddogconsulting.com>wrote:


> William,

>

> *bump* is a sign of impatience. Nobody working on scons is getting paid to

> do so.

> You may also notice that often during the week, there's less response from

> some members of the project, and more on the weekend. Many people do this

> on their free time.

>

> Yes I thought it was clear that Dirk was asking for whatever code you

> could provide.

>

> So please do.

>

> -Bill

>

>

> On Fri, Feb 28, 2014 at 3:18 PM, William Blevins <wblevins001 at gmail.com>wrote:

>

>> Bill,

>>

>> Sorry, I assumed that the internet meme was established by now. My test

>> case response had an implicit question that got missed.

>>

>> "If you need help creating this test case then, I could try to create a

>> patch sometime this week with a link to documentation for contributing to

>> SCons."

>>

>> Since there wasn't a response, I didn't know whether I had volunteered

>> myself to create the patch or not. Redoing work is a waste.

>>

>> V/R,

>> William

>>

>>

>> On Fri, Feb 28, 2014 at 1:31 AM, Bill Deegan <bill at baddogconsulting.com>wrote:

>>

>>> William,

>>>

>>> *bump* is not encouraged.

>>> -1

>>>

>>> -Bill

>>>

>>>

>>> On Thu, Feb 27, 2014 at 5:07 PM, William Blevins <wblevins001 at gmail.com>wrote:

>>>

>>>> * bump *

>>>>

>>>> V/R,

>>>> William

>>>>

>>>>

>>>> On Mon, Feb 24, 2014 at 7:33 PM, William Blevins <wblevins001 at gmail.com

>>>> > wrote:

>>>>

>>>>> The builder implementation is irrelevant to the test case, so I

>>>>> recommend generalizing. The easiest way to do this would be:

>>>>>

>>>>> 1) Make a <name>.java file that has one or more of the properties that

>>>>> causes this problem:

>>>>> 1) The java file creates more than one class file when compiled.

>>>>> 2) The java class package is not equal to the root package.

>>>>> 2) Write an SConscript that essentially does

>>>>> # Psuedo code as follows

>>>>> Line 1: env = Environment()

>>>>> Line 2: env.Command( "<test_case_input_file>",

>>>>> "<source_directory>/<package_info>/<test_case_file_name>", Copy("$TARGET",

>>>>> "$SOURCE") )

>>>>> Line 3: env.Java( targets = <build_directory>, sources =

>>>>> <source_directory> )

>>>>>

>>>>> This test case provides the following benefits:

>>>>> 1) It is simple and easy to understand.

>>>>> Line 1: environment is setup for the example

>>>>> Line 2: source "<test_case_input_file>" creates target

>>>>> "<source_directory>/<package_info>/<test_case_file_name>" named DERIVED.

>>>>> Line 3: DERIVED becomes a derived source for the Java builder.

>>>>> 2) This keeps the context local to SCons and removes any external

>>>>> dependencies: so all code generators are equal~!

>>>>>

>>>>> Now you just need to validate the produced dependency tree. Please

>>>>> see the original email for dependency tree examples.

>>>>>

>>>>> V/R,

>>>>> William

>>>>>

>>>>> If you need help creating this test case then, I could try to create a

>>>>> patch sometime this week with a link to documentation for contributing to

>>>>> SCons.

>>>>>

>>>>>

>>>>>

>>>>>

>>>>> On Sat, Feb 22, 2014 at 7:29 PM, Dirk Bächle <tshortik at gmx.de> wrote:

>>>>>

>>>>>> On 22.02.2014 22:26, William Blevins wrote:

>>>>>>

>>>>>>> Unfortunately, I cannot post the code without going through a lot of

>>>>>>> hoops.

>>>>>>>

>>>>>>>

>>>>>> Okay, I understand...but could you post your version of the Protoc

>>>>>> Builder? The original snippet from the Wiki, as well as the latest revision

>>>>>> from the Bitbucket repository, both don't support Java.

>>>>>> So having your current Builder available would really help for

>>>>>> setting up simple test examples and such.

>>>>>>

>>>>>> Thanks a lot in advance.

>>>>>>

>>>>>>

>>>>>> Dirk

>>>>>>

>>>>>> _______________________________________________

>>>>>> Scons-users mailing list

>>>>>> Scons-users at scons.org

>>>>>> http://four.pairlist.net/mailman/listinfo/scons-users

>>>>>>

>>>>>

>>>>>

>>>>

>>>> _______________________________________________

>>>> Scons-users mailing list

>>>> Scons-users at scons.org

>>>> http://four.pairlist.net/mailman/listinfo/scons-users

>>>>

>>>>

>>>

>>> _______________________________________________

>>> Scons-users mailing list

>>> Scons-users at scons.org

>>> http://four.pairlist.net/mailman/listinfo/scons-users

>>>

>>>

>>

>> _______________________________________________

>> Scons-users mailing list

>> Scons-users at scons.org

>> http://four.pairlist.net/mailman/listinfo/scons-users

>>

>>

>

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users

>

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140302/29b690be/attachment-0001.htm
-------------- next part --------------
diff -r 367f69787214 test/Java/DerivedSourceTest.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/Java/DerivedSourceTest.py Sun Mar 02 21:32:04 2014 +0100
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Test of javac.py when building java code from derived sources.
+ at author William Blevins
+ at version 2 March 2014
+"""
+
+import os
+import TestSCons
+import SCons.Node.FS
+
+test = TestSCons.TestSCons()
+
+test.write(
+ ['Sample.java'],
+"""
+package org.sample;
+
+public class Sample {
+ enum InnerEnum {
+ stuff,
+ and,
+ things
+ }
+}
+"""
+)
+
+test.write(
+ ['SConstruct'],
+"""
+import os
+
+env = Environment()
+
+env.Command(
+ os.path.join( 'org', 'sample', 'Sample.java' ),
+ 'Sample.java',
+ Copy(
+ '$TARGET',
+ '$SOURCE'
+ )
+)
+
+env.Java(
+ 'build',
+ 'org'
+)
+"""
+)
+
+test.run( arguments = '.' )
+
+test.up_to_date(arguments = '.')


More information about the Scons-users mailing list