Merge remote-tracking branch 'origin/main' into bump-main-in-xcode14.1-2022-09-16
This commit is contained in:
Коммит
b230ef3601
|
@ -0,0 +1,70 @@
|
|||
name: Autoformat code
|
||||
on: pull_request
|
||||
|
||||
#
|
||||
# The autoformat action is a 2-parter:
|
||||
# Part 1 (this file):
|
||||
# * This is done in a safe context with no secrets (target: pull_request)
|
||||
# * We clone the repo and check out the pull request
|
||||
# * We run 'dotnet format' to format incorrectly formatted code (this is the potentially unsafe action, since who knows what kind of attach vector 'dotnet format' is)
|
||||
# * We see if any code was formatted, and create a commit with those changes.
|
||||
# * We preare a patch for the commit, and store it as an artifact.
|
||||
# Part 2 (autoformat2.yml):
|
||||
# * This is done in a context with more powers (most importantly it can push to forks)
|
||||
# * We get the πatch artifact from part 1
|
||||
# * We push the commit, and add a label to the PR.
|
||||
#
|
||||
# Ref:
|
||||
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
|
||||
# https://github.com/actions/checkout/issues/455
|
||||
#
|
||||
|
||||
jobs:
|
||||
autoformat-code:
|
||||
name: Autoformat code
|
||||
runs-on: ubuntu-latest
|
||||
if: contains(github.event.pull_request.labels.*.name, 'actions-enable-autoformat')
|
||||
|
||||
steps:
|
||||
- name: 'Checkout repo'
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: 'Autoformat'
|
||||
id: autoformat
|
||||
run: |
|
||||
set -exo pipefail
|
||||
|
||||
SRC_DIR=$(pwd)
|
||||
cd ..
|
||||
dotnet format "$SRC_DIR/tools/xibuild/xibuild.csproj"
|
||||
# add more projects here...
|
||||
cd "$SRC_DIR"
|
||||
|
||||
if git diff --exit-code >/dev/null; then
|
||||
echo "No code formatting occurred"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
git add -- .
|
||||
git config --global user.email "github-actions-autoformatter@xamarin.com"
|
||||
git config --global user.name "GitHub Actions Autoformatter"
|
||||
git checkout "$GITHUB_HEAD_REF"
|
||||
git commit -m "Auto-format source code"
|
||||
|
||||
mkdir -p autoformat
|
||||
echo ${{ github.event.number }} > ./autoformat/PR
|
||||
git format-patch HEAD^..HEAD --stdout > ./autoformat/autoformat.patch
|
||||
#cat ./autoformat/autoformat.patch
|
||||
|
||||
echo "::set-output name=autoformatted::true"
|
||||
|
||||
- name: 'Upload patch'
|
||||
uses: actions/upload-artifact@v2
|
||||
if: steps.autoformat.outputs.autoformatted == 'true'
|
||||
with:
|
||||
name: autoformat
|
||||
path: autoformat/
|
|
@ -0,0 +1,69 @@
|
|||
name: Autoformat code part 2
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Autoformat code"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
# See autoformat.yml for a description of what happens here.
|
||||
|
||||
jobs:
|
||||
push-and-notify:
|
||||
name: Push autoformatted code and notify user
|
||||
runs-on: ubuntu-latest
|
||||
if: >
|
||||
contains(github.event.pull_request.labels.*.name, 'actions-enable-autoformat') &&
|
||||
github.event.workflow_run.event == 'pull_request' &&
|
||||
github.event.workflow_run.conclusion == 'success'
|
||||
|
||||
steps:
|
||||
- name: 'Download artifacts'
|
||||
uses: actions/github-script@v3.1.0
|
||||
with:
|
||||
script: |
|
||||
var artifacts = await github.actions.listWorkflowRunArtifacts({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
run_id: ${{github.event.workflow_run.id }},
|
||||
});
|
||||
var matchArtifact = artifacts.data.artifacts.filter((artifact) => {
|
||||
return artifact.name == "autoformat"
|
||||
})[0];
|
||||
var download = await github.actions.downloadArtifact({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
artifact_id: matchArtifact.id,
|
||||
archive_format: 'zip',
|
||||
});
|
||||
var fs = require('fs');
|
||||
fs.writeFileSync('${{github.workspace}}/autoformat.zip', Buffer.from(download.data));
|
||||
|
||||
- run: unzip autoformat.zip
|
||||
|
||||
- name: 'Checkout repo'
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: 'Get autoformatted commit and push it'
|
||||
run: |
|
||||
git checkout "$GITHUB_HEAD_REF"
|
||||
git am < autoformat/autoformat.patch
|
||||
git show
|
||||
#git push
|
||||
|
||||
- name: 'Yell at user'
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
let fs = require('fs');
|
||||
let issue_number = Number(fs.readFileSync('./PR'));
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: issue_number,
|
||||
body: '# :warning: Your code has been automatically reformatted. :warning:\n\nIf this is not desired, add the `actions-skip-autoformat` label, and revert the reformatting commit.'
|
||||
});
|
|
@ -131,7 +131,7 @@ NUGET_HARDCODED_PRERELEASE_BRANCH_ALPHANUMERIC:=$(shell export LANG=C; printf "%
|
|||
ifneq ($(PULL_REQUEST_ID),)
|
||||
# we're a PR, so PR versioning
|
||||
NUGET_PRERELEASE_IDENTIFIER=-ci.pr.gh$(PULL_REQUEST_ID)
|
||||
else ifeq ($(NUGETNUGET_RELEASE_BRANCH_ALPHANUMERIC_RELEASE_BRANCH),$(CURRENT_BRANCH_ALPHANUMERIC))
|
||||
else ifeq ($(NUGET_RELEASE_BRANCH_ALPHANUMERIC),$(CURRENT_BRANCH_ALPHANUMERIC))
|
||||
# this is a release branch, so no prerelease identifier
|
||||
NUGET_PRERELEASE_IDENTIFIER=
|
||||
else ifeq ($(NUGET_HARDCODED_PRERELEASE_BRANCH_ALPHANUMERIC),$(CURRENT_BRANCH_ALPHANUMERIC))
|
||||
|
|
26
Makefile
26
Makefile
|
@ -38,15 +38,23 @@ ifdef INCLUDE_IOS
|
|||
endif
|
||||
endif
|
||||
@./system-dependencies.sh
|
||||
@echo "Building the packages:"
|
||||
@echo " Xamarin.iOS $(IOS_PACKAGE_VERSION)"
|
||||
@echo " Xamarin.Mac $(MAC_PACKAGE_VERSION)"
|
||||
@echo "and the NuGets:"
|
||||
@echo " Xamarin.iOS $(IOS_NUGET_VERSION_FULL)"
|
||||
@echo " Xamarin.tvOS $(TVOS_NUGET_VERSION_FULL)"
|
||||
@echo " Xamarin.watchOS $(WATCHOS_NUGET_VERSION_FULL)"
|
||||
@echo " Xamarin.macOS $(MACOS_NUGET_VERSION_FULL)"
|
||||
@echo " Xamarin.MacCatalyst $(MACCATALYST_NUGET_VERSION_FULL)"
|
||||
$(Q) $(MAKE) show-versions
|
||||
|
||||
show-versions:
|
||||
@echo "Building:"
|
||||
ifdef INCLUDE_XAMARIN_LEGACY
|
||||
@echo " The legacy package(s):"
|
||||
ifdef INCLUDE_IOS
|
||||
@echo " Xamarin.iOS $(IOS_PACKAGE_VERSION)"
|
||||
endif
|
||||
ifdef INCLUDE_MAC
|
||||
@echo " Xamarin.Mac $(MAC_PACKAGE_VERSION)"
|
||||
endif
|
||||
endif
|
||||
ifdef ENABLE_DOTNET
|
||||
@echo " The .NET NuGet(s):"
|
||||
@$(foreach platform,$(DOTNET_PLATFORMS),echo " Microsoft.$(platform) $($(shell echo $(platform) | tr 'a-z' 'A-Z')_NUGET_VERSION_FULL)";)
|
||||
endif
|
||||
|
||||
check-permissions:
|
||||
ifdef INCLUDE_MAC
|
||||
|
|
|
@ -10,12 +10,10 @@
|
|||
<clear />
|
||||
<!--Begin: Package sources managed by Dependency Flow automation. Do not edit the sources below.-->
|
||||
<!-- Begin: Package sources from dotnet-emsdk -->
|
||||
<add key="darc-pub-dotnet-emsdk-3f6c45a" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-emsdk-3f6c45a2/nuget/v3/index.json" />
|
||||
<!-- End: Package sources from dotnet-emsdk -->
|
||||
<!-- Begin: Package sources from dotnet-aspnetcore -->
|
||||
<!-- End: Package sources from dotnet-aspnetcore -->
|
||||
<!-- Begin: Package sources from dotnet-runtime -->
|
||||
<add key="darc-pub-dotnet-runtime-531f715" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-runtime-531f715f/nuget/v3/index.json" />
|
||||
<!-- End: Package sources from dotnet-runtime -->
|
||||
<!--End: Package sources managed by Dependency Flow automation. Do not edit the sources above.-->
|
||||
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" protocolVersion="3" />
|
||||
|
|
|
@ -144,7 +144,9 @@ endif
|
|||
/p:ToolChainManifestVersionBand="$(TOOLCHAIN_MANIFEST_VERSION_BAND)" \
|
||||
/bl \
|
||||
$(DOTNET_BUILD_VERBOSITY)
|
||||
$(Q) mkdir -p ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain/
|
||||
$(Q) $(CP) $(TOP)/packages/microsoft.net.workload.mono.toolchain.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(DOWNLOAD_DOTNET_VERSION)/data/WorkloadManifest.* ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain/
|
||||
$(Q) mkdir -p ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten/
|
||||
$(Q) $(CP) $(TOP)/packages/microsoft.net.workload.emscripten.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(EMSCRIPTEN_MANIFEST_PACKAGE_VERSION)/data/WorkloadManifest.* ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten/
|
||||
$(Q) touch $@
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
<Sha>531f715f281e7a6456375635c02b6dd301d95996</Sha>
|
||||
</Dependency>
|
||||
<!-- This is required for our test apps to build; in some cases Microsoft.AspNetCore.App is pulled in, and when building test apps the build needs to be able to resolve that -->
|
||||
<Dependency Name="Microsoft.AspNetCore.App.Ref" Version="6.0.5" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
|
||||
<Dependency Name="Microsoft.AspNetCore.App.Ref" Version="6.0.9" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">
|
||||
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-aspnetcore</Uri>
|
||||
<Sha>e5f183b656a0e8bc087108130a5a9b54ae94494e</Sha>
|
||||
<Sha>3fe12b935c03138f76364dc877a7e069e254b5b2</Sha>
|
||||
</Dependency>
|
||||
<Dependency Name="Microsoft.NET.Workload.Emscripten.Manifest-6.0.100" Version="6.0.9" CoherentParentDependency="Microsoft.NETCore.App.Ref">
|
||||
<Uri>https://github.com/dotnet/emsdk</Uri>
|
||||
|
|
|
@ -51,11 +51,13 @@ namespace CoreMedia {
|
|||
CMBufferCompare? compare;
|
||||
CMBufferGetSize? getTotalSize;
|
||||
|
||||
#if !NET
|
||||
delegate CMTime BufferGetTimeCallback (/* CMBufferRef */ IntPtr buf, /* void* */ IntPtr refcon);
|
||||
[return: MarshalAs (UnmanagedType.I1)]
|
||||
delegate bool BufferGetBooleanCallback (/* CMBufferRef */ IntPtr buf, /* void* */ IntPtr refcon);
|
||||
delegate int BufferCompareCallback (/* CMBufferRef */ IntPtr buf1, /* CMBufferRef */ IntPtr buf2, /* void* */ IntPtr refcon);
|
||||
delegate nint BufferGetSizeCallback (/* CMBufferRef */ IntPtr buffer, /* void* */ IntPtr refcon);
|
||||
#endif
|
||||
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
struct CMBufferCallbacks {
|
||||
|
@ -65,7 +67,7 @@ namespace CoreMedia {
|
|||
internal unsafe delegate* unmanaged<IntPtr, IntPtr, CMTime> XgetDecodeTimeStamp;
|
||||
internal unsafe delegate* unmanaged<IntPtr, IntPtr, CMTime> XgetPresentationTimeStamp;
|
||||
internal unsafe delegate* unmanaged<IntPtr, IntPtr, CMTime> XgetDuration;
|
||||
internal unsafe delegate* unmanaged<IntPtr, IntPtr, bool> XisDataReady;
|
||||
internal unsafe delegate* unmanaged<IntPtr, IntPtr, byte> XisDataReady;
|
||||
internal unsafe delegate* unmanaged<IntPtr, IntPtr, IntPtr, int> Xcompare;
|
||||
#else
|
||||
internal BufferGetTimeCallback? XgetDecodeTimeStamp;
|
||||
|
@ -398,17 +400,23 @@ namespace CoreMedia {
|
|||
|
||||
#if NET
|
||||
[UnmanagedCallersOnly]
|
||||
static byte GetDataReady (IntPtr buffer, IntPtr refcon)
|
||||
#else
|
||||
#if !MONOMAC
|
||||
[MonoPInvokeCallback (typeof (BufferGetBooleanCallback))]
|
||||
#endif
|
||||
#endif
|
||||
static bool GetDataReady (IntPtr buffer, IntPtr refcon)
|
||||
#endif
|
||||
{
|
||||
var queue = (CMBufferQueue?) GCHandle.FromIntPtr (refcon).Target;
|
||||
if (queue?.isDataReady is null)
|
||||
#if NET
|
||||
return 0;
|
||||
return (byte) (queue.isDataReady (queue.Surface (buffer)) ? 1 : 0);
|
||||
#else
|
||||
return false;
|
||||
return queue.isDataReady (queue.Surface (buffer));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if NET
|
||||
|
|
|
@ -54,7 +54,7 @@ endif
|
|||
#
|
||||
|
||||
package-tests:
|
||||
$(MAKE) qa-test-dependencies.zip mac-test-package.zip
|
||||
$(MAKE) mac-test-package.zip
|
||||
|
||||
test.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Version.Details.xml
|
||||
@rm -f $@
|
||||
|
@ -209,50 +209,6 @@ test-install-sources:
|
|||
@[[ -z "$$BUILD_REPOSITORY" ]] || ( xsltproc $(TOP)/tests/HtmlTransform.xslt $(NUNIT_MSBUILD_DIR)/TestResults_InstallSourcesTests.xml > $(TOP)/tests/index.html && echo "@MonkeyWrench: AddFile: $$PWD/index.html" )
|
||||
@if test -e $(NUNIT_MSBUILD_DIR)/.failed-stamp; then rm $(NUNIT_MSBUILD_DIR)/.failed-stamp; exit 1; fi
|
||||
|
||||
|
||||
ifdef ENABLE_XAMARIN
|
||||
ifdef INCLUDE_IOS
|
||||
qa-test-dependencies.zip:
|
||||
@$(MAKE) build-test-libraries
|
||||
@# Make sure we start from a clean slate
|
||||
$(Q) rm -rf $@ $@.tmpdir
|
||||
ifdef INCLUDE_TVOS
|
||||
@# TVOS
|
||||
$(Q) mkdir -p $@.tmpdir/tvos $@.tmpdir/tvsimulator
|
||||
$(Q) $(CP) $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/MonoTouch.Dialog-1.dll* $@.tmpdir/tvos
|
||||
$(Q) $(CP) $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/MonoTouch.NUnitLite.dll* $@.tmpdir/tvos
|
||||
$(Q) $(CP) $(TOP)/tests/test-libraries/.libs/tvos/libtest.a $@.tmpdir/tvos
|
||||
$(Q) $(CP) $(TOP)/tests/test-libraries/.libs/tvos/libtest.dylib $@.tmpdir/tvos
|
||||
$(Q) $(CP) -a $(TOP)/tests/test-libraries/.libs/tvos/XTest.framework $@.tmpdir/tvos
|
||||
$(Q) $(CP) $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/MonoTouch.Dialog-1.dll* $@.tmpdir/tvsimulator
|
||||
$(Q) $(CP) $(IOS_DESTDIR)$(MONOTOUCH_PREFIX)/lib/mono/Xamarin.TVOS/MonoTouch.NUnitLite.dll* $@.tmpdir/tvsimulator
|
||||
$(Q) $(CP) $(TOP)/tests/test-libraries/.libs/tvsimulator/libtest.a $@.tmpdir/tvsimulator
|
||||
$(Q) $(CP) $(TOP)/tests/test-libraries/.libs/tvsimulator/libtest.dylib $@.tmpdir/tvsimulator
|
||||
$(Q) $(CP) -a $(TOP)/tests/test-libraries/.libs/tvsimulator/XTest.framework $@.tmpdir/tvsimulator
|
||||
endif
|
||||
@# iOS
|
||||
$(Q) mkdir -p $@.tmpdir/iphoneos $@.tmpdir/iphonesimulator
|
||||
$(Q) $(CP) $(TOP)/tests/test-libraries/.libs/iphoneos/libtest.a $@.tmpdir/iphoneos
|
||||
$(Q) $(CP) $(TOP)/tests/test-libraries/.libs/iphoneos/libtest.dylib $@.tmpdir/iphoneos
|
||||
$(Q) $(CP) -a $(TOP)/tests/test-libraries/.libs/iphoneos/XTest.framework $@.tmpdir/iphoneos
|
||||
$(Q) $(CP) $(TOP)/tests/test-libraries/.libs/iphonesimulator/libtest.a $@.tmpdir/iphonesimulator
|
||||
$(Q) $(CP) $(TOP)/tests/test-libraries/.libs/iphonesimulator/libtest.dylib $@.tmpdir/iphonesimulator
|
||||
$(Q) $(CP) -a $(TOP)/tests/test-libraries/.libs/iphonesimulator/XTest.framework $@.tmpdir/iphonesimulator
|
||||
$(Q) printf '#!/bin/bash -e\n\n/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch "$$@"\n' > $@.tmpdir/mlaunch
|
||||
$(Q) chmod +x $@.tmpdir/mlaunch
|
||||
@# Generate zip
|
||||
$(Q_GEN) cd $@.tmpdir && zip -9r $(abspath $@) .
|
||||
@# Cleanup
|
||||
$(Q) rm -rf $@.tmpdir
|
||||
else
|
||||
qa-test-dependencies.zip:
|
||||
@echo Not enabled
|
||||
endif
|
||||
else
|
||||
qa-test-dependencies.zip:
|
||||
@echo Xamarin build not enabled
|
||||
endif
|
||||
|
||||
ifdef INCLUDE_MAC
|
||||
mac-test-package.zip:
|
||||
./package-mac-tests.sh
|
||||
|
|
|
@ -12,7 +12,8 @@ namespace Cecil.Tests {
|
|||
[TestFixture]
|
||||
public class EnumTest {
|
||||
|
||||
[TestCaseSource (typeof (Helper), "PlatformAssemblies")]
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblies))]
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblies))]
|
||||
// https://github.com/xamarin/xamarin-macios/issues/9724
|
||||
public void NoAvailabilityOnError (string assemblyPath)
|
||||
{
|
||||
|
|
|
@ -163,6 +163,9 @@ namespace Cecil.Tests {
|
|||
|
||||
public static IEnumerable PlatformAssemblies {
|
||||
get {
|
||||
if (!Configuration.include_legacy_xamarin)
|
||||
yield break;
|
||||
|
||||
if (Configuration.include_ios) {
|
||||
// we want to process 32/64 bits individually since their content can differ
|
||||
yield return new TestCaseData (Path.Combine (Configuration.MonoTouchRootDirectory, "lib", "32bits", "iOS", "Xamarin.iOS.dll"));
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace Cecil.Tests {
|
|||
[TestFixture]
|
||||
public class MarshalAsTest {
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblies))]
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblies))]
|
||||
public void TestAssembly (string assemblyPath)
|
||||
{
|
||||
var assembly = Helper.GetAssembly (assemblyPath);
|
||||
|
@ -82,6 +83,11 @@ namespace Cecil.Tests {
|
|||
var rv = true;
|
||||
|
||||
var type = tr.Resolve ();
|
||||
|
||||
// System.Runtime.InteropServices.NFloat is in a custom assembly in .NET 6, so add a special case.
|
||||
if (type is null && tr.FullName == "System.Runtime.InteropServices.NFloat")
|
||||
return true;
|
||||
|
||||
if (type.IsEnum)
|
||||
return true;
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace Cecil.Tests {
|
|||
public class Test {
|
||||
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblies))]
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformImplementationAssemblies))]
|
||||
// ref: https://github.com/xamarin/xamarin-macios/pull/7760
|
||||
public void IdentifyBackingFieldAssignation (string assemblyPath)
|
||||
{
|
||||
|
@ -50,6 +51,7 @@ namespace Cecil.Tests {
|
|||
}
|
||||
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblies))]
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformImplementationAssemblies))]
|
||||
// ref: https://github.com/xamarin/xamarin-macios/issues/8249
|
||||
public void EnsureUIThreadOnInit (string assemblyPath)
|
||||
{
|
||||
|
@ -84,6 +86,7 @@ namespace Cecil.Tests {
|
|||
}
|
||||
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblies))]
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblies))]
|
||||
public void NoSystemConsoleReference (string assemblyPath)
|
||||
{
|
||||
if (Path.GetFileName (assemblyPath) == "Xamarin.Mac.dll")
|
||||
|
@ -126,6 +129,7 @@ namespace Cecil.Tests {
|
|||
};
|
||||
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblies))]
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblies))]
|
||||
public void NoBannedApi (string assemblyPath)
|
||||
{
|
||||
var assembly = Helper.GetAssembly (assemblyPath);
|
||||
|
@ -151,6 +155,7 @@ namespace Cecil.Tests {
|
|||
}
|
||||
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.PlatformAssemblies))]
|
||||
[TestCaseSource (typeof (Helper), nameof (Helper.NetPlatformAssemblies))]
|
||||
// ref: https://github.com/xamarin/xamarin-macios/issues/4835
|
||||
public void Unavailable (string assemblyPath)
|
||||
{
|
||||
|
@ -159,17 +164,23 @@ namespace Cecil.Tests {
|
|||
var platform = PlatformName.None;
|
||||
switch (assembly.Name.Name) {
|
||||
case "Xamarin.Mac":
|
||||
case "Microsoft.macOS":
|
||||
platform = PlatformName.MacOSX;
|
||||
break;
|
||||
case "Xamarin.iOS":
|
||||
case "Microsoft.iOS":
|
||||
platform = PlatformName.iOS;
|
||||
break;
|
||||
case "Xamarin.WatchOS":
|
||||
platform = PlatformName.WatchOS;
|
||||
break;
|
||||
case "Xamarin.TVOS":
|
||||
case "Microsoft.tvOS":
|
||||
platform = PlatformName.TvOS;
|
||||
break;
|
||||
case "Microsoft.MacCatalyst":
|
||||
platform = PlatformName.MacCatalyst;
|
||||
break;
|
||||
}
|
||||
Assert.That (platform, Is.Not.EqualTo (PlatformName.None), "None");
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ namespace Xamarin.Tests
|
|||
public static bool include_maccatalyst;
|
||||
public static bool include_device;
|
||||
public static bool include_dotnet;
|
||||
public static bool include_legacy_xamarin;
|
||||
|
||||
static Version xcode_version;
|
||||
public static Version XcodeVersion {
|
||||
|
@ -295,6 +296,7 @@ namespace Xamarin.Tests
|
|||
include_maccatalyst = !string.IsNullOrEmpty (GetVariable ("INCLUDE_MACCATALYST", ""));
|
||||
include_device = !string.IsNullOrEmpty (GetVariable ("INCLUDE_DEVICE", ""));
|
||||
include_dotnet = !string.IsNullOrEmpty (GetVariable ("ENABLE_DOTNET", ""));
|
||||
include_legacy_xamarin = !string.IsNullOrEmpty (GetVariable ("INCLUDE_LEGACY_XAMARIN", ""));
|
||||
DotNetBclDir = GetVariable ("DOTNET_BCL_DIR", null);
|
||||
DotNetCscCommand = GetVariable ("DOTNET_CSC_COMMAND", null)?.Trim ('\'');
|
||||
DotNetExecutable = GetVariable ("DOTNET", null);
|
||||
|
|
|
@ -154,8 +154,5 @@
|
|||
<BundleResource Include="$(IntrospectionTestDirectory)\xamarin1.png">
|
||||
<Link>xamarin1.png</Link>
|
||||
</BundleResource>
|
||||
<BundleResource Include="$(IntrospectionTestDirectory)\..\..\tools\mtouch\simlauncher64-sgen.frameworks">
|
||||
<Link>simlauncher64-sgen.frameworks</Link>
|
||||
</BundleResource>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,78 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace Xamarin.MacDev.Tasks
|
||||
{
|
||||
class XIProject : IDisposable {
|
||||
public string OriginalProjectDirectory { get; private set; }
|
||||
public IEnumerable<string> DependentSiblings { get; private set; }
|
||||
public string ProjectDirectory { get; private set; }
|
||||
|
||||
static string ResolveSymlinks (string path)
|
||||
{
|
||||
using (var p = new Process ()) {
|
||||
p.StartInfo.FileName = "pwd";
|
||||
p.StartInfo.Arguments = "-P";
|
||||
p.StartInfo.WorkingDirectory = path;
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.StartInfo.RedirectStandardOutput = true;
|
||||
p.Start ();
|
||||
return p.StandardOutput.ReadToEnd ().Trim ('\n', '\r', ' ', '\t');
|
||||
}
|
||||
}
|
||||
|
||||
public static XIProject Clone (string projectDirectory, params string[] dependentSiblings)
|
||||
{
|
||||
var tmpdir = Path.GetTempFileName ();
|
||||
File.Delete (tmpdir);
|
||||
Directory.CreateDirectory (tmpdir);
|
||||
tmpdir = ResolveSymlinks (tmpdir); // We need to resolve any symlinks, otherwise MSBuild fails in strange ways.
|
||||
|
||||
// Calculate the directories to copy
|
||||
var dirs = new List<string> (1 + dependentSiblings.Length);
|
||||
dirs.Add (projectDirectory);
|
||||
foreach (var ds in dependentSiblings)
|
||||
dirs.Add (Path.Combine (Path.GetDirectoryName (projectDirectory), ds));
|
||||
|
||||
foreach (var dir in dirs) {
|
||||
// execute 'git clean -fxd' first so that we don't copy more than needed.
|
||||
using (var p = new Process ()) {
|
||||
p.StartInfo.FileName = "git";
|
||||
p.StartInfo.Arguments = "clean -xfd";
|
||||
p.StartInfo.WorkingDirectory = dir;
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
p.Start ();
|
||||
Console.WriteLine ("cd {2} && {0} {1}", p.StartInfo.FileName, p.StartInfo.Arguments, p.StartInfo.WorkingDirectory);
|
||||
p.WaitForExit ();
|
||||
}
|
||||
|
||||
using (var p = new Process ()) {
|
||||
p.StartInfo.FileName = "cp";
|
||||
p.StartInfo.Arguments = "-av \"" + dir + "\" \"" + tmpdir + "\"";
|
||||
p.StartInfo.WorkingDirectory = dir;
|
||||
p.StartInfo.UseShellExecute = false;
|
||||
Console.WriteLine ("cd {2} && {0} {1}", p.StartInfo.FileName, p.StartInfo.Arguments, p.StartInfo.WorkingDirectory);
|
||||
p.Start ();
|
||||
p.WaitForExit ();
|
||||
}
|
||||
}
|
||||
|
||||
return new XIProject {
|
||||
OriginalProjectDirectory = projectDirectory,
|
||||
ProjectDirectory = tmpdir,
|
||||
DependentSiblings = dependentSiblings,
|
||||
};
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
try {
|
||||
Directory.Delete (ProjectDirectory, true);
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine ("Failed to delete directory {0}: {1}", ProjectDirectory, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using Xharness.TestImporter;
|
||||
|
||||
namespace Xharness.BCLTestImporter {
|
||||
public class BCLTestAssemblyDefinition {
|
||||
|
||||
public IAssemblyLocator AssemblyLocator { get; set; }
|
||||
|
||||
#region static vars
|
||||
|
||||
static readonly Dictionary<Platform, string> downloadPartialPath = new Dictionary<Platform, string> {
|
||||
{Platform.iOS, "ios-bcl"},
|
||||
{Platform.WatchOS, "ios-bcl"},
|
||||
{Platform.TvOS, "ios-bcl"},
|
||||
{Platform.MacOSFull, "mac-bcl"},
|
||||
{Platform.MacOSModern, "mac-bcl"},
|
||||
};
|
||||
static readonly Dictionary <Platform, string> platformPathMatch = new Dictionary <Platform, string> {
|
||||
{Platform.iOS, "monotouch"},
|
||||
{Platform.WatchOS, "monotouch_watch"},
|
||||
{Platform.TvOS, "monotouch_tv"},
|
||||
{Platform.MacOSFull, "xammac_net_4_5"},
|
||||
{Platform.MacOSModern, "xammac"},
|
||||
};
|
||||
#endregion
|
||||
|
||||
#region properties
|
||||
|
||||
public string Name { get; set; }
|
||||
public bool IsXUnit { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public BCLTestAssemblyDefinition (string name, IAssemblyLocator locator)
|
||||
{
|
||||
Name = name ?? throw new ArgumentNullException (nameof (name));
|
||||
AssemblyLocator = locator ?? throw new ArgumentNullException (nameof (locator));
|
||||
// the following pattern is used when generating xunit test
|
||||
// assemblies
|
||||
IsXUnit = name.Contains ("_xunit-test");
|
||||
}
|
||||
|
||||
public string GetName (Platform platform)
|
||||
{
|
||||
switch (platform) {
|
||||
case Platform.WatchOS:
|
||||
return Name.Replace ("monotouch_", "monotouch_watch_");
|
||||
case Platform.TvOS:
|
||||
return Name.Replace ("monotouch_", "monotouch_tv_");
|
||||
case Platform.MacOSModern:
|
||||
return Name.Replace ("xammac_net_4_5", "xammac");
|
||||
default:
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the directory from the downloads where tests can be found.
|
||||
/// </summary>
|
||||
/// <returns>The test directory from downloads path.</returns>
|
||||
/// <param name="downloadsPath">Downloads path.</param>
|
||||
/// <param name="platform">Platform whose tests we require.</param>
|
||||
public string GetTestDirectoryFromDownloadsPath (Platform platform)
|
||||
{
|
||||
var downloadsPath = AssemblyLocator.GetAssembliesRootLocation (platform);
|
||||
|
||||
switch (platform) {
|
||||
case Platform.MacOSFull:
|
||||
case Platform.MacOSModern:
|
||||
return Path.Combine (downloadsPath, "mac-bcl", platformPathMatch [platform], "tests");
|
||||
case Platform.iOS:
|
||||
case Platform.TvOS:
|
||||
case Platform.WatchOS:
|
||||
return Path.Combine (downloadsPath, "ios-bcl", platformPathMatch [platform], "tests");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string GetHintPathForReferenceAssembly (string assembly, string monoRootPath, Platform platform)
|
||||
{
|
||||
var hintPath = Path.Combine (monoRootPath, downloadPartialPath [platform], platformPathMatch [platform], $"{assembly}.dll");
|
||||
if (File.Exists (hintPath)) {
|
||||
return hintPath;
|
||||
} else {
|
||||
// we could be referencing a dll in the test dir, lets test that
|
||||
hintPath = Path.Combine (monoRootPath, downloadPartialPath [platform], platformPathMatch [platform], "tests", $"{assembly}.dll");
|
||||
}
|
||||
return File.Exists (hintPath) ? hintPath : null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the path of the test assembly within the mono checkout.
|
||||
/// </summary>
|
||||
/// <param name="platform">The platform we are working with.</param>
|
||||
/// <returns>The full path of the assembly.</returns>
|
||||
public string GetPath (Platform platform)
|
||||
{
|
||||
var testsRootPath = GetTestDirectoryFromDownloadsPath (platform);
|
||||
return Path.Combine (testsRootPath, GetName (platform));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ namespace Xharness.Tests.Jenkins {
|
|||
[TestCase ("run-monotouch-tests, run-bgen-tests, run-bcl-tests, skip-all-tests", TestLabel.Bcl | TestLabel.Bgen | TestLabel.Monotouch, PlatformLabel.None)]
|
||||
[TestCase ("run-monotouch-tests, run-bgen-tests, skip-all-tests, run-bcl-tests", TestLabel.Bcl | TestLabel.Bgen | TestLabel.Monotouch, PlatformLabel.None)]
|
||||
[TestCase ("run-monotouch-tests, run-bgen-tests, run-all-tests, run-bcl-tests", TestLabel.All, PlatformLabel.All)]
|
||||
public void SelectTetByLabelsTest (string cmdLabels, TestLabel expectedResult, PlatformLabel expectedPlatform)
|
||||
public void SelectTestByLabelsTest (string cmdLabels, TestLabel expectedResult, PlatformLabel expectedPlatform)
|
||||
{
|
||||
var labels = new HashSet<string> ();
|
||||
labels.UnionWith (cmdLabels.Split (','));
|
||||
|
|
|
@ -147,7 +147,6 @@
|
|||
<Compile Include="Targets\TVOSTarget.cs" />
|
||||
<Compile Include="Targets\UnifiedTarget.cs" />
|
||||
<Compile Include="Targets\WatchOSTarget.cs" />
|
||||
<Compile Include="TestImporter\BCLTestAssemblyDefinition.cs" />
|
||||
<Compile Include="TestImporter\IAssemblyLocator.cs" />
|
||||
<Compile Include="TestImporter\ITestAssemblyDefinition.cs" />
|
||||
<Compile Include="TestImporter\Platform.cs" />
|
||||
|
|
|
@ -3,14 +3,9 @@ TOP=..
|
|||
include $(TOP)/Make.config
|
||||
|
||||
ifdef INCLUDE_MAC
|
||||
ifdef INCLUDE_XAMARIN_LEGACY
|
||||
SUBDIRS+=mmp
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef INCLUDE_XAMARIN_LEGACY
|
||||
SUBDIRS += mtouch
|
||||
endif
|
||||
|
||||
ifdef INCLUDE_XAMARIN_LEGACY
|
||||
SUBDIRS += xibuild
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash -eux
|
||||
|
||||
WORKLOAD_DST="$BUILD_SOURCESDIRECTORY/WorkloadRollback.json"
|
||||
|
||||
var=$(make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable VARIABLE=DOTNET_PLATFORMS)
|
||||
DOTNET_PLATFORMS=${var#*=}
|
||||
echo "Dotnet platforms are '$DOTNET_PLATFORMS'"
|
||||
|
||||
echo "{" > "$WORKLOAD_DST"
|
||||
for platform in $DOTNET_PLATFORMS; do
|
||||
CURRENT_UPPER=$(echo "$platform" | tr "[:lower:]" "[:upper:]")
|
||||
CURRENT_LOWER=$(echo "$platform" | tr "[:upper:]" "[:lower:]")
|
||||
|
||||
var=$(make -C "$BUILD_SOURCESDIRECTORY"/xamarin-macios/tools/devops print-variable "VARIABLE=${CURRENT_UPPER}_NUGET_VERSION_FULL")
|
||||
NUGET_VERSION_FULL=${var#*=}
|
||||
NUGET_VERSION_FULL=$(echo "$NUGET_VERSION_FULL" | cut -d "+" -f1)
|
||||
|
||||
echo "\"microsoft.net.sdk.$CURRENT_LOWER\": \"$NUGET_VERSION_FULL\"," >> "$WORKLOAD_DST"
|
||||
done
|
||||
|
||||
# Remove the trailing comma from the last entry, because json :/
|
||||
sed -i '' '$ s/,$//' "$WORKLOAD_DST"
|
||||
|
||||
echo "}" >> "$WORKLOAD_DST"
|
||||
|
||||
echo "Rollback file contents:"
|
||||
cat "$WORKLOAD_DST"
|
|
@ -65,35 +65,9 @@ steps:
|
|||
- ${{ if eq(parameters.enableDotnet, true) }}:
|
||||
- template: build-nugets.yml
|
||||
|
||||
- bash: |
|
||||
var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=IOS_NUGET_VERSION_FULL)
|
||||
IOS_NUGET_VERSION_FULL=${var#*=}
|
||||
IOS_NUGET_VERSION_FULL=$(echo $IOS_NUGET_VERSION_FULL | cut -d "+" -f1)
|
||||
|
||||
var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=TVOS_NUGET_VERSION_FULL)
|
||||
TVOS_NUGET_VERSION_FULL=${var#*=}
|
||||
TVOS_NUGET_VERSION_FULL=$(echo $TVOS_NUGET_VERSION_FULL | cut -d "+" -f1)
|
||||
|
||||
var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=MACOS_NUGET_VERSION_FULL)
|
||||
MACOS_NUGET_VERSION_FULL=${var#*=}
|
||||
MACOS_NUGET_VERSION_FULL=$(echo $MACOS_NUGET_VERSION_FULL | cut -d "+" -f1)
|
||||
|
||||
var=$(make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops print-variable VARIABLE=MACCATALYST_NUGET_VERSION_FULL)
|
||||
MACCATALYST_NUGET_VERSION_FULL=${var#*=}
|
||||
MACCATALYST_NUGET_VERSION_FULL=$(echo $MACCATALYST_NUGET_VERSION_FULL | cut -d "+" -f1)
|
||||
WORKLOAD_DST="$(Build.SourcesDirectory)/WorkloadRollback.json"
|
||||
|
||||
echo "{" > $WORKLOAD_DST
|
||||
echo "\"microsoft.net.sdk.ios\": \"$IOS_NUGET_VERSION_FULL\"," >> $WORKLOAD_DST
|
||||
echo "\"microsoft.net.sdk.tvos\": \"$TVOS_NUGET_VERSION_FULL\"," >> $WORKLOAD_DST
|
||||
echo "\"microsoft.net.sdk.macos\": \"$MACOS_NUGET_VERSION_FULL\"," >> $WORKLOAD_DST
|
||||
echo "\"microsoft.net.sdk.maccatalyst\": \"$MACCATALYST_NUGET_VERSION_FULL\"" >> $WORKLOAD_DST
|
||||
echo "}" >> $WORKLOAD_DST
|
||||
|
||||
echo "Rollback file contents:"
|
||||
echo "$(cat $WORKLOAD_DST)"
|
||||
- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/generate-workload-rollback.sh
|
||||
name: workload_file
|
||||
displayName: 'Generate "WorkloadRollback.json'
|
||||
displayName: 'Generate "WorkloadRollback.json"'
|
||||
|
||||
- task: PublishPipelineArtifact@1
|
||||
displayName: 'Publish WorkloadRollback.json'
|
||||
|
|
|
@ -72,22 +72,18 @@ steps:
|
|||
- pwsh: |
|
||||
$workloadPath = "$(Build.SourcesDirectory)/artifacts/WorkloadRollback/WorkloadRollback.json"
|
||||
$versionData = Get-Content $workloadPath | ConvertFrom-Json
|
||||
# could be done in a loop, but we don't want to be smart just yet
|
||||
$iOSVersion = $versionData | Select-Object -ExpandProperty "microsoft.net.sdk.ios"
|
||||
Write-Host "iOS workload version is $iOSVersion"
|
||||
Write-Host "##vso[task.setvariable variable=IOS_WORKLOAD_VERSION;]$iOSVersion"
|
||||
|
||||
$tvOSVersion = $versionData | Select-Object -ExpandProperty "microsoft.net.sdk.tvos"
|
||||
Write-Host "tvOS workload version is $tvOSVersion"
|
||||
Write-Host "##vso[task.setvariable variable=TVOS_WORKLOAD_VERSION;]$tvOSVersion"
|
||||
|
||||
$macVersion = $versionData | Select-Object -ExpandProperty "microsoft.net.sdk.macos"
|
||||
Write-Host "macOS workload version is $macVersion"
|
||||
Write-Host "##vso[task.setvariable variable=MACOS_WORKLOAD_VERSION;]$macVersion"
|
||||
|
||||
$catalystVersion = $versionData | Select-Object -ExpandProperty "microsoft.net.sdk.maccatalyst"
|
||||
Write-Host "MacCatalyst workload version is $catalystVersion "
|
||||
Write-Host "##vso[task.setvariable variable=MACCATALYST_WORKLOAD_VERSION;]$catalystVersion"
|
||||
$platforms = $("iOS", "tvOS", "macOS", "MacCatalyst")
|
||||
foreach ($platform in $platforms) {
|
||||
$platformLower = $platform.ToLowerInvariant()
|
||||
$platformUpper = $platform.ToUpperInvariant()
|
||||
$version = $versionData."microsoft.net.sdk.$platformLower"
|
||||
if (![string]::IsNullOrEmpty($version)) {
|
||||
Write-Host "Platform: $platform has version $version"
|
||||
Write-Host "##vso[task.setvariable variable=$($platformUpper)_WORKLOAD_VERSION;]$version"
|
||||
} else {
|
||||
Write-Host "Platform: $platform has no version (disabled?)"
|
||||
}
|
||||
}
|
||||
displayName: 'Set workload versions for xtro'
|
||||
|
||||
- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/install-workloads.sh
|
||||
|
|
|
@ -9,9 +9,10 @@ using static Xamarin.Provisioning.ProvisioningScript;
|
|||
// Provision Xcode using the xip name declared in Make.config
|
||||
Xcode ("@XCODE_XIP_NAME@").XcodeSelect (allowUntrusted: true);
|
||||
|
||||
Item ("@MONO_PACKAGE@");
|
||||
|
||||
// provisionator knows how to deal with this items
|
||||
if (!string.IsNullOrEmpty ("@INCLUDE_XAMARIN_LEGACY@")) {
|
||||
Item ("@MONO_PACKAGE@");
|
||||
Item ("@VS_PACKAGE@");
|
||||
if (!string.IsNullOrEmpty ("@INCLUDE_IOS@"))
|
||||
Item ("@XI_PACKAGE@");
|
||||
|
|
Загрузка…
Ссылка в новой задаче