コード例 #1
0
ファイル: Program.cs プロジェクト: samboman/VersionTools
        public static void HandleSetAction(setArgs args)
        {
            RootVersion = args.version.Length > 0 ? Semver.Parse(args.version) : Semver.NoVersion;
            var hasBuild = args.build.Length > 0;

            var scanner  = new ProjectScanner();
            var projects = scanner.Scan(RootVersion, args.scan);

            VerboseOut(Verbose.Scanning, "Scan done; found {0} projects", projects.Length);

            if (args.@override && RootVersion == Semver.NoVersion)
            {
                VerboseOut(Verbose.Warning,
                           "No root version set; all versions will be overridden with {0}", Semver.NoVersion);
            }

            if (hasBuild)
            {
                RootVersion = RootVersion.OverrideBuild(args.build);
            }

            if (args.tcbuildno)
            {
                Console.Out.WriteLine("##teamcity[buildNumber '{0}']", RootVersion);
            }

            foreach (var project in projects)
            {
                VerboseOut(Verbose.Version, "Versioning project {0}", project.Name);
                if (args.@override && RootVersion != Semver.NoVersion)
                {
                    VerboseOut(Verbose.Version, "Overriding version {0} => {1}", project.Version, RootVersion);
                    project.Version = RootVersion;
                }
                if (hasBuild)
                {
                    VerboseOut(Verbose.Version, "Overriding build {0} => {1}", project.Version.Build, args.build);
                    project.Version = project.Version.OverrideBuild(args.build);
                }

                AssemblyVersionSetter.SetVersion(project.AssemlyInfo, project.Version);
                NuspecVersionSetter.SetVersion(project.Nuspec, project.Version);
            }
        }
コード例 #2
0
ファイル: ProgramArgs.cs プロジェクト: samboman/VersionTools
 public static void set(setArgs args)
 {
     SetAction(args);
 }