-
Notifications
You must be signed in to change notification settings - Fork 520
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.
- xamarin-mac-9.3.0.23
- xamarin-mac-9.3.0.18
- xamarin-mac-9.3.0.6
- xamarin-mac-9.1.0.6
- xamarin-mac-9.1.0.5
- xamarin-mac-9.1.0.2
- xamarin-mac-9.0.0.28
- xamarin-mac-9.0.0.27
- xamarin-mac-8.12.0.2
- xamarin-mac-8.10.0.5
- xamarin-mac-8.10.0.1
- xamarin-mac-8.8.0.3
- xamarin-mac-8.8.0.0
- xamarin-mac-8.6.0.3
- xamarin-mac-8.5.0.5
- xamarin-mac-8.4.0.0
- xamarin-mac-8.2.0.17
- xamarin-mac-8.2.0.1
- xamarin-ios-16.4.0.23
- xamarin-ios-16.4.0.18
- xamarin-ios-16.4.0.6
- xamarin-ios-16.2.0.6
- xamarin-ios-16.2.0.5
- xamarin-ios-16.2.0.2
- xamarin-ios-16.1.1.28
- xamarin-ios-16.1.1.27
- xamarin-ios-16.0.0.72
- xamarin-ios-15.12.0.2
- xamarin-ios-15.10.0.5
- xamarin-ios-15.10.0.1
- xamarin-ios-15.8.0.3
- xamarin-ios-15.8.0.0
- xamarin-ios-15.6.0.3
- xamarin-ios-15.5.0.5
- xamarin-ios-15.4.0.0
- xamarin-ios-15.2.0.17
- xamarin-ios-15.2.0.1
- xamarin-ios-15.0.0.6
- xamarin.mac-8.10.0.5
- xamarin.mac-8.10.0.1
- xamarin.ios-15.10.0.5
- xamarin.ios-15.10.0.1
- dotnet-10.0.1xx-preview1-10322
- dotnet-10.0.1xx-preview1-10320
- dotnet-9.0.1xx-xcode16.2-9180
- dotnet-9.0.1xx-xcode16.2-9173
- dotnet-9.0.1xx-xcode16.2-9170
- dotnet-9.0.1xx-xcode16.1-9163
- dotnet-9.0.1xx-xcode16.0-9617
- dotnet-9.0.1xx-rc2-9600
- dotnet-9.0.1xx-rc1-9270
- dotnet-9.0.1xx-preview7-9231
- dotnet-9.0.1xx-preview6-9714
- dotnet-9.0.1xx-preview5-9639
- dotnet-9.0.1xx-preview4-9523
- dotnet-9.0.1xx-preview3-9433
- dotnet-9.0.1xx-preview3-9429
- dotnet-9.0.1xx-preview2-9244
- dotnet-9.0.1xx-preview2-9238
- dotnet-9.0.1xx-preview1-9088
- dotnet-8.0.1xx-xcode16.0-8319
- dotnet-8.0.1xx-xcode16.0-8316
- dotnet-8.0.1xx-xcode16.0-8314
- dotnet-8.0.1xx-xcode16.0-8303
- dotnet-8.0.1xx-xcode15.4-8030
- dotnet-8.0.1xx-xcode15.4-8020
- dotnet-8.0.1xx-xcode15.4-8018
- dotnet-8.0.1xx-xcode15.1-8078
- dotnet-8.0.1xx-xcode15.1-8053
- dotnet-8.0.1xx-xcode15.1-8043
- dotnet-8.0.1xx-xcode15.1-8022
- dotnet-8.0.1xx-xcode15.1-8004
- dotnet-8.0.1xx-rc2.1-8465
- dotnet-8.0.1xx-rc2-8968
- dotnet-8.0.1xx-rc1-8825
- dotnet-8.0.1xx-preview7-8694
- dotnet-8.0.1xx-preview6-8646
- dotnet-8.0.1xx-preview5-8525
- dotnet-8.0.1xx-preview4-8377
- dotnet-8.0.1xx-preview3-462
- dotnet-8.0.1xx-preview2-374
- dotnet-8.0.1xx-preview1-235
- dotnet-8.0.1xx-8490
- dotnet-8.0.1xx-8478
- dotnet-8.0.1xx-8078
- dotnet-7.0.3xx-xcode14.3-7141
- dotnet-7.0.3xx-xcode14.3-7129
- dotnet-7.0.3xx-7143
- dotnet-7.0.3xx-7142
- dotnet-7.0.3xx-7141
- dotnet-7.0.3xx-7133
- dotnet-7.0.3xx-7129
- dotnet-7.0.3xx-7127
- dotnet-7.0.3xx-7125
- dotnet-7.0.3xx-7124
- dotnet-7.0.3xx-7107
- dotnet-7.0.3xx-7099
- dotnet-7.0.3xx-7090
- dotnet-7.0.3xx-7089
- dotnet-7.0.2xx-xcode14.3-7067
- dotnet-7.0.2xx-xcode14.3-7060
- dotnet-7.0.2xx-2054
- dotnet-7.0.2xx-2035
- dotnet-7.0.1xx-xcode14.2-1040
- dotnet-7.0.1xx-xcode14.2-1007
- dotnet-7.0.1xx-xcode14-rc.2-1271
- dotnet-7.0.1xx-xcode14-1478
- dotnet-7.0.1xx-xcode13.3-2372
- dotnet-7.0.1xx-rc.2-1186
- dotnet-7.0.1xx-rc.1-1031
- dotnet-7.0.1xx-rc.1-1029
- dotnet-7.0.1xx-1477
- dotnet-6.0.4xx-xcode14.3-60
- dotnet-6.0.4xx-xcode14.2-46
- dotnet-6.0.4xx-xcode14.2-29
- dotnet-6.0.4xx-xcode14.2-19
- dotnet-6.0.4xx-xcode14.2-3
- dotnet-6.0.4xx-xcode14.1-229
- dotnet-6.0.4xx-xcode14.1-228
- dotnet-6.0.4xx-xcode14-523
- dotnet-6.0.4xx-xcode14-517
- dotnet-6.0.4xx-xcode14-507
- dotnet-6.0.4xx-465
- dotnet-6.0.4xx-455
- dotnet-6.0.4xx-454
- dotnet-6.0.4xx-447
- dotnet-6.0.4xx-430
- dotnet-6.0.4xx
- dotnet-6.0.3xx-315
- dotnet-6.0.3xx-311
- dotnet-6.0.3xx
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?