Beispiel #1
0
    public static int Main(string[] args) => BuildRunner.Execute(args, build =>
    {
        var dotNetBuildSettings = new DotNetBuildSettings
        {
            NuGetApiKey        = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
            SourceLinkSettings = new SourceLinkSettings
            {
                ShouldTestPackage = name => name == "XmlDocMarkdown.Core" || name == "Cake.XmlDocMarkdown",
            },
        };
        build.AddDotNetTargets(dotNetBuildSettings);

        build.Target("generate-docs")
        .Describe("Generates documentation")
        .DependsOn("build")
        .Does(() => GenerateDocs(dotNetBuildSettings, verify: false));

        build.Target("verify-docs")
        .Describe("Verifies generated documentation")
        .DependsOn("build")
        .Does(() => GenerateDocs(dotNetBuildSettings, verify: true));

        build.Target("test")
        .DependsOn("verify-docs");
    });
Beispiel #2
0
    public static int Main(string[] args) => BuildRunner.Execute(args, build =>
    {
        var codegen = "fsdgenfsd";

        var dotNetTools = new DotNetTools(Path.Combine("tools", "bin")).AddSource(Path.Combine("tools", "bin"));

        var dotNetBuildSettings = new DotNetBuildSettings
        {
            NuGetApiKey  = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
            DocsSettings = new DotNetDocsSettings
            {
                GitLogin       = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
                GitAuthor      = new GitAuthorInfo("FacilityApiBot", "*****@*****.**"),
                GitBranchName  = Environment.GetEnvironmentVariable("APPVEYOR_REPO_BRANCH"),
                SourceCodeUrl  = "https://github.com/FacilityApi/Facility/tree/master/src",
                ProjectHasDocs = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
            },
            DotNetTools        = dotNetTools,
            SourceLinkSettings = new SourceLinkSettings
            {
                ShouldTestPackage = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
            },
        };

        build.AddDotNetTargets(dotNetBuildSettings);

        build.Target("codegen")
        .DependsOn("build")
        .Describe("Generates code from the FSD")
        .Does(() => codeGen(verify: false));

        build.Target("verify-codegen")
        .DependsOn("build")
        .Describe("Ensures the generated code is up-to-date")
        .Does(() => codeGen(verify: true));

        build.Target("test")
        .DependsOn("verify-codegen");

        void codeGen(bool verify)
        {
            string configuration = dotNetBuildSettings.BuildOptions.ConfigurationOption.Value;
            string versionSuffix = $"cg{DateTime.UtcNow:yyyyMMddHHmmss}";
            RunDotNet("pack", Path.Combine("src", codegen, $"{codegen}.csproj"), "-c", configuration, "--no-build",
                      "--output", Path.GetFullPath(Path.Combine("tools", "bin")), "--version-suffix", versionSuffix);

            string packagePath    = FindFiles($"tools/bin/{codegen}.*-{versionSuffix}.nupkg").Single();
            string packageVersion = Regex.Match(packagePath, @"[/\\][^/\\]*\.([0-9]+\.[0-9]+\.[0-9]+(-.+)?)\.nupkg$").Groups[1].Value;
            string toolPath       = dotNetTools.GetToolPath($"{codegen}/{packageVersion}");

            string verifyOption = verify ? "--verify" : null;

            RunApp(toolPath, "example/ExampleApi.fsd", "example/output", "--newline", "lf", verifyOption);
            RunApp(toolPath, "example/ExampleApi.fsd.md", "example/output", "--newline", "lf", "--verify");

            RunApp(toolPath, "example/ExampleApi.fsd", "example/output/ExampleApi-nowidgets.fsd", "--excludeTag", "widgets", "--newline", "lf", verifyOption);
            RunApp(toolPath, "example/ExampleApi.fsd.md", "example/output/ExampleApi-nowidgets.fsd", "--excludeTag", "widgets", "--newline", "lf", "--verify");
        }
    });
Beispiel #3
0
        public void Execute(params string[] targets)
        {
            foreach (var target in targets)
            {
                Options.AddTarget(target);
            }

            Runner.Execute(Options);
        }
Beispiel #4
0
 public static int Main(string[] args) => BuildRunner.Execute(args, build =>
 {
     build.AddDotNetTargets(
         new DotNetBuildSettings
     {
         DocsSettings = new DotNetDocsSettings
         {
             GitLogin      = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
             GitAuthor     = new GitAuthorInfo("Faithlife Build Bot", "*****@*****.**"),
             SourceCodeUrl = "https://github.com/Faithlife/RepoName/tree/master/src",
         },
     });
 });
Beispiel #5
0
    public static int Main(string[] args) => BuildRunner.Execute(args, build =>
    {
        var codegen = "fsdgenaspnet";

        var dotNetBuildSettings = new DotNetBuildSettings
        {
            NuGetApiKey  = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
            DocsSettings = new DotNetDocsSettings
            {
                GitLogin       = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
                GitAuthor      = new GitAuthorInfo("FacilityApiBot", "*****@*****.**"),
                GitBranchName  = Environment.GetEnvironmentVariable("APPVEYOR_REPO_BRANCH"),
                SourceCodeUrl  = "https://github.com/FacilityApi/FacilityAspNet/tree/master/src",
                ProjectHasDocs = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
            },
        };

        build.AddDotNetTargets(dotNetBuildSettings);

        build.Target("codegen")
        .DependsOn("build")
        .Describe("Generates code from the FSD")
        .Does(() => codeGen(verify: false));

        build.Target("verify-codegen")
        .DependsOn("build")
        .Describe("Ensures the generated code is up-to-date")
        .Does(() => codeGen(verify: true));

        build.Target("test")
        .DependsOn("verify-codegen");

        void codeGen(bool verify)
        {
            var configuration = dotNetBuildSettings !.BuildOptions !.ConfigurationOption !.Value;
            var toolPath      = FindFiles($"src/{codegen}/bin/{configuration}/netcoreapp*/{codegen}.dll").FirstOrDefault();

            var verifyOption = verify ? "--verify" : null;

            RunDotNet("tool", "restore");
            RunDotNet("tool", "run", "FacilityConformance", "fsd", "--output", "conformance/ConformanceApi.fsd", verifyOption);
            RunDotNet("tool", "run", "FacilityConformance", "json", "--output", "conformance/ConformanceTests.json", verifyOption);

            RunDotNet(toolPath, "conformance/ConformanceApi.fsd", "conformance/WebApiControllerServer/Controllers",
                      "--namespace", "WebApiControllerServer.Controllers", "--newline", "lf", verifyOption);
            RunDotNet(toolPath, "conformance/ConformanceApi.fsd", "conformance/CoreWebApiShimServer/Controllers",
                      "--namespace", "CoreWebApiShimServer.Controllers", "--target", "core", "--newline", "lf", verifyOption);
            RunDotNet(toolPath, "conformance/ConformanceApi.fsd", "conformance/CoreControllerServer/Controllers",
                      "--namespace", "CoreControllerServer.Controllers", "--target", "core", "--newline", "lf", verifyOption);
        }
    });
Beispiel #6
0
 public static int Main(string[] args) => BuildRunner.Execute(args, build =>
 {
     build.AddDotNetTargets(
         new DotNetBuildSettings
     {
         NuGetApiKey  = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
         DocsSettings = new DotNetDocsSettings
         {
             GitLogin      = new GitLoginInfo("ejball", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
             GitAuthor     = new GitAuthorInfo("ejball", "*****@*****.**"),
             SourceCodeUrl = "https://github.com/ejball/SqlRendering/tree/master/src",
         },
     });
 });
Beispiel #7
0
    public static int Main(string[] args) => BuildRunner.Execute(args, build =>
    {
        var dotNetBuildSettings = new DotNetBuildSettings
        {
            NuGetApiKey  = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
            DocsSettings = new DotNetDocsSettings
            {
                GitLogin      = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
                GitAuthor     = new GitAuthorInfo("Faithlife Build Bot", "*****@*****.**"),
                SourceCodeUrl = "https://github.com/Faithlife/System.Data.SQLite/tree/master/src",
            },

            // 32-bit MSBuild is required for Xamarin builds
            MSBuildSettings = new MSBuildSettings {
                Version = MSBuildVersion.VS2017, Platform = MSBuildPlatform.X32
            },

            // default to everything
            SolutionPlatform = "everything",

            // we need the build options below
            BuildOptions = new DotNetBuildOptions(),

            // dotnet test doesn't work on Mac, so we must specify the test assemblies directly (see below)
            TestSettings = new DotNetTestSettings(),

            // enable SourceLink
            SourceLinkSettings = SourceLinkSettings.Default,
        };

        IReadOnlyList <string> findTestAssemblies()
        {
            var buildOptions       = dotNetBuildSettings.BuildOptions;
            var configuration      = buildOptions.ConfigurationOption.Value;
            var platform           = buildOptions.PlatformOption.Value ?? dotNetBuildSettings.SolutionPlatform;
            var platformFolder     = platform == "Any CPU" ? "" : $"{platform}/";
            var testAssembliesGlob = $"tests/**/bin/{platformFolder}{configuration}/net*/{(BuildEnvironment.IsMacOS() ? "osx*" : "win*")}/*Tests.dll";
            var testAssemblies     = FindFiles(testAssembliesGlob);
            if (testAssemblies.Count == 0)
            {
                throw new InvalidOperationException($"No test assemblies found: {testAssembliesGlob}");
            }
            return(testAssemblies);
        }

        dotNetBuildSettings.TestSettings.FindTestAssemblies = findTestAssemblies;

        build.AddDotNetTargets(dotNetBuildSettings);
    });
Beispiel #8
0
    public static int Main(string[] args) => BuildRunner.Execute(args, build =>
    {
        var codegen = "fsdgenfsd";

        var dotNetBuildSettings = new DotNetBuildSettings
        {
            NuGetApiKey  = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
            DocsSettings = new DotNetDocsSettings
            {
                GitLogin       = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
                GitAuthor      = new GitAuthorInfo("FacilityApiBot", "*****@*****.**"),
                SourceCodeUrl  = "https://github.com/FacilityApi/Facility/tree/master/src",
                ProjectHasDocs = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
            },
        };

        build.AddDotNetTargets(dotNetBuildSettings);

        build.Target("codegen")
        .DependsOn("build")
        .Describe("Generates code from the FSD")
        .Does(() => CodeGen(verify: false));

        build.Target("verify-codegen")
        .DependsOn("build")
        .Describe("Ensures the generated code is up-to-date")
        .Does(() => CodeGen(verify: true));

        build.Target("test")
        .DependsOn("verify-codegen");

        void CodeGen(bool verify)
        {
            var configuration = dotNetBuildSettings !.BuildOptions !.ConfigurationOption !.Value;
            var toolPath      = FindFiles($"src/{codegen}/bin/{configuration}/netcoreapp3.1/{codegen}.dll").FirstOrDefault();

            var verifyOption = verify ? "--verify" : null;

            RunDotNet(toolPath, "example/ExampleApi.fsd", "example/output", "--newline", "lf", verifyOption);
            RunDotNet(toolPath, "example/ExampleApi.fsd.md", "example/output", "--newline", "lf", "--verify");

            RunDotNet(toolPath, "example/ExampleApi.fsd", "example/output/ExampleApi-nowidgets.fsd", "--excludeTag", "widgets", "--newline", "lf", verifyOption);
            RunDotNet(toolPath, "example/ExampleApi.fsd.md", "example/output/ExampleApi-nowidgets.fsd", "--excludeTag", "widgets", "--newline", "lf", "--verify");
        }
    });
Beispiel #9
0
 public static int Main(string[] args) => BuildRunner.Execute(args, build =>
 {
     build.AddDotNetTargets(
         new DotNetBuildSettings
     {
         NuGetApiKey  = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
         DocsSettings = new DotNetDocsSettings
         {
             GitLogin      = new GitLoginInfo("faithlifebuildbot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
             GitAuthor     = new GitAuthorInfo("Faithlife Build Bot", "*****@*****.**"),
             SourceCodeUrl = "https://github.com/Faithlife/FaithlifeTesting/tree/master/src",
         },
         PackageSettings = new DotNetPackageSettings
         {
             FindProjects = () => NugetPackages.ProjectsToPublish,
         },
     });
 });
Beispiel #10
0
    public static int Main(string[] args) => BuildRunner.Execute(args, build =>
    {
        var dotNetBuildSettings = new DotNetBuildSettings
        {
            NuGetApiKey = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
        };
        build.AddDotNetTargets(dotNetBuildSettings);

        build.Target("generate-docs")
        .Describe("Generates documentation")
        .DependsOn("build")
        .Does(() => GenerateDocs(dotNetBuildSettings, verify: false));

        build.Target("verify-docs")
        .Describe("Verifies generated documentation")
        .DependsOn("build")
        .Does(() => GenerateDocs(dotNetBuildSettings, verify: true));

        build.Target("test")
        .DependsOn("verify-docs");
    });
Beispiel #11
0
    public static int Main(string[] args) => BuildRunner.Execute(args, build =>
    {
        var buildOptions = new DotNetBuildOptions();

        build.AddDotNetTargets(
            new DotNetBuildSettings
        {
            BuildOptions = buildOptions,
            Verbosity    = DotNetBuildVerbosity.Minimal,
        });

        build.Target("package")
        .Describe("Creates a standalone executable")
        .ClearActions()
        .Does(() =>
        {
            RunDotNet("publish",
                      Path.Combine("src", "LaunchGlob", "LaunchGlob.csproj"),
                      "-c", buildOptions.ConfigurationOption !.Value,
                      "-r", "win-x86",
                      "--self-contained", "true",
                      "-p:PublishSingleFile=true",
                      "-p:PublishTrimmed=true");
Beispiel #12
0
    public static int Main(string[] args) => BuildRunner.Execute(args, build =>
    {
        var dotNetBuildSettings = new DotNetBuildSettings
        {
            ProjectUsesSourceLink = name => name == "XmlDocMarkdown.Core" || name == "Cake.XmlDocMarkdown",
        };
        build.AddDotNetTargets(dotNetBuildSettings);

        build.Target("generate-docs")
        .Describe("Generates documentation")
        .DependsOn("build")
        .Does(() => GenerateDocs(dotNetBuildSettings, verify: false));

        build.Target("verify-docs")
        .Describe("Verifies generated documentation")
        .DependsOn("build")
        .Does(() => GenerateDocs(dotNetBuildSettings, verify: true));

        build.Target("test")
        .DependsOn("verify-docs");

        build.Target("default")
        .DependsOn("build");
    });
Beispiel #13
0
    public static int Main(string[] args) => BuildRunner.Execute(args, build =>
    {
        var codegen = "fsdgenpython";

        var dotNetBuildSettings = new DotNetBuildSettings
        {
            NuGetApiKey  = Environment.GetEnvironmentVariable("NUGET_API_KEY"),
            DocsSettings = new DotNetDocsSettings
            {
                GitLogin       = new GitLoginInfo("FacilityApiBot", Environment.GetEnvironmentVariable("BUILD_BOT_PASSWORD") ?? ""),
                GitAuthor      = new GitAuthorInfo("FacilityApiBot", "*****@*****.**"),
                SourceCodeUrl  = "https://github.com/FacilityApi/FacilityPython/tree/master/src",
                ProjectHasDocs = name => !name.StartsWith("fsdgen", StringComparison.Ordinal),
            },
            Verbosity     = DotNetBuildVerbosity.Minimal,
            CleanSettings = new DotNetCleanSettings
            {
                FindDirectoriesToDelete = () => s_directoriesToDelete,
            },
        };

        build.AddDotNetTargets(dotNetBuildSettings);

        build.Target("codegen")
        .DependsOn("build")
        .Describe("Generates code from the FSD")
        .Does(() => CodeGen(verify: false));

        build.Target("verify-codegen")
        .DependsOn("build")
        .Describe("Ensures the generated code is up-to-date")
        .Does(() => CodeGen(verify: true));

        build.Target("test")
        .DependsOn("verify-codegen");

        build.Target("pip")
        .DependsOn("clean")
        .DependsOn("verify-codegen")
        .Describe("Creates a pip package")
        .Does(() => CreatePipPackage());

        build.Target("pip-publish")
        .DependsOn("pip")
        .Describe("Publishes a pip package")
        .Does(() => PublishPipPackage());

        build.Target("try-pip-publish")
        .DependsOn("pip")
        .Describe("Publishes a pip package. Ignores failure.")
        .Does(() => PublishPipPackage(ignoreFailure: true));

        void CodeGen(bool verify)
        {
            var configuration = dotNetBuildSettings !.BuildOptions !.ConfigurationOption !.Value;
            var toolPath      = FindFiles($"src/{codegen}/bin/{configuration}/netcoreapp3.1/{codegen}.dll").FirstOrDefault();

            var verifyOption = verify ? "--verify" : null;

            RunDotNet("tool", "restore");
            RunDotNet("tool", "run", "FacilityConformance", "fsd", "--output", "conformance/ConformanceApi.fsd", verifyOption);

            RunDotNet(toolPath, "conformance/ConformanceApi.fsd", "conformance/", "--newline", "lf", verifyOption);
        }
 public void NullInitializeThrows()
 {
     Assert.Throws <ArgumentNullException>(() => BuildRunner.Execute(new string[0], null !));
 }
 public void NullInitializeThrows()
 {
     Assert.Throws <ArgumentNullException>(() => BuildRunner.Execute(Array.Empty <string>(), null !));
 }
 public void NullArgsThrows()
 {
     Assert.Throws <ArgumentNullException>(() => BuildRunner.Execute(null, app => { }));
 }