コード例 #1
0
        public void Pack()
        {
            var nugetInfo = _globalInfo.ArtifactTypes.OfType <NuGetArtifactType>().Single();
            var settings  = new DotNetCorePackSettings().AddVersionArguments(_globalInfo.BuildInfo, c =>
            {
                c.NoBuild         = true;
                c.IncludeSymbols  = true;
                c.Configuration   = _globalInfo.BuildInfo.BuildConfiguration;
                c.OutputDirectory = _globalInfo.ReleasesFolder.Path;
            });

            foreach (var p in nugetInfo.GetNuGetArtifacts())
            {
                _globalInfo.Cake.Information(p.ArtifactInstance);
                _globalInfo.Cake.DotNetCorePack(p.Project.Path.FullPath, settings);
            }
        }
コード例 #2
0
    private static void PackageWithCli(BuildContext context)
    {
        var settings = new DotNetCorePackSettings
        {
            Configuration         = context.MsBuildConfiguration,
            OutputDirectory       = Paths.Nuget,
            MSBuildSettings       = context.MsBuildSettings,
            ArgumentCustomization = arg => arg.Append("/p:PackAsTool=true")
        };

        // GitVersion.MsBuild, global tool & core
        context.DotNetCorePack("./src/GitVersion.App/GitVersion.App.csproj", settings);

        settings.ArgumentCustomization = arg => arg.Append("/p:IsPackaging=true");
        context.DotNetCorePack("./src/GitVersion.MsBuild", settings);

        settings.ArgumentCustomization = null;
        context.DotNetCorePack("./src/GitVersion.Core", settings);
    }
コード例 #3
0
        void StandardCreateNuGetPackages(NuGetArtifactType nugetInfo)
        {
            var settings = new DotNetCorePackSettings().AddVersionArguments(nugetInfo.GlobalInfo.GitInfo, c =>
            {
                // IsPackable=true is required for Tests package. Without this Pack on Tests projects
                // does not generate nupkg.
                c.ArgumentCustomization += args => args.Append("/p:IsPackable=true");
                c.NoBuild         = true;
                c.IncludeSymbols  = true;
                c.Configuration   = nugetInfo.GlobalInfo.BuildConfiguration;
                c.OutputDirectory = nugetInfo.GlobalInfo.ReleasesFolder.Path;
            });

            foreach (var p in nugetInfo.GetNuGetArtifacts())
            {
                Cake.Information(p.ArtifactInstance);
                Cake.DotNetCorePack(p.Project.Path.FullPath, settings);
            }
        }
コード例 #4
0
        void StandardCreateNuGetPackages(DirectoryPath releasesDir, IEnumerable <SolutionProject> projectsToPublish, SimpleRepositoryInfo gitInfo, string configuration)
        {
            var settings = new DotNetCorePackSettings().AddVersionArguments(gitInfo, c =>
            {
                // IsPackable=true is required for Tests package. Without this Pack on Tests projects
                // does not generate nupkg.
                c.ArgumentCustomization += args => args.Append("/p:IsPackable=true");
                c.NoBuild         = true;
                c.IncludeSymbols  = true;
                c.Configuration   = configuration;
                c.OutputDirectory = releasesDir;
            });

            foreach (SolutionProject p in projectsToPublish)
            {
                Cake.Information(p.Path.GetDirectory().FullPath);
                Cake.DotNetCorePack(p.Path.GetDirectory().FullPath, settings);
            }
        }
コード例 #5
0
    public override void Run(BuildContext context)
    {
        var settingsSrc = new DotNetCorePackSettings
        {
            Configuration         = context.BuildConfiguration,
            OutputDirectory       = context.ArtifactsDirectory.FullPath,
            ArgumentCustomization = args => args.Append("--include-symbols").Append("-p:SymbolPackageFormat=snupkg")
        };
        var settingsTemplate = new DotNetCorePackSettings
        {
            Configuration   = context.BuildConfiguration,
            OutputDirectory = context.ArtifactsDirectory.FullPath
        };

        foreach (var project in context.AllPackableSrcProjects)
        {
            context.DotNetPack(project.FullPath, settingsSrc);
        }
        context.DotNetPack(context.TemplatesTestsProjectFile.FullPath, settingsTemplate);
    }
コード例 #6
0
        public void PackOpenSourcePlugins()
        {
            DotNetCorePackSettings settings = new DotNetCorePackSettings
            {
                Configuration   = config,
                NoRestore       = true,
                OutputDirectory = outdir
            };

            string pluginsDirPath = Path.Combine(solutionDirectory, pluginsRelativePath);

            foreach (var proj in Plugins_Core)
            {
                string proj_path = Path.Combine(pluginsDirPath, $"FastReport.Data.{proj}", $"FastReport.OpenSource.Data.{proj}.csproj");

                DotNetCoreRestore(proj_path);

                DotNetCorePack(proj_path, settings);
            }
        }
コード例 #7
0
    public override void Run(Context context)
    {
        var packSettings = new DotNetCorePackSettings()
        {
            ArgumentCustomization = args => args.Append("/nodeReuse:False").Append("/m"),
            Configuration = context.Configuration,
            IncludeSymbols = true,
            NoBuild = true,
        };

        if (context.MsBuildDebug)
        {
            packSettings.ArgumentCustomization = args => args.Append($"/bl:{context.MsBuildPackLogFile}");
        }

        DotNetCoreAliases.DotNetCorePack(
            context,
            context.SolutionFile.FullPath,
            packSettings);
    }
コード例 #8
0
        public override void Run(Context context)
        {
            var appVersion = context.Argument <string>("AppVersion");

            var dotNetCore = context.ServiceProvider.GetService <IDotNetCoreCupCake>();

            //https://github.com/NuGet/Home/wiki/Adding-nuget-pack-as-a-msbuild-target
            var settings = new DotNetCorePackSettings
            {
                Configuration         = context.Configuration,
                NoBuild               = true,
                ArgumentCustomization = args => args
                                        .Append($"/p:Version={appVersion}")
                                        .Append($"/p:Copyright=\"Copyright {DateTime.UtcNow.Year} Adam Salvo\"")
            };

            PackAero(context, dotNetCore, settings);
            PackAeroAzure(context, dotNetCore, settings);
            PackAeroCake(context, dotNetCore, settings);
        }
コード例 #9
0
        public Build()
        {
            Cake.Log.Verbosity = Verbosity.Diagnostic;

            const string solutionName     = "DocFxCodeCake";
            const string solutionFileName = solutionName + ".sln";

            var releasesDir         = Cake.Directory("CodeCakeBuilder/Releases");
            var ghPagesDir          = Cake.Directory("gh-pages");
            var docfxConfigFilePath = Cake.File("Documentation/docfx.json");
            var docfxOutput         = Cake.Directory("Documentation/_site");
            var docfxDir            = Cake.Directory("Documentation");

            var projects = Cake.ParseSolution(solutionFileName)
                           .Projects
                           .Where(p => !(p is SolutionFolder) &&
                                  p.Name != "CodeCakeBuilder");

            // We do not publish .Tests projects for this solution.
            var projectsToPublish = projects
                                    .Where(p => !p.Path.Segments.Contains("Tests"));

            SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo();

            // Configuration is either "Debug" or "Release".
            string configuration = "Debug";

            Task("Check-Repository")
            .Does(() =>
            {
                if (!gitInfo.IsValid)
                {
                    if (Cake.IsInteractiveMode() &&
                        Cake.ReadInteractiveOption("Repository is not ready to be published. Proceed anyway?", 'Y', 'N') == 'Y')
                    {
                        Cake.Warning("GitInfo is not valid, but you choose to continue...");
                    }
                    else if (!Cake.AppVeyor().IsRunningOnAppVeyor)
                    {
                        throw new Exception("Repository is not ready to be published.");
                    }
                }

                if (gitInfo.IsValidRelease &&
                    (gitInfo.PreReleaseName.Length == 0 || gitInfo.PreReleaseName == "rc"))
                {
                    configuration = "Release";
                }

                Cake.Information("Publishing {0} projects with version={1} and configuration={2}: {3}",
                                 projectsToPublish.Count(),
                                 gitInfo.SafeSemVersion,
                                 configuration,
                                 projectsToPublish.Select(p => p.Name).Concatenate());
            });

            Task("Unit-Testing")
            .IsDependentOn("Check-Repository")
            .Does(() =>
            {
                Cake.DotNetCoreRestore();
                var testDirectories = Cake.ParseSolution(solutionFileName)
                                      .Projects
                                      .Where(p => p.Name.EndsWith(".Tests"))
                                      .Select(p => p.Path.FullPath);
                foreach (var test in testDirectories)
                {
                    Cake.DotNetCoreTest(test);
                }
            });

            Task("Clean")
            .IsDependentOn("Check-Repository")
            .IsDependentOn("Unit-Testing")
            .Does(() =>
            {
                Cake.CleanDirectories(projects.Select(p => p.Path.GetDirectory().Combine("bin")));
                Cake.CleanDirectories(releasesDir);
            });

            Task("Restore-NuGet-Packages-With-Version")
            .WithCriteria(() => gitInfo.IsValid)
            .IsDependentOn("Clean")
            .Does(() =>
            {
                // https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets
                Cake.DotNetCoreRestore(new DotNetCoreRestoreSettings().AddVersionArguments(gitInfo));
            });

            Task("Build-With-Version")
            .WithCriteria(() => gitInfo.IsValid)
            .IsDependentOn("Check-Repository")
            .IsDependentOn("Unit-Testing")
            .IsDependentOn("Clean")
            .IsDependentOn("Restore-NuGet-Packages-With-Version")
            .Does(() =>
            {
                foreach (var p in projectsToPublish)
                {
                    Cake.DotNetCoreBuild(p.Path.GetDirectory().FullPath,
                                         new DotNetCoreBuildSettings().AddVersionArguments(gitInfo, s =>
                    {
                        s.Configuration = configuration;
                    }));
                }
            });

            Task("Create-NuGet-Packages")
            .WithCriteria(() => gitInfo.IsValid)
            .IsDependentOn("Build-With-Version")
            .Does(() =>
            {
                Cake.CreateDirectory(releasesDir);
                foreach (SolutionProject p in projectsToPublish)
                {
                    Cake.Warning(p.Path.GetDirectory().FullPath);
                    var s = new DotNetCorePackSettings();
                    s.ArgumentCustomization = args => args.Append("--include-symbols");
                    s.NoBuild         = true;
                    s.Configuration   = configuration;
                    s.OutputDirectory = releasesDir;
                    s.AddVersionArguments(gitInfo);
                    Cake.DotNetCorePack(p.Path.GetDirectory().FullPath, s);
                }
            });

            Task("Push-NuGet-Packages")
            //.WithCriteria( () => gitInfo.IsValid )
            .WithCriteria(() => false)
            .IsDependentOn("Create-NuGet-Packages")
            .Does(() =>
            {
                IEnumerable <FilePath> nugetPackages = Cake.GetFiles(releasesDir.Path + "/*.nupkg");
                if (Cake.IsInteractiveMode())
                {
                    var localFeed = Cake.FindDirectoryAbove("LocalFeed");
                    if (localFeed != null)
                    {
                        Cake.Information("LocalFeed directory found: {0}", localFeed);
                        if (Cake.ReadInteractiveOption("Do you want to publish to LocalFeed?", 'Y', 'N') == 'Y')
                        {
                            Cake.CopyFiles(nugetPackages, localFeed);
                        }
                    }
                }
                if (gitInfo.IsValidRelease)
                {
                    if (gitInfo.PreReleaseName == "" ||
                        gitInfo.PreReleaseName == "prerelease" ||
                        gitInfo.PreReleaseName == "rc")
                    {
                        PushNuGetPackages("NUGET_API_KEY", "https://www.nuget.org/api/v2/package", nugetPackages);
                    }
                    else
                    {
                        // An alpha, beta, delta, epsilon, gamma, kappa goes to invenietis-preview.
                        PushNuGetPackages("MYGET_PREVIEW_API_KEY", "https://www.myget.org/F/invenietis-preview/api/v2/package", nugetPackages);
                    }
                }
                else
                {
                    Debug.Assert(gitInfo.IsValidCIBuild);
                    PushNuGetPackages("MYGET_CI_API_KEY", "https://www.myget.org/F/invenietis-ci/api/v2/package", nugetPackages);
                }
                if (Cake.AppVeyor().IsRunningOnAppVeyor)
                {
                    Cake.AppVeyor().UpdateBuildVersion(gitInfo.SafeNuGetVersion);
                }
            });

            Task("Execute-DocFX")
            //.WithCriteria(() => gitInfo.IsValid && gitInfo.PreReleaseName == "")
            .IsDependentOn("Push-NuGet-Packages")
            .Does(() =>
            {
                Cake.DocFxMetadata(docfxConfigFilePath);
                Cake.DocFxBuild(docfxConfigFilePath);
            });

            Task("Push-GitHub-Pages")
            .WithCriteria(() => gitInfo.IsValid && gitInfo.PreReleaseName == "")
            .IsDependentOn("Execute-DocFX")
            .Does(() =>
            {
                //Exec( "git", $"--version" );
                // Pull origin/gh-pages into local gh-pages
                Exec("git", $"pull origin gh-pages:gh-pages");
                // Checkout gh-pages branch in ghPagesDir
                Exec("git", $"worktree add {ghPagesDir} gh-pages");
                // Overwrite site with DocFX output
                Cake.CopyDirectory(docfxOutput, ghPagesDir);
                // Commit everything in gh-pages
                Exec("git", "add .", ghPagesDir);
                Exec("git", "commit -m \"Update gh-pages\"", ghPagesDir);
                // Push gh-pages to remote
                Exec("git", "push origin gh-pages", ghPagesDir);
                // Cleanup
                Cake.DeleteDirectory(ghPagesDir, true);
                Exec("git", "worktree prune");
            });


            // The Default task for this script can be set here.
            Task("Default")
            .IsDependentOn("Push-GitHub-Pages");
        }
コード例 #10
0
ファイル: Build.cs プロジェクト: bcrosnier/CK-Text
        public Build()
        {
            Cake.Log.Verbosity = Verbosity.Diagnostic;

            const string solutionName     = "CK-Text";
            const string solutionFileName = solutionName + ".sln";
            const string coreBuildProj    = "CodeCakeBuilder/CoreBuild.proj";

            var releasesDir = Cake.Directory("CodeCakeBuilder/Releases");

            var projects = Cake.ParseSolution(solutionFileName)
                           .Projects
                           .Where(p => !(p is SolutionFolder) &&
                                  p.Name != "CodeCakeBuilder");

            // We do not publish .Tests projects for this solution.
            var projectsToPublish = projects
                                    .Where(p => !p.Path.Segments.Contains("Tests"));

            SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo();

            // Configuration is either "Debug" or "Release".
            string configuration = "Debug";

            Task("Check-Repository")
            .Does(() =>
            {
                if (!gitInfo.IsValid)
                {
                    if (Cake.IsInteractiveMode() &&
                        Cake.ReadInteractiveOption("Repository is not ready to be published. Proceed anyway?", 'Y', 'N') == 'Y')
                    {
                        Cake.Warning("GitInfo is not valid, but you choose to continue...");
                    }
                    else
                    {
                        throw new Exception("Repository is not ready to be published.");
                    }
                }

                if (gitInfo.IsValidRelease &&
                    (gitInfo.PreReleaseName.Length == 0 || gitInfo.PreReleaseName == "rc"))
                {
                    configuration = "Release";
                }

                Cake.Information("Publishing {0} projects with version={1} and configuration={2}: {3}",
                                 projectsToPublish.Count(),
                                 gitInfo.SemVer,
                                 configuration,
                                 string.Join(", ", projectsToPublish.Select(p => p.Name)));
            });

            Task("Clean")
            .IsDependentOn("Check-Repository")
            .Does(() =>
            {
                Cake.CleanDirectories(projects.Select(p => p.Path.GetDirectory().Combine("bin")));
                Cake.CleanDirectories(releasesDir);
                Cake.DeleteFiles("Tests/**/TestResult*.xml");
            });

            Task("Restore-NuGet-Packages")
            .IsDependentOn("Check-Repository")
            .IsDependentOn("Clean")
            .Does(() =>
            {
                // https://docs.microsoft.com/en-us/nuget/schema/msbuild-targets
                Cake.DotNetCoreRestore(coreBuildProj, new DotNetCoreRestoreSettings().AddVersionArguments(gitInfo));
            });

            Task("Build")
            .IsDependentOn("Check-Repository")
            .IsDependentOn("Clean")
            .IsDependentOn("Restore-NuGet-Packages")
            .Does(() =>
            {
                Cake.DotNetCoreBuild(coreBuildProj,
                                     new DotNetCoreBuildSettings().AddVersionArguments(gitInfo, s =>
                {
                    s.Configuration = configuration;
                }));
            });

            Task("Unit-Testing")
            .IsDependentOn("Build")
            .Does(() =>
            {
                Cake.CreateDirectory(releasesDir);
                var testDlls = projects.Where(p => p.Name.EndsWith(".Tests")).Select(p =>
                                                                                     new
                {
                    ProjectPath   = p.Path.GetDirectory(),
                    NetCoreAppDll = p.Path.GetDirectory().CombineWithFilePath("bin/" + configuration + "/netcoreapp1.1/" + p.Name + ".dll"),
                    Net451Exe     = p.Path.GetDirectory().CombineWithFilePath("bin/" + configuration + "/net451/" + p.Name + ".exe"),
                });

                foreach (var test in testDlls)
                {
                    using (Cake.Environment.SetWorkingDirectory(test.ProjectPath))
                    {
                        Cake.Information("Testing: {0}", test.Net451Exe);
                        Cake.NUnit(test.Net451Exe.FullPath, new NUnitSettings()
                        {
                            Framework   = "v4.5",
                            ResultsFile = test.ProjectPath.CombineWithFilePath("TestResult.Net451.xml")
                        });
                        Cake.Information("Testing: {0}", test.NetCoreAppDll);
                        Cake.DotNetCoreExecute(test.NetCoreAppDll);
                    }
                }
            });

            Task("Create-NuGet-Packages")
            .WithCriteria(() => gitInfo.IsValid)
            .IsDependentOn("Unit-Testing")
            .Does(() =>
            {
                Cake.CreateDirectory(releasesDir);
                foreach (SolutionProject p in projectsToPublish)
                {
                    Cake.Warning(p.Path.GetDirectory().FullPath);
                    var s = new DotNetCorePackSettings();
                    s.ArgumentCustomization = args => args.Append("--include-symbols");
                    s.NoBuild         = true;
                    s.Configuration   = configuration;
                    s.OutputDirectory = releasesDir;
                    s.AddVersionArguments(gitInfo);
                    Cake.DotNetCorePack(p.Path.GetDirectory().FullPath, s);
                }
            });


            Task("Push-NuGet-Packages")
            .IsDependentOn("Create-NuGet-Packages")
            .WithCriteria(() => gitInfo.IsValid)
            .Does(() =>
            {
                IEnumerable <FilePath> nugetPackages = Cake.GetFiles(releasesDir.Path + "/*.nupkg");
                if (Cake.IsInteractiveMode())
                {
                    var localFeed = Cake.FindDirectoryAbove("LocalFeed");
                    if (localFeed != null)
                    {
                        Cake.Information("LocalFeed directory found: {0}", localFeed);
                        if (Cake.ReadInteractiveOption("Do you want to publish to LocalFeed?", 'Y', 'N') == 'Y')
                        {
                            Cake.CopyFiles(nugetPackages, localFeed);
                        }
                    }
                }
                if (gitInfo.IsValidRelease)
                {
                    if (gitInfo.PreReleaseName == "" ||
                        gitInfo.PreReleaseName == "prerelease" ||
                        gitInfo.PreReleaseName == "rc")
                    {
                        PushNuGetPackages("NUGET_API_KEY", "https://www.nuget.org/api/v2/package", nugetPackages);
                    }
                    else
                    {
                        // An alpha, beta, delta, epsilon, gamma, kappa goes to invenietis-preview.
                        PushNuGetPackages("MYGET_PREVIEW_API_KEY", "https://www.myget.org/F/invenietis-preview/api/v2/package", nugetPackages);
                    }
                }
                else
                {
                    Debug.Assert(gitInfo.IsValidCIBuild);
                    PushNuGetPackages("MYGET_CI_API_KEY", "https://www.myget.org/F/invenietis-ci/api/v2/package", nugetPackages);
                }
                if (Cake.AppVeyor().IsRunningOnAppVeyor)
                {
                    Cake.AppVeyor().UpdateBuildVersion(gitInfo.SemVer);
                }
            });

            // The Default task for this script can be set here.
            Task("Default")
            .IsDependentOn("Push-NuGet-Packages");
        }
コード例 #11
0
 public static void ApplyBuildParameters(this IConfiguration configuration, string projectOrSolutionFile, DotNetCorePackSettings settings)
 {
     configuration.ApplyBuildParametersForDotNetCore(projectOrSolutionFile,
                                                     buildConfiguration => settings.Configuration = buildConfiguration,
                                                     () => settings.MSBuildSettings,
                                                     msBuildSettings => settings.MSBuildSettings = msBuildSettings);
 }
コード例 #12
0
        public Build()
        {
            Cake.Log.Verbosity = Verbosity.Diagnostic;

            const string solutionName     = "CK-Glouton";
            const string solutionFileName = "../" + solutionName + ".sln";

            var releasesDir = Cake.Directory("CodeCakeBuilder/Releases");

            var projects = Cake.ParseSolution(solutionFileName)
                           .Projects
                           .Where(p => !(p is SolutionFolder) &&
                                  p.Name != "CodeCakeBuilder");

            // We do not publish .Tests projects for this solution.
            var projectsToPublish = projects
                                    .Where(p => !p.Path.Segments.Contains("Tests"));

            SimpleRepositoryInfo gitInfo = Cake.GetSimpleRepositoryInfo();

            // Configuration is either "Debug" or "Release".
            string configuration = "Debug";

            Task("Check-Repository")
            .Does(() =>
            {
                if (!gitInfo.IsValid)
                {
                    if (Cake.IsInteractiveMode() &&
                        Cake.ReadInteractiveOption("Repository is not ready to be published. Proceed anyway?", 'Y', 'N') == 'Y')
                    {
                        Cake.Warning("GitInfo is not valid, but you choose to continue...");
                    }
                    else if (!Cake.AppVeyor().IsRunningOnAppVeyor)
                    {
                        throw new Exception("Repository is not ready to be published.");
                    }
                }

                if (gitInfo.IsValidRelease &&
                    (gitInfo.PreReleaseName.Length == 0 || gitInfo.PreReleaseName == "rc"))
                {
                    configuration = "Release";
                }

                Cake.Information("Publishing {0} projects with version={1} and configuration={2}: {3}",
                                 projectsToPublish.Count(),
                                 gitInfo.SafeSemVersion,
                                 configuration,
                                 projectsToPublish.Select(p => p.Name).Concatenate());
            });

            Task("Clean")
            .IsDependentOn("Check-Repository")
            .Does(() =>
            {
                Cake.CleanDirectories(projects.Select(p => p.Path.GetDirectory().Combine("bin")));
                Cake.CleanDirectories(releasesDir);
            });


            Task("Restore-NPM-Package")
            .IsDependentOn("Clean")
            .Does(() =>
            {
                var settings = new NpmInstallSettings();

                settings.LogLevel         = NpmLogLevel.Warn;
                settings.WorkingDirectory = "../src/CK.Glouton.Web/app";
                settings.InstallLocally();

                NpmInstallAliases.NpmInstall(this.Cake, settings);
            });
            Task("NPM-Build")
            .IsDependentOn("Restore-NPM-Package")
            .IsDependentOn("Clean")
            .Does(() =>
            {
                var settings = new NpmRunScriptSettings();

                settings.LogLevel         = NpmLogLevel.Info;
                settings.WorkingDirectory = "../src/CK.Glouton.Web/app";
                settings.ScriptName       = "build";

                NpmRunScriptAliases.NpmRunScript(this.Cake, settings);
            });

            Task("Build-With-Version")
            .IsDependentOn("Check-Repository")
            .IsDependentOn("Clean")
            .IsDependentOn("Restore-NPM-package")
            .IsDependentOn("NPM-Build")
            .Does(() =>
            {
                using (var tempSln = Cake.CreateTemporarySolutionFile(solutionFileName))
                {
                    tempSln.ExcludeProjectsFromBuild("CodeCakeBuilder");
                    Cake.DotNetCoreBuild(tempSln.FullPath.FullPath,
                                         new DotNetCoreBuildSettings().AddVersionArguments(gitInfo, s =>
                    {
                        s.Configuration = configuration;
                    }));
                }
            });

            Task("Unit-Testing")
            .IsDependentOn("Build-With-Version")
            .Does(() =>
            {
                var testProjects = projects.Where(p => p.Path.Segments.Contains("Tests"));

                var testNetFrameworkDlls = testProjects
                                           .Where(p => p.Name.EndsWith(".NetFramework"))
                                           .Select(p => p.Path.GetDirectory().CombineWithFilePath("bin/" + configuration + "/net461/" + p.Name + ".dll"));
                Cake.Information("Testing: {0}", string.Join(", ", testNetFrameworkDlls.Select(p => p.GetFilename().ToString())));
                Cake.NUnit(testNetFrameworkDlls);

                var testNetCoreDirectories = testProjects
                                             .Where(p => p.Name.EndsWith(".NetCore"))
                                             .Select(p => p.Path.GetDirectory());
                Cake.Information("Testing: {0}", string.Join(", ", testNetCoreDirectories.Select(p => p.GetDirectoryName().ToString())));
                foreach (var testNetCoreDirectory in testNetCoreDirectories)
                {
                    Cake.DotNetCoreRun(testNetCoreDirectory.FullPath);
                }
            });

            Task("Create-NuGet-Packages")
            .WithCriteria(() => gitInfo.IsValid)
            .IsDependentOn("Unit-Testing")
            .Does(() =>
            {
                Cake.CreateDirectory(releasesDir);
                foreach (SolutionProject p in projectsToPublish)
                {
                    Cake.Warning(p.Path.GetDirectory().FullPath);
                    var s = new DotNetCorePackSettings();
                    s.ArgumentCustomization = args => args.Append("--include-symbols");
                    s.NoBuild         = true;
                    s.Configuration   = configuration;
                    s.OutputDirectory = releasesDir;
                    s.AddVersionArguments(gitInfo);
                    Cake.DotNetCorePack(p.Path.GetDirectory().FullPath, s);
                }
            });

            Task("Push-NuGet-Packages")
            .WithCriteria(() => gitInfo.IsValid)
            .IsDependentOn("Create-NuGet-Packages")
            .Does(() =>
            {
                IEnumerable <FilePath> nugetPackages = Cake.GetFiles(releasesDir.Path + "/*.nupkg");
                if (Cake.IsInteractiveMode())
                {
                    var localFeed = Cake.FindDirectoryAbove("LocalFeed");
                    if (localFeed != null)
                    {
                        Cake.Information("LocalFeed directory found: {0}", localFeed);
                        if (Cake.ReadInteractiveOption("Do you want to publish to LocalFeed?", 'Y', 'N') == 'Y')
                        {
                            Cake.CopyFiles(nugetPackages, localFeed);
                        }
                    }
                }
                if (gitInfo.IsValidRelease)
                {
                    // All Version
                    PushNuGetPackages("MYGET_PREVIEW_API_KEY", "https://www.myget.org/F/glouton-preview/api/v2/package", nugetPackages);
                }
                else
                {
                    Debug.Assert(gitInfo.IsValidCIBuild);
                    PushNuGetPackages("MYGET_CI_API_KEY", "https://www.myget.org/F/glouton-ci/api/v2/package", nugetPackages);
                }
                if (Cake.AppVeyor().IsRunningOnAppVeyor)
                {
                    Cake.AppVeyor().UpdateBuildVersion(gitInfo.SafeSemVersion);
                }
            });

            // The Default task for this script can be set here.
            Task("Default")
            .IsDependentOn("Push-NuGet-Packages");
        }
コード例 #13
0
ファイル: CakeAPI.cs プロジェクト: frontlook-admin/FastReport
 public static void DotNetCorePack(string project, DotNetCorePackSettings packSettings)
 => Context.DotNetCorePack(project, packSettings);
コード例 #14
0
        public Build()
        {
            Cake.Log.Verbosity = Verbosity.Diagnostic;

            const string solutionName     = "LogCollector";
            const string solutionFileName = solutionName + ".sln";

            var releasesDir = Cake.Directory("CodeCakeBuilder/Releases");

            var projects = Cake.ParseSolution(solutionFileName)
                           .Projects
                           .Where(p => !(p is SolutionFolder) &&
                                  p.Name != "CodeCakeBuilder");

            // We do not publish .Tests projects for this solution.
            var projectsToPublish = projects
                                    .Where(p => !p.Path.Segments.Contains("Tests"));

            // Configuration is either "Debug" or "Release".
            string configuration = "Debug";

            Task("Clean")
            .IsDependentOn("Check-Repository")
            .Does(() =>
            {
                Cake.CleanDirectories(projects.Select(p => p.Path.GetDirectory().Combine("bin")));
                Cake.CleanDirectories(releasesDir);
                Cake.DeleteFiles("Tests/**/TestResult*.xml");
            });
            Task("Build")
            .IsDependentOn("Restore")
            .Does(() =>
            {
                using (var tempSln = Cake.CreateTemporarySolutionFile(solutionFileName))
                {
                    tempSln.ExcludeProjectsFromBuild("CodeCakeBuilder");
                    Cake.DotNetCoreBuild(tempSln.FullPath.FullPath);
                }
            });

            Task("Unit-Testing")
            .IsDependentOn("Build")
            .Does(() =>
            {
                var testDlls = projects.Where(p => p.Name.EndsWith(".Tests")).Select(p =>
                                                                                     new
                {
                    ProjectPath   = p.Path.GetDirectory(),
                    NetCoreAppDll = p.Path.GetDirectory().CombineWithFilePath("bin/" + configuration + "/netcoreapp2.0/" + p.Name + ".dll"),
                    Net461Dll     = p.Path.GetDirectory().CombineWithFilePath("bin/" + configuration + "/net461/" + p.Name + ".dll"),
                });

                foreach (var test in testDlls)
                {
                    if (System.IO.File.Exists(test.Net461Dll.FullPath))
                    {
                        Cake.Information("Testing: {0}", test.Net461Dll);
                        Cake.NUnit(test.Net461Dll.FullPath, new NUnitSettings()
                        {
                            Framework = "v4.5"
                        });
                    }
                    if (System.IO.File.Exists(test.NetCoreAppDll.FullPath))
                    {
                        Cake.Information("Testing: {0}", test.NetCoreAppDll);
                        Cake.DotNetCoreExecute(test.NetCoreAppDll);
                    }
                }
            });

            Task("Create-NuGet-Packages")
            .IsDependentOn("Unit-Testing")
            .Does(() =>
            {
                foreach (SolutionProject p in projectsToPublish)
                {
                    Cake.Warning(p.Path.GetDirectory().FullPath);
                    var s = new DotNetCorePackSettings();
                    s.ArgumentCustomization = args => args.Append("--include-symbols");
                    s.NoBuild         = true;
                    s.Configuration   = configuration;
                    s.OutputDirectory = releasesDir;
                    Cake.DotNetCorePack(p.Path.GetDirectory().FullPath, s);
                }
            });

            // The Default task for this script can be set here.
            Task("Default")
            .IsDependentOn("Create-NuGet-Packages");
        }
コード例 #15
0
        private void PackAeroCake(Context context, IDotNetCoreCupCake dotNetCore, DotNetCorePackSettings defaultSettings)
        {
            var path = new FilePath($"{context.ProjectsPath}/Aero.Cake/Aero.Cake.csproj");

            dotNetCore.Pack(path.FullPath, defaultSettings);
        }
コード例 #16
0
 public void Pack(string projectPath, DotNetCorePackSettings settings)
 {
     AeroContext.DotNetCorePack(projectPath, settings);
 }