Add Clean option

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14764 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-10-13 16:09:47 +00:00
parent 6b214cdf3c
commit 6c379173c5
3 changed files with 86 additions and 7 deletions

View file

@ -14,6 +14,7 @@
type specifications of the form (id<protocol1,protocol2,...>)
* Tools/autogsdoc.m: Add -Files option to read names of files
to process as a property list rather than using command line args.
Add -Clean flag to remove generated output files.
* Tools/AGSParser.m: Warn about private methods and ivars.
2002-10-12 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -1800,7 +1800,10 @@ fail:
name = [name stringByAppendingFormat: @"(%@)", category];
unitName = name;
[dict setObject: @"category" forKey: @"Type"];
if ([category caseInsensitiveCompare: @"Private"] == NSOrderedSame)
if ([category length] >= 7
&& [category compare: @"Private"
options: NSCaseInsensitiveSearch
range: NSMakeRange(0, 7)] == NSOrderedSame)
{
NSString *c;

View file

@ -216,6 +216,13 @@
supplied as command-line arguments as usual) -
</p>
<list>
<item><strong>Clean</strong>
If this boolean value is set to YES, then rather than generating
documentation, the tool removes all gsdoc files generated in the
project, and all html files generated from them (as well as any
which would be generated from gsdoc files listed explicitly),
and finally removes the project index file.
</item>
<item><strong>ConstantsTemplate</strong>
Specify the name of a template document into which documentation
about constants should be inserted from all files in the project.<br />
@ -626,12 +633,6 @@ main(int argc, char **argv, char **env)
}
}
if ([sFiles count] == 0 && [gFiles count] == 0 && [hFiles count] == 0)
{
NSLog(@"No filename arguments found ... giving up");
return 1;
}
mgr = [NSFileManager defaultManager];
/*
@ -662,6 +663,80 @@ main(int argc, char **argv, char **env)
}
}
if ([defs boolForKey: @"Clean"] == YES)
{
NSDictionary *output = [[projectRefs refs] objectForKey: @"output"];
NSEnumerator *enumerator = [output objectEnumerator];
NSArray *outputNames;
NSMutableSet *allPaths = [NSMutableSet new];
NSString *path;
/*
* Build a list of all generated gsdoc files, then remove them
* and their corresponding html documents.
*/
while ((outputNames = [enumerator nextObject]) != nil)
{
[allPaths addObjectsFromArray: outputNames];
}
enumerator = [allPaths objectEnumerator];
while ((path = [enumerator nextObject]) != nil)
{
if ([mgr fileExistsAtPath: path] == YES)
{
if ([mgr removeFileAtPath: path handler: nil] == NO)
{
NSLog(@"Cleaning ... failed to remove %@", path);
}
}
path = [path stringByDeletingPathExtension];
path = [path stringByAppendingPathExtension: @"html"];
if ([mgr fileExistsAtPath: path] == YES)
{
if ([mgr removeFileAtPath: path handler: nil] == NO)
{
NSLog(@"Cleaning ... failed to remove %@", path);
}
}
}
RELEASE(allPaths);
/*
* Remove the project index file.
*/
if ([mgr removeFileAtPath: refsFile handler: nil] == NO)
{
NSLog(@"Cleaning ... failed to remove %@", refsFile);
}
/*
* Remove any HTML documents resulting from gsdoc files which
* were specified on the command line rather than generated.
*/
enumerator = [gFiles objectEnumerator];
while ((path = [enumerator nextObject]) != nil)
{
path = [documentationDirectory
stringByAppendingPathComponent: path];
path = [path stringByDeletingPathExtension];
path = [path stringByAppendingPathExtension: @"html"];
if ([mgr fileExistsAtPath: path] == YES)
{
if ([mgr removeFileAtPath: path handler: nil] == NO)
{
NSLog(@"Cleaning ... failed to remove %@", path);
}
}
}
return 0;
}
if ([sFiles count] == 0 && [gFiles count] == 0 && [hFiles count] == 0)
{
NSLog(@"No filename arguments found ... giving up");
return 1;
}
count = [sFiles count];
if (count > 0)
{