Exemplo n.º 1
0
        public override object GetValue(MemberInfo member, object instance)
        {
            // TODO: https://github.com/GitTools/GitVersion/issues/1097
            if (EnvironmentInfo.IsUnix && DisableOnUnix)
            {
                Logger.Warn($"{nameof(GitVersion)} is disabled on UNIX environment.");
                return(null);
            }

            var gitVersion = GitVersionTasks.GitVersion(s => s
                                                        .SetFramework(Framework)
                                                        .SetNoFetch(NoFetch)
                                                        .DisableLogOutput()
                                                        .SetUpdateAssemblyInfo(UpdateAssemblyInfo))
                             .Result;

            if (UpdateBuildNumber)
            {
                AzurePipelines.Instance?.UpdateBuildNumber(gitVersion.FullSemVer);
                TeamCity.Instance?.SetBuildNumber(gitVersion.FullSemVer);
                AppVeyor.Instance?.UpdateBuildNumber(gitVersion.FullSemVer);
            }

            return(gitVersion);
        }
Exemplo n.º 2
0
        public override object GetValue(MemberInfo member, object instance)
        {
            // TODO: https://github.com/GitTools/GitVersion/issues/1097
            if (EnvironmentInfo.IsUnix && DisableOnUnix)
            {
                Logger.Warn($"{nameof(GitVersion)} is disabled on UNIX environment.");
                return(null);
            }

            var repository = SuppressErrors(() => GitRepository.FromLocalDirectory(NukeBuild.RootDirectory));

            AssertWarn(repository == null || repository.Protocol != GitProtocol.Ssh || NoFetch,
                       $"{nameof(GitVersion)} does not support fetching SSH endpoints. Enable {nameof(NoFetch)} to skip fetching.");

            var gitVersion = GitVersionTasks.GitVersion(s => s
                                                        .SetFramework(Framework)
                                                        .SetNoFetch(NoFetch)
                                                        .DisableProcessLogOutput()
                                                        .SetUpdateAssemblyInfo(UpdateAssemblyInfo))
                             .Result;

            if (UpdateBuildNumber)
            {
                AzurePipelines.Instance?.UpdateBuildNumber(gitVersion.FullSemVer);
                TeamCity.Instance?.SetBuildNumber(gitVersion.FullSemVer);
                AppVeyor.Instance?.UpdateBuildVersion($"{gitVersion.FullSemVer}.build.{AppVeyor.Instance.BuildNumber}");
            }

            return(gitVersion);
        }
Exemplo n.º 3
0
        public override object GetStaticValue()
        {
            // TODO: https://github.com/GitTools/GitVersion/issues/1097
            if (EnvironmentInfo.IsUnix && DisableOnUnix)
            {
                Logger.Warn($"{nameof(GitVersion)} is disabled on UNIX environment.");
                return(null);
            }

            return(Value = GitVersionTasks.GitVersion(s => GitVersionTasks.DefaultGitVersion).Result);
        }
Exemplo n.º 4
0
        public override object GetStaticValue()
        {
            // TODO: https://github.com/GitTools/GitVersion/issues/1097
            if (EnvironmentInfo.IsUnix && DisableOnUnix)
            {
                Logger.Warn($"{nameof(GitVersion)} is disabled on UNIX environment.");
                return(null);
            }

            return(Value = GitVersionTasks.GitVersion(s => s
                                                      .SetWorkingDirectory(NukeBuild.Instance.RootDirectory)
                                                      .DisableLogOutput())
                           .Result);
        }
Exemplo n.º 5
0
        public override object GetStaticValue()
        {
            // TODO: https://github.com/GitTools/GitVersion/issues/1097
            if (EnvironmentInfo.IsUnix)
            {
                Logger.Warn($"{nameof(GitVersion)} does not work in UNIX environments.");
                return(null);
            }

            return(Value = Value ??
                           GitVersionTasks.GitVersion(
                       s => GitVersionTasks.DefaultGitVersion,
                       new ProcessSettings().EnableRedirectOutput()));
        }
Exemplo n.º 6
0
        public override object GetValue(MemberInfo member, object instance)
        {
            // TODO: https://github.com/GitTools/GitVersion/issues/1097
            if (EnvironmentInfo.IsUnix && DisableOnUnix)
            {
                Logger.Warn($"{nameof(GitVersion)} is disabled on UNIX environment.");
                return(null);
            }

            return(ControlFlow.SuppressErrors(() =>
                                              GitVersionTasks.GitVersion(s => s
                                                                         .DisableLogOutput())
                                              .Result,
                                              includeStackTrace: true));
        }
Exemplo n.º 7
0
        public override object GetValue(MemberInfo member, object instance)
        {
            // TODO: https://github.com/GitTools/GitVersion/issues/1097
            if (EnvironmentInfo.IsUnix && DisableOnUnix)
            {
                Logger.Warn($"{nameof(GitVersion)} is disabled on UNIX environment.");
                return(null);
            }

            return(GitVersionTasks.GitVersion(s => s
                                              .SetFramework("netcoreapp3.0")
                                              .DisableLogOutput()
                                              .SetUpdateAssemblyInfo(UpdateAssemblyInfo))
                   .Result);
        }
Exemplo n.º 8
0
 private static GitVersion GetVersion()
 {
     return(GitVersionTasks.GitVersion(
                s => GitVersionTasks.DefaultGitVersion,
                new ProcessSettings().EnableRedirectOutput()));
 }
Exemplo n.º 9
0
 private string GetToolPath()
 {
     return(GitVersionTasks.GetToolPath(Framework));
 }