> -----Original Message-----
> From: Gavin [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 2 September 2008 11:28 AM
> To: [email protected]
> Subject: RE: Auto adding license headers
> 
> 
> 
> > -----Original Message-----
> > From: Ross Gardler [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, 2 September 2008 7:11 AM
> > To: [email protected]
> > Subject: Re: Auto adding license headers
> >
> > Gavin wrote:
> > > Hi All,
> > >
> > > I see that this has been addressed and committed (RAT-30), however I
> > must be
> > > doing something wrong as it does not work for me.
> >
> > Not necessarily - it might be you are the first person to actually do it
> > other than me ;-)
> >
> > I often fall foul of the fact that I run things from within Eclipse
> > which manages the classpath for you and sometimes I forget to test in
> > the command line. Let me see now... (using command line only)...
> >
> > > I only downloaded trunk today so bear with me, this is what I did
> after
> > the
> > > download of trunk.
> > >
> > > ant build (did not work)
> >
> > Yep, seems there is no build.xml - docs need updating
> >
> > > mvn install (aha now it does)
> >
> > Good, that's a start then, didn't work for me like that. I tried:
> >
> > cd rat-trunk/rat
> > mvn installed
> >
> > This failed due to a missing dependency on rat-core, so I had to:
> >
> > cd rat-trunk/rat/rat-core
> > mvn install
> >
> > > cd /project/to/test
> > > java -jar /path/to/rat-core/target/rat-core-0.6-SNAPSHOT.jar -a .
> 
> That should all be rat-app , not app-core.
> 
> > >
> > > The above does create filename.ext.new files but they are identical to
> > the
> > > old ones.
> >
> > Strange, the contribution does have tests with it [2]. The tests are run
> > on a "mvn install":
> >
> > Running org.apache.rat.annotation.TestLicenceAppender
> > Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047
> sec
> 
> Yep I get all tests pass also.
> 
> >
> > I've also tested this on my own application here and can't reproduce the
> > problem.
> 
> Well, in case it was my environment or a Windows thing, I installed rat
> and
> my source files to convert on my Ubuntu box and I get exactly the same
> results, that is I get .new files which are just copies of the originals.

Well, I now know what the problem is.

In the AbstractLicenseAppender.java file you have

if (type == TYPE_JAVA && line.startsWith("package "))

So, your looking to insert the License after the package line.
Your also assuming that all java files have a package line :)

None of my java files have package lines, I haven't got that far yet.

So, what's the solution, 2 choices I see :-

1. Do nothing (almost) - Document that a package line must exist and that
the license will be appended after that line. Therefore you are actively
forcing this limitation as an intentional design feature.

If this route is chosen then you should bail out without writing a .new file
if there is no package line, perhaps with a WARNING message appended to the
output. A .new file is currently written anyway because the file has already
been opened and written ("\n") to before that 'package' check above.

2. If no package line exists then put the license in anyway at the very top.

or something else.

Either way, I now need to go make some package name and add them in to my
project, then I can use the License appender as is.

Gav...

> 
> >
> > What is the extension of the files you are hoping to relicence? The
> > appender does not work on every file type. Currently supported filetypes
> > are:
> >
> > .java
> > .xml
> > .html
> > .js
> > .apt
> > .properties
> 
> Currently just .java files, there are other files there too, but RAT
> correctly ignores those and only copies the .java files.
> 
> >
> > There is patch against issue Rat-30 that adds .rdf but it has not yet
> > been applied to head.
> >
> > > I have not come across any docs that tell me what else I should be
> > doing, is
> > > the AL license embedded or does it need to refer to an existing one
> > > somewhere or ?
> >
> > The licence header is in [1] so it does not need to be added or managed
> > by the user.
> 
> excellent.
> 
> >
> > I note that the rat website has broken links and old docs for the
> > rat-core module. I assume you are reading the docs from source otherwise
> > the above was a pretty good guess (or perhaps the help option is
> > actually helpful?).
> 
> looking at source and yes the help was most useful, if an option is missed
> then help automatically comes up which is good.
> 
> I also tried the full path to the directory as well as just '.' with no
> difference in output. Copying the jar to the directory also makes no
> difference, just saying some of the things I tried.
> 
> >
> > Anyway, docs are pretty sparse aren't they? You're going to add this
> > stuff to the docs, right? (note there is a patch attached to issue
> > Rat-30 that has some extra docs, but nothing more useful to you)
> 
> Yes, very sparse, but at this stage and for the audience I guess it is
> better for those working on the program to concentrate on getting it
> working. Does anything work with this program; I can't even get an audit
> report from it?
> 
> Add to the docs, sure, when I get something working (ugh maven generated
> docs), but I think I should try get something working first when I get
> time.
> 
> If anyone can help debug what's wrong with what I'm doing I'll document it
> also in return.
> 
> Gav...
> 
> >
> > Ross
> >
> > [1]
> > http://svn.apache.org/repos/asf/incubator/rat/main/trunk/rat/rat-
> >
> core/src/main/java/org/apache/rat/annotation/ApacheV2LicenceAppender.java
> > [2]
> > http://svn.apache.org/repos/asf/incubator/rat/main/trunk/rat/rat-
> > core/src/test/java/org/apache/rat/annotation/TestLicenceAppender.java
> >
> >
> 
> 
> --
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.524 / Virus Database: 270.6.14/1645 - Release Date: 9/1/2008
> 7:19 AM

Reply via email to