Skip to main content



      Home
Home » Archived » Buckminster » Understanding uptodatepolicy(Avoid regenerating Xtext language artifact during each build)
Understanding uptodatepolicy [message #647530] Thu, 06 January 2011 15:07 Go to next message
Eclipse UserFriend
Hello,

I'm quite new to Buckminster and trying to set up a build enviroment for our Xtext projects.

I got as far as being able to make Buckminster trigger the mwe2 workflow for generating the Xtext language artifacts before running the eclipse.build action. To achieve this, I added a CSPEX extension to the project which basically adds the src-gen folder as a prerequisite to the eclipse.build action and adds the action 'gen.xtext.artifacts' for running the mwe2 workflow (using an ANT script):

<?xml version="1.0" encoding="UTF-8"?>
<cspecExtension
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:bc="http://www.eclipse.org/buckminster/Common-1.0"
	xmlns="http://www.eclipse.org/buckminster/CSpec-1.0">	
	<artifacts>
	    <private name="mydsl.src" base="${buckminster.home}/src/">
	       <path path="org/xtext/example/mydsl/MyDsl.xtext"/>	       
	    </private>	
	</artifacts>
	
	<actions>	
        <public name="gen.xtext.artifacts" actor="jdt.ant">
            <actorProperties>
                <property key="buildFile" value="gen_code.xml" />
            </actorProperties>
            <prerequisites>
                <attribute name="mydsl.src" alias="grammar"/>                                             
            </prerequisites>
            <products alias="output">
                <private name="sources.generated" path="${buckminster.home}/src-gen/" />                
            </products>
        </public>
    </actions>

    <alterActions>
        <private name="eclipse.build">
            <alterPrerequisites>
                <attribute name="sources.generated"/>		        
            </alterPrerequisites>
        </private>
    </alterActions>
	   
</cspecExtension>


Now, I want to have the gen.xtext.artifacts action only executed if the MyDSl.xtext file actually changed but I'm unable to get it working. It just runs every time.

From what I read in the BuckyBook I assume that I could use an updatepolicy of COUNT to make the action run as soon as the MyDsl.xtext file is younger than all files in src-gen:

<actions>	
        <public name="gen.xtext.artifacts" actor="jdt.ant">
            <actorProperties>
                <property key="buildFile" value="gen_code.xml" />
            </actorProperties>
            <prerequisites>
                <attribute name="mydsl.src" alias="grammar"/>                                             
            </prerequisites>
            <products alias="output" upToDatePolicy="COUNT" fileCount="1">
                <private name="sources.generated" path="${buckminster.home}/src-gen/" />                
            </products>
        </public>
    </actions>


But it keeps always executing that action. Even if I use the NOT EMPTY upToDatePolicy the action is invoked each time.

Do you have any idea where my problem might be or how I can find out why Buckminster decides that the
action needs to be invoked?

Thanks,
Tobias
Re: Understanding uptodatepolicy [message #647585 is a reply to message #647530] Fri, 07 January 2011 02:53 Go to previous messageGo to next message
Eclipse UserFriend
Setting loglevel DEBUG might give you some more info. It should then log some info about why it thinks the product needs
to be rebuilt.

- thomas

On 2011-01-06 21:07, Tobias wrote:
> Hello,
>
> I'm quite new to Buckminster and trying to set up a build enviroment for our Xtext projects.
>
> I got as far as being able to make Buckminster trigger the mwe2 workflow for generating the Xtext language artifacts
> before running the eclipse.build action. To achieve this, I added a CSPEX extension to the project which basically adds
> the src-gen folder as a prerequisite to the eclipse.build action and adds the action 'gen.xtext.artifacts' for running
> the mwe2 workflow (using an ANT script):
>
>
> <?xml version="1.0" encoding="UTF-8"?>
> <cspecExtension
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:bc="http://www.eclipse.org/buckminster/Common-1.0"
> xmlns="http://www.eclipse.org/buckminster/CSpec-1.0">
> <artifacts>
> <private name="mydsl.src" base="${buckminster.home}/src/">
> <path path="org/xtext/example/mydsl/MyDsl.xtext"/> </private>
> </artifacts>
>
> <actions>
> <public name="gen.xtext.artifacts" actor="jdt.ant">
> <actorProperties>
> <property key="buildFile" value="gen_code.xml" />
> </actorProperties>
> <prerequisites>
> <attribute name="mydsl.src" alias="grammar"/> </prerequisites>
> <products alias="output">
> <private name="sources.generated" path="${buckminster.home}/src-gen/" /> </products>
> </public>
> </actions>
>
> <alterActions>
> <private name="eclipse.build">
> <alterPrerequisites>
> <attribute name="sources.generated"/> </alterPrerequisites>
> </private>
> </alterActions>
> </cspecExtension>
>
> Now, I want to have the gen.xtext.artifacts action only executed if the MyDSl.xtext file actually changed but I'm unable
> to get it working. It just runs every time.
> From what I read in the BuckyBook I assume that I could use an updatepolicy of COUNT to make the action run as soon as
> the MyDsl.xtext file is younger than all files in src-gen:
>
>
> <actions>
> <public name="gen.xtext.artifacts" actor="jdt.ant">
> <actorProperties>
> <property key="buildFile" value="gen_code.xml" />
> </actorProperties>
> <prerequisites>
> <attribute name="mydsl.src" alias="grammar"/> </prerequisites>
> <products alias="output" upToDatePolicy="COUNT" fileCount="1">
> <private name="sources.generated" path="${buckminster.home}/src-gen/" /> </products>
> </public>
> </actions>
>
>
> But it keeps always executing that action. Even if I use the NOT EMPTY upToDatePolicy the action is invoked each time.
>
> Do you have any idea where my problem might be or how I can find out why Buckminster decides that the action needs to be
> invoked?
>
> Thanks,
> Tobias
>
Re: Understanding uptodatepolicy [message #647591 is a reply to message #647585] Fri, 07 January 2011 04:00 Go to previous message
Eclipse UserFriend
Hello Thomas,

thanks for your reply. The loglevel is set to DEBUG and I get plenty of output but I don't find
anything about upToDate checks. The output starts with:

Actions to perform (in order)
  org.xtext.example.mydsl:osgi.bundle$1.0.0#gen.xtext.artifacts
  org.xtext.example.mydsl:osgi.bundle$1.0.0#eclipse.build
  org.xtext.example.mydsl:osgi.bundle$1.0.0#bundle.jar
[start org.xtext.example.mydsl:osgi.bundle$1.0.0#gen.xtext.artifacts]

 ... property output ...

Emitting classpath for project org.xtext.example.mydsl...
 java project, contains 42 entries

 ... classpath output ...

[ant] Buildfile: C:\Workspace\org.xtext.example.mydsl\gen_code.xml
[ant] Grammar = C:\Workspace\org.xtext.example.mydsl\src\org\xtext\example\mydsl\MyDsl.xtext
[ant] 
[ant] gen.xtext.artifacts:
[end org.xtext.example.mydsl:osgi.bundle$1.0.0#gen.xtext.artifacts]
[start org.xtext.example.mydsl:osgi.bundle$1.0.0#eclipse.build]
...


I would expect information about the up to date check somewhere before the
[start org.xtext.example.mydsl:osgi.bundle$1.0.0#gen.xtext.artifacts]
part or am I wrong?

Regards,
Tobias
Previous Topic:proper matcher syntax?
Next Topic:Order of precedence for properties
Goto Forum:
  


Current Time: Sun Aug 31 14:03:00 EDT 2025

Powered by FUDForum. Page generated in 0.16384 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top