public void Dispose() { if (NugetPackage != null) { NugetPackage.Dispose(); NugetPackage = null; } _sheet = null; }
public PackageScript(string filename) { Event <Verbose> .Raise("PackageScript", "Constructor"); _sheet = new RootPropertySheet(this); // get the full path to the .autopkgFile FullPath = filename.GetFullPath(); // parse the script _sheet.ParseFile(filename); _sheet.ImportText(_requiredTemplate, "required"); // temp hack to work around static & ltcg getting marked as used when they are just in the template. var scriptText = File.ReadAllText(filename); if (scriptText.IndexOf("static", StringComparison.InvariantCultureIgnoreCase) > -1) { _sheet.ImportText(_requiredTemplateStatic, "required_static"); } // end hack if (scriptText.IndexOf("ltcg", StringComparison.InvariantCultureIgnoreCase) > -1) { _sheet.ImportText(_requiredTemplateLTCG, "required_ltcg"); } // ensure we have at least the package ID var packageName = _sheet.View.nuget.nuspec.id; if (string.IsNullOrEmpty(packageName)) { throw new ClrPlusException("the Field nuget.nuspec.id can not be null or empty. You must specify an id for a package."); } // set the package name macro _sheet.AddMacro("pkgname", packageName); _sheet.CurrentView.AddMacroHandler((name, context) => _macros.ContainsKey(name.ToLower()) ? _macros[name.ToLower()] : null); _sheet.CurrentView.AddMacroHandler((name, context) => System.Environment.GetEnvironmentVariable(name)); Pivots = new Pivots(_sheet.CurrentView.GetProperty("configurations")); }
public PackageScript(string filename) { SplitThreshold = 1024*1024*20; // 20 megabytes default Event<Verbose>.Raise("PackageScript", "Constructor"); _sheet = new RootPropertySheet(this); // get the full path to the .autopkgFile FullPath = filename.GetFullPath(); // parse the script _sheet.ParseFile(filename); _sheet.ImportText(_requiredTemplate, "required"); // temp hack to work around static & ltcg getting marked as used when they are just in the template. var scriptText = File.ReadAllText(filename); if (scriptText.IndexOf("static", StringComparison.InvariantCultureIgnoreCase) > -1) { _sheet.ImportText(_requiredTemplateStatic, "required_static"); } // end hack if (scriptText.IndexOf("ltcg", StringComparison.InvariantCultureIgnoreCase) > -1) { _sheet.ImportText(_requiredTemplateLTCG, "required_ltcg"); } // ensure we have at least the package ID var packageName = _sheet.View.nuget.nuspec.id; if (string.IsNullOrEmpty(packageName)) { throw new ClrPlusException("the Field nuget.nuspec.id can not be null or empty. You must specify an id for a package."); } // set the package name macro _sheet.AddMacro("pkgname", packageName); _sheet.CurrentView.AddMacroHandler( (name, context) => _macros.ContainsKey(name.ToLower()) ? _macros[name.ToLower()] : null); _sheet.CurrentView.AddMacroHandler((name, context) => System.Environment.GetEnvironmentVariable(name)); Pivots = new Pivots(_sheet.CurrentView.GetProperty("configurations")); }
public BuildScript(string filename) { try { Filename = filename.GetFullPath(); _project = new ProjectPlus(this, Filename + ".msbuild"); _project.Xml.AddImport(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "etc", "MSBuild.ExtensionPack.tasks")); _sheet = new RootPropertySheet(_project); _sheet.ParseFile(Filename); _pivots = new Pivots(_sheet.View.configurations); _sheet.AddChildRoutes(_project.MemberRoutes); // _sheet.AddChildRoutesForType(typeof (ProjectTargetElement), _project.TargetRoutes); _sheet.CurrentView.AddMacroHandler((name, context) => _macros.ContainsKey(name.ToLower()) ? _macros[name.ToLower()] : null); _sheet.CurrentView.AddMacroHandler((name, context) => Environment.GetEnvironmentVariable(name)); // convert #product-info into a dictionary. productInformation = _sheet.Metadata.Value.Keys.Where(each => each.StartsWith("product-info")).ToXDictionary(each => each.Substring(12), each => _sheet.Metadata.Value[each]); } catch(Exception e) { // e.PrintDump(); Dispose(); } }
public BuildScript(string filename) { try { Filename = filename.GetFullPath(); _project = new ProjectPlus(this, Filename + ".msbuild"); _project.Xml.AddImport(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "etc", "MSBuild.ExtensionPack.tasks")); _sheet = new RootPropertySheet(_project); _sheet.ParseFile(Filename); _pivots = new Pivots(_sheet.View.configurations); _sheet.AddChildRoutes(_project.MemberRoutes); // _sheet.AddChildRoutesForType(typeof (ProjectTargetElement), _project.TargetRoutes); _sheet.CurrentView.AddMacroHandler((name, context) => _macros.ContainsKey(name.ToLower()) ? _macros[name.ToLower()] : null); _sheet.CurrentView.AddMacroHandler((name, context) => Environment.GetEnvironmentVariable(name)); // convert #product-info into a dictionary. productInformation = _sheet.Metadata.Value.Keys.Where(each => each.StartsWith("product-info")).ToXDictionary(each => each.Substring(12), each => _sheet.Metadata.Value[each]); } catch { Dispose(); } }
public void Dispose() { _nugetPackages.Dispose(); _sheet = null; _nugetPackages = null; }
public void Dispose() { _sheet = null; _project.Dispose(); }