[msbuild/tests] Add TVServicesExtension test (#21)

* [msbuild/tests] Remove car idiom from Contents.json

The car idiom is something new projects used to generate
and that actool doesn't handle anymore.

Logs were polluted by a warning: "The app icon set 'AppIcons' has an unassigned child".

* [msbuild/tests] Add tvOS extension test

We now have MyTVServicesExtension project which
comes from a simple tvOS extension template.
It is attached to MyTVApp.

The TVApp test has been updated to also build the extension.

* [msbuild/tests] Fix Action Extension version number

The action extension project now has a version number that
is matching the parent app.

Avoids warning message.
This commit is contained in:
Vincent Dondain 2016-05-03 13:17:38 -04:00 коммит произвёл Sebastien Pouliot
Родитель d8ace2658e
Коммит 0970fce6ed
18 изменённых файлов: 215 добавлений и 68 удалений

Просмотреть файл

@ -19,7 +19,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>1.0</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>

Просмотреть файл

@ -94,15 +94,10 @@
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "120x120",
"scale": "1x",
"idiom": "car"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
}

Просмотреть файл

@ -94,15 +94,10 @@
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "120x120",
"scale": "1x",
"idiom": "car"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
}

Просмотреть файл

@ -94,15 +94,10 @@
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "120x120",
"scale": "1x",
"idiom": "car"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
}

Просмотреть файл

@ -83,6 +83,13 @@
<DependentUpon>MySingleViewViewController.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MyTVServicesExtension\MyTVServicesExtension.csproj">
<IsAppExtension>true</IsAppExtension>
<Project>{0F124570-8B79-4593-B618-A90E51F339DF}</Project>
<Name>MyTVServicesExtension</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\TVOS\Xamarin.TVOS.CSharp.targets" />
<ItemGroup>
<InterfaceDefinition Include="MainStoryboard.storyboard" />

Просмотреть файл

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>MyTVServicesExtension</string>
<key>CFBundleName</key>
<string>MyTVServicesExtension</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.mytvapp.mytvservicesextension</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.2</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
<dict>
<key>TVExtensionProtocols</key>
<array>
<string>TVTopShelfProvider</string>
</array>
</dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.tv-services</string>
<key>NSExtensionPrincipalClass</key>
<string>ServiceProvider</string>
</dict>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
</dict>
</plist>

Просмотреть файл

@ -0,0 +1,99 @@
<?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)' == '' ">iPhoneSimulator</Platform>
<ProjectGuid>{0F124570-8B79-4593-B618-A90E51F339DF}</ProjectGuid>
<ProjectTypeGuids>{53F59511-8024-45F7-9A2A-2739F70C7A80};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>MyTVServicesExtension</RootNamespace>
<AssemblyName>MyTVServicesExtension</AssemblyName>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<MtouchFastDev>true</MtouchFastDev>
<MtouchProfiling>true</MtouchProfiling>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
<DeviceSpecificBuild>false</DeviceSpecificBuild>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<Optimize>true</Optimize>
<OutputPath>bin\iPhone\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchUseLlvm>true</MtouchUseLlvm>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchFloat32>true</MtouchFloat32>
<MtouchEnableBitcode>true</MtouchEnableBitcode>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchArch>ARM64</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<Optimize>true</Optimize>
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
<DefineConstants></DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchLink>None</MtouchLink>
<MtouchArch>x86_64</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\iPhone\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<DeviceSpecificBuild>true</DeviceSpecificBuild>
<MtouchDebug>true</MtouchDebug>
<MtouchFastDev>true</MtouchFastDev>
<MtouchProfiling>true</MtouchProfiling>
<MtouchUseSGen>true</MtouchUseSGen>
<MtouchUseRefCounting>true</MtouchUseRefCounting>
<MtouchFloat32>true</MtouchFloat32>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<IOSDebuggerPort>10001</IOSDebuggerPort>
<MtouchArch>ARM64</MtouchArch>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.TVOS" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
<None Include="Entitlements.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="ServiceProvider.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\TVOS\Xamarin.TVOS.AppExtension.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,25 @@
using System;
using Foundation;
using TVServices;
namespace MyTVServicesExtension
{
public class ServiceProvider : NSObject, ITVTopShelfProvider
{
protected ServiceProvider (IntPtr handle) : base (handle)
{
// Note: this .ctor should not contain any initialization logic.
}
public TVContentItem [] TopShelfItems {
[Export ("topShelfItems")]
get;
}
public TVTopShelfContentStyle TopShelfStyle {
[Export ("topShelfStyle")]
get;
}
}
}

Просмотреть файл

@ -94,15 +94,10 @@
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "120x120",
"scale": "1x",
"idiom": "car"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
}

Просмотреть файл

@ -95,11 +95,6 @@
"size": "76x76",
"scale": "2x"
},
{
"idiom": "car",
"size": "120x120",
"scale": "1x"
},
{
"size": "24x24",
"idiom": "watch",
@ -159,4 +154,4 @@
"version": 1,
"author": "xcode"
}
}
}

Просмотреть файл

@ -94,15 +94,10 @@
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "120x120",
"scale": "1x",
"idiom": "car"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
}

Просмотреть файл

@ -95,11 +95,6 @@
"size" : "76x76",
"scale" : "2x"
},
{
"idiom" : "car",
"size" : "120x120",
"scale" : "1x"
},
{
"size" : "24x24",
"idiom" : "watch",
@ -167,4 +162,4 @@
"version" : 1,
"author" : "xcode"
}
}
}

Просмотреть файл

@ -94,15 +94,10 @@
"size": "76x76",
"scale": "2x",
"idiom": "ipad"
},
{
"size": "120x120",
"scale": "1x",
"idiom": "car"
}
],
"info": {
"version": 1,
"author": "xcode"
}
}
}

Просмотреть файл

@ -95,11 +95,6 @@
"size": "76x76",
"scale": "2x"
},
{
"idiom": "car",
"size": "120x120",
"scale": "1x"
},
{
"size": "24x24",
"idiom": "watch",
@ -159,4 +154,4 @@
"version": 1,
"author": "xcode"
}
}
}

Просмотреть файл

@ -5,15 +5,27 @@ using NUnit.Framework;
namespace Xamarin.iOS.Tasks
{
public class ExtensionTestBase : TestBase {
public string BundlePath;
public string Platform;
public ExtensionTestBase (string platform) {
Platform = platform;
}
public void BuildExtension (string hostAppName, string extensionName, string platform, int expectedErrorCount = 0)
public ExtensionTestBase (string bundlePath, string platform)
{
var mtouchPaths = SetupProjectPaths (hostAppName, "../", true, platform);
BundlePath = bundlePath;
Platform = platform;
}
public void BuildExtension (string hostAppName, string extensionName, string platform, int expectedErrorCount = 0)
{
BuildExtension (hostAppName, extensionName, platform, platform, expectedErrorCount);
}
public void BuildExtension (string hostAppName, string extensionName, string bundlePath, string platform, int expectedErrorCount = 0)
{
var mtouchPaths = SetupProjectPaths (hostAppName, "../", true, bundlePath);
var proj = SetupProject (Engine, mtouchPaths ["project_csprojpath"]);
@ -22,7 +34,7 @@ namespace Xamarin.iOS.Tasks
Engine.GlobalProperties.SetProperty ("Platform", platform);
RunTarget (proj, "Clean");
Assert.IsFalse (Directory.Exists (AppBundlePath), "{1}: App bundle exists after cleanup: {0} ", AppBundlePath, platform);
Assert.IsFalse (Directory.Exists (AppBundlePath), "{1}: App bundle exists after cleanup: {0} ", AppBundlePath, bundlePath);
proj = SetupProject (Engine, mtouchPaths.ProjectCSProjPath);
RunTarget (proj, "Build", expectedErrorCount);
@ -30,7 +42,7 @@ namespace Xamarin.iOS.Tasks
if (expectedErrorCount > 0)
return;
Assert.IsTrue (Directory.Exists (AppBundlePath), "{1} App Bundle does not exist: {0} ", AppBundlePath, platform);
Assert.IsTrue (Directory.Exists (AppBundlePath), "{1} App Bundle does not exist: {0} ", AppBundlePath, bundlePath);
TestPList (AppBundlePath, new string[] {"CFBundleExecutable", "CFBundleVersion"});
@ -41,13 +53,14 @@ namespace Xamarin.iOS.Tasks
TestFilesExists (AppBundlePath, ExpectedAppFiles);
TestFilesDoNotExist (AppBundlePath, UnexpectedAppFiles);
if (IsWatchOS) {
var coreFiles = platform == "iPhone" ? CoreAppFiles : CoreAppFiles.Union (new string [] { extensionName + ".dll", Path.GetFileNameWithoutExtension (extensionPath) }).ToArray ();
var coreFiles = platform == "iPhone" ? CoreAppFiles : CoreAppFiles.Union (new string [] { hostAppName + ".exe", hostAppName }).ToArray ();
if (IsTVOS)
TestFilesExists (platform == "iPhone" ? Path.Combine (AppBundlePath, ".monotouch-64") : AppBundlePath, coreFiles);
else if (IsWatchOS) {
coreFiles = platform == "iPhone" ? CoreAppFiles : CoreAppFiles.Union (new string [] { extensionName + ".dll", Path.GetFileNameWithoutExtension (extensionPath) }).ToArray ();
TestFilesExists (platform == "iPhone" ? Path.Combine (extensionPath, ".monotouch-32") : extensionPath, coreFiles);
} else {
var coreFiles = platform == "iPhone" ? CoreAppFiles : CoreAppFiles.Union (new string [] { hostAppName + ".exe", hostAppName }).ToArray ();
} else
TestFilesExists (platform == "iPhone" ? Path.Combine (AppBundlePath, ".monotouch-32") : AppBundlePath, coreFiles);
}
}
public void SetupPaths (string appName, string platform)

Просмотреть файл

@ -4,16 +4,16 @@ namespace Xamarin.iOS.Tasks
{
[TestFixture("TV", "iPhone")]
[TestFixture("TVSimulator", "iPhoneSimulator")]
public class MyTVAppTests : ProjectTest
public class TVAppTests : ExtensionTestBase
{
public MyTVAppTests(string bundlePath, string platform) : base(bundlePath, platform)
public TVAppTests (string bundlePath, string platform) : base(bundlePath, platform)
{
}
[Test]
public void BasicTest()
{
BuildProject("MyTVApp", BundlePath, Platform);
BuildExtension("MyTVApp", "MyTVServicesExtension", BundlePath, Platform);
}
public override string TargetFrameworkIdentifier {

Просмотреть файл

@ -92,7 +92,7 @@
<Compile Include="..\..\..\tests\common\Configuration.cs">
<Link>Configuration.cs</Link>
</Compile>
<Compile Include="ProjectsTests\TVOS\MyTVApp.cs" />
<Compile Include="ProjectsTests\TVOS\TVApp.cs" />
<Compile Include="TaskTests\GeneratePlistTaskTests\GeneratePlistTaskTests_iOS.cs" />
<Compile Include="TaskTests\GeneratePlistTaskTests\GeneratePlistTaskTests_Core.cs" />
<Compile Include="TaskTests\GeneratePlistTaskTests\GeneratePlistTaskTests_iOS_AppExtension.cs" />