Home Patches

Slice2CppTask

sinofoolsinofool Member Bochun BaiOrganization: sinofool.comProject: http://sinofool.com/ ✭✭
I use ant build system for both Java and C++ compile in the project.

IceJ includes Slice2JavaTask but no Slice2CppTask.

I copied Slice2JavaTask.java to Slice2CppTask.java and changed some class name. But it does not handle the dependencies correctly.

By overriding parseDependencies method, it works.
@Override
    protected java.util.List
    parseDependencies(String allDependencies)
    {
        java.util.List sResult = super.parseDependencies(allDependencies);
        java.util.Iterator p = sResult.iterator();
        while(p.hasNext())
        {
            SliceDependency dep = (SliceDependency)p.next();
            assert(dep._dependencies[0].endsWith(".cpp"));

            String[] newDependencies = new String[dep._dependencies.length - 1];
            for(int initNewDep=0;initNewDep < newDependencies.length;++initNewDep)
            {
                newDependencies[initNewDep] = dep._dependencies[initNewDep+1];
            }
            dep._dependencies = newDependencies;
        }
        return sResult;
    }
Sign In or Register to comment.