diff --git a/.gitignore b/.gitignore index 8e265262ad..7231f013b1 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ Backup* project.lock.json *~ .DS_Store +.cr msbuild.log TestResult.xml diff --git a/ClientGenerator/src/googleapis/codegen/languages/csharp/default/features.json b/ClientGenerator/src/googleapis/codegen/languages/csharp/default/features.json index 8b6afe6507..e05cf0ec9a 100644 --- a/ClientGenerator/src/googleapis/codegen/languages/csharp/default/features.json +++ b/ClientGenerator/src/googleapis/codegen/languages/csharp/default/features.json @@ -1,7 +1,7 @@ { "language": "csharp", "description": "C# libraries for Google APIs.", - "releaseVersion": "1.17.0", - "nugetVersion": "1.17.0", + "releaseVersion": "1.18.0", + "nugetVersion": "1.18.0", "oldCompatibleVersion": "1.10.0" } diff --git a/ClientGenerator/src/googleapis/codegen/languages/csharp/default/templates/___package_name___/___package_name___.nuspec.tmpl b/ClientGenerator/src/googleapis/codegen/languages/csharp/default/templates/___package_name___/___package_name___.nuspec.tmpl index 453fb50a42..607c543818 100644 --- a/ClientGenerator/src/googleapis/codegen/languages/csharp/default/templates/___package_name___/___package_name___.nuspec.tmpl +++ b/ClientGenerator/src/googleapis/codegen/languages/csharp/default/templates/___package_name___/___package_name___.nuspec.tmpl @@ -12,13 +12,14 @@ Google {% camel_case api.name %} {{ api.version }} API client library Google APIs Client Library for working with {% camel_case api.name %} {{ api.version }}. + Supported Platforms: - - .NET Framework 4 and 4.5+ + - .NET Framework 4.5 and 4.6 - NetStandard1.3 - - Windows Store apps + - Windows 8 Apps - Windows Phone 8 and 8.1 diff --git a/GeneratedLibraries.proj b/GeneratedLibraries.proj index 2ababbea07..41bd369975 100644 --- a/GeneratedLibraries.proj +++ b/GeneratedLibraries.proj @@ -17,6 +17,10 @@ --> + + $(MSBuildThisFileDirectory)Src\Tools\ + + $(MSBuildThisFileDirectory)DiscoveryJson\ $(MSBuildThisFileDirectory)Src\Generated\ @@ -28,22 +32,32 @@ - + - + - + + + + + + + + + - + <_GenerateLibraryTool>ClientGenerator\generate_library.cmd - <_DiscoveryDocument Include="DiscoveryJson\*.json" /> + <_DiscoveryDocument Include="$(DiscoveryDocumentsDir)\*.json" /> @@ -72,9 +86,6 @@ - - - @@ -125,7 +136,7 @@ - + diff --git a/README.md b/README.md index 72d1d4e3b4..08bb77f9c3 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,9 @@ The Google API client library for .NET enables access to Google APIs such as Dri Supported Platforms ================================= -* .NET Framework 4.5 -* Windows Store apps +* .NET Framework 4.5 and 4.6 +* .NET Core (via netstandard1.3 support) +* Windows 8 Apps * Windows Phone 8 and 8.1 * Portable Class Libraries diff --git a/Src/Support/CommonAssemblyInfo.cs b/Src/Support/CommonAssemblyInfo.cs index 54aae25366..d6158c9f59 100644 --- a/Src/Support/CommonAssemblyInfo.cs +++ b/Src/Support/CommonAssemblyInfo.cs @@ -21,7 +21,7 @@ limitations under the License. [assembly: AssemblyCompany("Google Inc")] [assembly: AssemblyCopyright("Copyright 2016 Google Inc")] -[assembly: AssemblyVersion("1.17.0.0")] +[assembly: AssemblyVersion("1.18.0.0")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] diff --git a/Src/Support/GoogleApis.Auth/Google.Apis.Auth.nuspec b/Src/Support/GoogleApis.Auth/Google.Apis.Auth.nuspec index b75cc53353..807e376bb2 100644 --- a/Src/Support/GoogleApis.Auth/Google.Apis.Auth.nuspec +++ b/Src/Support/GoogleApis.Auth/Google.Apis.Auth.nuspec @@ -15,11 +15,11 @@ Supported Platforms: - - .NET Framework 4.5 + - .NET Framework 4.5 and 4.6 - NetStandard1.3 - - Windows Store apps + - Windows 8 Apps - Windows Phone 8 and 8.1 diff --git a/Src/Support/GoogleApis.Core/Google.Apis.Core.nuspec b/Src/Support/GoogleApis.Core/Google.Apis.Core.nuspec index 92ee15b36d..dde6f50cac 100644 --- a/Src/Support/GoogleApis.Core/Google.Apis.Core.nuspec +++ b/Src/Support/GoogleApis.Core/Google.Apis.Core.nuspec @@ -14,14 +14,14 @@ Supported Platforms: - - .NET Framework 4.5 - - - NetStandard1.3 + - .NET Framework 4.5 and 4.6 - - Windows Store apps + - NetStandard1.3 + + - Windows 8 Apps - Windows Phone 8 and 8.1 - + - Portable Class Libraries Google diff --git a/Src/Support/GoogleApis/Google.Apis.nuspec b/Src/Support/GoogleApis/Google.Apis.nuspec index 5712a391e2..a2b6e4e7bd 100644 --- a/Src/Support/GoogleApis/Google.Apis.nuspec +++ b/Src/Support/GoogleApis/Google.Apis.nuspec @@ -15,11 +15,11 @@ Supported Platforms: - - .NET Framework 4.5 - - - NetStandard1.3 + - .NET Framework 4.5 and 4.6 - - Windows Store apps + - NetStandard1.3 + + - Windows 8 Apps - Windows Phone 8 and 8.1 diff --git a/Src/Tools/DiscoveryDocPatcher/App.config b/Src/Tools/DiscoveryDocPatcher/App.config new file mode 100644 index 0000000000..9c05822ff5 --- /dev/null +++ b/Src/Tools/DiscoveryDocPatcher/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Src/Tools/DiscoveryDocPatcher/DiscoveryDocPatcher.csproj b/Src/Tools/DiscoveryDocPatcher/DiscoveryDocPatcher.csproj new file mode 100644 index 0000000000..11f1fae600 --- /dev/null +++ b/Src/Tools/DiscoveryDocPatcher/DiscoveryDocPatcher.csproj @@ -0,0 +1,66 @@ + + + + + Debug + AnyCPU + {555463EC-9010-41E3-BCBD-76903F663102} + Exe + Properties + DiscoveryDocPatcher + DiscoveryDocPatcher + v4.5.1 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + True + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Src/Tools/DiscoveryDocPatcher/DiscoveryDocPatcher.sln b/Src/Tools/DiscoveryDocPatcher/DiscoveryDocPatcher.sln new file mode 100644 index 0000000000..d23ed0b5ef --- /dev/null +++ b/Src/Tools/DiscoveryDocPatcher/DiscoveryDocPatcher.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscoveryDocPatcher", "DiscoveryDocPatcher.csproj", "{555463EC-9010-41E3-BCBD-76903F663102}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {555463EC-9010-41E3-BCBD-76903F663102}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {555463EC-9010-41E3-BCBD-76903F663102}.Debug|Any CPU.Build.0 = Debug|Any CPU + {555463EC-9010-41E3-BCBD-76903F663102}.Release|Any CPU.ActiveCfg = Release|Any CPU + {555463EC-9010-41E3-BCBD-76903F663102}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Src/Tools/DiscoveryDocPatcher/Patcher.cs b/Src/Tools/DiscoveryDocPatcher/Patcher.cs new file mode 100644 index 0000000000..f0a20022b8 --- /dev/null +++ b/Src/Tools/DiscoveryDocPatcher/Patcher.cs @@ -0,0 +1,98 @@ +/* +Copyright 2016 Google Inc + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +using Newtonsoft.Json.Linq; +using System; +using System.IO; + +namespace DiscoveryDocPatcher +{ + class Patcher + { + public static Patcher Load(string path) => + new Patcher(path, JObject.Parse(File.ReadAllText(path))); + + private readonly string _path; + private readonly JObject _json; + private bool changed = false; + + private Patcher(string path, JObject json) + { + _path = path; + _json = json; + } + + public void SaveWithBackup() + { + if (changed) + { + File.Move(_path, _path + ".original"); + string json = _json.ToString(); + File.WriteAllText(_path, json); + } + } + + public void Remove(string jPath, JToken oldToken, JToken replacedToken) + { + // replacedToken is used if this remove operation has already been carried + // out on this jPath. It contains the token that is expected to be at the + // jPath *after* the remove operation. + var token = _json.SelectToken(jPath); + if (!JToken.DeepEquals(token, oldToken)) + { + if (JToken.DeepEquals(token, replacedToken)) + { + // Already replaced, so do nothing. + return; + } + throw new InvalidOperationException("Content wrong"); + } + changed = true; + token.Remove(); + } + + public void Remove(string jPath, string oldContent, string replacedContent) + { + // Single quotes replaced with double quotes, to ease caller string literals. + JToken oldToken = JToken.Parse(oldContent.Replace('\'', '"')); + JToken replacedToken = JToken.Parse(replacedContent.Replace('\'', '"')); + Remove(jPath, oldToken, replacedToken); + } + + public void Replace(string jPath, JToken oldToken, JToken newToken) + { + var token = _json.SelectToken(jPath); + if (!JToken.DeepEquals(token, oldToken)) + { + if (JToken.DeepEquals(token, newToken)) + { + // Already replaced, so do nothing. + return; + } + throw new InvalidOperationException("Content wrong"); + } + changed = true; + token.Replace(newToken); + } + + public void Replace(string jPath, string oldContent, string newContent) + { + // Single quotes replaced with double quotes, to ease caller string literals. + JToken oldToken = JToken.Parse(oldContent.Replace('\'', '"')); + JToken newToken = JToken.Parse(newContent.Replace('\'', '"')); + Replace(jPath, oldToken, newToken); + } + } +} diff --git a/Src/Tools/DiscoveryDocPatcher/Program.cs b/Src/Tools/DiscoveryDocPatcher/Program.cs new file mode 100644 index 0000000000..0edde5e253 --- /dev/null +++ b/Src/Tools/DiscoveryDocPatcher/Program.cs @@ -0,0 +1,68 @@ +/* +Copyright 2016 Google Inc + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +using System; +using System.IO; + +namespace DiscoveryDocPatcher +{ + + class Program + { + static int Main(string[] args) + { + try + { + string discoveryDocPath = args[0]; + PatchGames(discoveryDocPath); + PatchDirectory(discoveryDocPath); + return 0; + } + catch (Exception e) + { + Console.WriteLine(e); + return 1; + } + } + + static void PatchGames(string rootPath) + { + var patcher = Patcher.Load(Path.Combine(rootPath, "games_v1.json")); + // Remove deprecated enum value that causes duplicate C# enum value. + patcher.Remove("resources.players.methods.list.parameters.collection.enum[1]", "'playedWith'", "'played_with'"); + patcher.Remove("resources.players.methods.list.parameters.collection.enumDescriptions[1]", + "'(DEPRECATED: please use played_with!) Retrieve a list of players you have played a multiplayer game (realtime or turn-based) with recently.'", + "'Retrieve a list of players you have played a multiplayer game (realtime or turn-based) with recently.'"); + patcher.SaveWithBackup(); + } + + static void PatchDirectory(string rootPath) + { + var patcher = Patcher.Load(Path.Combine(rootPath, "admin_directory_v1.json")); + // Strongly-type properties that are defined without typing. + patcher.Replace("schemas.User.properties.addresses", "{ 'type': 'any' }", "{ 'type': 'array', 'items': { '$ref': 'UserAddress' } }"); + patcher.Replace("schemas.User.properties.emails", "{ 'type': 'any' }", "{ 'type': 'array', 'items': { '$ref': 'UserEmail' } }"); + patcher.Replace("schemas.User.properties.externalIds", "{ 'type': 'any' }", "{ 'type': 'array', 'items': { '$ref': 'UserExternalId' } }"); + patcher.Replace("schemas.User.properties.ims", "{ 'type': 'any' }", "{ 'type': 'array', 'items': { '$ref': 'UserIm' } }"); + patcher.Replace("schemas.User.properties.organizations", "{ 'type': 'any' }", "{ 'type': 'array', 'items': { '$ref': 'UserOrganization' } }"); + patcher.Replace("schemas.User.properties.phones", "{ 'type': 'any' }", "{ 'type': 'array', 'items': { '$ref': 'UserPhone' } }"); + patcher.Replace("schemas.User.properties.relations", "{ 'type': 'any' }", "{ 'type': 'array', 'items': { '$ref': 'UserRelation' } }"); + patcher.Replace("schemas.User.properties.websites", "{ 'type': 'any' }", "{ 'type': 'array', 'items': { '$ref': 'UserWebsite' } }"); + patcher.Replace("schemas.Aliases.properties.aliases.items", "{ 'type': 'any' }", "{ '$ref': 'Alias' }"); + patcher.SaveWithBackup(); + + } + } +} diff --git a/Src/Tools/DiscoveryDocPatcher/Properties/AssemblyInfo.cs b/Src/Tools/DiscoveryDocPatcher/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..c09e6c133c --- /dev/null +++ b/Src/Tools/DiscoveryDocPatcher/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("DiscoveryDocPatcher")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("DiscoveryDocPatcher")] +[assembly: AssemblyCopyright("Copyright © 2016")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("555463ec-9010-41e3-bcbd-76903f663102")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Src/Tools/DiscoveryDocPatcher/packages.config b/Src/Tools/DiscoveryDocPatcher/packages.config new file mode 100644 index 0000000000..3e14be6a5b --- /dev/null +++ b/Src/Tools/DiscoveryDocPatcher/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file