/// <summary> /// Executes manifest generator /// </summary> /// <param name="args"> </param> public void Run(string[] args) { var options = new ConsoleArgumentHelper().Parse <ManifestBxlGeneratorOptions>(args); if (options.LibraryDirectory.IsEmpty() && options.LibraryName.IsNotEmpty()) { options.LibraryDirectory = Path.GetDirectoryName(Path.GetFullPath(options.LibraryName)); options.LibraryName = Path.GetFileName(options.LibraryName); } options.LibraryDirectory = Path.GetFullPath(options.LibraryDirectory); if (options.LibraryName.IsNotEmpty()) { options.LibraryName = Path.Combine(options.LibraryDirectory, options.LibraryName); } if (options.OutputFile.IsNotEmpty()) { Console.WriteLine("LibraryDir: " + options.LibraryDirectory); } var generator = new ManifestBxlGenerator(); var content = generator.GenerateManifest(options); if (options.OutputFile.IsEmpty()) { Console.WriteLine(content); } else { if (content.IsEmpty() && options.LibraryName.IsNotEmpty()) { return; } File.WriteAllText(options.OutputFile, content); Console.WriteLine("manifest saved"); } }
/// <summary> /// Executes manifest generator /// </summary> /// <param name="args"> </param> public void Run(string[] args) { var options = new ConsoleArgumentHelper().Parse<ManifestBxlGeneratorOptions>(args); if (options.LibraryDirectory.IsEmpty() && options.LibraryName.IsNotEmpty()) { options.LibraryDirectory = Path.GetDirectoryName(Path.GetFullPath(options.LibraryName)); options.LibraryName = Path.GetFileName(options.LibraryName); } options.LibraryDirectory = Path.GetFullPath(options.LibraryDirectory); if (options.LibraryName.IsNotEmpty()) { options.LibraryName = Path.Combine(options.LibraryDirectory, options.LibraryName); } if (options.OutputFile.IsNotEmpty()) { Console.WriteLine("LibraryDir: " + options.LibraryDirectory); } var generator = new ManifestBxlGenerator(); var content = generator.GenerateManifest(options); if (options.OutputFile.IsEmpty()) { Console.WriteLine(content); } else { if (content.IsEmpty() && options.LibraryName.IsNotEmpty()) { return; } File.WriteAllText(options.OutputFile, content); Console.WriteLine("manifest saved"); } }
/// <summary> /// When overridden in a derived class, executes the task. /// </summary> /// <returns> true if the task successfully executed; otherwise, false. </returns> public override bool Execute() { var assemblypath = Path.GetFullPath(AssemblyPath); var manifestpath = Path.GetFullPath(ManifestPath); Log.LogMessage("Start generate Short:{0} manifest for {1}", Short, assemblypath); var generator = new ManifestBxlGenerator(); generator.NeedExportAttribute = false; var assembly = Assembly.Load(File.ReadAllBytes(assemblypath),File.ReadAllBytes(FileNameResolverExtensions.GetSymbolFileName(assemblypath))); var options = new ManifestBxlGeneratorOptions {UseShortNames = Short}; var result = generator.GenerateManifest(new[] {assembly}, options); Directory.CreateDirectory(Path.GetDirectoryName(manifestpath)); File.WriteAllText(ManifestPath, result, Encoding.UTF8); Log.LogMessage("Manifest {0} generated", manifestpath); return true; }