Dependency handling improvement

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13028 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-03-06 18:11:55 +00:00
parent d533f8ae5f
commit d44bc0a85d
4 changed files with 49 additions and 36 deletions

View file

@ -1,3 +1,9 @@
2002-03-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/autogsdoc.m: store and fetch dependency info in .igsdoc
so we can parse the correct source files for each header when we
need to.
2002-03-06 Richard Frith-Macdonald <rfm@gnu.org> 2002-03-06 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/GNUmakefile: build subproject. * Source/Additions/GNUmakefile: build subproject.

View file

@ -44,7 +44,9 @@
- (void) setDirectory: (NSString*)path; - (void) setDirectory: (NSString*)path;
- (void) setGlobalRef: (NSString*)ref type: (NSString*)type; - (void) setGlobalRef: (NSString*)ref type: (NSString*)type;
- (void) setRelationship: (NSString*)r from: (NSString*)from to: (NSString*)to; - (void) setRelationship: (NSString*)r from: (NSString*)from to: (NSString*)to;
- (void) setSources: (NSArray*)a forHeader: (NSString*)h;
- (void) setUnitRef: (NSString*)ref type: (NSString*)type; - (void) setUnitRef: (NSString*)ref type: (NSString*)type;
- (NSArray*) sourcesForHeader: (NSString*)h;
- (NSDictionary*) unitRef: (NSString*)ref type: (NSString*)type; - (NSDictionary*) unitRef: (NSString*)ref type: (NSString*)type;
- (NSString*) unitRef: (NSString*)ref type: (NSString*)type unit: (NSString**)u; - (NSString*) unitRef: (NSString*)ref type: (NSString*)type unit: (NSString**)u;
@end @end

View file

@ -520,7 +520,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
/** /**
* Set up an array listing the source files for a particular header. * Set up an array listing the source files for a particular header.
*/ */
- (void) setSource: (NSArray*)s forHeader: (NSString*)h - (void) setSources: (NSArray*)a forHeader: (NSString*)h
{ {
NSMutableDictionary *dict; NSMutableDictionary *dict;
@ -531,7 +531,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path)
[refs setObject: dict forKey: @"source"]; [refs setObject: dict forKey: @"source"];
RELEASE(dict); RELEASE(dict);
} }
[dict setObject: s forKey: h]; [dict setObject: a forKey: h];
} }
/** /**

View file

@ -482,6 +482,34 @@ main(int argc, char **argv, char **env)
mgr = [NSFileManager defaultManager]; mgr = [NSFileManager defaultManager];
/*
* Load any old project indexing information and determine when the
* indexing information was last updated (never ==> distant past)
*/
refsFile = [documentationDirectory
stringByAppendingPathComponent: project];
refsFile = [refsFile stringByAppendingPathExtension: @"igsdoc"];
projectRefs = [AGSIndex new];
originalIndex = nil;
rDate = [NSDate distantPast];
if ([mgr isReadableFileAtPath: refsFile] == YES)
{
originalIndex
= [[NSDictionary alloc] initWithContentsOfFile: refsFile];
if (originalIndex == nil)
{
NSLog(@"Unable to read project file '%@'", refsFile);
}
else
{
NSDictionary *dict;
[projectRefs mergeRefs: originalIndex override: NO];
dict = [mgr fileAttributesAtPath: refsFile traverseLink: YES];
rDate = [dict objectForKey: NSFileModificationDate];
}
}
count = [sFiles count]; count = [sFiles count];
if (count > 0) if (count > 0)
{ {
@ -563,13 +591,10 @@ main(int argc, char **argv, char **env)
AUTORELEASE(RETAIN(sDate)); AUTORELEASE(RETAIN(sDate));
} }
/* /*
* FIXME work out dependencies for .m files. * Ask existing project info (.gsdoc file) for dependency
* for the moment, hack in an assumption that the .h simply * information. Then check the dates on the source files.
* depends on the corresponding .m
*/ */
a = [NSArray arrayWithObject: a = [projectRefs sourcesForHeader: hfile];
[[[hfile lastPathComponent] stringByDeletingPathExtension]
stringByAppendingPathExtension: @"m"]];
for (i = 0; i < [a count]; i++) for (i = 0; i < [a count]; i++)
{ {
NSString *sfile = [a objectAtIndex: i]; NSString *sfile = [a objectAtIndex: i];
@ -619,6 +644,14 @@ main(int argc, char **argv, char **env)
[parser parseFile: hfile isSource: NO]; [parser parseFile: hfile isSource: NO];
a = [parser source]; a = [parser source];
/*
* Record dependency information.
*/
if ([a count] > 0)
{
[projectRefs setSources: a forHeader: hfile];
}
for (i = 0; i < [a count]; i++) for (i = 0; i < [a count]; i++)
{ {
NSString *sfile = [a objectAtIndex: i]; NSString *sfile = [a objectAtIndex: i];
@ -688,34 +721,6 @@ main(int argc, char **argv, char **env)
DESTROY(output); DESTROY(output);
} }
/*
* Load any old project indexing information and determine when the
* indexing information was last updated (never ==> distant past)
*/
refsFile = [documentationDirectory
stringByAppendingPathComponent: project];
refsFile = [refsFile stringByAppendingPathExtension: @"igsdoc"];
projectRefs = [AGSIndex new];
originalIndex = nil;
rDate = [NSDate distantPast];
if ([mgr isReadableFileAtPath: refsFile] == YES)
{
originalIndex
= [[NSDictionary alloc] initWithContentsOfFile: refsFile];
if (originalIndex == nil)
{
NSLog(@"Unable to read project file '%@'", refsFile);
}
else
{
NSDictionary *dict;
[projectRefs mergeRefs: originalIndex override: NO];
dict = [mgr fileAttributesAtPath: refsFile traverseLink: YES];
rDate = [dict objectForKey: NSFileModificationDate];
}
}
count = [gFiles count]; count = [gFiles count];
if (count > 0) if (count > 0)
{ {