Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/sdks/ios
diff options
context:
space:
mode:
authorAlexander Köplinger <alex.koeplinger@outlook.com>2019-11-25 20:12:47 +0300
committerAlexander Köplinger <alex.koeplinger@outlook.com>2019-11-27 20:36:02 +0300
commita0d79a4886e76b077f9377185945b959adb6fc8c (patch)
tree79df59703b7b892f432e3b11143b65d944db65e2 /sdks/ios
parent167913524fd5029a4762d0b497a84739d7227fb3 (diff)
[sdks] Add netcore option for iOS SDK
Diffstat (limited to 'sdks/ios')
-rw-r--r--sdks/ios/Makefile179
-rw-r--r--sdks/ios/README.md8
-rw-r--r--sdks/ios/app/.gitignore2
-rw-r--r--sdks/ios/app/Entitlements.plist.in (renamed from sdks/ios/runtime/Entitlements.xcent)4
-rw-r--r--sdks/ios/app/Info.plist.in (renamed from sdks/ios/runtime/Info.plist.in)4
-rw-r--r--sdks/ios/app/Makefile110
-rw-r--r--sdks/ios/app/main.m (renamed from sdks/ios/runtime/ViewController.m)62
-rw-r--r--sdks/ios/app/runtime.h (renamed from sdks/ios/runtime/runtime.h)0
-rw-r--r--sdks/ios/app/runtime.m (renamed from sdks/ios/runtime/runtime.m)14
-rw-r--r--sdks/ios/appbuilder/appbuilder.cs73
-rw-r--r--sdks/ios/runtime/AppDelegate.h17
-rw-r--r--sdks/ios/runtime/AppDelegate.m51
-rw-r--r--sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nibbin1136 -> 0 bytes
-rw-r--r--sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/Info.plistbin258 -> 0 bytes
-rw-r--r--sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nibbin832 -> 0 bytes
-rw-r--r--sdks/ios/runtime/Base.lproj/Main.storyboardc/BYZ-38-t0r-view-8bC-Xf-vdC.nibbin1136 -> 0 bytes
-rw-r--r--sdks/ios/runtime/Base.lproj/Main.storyboardc/Info.plistbin258 -> 0 bytes
-rw-r--r--sdks/ios/runtime/Base.lproj/Main.storyboardc/UIViewController-BYZ-38-t0r.nibbin916 -> 0 bytes
-rw-r--r--sdks/ios/runtime/Makefile79
-rw-r--r--sdks/ios/runtime/ViewController.h15
-rw-r--r--sdks/ios/runtime/main.m16
-rw-r--r--sdks/ios/test-runner/runner.cs75
22 files changed, 424 insertions, 285 deletions
diff --git a/sdks/ios/Makefile b/sdks/ios/Makefile
index a44b522e768..bd9ffe170fc 100644
--- a/sdks/ios/Makefile
+++ b/sdks/ios/Makefile
@@ -1,7 +1,20 @@
+TOP=$(realpath $(CURDIR)/../..)
+-include $(TOP)/sdks/Make.config
-all: harness.exe appbuilder.exe test-runner.exe
+ALL_TARGETS = harness.exe appbuilder.exe
+
+ifdef ENABLE_NETCORE
+ALL_TARGETS += netcore-test-runner.exe
+endif
+
+ifndef DISABLE_CLASSIC
+ALL_TARGETS += test-runner.exe
+endif
+
+all: $(ALL_TARGETS)
BCL_DIR = ../out/ios-bcl/monotouch
+NETCORE_BCL_DIR = ../out/ios-netcore_libs/ios
XCODE_ROOT=$(shell xcode-select -p)
SYSROOT=$(XCODE_ROOT)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
@@ -51,33 +64,30 @@ harness.exe: harness/harness.cs $(OPTIONS_CS)
appbuilder.exe: appbuilder/appbuilder.cs $(OPTIONS_CS)
csc /out:$@ $^
+NETCORE_XUNIT_DIR := $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/System.Buffers.Tests/netcoreapp-Debug
+
+netcore-test-runner.exe: test-runner/runner.cs $(NETCORE_XUNIT_DIR)/xunit.core.dll
+ csc /out:$@ /debug /noconfig /nostdlib /d:ENABLE_NETCORE /d:XUNIT_RUNNER /r:$(NETCORE_BCL_DIR)/System.Private.CoreLib.dll /r:$(NETCORE_BCL_DIR)/System.Runtime.dll /r:$(NETCORE_BCL_DIR)/System.Runtime.Extensions.dll /r:$(NETCORE_BCL_DIR)/System.Xml.XDocument.dll /r:$(NETCORE_BCL_DIR)/System.Private.Xml.dll /r:$(NETCORE_BCL_DIR)/System.Private.Xml.Linq.dll /r:$(NETCORE_BCL_DIR)/System.Linq.dll /r:$(NETCORE_BCL_DIR)/System.IO.dll /r:$(NETCORE_BCL_DIR)/System.IO.FileSystem.dll /r:$(NETCORE_BCL_DIR)/System.Collections.dll /r:$(NETCORE_BCL_DIR)/System.Threading.dll /r:$(NETCORE_BCL_DIR)/System.Net.Sockets.dll /r:$(NETCORE_XUNIT_DIR)/xunit.core.dll /r:$(NETCORE_XUNIT_DIR)/xunit.abstractions.dll /r:$(NETCORE_XUNIT_DIR)/xunit.runner.utility.netcoreapp10.dll test-runner/runner.cs
+
test-runner.exe: test-runner/runner.cs
- csc /out:$@ -r:$(BCL_DIR)/nunitlite.dll -r:$(BCL_DIR)/Mono.Security.dll test-runner/runner.cs
+ csc /out:$@ /debug -r:$(BCL_DIR)/nunitlite.dll -r:$(BCL_DIR)/Mono.Security.dll test-runner/runner.cs
+
+app/app-simulator app/app-device.a app/app-netcore-simulator app/app-netcore-device.a: app/*.h app/*.m app/Makefile
+ $(MAKE) -C app
-runtime/runtime:
- $(MAKE) -C runtime
+ifdef ENABLE_NETCORE
+SIM_DEPS += netcore-test-runner.exe app/app-netcore-simulator
+endif
-runtime/libmonoios.a:
- $(MAKE) -C runtime
+ifndef DISABLE_CLASSIC
+SIM_DEPS += test-runner.exe app/app-simulator
+endif
# Build % from assemblies %_ASSEMBLIES
# The end result is in bin/ios-sim/test-%.app
-TEST_ASSEMBLIES = $(BCL_DIR)/mscorlib.dll \
- $(BCL_DIR)/System.dll \
- $(BCL_DIR)/System.Xml.dll \
- $(BCL_DIR)/System.Core.dll \
- $(BCL_DIR)/I18N.dll \
- $(BCL_DIR)/I18N.West.dll \
- $(BCL_DIR)/Mono.Simd.dll \
- $(BCL_DIR)/Mono.Security.dll \
- $(BCL_DIR)/System.Numerics.dll \
- $(BCL_DIR)/System.Numerics.Vectors.dll \
- $(BCL_DIR)/nunitlite.dll \
- test-runner.exe
-
-build-ios-sim-%: appbuilder.exe test-runner.exe runtime/runtime $($*_ASSEMBLIES)
- mono appbuilder.exe --target ios-sim64 --mono-sdkdir $(abspath ../out) --appdir $(abspath bin/ios-sim/test-$*.app) --runtimedir $(abspath runtime) --builddir $(abspath obj/ios-sim/test-$*.app) --sysroot $(SYSROOT) --signing-identity - --bundle-executable test-$* --bundle-identifier com.xamarin.mono.ios.test-$* --bundle-name test-$* $(patsubst %,-r %,$(TEST_ASSEMBLIES) $($*_ASSEMBLIES))
+build-ios-sim-%: appbuilder.exe $(SIM_DEPS)
+ mono appbuilder.exe $(APPBUILDER_ARGS) $($*_APPBUILDER_ARGS) --target ios-sim64 --mono-sdkdir $(abspath ../out) --appdir $(abspath bin/ios-sim/test-$*.app) --apptemplatedir $(abspath app) --builddir $(abspath obj/ios-sim/test-$*.app) --sysroot $(SYSROOT) --signing-identity - --bundle-executable test-$* --bundle-identifier com.xamarin.mono.ios.test-$* --bundle-name test-$* $(patsubst %,-r %,$($*_ASSEMBLIES))
mkdir -p bin/ios-sim/test-$*.app
ninja -C obj/ios-sim/test-$*.app -v
@@ -93,10 +103,6 @@ ifdef INTERP_MIXED
APPBUILDER_ARGS += --interp-mixed
endif
-ifdef IOS_PROVISIONING_PROFILE
-APPBUILDER_ARGS += --profile $(abspath $(IOS_PROVISIONING_PROFILE))
-endif
-
#
# This enables caching of aot outputs between different apps.
# Changes to the assemblies/runtimes etc. are not detected, so this should only
@@ -107,9 +113,23 @@ ifdef ENABLE_AOT_CACHE
APPBUILDER_ARGS += --aot-cachedir $(abspath aot-cache)
endif
-build-ios-dev-%: appbuilder.exe test-runner.exe runtime/libmonoios.a $($*_ASSEMBLIES)
+ifdef ENABLE_NETCORE
+DEV_DEPS += netcore-test-runner.exe app/app-netcore-device.a
+endif
+
+ifndef DISABLE_CLASSIC
+DEV_DEPS += test-runner.exe app/app-device.a
+endif
+
+build-ios-dev-%: appbuilder.exe $(DEV_DEPS)
+ifeq ($(IOS_SIGNING_IDENTITY),-)
+ @echo "Error: Ad-hoc signing isn't valid for device builds, set IOS_SIGNING_IDENTITY." && exit 1
+endif
+ifeq ($(IOS_TEAM_IDENTIFIER),)
+ @echo "Error: Team identifier needs to be set for device builds, set IOS_TEAM_IDENTIFIER." && exit 1
+endif
mkdir -p aot-cache
- mono appbuilder.exe $(APPBUILDER_ARGS) --target ios-dev64 --mono-sdkdir $(abspath ../out) --appdir $(abspath bin/ios-dev/test-$*.app) --runtimedir $(abspath runtime) --builddir $(abspath obj/ios-dev/test-$*.app) --sysroot $(SYSROOT) --signing-identity "$(IOS_SIGNING_IDENTITY)" --bundle-executable test-$* --bundle-identifier com.xamarin.mono.ios.test-$* --bundle-name test-$* --exe test-runner.exe $(patsubst %,-r %,$(TEST_ASSEMBLIES) $($*_ASSEMBLIES))
+ mono appbuilder.exe $(APPBUILDER_ARGS) $($*_APPBUILDER_ARGS) --target ios-dev64 --mono-sdkdir $(abspath ../out) --appdir $(abspath bin/ios-dev/test-$*.app) --apptemplatedir $(abspath app) --builddir $(abspath obj/ios-dev/test-$*.app) --sysroot $(SYSROOT) --signing-identity "$(IOS_SIGNING_IDENTITY)" --team-identifier "$(IOS_TEAM_IDENTIFIER)" --bundle-executable test-$* --bundle-identifier com.xamarin.mono.ios.test-$* --bundle-name test-$* $(patsubst %,-r %,$($*_ASSEMBLIES))
mkdir -p bin/ios-dev/test-$*.app
ninja -C obj/ios-dev/test-$*.app -v
@@ -126,11 +146,11 @@ run-ios-sim-%: harness.exe
xcrun simctl install $(SIM_NAME) bin/ios-sim/test-$*.app
mono harness.exe --run-sim --logfile ios-sim-$*.log --bundle-id com.xamarin.mono.ios.test-$* --bundle-dir bin/ios-sim/test-$*.app $(ARGS) $($*_ARGS)
-run-ios-dev-%: harness.exe test-runner.exe
+run-ios-dev-%: harness.exe
mono harness.exe --run-dev --logfile ios-dev-$*.log --bundle-id com.xamarin.mono.ios.test-$* --bundle-dir bin/ios-dev/test-$*.app $(ARGS) $($*_ARGS)
clean:
- $(MAKE) -C runtime clean
+ $(MAKE) -C app clean
$(RM) -rf bin obj *.exe *.log aot-cache
build-ios-sim-all:
@@ -179,52 +199,109 @@ start-sim:
stop-sim:
xcrun simctl shutdown $(SIM_NAME)
+ifdef ENABLE_NETCORE
+
+NETCORE_TEST_ASSEMBLIES = $(filter-out $(NETCORE_BCL_DIR)/System.Runtime.WindowsRuntime.dll $(NETCORE_BCL_DIR)/System.Runtime.WindowsRuntime.UI.Xaml.dll, $(wildcard $(NETCORE_BCL_DIR)/*.dll)) netcore-test-runner.exe
+
+# Parameters:
+# $(1): test assembly name (no .dll suffix)
+define NetCoreTestTemplate
+
+$(1)_ASSEMBLIES = \
+ $(NETCORE_TEST_ASSEMBLIES) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/$(1).dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/CoreFx.Private.TestUtilities.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Newtonsoft.Json.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/xunit.abstractions.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/xunit.assert.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/xunit.core.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/xunit.execution.dotnet.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/xunit.runner.utility.netcoreapp10.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.VisualStudio.TestPlatform.ObjectModel.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.DotNet.PlatformAbstractions.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.DotNet.XUnitExtensions.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.TestPlatform.CommunicationUtilities.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.TestPlatform.CoreUtilities.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.TestPlatform.CrossPlatEngine.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.TestPlatform.PlatformAbstractions.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.TestPlatform.Utilities.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.VisualStudio.CodeCoverage.Shim.dll) \
+ $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/$(1)/netcoreapp*/Microsoft.VisualStudio.TestPlatform.Common.dll)
+
+# TODO: remove need for DOTNET_SYSTEM_GLOBALIZATION_INVARIANT by compiling System.Globalization.Native.dylib
+# TODO: replace nonosxtests trait with noniostests
+$(1)_ARGS = --setenv=DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1 netcore-test-runner.exe CONNSTR $(1).dll -notrait category=nonosxtests @CoreFX.issues.rsp @CoreFX.issues_mac.rsp
+$(1)_APPBUILDER_ARGS += --netcore --exe netcore-test-runner.exe --content="$(abspath $(TOP)/netcore/CoreFX.issues.rsp)" --content="$(abspath $(TOP)/netcore/CoreFX.issues_mac.rsp)"
+
+endef
+
+$(foreach testdir,$(notdir $(wildcard $(DOTNET_RUNTIME_REPO_DIR)/artifacts/bin/*.Tests)),$(eval $(call NetCoreTestTemplate,$(testdir))))
+
+endif
+
+ifndef DISABLE_CLASSIC
+
+CLASSIC_TEST_ASSEMBLIES = $(BCL_DIR)/mscorlib.dll \
+ $(BCL_DIR)/System.dll \
+ $(BCL_DIR)/System.Xml.dll \
+ $(BCL_DIR)/System.Core.dll \
+ $(BCL_DIR)/I18N.dll \
+ $(BCL_DIR)/I18N.West.dll \
+ $(BCL_DIR)/Mono.Simd.dll \
+ $(BCL_DIR)/Mono.Security.dll \
+ $(BCL_DIR)/System.Numerics.dll \
+ $(BCL_DIR)/System.Numerics.Vectors.dll \
+ $(BCL_DIR)/nunitlite.dll \
+ test-runner.exe
+
# CONNSTR will be replace by the harness with the real connection string
NUNIT = test-runner.exe CONNSTR -exclude:MobileNotWorking,NotOnMac,NotWorking,CAS,InetAccess,NotWorkingLinqInterpreter $(if $(TESTNAME),-test:$(TESTNAME)) -labels
TESTDIR = $(BCL_DIR)/tests
# Options for each test
-Mono.Runtime.Tests_ASSEMBLIES = $(TESTDIR)/monotouch_Mono.Runtime.Tests_test.dll
+Mono.Runtime.Tests_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(TESTDIR)/monotouch_Mono.Runtime.Tests_test.dll
Mono.Runtime.Tests_ARGS = $(NUNIT) monotouch_Mono.Runtime.Tests_test.dll
-corlib_ASSEMBLIES = $(TESTDIR)/monotouch_corlib_test.dll
+corlib_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(TESTDIR)/monotouch_corlib_test.dll
corlib_ARGS = $(NUNIT) monotouch_corlib_test.dll
-System.Core_ASSEMBLIES = $(TESTDIR)/monotouch_System.Core_test.dll
+System.Core_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(TESTDIR)/monotouch_System.Core_test.dll
System.Core_ARGS = $(NUNIT) monotouch_System.Core_test.dll
-System_ASSEMBLIES = $(TESTDIR)/monotouch_System_test.dll $(BCL_DIR)/Mono.Security.dll
+System_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(TESTDIR)/monotouch_System_test.dll $(BCL_DIR)/Mono.Security.dll
System_ARGS = $(NUNIT) monotouch_System_test.dll
-System.Data_ASSEMBLIES = $(BCL_DIR)/System.Data.dll $(BCL_DIR)/System.Transactions.dll $(TESTDIR)/monotouch_System.Data_test.dll
+System.Data_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.Data.dll $(BCL_DIR)/System.Transactions.dll $(TESTDIR)/monotouch_System.Data_test.dll
System.Data_ARGS = $(NUNIT) monotouch_System.Data_test.dll
-System.Net.Http_ASSEMBLIES = $(BCL_DIR)/System.Net.Http.dll $(TESTDIR)/monotouch_System.Net.Http_test.dll
+System.Net.Http_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.Net.Http.dll $(TESTDIR)/monotouch_System.Net.Http_test.dll
System.Net.Http_ARGS = $(NUNIT) monotouch_System.Net.Http_test.dll
-System.Numerics_ASSEMBLIES = $(TESTDIR)/monotouch_System.Numerics_test.dll
+System.Numerics_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(TESTDIR)/monotouch_System.Numerics_test.dll
System.Numerics_ARGS = $(NUNIT) monotouch_System.Numerics_test.dll
-System.Runtime.Serialization_ASSEMBLIES = $(BCL_DIR)/System.Runtime.Serialization.dll $(BCL_DIR)/System.ServiceModel.dll $(BCL_DIR)/System.ServiceModel.Internals.dll $(TESTDIR)/monotouch_System.Runtime.Serialization_test.dll
+System.Runtime.Serialization_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.Runtime.Serialization.dll $(BCL_DIR)/System.ServiceModel.dll $(BCL_DIR)/System.ServiceModel.Internals.dll $(TESTDIR)/monotouch_System.Runtime.Serialization_test.dll
System.Runtime.Serialization_ARGS = $(NUNIT) monotouch_System.Runtime.Serialization_test.dll
-System.Transactions_ASSEMBLIES = $(BCL_DIR)/System.Transactions.dll $(TESTDIR)/monotouch_System.Transactions_test.dll
+System.Transactions_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.Transactions.dll $(TESTDIR)/monotouch_System.Transactions_test.dll
System.Transactions_ARGS = $(NUNIT) monotouch_System.Transactions_test.dll
-System.IO.Compression_ASSEMBLIES = $(BCL_DIR)/System.IO.Compression.dll $(TESTDIR)/monotouch_System.IO.Compression_test.dll
+System.IO.Compression_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.IO.Compression.dll $(TESTDIR)/monotouch_System.IO.Compression_test.dll
System.IO.Compression_ARGS = $(NUNIT) monotouch_System.IO.Compression_test.dll
-System.IO.Compression.FileSystem_ASSEMBLIES = $(BCL_DIR)/System.IO.Compression.FileSystem.dll $(BCL_DIR)/System.IO.Compression.dll $(TESTDIR)/monotouch_System.IO.Compression.FileSystem_test.dll
+System.IO.Compression.FileSystem_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.IO.Compression.FileSystem.dll $(BCL_DIR)/System.IO.Compression.dll $(TESTDIR)/monotouch_System.IO.Compression.FileSystem_test.dll
System.IO.Compression.FileSystem_ARGS = $(NUNIT) monotouch_System.IO.Compression.FileSystem_test.dll
-Mono.CSharp_ASSEMBLIES = $(BCL_DIR)/Mono.CSharp.dll $(TESTDIR)/monotouch_Mono.CSharp_test.dll
+Mono.CSharp_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/Mono.CSharp.dll $(TESTDIR)/monotouch_Mono.CSharp_test.dll
Mono.CSharp_ARGS = $(NUNIT) monotouch_Mono.CSharp_test.dll
-System.Json_ASSEMBLIES = $(BCL_DIR)/System.Json.dll $(TESTDIR)/monotouch_System.Json_test.dll
+System.Json_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.Json.dll $(TESTDIR)/monotouch_System.Json_test.dll
System.Json_ARGS = $(NUNIT) monotouch_System.Json_test.dll
-System.ComponentModel.DataAnnotations_ASSEMBLIES = $(BCL_DIR)/System.ComponentModel.DataAnnotations.dll $(TESTDIR)/monotouch_System.ComponentModel.DataAnnotations_test.dll
+System.ComponentModel.DataAnnotations_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.ComponentModel.DataAnnotations.dll $(TESTDIR)/monotouch_System.ComponentModel.DataAnnotations_test.dll
System.ComponentModel.DataAnnotations_ARGS = $(NUNIT) monotouch_System.ComponentModel.DataAnnotations_test.dll
-Mono.Data.Sqlite_ASSEMBLIES = $(BCL_DIR)/Mono.Data.Sqlite.dll $(TESTDIR)/monotouch_Mono.Data.Sqlite_test.dll
+Mono.Data.Sqlite_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/Mono.Data.Sqlite.dll $(TESTDIR)/monotouch_Mono.Data.Sqlite_test.dll
Mono.Data.Sqlite_ARGS = $(NUNIT) monotouch_Mono.Data.Sqlite_test.dll
-Mono.Data.Tds_ASSEMBLIES = $(BCL_DIR)/Mono.Data.Tds.dll $(TESTDIR)/monotouch_Mono.Data.Tds_test.dll
+Mono.Data.Tds_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/Mono.Data.Tds.dll $(TESTDIR)/monotouch_Mono.Data.Tds_test.dll
Mono.Data.Tds_ARGS = $(NUNIT) monotouch_Mono.Data.Tds_test.dll
-System.Security_ASSEMBLIES = $(BCL_DIR)/System.Security.dll $(TESTDIR)/monotouch_System.Security_test.dll
+System.Security_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.Security.dll $(TESTDIR)/monotouch_System.Security_test.dll
System.Security_ARGS = $(NUNIT) monotouch_System.Security_test.dll
-System.Xml_ASSEMBLIES = $(BCL_DIR)/System.Data.dll $(BCL_DIR)/System.Transactions.dll $(TESTDIR)/monotouch_System.Xml_test.dll
+System.Xml_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.Data.dll $(BCL_DIR)/System.Transactions.dll $(TESTDIR)/monotouch_System.Xml_test.dll
System.Xml_ARGS = $(NUNIT) monotouch_System.Xml_test.dll
-System.Xml.Linq_ASSEMBLIES = $(BCL_DIR)/System.Xml.Linq.dll $(TESTDIR)/monotouch_System.Xml.Linq_test.dll
+System.Xml.Linq_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.Xml.Linq.dll $(TESTDIR)/monotouch_System.Xml.Linq_test.dll
System.Xml.Linq_ARGS = $(NUNIT) monotouch_System.Xml.Linq_test.dll
-Mono.Security_ASSEMBLIES = $(TESTDIR)/monotouch_Mono.Security_test.dll
+Mono.Security_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(TESTDIR)/monotouch_Mono.Security_test.dll
Mono.Security_ARGS = $(NUNIT) monotouch_Mono.Security_test.dll
-System.ServiceModel.Web_ASSEMBLIES = $(BCL_DIR)/System.ServiceModel.Web.dll $(BCL_DIR)/System.ServiceModel.dll $(BCL_DIR)/System.ServiceModel.Internals.dll $(BCL_DIR)/System.IdentityModel.dll $(BCL_DIR)/System.Runtime.Serialization.dll $(TESTDIR)/monotouch_System.ServiceModel.Web_test.dll
+System.ServiceModel.Web_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.ServiceModel.Web.dll $(BCL_DIR)/System.ServiceModel.dll $(BCL_DIR)/System.ServiceModel.Internals.dll $(BCL_DIR)/System.IdentityModel.dll $(BCL_DIR)/System.Runtime.Serialization.dll $(TESTDIR)/monotouch_System.ServiceModel.Web_test.dll
System.ServiceModel.Web_ARGS = $(NUNIT) monotouch_System.ServiceModel.Web_test.dll
-System.Web.Services_ASSEMBLIES = $(BCL_DIR)/System.Web.Services.dll $(TESTDIR)/monotouch_System.Web.Services_test.dll
+System.Web.Services_ASSEMBLIES = $(CLASSIC_TEST_ASSEMBLIES) $(BCL_DIR)/System.Web.Services.dll $(TESTDIR)/monotouch_System.Web.Services_test.dll
System.Web.Services_ARGS = $(NUNIT) monotouch_System.Web.Services_test.dll
+
+endif
diff --git a/sdks/ios/README.md b/sdks/ios/README.md
index 74ca6aea2c6..b6c09a2fcfc 100644
--- a/sdks/ios/README.md
+++ b/sdks/ios/README.md
@@ -48,11 +48,11 @@ of the default ad-hoc signing. It also needs to include a provisioning
profile. This can be done using:
```
-make build-ios-dev-<app> IOS_SIGNING_IDENTITY="iPhone Developer: XXX" IOS_PROVISIONING_PROFILE="$HOME/Library/MobileDevice/Provisioning Profiles/test.mobileprovision"
+make build-ios-dev-<app> IOS_SIGNING_IDENTITY="iPhone Developer: XXX" IOS_TEAM_IDENTIFIER="XXXX"
```
* The certificates/provisioning profiles need to be installed on the
-host/device.
+host/device. Check `$HOME/Library/MobileDevice/Provisioning Profiles/*.mobileprovision` for a team identifier you can use.
* The app is installed/run using 'ios-deploy', make sure it is installed.
@@ -69,7 +69,3 @@ seem to read the device logs, only the graphical Console app can.
* Use a publish-subscribe pattern by uploading test results to some cloud service like
Azure EventHub. This only requires client side internet access on the device and
the test harness.
-
-## Notes
-
-Bernhard needed this patch to make it work on his machine: https://gist.github.com/lewurm/7711187deadb57bae97a4d4be4df563b
diff --git a/sdks/ios/app/.gitignore b/sdks/ios/app/.gitignore
new file mode 100644
index 00000000000..049da2505ae
--- /dev/null
+++ b/sdks/ios/app/.gitignore
@@ -0,0 +1,2 @@
+/app-*device.a
+/app-*simulator
diff --git a/sdks/ios/runtime/Entitlements.xcent b/sdks/ios/app/Entitlements.plist.in
index ff24d120cea..c670f09ba55 100644
--- a/sdks/ios/runtime/Entitlements.xcent
+++ b/sdks/ios/app/Entitlements.plist.in
@@ -5,8 +5,8 @@
<key>get-task-allow</key>
<true/>
<key>application-identifier</key>
- <string>C9D4426WFH.com.xamarin.test2</string>
+ <string>TEAM_IDENTIFIER.com.xamarin.mono.ios</string>
<key>com.apple.developer.team-identifier</key>
- <string>C9D4426WFH</string>
+ <string>TEAM_IDENTIFIER</string>
</dict>
</plist>
diff --git a/sdks/ios/runtime/Info.plist.in b/sdks/ios/app/Info.plist.in
index 0b5d296d3fe..2e61ee33995 100644
--- a/sdks/ios/runtime/Info.plist.in
+++ b/sdks/ios/app/Info.plist.in
@@ -50,10 +50,6 @@
<integer>2</integer>
<integer>3</integer>
</array>
- <key>UILaunchStoryboardName</key>
- <string>LaunchScreen</string>
- <key>UIMainStoryboardFile</key>
- <string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
diff --git a/sdks/ios/app/Makefile b/sdks/ios/app/Makefile
new file mode 100644
index 00000000000..d9d648cad42
--- /dev/null
+++ b/sdks/ios/app/Makefile
@@ -0,0 +1,110 @@
+TOP=$(realpath $(CURDIR)/../../..)
+-include $(TOP)/sdks/Make.config
+
+ifndef DISABLE_CLASSIC
+ALL_TARGETS += app-simulator app-device.a
+endif
+
+ifdef ENABLE_NETCORE
+ALL_TARGETS += app-netcore-simulator app-netcore-device.a
+endif
+
+all: $(ALL_TARGETS)
+
+CONFIGURATION?=release
+
+XCODE_ROOT=$(shell xcode-select -p)
+
+UNREFERENCED_SYMBOLS_COMMON = \
+ _xamarin_log \
+ _xamarin_timezone_get_data \
+ _xamarin_timezone_get_names
+
+UNREFERENCED_SYMBOLS_CLASSIC = \
+ _CloseZStream \
+ _CreateZStream \
+ _Flush \
+ _ReadZStream \
+ _WriteZStream
+
+CC = $(XCODE_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
+SIM_SYSROOT = $(XCODE_ROOT)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
+SIM_ARCH = x86_64
+SIM_CLASSIC_SDK_DIR = ../../out/ios-sim64-$(CONFIGURATION)
+SIM_NETCORE_SDK_DIR = ../../out/ios-netcore_sim64-$(CONFIGURATION)
+SIM_CFLAGS = \
+ -std=gnu11 \
+ -fobjc-arc \
+ -isysroot $(SIM_SYSROOT) \
+ -mios-simulator-version-min=10.1 \
+ -g
+
+SIM_LDFLAGS = \
+ -isysroot $(SIM_SYSROOT) \
+ -mios-simulator-version-min=10.1 \
+ -framework Foundation \
+ -framework UIKit \
+ -framework GSS \
+ -liconv -lz
+
+ifndef DISABLE_CLASSIC
+SIM_CLASSIC_LDFLAGS = \
+ $(foreach u,$(UNREFERENCED_SYMBOLS_COMMON) $(UNREFERENCED_SYMBOLS_CLASSIC),-u $u) \
+ $(SIM_CLASSIC_SDK_DIR)/lib/libmonosgen-2.0.a \
+ -force_load $(SIM_CLASSIC_SDK_DIR)/lib/libmono-native-unified.a \
+ -force_load $(SIM_CLASSIC_SDK_DIR)/lib/libMonoPosixHelper.a
+
+sim-%.o: %.m
+ $(ENV) $(CC) -arch $(SIM_ARCH) $(SIM_CFLAGS) -I$(SIM_CLASSIC_SDK_DIR)/include/mono-2.0 -c -o $@ $^
+
+app-simulator: sim-main.o sim-runtime.o
+ $(ENV) $(CC) -arch $(SIM_ARCH) $(SIM_LDFLAGS) $(SIM_CLASSIC_LDFLAGS) -o $@ $^
+endif
+
+ifdef ENABLE_NETCORE
+SIM_NETCORE_LDFLAGS = \
+ $(foreach u,$(UNREFERENCED_SYMBOLS_COMMON),-u $u) \
+ $(SIM_NETCORE_SDK_DIR)/lib/libmonosgen-2.0.a \
+ -force_load $(SIM_NETCORE_SDK_DIR)/lib/System.Native.a \
+ -force_load $(SIM_NETCORE_SDK_DIR)/lib/System.IO.Compression.Native.a \
+ -force_load $(SIM_NETCORE_SDK_DIR)/lib/System.Security.Cryptography.Native.Apple.a
+
+sim-netcore-%.o: %.m
+ $(ENV) $(CC) -arch $(SIM_ARCH) $(SIM_CFLAGS) -I$(SIM_NETCORE_SDK_DIR)/include/mono-2.0 -c -o $@ $^
+
+app-netcore-simulator: sim-netcore-main.o sim-netcore-runtime.o
+ $(ENV) $(CC) -arch $(SIM_ARCH) $(SIM_LDFLAGS) $(SIM_NETCORE_LDFLAGS) -o $@ $^
+endif
+
+
+DEV_ARCH = arm64
+DEV_CLASSIC_SDK_DIR = ../../out/ios-target64-$(CONFIGURATION)
+DEV_NETCORE_SDK_DIR = ../../out/ios-netcore_target64-$(CONFIGURATION)
+DEV_SYSROOT = $(XCODE_ROOT)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/
+DEV_CFLAGS = \
+ -isysroot $(DEV_SYSROOT) \
+ -std=gnu11 \
+ -fobjc-arc \
+ -mios-simulator-version-min=10.1 \
+ -g \
+ -fPIC \
+ -DDEVICE=1
+
+ifndef DISABLE_CLASSIC
+dev-%.o: %.m
+ $(ENV) $(CC) -arch $(DEV_ARCH) $(DEV_CFLAGS) -I$(DEV_CLASSIC_SDK_DIR)/include/mono-2.0 -c -o $@ $^
+
+app-device.a: dev-main.o dev-runtime.o
+ libtool -static -o $@ $^
+endif
+
+ifdef ENABLE_NETCORE
+dev-netcore-%.o: %.m
+ $(ENV) $(CC) -arch $(DEV_ARCH) $(DEV_CFLAGS) -I$(DEV_NETCORE_SDK_DIR)/include/mono-2.0 -DENABLE_NETCORE -c -o $@ $^
+
+app-netcore-device.a: dev-netcore-main.o dev-netcore-runtime.o
+ libtool -static -o $@ $^
+endif
+
+clean:
+ $(RM) -rf app-simulator app-netcore-simulator *.o *.a
diff --git a/sdks/ios/runtime/ViewController.m b/sdks/ios/app/main.m
index ca6cfa1c078..c3fdbc1dedb 100644
--- a/sdks/ios/runtime/ViewController.m
+++ b/sdks/ios/app/main.m
@@ -1,27 +1,70 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
//
-// ViewController.m
+// main.m
// test-runner
//
// Created by Zoltan Varga on 11/12/17.
// Copyright © 2017 Zoltan Varga. All rights reserved.
//
-#import "ViewController.h"
+#import <UIKit/UIKit.h>
#import "runtime.h"
-@interface ViewController ()
+@interface ViewController : UIViewController
@end
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+@property (strong, nonatomic) ViewController *controller;
+
+@end
+
+// ------------------------------------------
+
+@implementation AppDelegate
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ self.controller = [[ViewController alloc] initWithNibName:nil bundle:nil];
+ self.window.rootViewController = self.controller;
+ [self.window makeKeyAndVisible];
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application {
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+}
+
+
+@end
+
+
@implementation ViewController
+UIView *mainView;
UILabel *lblResults;
int passed = 0, skipped = 0, failed = 0;
- (void)viewDidLoad {
[super viewDidLoad];
+ mainView = [[UIView alloc] initWithFrame:self.view.frame];
+ mainView.backgroundColor = [UIColor whiteColor];
+ [self.view addSubview:mainView];
+
UILabel *lblHeader = [[UILabel alloc] init];
lblHeader.frame = CGRectMake(100, 100, 200, 200);
lblHeader.backgroundColor = [UIColor clearColor];
@@ -29,7 +72,7 @@ int passed = 0, skipped = 0, failed = 0;
lblHeader.font = [UIFont boldSystemFontOfSize: 20];
lblHeader.numberOfLines = 2;
lblHeader.text = @"Mono iOS SDK\nRunning tests...";
- [self.view addSubview:lblHeader];
+ [mainView addSubview:lblHeader];
lblResults = [[UILabel alloc] init];
lblResults.frame = CGRectMake(100, 200, 200, 200);
@@ -38,7 +81,7 @@ int passed = 0, skipped = 0, failed = 0;
lblResults.font = [UIFont boldSystemFontOfSize: 20];
lblResults.numberOfLines = 3;
lblResults.text = @"Passed: 0\nSkipped: 0\nFailed: 0";
- [self.view addSubview:lblResults];
+ [mainView addSubview:lblResults];
NSTimer* timer = [NSTimer timerWithTimeInterval:0.5f target:self selector:@selector(updateTestResults) userInfo:nil repeats:YES];
[[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];
@@ -67,3 +110,10 @@ int passed = 0, skipped = 0, failed = 0;
@end
+
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
diff --git a/sdks/ios/runtime/runtime.h b/sdks/ios/app/runtime.h
index 4952bdbcf5b..4952bdbcf5b 100644
--- a/sdks/ios/runtime/runtime.h
+++ b/sdks/ios/app/runtime.h
diff --git a/sdks/ios/runtime/runtime.m b/sdks/ios/app/runtime.m
index f4529283c17..106ba9cb6d0 100644
--- a/sdks/ios/runtime/runtime.m
+++ b/sdks/ios/app/runtime.m
@@ -15,6 +15,8 @@
#include <sys/stat.h>
#include <sys/mman.h>
+#include "runtime.h"
+
//
// Based on runtime/ in xamarin-macios
//
@@ -27,6 +29,7 @@ static os_log_t stdout_log;
typedef unsigned char* (*MonoLoadAotDataFunc) (MonoAssembly *assembly, int size, void *user_data, void **out_handle);
typedef void (*MonoFreeAotDataFunc) (MonoAssembly *assembly, int size, void *user_data, void *handle);
void mono_install_load_aot_data_hook (MonoLoadAotDataFunc load_func, MonoFreeAotDataFunc free_func, void *user_data);
+void mono_trace_init (void);
bool
file_exists (const char *path)
@@ -197,7 +200,7 @@ void
log_callback (const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *user_data)
{
os_log_info (OS_LOG_DEFAULT, "(%s %s) %s", log_domain, log_level, message);
- NSLog (@"(%s %s) %s", log_domain, log_level, message);
+ //NSLog (@"(%s %s) %s", log_domain, log_level, message);
if (fatal) {
os_log_info (OS_LOG_DEFAULT, "Exit code: %d.", 1);
exit (1);
@@ -208,6 +211,7 @@ static void
register_dllmap (void)
{
mono_dllmap_insert (NULL, "System.Native", NULL, "__Internal", NULL);
+ mono_dllmap_insert (NULL, "System.IO.Compression.Native", NULL, "__Internal", NULL);
mono_dllmap_insert (NULL, "System.Security.Cryptography.Native.Apple", NULL, "__Internal", NULL);
}
@@ -225,6 +229,9 @@ mono_ios_runtime_init (void)
char *executable;
char **args, **config_args = NULL;
+ //setenv ("MONO_LOG_LEVEL", "debug", TRUE);
+ //setenv ("MONO_LOG_MASK", "all", TRUE);
+
stdout_log = os_log_create ("com.xamarin", "stdout");
id args_array = [[NSProcessInfo processInfo] arguments];
@@ -302,12 +309,11 @@ mono_ios_runtime_init (void)
mono_install_assembly_preload_hook (assembly_preload_hook, NULL);
mono_install_load_aot_data_hook (load_aot_data, free_aot_data, NULL);
mono_install_unhandled_exception_hook (unhandled_exception_handler, NULL);
+ mono_trace_init ();
mono_trace_set_log_handler (log_callback, NULL);
mono_set_signal_chaining (TRUE);
mono_set_crash_chaining (TRUE);
- //setenv ("MONO_LOG_LEVEL", "debug", TRUE);
-
mono_jit_init_version ("Mono.ios", "mobile");
MonoAssembly *assembly = load_assembly (executable, NULL);
@@ -318,7 +324,7 @@ mono_ios_runtime_init (void)
char *managed_argv [128];
assert (managed_argc < 128 - 2);
int managed_aindex = 0;
- managed_argv [managed_aindex ++] = "test-runner";
+ managed_argv [managed_aindex ++] = executable;
for (int i = 0; i < managed_argc; ++i) {
managed_argv [managed_aindex] = args [aindex];
os_log_info (OS_LOG_DEFAULT, "Arg: %s", managed_argv [managed_aindex]);
diff --git a/sdks/ios/appbuilder/appbuilder.cs b/sdks/ios/appbuilder/appbuilder.cs
index d1127d324b4..0df8c031903 100644
--- a/sdks/ios/appbuilder/appbuilder.cs
+++ b/sdks/ios/appbuilder/appbuilder.cs
@@ -18,7 +18,7 @@ public class AppBuilder
symbols.Add (String.Format ("mono_aot_module_{0}_info", img.Replace ('.', '_').Replace ('-', '_')));
}
- var w = File.CreateText (Path.Combine (builddir, "main.m"));
+ var w = File.CreateText (Path.Combine (builddir, "modules.m"));
/* copy from <mono/mini/jit.h> */
w.WriteLine ("typedef enum {");
@@ -86,7 +86,7 @@ public class AppBuilder
string target = null;
string appdir = null;
string builddir = null;
- string runtimedir = null;
+ string apptemplatedir = null;
string mono_sdkdir = null;
string bundle_identifier = null;
string bundle_name = null;
@@ -95,18 +95,20 @@ public class AppBuilder
string aotdir = null;
string exe = null;
string signing_identity = null;
- string profile = null;
+ string team_identifier = null;
+ bool isnetcore = false;
bool isdev = false;
bool isrelease = false;
bool isllvm = false;
bool isinterponly = false;
bool isinterpmixed = false;
var assemblies = new List<string> ();
+ var content_files = new List<string> ();
var p = new OptionSet () {
{ "target=", s => target = s },
{ "appdir=", s => appdir = s },
{ "builddir=", s => builddir = s },
- { "runtimedir=", s => runtimedir = s },
+ { "apptemplatedir=", s => apptemplatedir = s },
{ "mono-sdkdir=", s => mono_sdkdir = s },
{ "sysroot=", s => sysroot = s },
{ "aot-cachedir=", s => aotdir = s },
@@ -114,18 +116,20 @@ public class AppBuilder
{ "bundle-name=", s => bundle_name = s },
{ "bundle-executable=", s => bundle_executable = s },
{ "signing-identity=", s => signing_identity = s },
- { "profile=", s => profile = s },
+ { "team-identifier=", s => team_identifier = s },
{ "llvm", s => isllvm = true },
+ { "netcore", s => isnetcore = true },
{ "interp-only", s => isinterponly = true },
{ "interp-mixed", s => isinterpmixed = true },
{ "exe=", s => exe = s },
{ "r=", s => assemblies.Add (s) },
+ { "content=", s => content_files.Add (s) },
};
var new_args = p.Parse (args).ToArray ();
check_mandatory (target, "--target");
- check_mandatory (runtimedir, "--runtimedir");
+ check_mandatory (apptemplatedir, "--apptemplatedir");
check_mandatory (appdir, "--appdir");
check_mandatory (mono_sdkdir, "--mono-sdkdir");
check_mandatory (sysroot, "--sysroot");
@@ -134,6 +138,7 @@ public class AppBuilder
switch (target) {
case "ios-dev64":
isdev = true;
+ check_mandatory (team_identifier, "--team-identifier");
break;
case "ios-sim64":
break;
@@ -146,6 +151,9 @@ public class AppBuilder
if (isllvm)
isrelease = true;
+ string runtime = isnetcore ? "ios-netcore_target64-release" : "ios-target64-release";
+ string cross_runtime = isnetcore ? "ios-netcore_cross64-release" : "ios-cross64-release";
+
bool isinterpany = isinterponly || isinterpmixed;
string aot_args = "";
@@ -169,7 +177,7 @@ public class AppBuilder
Directory.CreateDirectory (builddir);
// Create Info.plist file
- var lines = File.ReadAllLines (Path.Combine (runtimedir, "Info.plist.in"));
+ var lines = File.ReadAllLines (Path.Combine (apptemplatedir, "Info.plist.in"));
for (int i = 0; i < lines.Length; ++i) {
string line = lines [i];
line = line.Replace ("BUNDLE_IDENTIFIER", bundle_identifier);
@@ -180,6 +188,15 @@ public class AppBuilder
}
File.WriteAllLines (Path.Combine (builddir, "Info.plist"), lines);
+ // Create Entitlements.plist file
+ lines = File.ReadAllLines (Path.Combine (apptemplatedir, "Entitlements.plist.in"));
+ for (int i = 0; i < lines.Length; ++i) {
+ string line = lines [i];
+ line = line.Replace ("TEAM_IDENTIFIER", team_identifier);
+ lines [i] = line;
+ }
+ File.WriteAllLines (Path.Combine (builddir, "Entitlements.plist"), lines);
+
// Create config.json file
string config = "{ \"exe\" : \"" + exe + "\" }";
File.WriteAllLines (Path.Combine (builddir, "config.json"), new string [] { config });
@@ -188,14 +205,15 @@ public class AppBuilder
// Defines
ninja.WriteLine ($"mono_sdkdir = {mono_sdkdir}");
- ninja.WriteLine ($"monoios_dir = {runtimedir}");
+ ninja.WriteLine ($"apptemplate_dir = {apptemplatedir}");
ninja.WriteLine ($"appdir = {appdir}");
ninja.WriteLine ($"sysroot = {sysroot}");
- ninja.WriteLine ("cross = $mono_sdkdir/ios-cross64-release/bin/aarch64-darwin-mono-sgen");
+ ninja.WriteLine ($"cross = $mono_sdkdir/{cross_runtime}/bin/aarch64-darwin-mono-sgen");
ninja.WriteLine ($"builddir = .");
if (aotdir != null)
ninja.WriteLine ($"aotdir = {aotdir}");
ninja.WriteLine ($"signing_identity = {signing_identity}");
+ ninja.WriteLine ("entitlements = $builddir/Entitlements.plist");
// Rules
ninja.WriteLine ("rule aot");
ninja.WriteLine ($" command = MONO_PATH=$mono_path $cross -O=gsharedvt,float32 --debug {cross_runtime_args} --aot=mtriple=arm64-ios,static,asmonly,direct-icalls,no-direct-calls,dwarfdebug,{aot_args},outfile=$outfile,data-outfile=$data_outfile $src_file");
@@ -234,7 +252,7 @@ public class AppBuilder
var ofiles = "";
var assembly_names = new List<string> ();
- var cultures = CultureInfo.GetCultures (CultureTypes.AllCultures).Where (x => !String.IsNullOrEmpty (x.IetfLanguageTag)).Select (x => x.IetfLanguageTag);
+ var cultures = CultureInfo.GetCultures (CultureTypes.AllCultures).Where (x => !String.IsNullOrEmpty (x.IetfLanguageTag)).Select (x => x.IetfLanguageTag).Distinct ();
foreach (var assembly in assemblies) {
string filename = Path.GetFileName (assembly);
var filename_noext = Path.GetFileNameWithoutExtension (filename);
@@ -299,35 +317,36 @@ public class AppBuilder
assembly_names.Add (aname.Name);
}
+ foreach (var file in content_files) {
+ string filename = Path.GetFileName (file);
+ ninja.WriteLine ($"build $appdir/{filename}: cpifdiff {file}");
+ }
+
ninja.WriteLine ("build $appdir: mkdir");
if (isdev) {
- string libs = "$mono_sdkdir/ios-target64-release/lib/libmonosgen-2.0.a";
+ string libs = $"$mono_sdkdir/{runtime}/lib/libmonosgen-2.0.a";
if (isinterpany) {
- libs += " $mono_sdkdir/ios-target64-release/lib/libmono-ee-interp.a";
- libs += " $mono_sdkdir/ios-target64-release/lib/libmono-icall-table.a";
- libs += " $mono_sdkdir/ios-target64-release/lib/libmono-ilgen.a";
+ libs += $" $mono_sdkdir/{runtime}/lib/libmono-ee-interp.a";
+ libs += $" $mono_sdkdir/{runtime}/lib/libmono-icall-table.a";
+ libs += $" $mono_sdkdir/{runtime}/lib/libmono-ilgen.a";
}
- ninja.WriteLine ($"build $appdir/{bundle_executable}: gen-exe {ofiles} $builddir/main.o " + libs + " $monoios_dir/libmonoios.a");
- ninja.WriteLine (" forcelibs = -force_load $mono_sdkdir/ios-target64-release/lib/libmono-native-unified.a");
- ninja.WriteLine ("build $builddir/main.o: compile-objc $builddir/main.m");
+ ninja.WriteLine ($"build $appdir/{bundle_executable}: gen-exe {ofiles} $builddir/modules.o " + libs + (isnetcore ? " $apptemplate_dir/app-netcore-device.a" : " $apptemplate_dir/app-device.a"));
+ if (isnetcore)
+ ninja.WriteLine ($" forcelibs = -force_load $mono_sdkdir/{runtime}/lib/System.Native.a -force_load $mono_sdkdir/{runtime}/lib/System.IO.Compression.Native.a -force_load $mono_sdkdir/{runtime}/lib/System.Security.Cryptography.Native.Apple.a");
+ else
+ ninja.WriteLine ($" forcelibs = -force_load $mono_sdkdir/{runtime}/lib/libmono-native-unified.a");
+ ninja.WriteLine ("build $builddir/modules.o: compile-objc $builddir/modules.m");
} else {
- ninja.WriteLine ($"build $appdir/{bundle_executable}: cp $monoios_dir/runtime");
+ ninja.WriteLine ($"build $appdir/{bundle_executable}: cp " + (isnetcore ? "$apptemplate_dir/app-netcore-simulator" : "$apptemplate_dir/app-simulator"));
}
ninja.WriteLine ("build $builddir/Info.plist.binary: plutil $builddir/Info.plist");
ninja.WriteLine ("build $appdir/Info.plist: cpifdiff $builddir/Info.plist.binary");
ninja.WriteLine ("build $appdir/config.json: cpifdiff $builddir/config.json");
- ninja.WriteLine ("build $builddir/Entitlements.xcent: cpifdiff $monoios_dir/Entitlements.xcent");
- if (profile != null) {
- ninja.WriteLine ($"build $builddir/embedded.mobileprovision: cp {profile}");
- ninja.WriteLine ($"build $appdir/embedded.mobileprovision: cp $builddir/embedded.mobileprovision");
- }
if (isdev)
- ninja.WriteLine ($"build $appdir/_CodeSignature: codesign $appdir/{bundle_executable} | $builddir/Entitlements.xcent");
+ ninja.WriteLine ($"build $appdir/_CodeSignature: codesign $appdir/{bundle_executable}");
else
- ninja.WriteLine ($"build $appdir/_CodeSignature: codesign-sim $appdir/{bundle_executable} | $builddir/Entitlements.xcent");
- ninja.WriteLine (" entitlements=$builddir/Entitlements.xcent");
- ninja.WriteLine ("build $appdir/Base.lproj: cp-recursive $monoios_dir/Base.lproj");
+ ninja.WriteLine ($"build $appdir/_CodeSignature: codesign-sim $appdir/{bundle_executable}");
ninja.Close ();
diff --git a/sdks/ios/runtime/AppDelegate.h b/sdks/ios/runtime/AppDelegate.h
deleted file mode 100644
index fd49c47b337..00000000000
--- a/sdks/ios/runtime/AppDelegate.h
+++ /dev/null
@@ -1,17 +0,0 @@
-//
-// AppDelegate.h
-// test-runner
-//
-// Created by Zoltan Varga on 11/12/17.
-// Copyright © 2017 Zoltan Varga. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface AppDelegate : UIResponder <UIApplicationDelegate>
-
-@property (strong, nonatomic) UIWindow *window;
-
-
-@end
-
diff --git a/sdks/ios/runtime/AppDelegate.m b/sdks/ios/runtime/AppDelegate.m
deleted file mode 100644
index 1578910d7b2..00000000000
--- a/sdks/ios/runtime/AppDelegate.m
+++ /dev/null
@@ -1,51 +0,0 @@
-//
-// AppDelegate.m
-// test-runner
-//
-// Created by Zoltan Varga on 11/12/17.
-// Copyright © 2017 Zoltan Varga. All rights reserved.
-//
-
-#import "AppDelegate.h"
-
-@interface AppDelegate ()
-
-@end
-
-@implementation AppDelegate
-
-
-- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- // Override point for customization after application launch.
- return YES;
-}
-
-
-- (void)applicationWillResignActive:(UIApplication *)application {
- // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
- // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
-}
-
-
-- (void)applicationDidEnterBackground:(UIApplication *)application {
- // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
- // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
-}
-
-
-- (void)applicationWillEnterForeground:(UIApplication *)application {
- // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
-}
-
-
-- (void)applicationDidBecomeActive:(UIApplication *)application {
- // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
-}
-
-
-- (void)applicationWillTerminate:(UIApplication *)application {
- // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
-}
-
-
-@end
diff --git a/sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib b/sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib
deleted file mode 100644
index 9aa00f51419..00000000000
--- a/sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/01J-lp-oVM-view-Ze5-6b-2t3.nib
+++ /dev/null
Binary files differ
diff --git a/sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/Info.plist b/sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/Info.plist
deleted file mode 100644
index 32288e88f6e..00000000000
--- a/sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/Info.plist
+++ /dev/null
Binary files differ
diff --git a/sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib b/sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib
deleted file mode 100644
index 6b39fef6975..00000000000
--- a/sdks/ios/runtime/Base.lproj/LaunchScreen.storyboardc/UIViewController-01J-lp-oVM.nib
+++ /dev/null
Binary files differ
diff --git a/sdks/ios/runtime/Base.lproj/Main.storyboardc/BYZ-38-t0r-view-8bC-Xf-vdC.nib b/sdks/ios/runtime/Base.lproj/Main.storyboardc/BYZ-38-t0r-view-8bC-Xf-vdC.nib
deleted file mode 100644
index de467bf1fc8..00000000000
--- a/sdks/ios/runtime/Base.lproj/Main.storyboardc/BYZ-38-t0r-view-8bC-Xf-vdC.nib
+++ /dev/null
Binary files differ
diff --git a/sdks/ios/runtime/Base.lproj/Main.storyboardc/Info.plist b/sdks/ios/runtime/Base.lproj/Main.storyboardc/Info.plist
deleted file mode 100644
index 9a41f2cb91b..00000000000
--- a/sdks/ios/runtime/Base.lproj/Main.storyboardc/Info.plist
+++ /dev/null
Binary files differ
diff --git a/sdks/ios/runtime/Base.lproj/Main.storyboardc/UIViewController-BYZ-38-t0r.nib b/sdks/ios/runtime/Base.lproj/Main.storyboardc/UIViewController-BYZ-38-t0r.nib
deleted file mode 100644
index e22d2126647..00000000000
--- a/sdks/ios/runtime/Base.lproj/Main.storyboardc/UIViewController-BYZ-38-t0r.nib
+++ /dev/null
Binary files differ
diff --git a/sdks/ios/runtime/Makefile b/sdks/ios/runtime/Makefile
deleted file mode 100644
index 46b0fadbb5f..00000000000
--- a/sdks/ios/runtime/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-all: runtime libmonoios.a
-
-CONFIGURATION?=release
-
-XCODE_ROOT=$(shell xcode-select -p)
-
-UNREFERENCED_SYMBOLS = \
- _xamarin_log \
- _xamarin_timezone_get_data \
- _xamarin_timezone_get_names \
- _CloseZStream \
- _CreateZStream \
- _Flush \
- _ReadZStream \
- _WriteZStream
-
-CC = $(XCODE_ROOT)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-SIM_SYSROOT = $(XCODE_ROOT)/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk
-SIM_ARCH = x86_64
-SIM_SDK_DIR = ../../out/ios-sim64-$(CONFIGURATION)
-SIM_CFLAGS = \
- -std=gnu11 \
- -fobjc-arc \
- -isysroot $(SIM_SYSROOT) \
- -mios-simulator-version-min=10.1 \
- -g \
- -I$(SIM_SDK_DIR)/include/mono-2.0
-
-SIM_LDFLAGS = \
- -isysroot $(SIM_SYSROOT) \
- -mios-simulator-version-min=10.1 \
- -framework Foundation \
- -framework UIKit \
- -framework GSS \
- $(foreach u,$(UNREFERENCED_SYMBOLS),-u $u) \
- $(SIM_SDK_DIR)/lib/libmonosgen-2.0.a \
- $(SIM_SDK_DIR)/lib/libMonoPosixHelper.a \
- -force_load $(SIM_SDK_DIR)/lib/libmono-native-unified.a \
- -liconv -lz
-
-sim-%.o: %.m
- $(ENV) $(CC) -arch $(SIM_ARCH) $(SIM_CFLAGS) -c -o $@ $^
-
-runtime: sim-main.o sim-runtime.o sim-AppDelegate.o sim-ViewController.o
- $(ENV) $(CC) -arch $(SIM_ARCH) $(SIM_LDFLAGS) -o $@ $^
-
-DEV_ARCH = arm64
-DEV_SDK_DIR = ../../out/ios-target64-$(CONFIGURATION)
-DEV_SYSROOT = $(XCODE_ROOT)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/
-DEV_CFLAGS = \
- -isysroot $(DEV_SYSROOT) \
- -std=gnu11 \
- -fobjc-arc \
- -mios-simulator-version-min=10.1 \
- -g \
- -fPIC \
- -DDEVICE=1 \
- -I$(DEV_SDK_DIR)/include/mono-2.0
-
-DEV_LDFLAGS = \
- -isysroot $(DEV_SYSROOT) \
- -mios-simulator-version-min=10.1 \
- -framework Foundation \
- -framework UIKit \
- -framework GSS \
- -Wl,-pie \
- $(foreach u,$(UNREFERENCED_SYMBOLS),-u $u) \
- $(DEV_SDK_DIR)/lib/libmonosgen-2.0.a \
- $(DEV_SDK_DIR)/lib/libMonoPosixHelper.a \
- -liconv -lz
-
-dev-%.o: %.m
- $(ENV) $(CC) -arch $(DEV_ARCH) $(DEV_CFLAGS) -c -o $@ $^
-
-libmonoios.a: dev-main.o dev-runtime.o dev-AppDelegate.o dev-ViewController.o
- libtool -static -o $@ $^
-
-clean:
- $(RM) -rf runtime *.o *.a
diff --git a/sdks/ios/runtime/ViewController.h b/sdks/ios/runtime/ViewController.h
deleted file mode 100644
index 2904d029aad..00000000000
--- a/sdks/ios/runtime/ViewController.h
+++ /dev/null
@@ -1,15 +0,0 @@
-//
-// ViewController.h
-// test-runner
-//
-// Created by Zoltan Varga on 11/12/17.
-// Copyright © 2017 Zoltan Varga. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-
-@interface ViewController : UIViewController
-
-
-@end
-
diff --git a/sdks/ios/runtime/main.m b/sdks/ios/runtime/main.m
deleted file mode 100644
index ff82643884a..00000000000
--- a/sdks/ios/runtime/main.m
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// main.m
-// test-runner
-//
-// Created by Zoltan Varga on 11/12/17.
-// Copyright © 2017 Zoltan Varga. All rights reserved.
-//
-
-#import <UIKit/UIKit.h>
-#import "AppDelegate.h"
-
-int main(int argc, char * argv[]) {
- @autoreleasepool {
- return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
- }
-}
diff --git a/sdks/ios/test-runner/runner.cs b/sdks/ios/test-runner/runner.cs
index 9d36bb03327..c4e5cc16c5f 100644
--- a/sdks/ios/test-runner/runner.cs
+++ b/sdks/ios/test-runner/runner.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
@@ -80,6 +81,58 @@ class DiagnosticTextWriterMessageSink : LongLivedMarshalByRefObject, IMessageSin
return true;
}
}
+
+class XunitArgumentsParser
+{
+ public static XunitFilters ParseArgumentsToFilter (Stack<string> arguments)
+ {
+ var filters = new XunitFilters ();
+
+ while (arguments.Count > 0)
+ {
+ var option = arguments.Pop ();
+ if (option.StartsWith ("@")) { // response file handling
+ var fileName = option.Substring (1);
+ var fileContent = File.ReadAllLines (fileName);
+ foreach (var line in fileContent)
+ {
+ if (line.StartsWith ("#") || String.IsNullOrWhiteSpace (line)) continue;
+
+ var parts = line.Split (" ", StringSplitOptions.RemoveEmptyEntries);
+ for (var i = parts.Length - 1; i >= 0; i--)
+ arguments.Push (parts[i]);
+ }
+ continue;
+ }
+
+ switch (option)
+ {
+ case "-nomethod": filters.ExcludedMethods.Add (arguments.Pop ()); break;
+ case "-noclass": filters.ExcludedClasses.Add (arguments.Pop ()); break;
+ case "-nonamespace": filters.ExcludedNamespaces.Add (arguments.Pop ()); break;
+ case "-notrait": ParseEqualSeparatedArgument (filters.ExcludedTraits, arguments.Pop ()); break;
+ default: throw new ArgumentException ($"Not supported option: '{option}'");
+ };
+ }
+
+ return filters;
+ }
+
+ static void ParseEqualSeparatedArgument (Dictionary<string, List<string>> targetDictionary, string argument)
+ {
+ var parts = argument.Split ('=');
+ if (parts.Length != 2 || string.IsNullOrEmpty (parts[0]) || string.IsNullOrEmpty (parts[1]))
+ throw new ArgumentException (argument);
+
+ var name = parts[0];
+ var value = parts[1];
+ if (targetDictionary.TryGetValue (name, out List<string> excludedTraits)) {
+ excludedTraits.Add (value);
+ } else {
+ targetDictionary[name] = new List<string> { value };
+ }
+ }
+}
#else
class MonoSdksTextUI : TextUI,ITestListener
{
@@ -115,27 +168,33 @@ class Interop
public class TestRunner
{
public static int Main(string[] args) {
+ var arguments = new Stack<string> ();
string host = null;
int port = 0;
+ for (var i = args.Length - 1; i >= 0; i--)
+ arguments.Push (args[i]);
+
// First argument is the connection string
- if (args [0].StartsWith ("tcp:")) {
- var parts = args [0].Split (':');
+ if (arguments.Peek ().StartsWith("tcp:", StringComparison.Ordinal)) {
+ var parts = arguments.Pop ().Split (':');
if (parts.Length != 3)
throw new Exception ();
host = parts [1];
port = Int32.Parse (parts [2]);
- args = args.Skip (1).ToArray ();
}
+#if !ENABLE_NETCORE
// Make sure the TLS subsystem including the DependencyInjector is initialized.
// This would normally happen on system startup in
// `xamarin-macios/src/ObjcRuntime/Runtime.cs`.
MonoTlsProviderFactory.Initialize ();
+#endif
#if XUNIT_RUNNER
var writer = new TcpWriter (host, port);
- var assemblyFileName = args[0];
+ var assemblyFileName = arguments.Pop ();
+ var filters = XunitArgumentsParser.ParseArgumentsToFilter (arguments);
var configuration = new TestAssemblyConfiguration () { ShadowCopy = false };
var discoveryOptions = TestFrameworkOptions.ForDiscovery (configuration);
var discoverySink = new TestDiscoverySink ();
@@ -147,6 +206,7 @@ public class TestRunner
writer.WriteLine ($"Discovering tests for {assemblyFileName}");
controller.Find (includeSourceInformation: false, discoverySink, discoveryOptions);
discoverySink.Finished.WaitOne ();
+ var testCasesToRun = discoverySink.TestCases.Where (filters.Filter).ToList ();
writer.WriteLine ($"Discovery finished.");
var summarySink = new DelegatingExecutionSummarySink (testSink, () => false, (completed, summary) => { writer.WriteLine ($"Tests run: {summary.Total}, Errors: 0, Failures: {summary.Failed}, Skipped: {summary.Skipped}{Environment.NewLine}Time: {TimeSpan.FromSeconds ((double)summary.Time).TotalSeconds}s"); });
@@ -160,7 +220,7 @@ public class TestRunner
testSink.Execution.TestAssemblyStartingEvent += args => { writer.WriteLine ($"Running tests for {args.Message.TestAssembly.Assembly}"); };
testSink.Execution.TestAssemblyFinishedEvent += args => { writer.WriteLine ($"Finished {args.Message.TestAssembly.Assembly}{Environment.NewLine}"); };
- controller.RunTests (discoverySink.TestCases, resultsSink, testOptions);
+ controller.RunTests (testCasesToRun, resultsSink, testOptions);
resultsSink.Finished.WaitOne ();
writer.WriteLine ($"STARTRESULTXML");
@@ -180,14 +240,15 @@ public class TestRunner
if (host != null) {
Console.WriteLine ($"Connecting to harness at {host}:{port}.");
resultsXml = Path.GetTempFileName ();
- args = args.Concat (new string[] {"-format:xunit", $"-result:{resultsXml}"}).ToArray ();
+ arguments.Push ("-format:xunit");
+ arguments.Push ($"-result:{resultsXml}");
writer = new TcpWriter (host, port);
runner = new MonoSdksTextUI (writer);
} else {
runner = new MonoSdksTextUI ();
}
- runner.Execute (args);
+ runner.Execute (arguments.ToArray ());
if (resultsXml != null) {
writer.WriteLine ($"STARTRESULTXML");