Merge remote-tracking branch 'upstream/master' into mono-2019-02

This commit is contained in:
Alexander Köplinger 2019-04-09 21:06:44 +02:00
Родитель 07e454bb40 da007e5781
Коммит e42e1e8fce
16 изменённых файлов: 208 добавлений и 43 удалений

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

@ -1,5 +1,5 @@
ifdef ENABLE_XAMARIN
NEEDED_MACCORE_VERSION := b1322257641d4059e0eb5ae9f17ebfa0d2232b80
NEEDED_MACCORE_VERSION := 9eef60828aa36655aeae220143e8d088e0f073ce
NEEDED_MACCORE_BRANCH := master
MACCORE_DIRECTORY := maccore

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

@ -170,8 +170,8 @@
new XDelegate ("MonoObject *", "IntPtr", "xamarin_get_inative_object_static",
"id", "IntPtr", "obj",
"bool", "bool", "owns",
"const char *", "string", "type_name",
"const char *", "string", "iface_name"
"unsigned int", "uint", "iface_token_ref",
"unsigned int", "uint", "implementation_token_ref"
) {
WrappedManagedFunction = "GetINativeObject_Static",
OnlyDynamicUsage = false,

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

@ -172,7 +172,7 @@ $(IOS_BUILD_DIR)/reference/System.Drawing.dll: $(IOS_SYSTEM_DRAWING_SOURCES) mon
$(IOS_SYSTEM_DRAWING_SOURCES)
$(IOS_BUILD_DIR)/reference/Xamarin.iOS.dll: $(IOS_BUILD_DIR)/native-64/Xamarin.iOS.dll | $(IOS_BUILD_DIR)/reference
$(Q_GEN) mono-cil-strip $< $@
$(Q_STRIP) mono-cil-strip -q $< $@
$(IOS_BUILD_DIR)/reference/Xamarin.iOS.pdb: $(IOS_BUILD_DIR)/native-64/Xamarin.iOS.pdb | $(IOS_BUILD_DIR)/reference
$(Q) $(CP) $< $@
@ -661,7 +661,7 @@ $(WATCH_BUILD_DIR)/watch-32/Xamarin.WatchOS%dll $(WATCH_BUILD_DIR)/watch-32/Xama
$(WATCHOS_SOURCES) @$(WATCH_BUILD_DIR)/watch/generated_sources
$(WATCH_BUILD_DIR)/reference/Xamarin.WatchOS.dll: $(WATCH_BUILD_DIR)/watch-32/Xamarin.WatchOS.dll | $(WATCH_BUILD_DIR)/reference
$(Q_GEN) mono-cil-strip $< $@
$(Q_STRIP) mono-cil-strip -q $< $@
$(WATCH_BUILD_DIR)/reference/Xamarin.WatchOS.pdb: $(WATCH_BUILD_DIR)/watch-32/Xamarin.WatchOS.pdb | $(WATCH_BUILD_DIR)/reference
$(Q) $(CP) $< $@
@ -831,7 +831,7 @@ $(TVOS_BUILD_DIR)/tvos-64/Xamarin.TVOS%dll $(TVOS_BUILD_DIR)/tvos-64/Xamarin.TVO
$(TVOS_SOURCES) @$(TVOS_BUILD_DIR)/tvos/generated_sources
$(TVOS_BUILD_DIR)/reference/Xamarin.TVOS.dll: $(TVOS_BUILD_DIR)/tvos-64/Xamarin.TVOS.dll | $(TVOS_BUILD_DIR)/reference
$(Q_GEN) mono-cil-strip $< $@
$(Q_STRIP) mono-cil-strip -q $< $@
$(TVOS_BUILD_DIR)/reference/Xamarin.TVOS.pdb: $(TVOS_BUILD_DIR)/tvos-64/Xamarin.TVOS.pdb | $(TVOS_BUILD_DIR)/reference
$(Q) $(CP) $< $@

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

@ -259,7 +259,7 @@ namespace ObjCRuntime {
baseMethod = null;
if (token_ref != Runtime.INVALID_TOKEN_REF)
return (Type) Class.ResolveTokenReference (token_ref, 0x02000000 /* TypeDef */);
return Class.ResolveTypeTokenReference (token_ref);
baseMethod = minfo.GetBaseDefinition ();
var delegateProxies = baseMethod.ReturnTypeCustomAttributes.GetCustomAttributes (typeof (DelegateProxyAttribute), false);

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

@ -347,11 +347,7 @@ namespace ObjCRuntime {
// Resolve the map entry we found to a managed type
var type_reference = map->map [mapIndex].type_reference;
var member = ResolveTokenReference (type_reference, 0x02000000);
type = member as Type;
if (type == null && member != null)
throw ErrorHelper.CreateError (8022, $"Expected the token reference 0x{type_reference:X} to be a type, but it's a {member.GetType ().Name}. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new.");
type = ResolveTypeTokenReference (type_reference);
#if LOG_TYPELOAD
Console.WriteLine ($"FindType (0x{@class:X} = {Marshal.PtrToStringAuto (class_getName (@class))}) => {type.FullName}; is custom: {is_custom_type} (token reference: 0x{type_reference:X}).");
@ -379,7 +375,29 @@ namespace ObjCRuntime {
return ResolveToken (module, token);
}
internal unsafe static MemberInfo ResolveTokenReference (uint token_reference, uint implicit_token_type)
internal static Type ResolveTypeTokenReference (uint token_reference)
{
var member = ResolveTokenReference (token_reference, 0x02000000 /* TypeDef */);
if (member == null)
return null;
if (member is Type type)
return type;
throw ErrorHelper.CreateError (8022, $"Expected the token reference 0x{token_reference:X} to be a type, but it's a {member.GetType ().Name}. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new.");
}
internal static MethodBase ResolveMethodTokenReference (uint token_reference)
{
var member = ResolveTokenReference (token_reference, 0x06000000 /* Method */);
if (member == null)
return null;
if (member is MethodBase method)
return method;
throw ErrorHelper.CreateError (8022, $"Expected the token reference 0x{token_reference:X} to be a method, but it's a {member.GetType ().Name}. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new.");
}
unsafe static MemberInfo ResolveTokenReference (uint token_reference, uint implicit_token_type)
{
var map = Runtime.options->RegistrationMap;

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

@ -898,10 +898,10 @@ namespace Registrar {
public void GetMethodDescriptionAndObject (Type type, IntPtr selector, bool is_static, IntPtr obj, ref IntPtr mthis, IntPtr desc)
{
var sel = new Selector (selector);
var res = GetMethodNoThrow (type, type, sel.Name, is_static);
var sel = Selector.GetName (selector);
var res = GetMethodNoThrow (type, type, sel, is_static);
if (res == null)
throw ErrorHelper.CreateError (8006, "Failed to find the selector '{0}' on the type '{1}'", sel.Name, type.FullName);
throw ErrorHelper.CreateError (8006, "Failed to find the selector '{0}' on the type '{1}'", sel, type.FullName);
if (res.IsInstanceCategory) {
mthis = IntPtr.Zero;
@ -919,10 +919,10 @@ namespace Registrar {
public void GetMethodDescription (Type type, IntPtr selector, bool is_static, IntPtr desc)
{
var sel = new Selector (selector);
var res = GetMethodNoThrow (type, type, sel.Name, is_static);
var sel = Selector.GetName (selector);
var res = GetMethodNoThrow (type, type, sel, is_static);
if (res == null)
throw ErrorHelper.CreateError (8006, "Failed to find the selector '{0}' on the type '{1}'", sel.Name, type.FullName);
throw ErrorHelper.CreateError (8006, "Failed to find the selector '{0}' on the type '{1}'", sel, type.FullName);
if (type.IsGenericType && res.Method is ConstructorInfo)
throw ErrorHelper.CreateError (4133, "Cannot construct an instance of the type '{0}' from Objective-C because the type is generic.", type.FullName);

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

@ -657,12 +657,7 @@ namespace ObjCRuntime {
static unsafe IntPtr GetMethodFromToken (uint token_ref)
{
var method = Class.ResolveTokenReference (token_ref, 0x06000000);
var mb = method as MethodBase;
if (method != null && mb == null)
throw ErrorHelper.CreateError (8022, $"Expected the token reference 0x{token_ref:X} to be a method, but it's a {method.GetType ().Name}. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new.");
var method = Class.ResolveMethodTokenReference (token_ref);
if (method != null)
return ObjectWrapper.Convert (method);
@ -671,19 +666,15 @@ namespace ObjCRuntime {
static unsafe IntPtr GetGenericMethodFromToken (IntPtr obj, uint token_ref)
{
var method = Class.ResolveTokenReference (token_ref, 0x06000000);
var method = Class.ResolveMethodTokenReference (token_ref);
if (method == null)
return IntPtr.Zero;
var mb = method as MethodBase;
if (mb == null)
throw ErrorHelper.CreateError (8022, $"Expected the token reference 0x{token_ref:X} to be a method, but it's a {method.GetType ().Name}. Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new.");
var nsobj = ObjectWrapper.Convert (obj) as NSObject;
if (nsobj == null)
throw ErrorHelper.CreateError (8023, $"An instance object is required to construct a closed generic method for the open generic method: {mb.DeclaringType.FullName}.{mb.Name} (token reference: 0x{token_ref:X}). Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new.");
throw ErrorHelper.CreateError (8023, $"An instance object is required to construct a closed generic method for the open generic method: {method.DeclaringType.FullName}.{method.Name} (token reference: 0x{token_ref:X}). Please file a bug report at https://github.com/xamarin/xamarin-macios/issues/new.");
return ObjectWrapper.Convert (FindClosedMethod (nsobj.GetType (), mb));
return ObjectWrapper.Convert (FindClosedMethod (nsobj.GetType (), method));
}
static IntPtr TryGetOrConstructNSObjectWrapped (IntPtr ptr)
@ -701,14 +692,14 @@ namespace ObjCRuntime {
return ObjectWrapper.Convert (GetINativeObject (ptr, owns, type));
}
static IntPtr GetINativeObject_Static (IntPtr ptr, bool owns, string typename, string ifacename)
static IntPtr GetINativeObject_Static (IntPtr ptr, bool owns, uint iface_token, uint implementation_token)
{
/*
* This method is called from generated code from the static registrar.
*/
var iface = Type.GetType (ifacename, true);
var type = Type.GetType (typename, true);
var iface = Class.ResolveTypeTokenReference (iface_token);
var type = Class.ResolveTypeTokenReference (implementation_token);
return ObjectWrapper.Convert (GetINativeObject (ptr, owns, iface, type));
}
@ -1480,7 +1471,7 @@ namespace ObjCRuntime {
if (token != INVALID_TOKEN_REF) {
var wrapper_token = xamarin_find_protocol_wrapper_type (token);
if (wrapper_token != INVALID_TOKEN_REF)
return (Type)Class.ResolveTokenReference (wrapper_token, 0x02000000 /* TypeDef */);
return Class.ResolveTypeTokenReference (wrapper_token);
}
}
}

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

@ -1,6 +1,7 @@
using System;
using Foundation;
using ObjCRuntime;
using UIKit;
namespace TVMLKit {
@ -16,6 +17,39 @@ namespace TVMLKit {
public bool IsDispatched { get; set; }
public bool IsCancelled { get; set; }
#endif
}
public partial class TVViewElement {
#if !COREBUILD
public virtual TVElementUpdateType UpdateType {
[Export ("updateType")]
get {
var value = _UpdateType;
switch ((long) value) {
case 2:
if (UIDevice.CurrentDevice.CheckSystemVersion (12, 0)) {
return TVElementUpdateType.Styles;
} else {
return TVElementUpdateType.Children;
}
case 3:
if (UIDevice.CurrentDevice.CheckSystemVersion (12, 0)) {
return TVElementUpdateType.Children;
} else {
return TVElementUpdateType.Self;
}
case 4:
if (UIDevice.CurrentDevice.CheckSystemVersion (12, 0)) {
return TVElementUpdateType.Self;
} else {
return TVElementUpdateType.Styles;
}
default:
return value;
}
}
}
#endif
}
}

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

@ -86,10 +86,17 @@ namespace TVMLKit {
public enum TVElementUpdateType : long {
None,
Subtree,
#if XAMCORE_4_0
[TV (10,0)]
Styles,
Children,
Self,
#else
Children,
Self,
[TV (10,0)]
Styles,
#endif
}
[TV (9,0)]
@ -819,8 +826,9 @@ namespace TVMLKit {
set;
}
[Internal][Sealed]
[Export ("updateType")]
TVElementUpdateType UpdateType { get; }
TVElementUpdateType _UpdateType { get; }
[Export ("resetProperty:")]
void Reset (TVElementResettableProperty resettableProperty);

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

@ -210,5 +210,20 @@ namespace Xamarin.MMP.Tests
NativeReferenceTestCore (tmpDir, test, "MultipleNativeReferences_OnlyInvokeMMPOneTime_AndCopyEverythingIn", null, true);
});
}
[Test]
public void ReferenceNativeRefNoCodeUsage_ShouldStillCopy ()
{
MMPTests.RunMMPTest (tmpDir => {
TI.UnifiedTestConfig test = new TI.UnifiedTestConfig (tmpDir) {
XM45 = true,
ItemGroup = CreateSingleNativeRef ("/Library/Frameworks/Mono.framework/Libraries/libintl.dylib", "Dynamic")
};
var log = TI.TestUnifiedExecutable (test);
Console.WriteLine (log.BuildOutput);
Assert.True (File.Exists (Path.Combine (tmpDir, "bin/Debug/XM45Example.app/Contents/MonoBundle/libintl.dylib")));
});
}
}
}

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

@ -156,7 +156,8 @@ static class C {
for (int i = 0; i < s.Length; i++) {
w.Append (GetNativeName (s [i])).Append (" x").Append (i).Append ("; ");
}
w.AppendLine ($"}} S{s};");
w.AppendLine ($"}};");
w.AppendLine ($"typedef struct S{s} S{s};");
}
File.WriteAllText ("libtest.structs.h", w.ToString ());

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

@ -209,7 +209,10 @@ namespace xharness
protected override void CalculateName ()
{
base.CalculateName ();
if (TargetDirectory.Contains ("BCLTests"))
Name = TestProject.Name;
else
base.CalculateName ();
if (MonoNativeInfo != null)
Name = Name + MonoNativeInfo.FlavorSuffix;
}

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

@ -135,6 +135,7 @@ namespace BCLTestImporter {
"monotouch_Mono.CodeContracts_test.dll", // not supported by xamarin
"monotouch_Novell.Directory.Ldap_test.dll", // not supported by xamarin
"monotouch_Mono.Profiler.Log_xunit-test.dll", // special tests that need an extra app to connect as a profiler
"monotouch_Microsoft.CSharp_xunit-test.dll", // mono-cil-strip fails due to an exception from cecil, issue https://github.com/xamarin/xamarin-macios/issues/5868
};
// list of assemblies that are going to be ignored, any project with an assemblies that is ignored will

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

@ -3569,7 +3569,8 @@ namespace Registrar {
if (nativeObjType.IsInterface) {
setup_call_stack.AppendLine ("mobj{0} = xamarin_get_inative_object_static (nobj, false, \"{1}\", \"{2}\");", i, GetAssemblyQualifiedName (nativeObjType), GetAssemblyQualifiedName (elementType));
setup_call_stack.AppendLine ("mobj{0} = xamarin_get_inative_object_static (nobj, false, 0x{1:X} /* {2} */, 0x{3:X} /* {4} */, &exception_gchandle);", i, CreateTokenReference (elementType, TokenType.TypeDef), elementType.FullName, CreateTokenReference (nativeObjType, TokenType.TypeDef), nativeObjType.FullName);
setup_call_stack.AppendLine ("if (exception_gchandle != 0) goto exception_handling;");
} else {
// find the MonoClass for this parameter
setup_call_stack.AppendLine ("MonoType *type{0};", i);
@ -3675,7 +3676,7 @@ namespace Registrar {
if (isOut) {
setup_call_stack.AppendLine ("inobj{0} = NULL;", i);
} else if (td.IsInterface) {
setup_call_stack.AppendLine ("inobj{0} = xamarin_get_inative_object_static (*p{0}, false, \"{1}\", \"{2}\", &exception_gchandle);", i, GetAssemblyQualifiedName (nativeObjType), GetAssemblyQualifiedName (td));
setup_call_stack.AppendLine ("inobj{0} = xamarin_get_inative_object_static (*p{0}, false, 0x{1:X} /* {2} */, 0x{3:X} /* {4} */, &exception_gchandle);", i, CreateTokenReference (td, TokenType.TypeDef), td.FullName, CreateTokenReference (nativeObjType, TokenType.TypeDef), nativeObjType.FullName);
setup_call_stack.AppendLine ("if (exception_gchandle != 0) goto exception_handling;");
} else {
setup_call_stack.AppendLine ("inobj{0} = xamarin_get_inative_object_dynamic (*p{0}, false, mono_type_get_object (mono_domain_get (), type{0}), &exception_gchandle);", i);
@ -3689,7 +3690,7 @@ namespace Registrar {
copyback.AppendLine ("*p{0} = (id) handle{0};", i);
} else {
if (td.IsInterface) {
setup_call_stack.AppendLine ("arg_ptrs [{0}] = xamarin_get_inative_object_static (p{0}, false, \"{1}\", \"{2}\", &exception_gchandle);", i, GetAssemblyQualifiedName (nativeObjType), GetAssemblyQualifiedName (td));
setup_call_stack.AppendLine ("arg_ptrs [{0}] = xamarin_get_inative_object_static (p{0}, false, 0x{1:X} /* {2} */, 0x{3:X} /* {4} */, &exception_gchandle);", i, CreateTokenReference (td, TokenType.TypeDef), td.FullName, CreateTokenReference (nativeObjType, TokenType.TypeDef), nativeObjType.FullName);
} else {
setup_call_stack.AppendLine ("arg_ptrs [{0}] = xamarin_get_inative_object_dynamic (p{0}, false, mono_type_get_object (mono_domain_get (), type{0}), &exception_gchandle);", i);
}

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

@ -0,0 +1,93 @@
trigger:
- master
jobs:
- job: macOS
displayName: xamarin macios
timeoutInMinutes: 120
pool:
name: "Hosted Mac Internal Mojave"
steps:
- task: InstallSSHKey@0
inputs:
hostName: $(github-hostname)
sshPublicKey: $(github-pubkey)
sshPassphrase: $(github-sec)
sshKeySecureFile: $(github-file)
- bash: |
echo "Setting up maccore..."
./configure --enable-xamarin
make reset-maccore
displayName: "Setting up maccore..."
- bash: |
echo "Setting up prerequisites from brew..."
brew install libtool autoconf automake bison flex
displayName: "Setting up prerequisites from brew..."
- task: xamops.azdevex.provisionator-task.provisionator@1
displayName: Provisionate external-deps.csx
inputs:
provisioning_script: $(System.DefaultWorkingDirectory)/../maccore/tools/devops/external-deps.csx
provisioning_extra_args: '-vvvv'
- bash: |
echo "Setting up build system dependencies..."
./system-dependencies.sh --provision-all
displayName: "Setting up build system dependencies..."
- bash: |
echo "Build the World..."
ln -sf $SYSTEM_DEFAULTWORKINGDIRECTORY $SYSTEM_DEFAULTWORKINGDIRECTORY/../xamarin-macios
make world
displayName: "Build the World..."
- bash: |
echo "Create Packages..."
rm -Rf ../package
make package
cp ../package/*.* $BUILD_ARTIFACTSTAGINGDIRECTORY
displayName: "Create Packages..."
- task: PublishBuildArtifacts@1
inputs:
artifactName: "macios-packages"
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: "Component Detection"
# CredScan is Windows Only
- job: Windows
displayName: "CredScan - No Build"
pool:
vmImage: "vs2017-win2016"
steps:
- task: InstallSSHKey@0
inputs:
hostName: $(github-hostname)
sshPublicKey: $(github-pubkey)
sshPassphrase: $(github-sec)
sshKeySecureFile: $(github-file)
- bash: |
echo "Setting up maccore..."
repo=$(grep -m 1 "MACCORE_MODULE" "$SYSTEM_DEFAULTWORKINGDIRECTORY/mk/xamarin.mk" | cut -d'=' -f2 | awk '{$1=$1};1')
branch=$(grep "NEEDED_MACCORE_BRANCH" "$SYSTEM_DEFAULTWORKINGDIRECTORY/mk/xamarin.mk" | cut -d'=' -f2 | awk '{$1=$1};1')
git clone -b $branch $repo $SYSTEM_DEFAULTWORKINGDIRECTORY/../maccore
displayName: "Setting up maccore..."
- task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
displayName: "Run CredScan"
inputs:
suppressionsFile: "$(System.DefaultWorkingDirectory)/../maccore/tools/devops/CredScanSuppressions.json"
debugMode: false
- task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@1
displayName: 'Post Analysis'
inputs:
CredScan: true

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

@ -1619,7 +1619,7 @@ namespace Xamarin.Bundler {
return true;
}
// Shutup the warning until we decide on bug: 36478
if (shortendName.ToLowerInvariant () == "intl" && IsUnifiedFullXamMacFramework)
if (shortendName.ToLowerInvariant () == "intl" && !native_references.Any (x => x.Contains ("libintl.dylib")) && IsUnifiedFullXamMacFramework)
return true;
return false;
}