Skip to content

Commit

Permalink
Add UnityPackageManagerResolver to EDM4U
Browse files Browse the repository at this point in the history
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
  • Loading branch information
chkuang-g authored and Stewart Miles committed Mar 10, 2020
1 parent 886a5c2 commit c43deb5
Show file tree
Hide file tree
Showing 16 changed files with 1,684 additions and 4 deletions.
36 changes: 33 additions & 3 deletions LICENSE
@@ -1,11 +1,11 @@
Copyright (C) 2014 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.
Expand Down Expand Up @@ -213,3 +213,33 @@ Copyright (C) 2014 Google Inc.
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.

====================================================================================================
This package uses MiniJSON

Copyright (c) 2013 Calvin Rien

Based on the JSON parser by Patrick van Bergen
http://techblog.procurios.nl/k/618/news/view/14605/14863/How-do-I-write-my-own-parser-for-JSON.html

Simplified it so that it doesn't throw exceptions
and can be used in Unity iPhone with maximum code stripping.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 changes: 27 additions & 1 deletion build.gradle
Expand Up @@ -1105,6 +1105,10 @@ Task buildAndroidResolver = createBuildPluginDllTask(
Task buildIosResolver = createBuildPluginDllTask(
"IosResolver", "IOSResolver", "Google.IOSResolver.dll", true,
[buildAndroidResolver])
Task buildUnityPackageManagerResolver = createBuildPluginDllTask(
"UnityPackageManagerResolver", "UnityPackageManagerResolver",
"Google.UnityPackageManagerResolver.dll", true,
[buildVersionHandlerImpl])

task preparePluginStagingAreaDir(type: Task) {
description "Delete all files that should not be present in staging area."
Expand Down Expand Up @@ -1137,7 +1141,8 @@ Iterable<Task> copyComponentsToStagingAreaTasks = [
copyAndroidResolverStaging,
copyVersionHandlerStaging,
copyVersionHandlerImplStaging,
copyIosResolverStaging].collect {
copyIosResolverStaging,
copyUnityPackageManagerResolverStaging].collect {
task ->
createCopyFilesTask(
sprintf("copy%sToStagingArea", task.ext.componentName),
Expand Down Expand Up @@ -1370,6 +1375,27 @@ createNUnitTask(
compileVersionHandlerImplTests.outputs.files[0],
[compileVersionHandlerImplTests])

Task compileUnityPackageManagerResolverTests = createXbuildTask(
"compileUnityPackageManagerResolverTests",
"Compile tests for UnityPackageManagerResolver.",
project.ext.pluginSolutionFile, "UnityPackageManagerResolverTests",
fileTree(new File(
new File(
new File(project.ext.pluginSourceDir,
"UnityPackageManagerResolver"),
"unit_tests"),
"src")),
new File(project.ext.testDir, "UnityPackageManagerResolverTests"),
[new File("Google.UnityPackageManagerResolverTests.dll")],
[buildUnityPackageManagerResolver]).with {
doFirst { checkNUnitDllPath() }
}

createNUnitTask(
"testUnityPackageManagerResolver",
"Runs tests for the UnityPackageManagerResolver module",
compileUnityPackageManagerResolverTests.outputs.files[0],
[compileUnityPackageManagerResolverTests])

createUnityTestBatchAndNonBatch(
"testVersionHandlerActivation",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions source/ExternalDependencyManager.sln
Expand Up @@ -15,6 +15,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VersionHandlerImplTests", "
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "IOSResolver", "IOSResolver\IOSResolver.csproj", "{5B581BAE-D432-41AB-AEED-FD269AEA081D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityPackageManagerResolver", "UnityPackageManagerResolver\UnityPackageManagerResolver.csproj", "{77EBE819-CBE6-4CA8-A791-ED747EA29D30}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityPackageManagerResolverTests", "UnityPackageManagerResolver\unit_tests\UnityPackageManagerResolverTests.csproj", "{FEECDCE1-F528-4931-A4CF-808DDBCE1A8D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -49,5 +53,13 @@ Global
{5B581BAE-D432-41AB-AEED-FD269AEA081D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B581BAE-D432-41AB-AEED-FD269AEA081D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5B581BAE-D432-41AB-AEED-FD269AEA081D}.Release|Any CPU.Build.0 = Release|Any CPU
{77EBE819-CBE6-4CA8-A791-ED747EA29D30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{77EBE819-CBE6-4CA8-A791-ED747EA29D30}.Debug|Any CPU.Build.0 = Debug|Any CPU
{77EBE819-CBE6-4CA8-A791-ED747EA29D30}.Release|Any CPU.ActiveCfg = Release|Any CPU
{77EBE819-CBE6-4CA8-A791-ED747EA29D30}.Release|Any CPU.Build.0 = Release|Any CPU
{FEECDCE1-F528-4931-A4CF-808DDBCE1A8D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FEECDCE1-F528-4931-A4CF-808DDBCE1A8D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FEECDCE1-F528-4931-A4CF-808DDBCE1A8D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FEECDCE1-F528-4931-A4CF-808DDBCE1A8D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
58 changes: 58 additions & 0 deletions source/UnityPackageManagerResolver/Properties/AssemblyInfo.cs
@@ -0,0 +1,58 @@
// <copyright file="AssemblyInfo.cs" company="Google LLC">
// Copyright (C) 2020 Google LLC All Rights Reserved.
//
// 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.
// </copyright>

using System.Reflection;
using System.Runtime.CompilerServices;

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Google.UnityPackageManagerResolver")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Google LLC")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright 2020")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.2.0.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

// [assembly: AssemblyDelaySign(false)]
// // <copyright file="ResolutionException.cs" company="Google LLC">
// Copyright (C) 2016 Google LLC All Rights Reserved.
//
// 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.
// </copyright>[assembly: AssemblyKeyFile("")]

// Uses UnityPackageManagerResolver.RestoreDefaultSettings(preferenceKeys)
[assembly: InternalsVisibleTo("Google.UnityPackageManagerResolverTests")]

@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{77EBE819-CBE6-4CA8-A791-ED747EA29D30}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Google</RootNamespace>
<AssemblyName>Google.UnityPackageManagerResolver</AssemblyName>
<ReleaseVersion>1.2</ReleaseVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;UNITY_EDITOR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Release</OutputPath>
<DefineConstants>DEBUG;UNITY_EDITOR</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>False</ConsolePause>
</PropertyGroup>
<PropertyGroup>
<UnityHintPath>..\..\unity_dlls</UnityHintPath>
</PropertyGroup>
<ItemGroup>
<Reference Include="UnityEditor">
<HintPath>$(UnityHintPath)/UnityEditor.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(UnityHintPath)/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="Google.VersionHandler.dll">
<HintPath>..\VersionHandler\bin\Release\Google.VersionHandler.dll</HintPath>
</Reference>
<Reference Include="Google.VersionHandlerImpl.dll">
<HintPath>..\VersionHandler\bin\Release\Google.VersionHandlerImpl.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<Folder Include="src\" />
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<Compile Include="src\PackageManifestModifier.cs" />
<Compile Include="src\SettingsDialog.cs" />
<Compile Include="src\UnityPackageManagerResolver.cs" />
<Compile Include="src\VersionNumber.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\VersionHandler\VersionHandler.csproj">
<Project>{5378B37A-887E-49ED-A8AE-42FA843AA9DC}</Project>
<Name>VersionHandler</Name>
</ProjectReference>
<ProjectReference Include="..\VersionHandlerImpl\VersionHandlerImpl.csproj">
<Project>{1E162334-8EA2-440A-9B3A-13FD8FE5C22E}</Project>
<Name>VersionHandlerImpl</Name>
</ProjectReference>
</ItemGroup>
</Project>

0 comments on commit c43deb5

Please sign in to comment.