You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Jean Lazarou <je...@yahoo.com> on 2005/07/12 09:12:08 UTC

javac

We had problem with a (legacy) build from scratch, seems that, because we have too many java files to compile, nothing is compiled (both on Linux and Windows2000). 
 
After spending 4 days on that, I decided to split the compilation, I created a new task, name "bydir-javac". The task is derived from Javac.
 
Can I publish this? Is it a better way of doing it?
 
Jean Lazarou

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: javac

Posted by Peter Reilly <pe...@corvil.com>.
Ok
I still think that it would be better to try to modularize it, however
it is fair enough the deal with the problem using the least amount
of effort!.

Cheers,
Peter

Jean Lazarou wrote:

>We changed the memory size, using the ways you described, but the build still failed.
> 
>The problem with splitting in functional units is that the development is done on several sites with several teams, and the final build made by us... we don't want to change that strange process because that development is the legacy code maintainance, new developments are structured differently and we don't run into the same problems. But, we want to have all the builds made using ant.
> 
>Jean
>
>Peter Reilly <pe...@apache.org> wrote:
>It may be better to give more memory to the compiler.
>With enough memory a hugh number of files can be
>compiled. The default memory is only I think 64M.
>
>This can be done in a number of ways -
>
>- use the env variable ANT_OPTS to specify the memory
>for Ant's jvm
>example: export ANT_OPTS="-Xms200m -Xmx1000m"
>in your .bashrc file
>- spawn a jvm for the compiler
>destdir="${build}"
>fork="true" memoryInitialSize="100m"
>memoryMaximumSize="1000m"/>
>
>In extreme cases you can split the code into functional units
>and compile each separately. This would not be at the level of
>directories, but complete package trees. We had to do this
>in a project once.
>
>Peter 
>
>Jean Lazarou wrote:
>
>  
>
>>We are trying to create an ant build for legacy code, that is build using some make tool, as I don't want to break the already complicated buiild, I preferred simulate the same behaviour as the make tool we're using. As that legacy code is still alive I cannot count the files and decide how to split because it could break in several months.
>>
>>Jean
>>
>>
>>Phil Weighill Smith 
>>    
>>
>wrote:
>  
>
>>Why not simply put two calls to javac in your build script and split the
>>source tree in two in the same way that you have in your new task,
>>passing one tree to the first call and the other to the second?
>>
>>Clearly you need to ensure that the first call compiles "pre-requisite"
>>code for the second call and that you should avoid cyclic references
>>between the two sets of classes.
>>
>>Phil :n.
>>
>>PS: I would consider re-structuring the application into "subsystems"
>>with separate source trees and separate build scripts per subsystem.
>>Dependencies between subsystems only on the class files (not the source
>>files). This is the approach we have taken to great effect.
>>
>>On Tue, 2005-07-12 at 00:12 -0700, Jean Lazarou wrote:
>>
>>
>>    
>>
>>>We had problem with a (legacy) build from scratch, seems that, because we have too many java files to compile, nothing is compiled (both on Linux and Windows2000). 
>>>
>>>After spending 4 days on that, I decided to split the compilation, I created a new task, name "bydir-javac". The task is derived from Javac.
>>>
>>>Can I publish this? Is it a better way of doing it?
>>>
>>>Jean Lazarou
>>>
>>>__________________________________________________
>>>Do You Yahoo!?
>>>Tired of spam? Yahoo! Mail has the best spam protection around 
>>>http://mail.yahoo.com 
>>>
>>>
>>>      
>>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>>For additional commands, e-mail: dev-help@ant.apache.org
>>
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Tired of spam? Yahoo! Mail has the best spam protection around 
>>http://mail.yahoo.com 
>>
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: javac

Posted by Jean Lazarou <je...@yahoo.com>.
We changed the memory size, using the ways you described, but the build still failed.
 
The problem with splitting in functional units is that the development is done on several sites with several teams, and the final build made by us... we don't want to change that strange process because that development is the legacy code maintainance, new developments are structured differently and we don't run into the same problems. But, we want to have all the builds made using ant.
 
Jean

Peter Reilly <pe...@apache.org> wrote:
It may be better to give more memory to the compiler.
With enough memory a hugh number of files can be
compiled. The default memory is only I think 64M.

This can be done in a number of ways -

- use the env variable ANT_OPTS to specify the memory
for Ant's jvm
example: export ANT_OPTS="-Xms200m -Xmx1000m"
in your .bashrc file
- spawn a jvm for the compiler
destdir="${build}"
fork="true" memoryInitialSize="100m"
memoryMaximumSize="1000m"/>

In extreme cases you can split the code into functional units
and compile each separately. This would not be at the level of
directories, but complete package trees. We had to do this
in a project once.

Peter 

Jean Lazarou wrote:

>We are trying to create an ant build for legacy code, that is build using some make tool, as I don't want to break the already complicated buiild, I preferred simulate the same behaviour as the make tool we're using. As that legacy code is still alive I cannot count the files and decide how to split because it could break in several months.
> 
>Jean
>
>
>Phil Weighill Smith 
wrote:
>Why not simply put two calls to javac in your build script and split the
>source tree in two in the same way that you have in your new task,
>passing one tree to the first call and the other to the second?
>
>Clearly you need to ensure that the first call compiles "pre-requisite"
>code for the second call and that you should avoid cyclic references
>between the two sets of classes.
>
>Phil :n.
>
>PS: I would consider re-structuring the application into "subsystems"
>with separate source trees and separate build scripts per subsystem.
>Dependencies between subsystems only on the class files (not the source
>files). This is the approach we have taken to great effect.
>
>On Tue, 2005-07-12 at 00:12 -0700, Jean Lazarou wrote:
> 
>
>>We had problem with a (legacy) build from scratch, seems that, because we have too many java files to compile, nothing is compiled (both on Linux and Windows2000). 
>>
>>After spending 4 days on that, I decided to split the compilation, I created a new task, name "bydir-javac". The task is derived from Javac.
>>
>>Can I publish this? Is it a better way of doing it?
>>
>>Jean Lazarou
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Tired of spam? Yahoo! Mail has the best spam protection around 
>>http://mail.yahoo.com 
>> 
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
> 
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: javac

Posted by Peter Reilly <pe...@apache.org>.
It may be better to give more memory to the compiler.
With enough memory a hugh number of files can be
compiled. The default memory is only I think 64M.

This can be done in a number of ways -

  - use the env variable ANT_OPTS to specify the memory
    for Ant's jvm
    example: export ANT_OPTS="-Xms200m -Xmx1000m"
            in your .bashrc file
  - spawn a jvm for the compiler
          <javac srcdir="${src}"
                 destdir="${build}"
                 fork="true" memoryInitialSize="100m"
                 memoryMaximumSize="1000m"/>

In extreme cases you can split the code into functional units
and compile each separately. This would not be at the level of
directories, but complete package trees. We had to do this
in a project once.

Peter 

Jean Lazarou wrote:

>We are trying to create an ant build for legacy code, that is build using some make tool, as I don't want to break the already complicated buiild, I preferred simulate the same behaviour as the make tool we're using. As that legacy code is still alive I cannot count the files and decide how to split because it could break in several months.
> 
>Jean
>
>
>Phil Weighill Smith <ph...@volantis.com> wrote:
>Why not simply put two calls to javac in your build script and split the
>source tree in two in the same way that you have in your new task,
>passing one tree to the first call and the other to the second?
>
>Clearly you need to ensure that the first call compiles "pre-requisite"
>code for the second call and that you should avoid cyclic references
>between the two sets of classes.
>
>Phil :n.
>
>PS: I would consider re-structuring the application into "subsystems"
>with separate source trees and separate build scripts per subsystem.
>Dependencies between subsystems only on the class files (not the source
>files). This is the approach we have taken to great effect.
>
>On Tue, 2005-07-12 at 00:12 -0700, Jean Lazarou wrote:
>  
>
>>We had problem with a (legacy) build from scratch, seems that, because we have too many java files to compile, nothing is compiled (both on Linux and Windows2000). 
>>
>>After spending 4 days on that, I decided to split the compilation, I created a new task, name "bydir-javac". The task is derived from Javac.
>>
>>Can I publish this? Is it a better way of doing it?
>>
>>Jean Lazarou
>>
>>__________________________________________________
>>Do You Yahoo!?
>>Tired of spam? Yahoo! Mail has the best spam protection around 
>>http://mail.yahoo.com 
>>    
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
>For additional commands, e-mail: dev-help@ant.apache.org
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: javac

Posted by Jean Lazarou <je...@yahoo.com>.
We are trying to create an ant build for legacy code, that is build using some make tool, as I don't want to break the already complicated buiild, I preferred simulate the same behaviour as the make tool we're using. As that legacy code is still alive I cannot count the files and decide how to split because it could break in several months.
 
Jean


Phil Weighill Smith <ph...@volantis.com> wrote:
Why not simply put two calls to javac in your build script and split the
source tree in two in the same way that you have in your new task,
passing one tree to the first call and the other to the second?

Clearly you need to ensure that the first call compiles "pre-requisite"
code for the second call and that you should avoid cyclic references
between the two sets of classes.

Phil :n.

PS: I would consider re-structuring the application into "subsystems"
with separate source trees and separate build scripts per subsystem.
Dependencies between subsystems only on the class files (not the source
files). This is the approach we have taken to great effect.

On Tue, 2005-07-12 at 00:12 -0700, Jean Lazarou wrote:
> We had problem with a (legacy) build from scratch, seems that, because we have too many java files to compile, nothing is compiled (both on Linux and Windows2000). 
> 
> After spending 4 days on that, I decided to split the compilation, I created a new task, name "bydir-javac". The task is derived from Javac.
> 
> Can I publish this? Is it a better way of doing it?
> 
> Jean Lazarou
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

RE: javac

Posted by Jean Lazarou <je...@yahoo.com>.
Do you think we can pick up any splitting for the subsystem to compile?
 
How can you be sure, when you're not developer of the project, that some sub-tree won't imply that, due to compilation dependencies, again too much files to compile at once?
Even the approach I wrote is not full reliable... 
 
Any way, creating a new task that derives from the ant Javac task implemention was pretty easy to do.
 
I thank you for you advice.
 
Jean


Dominique Devienne <dd...@gmail.com> wrote:
Phil is right Jean. Independently of splitting the code in subsystems, which
is always a good idea, even if you can't do that you can split the compile
of a single source tree into several passes using regular . This can
even enforce dependencies of the code compiled by the different passes. The
trick is to reset the sourcepath that normally sets.

I include here an example for reference. Hope this helps. --DD

       Compile the java code from src/ into build/classes
    -->





         when not forking , and instead specify directly the
         JVM argument only when forking... Convoluted, but works!  -->

















destdir="@{destdir}" sourcepath=""
deprecation="${deprecation}" debug="true" verbose="false"
includeAntRuntime="false" fork="@{fork}">
 -->






























> -----Original Message-----
> From: Phil Weighill Smith [mailto:phil.weighill-smith@volantis.com]
> 
> Why not simply put two calls to javac in your build script and split the
> source tree in two in the same way that you have in your new task,
> passing one tree to the first call and the other to the second?
> 
> Clearly you need to ensure that the first call compiles "pre-requisite"
> code for the second call and that you should avoid cyclic references
> between the two sets of classes.
> 
> On Tue, 2005-07-12 at 00:12 -0700, Jean Lazarou wrote:
> > We had problem with a (legacy) build from scratch, seems that, because
> we have too many java files to compile, nothing is compiled (both on Linux
> and Windfoos2000).
> >
> > After spending 4 days on that, I decided to split the compilation, I
> created a new task, name "bydir-javac". The task is derived from Javac.
> >
> > Can I publish this? Is it a better way of doing it?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

RE: javac

Posted by Dominique Devienne <dd...@gmail.com>.
Phil is right Jean. Independently of splitting the code in subsystems, which
is always a good idea, even if you can't do that you can split the compile
of a single source tree into several passes using regular <javac>. This can
even enforce dependencies of the code compiled by the different passes. The
trick is to reset the sourcepath that <javac> normally sets.

I include here an example for reference. Hope this helps. --DD

  <!-- =====================================================
       Compile the java code from src/ into build/classes
    -->
  <target name="-classes">

    <mkdir dir="build/classes/META-INF" />
    <mkdir dir="build/testclasses" />

    <!-- Avoid warning message about memoryMaximumSize being ignored
         when not forking <javac>, and instead specify directly the
         JVM argument only when forking... Convoluted, but works!  -->
    <property name="javac.memoryMaximumSize.true" value="-J-Xmx512m" />
    <property name="javac.memoryMaximumSize.false" value="" />

    <property name="deprecation" value="true" />

    <macrodef name="compile">
      <attribute name="fork" default="false" />
      <attribute name="srcdir" default="src" />
      <attribute name="destdir" default="build/classes" />
      <element name="sources" implicit="true" optional="true" />
      <sequential>
        <javac srcdir="@{srcdir}" source="1.4"
               destdir="@{destdir}" sourcepath=""
               deprecation="${deprecation}" debug="true" verbose="false"
               includeAntRuntime="false" fork="@{fork}">
          <!-- equivalent to <javac ... memoryMaximumSize="512m"> -->
          <compilerarg line="${javac.memoryMaximumSize.@{fork}}" />
          <classpath refid="classpath" />
          <sources/>
        </javac>
      </sequential>
    </macrodef>

    <!-- compile FOO first, -->
    <compile fork="true">
      <include name="com/acme/foo/**" />
      <include name="com/acme/app/foo/**" />
    </compile>

    <!-- then BAR, -->
    <compile>
      <include name="com/acme/bar/**" />
      <include name="com/acme/app/bar/**" />
      <include name="com/acme/testing/utils/TestAlgo*.java" />
    </compile>

    <!-- then the package-private tests, -->
    <compile srcdir="test" destdir="build/testclasses" />

    <!-- and finally the examples. -->
    <compile>
      <include name="com/acme/examples/**" />
    </compile>

  </target>

> -----Original Message-----
> From: Phil Weighill Smith [mailto:phil.weighill-smith@volantis.com]
> 
> Why not simply put two calls to javac in your build script and split the
> source tree in two in the same way that you have in your new task,
> passing one tree to the first call and the other to the second?
> 
> Clearly you need to ensure that the first call compiles "pre-requisite"
> code for the second call and that you should avoid cyclic references
> between the two sets of classes.
> 
> On Tue, 2005-07-12 at 00:12 -0700, Jean Lazarou wrote:
> > We had problem with a (legacy) build from scratch, seems that, because
> we have too many java files to compile, nothing is compiled (both on Linux
> and Windfoos2000).
> >
> > After spending 4 days on that, I decided to split the compilation, I
> created a new task, name "bydir-javac". The task is derived from Javac.
> >
> > Can I publish this? Is it a better way of doing it?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: javac

Posted by Phil Weighill Smith <ph...@volantis.com>.
Why not simply put two calls to javac in your build script and split the
source tree in two in the same way that you have in your new task,
passing one tree to the first call and the other to the second?

Clearly you need to ensure that the first call compiles "pre-requisite"
code for the second call and that you should avoid cyclic references
between the two sets of classes.

Phil :n.

PS: I would consider re-structuring the application into "subsystems"
with separate source trees and separate build scripts per subsystem.
Dependencies between subsystems only on the class files (not the source
files). This is the approach we have taken to great effect.

On Tue, 2005-07-12 at 00:12 -0700, Jean Lazarou wrote:
> We had problem with a (legacy) build from scratch, seems that, because we have too many java files to compile, nothing is compiled (both on Linux and Windows2000). 
>  
> After spending 4 days on that, I decided to split the compilation, I created a new task, name "bydir-javac". The task is derived from Javac.
>  
> Can I publish this? Is it a better way of doing it?
>  
> Jean Lazarou
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org