[mtouch] Add logic to determine whether we're building for simulator or device based on runtime identifier.

This commit is contained in:
Rolf Bjarne Kvinge 2021-11-23 01:30:36 +01:00
Родитель b4aae072c8
Коммит 0836b0c758
3 изменённых файлов: 13 добавлений и 2 удалений

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

@ -135,6 +135,7 @@ namespace Xamarin.Bundler {
public XamarinRuntime XamarinRuntime;
public bool? UseMonoFramework;
public string RuntimeIdentifier; // Only used for build-time --run-registrar support
// The bitcode mode to compile to.
// This variable does not apply to macOS, because there's no bitcode on macOS.
@ -369,6 +370,9 @@ namespace Xamarin.Bundler {
public bool IsDeviceBuild {
get {
if (!string.IsNullOrEmpty (RuntimeIdentifier))
return !IsSimulatorBuild;
switch (Platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
@ -385,6 +389,9 @@ namespace Xamarin.Bundler {
public bool IsSimulatorBuild {
get {
if (!string.IsNullOrEmpty (RuntimeIdentifier))
return RuntimeIdentifier.IndexOf ("simulator", StringComparison.OrdinalIgnoreCase) >= 0;
switch (Platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:

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

@ -250,6 +250,10 @@ namespace Xamarin.Bundler {
app.XamarinRuntime = rv;
}, true /* hidden - this is only for build-time --runregistrar support */);
options.Add ("rid=", "The runtime identifier we're building for", v => {
app.RuntimeIdentifier = v;
}, true /* hidden - this is only for build-time --runregistrar support */);
// Keep the ResponseFileSource option at the end.
options.Add (new Mono.Options.ResponseFileSource ());

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

@ -230,7 +230,7 @@ define RunRegistrar
$$(Q) touch $$(basename $$@).m $$(basename $$@).h
.libs/Microsoft.$(9).registrar.$(10)%m .libs/Microsoft.$(9).registrar.$(10)%h: $(TOP)/src/build/dotnet/$(1)/$(3)/Xamarin.$(5).dll $(LOCAL_MTOUCH) | .libs
$$(Q_GEN) $$(LOCAL_MTOUCH_COMMAND) --xamarin-framework-directory=$$(IOS_DESTDIR)/$$(MONOTOUCH_PREFIX) $$(MTOUCH_VERBOSITY) --runregistrar:$$(abspath $$(basename $$@).m) --sdkroot $$(XCODE_DEVELOPER_ROOT) --sdk $(4) $$< --registrar:static --target-framework .NETCoreApp,Version=6.0,Profile=$(1) --abi $(2) -r:$(DOTNET6_BCL_DIR)/System.Runtime.dll
$$(Q_GEN) $$(LOCAL_MTOUCH_COMMAND) --xamarin-framework-directory=$$(IOS_DESTDIR)/$$(MONOTOUCH_PREFIX) $$(MTOUCH_VERBOSITY) --runregistrar:$$(abspath $$(basename $$@).m) --sdkroot $$(XCODE_DEVELOPER_ROOT) --sdk $(4) $$< --registrar:static --target-framework .NETCoreApp,Version=6.0,Profile=$(1) --abi $(2) -r:$(DOTNET6_BCL_DIR)/System.Runtime.dll --rid $(10)
$$(Q) touch $$(basename $$@).m $$(basename $$@).h
%.registrar.$(1).$(2).a: %.registrar.$(1).$(2).m %.registrar.$(1).$(2).h
@ -239,7 +239,7 @@ define RunRegistrar
.libs/Microsoft.$(9).registrar.$(10).a: .libs/Microsoft.$(9).registrar.$(10).m .libs/Microsoft.$(9).registrar.$(10).h | .libs
$$(Q_CC) $$(IOS_CC) -DDEBUG -g -gdwarf-2 $(6) -stdlib=libc++ -std=c++14 -x objective-c++ -o $$@ -c $$< -Wall -Wno-unguarded-availability-new -I$(7) -I$(TOP)/runtime
# make will automatically consider files created in chained implicit rules as temporary files, and delete them afterwards
# make will automatically consider files created in chained implicit rules as temporary files, and delete them afterwards
# marking those files as .SECONDARY will prevent that deletion.
.SECONDARY: Xamarin.$(5).registrar.$(1).$(2).m Xamarin.$(5).registrar.$(1).$(2).h Xamarin.$(5).registrar.$(1).$(2).a
.SECONDARY: .libs/Microsoft.$(8).registrar.$(2).m .libs/Microsoft.$(8).registrar.$(2).h .libs/Microsoft.$(8).registrar.$(2).a