Skip to content

Commit c43deb5

Browse files
chkuang-gStewart Miles
authored andcommitted
Add UnityPackageManagerResolver to EDM4U
UnityPackageManagerResolver helps to transition to manage packages through Unity Package Manager, from Unity 2018.4. - Prompts to add Game Package Registry by Google to Unity project. This allows the users to discover and manage packages from Google through Unity Package Manager. - Added a setting window under "Assets > External Dependency Manager > Unity Package Manager Resolver" to add and remove registries. Bug: 150471207 Change-Id: Ia2f1b497a412b850d561d62977808b09b7c1f5fc
1 parent 886a5c2 commit c43deb5

16 files changed

+1684
-4
lines changed

LICENSE

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Copyright (C) 2014 Google Inc.
2-
2+
33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
55
You may obtain a copy of the License at
6-
6+
77
http://www.apache.org/licenses/LICENSE-2.0
8-
8+
99
Unless required by applicable law or agreed to in writing, software
1010
distributed under the License is distributed on an "AS IS" BASIS,
1111
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -213,3 +213,33 @@ Copyright (C) 2014 Google Inc.
213213
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
214214
See the License for the specific language governing permissions and
215215
limitations under the License.
216+
217+
====================================================================================================
218+
This package uses MiniJSON
219+
220+
Copyright (c) 2013 Calvin Rien
221+
222+
Based on the JSON parser by Patrick van Bergen
223+
http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html
224+
225+
Simplified it so that it doesn't throw exceptions
226+
and can be used in Unity iPhone with maximum code stripping.
227+
228+
Permission is hereby granted, free of charge, to any person obtaining
229+
a copy of this software and associated documentation files (the
230+
"Software"), to deal in the Software without restriction, including
231+
without limitation the rights to use, copy, modify, merge, publish,
232+
distribute, sublicense, and/or sell copies of the Software, and to
233+
permit persons to whom the Software is furnished to do so, subject to
234+
the following conditions:
235+
236+
The above copyright notice and this permission notice shall be
237+
included in all copies or substantial portions of the Software.
238+
239+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
240+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
241+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
242+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
243+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
244+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
245+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

build.gradle

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,10 @@ Task buildAndroidResolver = createBuildPluginDllTask(
11051105
Task buildIosResolver = createBuildPluginDllTask(
11061106
"IosResolver", "IOSResolver", "Google.IOSResolver.dll", true,
11071107
[buildAndroidResolver])
1108+
Task buildUnityPackageManagerResolver = createBuildPluginDllTask(
1109+
"UnityPackageManagerResolver", "UnityPackageManagerResolver",
1110+
"Google.UnityPackageManagerResolver.dll", true,
1111+
[buildVersionHandlerImpl])
11081112

11091113
task preparePluginStagingAreaDir(type: Task) {
11101114
description "Delete all files that should not be present in staging area."
@@ -1137,7 +1141,8 @@ Iterable<Task> copyComponentsToStagingAreaTasks = [
11371141
copyAndroidResolverStaging,
11381142
copyVersionHandlerStaging,
11391143
copyVersionHandlerImplStaging,
1140-
copyIosResolverStaging].collect {
1144+
copyIosResolverStaging,
1145+
copyUnityPackageManagerResolverStaging].collect {
11411146
task ->
11421147
createCopyFilesTask(
11431148
sprintf("copy%sToStagingArea", task.ext.componentName),
@@ -1370,6 +1375,27 @@ createNUnitTask(
13701375
compileVersionHandlerImplTests.outputs.files[0],
13711376
[compileVersionHandlerImplTests])
13721377

1378+
Task compileUnityPackageManagerResolverTests = createXbuildTask(
1379+
"compileUnityPackageManagerResolverTests",
1380+
"Compile tests for UnityPackageManagerResolver.",
1381+
project.ext.pluginSolutionFile, "UnityPackageManagerResolverTests",
1382+
fileTree(new File(
1383+
new File(
1384+
new File(project.ext.pluginSourceDir,
1385+
"UnityPackageManagerResolver"),
1386+
"unit_tests"),
1387+
"src")),
1388+
new File(project.ext.testDir, "UnityPackageManagerResolverTests"),
1389+
[new File("Google.UnityPackageManagerResolverTests.dll")],
1390+
[buildUnityPackageManagerResolver]).with {
1391+
doFirst { checkNUnitDllPath() }
1392+
}
1393+
1394+
createNUnitTask(
1395+
"testUnityPackageManagerResolver",
1396+
"Runs tests for the UnityPackageManagerResolver module",
1397+
compileUnityPackageManagerResolverTests.outputs.files[0],
1398+
[compileUnityPackageManagerResolverTests])
13731399

13741400
createUnityTestBatchAndNonBatch(
13751401
"testVersionHandlerActivation",

plugin/Assets/ExternalDependencyManager/Editor/Google.UnityPackageManagerResolver.dll.mdb.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugin/Assets/ExternalDependencyManager/Editor/Google.UnityPackageManagerResolver.dll.meta

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/ExternalDependencyManager.sln

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VersionHandlerImplTests", "
1515
EndProject
1616
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOSResolver", "IOSResolver\IOSResolver.csproj", "{5B581BAE-D432-41AB-AEED-FD269AEA081D}"
1717
EndProject
18+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityPackageManagerResolver", "UnityPackageManagerResolver\UnityPackageManagerResolver.csproj", "{77EBE819-CBE6-4CA8-A791-ED747EA29D30}"
19+
EndProject
20+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityPackageManagerResolverTests", "UnityPackageManagerResolver\unit_tests\UnityPackageManagerResolverTests.csproj", "{FEECDCE1-F528-4931-A4CF-808DDBCE1A8D}"
21+
EndProject
1822
Global
1923
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2024
Debug|Any CPU = Debug|Any CPU
@@ -49,5 +53,13 @@ Global
4953
{5B581BAE-D432-41AB-AEED-FD269AEA081D}.Debug|Any CPU.Build.0 = Debug|Any CPU
5054
{5B581BAE-D432-41AB-AEED-FD269AEA081D}.Release|Any CPU.ActiveCfg = Release|Any CPU
5155
{5B581BAE-D432-41AB-AEED-FD269AEA081D}.Release|Any CPU.Build.0 = Release|Any CPU
56+
{77EBE819-CBE6-4CA8-A791-ED747EA29D30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57+
{77EBE819-CBE6-4CA8-A791-ED747EA29D30}.Debug|Any CPU.Build.0 = Debug|Any CPU
58+
{77EBE819-CBE6-4CA8-A791-ED747EA29D30}.Release|Any CPU.ActiveCfg = Release|Any CPU
59+
{77EBE819-CBE6-4CA8-A791-ED747EA29D30}.Release|Any CPU.Build.0 = Release|Any CPU
60+
{FEECDCE1-F528-4931-A4CF-808DDBCE1A8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
61+
{FEECDCE1-F528-4931-A4CF-808DDBCE1A8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
62+
{FEECDCE1-F528-4931-A4CF-808DDBCE1A8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
63+
{FEECDCE1-F528-4931-A4CF-808DDBCE1A8D}.Release|Any CPU.Build.0 = Release|Any CPU
5264
EndGlobalSection
5365
EndGlobal
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// <copyright file="AssemblyInfo.cs" company="Google LLC">
2+
// Copyright (C) 2020 Google LLC All Rights Reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (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
7+
//
8+
// http://www.apache.org/licenses/LICENSE-2.0
9+
//
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
// </copyright>
16+
17+
using System.Reflection;
18+
using System.Runtime.CompilerServices;
19+
20+
// Information about this assembly is defined by the following attributes.
21+
// Change them to the values specific to your project.
22+
[assembly: AssemblyTitle("Google.UnityPackageManagerResolver")]
23+
[assembly: AssemblyDescription("")]
24+
[assembly: AssemblyConfiguration("")]
25+
[assembly: AssemblyCompany("Google LLC")]
26+
[assembly: AssemblyProduct("")]
27+
[assembly: AssemblyCopyright("Copyright 2020")]
28+
[assembly: AssemblyTrademark("")]
29+
[assembly: AssemblyCulture("")]
30+
31+
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
32+
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
33+
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
34+
[assembly: AssemblyVersion("1.2.0.0")]
35+
36+
// The following attributes are used to specify the signing key for the assembly,
37+
// if desired. See the Mono documentation for more information about signing.
38+
39+
// [assembly: AssemblyDelaySign(false)]
40+
// // <copyright file="ResolutionException.cs" company="Google LLC">
41+
// Copyright (C) 2016 Google LLC All Rights Reserved.
42+
//
43+
// Licensed under the Apache License, Version 2.0 (the "License");
44+
// you may not use this file except in compliance with the License.
45+
// You may obtain a copy of the License at
46+
//
47+
// http://www.apache.org/licenses/LICENSE-2.0
48+
//
49+
// Unless required by applicable law or agreed to in writing, software
50+
// distributed under the License is distributed on an "AS IS" BASIS,
51+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52+
// See the License for the specific language governing permissions and
53+
// limitations under the License.
54+
// </copyright>[assembly: AssemblyKeyFile("")]
55+
56+
// Uses UnityPackageManagerResolver.RestoreDefaultSettings(preferenceKeys)
57+
[assembly: InternalsVisibleTo("Google.UnityPackageManagerResolverTests")]
58+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{77EBE819-CBE6-4CA8-A791-ED747EA29D30}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<RootNamespace>Google</RootNamespace>
11+
<AssemblyName>Google.UnityPackageManagerResolver</AssemblyName>
12+
<ReleaseVersion>1.2</ReleaseVersion>
13+
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>True</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>False</Optimize>
19+
<OutputPath>bin\Debug</OutputPath>
20+
<DefineConstants>DEBUG;UNITY_EDITOR</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
<ConsolePause>False</ConsolePause>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugSymbols>True</DebugSymbols>
27+
<DebugType>full</DebugType>
28+
<Optimize>True</Optimize>
29+
<OutputPath>bin\Release</OutputPath>
30+
<DefineConstants>DEBUG;UNITY_EDITOR</DefineConstants>
31+
<ErrorReport>prompt</ErrorReport>
32+
<WarningLevel>4</WarningLevel>
33+
<ConsolePause>False</ConsolePause>
34+
</PropertyGroup>
35+
<PropertyGroup>
36+
<UnityHintPath>..\..\unity_dlls</UnityHintPath>
37+
</PropertyGroup>
38+
<ItemGroup>
39+
<Reference Include="UnityEditor">
40+
<HintPath>$(UnityHintPath)/UnityEditor.dll</HintPath>
41+
</Reference>
42+
<Reference Include="UnityEngine">
43+
<HintPath>$(UnityHintPath)/UnityEngine.dll</HintPath>
44+
</Reference>
45+
<Reference Include="Google.VersionHandler.dll">
46+
<HintPath>..\VersionHandler\bin\Release\Google.VersionHandler.dll</HintPath>
47+
</Reference>
48+
<Reference Include="Google.VersionHandlerImpl.dll">
49+
<HintPath>..\VersionHandler\bin\Release\Google.VersionHandlerImpl.dll</HintPath>
50+
</Reference>
51+
<Reference Include="System" />
52+
<Reference Include="System.Core" />
53+
<Reference Include="System.Web" />
54+
<Reference Include="System.Xml" />
55+
</ItemGroup>
56+
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
57+
<ItemGroup>
58+
<Folder Include="src\" />
59+
<Folder Include="Properties\" />
60+
</ItemGroup>
61+
<ItemGroup>
62+
<Compile Include="src\PackageManifestModifier.cs" />
63+
<Compile Include="src\SettingsDialog.cs" />
64+
<Compile Include="src\UnityPackageManagerResolver.cs" />
65+
<Compile Include="src\VersionNumber.cs" />
66+
<Compile Include="Properties\AssemblyInfo.cs" />
67+
</ItemGroup>
68+
<ItemGroup>
69+
<ProjectReference Include="..\VersionHandler\VersionHandler.csproj">
70+
<Project>{5378B37A-887E-49ED-A8AE-42FA843AA9DC}</Project>
71+
<Name>VersionHandler</Name>
72+
</ProjectReference>
73+
<ProjectReference Include="..\VersionHandlerImpl\VersionHandlerImpl.csproj">
74+
<Project>{1E162334-8EA2-440A-9B3A-13FD8FE5C22E}</Project>
75+
<Name>VersionHandlerImpl</Name>
76+
</ProjectReference>
77+
</ItemGroup>
78+
</Project>

0 commit comments

Comments
 (0)