mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Improve dependency checking
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11835 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6e5edd5259
commit
7d7324444c
2 changed files with 95 additions and 37 deletions
|
@ -4,6 +4,8 @@
|
||||||
* Source/NSUserDefaults.m: Ensure flags are initialised.
|
* Source/NSUserDefaults.m: Ensure flags are initialised.
|
||||||
* Source/GSCompatibility.m: Set GNUstep DTD for propertyLists.
|
* Source/GSCompatibility.m: Set GNUstep DTD for propertyLists.
|
||||||
* Tools/plist-0_9.dtd: GNUstep property list DTD.
|
* Tools/plist-0_9.dtd: GNUstep property list DTD.
|
||||||
|
* Source/autogsdoc.m: Improve dependency checking ... only regenerate
|
||||||
|
project index when necessary, thus avoiding some gsdoc file parsing.
|
||||||
|
|
||||||
Wed Dec 19 02:17:09 2001 Nicola Pero <n.pero@mi.flashnet.it>
|
Wed Dec 19 02:17:09 2001 Nicola Pero <n.pero@mi.flashnet.it>
|
||||||
|
|
||||||
|
|
|
@ -317,9 +317,13 @@ main(int argc, char **argv, char **env)
|
||||||
NSString *prev = nil;
|
NSString *prev = nil;
|
||||||
BOOL showDependencies = YES;
|
BOOL showDependencies = YES;
|
||||||
BOOL haveAutoIndex = NO;
|
BOOL haveAutoIndex = NO;
|
||||||
|
BOOL modifiedRefs = NO;
|
||||||
|
NSDate *rDate = nil;
|
||||||
CREATE_AUTORELEASE_POOL(outer);
|
CREATE_AUTORELEASE_POOL(outer);
|
||||||
CREATE_AUTORELEASE_POOL(pool);
|
CREATE_AUTORELEASE_POOL(pool);
|
||||||
|
|
||||||
|
RELEASE(pool);
|
||||||
|
|
||||||
#ifdef GS_PASS_ARGUMENTS
|
#ifdef GS_PASS_ARGUMENTS
|
||||||
[NSProcessInfo initializeWithArguments: argv count: argc environment: env];
|
[NSProcessInfo initializeWithArguments: argv count: argc environment: env];
|
||||||
#endif
|
#endif
|
||||||
|
@ -332,6 +336,7 @@ main(int argc, char **argv, char **env)
|
||||||
showDependencies = [defs boolForKey: @"ShowDependencies"];
|
showDependencies = [defs boolForKey: @"ShowDependencies"];
|
||||||
declared = [defs stringForKey: @"Declared"];
|
declared = [defs stringForKey: @"Declared"];
|
||||||
project = [defs stringForKey: @"Project"];
|
project = [defs stringForKey: @"Project"];
|
||||||
|
|
||||||
localProjects = [defs stringForKey: @"LocalProjects"];
|
localProjects = [defs stringForKey: @"LocalProjects"];
|
||||||
if (localProjects == nil)
|
if (localProjects == nil)
|
||||||
{
|
{
|
||||||
|
@ -363,6 +368,10 @@ main(int argc, char **argv, char **env)
|
||||||
documentationDirectory = @"";
|
documentationDirectory = @"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refsFile = [documentationDirectory stringByAppendingPathComponent: project];
|
||||||
|
refsFile = [refsFile stringByAppendingPathExtension: @"igsdoc"];
|
||||||
|
|
||||||
|
|
||||||
proc = [NSProcessInfo processInfo];
|
proc = [NSProcessInfo processInfo];
|
||||||
if (proc == nil)
|
if (proc == nil)
|
||||||
{
|
{
|
||||||
|
@ -377,11 +386,37 @@ main(int argc, char **argv, char **env)
|
||||||
parser = [AGSParser new];
|
parser = [AGSParser new];
|
||||||
output = [AGSOutput new];
|
output = [AGSOutput new];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load any old project indexing information.
|
||||||
|
*/
|
||||||
|
if ([mgr isReadableFileAtPath: refsFile] == YES)
|
||||||
|
{
|
||||||
|
NSDictionary *dict;
|
||||||
|
|
||||||
|
dict = [[NSDictionary alloc] initWithContentsOfFile: refsFile];
|
||||||
|
if (dict == nil)
|
||||||
|
{
|
||||||
|
NSLog(@"Unable to read project file '%@'", refsFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[prjRefs mergeRefs: dict override: NO];
|
||||||
|
RELEASE(dict);
|
||||||
|
dict = [mgr fileAttributesAtPath: refsFile traverseLink: YES];
|
||||||
|
rDate = [dict objectForKey: NSFileModificationDate];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (rDate == nil)
|
||||||
|
{
|
||||||
|
rDate = [NSDate distantPast];
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Merge any external project references into the
|
* Merge any external project references into the
|
||||||
* main cross reference index.
|
* main cross reference index.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
pool = [NSAutoreleasePool new];
|
||||||
if ([systemProjects caseInsensitiveCompare: @"None"] != NSOrderedSame)
|
if ([systemProjects caseInsensitiveCompare: @"None"] != NSOrderedSame)
|
||||||
{
|
{
|
||||||
NSString *base = [NSSearchPathForDirectoriesInDomains(
|
NSString *base = [NSSearchPathForDirectoriesInDomains(
|
||||||
|
@ -492,9 +527,10 @@ main(int argc, char **argv, char **env)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
RELEASE(pool);
|
||||||
|
|
||||||
|
pool = [NSAutoreleasePool new];
|
||||||
args = [proc arguments];
|
args = [proc arguments];
|
||||||
|
|
||||||
for (i = 1; i < [args count]; i++)
|
for (i = 1; i < [args count]; i++)
|
||||||
{
|
{
|
||||||
NSString *arg = [args objectAtIndex: i];
|
NSString *arg = [args objectAtIndex: i];
|
||||||
|
@ -720,6 +756,10 @@ main(int argc, char **argv, char **env)
|
||||||
{
|
{
|
||||||
NSLog(@"Sorry unable to write %@", gsdocfile);
|
NSLog(@"Sorry unable to write %@", gsdocfile);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gDate = [NSDate date]; // Just generated.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -735,43 +775,57 @@ main(int argc, char **argv, char **env)
|
||||||
gsdocfile = [gsdocfile stringByAppendingPathExtension:
|
gsdocfile = [gsdocfile stringByAppendingPathExtension:
|
||||||
@"gsdoc"];
|
@"gsdoc"];
|
||||||
}
|
}
|
||||||
|
attrs = [mgr fileAttributesAtPath: gsdocfile traverseLink: YES];
|
||||||
|
gDate = [attrs objectForKey: NSFileModificationDate];
|
||||||
|
AUTORELEASE(RETAIN(gDate));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now we try to process the gsdoc data to make index info.
|
* Now we try to process the gsdoc data to make index info
|
||||||
|
* unless the project index is already more up to date than
|
||||||
|
* this file.
|
||||||
*/
|
*/
|
||||||
if ([mgr isReadableFileAtPath: gsdocfile] == YES)
|
if ([gDate earlierDate: rDate] == rDate)
|
||||||
{
|
{
|
||||||
GSXMLParser *parser;
|
if (showDependencies == YES)
|
||||||
AGSIndex *locRefs;
|
|
||||||
|
|
||||||
parser = [GSXMLParser parserWithContentsOfFile: gsdocfile];
|
|
||||||
[parser substituteEntities: NO];
|
|
||||||
[parser doValidityChecking: YES];
|
|
||||||
[parser keepBlanks: NO];
|
|
||||||
if ([parser parse] == NO)
|
|
||||||
{
|
{
|
||||||
NSLog(@"WARNING %@ is not a valid document", gsdocfile);
|
NSLog(@"%@: gsdoc %@, index %@ ==> regenerate",
|
||||||
|
file, sDate, gDate);
|
||||||
}
|
}
|
||||||
if (![[[[parser doc] root] name] isEqualToString: @"gsdoc"])
|
if ([mgr isReadableFileAtPath: gsdocfile] == YES)
|
||||||
{
|
{
|
||||||
NSLog(@"not a gsdoc document - because name node is %@",
|
GSXMLParser *parser;
|
||||||
[[[parser doc] root] name]);
|
AGSIndex *locRefs;
|
||||||
return 1;
|
|
||||||
|
parser = [GSXMLParser parserWithContentsOfFile: gsdocfile];
|
||||||
|
[parser substituteEntities: NO];
|
||||||
|
[parser doValidityChecking: YES];
|
||||||
|
[parser keepBlanks: NO];
|
||||||
|
if ([parser parse] == NO)
|
||||||
|
{
|
||||||
|
NSLog(@"WARNING %@ is not a valid document", gsdocfile);
|
||||||
|
}
|
||||||
|
if (![[[[parser doc] root] name] isEqualToString: @"gsdoc"])
|
||||||
|
{
|
||||||
|
NSLog(@"not a gsdoc document - because name node is %@",
|
||||||
|
[[[parser doc] root] name]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
locRefs = AUTORELEASE([AGSIndex new]);
|
||||||
|
[locRefs makeRefs: [[parser doc] root]];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* accumulate index info in project references
|
||||||
|
*/
|
||||||
|
[prjRefs mergeRefs: [locRefs refs] override: NO];
|
||||||
|
modifiedRefs = YES;
|
||||||
|
}
|
||||||
|
else if (isDocumentation)
|
||||||
|
{
|
||||||
|
NSLog(@"No readable documentation at '%@' ... skipping",
|
||||||
|
gsdocfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
locRefs = AUTORELEASE([AGSIndex new]);
|
|
||||||
[locRefs makeRefs: [[parser doc] root]];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* accumulate index info in project references
|
|
||||||
*/
|
|
||||||
[prjRefs mergeRefs: [locRefs refs] override: NO];
|
|
||||||
}
|
|
||||||
else if (isDocumentation)
|
|
||||||
{
|
|
||||||
NSLog(@"No readable documentation at '%@' ... skipping",
|
|
||||||
gsdocfile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -779,12 +833,13 @@ main(int argc, char **argv, char **env)
|
||||||
NSLog(@"Unknown argument '%@' ... ignored", arg);
|
NSLog(@"Unknown argument '%@' ... ignored", arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Accumulate project index info into global index
|
* Accumulate project index info into global index
|
||||||
*/
|
*/
|
||||||
[indexer mergeRefs: [prjRefs refs] override: YES];
|
[indexer mergeRefs: [prjRefs refs] override: YES];
|
||||||
|
RELEASE(pool);
|
||||||
|
|
||||||
|
pool = [NSAutoreleasePool new];
|
||||||
for (i = (haveAutoIndex ? 0 : 1); i < [args count]; i++)
|
for (i = (haveAutoIndex ? 0 : 1); i < [args count]; i++)
|
||||||
{
|
{
|
||||||
NSString *arg;
|
NSString *arg;
|
||||||
|
@ -921,14 +976,15 @@ main(int argc, char **argv, char **env)
|
||||||
DESTROY(up);
|
DESTROY(up);
|
||||||
DESTROY(prev);
|
DESTROY(prev);
|
||||||
|
|
||||||
/*
|
if (modifiedRefs == YES)
|
||||||
* Save references.
|
|
||||||
*/
|
|
||||||
refsFile = [documentationDirectory stringByAppendingPathComponent: project];
|
|
||||||
refsFile = [refsFile stringByAppendingPathExtension: @"igsdoc"];
|
|
||||||
if ([[prjRefs refs] writeToFile: refsFile atomically: YES] == NO)
|
|
||||||
{
|
{
|
||||||
NSLog(@"Sorry unable to write %@", refsFile);
|
/*
|
||||||
|
* Save references.
|
||||||
|
*/
|
||||||
|
if ([[prjRefs refs] writeToFile: refsFile atomically: YES] == NO)
|
||||||
|
{
|
||||||
|
NSLog(@"Sorry unable to write %@", refsFile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RELEASE(outer);
|
RELEASE(outer);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue