Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1392)

Delta Between Two Patch Sets: Tools/Google.Apis.Release/ProjectExtenstions.cs

Issue 12767046: Issue 377: New build for releasing a new version (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Left Patch Set: self review II Created 10 years, 6 months ago
Right Patch Set: david comments Created 10 years, 6 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « Tools/Google.Apis.Release/Program.cs ('k') | Tools/Google.Apis.Release/Properties/AssemblyInfo.cs » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 Copyright 2013 Google Inc 2 Copyright 2013 Google Inc
3 3
4 Licensed under the Apache License, Version 2.0 (the "License"); 4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License. 5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at 6 You may obtain a copy of the License at
7 7
8 http://www.apache.org/licenses/LICENSE-2.0 8 http://www.apache.org/licenses/LICENSE-2.0
9 9
10 Unless required by applicable law or agreed to in writing, software 10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS, 11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and 13 See the License for the specific language governing permissions and
14 limitations under the License. 14 limitations under the License.
15 */ 15 */
16 16
17 using System; 17 using System;
18 using System.Collections.Generic;
19 using System.Diagnostics; 18 using System.Diagnostics;
20 using System.IO; 19 using System.IO;
21 using System.Linq; 20 using System.Linq;
22 using System.Text;
23 using System.Threading.Tasks;
24 21
25 using Microsoft.Build.Evaluation; 22 using Microsoft.Build.Evaluation;
26 23
27 using Google.Apis.Utils; 24 using Google.Apis.Utils;
25 using Google.Apis.Utils.Trace;
28 26
29 namespace Google.Apis.Release 27 namespace Google.Apis.Release
30 { 28 {
31 /// <summary>Project extensions.</summary> 29 /// <summary>
32 static class ProjectExtenstions 30 /// Extension methods for the Project class.·
31 /// Add support in getting the short name of the project and also in replaci ng the current library version with·
32 /// the new version (<see cref="ReplaceVersion"/>).
33 /// </summary>
34 internal static class ProjectExtenstions
33 { 35 {
34 static readonly TraceSource TraceSource = new TraceSource("Google.Apis") ; 36 static readonly TraceSource TraceSource = new TraceSource("Google.Apis") ;
35 37
36 /// <summary>Gets the name of the project.</summary> 38 /// <summary>Gets the name of the project.</summary>
37 public static string GetName(this Project project) 39 public static string GetName(this Project project)
38 { 40 {
39 return project.DirectoryPath.Substring(project.DirectoryPath.LastInd exOf(Path.DirectorySeparatorChar) + 1); 41 return project.DirectoryPath.Substring(project.DirectoryPath.LastInd exOf(Path.DirectorySeparatorChar) + 1);
40 } 42 }
41 43
42 /// <summary>Replaces Assembly version number with the given one.</summa ry> 44 /// <summary>Replaces Assembly version number with the given one.</summa ry>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 private static string ReplaceVersionInLine(string line, string assemblyV ersionPrefix, string newVersion) 76 private static string ReplaceVersionInLine(string line, string assemblyV ersionPrefix, string newVersion)
75 { 77 {
76 var startVersion = assemblyVersionPrefix.Length; 78 var startVersion = assemblyVersionPrefix.Length;
77 // '.*' ends the old version number (e.g 1.2.* or 1.2.0.*) 79 // '.*' ends the old version number (e.g 1.2.* or 1.2.0.*)
78 var endVersion = line.IndexOf(".*", startVersion); 80 var endVersion = line.IndexOf(".*", startVersion);
79 var oldVersion = line.Substring(startVersion, endVersion - startVers ion); 81 var oldVersion = line.Substring(startVersion, endVersion - startVers ion);
80 return line.Replace(assemblyVersionPrefix + oldVersion, assemblyVers ionPrefix + newVersion); 82 return line.Replace(assemblyVersionPrefix + oldVersion, assemblyVers ionPrefix + newVersion);
81 } 83 }
82 } 84 }
83 } 85 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b