Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > dependency scanner

Reply
Thread Tools

dependency scanner

 
 
Aryeh M. Friedman
Guest
Posts: n/a
 
      05-11-2008
I am looking for a class/program that will scan a .java file for imports
(recursively) to discover which ones need to be rebuilt. This is
close to GNU's makedepend or cook's c_incl.
 
Reply With Quote
 
 
 
 
Stefan Ram
Guest
Posts: n/a
 
      05-11-2008
"Aryeh M. Friedman" <> writes:
>I am looking for a class/program that will scan a .java file for imports
> (recursively) to discover which ones need to be rebuilt. This is
>close to GNU's makedepend or cook's c_incl.


You might try to trace the classes loaded by the JVM.

http://www.md.pp.ru/~eu/jdk6options....oadingPreorder
http://www.md.pp.ru/~eu/jdk6options....ceClassLoading

 
Reply With Quote
 
 
 
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-11-2008
Aryeh M. Friedman wrote:
> I am looking for a class/program that will scan a .java file for imports
> (recursively) to discover which ones need to be rebuilt. This is close
> to GNU's makedepend or cook's c_incl.


You don't use that type of tools with Java.

The javac compiler itself compiles missing parts.

And the ant tool (which you should use for build) checks what to
rebuild based on dates similar to ant.

Just use ant and javac and forget about dependencies.

If you use maven for build it will even be able to download
external packages you need for you.

Arne
 
Reply With Quote
 
Mike Schilling
Guest
Posts: n/a
 
      05-11-2008
Arne Vajhøj wrote:
> Aryeh M. Friedman wrote:
>> I am looking for a class/program that will scan a .java file for
>> imports (recursively) to discover which ones need to be rebuilt.
>> This is close to GNU's makedepend or cook's c_incl.

>
> You don't use that type of tools with Java.
>
> The javac compiler itself compiles missing parts.
>
> And the ant tool (which you should use for build) checks what to
> rebuild based on dates similar to ant.
>
> Just use ant and javac and forget about dependencies.


And when that's not good enough (like when superclass change, require
subclasses to recompile too), curse a bit, delete all the .class
files, and rebuild the whole thing.


 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-11-2008
Mike Schilling wrote:
> Arne Vajhøj wrote:
>> Aryeh M. Friedman wrote:
>>> I am looking for a class/program that will scan a .java file for
>>> imports (recursively) to discover which ones need to be rebuilt.
>>> This is close to GNU's makedepend or cook's c_incl.

>> You don't use that type of tools with Java.
>>
>> The javac compiler itself compiles missing parts.
>>
>> And the ant tool (which you should use for build) checks what to
>> rebuild based on dates similar to ant.
>>
>> Just use ant and javac and forget about dependencies.

>
> And when that's not good enough (like when superclass change, require
> subclasses to recompile too), curse a bit, delete all the .class
> files, and rebuild the whole thing.


Many people make a clean target in build.xml !

Arne
 
Reply With Quote
 
jolz
Guest
Posts: n/a
 
      05-11-2008
> The javac compiler itself compiles missing parts.
>
> And the ant tool (which you should use for build) checks what to
> rebuild based on dates similar to ant.
>
> Just use ant and javac and forget about dependencies.


Compiling based on dates isn't enough. The most anoying problem (but not
the only one) during compilation is inlining constants. The only way to
be 100% sure of proper compilation is to allways recompile all sources.
Fortunatelly recompilation based on dates works often enought to make
ant/maven quite usefull tools.
 
Reply With Quote
 
Mike Schilling
Guest
Posts: n/a
 
      05-11-2008
Arne Vajhøj wrote:
> Mike Schilling wrote:
>> Arne Vajhøj wrote:
>>> Aryeh M. Friedman wrote:
>>>> I am looking for a class/program that will scan a .java file for
>>>> imports (recursively) to discover which ones need to be rebuilt.
>>>> This is close to GNU's makedepend or cook's c_incl.
>>> You don't use that type of tools with Java.
>>>
>>> The javac compiler itself compiles missing parts.
>>>
>>> And the ant tool (which you should use for build) checks what to
>>> rebuild based on dates similar to ant.
>>>
>>> Just use ant and javac and forget about dependencies.

>>
>> And when that's not good enough (like when superclass change,
>> require
>> subclasses to recompile too), curse a bit, delete all the .class
>> files, and rebuild the whole thing.

>
> Many people make a clean target in build.xml !


I always do, for several reasons; the above is one of them. My
comment was a complaint about the fact that the <javac> task is
*almost* good enough to handle dependencies, but not quite. When I,
for instance, get a batch of newer source code from the SCM system, I
always do a clean build, since there's no way to be sure it isn't
necessary, and I don't want to waste time with spurious problems from
not building clean when it was required.


 
Reply With Quote
 
jolz
Guest
Posts: n/a
 
      05-11-2008
> I am looking for a class/program that will scan a .java file for imports
> (recursively) to discover which ones need to be rebuilt. This is close
> to GNU's makedepend or cook's c_incl.


You didn't consider import x.y.* and classes in the same package. You'll
have to parse the whole source to do this properly (the most popular
tool is javacc) - it may not be much faster that simply recompiling
those sources.
 
Reply With Quote
 
Mike Schilling
Guest
Posts: n/a
 
      05-11-2008
jolz wrote:
>> I am looking for a class/program that will scan a .java file for
>> imports (recursively) to discover which ones need to be rebuilt.
>> This is close to GNU's makedepend or cook's c_incl.

>
> You didn't consider import x.y.* and classes in the same package.


And the use of fully qualified named with no import.


 
Reply With Quote
 
Arne Vajhøj
Guest
Posts: n/a
 
      05-11-2008
Mike Schilling wrote:
> Arne Vajhøj wrote:
>> Mike Schilling wrote:
>>> Arne Vajhøj wrote:
>>>> Aryeh M. Friedman wrote:
>>>>> I am looking for a class/program that will scan a .java file for
>>>>> imports (recursively) to discover which ones need to be rebuilt.
>>>>> This is close to GNU's makedepend or cook's c_incl.
>>>> You don't use that type of tools with Java.
>>>>
>>>> The javac compiler itself compiles missing parts.
>>>>
>>>> And the ant tool (which you should use for build) checks what to
>>>> rebuild based on dates similar to ant.
>>>>
>>>> Just use ant and javac and forget about dependencies.
>>> And when that's not good enough (like when superclass change,
>>> require
>>> subclasses to recompile too), curse a bit, delete all the .class
>>> files, and rebuild the whole thing.

>> Many people make a clean target in build.xml !

>
> I always do, for several reasons; the above is one of them. My
> comment was a complaint about the fact that the <javac> task is
> *almost* good enough to handle dependencies, but not quite. When I,
> for instance, get a batch of newer source code from the SCM system, I
> always do a clean build, since there's no way to be sure it isn't
> necessary, and I don't want to waste time with spurious problems from
> not building clean when it was required.


And usually Java builds are reasonable fast even when building from
scratch.

Arne
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Flat Bed Scanner + Enlarger = Film Scanner? G. Huang Digital Photography 10 08-07-2011 03:46 PM
ModelSim - vcom dependency order andyesquire@hotmail.com VHDL 17 04-06-2005 06:08 PM
epson (or others) flat bed scanner vs film scanner Albert Ma Digital Photography 1 10-30-2004 02:39 AM
Cache dependency on database select statement martin ASP .Net 1 10-18-2003 04:33 AM
Help untaining the command. Insecure dependency in `` ... setuid danpres2k Perl 0 08-13-2003 03:21 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57