ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tharp, Joshua L, SOLGV" <jlth...@att.com>
Subject RE: Automatic stub generation
Date Wed, 23 Apr 2003 17:19:05 GMT
I think it will re-rmic... Here's how it works. The javac task is run
before it gets to this target. The copy task copies any file it finds
with the ${rmi.gen.request.string} into the ${rmi.temp.dir}. Now, I only
want to rmic .class files that have corresponding .java files in the
temp directory, because those are the ones with the special source code
comment in them. So <rmic> selects the .class files in my build
directory that exist in their .java form in the temp directory. If the
original .java file changes, then the .class file is rebuilt by my javac
task. Following that, the rmic presumably does the dependency check
between the .class file and the _stub.class file. The timestamp on my
${rmic.temp.dir} files should remain irrelevant.

Josh

-----Original Message-----
From: Dominique Devienne [mailto:DDevienne@lgc.com] 
Sent: Wednesday, April 23, 2003 10:06 AM
To: 'Ant Users List'
Subject: RE: Automatic stub generation

Is this really going to re-rmic files that were changed??? I'm not too
sure... The .class are still there, so <present> is satisfied, but the
.class is older than the .java: not good! Plus there should be no need
for
the copy I think, but I could be wrong. --DD

-----Original Message-----
From: Tharp, Joshua L, SOLGV [mailto:jltharp@att.com] 
Sent: Wednesday, April 23, 2003 11:58 AM
To: Ant Users List
Subject: RE: Automatic stub generation

Thanks for the tip... I got it to work... Here's how (whole file not
included):

<target name="init">
    <mkdir dir="${rmic.temp.dir}" />
    <copy todir="${rmic.temp.dir}">
        <fileset dir="${src.dir}">
            <contains text="${rmi.gen.request.string}" />
        </fileset>
    </copy>

    <rmic base="${build.classes}" ...>
        <present targetdir="${rmic.temp.dir}">
            <mapper type="glob" from="*.class" to="*.java" />
        </present>
    </rmic>

    <delete dir="${rmic.temp.dir}" />
</target>

Josh

-----Original Message-----
From: Dominique Devienne [mailto:DDevienne@lgc.com] 
Sent: Wednesday, April 23, 2003 8:13 AM
To: 'Ant Users List'
Subject: RE: Automatic stub generation

Did you see the <present> selector. It compares files from one basedir,
to
another basedir provided in the selector only. You could do something
like
that. You can also use a marker interface, or static final in the class
file, thus don't need to check the sources, but your polluting your code
a
bit, so it's not pretty... It's up to you. --DD

-----Original Message-----
From: Tharp, Joshua L, SOLGV [mailto:jltharp@att.com] 
Sent: Wednesday, April 23, 2003 10:08 AM
To: Ant Users List
Subject: RE: Automatic stub generation

I figured out that I could put a selector in the <rmic> task because of
the statement from the rmic description page, "[t]his task forms an
implicit FileSet and supports all attributes of <fileset> (dir becomes
base) as well as the nested <include>, <exclude> and <patternset>
elements." I looked at FileSet to figure out that it takes a selector.
Here's where the problems really started though...

A selector that looks for a comment must work on the source, but <rmic>
works on the .class files. Unfortunately, what I was finding was that
the base attribute must specify the location to store the class files,
and I think it is also the implicit dir attribute for the fileset ("dir
becomes base," should read, "base becomes dir"). So, if I look for a
comment, it can't be found in the class file.

So how can I create a selector and then specify that what I really want
is the corresponding .class file? Do I need to define something outside
the <rmic> task and create some <patternset> or something that I can
reference from inside the <rmic> task?

Thanks,

Josh

-----Original Message-----
From: Dominique Devienne [mailto:DDevienne@lgc.com] 
Sent: Wednesday, April 23, 2003 7:50 AM
To: 'Ant Users List'
Subject: RE: Automatic stub generation

It's not documented in Ant 1.5.1 (the docs I'm looking at), but <rmic>,
since extending MatchingTask, which was made into a SelectorContainer,
thus
accepts selectors. One you have your selector working, then simply use
it
within <rmic>.

Because <rmic> doesn't accept a nested <fileset>, where it's obvious one
can
do <fileset refid="..." />, it's not evident it supports <fileset>,
right!
Plus that tasks now needs to document all these attributes of <fileset>
it
duplicates... Just one more example why composition is better than
inheritance in my book. --DD

-----Original Message-----
From: Tharp, Joshua L, SOLGV [mailto:jltharp@att.com] 
Sent: Tuesday, April 22, 2003 5:53 PM
To: user@ant.apache.org
Subject: Automatic stub generation

I've scanned the archives for my answer, but I haven't found a
satisfactory answer, so I'll pose the question myself...

I'm trying to automatically detect which files need to have RMI stubs
generated. I already have a comment in each file that requires
generation that I can search for. However, I haven't been able to figure
out how to use a combination of selectors, filesets, or whatever to
specify which files need RMI stubs generated. I did something similar to
this with make on Solaris with a little grep > temp.file routine. Then I
took the list of files from that routine and ran them through rmic
(after changing the *.java path names to qualified class names). This
worked really well. I can use a selector to find the files with the
comments using ant... but then what?

Any help here would be appreciated,

Josh

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


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

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


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

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


Mime
View raw message