Skip to content

Commit

Permalink
Merge v1.18 into master (#860)
Browse files Browse the repository at this point in the history
Update supported platform list (#852)
Patch directory and games discovery-docs (#851)
Fixes #757 and #682.
Tidy up nuspec files (#857)
Conform nuspec descriptions to agree exactly with the README file
Update version 1.17.0 -> 1.18.0 (#858)
  • Loading branch information
chrisdunelm committed Oct 24, 2016
1 parent 501c14f commit 41c874b
Show file tree
Hide file tree
Showing 16 changed files with 341 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Backup*
project.lock.json
*~
.DS_Store
.cr

msbuild.log
TestResult.xml
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
<summary>Google {% camel_case api.name %} {{ api.version }} API client library</summary>
<description>
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

Expand Down
29 changes: 20 additions & 9 deletions GeneratedLibraries.proj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
-->

<PropertyGroup>
<!-- Absolute directory of tools src -->
<ToolsDir>$(MSBuildThisFileDirectory)Src\Tools\</ToolsDir>
<!-- Absolute directory of the JSON discovery documents -->
<DiscoveryDocumentsDir>$(MSBuildThisFileDirectory)DiscoveryJson\</DiscoveryDocumentsDir>
<!-- Absolute directory of the location to put generated code -->
<GeneratedCodeDir>$(MSBuildThisFileDirectory)Src\Generated\</GeneratedCodeDir>
<!-- Absolute directory of the packages repository -->
Expand All @@ -28,22 +32,32 @@
</PropertyGroup>

<!-- Download discovery documents used as input to code generation. -->
<Target Name="DownloadDiscoveryDocuments" Condition="!Exists('DiscoveryJson')">
<Target Name="DownloadDiscoveryDocuments" Condition="!Exists('$(DiscoveryDocumentsDir)')">
<!-- Make DiscoveryJson directory -->
<MakeDir Directories="DiscoveryJson" />
<MakeDir Directories="$(DiscoveryDocumentsDir)" />
<!-- Run python script to download all discovery docs, starting from https://www.googleapis.com/discovery/v1/apis -->
<!-- 'python -u' turns off buffering so status is printed line-by-line. -->
<Exec Command="python -u get_discovery_documents.py --destination_dir .\DiscoveryJson" />
<Exec Command="python -u get_discovery_documents.py --destination_dir $(DiscoveryDocumentsDir)" />
</Target>

<!-- Patch discovery docs that require changes before generation. This process is idempotent. -->
<Target Name="PatchDiscoveryDocuments" DependsOnTargets="DownloadDiscoveryDocuments">
<!-- Build the patcher executable -->
<MSBuild
Projects="$(ToolsDir)DiscoveryDocPatcher\DiscoveryDocPatcher.csproj"
Properties="Configuration=Debug" />
<!-- Execute patcher against the downloaded discovery docs -->
<Exec Command="$(ToolsDir)DiscoveryDocPatcher\bin\Debug\DiscoveryDocPatcher.exe $(DiscoveryDocumentsDir)" />
</Target>

<!-- Generate library projects from discovery documents. -->
<Target Name="Generate" DependsOnTargets="DownloadDiscoveryDocuments" Condition="!Exists('$(GeneratedCodeDir)')">
<Target Name="Generate" DependsOnTargets="PatchDiscoveryDocuments" Condition="!Exists('$(GeneratedCodeDir)')">
<PropertyGroup>
<_GenerateLibraryTool>ClientGenerator\generate_library.cmd</_GenerateLibraryTool>
</PropertyGroup>

<ItemGroup>
<_DiscoveryDocument Include="DiscoveryJson\*.json" />
<_DiscoveryDocument Include="$(DiscoveryDocumentsDir)\*.json" />
</ItemGroup>

<MakeDir Directories="$(GeneratedCodeDir)" />
Expand Down Expand Up @@ -72,9 +86,6 @@
<!-- Generated libraries that don't compile -->
<!-- In target as these files may not exist until after Generate target has executed -->
<ItemGroup>
<!-- Last released May 2015 (1.9.0.1030) -->
<BrokenProjects Include="$(GeneratedCodeDir)Google.Apis.Games.v1\**" />

<!-- Last released April 2014 (1.8.1.1750) -->
<BrokenProjects Include="$(GeneratedCodeDir)Google.Apis.IdentityToolkit.v3\**" />

Expand Down Expand Up @@ -125,7 +136,7 @@

<!-- Remove all downloaded and generated artifacts. -->
<Target Name="Reset">
<RemoveDir Directories="DiscoveryJson;$(GeneratedCodeDir);$(NuPkgsDir)" />
<RemoveDir Directories="$(DiscoveryDocumentsDir);$(GeneratedCodeDir);$(NuPkgsDir)" />
</Target>
<!-- Alias Clean to Reset -->
<Target Name="Clean" DependsOnTargets="Reset" />
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Src/Support/CommonAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
[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("")]
Expand Down
4 changes: 2 additions & 2 deletions Src/Support/GoogleApis.Auth/Google.Apis.Auth.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions Src/Support/GoogleApis.Core/Google.Apis.Core.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -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
</description>
<tags>Google</tags>
Expand Down
8 changes: 4 additions & 4 deletions Src/Support/GoogleApis/Google.Apis.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions Src/Tools/DiscoveryDocPatcher/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
</configuration>
66 changes: 66 additions & 0 deletions Src/Tools/DiscoveryDocPatcher/DiscoveryDocPatcher.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{555463EC-9010-41E3-BCBD-76903F663102}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DiscoveryDocPatcher</RootNamespace>
<AssemblyName>DiscoveryDocPatcher</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Patcher.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
22 changes: 22 additions & 0 deletions Src/Tools/DiscoveryDocPatcher/DiscoveryDocPatcher.sln
Original file line number Diff line number Diff line change
@@ -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
98 changes: 98 additions & 0 deletions Src/Tools/DiscoveryDocPatcher/Patcher.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}

0 comments on commit 41c874b

Please sign in to comment.