本文整理汇总了C#中FileSet.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# FileSet.Initialize方法的具体用法?C# FileSet.Initialize怎么用?C# FileSet.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSet
的用法示例。
在下文中一共展示了FileSet.Initialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeVcprojs
void MergeVcprojs()
{
foreach(object package in _packages.Keys)
{
EAPackage eapkg = (EAPackage) _packages[package];
if(eapkg.slnTarget != null) // rwconfig1.x package found, we need to merge all vcprojs generated by 'generate-sln-all'.
{
string pkgBuildDir = Project.Properties["package." + eapkg.pkgName + ".builddir"];
string modulesToMerge = "";
foreach(string vcprojFile in Directory.GetFiles(pkgBuildDir + Path.DirectorySeparatorChar, "*.vcproj"))
{
modulesToMerge = CombineStrings(modulesToMerge, Path.GetFileNameWithoutExtension(vcprojFile));
}
foreach(string module in NantToVSTools.TrimAndSplit(modulesToMerge))
{
if(module == String.Empty)
continue;
string applicableConfigs = "";
foreach(string configdir in Directory.GetDirectories(pkgBuildDir + Path.DirectorySeparatorChar))
{
string tempconfigdir = configdir.Replace("\\", Path.DirectorySeparatorChar.ToString());
tempconfigdir = configdir.Replace("/", Path.DirectorySeparatorChar.ToString());
string configdirname = tempconfigdir.Replace(Path.GetDirectoryName(configdir) + Path.DirectorySeparatorChar, "");
if(ListContainsString(Project.Properties["package.configs"], configdirname))
{
if(File.Exists(configdir + Path.DirectorySeparatorChar + "build" + Path.DirectorySeparatorChar + module + ".vcproj"))
applicableConfigs = CombineStrings(applicableConfigs, configdirname);
}
}
if(applicableConfigs != "")
{
FileSet fs = new FileSet();
fs.Project = Project;
XmlElement fileset = _xmlDoc.CreateElement("fileset");
fileset.SetAttribute("name", module + "-input-vcproj-files");
foreach (string config in NantToVSTools.TrimAndSplit(applicableConfigs))
{
string vcprojfilename = Project.Properties["package." + eapkg.pkgName + ".builddir"] + Path.DirectorySeparatorChar + config + Path.DirectorySeparatorChar
+ "build" + Path.DirectorySeparatorChar + module + ".vcproj";
if (File.Exists(vcprojfilename))
{
XmlElement includes = _xmlDoc.CreateElement("includes");
includes.SetAttribute("name", vcprojfilename);
fileset.AppendChild(includes);
}
}
fs.Initialize(fileset);
MergeMyVcproj mmvcproj = new MergeMyVcproj();
mmvcproj.Output = Project.Properties["package." + eapkg.pkgName + ".builddir"] + Path.DirectorySeparatorChar + module + ".vcproj";
mmvcproj.Project = Project;
mmvcproj.Inputs = fs;
mmvcproj.Execute();
}
}
}
else
{
// merge vcproj for each group modules
foreach(string grp in eapkg.groupModules.Keys)
{
foreach(string mod in ((Hashtable) eapkg.groupModules[grp]).Keys)
{
FileSet fs = new FileSet();
fs.Project = Project;
XmlElement fileset = _xmlDoc.CreateElement("fileset");
fileset.SetAttribute("name", mod + "-input-vcproj-files");
string modulegroup = "";
if(grp != "runtime")
modulegroup = Path.DirectorySeparatorChar + grp;
foreach (string config in NantToVSTools.TrimAndSplit((string)((Hashtable)eapkg.groupModules[grp])[mod]))
{
string vcprojfilename = Project.Properties["package." + eapkg.pkgName + ".builddir." + config] + Path.DirectorySeparatorChar + config + Path.DirectorySeparatorChar
+ "build" + modulegroup + Path.DirectorySeparatorChar + mod + ".vcproj";
if (File.Exists(vcprojfilename))
{
XmlElement includes = _xmlDoc.CreateElement("includes");
includes.SetAttribute("name", vcprojfilename);
fileset.AppendChild(includes);
}
}
fs.Initialize(fileset);
MergeMyVcproj mmvcproj = new MergeMyVcproj();
mmvcproj.Output = Project.Properties["package." + eapkg.pkgName + ".builddir"] + Path.DirectorySeparatorChar + mod + ".vcproj";
mmvcproj.Project = Project;
mmvcproj.Inputs = fs;
mmvcproj.Execute();
}
}
}
}
}
示例2: ExecuteTask
protected override void ExecuteTask()
{
if(! IsPackageCompatibleWithSlnGenerator())
{
throw new BuildException("ERROR: This package does not support automated SLN generation. Please call 'generate-sln' or set the property 'rwconfig.enableslngeneration' to true !");
}
ValidatePackageConfigs();
System.DateTime dt1 = System.DateTime.Now;
string packageConfigs = ReOrderPackageConfigs();
string packageBuildDir = Project.Properties["package.builddir"];
string packageName = Project.Properties["package.name"];
originalPackageConfigs = Project.Properties["package.configs"];
InitializeGlobalVariables();
if(Project.Properties.Contains("generate-single-config"))
{
packageConfigs = Project.Properties["config"];
Project.Properties.UpdateReadOnly("package.configs", packageConfigs);
}
foreach(string config in NantToVSTools.TrimAndSplit(packageConfigs))
{
if(config == string.Empty)
continue;
if(PackageList != "")
{
foreach(string pkgname in NantToVSTools.TrimAndSplit(PackageList))
{
AddPackageProperties(pkgname);
FindBuildDependencies(pkgname, config, packageConfigs, Group, true, false, null);
}
}
else
{
FindBuildDependencies(packageName, config, packageConfigs, Group, true, false, null);
}
// instantiate one fileset for each package (input to slnmerger)
if(generateCompleteSlnsForAllPackages || PackageList != "")
{
foreach(object package in _packages.Keys)
{
EAPackage eap = (EAPackage) _packages[package];
if (!_filesets.Contains(eap.pkgName))
{
XmlElement filesetElement = _xmlDoc.CreateElement("fileset");
filesetElement.SetAttribute("name", "sln_fileset_" + eap.pkgName);
_filesets[eap.pkgName] = filesetElement;
}
}
}
else
{
if (!_filesets.Contains(packageName))
{
XmlElement filesetElement = _xmlDoc.CreateElement("fileset");
filesetElement.SetAttribute("name", "sln_fileset_" + packageName);
_filesets[packageName] = filesetElement;
}
}
// first execuate all packages using old rwconfigs
foreach(object package in _packages.Keys)
{
EAPackage eap = (EAPackage) _packages[package];
if(eap.slnTarget != null)
{
Project proj = (Project) _projects[eap.pkgName + "_" + config];
if(proj == null)
continue;
proj.Properties["package.nantToVSTools.slnmaker.default.output"] = proj.Properties["package.builddir"] + Path.DirectorySeparatorChar
+ proj.Properties["config"] + Path.DirectorySeparatorChar
+ eap.pkgName + ".sln";
if(ProjectTargetFind(proj, eap.slnTarget) != null)
{
ProjectTargetFind(proj, eap.slnTarget).Copy().Execute();
AddSlnToFileSets(eap.pkgName, "runtime", proj.Properties["package.builddir"] + Path.DirectorySeparatorChar
+ proj.Properties["config"] + Path.DirectorySeparatorChar
+ eap.pkgName + ".sln");
}
else
{
throw new BuildException(eap.pkgName + ": target " + eap.slnTarget + " is missing!");
}
_projects[eap.pkgName + "_" + config] = null;
proj.Dispose();
proj = null;
// This is to tell slnmaker to treat rwconfig1.x packages differently because
// the generated vcproj files break the one-config-at-a-time SLN generation semantics
_properties[eap.pkgName + ".is-using-rwconfig1x." + config] = "";
}
}
PopulateProjectReferences(config);
/// START: TO BE REMOVED for backwards compatibility with customized slngroup-slnmaker.
//.........这里部分代码省略.........
示例3: MergeSolutions
string MergeSolutions(string packagename, string packagebuilddir, bool toplevel)
{
try
{
SlnMerger slnMergerTask = new SlnMerger(Project);
FileSet fs = new FileSet();
fs.Project = Project;
fs.Initialize((XmlElement)_filesets[packagename]);
slnMergerTask.Inputs = fs;
if(Project.Properties.Contains("generate-single-config"))
{
slnMergerTask.Output = packagebuilddir + Path.DirectorySeparatorChar + Project.Properties["config"] + Path.DirectorySeparatorChar + packagename + ".sln";
}
else if(Group == "all" || Group == "allall" || Group == "runtime")
{
slnMergerTask.Output = packagebuilddir + Path.DirectorySeparatorChar + packagename + ".sln";
}
else
{
if(toplevel)
{
slnMergerTask.Output = packagebuilddir + Path.DirectorySeparatorChar + packagename + "-" + Group + ".sln";
}
else
{
slnMergerTask.Output = packagebuilddir + Path.DirectorySeparatorChar + packagename + ".sln";
}
}
slnMergerTask.ExecuteSlnMergerTask();
return slnMergerTask.Output;
}
catch(BuildException be)
{
throw new BuildException(be.ToString());
}
}