From d44bc0a85dfbb94ff3528c5b21d5b5c1d326d671 Mon Sep 17 00:00:00 2001 From: CaS Date: Wed, 6 Mar 2002 18:11:55 +0000 Subject: [PATCH] Dependency handling improvement git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13028 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++ Tools/AGSIndex.h | 2 ++ Tools/AGSIndex.m | 4 +-- Tools/autogsdoc.m | 73 +++++++++++++++++++++++++---------------------- 4 files changed, 49 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3cd0f84b6..aa93d07e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-03-06 Richard Frith-Macdonald + + * 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 * Source/Additions/GNUmakefile: build subproject. diff --git a/Tools/AGSIndex.h b/Tools/AGSIndex.h index 4d0e8d66a..5a7f198bf 100644 --- a/Tools/AGSIndex.h +++ b/Tools/AGSIndex.h @@ -44,7 +44,9 @@ - (void) setDirectory: (NSString*)path; - (void) setGlobalRef: (NSString*)ref type: (NSString*)type; - (void) setRelationship: (NSString*)r from: (NSString*)from to: (NSString*)to; +- (void) setSources: (NSArray*)a forHeader: (NSString*)h; - (void) setUnitRef: (NSString*)ref type: (NSString*)type; +- (NSArray*) sourcesForHeader: (NSString*)h; - (NSDictionary*) unitRef: (NSString*)ref type: (NSString*)type; - (NSString*) unitRef: (NSString*)ref type: (NSString*)type unit: (NSString**)u; @end diff --git a/Tools/AGSIndex.m b/Tools/AGSIndex.m index 3a267ee27..a30035b41 100644 --- a/Tools/AGSIndex.m +++ b/Tools/AGSIndex.m @@ -520,7 +520,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path) /** * 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; @@ -531,7 +531,7 @@ setDirectory(NSMutableDictionary *dict, NSString *path) [refs setObject: dict forKey: @"source"]; RELEASE(dict); } - [dict setObject: s forKey: h]; + [dict setObject: a forKey: h]; } /** diff --git a/Tools/autogsdoc.m b/Tools/autogsdoc.m index a7fe7f812..fb763e796 100644 --- a/Tools/autogsdoc.m +++ b/Tools/autogsdoc.m @@ -482,6 +482,34 @@ main(int argc, char **argv, char **env) 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]; if (count > 0) { @@ -563,13 +591,10 @@ main(int argc, char **argv, char **env) AUTORELEASE(RETAIN(sDate)); } /* - * FIXME work out dependencies for .m files. - * for the moment, hack in an assumption that the .h simply - * depends on the corresponding .m + * Ask existing project info (.gsdoc file) for dependency + * information. Then check the dates on the source files. */ - a = [NSArray arrayWithObject: - [[[hfile lastPathComponent] stringByDeletingPathExtension] - stringByAppendingPathExtension: @"m"]]; + a = [projectRefs sourcesForHeader: hfile]; for (i = 0; i < [a count]; i++) { NSString *sfile = [a objectAtIndex: i]; @@ -619,6 +644,14 @@ main(int argc, char **argv, char **env) [parser parseFile: hfile isSource: NO]; a = [parser source]; + /* + * Record dependency information. + */ + if ([a count] > 0) + { + [projectRefs setSources: a forHeader: hfile]; + } + for (i = 0; i < [a count]; i++) { NSString *sfile = [a objectAtIndex: i]; @@ -688,34 +721,6 @@ main(int argc, char **argv, char **env) 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]; if (count > 0) {