Skip to content

Commit

Permalink
GenerateDocumentation property, which generates xml documentation nam…
Browse files Browse the repository at this point in the history
…ed based on project name.

NAnt cant pass dynamic expressions into MSBuild nor can evaluate expression for every project again.
For fixed named xml documentation file DocumentationFile property can be used directly.
  • Loading branch information
maliger committed Dec 5, 2011
1 parent b68af3b commit eb32492
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/NAnt.MSBuild/MSBuildProject.cs
Expand Up @@ -93,6 +93,7 @@ public MSBuildProject(SolutionBase solution, string projectPath, XmlElement xmlD
_msproj.GlobalProperties.SetProperty("OutputPath", outputDir.FullName);
}

bool generateDoc = false;
//bool targwarnings = true;
foreach (NAnt.Core.Tasks.PropertyTask property in solutionTask.CustomProperties) {
string val;
Expand All @@ -102,8 +103,17 @@ public MSBuildProject(SolutionBase solution, string projectPath, XmlElement xmlD
} else {
val = property.Value;
}
_msproj.GlobalProperties.SetProperty(property.PropertyName, val);
//if (property.PropertyName == "TargetWarnings") targwarnings = Boolean.Parse(val);
switch (property.PropertyName)
{
//if (property.PropertyName == "TargetWarnings") targwarnings = Boolean.Parse(val);
case "GenerateDocumentation":
generateDoc = Boolean.Parse(val);
break;
default:
_msproj.GlobalProperties.SetProperty(property.PropertyName, val);
break;
}

}


Expand Down Expand Up @@ -172,6 +182,20 @@ public MSBuildProject(SolutionBase solution, string projectPath, XmlElement xmlD
pguid, pname, rpath, priv);
_references.Add(reference);
}

if(generateDoc) {
string xmlDocBuildFile = FileUtils.CombinePaths(OutputPath, this.Name + ".xml");

//// make sure the output directory for the doc file exists
//if (!Directory.Exists(Path.GetDirectoryName(xmlDocBuildFile))) {
// Directory.CreateDirectory(Path.GetDirectoryName(xmlDocBuildFile));
//}

// add built documentation file as extra output file
ExtraOutputFiles[xmlDocBuildFile] = Path.GetFileName(xmlDocBuildFile);

_msproj.GlobalProperties.SetProperty("DocumentationFile", xmlDocBuildFile);
}
}

internal string OutputPath {
Expand Down

0 comments on commit eb32492

Please sign in to comment.