Esempio n. 1
0
        public static AssemblyProcessorApp CreateAssemblyProcessorApp(string[] args, TextWriter logger, out OptionSet p, out bool showHelp, out string outputFilePath, out List <string> inputFiles)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            bool   localShowHelp       = false;
            string localOutputFilePath = null;

            var app = new AssemblyProcessorApp(logger);

            p = new OptionSet()
            {
                "Copyright (c) Stride contributors (https://stride3d.net) and Silicon Studio Corp. (https://www.siliconstudio.co.jp) All Rights Reserved",
                "Stride Assembly Processor tool - Version: "
                +
                String.Format(
                    "{0}.{1}.{2}",
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Major,
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Minor,
                    typeof(AssemblyProcessorProgram).Assembly.GetName().Version.Build) + string.Empty,
                string.Format("Usage: {0} [options]* inputfile -o [outputfile]", ExeName),
                string.Empty,
                "=== Options ===",
                string.Empty,
                { "h|help", "Show this message and exit", v => localShowHelp = v != null },
                { "o|output=", "Output file name", v => localOutputFilePath = v },
                { "p|platform=", "The platform (Windows, Android, iOS)", v => app.Platform = (PlatformType)Enum.Parse(typeof(PlatformType), v) },
                { "t|targetFramework=", "The .NET target platform (platform specific)", v => app.TargetFramework = v },
                { "auto-notify-property", "Automatically implements INotifyPropertyChanged", v => app.AutoNotifyProperty = true },
                { "parameter-key", "Automatically initialize parameter keys in module static constructor", v => app.ParameterKey = true },
                { "rename-assembly=", "Rename assembly", v => app.NewAssemblyName = v },
                { "auto-module-initializer", "Execute function tagged with [ModuleInitializer] at module initialization (automatically enabled)", v => app.ModuleInitializer = true },
                { "serialization", "Generate serialiation assembly", v => app.SerializationAssembly = true },
                { "docfile=", "Generate user documentation from XML file", v => app.DocumentationFile = v },
                { "d|directory=", "Additional search directory for assemblies", app.SearchDirectories.Add },
                { "a|assembly=", "Additional assembly (for now, it will add the assembly directory to search path)", v => app.SearchDirectories.Add(Path.GetDirectoryName(v)) },
                { "signkeyfile=", "Signing Key File", v => app.SignKeyFile = v },
                { "references-file=", "Project reference stored in a path", v => app.References.AddRange(File.ReadAllLines(v)) },
                { "add-reference=", "References to explicitely add", v => app.ReferencesToAdd.Add(v) },
                { "Werror", "Promote warnings to errors", v => app.TreatWarningsAsErrors = true },
                { "delete-output-on-error", "Delete output file if an error happened", v => app.DeleteOutputOnError = true },
                { "keep-original", "Keep copy of the original assembly", v => app.KeepOriginal = true },
            };

            inputFiles     = p.Parse(args);
            showHelp       = localShowHelp;
            outputFilePath = localOutputFilePath;
            return(app);
        }
Esempio n. 2
0
        public static AssemblyProcessorApp CreateAssemblyProcessorApp(string[] args, TextWriter logger, out OptionSet p, out bool showHelp, out string outputFilePath, out List <string> inputFiles)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            bool   localShowHelp       = false;
            string localOutputFilePath = null;

            var app = new AssemblyProcessorApp(logger);

            p = new OptionSet()
            {
                "Copyright (c) 2018-2021 Stride and its contributors (https://stride3d.net)",
                "Copyright (c) 2011-2018 Silicon Studio Corp. (https://www.siliconstudio.co.jp)",
                "Stride Assembly Processor tool - Version: " +
                string.Format("{0}.{1}.{2}.{3}",
                              ExeVersion.Major,
                              ExeVersion.Minor,
                              ExeVersion.Build,
                              ExeVersion.Revision),
                string.Empty,
                string.Format("Usage: {0} [options]* inputfile -o [outputfile]", ExeName),
                string.Empty,
                "=== Options ===",
                string.Empty,
                { "h|help", "Show this message and exit.", v => localShowHelp = v != null },
                { "o|output=", "Output file name.", v => localOutputFilePath = v },
                { "parameter-key", "Automatically initialize parameter keys in module static constructors.", v => app.ParameterKey = true },
                { "rename-assembly=", "Rename assembly.", v => app.NewAssemblyName = v },
                { "auto-module-initializer", "Execute functions tagged with [ModuleInitializer] at module initialization (automatically enabled).", v => app.ModuleInitializer = true },
                { "serialization", "Generate serialization code.", v => app.SerializationAssembly = true },
                { "docfile=", "Generate user documentation from XML file.", v => app.DocumentationFile = v },
                { "d|directory=", "Additional search directory for assemblies.", app.SearchDirectories.Add },
                { "a|assembly=", "Additional assembly (for now, it will add the assembly directory to search path).", v => app.SearchDirectories.Add(Path.GetDirectoryName(v)) },
                { "references-file=", "Load project references from a file.", v => app.References.AddRange(File.ReadAllLines(v)) },
                { "add-reference=", "References to explicitely add.", v => app.ReferencesToAdd.Add(v) },
                { "delete-output-on-error", "Delete output file if an error happens.", v => app.DeleteOutputOnError = true },
                { "keep-original", "Keep a copy of the original assembly.", v => app.KeepOriginal = true },
                string.Empty
            };

            inputFiles     = p.Parse(args);
            showHelp       = localShowHelp;
            outputFilePath = localOutputFilePath;
            return(app);
        }