Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-13-2007
blair blair is offline
Registered User
 
Name: Blair Zajac
Organization: Sony Pictures Imageworks
Project: VnP
 
Join Date: Mar 2007
Posts: 24
slice2java ant task not re-running

I have a build.xml file that works fine the first time you run it, but after running an "ant clean" task that deletes the subdirectory that slice2java creates, then successive runs of ant do not rebuild things:

Code:
$ ant
Buildfile: build.xml

slice2java:
[slice2java] skipping vnp_subversion.ice
Right now, I need to touch the slice file for it to always regenerate the *.java files.

The top portion of our slice file:

Code:
#ifndef VNP_ICE
#define VNP_ICE

[["java:package:com.imageworks.vnp"]]
module SubversionIce
{
    /** Generic exception. */
    exception VnpIceException {
        string message;
    };
and a portion of our build.xml.

Code:
<project name="VnpSubversionServer" default="slice2java">

    <property name="ice_home.dir" value="/usr/lib/Ice-3.1.1"/>

    <property name="src.dir" value="src"/>

    <property name="generated.dir"
              value="${src.dir}/com/imageworks/vnp/SubversionIce"/>

    <taskdef name="slice2java"
             classpath="${ice_home.dir}/ant"
             classname="Slice2JavaTask"/>

    <target name="slice2java">
        <!-- We seem to always need to run slice2java otherwise it
             will not create the *.java files if they have been
             deleted. -->
        <slice2java outputdir="${src.dir}">
            <fileset dir="slice" includes="vnp_subversion.ice"/>
        </slice2java>
    </target>

    <target name="clean">
        <delete file=".depend"/>
        <delete dir="${generated.dir}"/>
        <delete dir="${java.build.dir}"/>
        <delete file="${vnp_svn.jar}"/>
        <delete dir="${scala.build.dir}"/>
    </target>

</project>
Any ideas on how to make slice2java rerun if the files it generates are gone?

Regards,
Blair
Reply With Quote
  #2 (permalink)  
Old 03-13-2007
mes's Avatar
mes mes is offline
ZeroC Staff
 
Name: Mark Spruiell
Organization: ZeroC, Inc.
Project: Ice Developer
 
Join Date: Feb 2003
Location: California
Posts: 957
Hi Blair,

The Slice2Java ant task uses a dependency file to determine whether a Slice file needs to be recompiled. By default this file is named .depend, or ${outputdir}/.depend if you define the outputdir attribute. In your ant project, this file would be called ${src.dir}/.depend.

As you've seen, removing the generated files does not prompt the Slice2Java task to execute the translator. However, if you remove the dependency file as part of your clean target, the Slice2Java task will recompile all of your Slice files.

Hope that helps,
- Mark
Reply With Quote
  #3 (permalink)  
Old 03-13-2007
blair blair is offline
Registered User
 
Name: Blair Zajac
Organization: Sony Pictures Imageworks
Project: VnP
 
Join Date: Mar 2007
Posts: 24
Hi Mark,

Thanks, that did the trick.

Regards,
Blair
Reply With Quote
  #4 (permalink)  
Old 11-29-2007
jrray jrray is offline
Registered User
 
Name: J Robert Ray
Organization: Imageworks
Project: cutlist server
 
Join Date: Nov 2007
Posts: 1
Dependency problem when using --checksum

I ran into a problem with the ant dependency feature after I enabled checksums. If a built detects that only some of the slice files need to be rebuilt, my checksum class is remade from only the out of date slice files, and the class is then missing entries.

I made this patch to change the dependency tracking into an all-or-nothing rebuild, if the checksum feature is enabled.

Code:
--- ant/Slice2JavaTask.java     (revision 153092)
+++ ant/Slice2JavaTask.java     (revision 153093)
@@ -118,6 +118,7 @@
         // last updated or a slice file it depends on changed).
         //
         java.util.Vector buildList = new java.util.Vector();
+        java.util.Vector skipList = new java.util.Vector();
         java.util.Iterator p = _fileSets.iterator();
         while(p.hasNext())
         {
@@ -137,7 +138,27 @@
                 }
                 else
                 {
-                    log("skipping " + files[i]);
+                    skipList.addElement(slice);
+                }
+            }
+
+            if(   _checksum != null && _checksum.length() > 0
+               && !buildList.isEmpty())
+            {
+                //
+                // If generating a checksum, all slice files must be compiled
+                // if any are out of date so that the checksum class contains
+                // all the entities from all the slice files.
+                //
+                buildList.addAll(skipList);
+            }
+            else
+            {
+                java.util.Iterator i = skipList.iterator();
+                while(i.hasNext())
+                {
+                    File file = (File)i.next();
+                    log("skipping " + file.getName());
                 }
             }
         }

Last edited by jrray : 11-29-2007 at 04:42 PM.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Duplicate naming error while running slice2java Sameerrele Help Center 3 10-02-2006 08:52 AM
Problem running c++ Hello example programm SiegfriedHora Help Center 2 09-17-2006 10:44 PM
Anyone compiled and running on Solaris x86? ehup Help Center 0 09-05-2006 08:16 PM
slice2java task source code xdm Help Center 1 12-15-2004 07:20 PM
running sample server error on rh9 a2234 Help Center 1 10-12-2004 10:50 PM


All times are GMT -4. The time now is 07:43 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.