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:
Richard Frith-Macdonald 2002-03-06 18:11:55 +00:00
parent 5ec35d168b
commit 2815a022bc
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>
* Source/Additions/GNUmakefile: build subproject.

View file

@ -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

View file

@ -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];
}
/**

View file

@ -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)
{