xamarin-macios/tools/mlaunch/Makefile

68 строки
2.7 KiB
Makefile
Исходник Обычный вид История

TOP=../..
include $(TOP)/Make.config
COLOR_GREEN:=$(shell tput setaf 120 2>/dev/null)
COLOR_CLEAR:=$(shell tput sgr0 2>/dev/null)
ifdef INCLUDE_XAMARIN_LEGACY
ifdef ENABLE_XAMARIN
ifdef INCLUDE_MAC
ifdef INCLUDE_IOS
ENABLE_MLAUNCH=1
endif
endif
endif
endif
DOTNET_PLATFORMS_MOBILE=$(filter-out macOS MacCatalyst,$(DOTNET_PLATFORMS))
[dotnet] Add support for 'dotnet build -t:run'. (#9823) * Ship mlaunch in the iOS, tvOS and watchOS NuGets. It should probably go into a separate NuGet (to avoid shipping the same mlaunch executable in three different packages), but that can be done at a later stage. * Add a GetMlaunchArguments task that computes the mlaunch arguments to install or launch an app in either the simulator or on device. * Implement the MSBuild logic to make the Run target (provided by .NET) launch mlaunch (for iOS, tvOS and watchOS) or the built app (for macOS). This is done by setting the RunCommand and RunArguments properties (which the Run target uses) to the correct values. Ideally I'd would make 'dotnet run' work too, but that runs into a different problem which I haven't figured out yet: A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/'. Failed to run as a self-contained app. - The application was run as a self-contained app because '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json' did not specify a framework. - If this should be a framework-dependent app, specify the appropriate framework in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json'. That's for a different pull request though. Ref: https://github.com/xamarin/net6-samples/issues/35.
2020-10-09 14:01:13 +03:00
ifdef ENABLE_MLAUNCH
build-and-install:
$(MAKE) -C $(MACCORE_PATH)/tools/mlaunch all -j8
$(MAKE) -C $(MACCORE_PATH)/tools/mlaunch install -j8
else
build-and-install:
$(Q) $(CP) -R $(MACIOS_BINARIES_PATH)/mlaunch/bin/mlaunch $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin
$(Q) $(CP) -R $(MACIOS_BINARIES_PATH)/mlaunch/lib/mlaunch $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib
endif
all-local:: build-and-install
ifdef ENABLE_MLAUNCH
clean-local::
$(MAKE) -C $(MACCORE_PATH)/tools/mlaunch $@
endif
[dotnet] Add support for 'dotnet build -t:run'. (#9823) * Ship mlaunch in the iOS, tvOS and watchOS NuGets. It should probably go into a separate NuGet (to avoid shipping the same mlaunch executable in three different packages), but that can be done at a later stage. * Add a GetMlaunchArguments task that computes the mlaunch arguments to install or launch an app in either the simulator or on device. * Implement the MSBuild logic to make the Run target (provided by .NET) launch mlaunch (for iOS, tvOS and watchOS) or the built app (for macOS). This is done by setting the RunCommand and RunArguments properties (which the Run target uses) to the correct values. Ideally I'd would make 'dotnet run' work too, but that runs into a different problem which I haven't figured out yet: A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/'. Failed to run as a self-contained app. - The application was run as a self-contained app because '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json' did not specify a framework. - If this should be a framework-dependent app, specify the appropriate framework in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json'. That's for a different pull request though. Ref: https://github.com/xamarin/net6-samples/issues/35.
2020-10-09 14:01:13 +03:00
ifdef ENABLE_DOTNET
ifdef ENABLE_IOS
all-local:: build-and-install
$(MAKE) $(foreach platform,$(DOTNET_PLATFORMS_MOBILE),$(DOTNET_DESTDIR)/Microsoft.$(platform).Sdk/tools/bin/mlaunch)
[dotnet] Add support for 'dotnet build -t:run'. (#9823) * Ship mlaunch in the iOS, tvOS and watchOS NuGets. It should probably go into a separate NuGet (to avoid shipping the same mlaunch executable in three different packages), but that can be done at a later stage. * Add a GetMlaunchArguments task that computes the mlaunch arguments to install or launch an app in either the simulator or on device. * Implement the MSBuild logic to make the Run target (provided by .NET) launch mlaunch (for iOS, tvOS and watchOS) or the built app (for macOS). This is done by setting the RunCommand and RunArguments properties (which the Run target uses) to the correct values. Ideally I'd would make 'dotnet run' work too, but that runs into a different problem which I haven't figured out yet: A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/'. Failed to run as a self-contained app. - The application was run as a self-contained app because '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json' did not specify a framework. - If this should be a framework-dependent app, specify the appropriate framework in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json'. That's for a different pull request though. Ref: https://github.com/xamarin/net6-samples/issues/35.
2020-10-09 14:01:13 +03:00
$(Q) for platform in $(DOTNET_PLATFORMS_MOBILE); do \
$(CP) -R $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mlaunch $(DOTNET_DESTDIR)/Microsoft.$$platform.Sdk/tools/lib; \
[dotnet] Add support for 'dotnet build -t:run'. (#9823) * Ship mlaunch in the iOS, tvOS and watchOS NuGets. It should probably go into a separate NuGet (to avoid shipping the same mlaunch executable in three different packages), but that can be done at a later stage. * Add a GetMlaunchArguments task that computes the mlaunch arguments to install or launch an app in either the simulator or on device. * Implement the MSBuild logic to make the Run target (provided by .NET) launch mlaunch (for iOS, tvOS and watchOS) or the built app (for macOS). This is done by setting the RunCommand and RunArguments properties (which the Run target uses) to the correct values. Ideally I'd would make 'dotnet run' work too, but that runs into a different problem which I haven't figured out yet: A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/'. Failed to run as a self-contained app. - The application was run as a self-contained app because '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json' did not specify a framework. - If this should be a framework-dependent app, specify the appropriate framework in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json'. That's for a different pull request though. Ref: https://github.com/xamarin/net6-samples/issues/35.
2020-10-09 14:01:13 +03:00
done
$(DOTNET_DESTDIR)/Microsoft.%.Sdk/tools/bin/mlaunch: $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch | $(DOTNET_DESTDIR)/Microsoft.%.Sdk/tools/bin
$(Q) $(CP) $< $@
$(DOTNET_DESTDIR)/Microsoft.%.Sdk/tools/bin:
$(Q) mkdir -p $@
[dotnet] Add support for 'dotnet build -t:run'. (#9823) * Ship mlaunch in the iOS, tvOS and watchOS NuGets. It should probably go into a separate NuGet (to avoid shipping the same mlaunch executable in three different packages), but that can be done at a later stage. * Add a GetMlaunchArguments task that computes the mlaunch arguments to install or launch an app in either the simulator or on device. * Implement the MSBuild logic to make the Run target (provided by .NET) launch mlaunch (for iOS, tvOS and watchOS) or the built app (for macOS). This is done by setting the RunCommand and RunArguments properties (which the Run target uses) to the correct values. Ideally I'd would make 'dotnet run' work too, but that runs into a different problem which I haven't figured out yet: A fatal error was encountered. The library 'libhostpolicy.dylib' required to execute the application was not found in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/'. Failed to run as a self-contained app. - The application was run as a self-contained app because '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json' did not specify a framework. - If this should be a framework-dependent app, specify the appropriate framework in '/Users/rolf/work/maccore/onedotnet/xamarin-macios/tests/dotnet/MySingleView/bin/Debug/net5.0-ios/ios-x64/MySingleView.runtimeconfig.json'. That's for a different pull request though. Ref: https://github.com/xamarin/net6-samples/issues/35.
2020-10-09 14:01:13 +03:00
endif
endif
ifdef ENABLE_XAMARIN
MACCORE_HASH:=$(shell cd $(MACCORE_PATH) && git log -1 --pretty=%h)
publish:
$(Q) mkdir -p $(MACIOS_BINARIES_PATH)/mlaunch/bin
$(Q) mkdir -p $(MACIOS_BINARIES_PATH)/mlaunch/lib
$(Q) $(CP) -R $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mlaunch $(MACIOS_BINARIES_PATH)/mlaunch/bin
$(Q) $(CP) -R $(IOS_DESTDIR)/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mlaunch $(MACIOS_BINARIES_PATH)/mlaunch/lib
$(Q) cd $(MACIOS_BINARIES_PATH) && git add mlaunch && git commit -q -m $$'Bump mlaunch to xamarin/maccore@$(MACCORE_HASH)\n\nRef: xamarin/maccore@$(MACCORE_HASH)' && git log -1 --pretty=short
$(Q) echo "$(COLOR_GREEN)A new version of mlaunch has been copied to $(MACIOS_BINARIES_PATH), and a commit created with the new version.$(COLOR_CLEAR)"
$(Q) echo "$(COLOR_GREEN)Please create pull request in the macios-binaries repository for the new mlaunch version, and once merged, bump the submodule in xamarin-macios.$(COLOR_CLEAR)"
else
publish:
@echo "Can't publish mlaunch binaries to the macios-binaries repository unless building mlaunch from source (by enabling the xamarin build)"
@exit 1
endif