-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
* Move the templates to a common subdirectory. * Add .NET unit test to verify that all the templates build and that they have no warnings. * Modify the template code to: * Use the UIApplication.Main overload that takes a Type. * Use top-level statements for the Main method to simplify code. * Remove a few unnecessary usings. Partial fix for #12085.
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using UIKit; | ||
|
||
using MacCatalystApp1; | ||
|
||
// This is the main entry point of the application. | ||
// If you want to use a different Application Delegate class from "AppDelegate" | ||
// you can specify it here. | ||
UIApplication.Main (args, null, typeof (AppDelegate)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
using System; | ||
using Foundation; | ||
using UIKit; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
using CoreFoundation; | ||
using Foundation; | ||
using UIKit; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using UIKit; | ||
|
||
using iOSApp1; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
rolfbjarne
Author
Member
|
||
|
||
// This is the main entry point of the application. | ||
// If you want to use a different Application Delegate class from "AppDelegate" | ||
// you can specify it here. | ||
UIApplication.Main (args, null, typeof (AppDelegate)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
using System; | ||
using Foundation; | ||
using UIKit; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
using System; | ||
|
||
namespace iOSLib1 { | ||
public class Class1 { | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
using AppKit; | ||
|
||
using macOSApp1; | ||
|
||
// This is the main entry point of the application. | ||
NSApplication.Init (); | ||
NSApplication.Main (args); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
using UIKit; | ||
|
||
using tvOSApp1; | ||
|
||
// This is the main entry point of the application. | ||
// If you want to use a different Application Delegate class from "AppDelegate" | ||
// you can specify it here. | ||
UIApplication.Main (args, null, typeof (AppDelegate)); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using System; | ||
using Foundation; | ||
using UIKit; | ||
|
||
namespace tvOSApp1 { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
using NUnit.Framework; | ||
|
||
using Xamarin.Utils; | ||
|
||
namespace Xamarin.Tests { | ||
[TestFixture] | ||
public class TemplateTest { | ||
|
||
public static string [][] Templates = { | ||
// { platform, template_name } | ||
new [] { "iOS", "ios" }, | ||
new [] { "iOS", "ioslib" }, | ||
new [] { "tvOS", "tvos" }, | ||
new [] { "MacCatalyst", "maccatalyst" }, | ||
new [] { "macOS", "macos" }, | ||
}; | ||
|
||
public class TemplateConfig { | ||
public string Name; | ||
public string ShortName; | ||
public TemplateConfigTag Tags; | ||
} | ||
|
||
public class TemplateConfigTag { | ||
public string Language; | ||
public string Type; | ||
} | ||
|
||
[Test] | ||
public void AreAllTemplatesListed () | ||
{ | ||
var allListedTemplates = Templates.Select (v => v [1]).ToArray (); | ||
var allTemplates = new List<string> (); | ||
foreach (var platform in Enum.GetValues<ApplePlatform> ()) { | ||
var dir = Path.Combine (Configuration.SourceRoot, "dotnet", "Templates", $"Microsoft.{platform.AsString ()}.Templates"); | ||
if (!Directory.Exists (dir)) | ||
continue; | ||
|
||
var templateDirectories = Directory.GetDirectories (dir); | ||
var options = new JsonSerializerOptions { | ||
PropertyNameCaseInsensitive = true, | ||
IncludeFields = true, | ||
}; | ||
|
||
// read the template's configuration to figure out if it's a project template, and if not, skip it | ||
foreach (var templateDir in templateDirectories) { | ||
var jsonPath = Path.Combine (templateDir, ".template.config", "template.json"); | ||
if (!File.Exists (jsonPath)) | ||
continue; | ||
var json = JsonSerializer.Deserialize<TemplateConfig> (File.ReadAllText (jsonPath), options); | ||
if (json.Tags.Type != "project") | ||
continue; | ||
|
||
allTemplates.Add (json.ShortName); | ||
} | ||
} | ||
Assert.That (allListedTemplates, Is.EquivalentTo (allTemplates), "The listed templates here and the templates on disk don't match"); | ||
} | ||
|
||
[Test] | ||
[TestCaseSource (nameof (Templates))] | ||
public void CreateAndBuildTemplate (string platform, string template) | ||
{ | ||
Configuration.IgnoreIfIgnoredPlatform (platform); | ||
var tmpDir = Cache.CreateTemporaryDirectory (); | ||
Configuration.CopyDotNetSupportingFiles (tmpDir); | ||
var outputDir = Path.Combine (tmpDir, template); | ||
DotNet.AssertNew (outputDir, template); | ||
var csproj = Path.Combine (outputDir, template + ".csproj"); | ||
var rv = DotNet.AssertBuild (csproj); | ||
var warnings = BinLog.GetBuildLogWarnings (rv.BinLogPath).Select (v => v.Message); | ||
Assert.That (warnings, Is.Empty, $"Build warnings:\n\t{string.Join ("\n\t", warnings)}"); | ||
} | ||
} | ||
} |
8 comments
on commit 7ac3417
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ [CI Build] Tests failed on Build ❌
Tests failed on Build.
API diff
✅ API Diff from stable
View API diff
API & Generator diff
✅ API Diff (from PR only) (no change)
✅ Generator Diff (no change)
Packages generated
View packages
- delete-xma-build-host.pkg
- Microsoft.iOS.Bundle.15.0.100-ci.main.166.pkg
- Microsoft.iOS.Ref.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.iOS.Runtime.ios-arm.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.iOS.Runtime.ios-arm64.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.iOS.Runtime.iossimulator-x64.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.iOS.Runtime.iossimulator-x86.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.iOS.Sdk.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.iOS.Templates.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.iOS.Windows.Sdk.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.MacCatalyst.Bundle.15.0.100-ci.main.166.pkg
- Microsoft.MacCatalyst.Ref.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.MacCatalyst.Runtime.maccatalyst-arm64.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.MacCatalyst.Runtime.maccatalyst-x64.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.MacCatalyst.Sdk.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.MacCatalyst.Templates.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.macOS.Bundle.12.0.100-ci.main.166.pkg
- Microsoft.macOS.Ref.12.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.macOS.Runtime.osx-arm64.12.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.macOS.Runtime.osx-x64.12.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.macOS.Sdk.12.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.macOS.Templates.12.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.NET.Sdk.iOS.Manifest-6.0.100.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.NET.Sdk.MacCatalyst.Manifest-6.0.100.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.NET.Sdk.macOS.Manifest-6.0.100.12.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.NET.Sdk.tvOS.Manifest-6.0.100.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.NET.Workload.iOS.15.0.100-ci.main.166.msi
- Microsoft.tvOS.Bundle.15.0.100-ci.main.166.pkg
- Microsoft.tvOS.Ref.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.tvOS.Runtime.tvos-arm64.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.tvOS.Runtime.tvossimulator-x64.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.tvOS.Sdk.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- Microsoft.tvOS.Templates.15.0.100-ci.main.166+sha.7ac3417ee.nupkg
- xamarin.ios-14.99.0.166.pkg
- xamarin.mac-7.99.0.166.pkg
- Microsoft.iOS.Bundle.15.0.100-ci.main.166.pkg (notarized)
- Microsoft.MacCatalyst.Bundle.15.0.100-ci.main.166.pkg (notarized)
- Microsoft.macOS.Bundle.12.0.100-ci.main.166.pkg (notarized)
- Microsoft.tvOS.Bundle.15.0.100-ci.main.166.pkg (notarized)
- xamarin.ios-14.99.0.166.pkg (notarized)
- xamarin.mac-7.99.0.166.pkg (notarized)
Test results
2 tests failed, 219 tests passed.
Failed tests
- framework-test/Mac Catalyst/Debug: TimedOut (Execution timed out after 1200 seconds.
No test log file was produced) - DotNet tests: Failed (Execution failed with exit code 1)
Pipeline on Agent XAMBOT-1037.BigSur'
[dotnet/templates/tests] Update template code. (#12109)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️
Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.
Pipeline on Agent
[dotnet/templates/tests] Update template code. (#12109)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️
Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.
Pipeline on Agent
[dotnet/templates/tests] Update template code. (#12109)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ Tests were not ran (VSTS: device tests iOS32b). ⚠️
Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.
Pipeline on Agent
[dotnet/templates/tests] Update template code. (#12109)
Why does this need a using for its own namespace?