This commit is contained in:
Rolf Bjarne Kvinge 2017-01-26 13:38:39 +01:00
Родитель 617362b738
Коммит 8a6d7cd0dd
14 изменённых файлов: 384 добавлений и 3 удалений

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

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

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

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Linq;
#if __UNIFIED__
using Foundation;
using ObjCRuntime;
#else
using MonoTouch.Foundation;
using MonoTouch.ObjCRuntime;
#endif
using NUnit.Framework;
using Bindings.Test2;
namespace Xamarin.BindingTests2
{
[TestFixture]
[Preserve (AllMembers = true)]
public class BindingTest
{
[Test]
public void Test ()
{
Assert.AreEqual (42, CFunctions.getIntOfChocolate (), "chocolate");
Assert.AreEqual (42, Bindings.Test.CFunctions.theUltimateAnswer (), "theUltimateAnswer");
}
}
}

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

@ -0,0 +1,10 @@
using System;
using System.Runtime.InteropServices;
namespace Bindings.Test2
{
public static class CFunctions {
[DllImport ("__Internal")]
public static extern int getIntOfChocolate ();
}
}

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

@ -0,0 +1,91 @@
<?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)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F88FA3CF-B8EF-4CC7-9A2C-BC59DC7B4F22}</ProjectGuid>
<ProjectTypeGuids>{8FFB629D-F513-41CE-95D2-7ECE97B6EEEC};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>bindingstest2</RootNamespace>
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
<AssemblyName>bindings-test2</AssemblyName>
<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)-unified</IntermediateOutputPath>
<DefineConstants>XAMCORE_2_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' Or '$(Configuration)' == 'Debug32' Or '$(Configuration)' == 'Debug64' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\Any CPU\$(Configuration)-unified</OutputPath>
<DefineConstants>DO_NOT_REMOVE;DEBUG;;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' Or '$(Configuration)' == 'Release32' Or '$(Configuration)' == 'Release64' Or '$(Configuration)' == 'Release-bitcode' ">
<DebugType>none</DebugType>
<Optimize>True</Optimize>
<OutputPath>bin\Any CPU\$(Configuration)-unified</OutputPath>
<DefineConstants>DO_NOT_REMOVE;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="MonoTouch.NUnitLite" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<ObjcBindingApiDefinition Include="ApiDefinition.cs" />
<ObjcBindingApiDefinition Include="ApiProtocol.cs" />
</ItemGroup>
<ItemGroup>
<ObjcBindingCoreSource Include="StructsAndEnums.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.ObjCBinding.CSharp.targets" />
<ItemGroup>
<ObjcBindingNativeLibrary Include="..\..\tests\test-libraries\.libs\ios\libtest2.a">
<Link>libtest2.a</Link>
</ObjcBindingNativeLibrary>
</ItemGroup>
<ItemGroup>
<Compile Include="libtest2.linkwith.cs">
<DependentUpon>libtest2.a</DependentUpon>
</Compile>
<Compile Include="BindingTest.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\tests\test-libraries\libtest2.m">
<Link>libtest2.m</Link>
</None>
<None Include="..\..\tests\test-libraries\libtest2.h">
<Link>libtest2.h</Link>
</None>
</ItemGroup>
<ItemGroup>
<GeneratedTestInput Include="..\..\tests\test-libraries\*.m" />
<GeneratedTestInput Include="..\..\tests\test-libraries\*.h" />
<GeneratedTestInput Include="..\..\tests\test-libraries\*.cs" />
<GeneratedTestInput Include="..\..\tests\test-libraries\Makefile" />
<GeneratedTestOutput Include="..\..\tests\test-libraries\.libs\ios\libtest2.a" />
</ItemGroup>
<Target Name="BeforeBuild" Inputs="@(GeneratedTestInput)" Outputs="@(GeneratedTestOutput)">
<Exec Command="make -j8 -C ..\..\tests\test-libraries" />
</Target>
<ItemGroup>
<ProjectReference Include="..\bindings-test\bindings-test.csproj">
<Project>{48585BC2-D604-4CF2-A827-D887BEA51FD6}</Project>
<Name>bindings-test</Name>
</ProjectReference>
</ItemGroup>
</Project>

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

@ -0,0 +1,14 @@
using System;
#if __UNIFIED__
using ObjCRuntime;
#else
using MonoTouch.ObjCRuntime;
#endif
using System.Runtime.InteropServices;
[assembly: LinkWith ("libtest2.a", LinkTarget.Simulator | LinkTarget.ArmV6 | LinkTarget.ArmV7 | LinkTarget.ArmV7s | LinkTarget.Arm64 | LinkTarget.Simulator64, SmartLink = true, Frameworks = "Foundation" , LinkerFlags = "-lz")]
public static class LibTest {
[DllImport ("__Internal")]
public static extern int theUltimateAnswer ();
}

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

@ -0,0 +1,19 @@
<?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>TestApp</string>
<key>CFBundleIdentifier</key>
<string>com.xamarin.tests.interdependentbindingprojects</string>
<key>CFBundleName</key>
<string>TestApp</string>
<key>MinimumOSVersion</key>
<string>6.0</string>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
</dict>
</plist>

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

@ -0,0 +1,37 @@
using System;
using Foundation;
using UIKit;
using MonoTouch.NUnit.UI;
using NUnit.Framework;
using NUnit.Framework.Internal;
#if !__WATCHOS__
[Register ("AppDelegate")]
public partial class AppDelegate : UIApplicationDelegate
{
UIWindow window;
TouchRunner runner;
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
runner = new TouchRunner (window);
runner.Add (System.Reflection.Assembly.GetExecutingAssembly ());
runner.Add (typeof (Xamarin.BindingTests2.BindingTest).Assembly);
runner.Add (typeof (Xamarin.BindingTests.ProtocolTest).Assembly);
window.RootViewController = new UINavigationController (runner.GetViewController ());
window.MakeKeyAndVisible ();
return true;
}
static void Main (string[] args)
{
UIApplication.Main (args, null, typeof (AppDelegate));
}
}
#endif // !__WATCHOS__

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

@ -0,0 +1,151 @@
<?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>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AC6D070F-2ED4-4701-B701-81915B931D1D}</ProjectGuid>
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Exe</OutputType>
<RootNamespace>interdependentbindingprojects</RootNamespace>
<AssemblyName>interdependentbindingprojects</AssemblyName>
<SignAssembly>True</SignAssembly>
<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>
<IntermediateOutputPath>obj\$(Platform)\$(Configuration)-unified</IntermediateOutputPath>
<DefineConstants>XAMCORE_2_0</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhoneSimulator\$(Configuration)-unified</OutputPath>
<DefineConstants>DEBUG;;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>0</WarningLevel>
<MtouchDebug>True</MtouchDebug>
<MtouchExtraArgs>-v -v -v -v</MtouchExtraArgs>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<MtouchArch>i386, x86_64</MtouchArch>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchLink>None</MtouchLink>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhoneSimulator\$(Configuration)-unified</OutputPath>
<DefineConstants>MONOTOUCH;;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<MtouchLink>None</MtouchLink>
<MtouchExtraArgs>-v -v -v -v</MtouchExtraArgs>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<MtouchArch>i386, x86_64</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\$(Configuration)-unified</OutputPath>
<DefineConstants>DEBUG;;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>0</WarningLevel>
<MtouchDebug>True</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchExtraArgs>-v -v -v -v</MtouchExtraArgs>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<IpaPackageName>
</IpaPackageName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug64|iPhone' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\$(Configuration)-unified</OutputPath>
<DefineConstants>DEBUG;;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>0</WarningLevel>
<MtouchDebug>True</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchExtraArgs>-v -v -v -v</MtouchExtraArgs>
<MtouchArch>ARM64</MtouchArch>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug32|iPhone' ">
<DebugSymbols>True</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\$(Configuration)-unified</OutputPath>
<DefineConstants>DEBUG;;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>0</WarningLevel>
<MtouchDebug>True</MtouchDebug>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchExtraArgs>-v -v -v -v</MtouchExtraArgs>
<MtouchArch>ARMv7</MtouchArch>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\$(Configuration)-unified</OutputPath>
<DefineConstants>MONOTOUCH;;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchExtraArgs>-v -v -v -v --nosymbolstrip</MtouchExtraArgs>
<MtouchArch>ARMv7, ARM64</MtouchArch>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<MtouchUseLlvm>true</MtouchUseLlvm>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release32|iPhone' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\$(Configuration)-unified</OutputPath>
<DefineConstants>MONOTOUCH;;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchExtraArgs>-v -v -v -v --nosymbolstrip</MtouchExtraArgs>
<MtouchArch>ARMv7</MtouchArch>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<MtouchUseLlvm>true</MtouchUseLlvm>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release64|iPhone' ">
<DebugType>none</DebugType>
<Optimize>False</Optimize>
<OutputPath>bin\iPhone\$(Configuration)-unified</OutputPath>
<DefineConstants>MONOTOUCH;;$(DefineConstants)</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchExtraArgs>-v -v -v -v --nosymbolstrip</MtouchExtraArgs>
<MtouchArch>ARM64</MtouchArch>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<MtouchUseLlvm>true</MtouchUseLlvm>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="MonoTouch.NUnitLite" />
</ItemGroup>
<ItemGroup>
<None Include="Info.plist" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\bindings-test2\bindings-test2.csproj">
<Project>{F88FA3CF-B8EF-4CC7-9A2C-BC59DC7B4F22}</Project>
<Name>bindings-test2</Name>
</ProjectReference>
<ProjectReference Include="..\bindings-test\bindings-test.csproj">
<Project>{D6667423-EDD8-4B50-9D98-1AC5D8A8A4EA}</Project>
<Name>bindings-test</Name>
</ProjectReference>
</ItemGroup>
</Project>

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

@ -40,6 +40,7 @@ $(2)_TARGETS = \
.libs/$(1)/XStaticObjectTest.framework/XStaticObjectTest \
.libs/$(1)/XStaticArTest.framework/XStaticArTest \
.libs/$(1)/libtest.dylib \
.libs/$(1)/libtest2.a \
.libs/$(1)/libtest.a \
.libs/$(1)/libtest-object.a \
.libs/$(1)/libtest-ar.a \
@ -67,6 +68,10 @@ EXTRA_DEPENDENCIES = libtest.h $(GENERATED_FILES)
$(Q) rm -f $$@
$$(call Q_2,LIPO [$(1)]) $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo $$^ -create -output $$@
.libs/$(1)/libtest2.a: $$(foreach arch,$(3),.libs/$(1)/libtest2.$$(arch).a)
$(Q) rm -f $$@
$$(call Q_2,LIPO [$(1)]) $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo $$^ -create -output $$@
.libs/$(1)/libtest-object.a: $$(foreach arch,$(3),.libs/$(1)/libtest-object.$$(arch).a)
$(Q) rm -f $$@
$$(call Q_2,LIPO [$(1)]) $(XCODE_DEVELOPER_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/lipo $$^ -create -output $$@

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

@ -0,0 +1,10 @@
#ifdef __cplusplus
extern "C" {
#endif
int getIntOfChocolate ();
#ifdef __cplusplus
} /* extern "C" */
#endif

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

@ -0,0 +1,7 @@
#include "libtest.h"
#include "libtest2.h"
int getIntOfChocolate ()
{
return theUltimateAnswer ();
}

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

@ -292,8 +292,8 @@ namespace xharness
void AutoConfigureIOS ()
{
var test_suites = new string [] { "monotouch-test", "framework-test", "mini" };
var library_projects = new string [] { "BundledResources", "EmbeddedResources", "bindings-test", "bindings-framework-test" };
var test_suites = new string [] { "monotouch-test", "framework-test", "mini", "interdependent-binding-projects" };
var library_projects = new string [] { "BundledResources", "EmbeddedResources", "bindings-test", "bindings-test2", "bindings-framework-test" };
var fsharp_test_suites = new string [] { "fsharp" };
var fsharp_library_projects = new string [] { "fsharplibrary" };
var bcl_suites = new string [] { "mscorlib", "System", "System.Core", "System.Data", "System.Net.Http", "System.Numerics", "System.Runtime.Serialization", "System.Transactions", "System.Web.Services", "System.Xml", "System.Xml.Linq", "Mono.Security", "System.ComponentModel.DataAnnotations", "System.Json", "System.ServiceModel.Web", "Mono.Data.Sqlite" };

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

@ -381,7 +381,13 @@ namespace xharness
public static void FixTestLibrariesReferences (this XmlDocument csproj, string platform)
{
var nodes = csproj.SelectNodes ("//*[local-name() = 'ObjcBindingNativeLibrary' or local-name() = 'ObjcBindingNativeFramework']");
var test_libraries = new string [] { "libtest.a", "XTest.framework", "XStaticArTest.framework", "XStaticObjectTest.framework" };
var test_libraries = new string [] {
"libtest.a",
"libtest2.a",
"XTest.framework",
"XStaticArTest.framework",
"XStaticObjectTest.framework"
};
foreach (XmlNode node in nodes) {
var includeAttribute = node.Attributes ["Include"];
if (includeAttribute != null) {