Ejemplo n.º 1
0
        private static void UpdateSamples(IEnumerable <Project> releaseProjects, Project serviceGenerator)
        {
            CommandLine.WriteLine("{{white}} =======================================");
            CommandLine.WriteLine("{{white}} Updating Samples");
            CommandLine.WriteLine("{{white}} =======================================");

            // Update all the dependencies.
            string libDir = Samples.Combine("Lib");

            DirUtils.ClearDir(libDir);

            foreach (Project p in releaseProjects)
            {
                p.CopyTo(libDir);
            }

            string thirdpartyDir = Samples.Combine("Lib", "ThirdParty");

            Directory.CreateDirectory(thirdpartyDir);
            foreach (string file in ThirdPartyFiles)
            {
                DirUtils.CopyFile(file, thirdpartyDir);
            }

            // Generate all strongly typed services.
            DirUtils.ClearDir(ServiceDir);
            var runner = new Runner(
                serviceGenerator.BinaryFile, "--google", "--output", ServiceDir, "repository");

            runner.WorkingDirectory = Path.GetDirectoryName(serviceGenerator.BinaryFile);
            runner.Run();

            // Build all the samples projects.
            CommandLine.WriteAction("Building samples...");
            foreach (string csproj in
                     Directory.GetFiles(Samples.WorkingDirectory, "*.csproj", SearchOption.AllDirectories))
            {
                Project project = new Project(csproj);
                project.RunBuildTask();
                project.Clean();
            }
            CommandLine.WriteLine();
        }