Ejemplo n.º 1
0
    public static BuildVersion Calculate(Context context)
    {
        context.Information("Calculating semantic version...");
        if (context.CoreOnly)
        {
            context.Information("Skipping GitVersion query for local build");
            return(new BuildVersion("0.0.0", "dev"));
        }

        if (!context.IsLocalBuild)
        {
            // Run to set the version properties inside the CI server
            GitVersionRunner.Run(context, GitVersionOutput.BuildServer);
        }

        // Run in interactive mode to get the properties for the rest of the script
        var assertedversions = GitVersionRunner.Run(context, GitVersionOutput.Json);

        var version    = assertedversions.MajorMinorPatch;
        var semVersion = assertedversions.LegacySemVerPadded;

        if (string.IsNullOrWhiteSpace(version))
        {
            throw new CakeException("Could not calculate version of build.");
        }

        return(new BuildVersion(version, semVersion.Substring(version.Length).TrimStart('-')));
    }
Ejemplo n.º 2
0
    public static BuildVersion Calculate(Context context)
    {
        string version    = null;
        string semVersion = null;
        string fullSemVer = null;

        context.Information("Calculating semantic version...");

        if (!context.IsLocalBuild)
        {
            // Run to set the version properties inside the CI server
            GitVersionRunner.Run(context, GitVersionOutput.BuildServer);
        }

        // Run in interactive mode to get the properties for the rest of the script
        var assertedversions = GitVersionRunner.Run(context, GitVersionOutput.Json);

        version    = assertedversions.MajorMinorPatch;
        semVersion = assertedversions.LegacySemVerPadded;
        fullSemVer = assertedversions.FullSemVer;

        if (string.IsNullOrWhiteSpace(version))
        {
            throw new CakeException("Could not calculate version of build.");
        }

        return(new BuildVersion(version, semVersion.Substring(version.Length).TrimStart('-'), fullSemVer));
    }
Ejemplo n.º 3
0
    public static GitVersion GitVersion(this ICakeContext context, GitVersionSettings settings)
    {
        if (context == null)
        {
            throw new ArgumentNullException(nameof(context));
        }

        var gitVersionRunner = new GitVersionRunner(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools, context.Log);

        return(gitVersionRunner.Run(settings));
    }
Ejemplo n.º 4
0
        protected override void RunTool()
        {
            var tool = new GitVersionRunner(FileSystem, Environment, ProcessRunner, Tools, Log);

            tool.Run(Settings);
        }
Ejemplo n.º 5
0
        public GitVersion RunGitVersion()
        {
            var tool = new GitVersionRunner(FileSystem, Environment, ProcessRunner, Tools, Log);

            return(tool.Run(Settings));
        }