internal NugetPackage(PackageScript packageScript, PackageRole packageRole, string packageName) { _packageScript = packageScript; _pkgName = packageName; PkgRole = packageRole; Props = new Lazy <ProjectPlus>(() => new ProjectPlus(this, "{0}.props".format(_pkgName))); Targets = new Lazy <ProjectPlus>(() => new ProjectPlus(this, "{0}.targets".format(_pkgName))); // Acquire semaphore because executing any tasks in the AfterBuild step of the package. // This prevents errors when multiple consumers of the package try to copy package // redistributables to the same destination. (see release in the Save method) if (packageRole == PackageRole.@default) // not needed in the overlay package { var semaphore = Targets.Value.LookupTarget("AfterBuild").AddTask("AcquireSemaphore"); semaphore.SetParameter("Name", "Sync_AfterBuild_" + _pkgName); semaphore.AddOutputProperty("Handle", "SemaphoreHandle"); } _nuSpec.metadata.id = "Package"; _nuSpec.metadata.version = "1.0.0"; // _nuSpec.metadata.authors = "NAME"; // _nuSpec.metadata.owners = "NAME"; // _nuSpec.metadata.licenseUrl = "http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE"; // _nuSpec.metadata.projectUrl = "http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE"; // _nuSpec.metadata.iconUrl = "http://ICON_URL_HERE_OR_DELETE_THIS_LINE"; _nuSpec.metadata.requireLicenseAcceptance = "false"; // _nuSpec.metadata.description = "Package description"; // _nuSpec.metadata.releaseNotes = "Summary of changes made in this release of the package."; // _nuSpec.metadata.copyright = "Copyright 2013"; }
internal NugetPackage(PackageScript packageScript, string packageRole, string packageName) { _packageScript = packageScript; _pkgName = packageName; PkgRole = packageRole; _nuSpec.metadata.id = "Package"; _nuSpec.metadata.version = "1.0.0"; _nuSpec.metadata.authors = "NAME"; _nuSpec.metadata.owners = "NAME"; _nuSpec.metadata.licenseUrl = "http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE"; _nuSpec.metadata.projectUrl = "http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE"; _nuSpec.metadata.iconUrl = "http://ICON_URL_HERE_OR_DELETE_THIS_LINE"; _nuSpec.metadata.requireLicenseAcceptance = "false"; _nuSpec.metadata.description = "Package description"; _nuSpec.metadata.releaseNotes = "Summary of changes made in this release of the package."; _nuSpec.metadata.copyright = "Copyright 2013"; }
internal NugetPackage(PackageScript packageScript, PackageRole packageRole, string packageName) { _packageScript = packageScript; _pkgName = packageName; PkgRole = packageRole; Props = new Lazy<ProjectPlus>(() => new ProjectPlus(this, "{0}.props".format(_pkgName))); Targets = new Lazy<ProjectPlus>(() => new ProjectPlus(this, "{0}.targets".format(_pkgName))); // Acquire semaphore because executing any tasks in the AfterBuild step of the package. // This prevents errors when multiple consumers of the package try to copy package // redistributables to the same destination. (see release in the Save method) if (packageRole == PackageRole.@default) { // not needed in the overlay package var semaphore = Targets.Value.LookupTarget("AfterBuild").AddTask("AcquireSemaphore"); semaphore.SetParameter("Name", "Sync_AfterBuild_" + _pkgName); semaphore.AddOutputProperty("Handle", "SemaphoreHandle"); } _nuSpec.metadata.id = "Package"; _nuSpec.metadata.version = "1.0.0"; // _nuSpec.metadata.authors = "NAME"; // _nuSpec.metadata.owners = "NAME"; // _nuSpec.metadata.licenseUrl = "http://LICENSE_URL_HERE_OR_DELETE_THIS_LINE"; // _nuSpec.metadata.projectUrl = "http://PROJECT_URL_HERE_OR_DELETE_THIS_LINE"; // _nuSpec.metadata.iconUrl = "http://ICON_URL_HERE_OR_DELETE_THIS_LINE"; _nuSpec.metadata.requireLicenseAcceptance = "false"; // _nuSpec.metadata.description = "Package description"; // _nuSpec.metadata.releaseNotes = "Summary of changes made in this release of the package."; // _nuSpec.metadata.copyright = "Copyright 2013"; }
private void Start(string[] args) { CurrentTask.Events += new SourceError((code, location, message, objects) => { location = location ?? SourceLocation.Unknowns; Console.WriteLine("{0}:Error {1}:{2}", location.FirstOrDefault(), code, message.format(objects)); return true; }); CurrentTask.Events += new SourceWarning((code, location, message, objects) => { location = location ?? SourceLocation.Unknowns; Console.WriteLine("{0}:Warning {1}:{2}", location.FirstOrDefault(), message.format(objects)); return false; }); CurrentTask.Events += new SourceDebug((code, location, message, objects) => { location = location ?? SourceLocation.Unknowns; Console.WriteLine("{0}:DebugMessage {1}:{2}", location.FirstOrDefault(), code, message.format(objects)); return false; }); CurrentTask.Events += new Error((code, message, objects) => { Console.WriteLine("{0}:Error {1}", code, message.format(objects)); return true; }); CurrentTask.Events += new Warning((code, message, objects) => { Console.WriteLine("{0}:Warning {1}", code, message.format(objects)); return false; }); CurrentTask.Events += new Debug((code, message, objects) => { Console.WriteLine("{0}:DebugMessage {1}", code, message.format(objects)); return false; }); CurrentTask.Events += new Verbose((code, message, objects) => { Console.WriteLine("{0}:Verbose {1}", code, message.format(objects)); return false; }); CurrentTask.Events += new Message((code, message, objects) => { Console.WriteLine("{0}:Message {1}", code, message.format(objects)); return false; }); #if true try { Environment.CurrentDirectory = @"C:\root\V2\coapp-packages\openssl\copkg"; Console.WriteLine("Package script"); using(var script = new PackageScript("openssl.autopkg")) { IEnumerable<string> overlayFiles; var pkgFile = script.Save(PackageTypes.NuGet, false, false, out overlayFiles); } Console.WriteLine(); } catch (Exception e) { Console.WriteLine("{0} =>\r\n\r\nat {1}", e.Message, e.StackTrace.Replace("at ClrPlus.Scripting.Languages.PropertySheetV3.PropertySheetParser", "PropertySheetParser")); } #else try { // Environment.CurrentDirectory = @"C:\project"; Console.WriteLine("Build script"); using (var script = new BuildScript("test.buildinfo")) { script.Execute(); } } catch (Exception e) { Console.WriteLine("{0} =>\r\n\r\nat {1}", e.Message, e.StackTrace.Replace("at ClrPlus.Scripting.Languages.PropertySheetV3.PropertySheetParser", "PropertySheetParser")); } #endif return; // }
protected override void ProcessRecord() { #if USING_RESTABLE_CMDLET if (Remote) { ProcessRecordViaRest(); return; } #endif ProviderInfo packagePathProviderInfo; var pkgPath = SessionState.Path.GetResolvedProviderPathFromPSPath(Package, out packagePathProviderInfo); using (var local = LocalEventSource) { local.Events += new SourceError((code, location, message, objects) => { location = location ?? SourceLocation.Unknowns; Host.UI.WriteErrorLine("{0}:Error {1}:{2}".format(location.FirstOrDefault(), code, message.format(objects))); return true; }); if (!NoWarnings) { local.Events += new SourceWarning((code, location, message, objects) => { WriteWarning("{0}:Warning {1}:{2}".format((location ?? SourceLocation.Unknowns).FirstOrDefault(), message.format(objects))); return false; }); } local.Events += new SourceDebug((code, location, message, objects) => { WriteVerbose("{0}:DebugMessage {1}:{2}".format((location ?? SourceLocation.Unknowns).FirstOrDefault(), code, message.format(objects))); return false; }); using (var script = new PackageScript(pkgPath.FirstOrDefault())) { script.SplitThreshold = SplitThreshold * 1024 * 1024; if (NoSplit.IsPresent) { script.NoSplit = true; } if (PackageDirectory.Is()) { script.AddNuGetPackageDirectory(PackageDirectory.GetFullPath()); } if (Defines != null) { foreach (var i in Defines) { var p = i.IndexOf("="); var k = p > -1 ? i.Substring(0, p) : i; var v = p > -1 ? i.Substring(p + 1) : ""; script.AddMacro(k, v); } } if (Define != null) { foreach (var i in Define) { var p = i.IndexOf("="); var k = p > -1 ? i.Substring(0, p) : i; var v = p > -1 ? i.Substring(p + 1) : ""; script.AddMacro(k, v); } } IEnumerable<string> overlayPackages; var pkgFile = script.Save(PackageTypes.NuGet, !NoClean, GenerateOnly, out overlayPackages); } } }