mscarcy / collide

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

Ant build failed if path contains "gen" #31

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)

Please provide any additional information below.

Original issue reported on code.google.com by superli...@gmail.com on 11 Jul 2012 at 4:11

GoogleCodeExporter commented 8 years ago
We require Ant 1.8.4+

Perhaps your (older) version of ant is misinterpreting one of our paths?

Original comment by dragonsinth on 11 Jul 2012 at 9:28

GoogleCodeExporter commented 8 years ago

Original comment by dragonsinth on 12 Jul 2012 at 6:15

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
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 comment by superli...@gmail.com on 13 Jul 2012 at 1:25

GoogleCodeExporter commented 8 years ago
Nice sleuthing!  Please provide your desired "author" string so we can credit 
you.

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

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 4471933b3c81.

Original comment by dragonsinth on 13 Jul 2012 at 5:56

GoogleCodeExporter commented 8 years ago
Freeland, can please review / check that this builds for you (I'm not properly 
setup to build right now on this machine):

http://code.google.com/p/collide/source/list?name=package-base

Original comment by dragonsinth on 13 Jul 2012 at 5:59

GoogleCodeExporter commented 8 years ago

Original comment by dragonsinth on 14 Jul 2012 at 3:36

GoogleCodeExporter commented 8 years ago
Ping.  Still wants review.

Original comment by dragonsinth on 6 Aug 2012 at 11:03

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 92de08c50355.

Original comment by dragonsinth on 7 Aug 2012 at 10:05