[go: nahoru, domu]

Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(524)
Delta Between Two Patch Sets: Tools/Google.Apis.NuGet.Publisher/Google.Apis.NuGet.Publisher/Program.cs
Issue 12662047: Issue 376: Generate NuGet pacakges for generated APIs (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Left Patch Set: David comments Created 10 years, 10 months ago
Right Patch Set: David final comments Created 10 years, 10 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
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
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 /// The Google APIs NuGet publisher uses a local folder "C:\LocalNuGetFeed" to store all the NuGet packages 78 /// The Google APIs NuGet publisher uses a local folder "C:\LocalNuGetFeed" to store all the NuGet packages
79 /// locally. 79 /// locally.
80 /// Notice also the different between bundle and package: 80 /// Notice also the different between bundle and package:
81 /// A bundle is the zip file that contains the sources, and it's is download ed from 81 /// A bundle is the zip file that contains the sources, and it's is download ed from
82 /// "https://google-api-client-libraries.appspot.com/" 82 /// "https://google-api-client-libraries.appspot.com/"
83 /// A package is the NuGet package we use to build a solution. We can store NuGet packages locally (e.g. in 83 /// A package is the NuGet package we use to build a solution. We can store NuGet packages locally (e.g. in
84 /// "C:\LocalNuGetFeed") or use the main NuGet repository at "https://nuget. org/api/v2/" 84 /// "C:\LocalNuGetFeed") or use the main NuGet repository at "https://nuget. org/api/v2/"
85 /// </remarks> 85 /// </remarks>
86 class Program 86 class Program
87 { 87 {
88 static TraceSource TraceSource = new TraceSource("Google.Apis"); 88 private static TraceSource TraceSource = new TraceSource("Google.Apis");
89 89
90 /// <summary>The discovery URI to get all the public APIs.</summary> 90 /// <summary>The discovery URI to get all the public APIs.</summary>
91 static readonly Uri DiscoveryApiUri = new Uri(@"https://www.googleapis.c om/discovery/v1/apis"); 91 static readonly Uri DiscoveryApiUri = new Uri(@"https://www.googleapis.c om/discovery/v1/apis");
92 92
93 /// <summary>The download URI format to download a specific API format. Two parameters are expected the API· 93 /// <summary>The download URI format to download a specific API format. Two parameters are expected the API·
94 /// name and its version.</summary> 94 /// name and its version.</summary>
95 const string DownloadUriFormat = 95 const string DownloadUriFormat =
96 "https://google-api-client-libraries.appspot.com/resources/api-libra ries/download/stable/" + 96 "https://google-api-client-libraries.appspot.com/download/library/{0 }/{1}/csharp?deps=0";
97 "{0}/{1}/csharp?deps=0";
98 97
99 /// <summary>The template directory which contains the '.nuget' director y and the necessary·· 98 /// <summary>The template directory which contains the '.nuget' director y and the necessary··
100 /// 'Microsoft.Bcl.Build.targets' file.</summary> 99 /// 'Microsoft.Bcl.Build.targets' file.</summary>
101 readonly string TemplateDirectory; 100 readonly string TemplateDirectory;
102 101
103 /// <summary>The directory that the bundle will be downloaded to.</summa ry> 102 /// <summary>The directory that the bundle will be downloaded to.</summa ry>
104 readonly string DownloadBundleTempDirectory = Path.Combine(Path.GetTempP ath(), "GoogleAPIsPublisher"); 103 readonly string DownloadBundleTempDirectory = Path.Combine(Path.GetTempP ath(), "GoogleAPIsPublisher");
105 104
106 /// <summary>The program's options.</summary> 105 /// <summary>The program's options.</summary>
107 readonly Options options; 106 readonly Options options;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 174
176 IEnumerable<DiscoveryItem> apis; 175 IEnumerable<DiscoveryItem> apis;
177 if (options.AllApis) 176 if (options.AllApis)
178 { 177 {
179 apis = await new DiscoveryService().GetApis(DiscoveryApiUri); 178 apis = await new DiscoveryService().GetApis(DiscoveryApiUri);
180 } 179 }
181 else 180 else
182 { 181 {
183 apis = new List<DiscoveryItem> { new DiscoveryItem 182 apis = new List<DiscoveryItem> { new DiscoveryItem
184 { 183 {
185 Name = options.ApiName, 184 Name = options.ApiName.ToLower(),
186 Version = options.ApiVersion 185 Version = options.ApiVersion.ToLower()
187 }}; 186 }};
188 } 187 }
189 188
190 if (Directory.Exists(DownloadBundleTempDirectory)) 189 if (Directory.Exists(DownloadBundleTempDirectory))
191 { 190 {
192 Directory.Delete(DownloadBundleTempDirectory, true); 191 Directory.Delete(DownloadBundleTempDirectory, true);
193 } 192 }
194 Directory.CreateDirectory(DownloadBundleTempDirectory); 193 Directory.CreateDirectory(DownloadBundleTempDirectory);
195 194
196 try 195 try
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 await publisher.Test(options.ApisDirectory); 258 await publisher.Test(options.ApisDirectory);
260 } 259 }
261 catch (Exception ex) 260 catch (Exception ex)
262 { 261 {
263 TraceSource.TraceEvent(TraceEventType.Error, "{0}\t Exceptio n [{1}] occurred", item, ex.Message); 262 TraceSource.TraceEvent(TraceEventType.Error, "{0}\t Exceptio n [{1}] occurred", item, ex.Message);
264 } 263 }
265 } 264 }
266 } 265 }
267 } 266 }
268 } 267 }
LEFTRIGHT

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