supersdar / collide

Automatically exported from code.google.com/p/collide
Apache License 2.0
0 stars 0 forks source link

Ant build failed, reopen issue of 31 #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. git clone http://xxxx/collide 
2. cd collide 
3. ant dist

"......
src.dto.client:
    [mkdir] Created dir: /home/ligen/works/gitroot/collide/bin/gen/com/google/collide/dto/client
    [javac] Compiling 1 source file to /home/ligen/works/gitroot/collide/bin/classes
    [javac] Compiling 2 source files to /home/ligen/works/gitroot/collide/bin/classes
    [javac] /home/ligen/works/gitroot/collide/java/com/google/collide/dto/client/ClientDocOpFactory.java:25: error: package com.google.collide.dto.client.DtoClientImpls does not exist
    [javac] import com.google.collide.dto.client.DtoClientImpls.DeleteImpl;
    [javac]                                                    ^
    [javac] /home/ligen/works/gitroot/collide/java/com/google/collide/dto/client/ClientDocOpFactory.java:26: error: package com.google.collide.dto.client.DtoClientImpls does not exist
......."

I found DtoClientImpls class has been compiled into:
~/works/gitroot/collide/bin/classes/works/gitroot/collide/bin/gen/com/google/col
lide/dto/client
however, it should have been compiled into :
~/works/gitroot/collide/bin/classes/com/google/collide/dto/client

Is there something env vars which need to be set before? or there are some 
problem with build.xml?

What version of the product are you using? On what operating system?
OS: ubuntu 12.04 
      Apache Ant(TM) version 1.8.2 compiled on December 3 2011
     OpenJDK Runtime Environment (IcedTea7 2.1.1pre) (7~u3-2.1.1~pre1-1ubuntu3)

I have finally found the resolution of this problem. This problem is cause by 
the line in build.xml like this:
   "<arg value="--package_base=gen/"/>"   
and in my path string 
"/home/ligen/works/gitroot/collide/bin/gen/com/google/collide/dto/client", you 
can see my home directory string  "/home/ligen/" match the package_base string 
"gen/", this cause DtoGenerator generate wrong path of DtoClientImpls.java.

I provide a patch here. could you fix this defect? otherwise, I have to change 
my name :P.   

diff --git a/java/com/google/collide/dto/build.xml 
b/java/com/google/collide/dto/build.xml
index abd04f5..b31b5d5 100644
--- a/java/com/google/collide/dto/build.xml
+++ b/java/com/google/collide/dto/build.xml
@@ -49,7 +49,7 @@
                <arg value="--dto_jar=${dirs.bin}/${dirs.toppkg}/dto/dto-interfaces.jar"/>
           <arg value="--gen_file_name=${dirs.gen}/${dirs.toppkg}/dto/client/DtoClientImpls.java"/>
           <arg value="--impl=client"/>
-          <arg value="--package_base=gen/"/>
+          <arg value="--package_base=${dirs.gen}/"/>
         </java>
         <do.javac srcdir="${dirs.gen}" destdir="${dirs.bin}">
           <include name="${dirs.toppkg}/dto/client/**/*.java"/>
@@ -87,7 +87,7 @@
           <arg value="--dto_jar=${dirs.bin}/${dirs.toppkg}/dto/dto-interfaces.jar"/>
          <arg value="--gen_file_name=${dirs.gen}/${dirs.toppkg}/dto/server/DtoServerImpls.java"/>
           <arg value="--impl=server"/>
-          <arg value="--package_base=gen/"/>
+          <arg value="--package_base=${dirs.gen}/"/>
         </java>
         <do.javac srcdir="${dirs.gen}" destdir="${dirs.bin}">
           <include name="${dirs.toppkg}/dto/server/**/*.java"/>
diff --git a/java/com/google/collide/dtogen/DtoGenerator.java 
b/java/com/google/collide/dtogen/DtoGenerator.java
index e51b459..b6ee5d4 100644
--- a/java/com/google/collide/dtogen/DtoGenerator.java
+++ b/java/com/google/collide/dtogen/DtoGenerator.java
@@ -86,6 +86,8 @@ public class DtoGenerator {
     String fileName = outputFilePath.substring(packageEnd + 1);
     String className = fileName.substring(0, fileName.indexOf(".java"));
     String packageName = outputFilePath.substring(packageStart, packageEnd).replace('/', '.');
+       
+    

     File outFile = new File(outputFilePath);
     File interfaceJar = new File(dto_jar);
diff --git a/javatests/com/google/collide/client/build.xml 
b/javatests/com/google/collide/client/build.xml
index 9038438..38cb74b 100644
--- a/javatests/com/google/collide/client/build.xml
+++ b/javatests/com/google/collide/client/build.xml
@@ -48,7 +48,7 @@
           <arg value="--dto_jar=${dirs.testbin}/${dirs.toppkg}/client/testing/dto/client-testdtos.jar"/>
           <arg value="--gen_file_name=${dirs.testgen}/${dirs.toppkg}/client/testing/CollideDtoClientTestingImpls.java"/>
           <arg value="--impl=client"/>
-          <arg value="--package_base=gen/"/>
+          <arg value="--package_base=${dirs.testgen}/"/>
         </java>
         <do.javac srcdir="${dirs.testgen}" destdir="${dirs.testbin}">
           <include name="${dirs.toppkg}/client/**/*.java"/>
diff --git a/javatests/com/google/collide/dtogen/build.xml 
b/javatests/com/google/collide/dtogen/build.xml
index fd4f737..d168262 100644
--- a/javatests/com/google/collide/dtogen/build.xml
+++ b/javatests/com/google/collide/dtogen/build.xml
@@ -48,7 +48,7 @@
           <arg value="--dto_jar=${dirs.testbin}/${dirs.toppkg}/dtogen/dtogen-testdtos.jar"/>
           <arg value="--gen_file_name=${dirs.testgen}/${dirs.toppkg}/dtogen/server/TestDtoServerImpls.java"/>
           <arg value="--impl=server"/>
-          <arg value="--package_base=gen/"/>
+          <arg value="--package_base=${dirs.testgen}/"/>
         </java>
         <mkdir dir="${dirs.testgen}/${dirs.toppkg}/dtogen/client"/>
         <java classname="${pkg.toppkg}.dtogen.DtoGenerator" fork="true"

Original issue reported on code.google.com by superli...@gmail.com on 13 Jul 2012 at 1:28

GoogleCodeExporter commented 8 years ago
I reopened issue #31 myself.

Original comment by dragonsinth on 13 Jul 2012 at 2:35