コード例 #1
0
        private static async Task <int> MainAsync(string[] args)
        {
            try
            {
                var solutionDir  = Path.GetFullPath(args[0]);
                var artifactsDir = Path.GetFullPath(args[1]);
                var dirNames     = args.Skip(2).ToArray();

                var versionString = await Collectors.GetVersionStringAsync(solutionDir);

                WriteLine("\r\n/////////////////////////////////////////////////////\r\nIL2C artifact collector\r\n");
                WriteLine("SolutionDir={0}",
                          solutionDir);
                WriteLine("ArtifactsDir={0}",
                          artifactsDir);
                WriteLine("Target version={0}",
                          versionString);

                await Collectors.RecreateDirectoryAsync(artifactsDir);

                var csprojPaths = dirNames.
                                  SelectMany(p => Directory.GetFiles(Path.Combine(solutionDir, p), "*.csproj")).
                                  ToArray();

                WriteLine("\r\n/////////////////////////////////////////////////////\r\n// Collect for {0}\r\n\r\n",
                          string.Join(", ", csprojPaths.Select(p => Path.GetFileName(p))));

                await Collectors.BuildCsprojAndCollectArtifactsAsync(solutionDir, artifactsDir, csprojPaths, versionString);

                var nuspecPaths = dirNames.
                                  SelectMany(p => Directory.GetFiles(Path.Combine(solutionDir, p), "*.nuspec")).
                                  ToArray();

                WriteLine("\r\n/////////////////////////////////////////////////////\r\n// Collect for {0}\r\n\r\n",
                          string.Join(", ", nuspecPaths.Select(p => Path.GetFileName(p))));

                await Collectors.BuildNuspecAndCollectArtifactsAsync(solutionDir, artifactsDir, nuspecPaths, versionString);

                WriteLine("\r\n/////////////////////////////////////////////////////\r\n// Collect for {0}\r\n\r\n",
                          "Arduino library");

                await Collectors.CollectArduinoArtifactsAsync(solutionDir, artifactsDir, versionString);
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                return(Marshal.GetHRForException(ex));
            }

            return(0);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: khursia/IL2C
        private static async Task <int> MainAsync(string[] args)
        {
            try
            {
                var solutionDir     = Path.GetFullPath(args[0]);
                var artifactsDir    = Path.GetFullPath(args[1]);
                var buildIdentifier = args[2];
                var dirNames        = args.Skip(3).ToArray();

                WriteLine("/////////////////////////////////////////////////////\r\nIL2C artifact collector");
                WriteLine("SolutionDir={0}",
                          solutionDir);
                WriteLine("ArtifactsDir={0}",
                          artifactsDir);
                WriteLine("Build identifier={0}",
                          buildIdentifier);
                WriteLine("Target version={0}",
                          typeof(Program).Assembly.GetName().Version);

                await Collectors.RecreateDirectoryAsync(artifactsDir);

                var csprojPaths = dirNames.
                                  SelectMany(p => Directory.GetFiles(Path.Combine(solutionDir, p), "*.csproj")).
                                  ToArray();

                WriteLine("\r\n/////////////////////////////////////////////////////\r\n// Collect for {0}\r\n\r\n",
                          string.Join(", ", csprojPaths.Select(p => Path.GetFileName(p))));

                await Collectors.BuildCsprojAndCollectArtifactsAsync(
                    solutionDir, artifactsDir, buildIdentifier, csprojPaths);

                var nuspecPaths = dirNames.
                                  SelectMany(p => Directory.GetFiles(Path.Combine(solutionDir, p), "*.nuspec")).
                                  ToArray();

                WriteLine("\r\n/////////////////////////////////////////////////////\r\n// Collect for {0}\r\n\r\n",
                          string.Join(", ", nuspecPaths.Select(p => Path.GetFileName(p))));

                await Collectors.BuildNuspecAndCollectArtifactsAsync(
                    solutionDir, artifactsDir, buildIdentifier, nuspecPaths);

                var zipArtifactsPaths = dirNames.
                                        SelectMany(p => Directory.GetFiles(Path.Combine(solutionDir, p), "*.zaspec")).
                                        ToArray();

                WriteLine("\r\n/////////////////////////////////////////////////////\r\n// Collect for {0}\r\n\r\n",
                          string.Join(", ", zipArtifactsPaths.Select(p => Path.GetFileName(p))));

                await Collectors.BuildZipFromCollectArtifactsAsync(
                    artifactsDir, zipArtifactsPaths);

                WriteLine("\r\n/////////////////////////////////////////////////////\r\n// Collect for {0}\r\n\r\n",
                          "Arduino library");

                await Collectors.CollectArduinoArtifactsAsync(solutionDir, artifactsDir);
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
                return(Marshal.GetHRForException(ex));
            }

            return(0);
        }