Move tests to use new tool xibuild and thus fix msbuild tests (#5128)

* xibuild: New wrapper tool to run msbuild or managed executables

MSBuild supports fallback paths for projects imported using
`$(MSBuildExtensionsPath)`, but these must be specified explicitly in
the app.config of the main executable. There was a PR to allow use of
properties for this in the app.config, but that was not accepted
upstream.

This is required for being able to:

1. build projects with msbuild against the in-tree XI/XM build output
2. and to run nunit tests against the same.

For this we introduce a new tool, `xibuild`, based on XA's `xabuild`.
This supports the fallback paths to be specified via the environment variable
`MSBuildExtensionsPathFallbackPathsOverride`[1].
It essentially operates in 3 modes:

1. `xibuild -c /path/to/foo.exe`
	Generates /path/to/foo.exe.config with the fallback paths inserted into that.

2. `xibuild -- /v:diag /path/to/project.csproj`
	Runs msbuild with the arguments after `--` with a custom app.config based on
	`MSBuild.dll.config`, with the fallback paths correctly inserted.
	This is in a temporary file and the original config file is not touched.

3. `xibuild -t -- /path/to/managed_tool.exe args`
	Generates `/path/to/managed_tool.exe.config` based on `MSBuild.dll.config` with
	the fallback paths inserted, and runs `managed_tool.exe` with the arguments.
	The default is to overwrite the config file.
	But there is also a switch to merge it with an existing config file.

--
1. Value of the environment variable $MSBuildExtensionsPathFallbackPathsOverride
is prepended to any existing list of search paths in `MSBuild.dll.config`, IOW,
it takes precedence. So, the order of lookup becomes:

  - Value of the property `$(MSBuildExtensionsPath)`
  - Value of the environment variable `$MSBuildExtensionsPathFallbackPathsOverride`
  - /Library/Frameworks/Mono.framework/External/xbuild on macOS

* Integrate use of `xibuild` with the tests

Update all uses of `msbuild` and invocations of tools like nunit that
might depend on using the in-tree builds to use `xibuild`.

* xibuild: Move help descriptions to OptionSet itself.
This commit is contained in:
Ankit Jain 2018-11-16 11:24:35 -08:00 коммит произвёл Rolf Bjarne Kvinge
Родитель 505006952c
Коммит f865694f86
20 изменённых файлов: 383 добавлений и 74 удалений

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

@ -253,6 +253,9 @@ SYSTEM_XBUILD=$(MONO_PREFIX)/bin/msbuild
SYSTEM_MSBUILD=unset MSBuildExtensionsPath && $(MONO_PREFIX)/bin/msbuild
SYSTEM_RESGEN=$(MONO_PREFIX)/bin/resgen
XIBUILD_EXE_PATH=$(abspath $(TOP)/tools/xibuild/bin/Debug/xibuild.exe)
SYSTEM_XIBUILD=$(SYSTEM_MONO) $(XIBUILD_EXE_PATH)
PKG_CONFIG=$(MONO_PREFIX)/bin/pkg-config
MAC_PRODUCT=Xamarin.Mac

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

@ -32,7 +32,7 @@ namespace Xamarin.iOS.Tasks
NugetRestore ("../MyExtensionWithPackageReference/MyExtensionWithPackageReference.csproj");
// Can't use the in-process MSBuild engine, because it complains that the project file is invalid (the attribute 'Version' in the element '<PackageReference>' is unrecognized)
var rv = ExecutionHelper.Execute ("msbuild", $"../MyAppWithPackageReference/MyAppWithPackageReference.csproj /p:Platform={Platform} /p:Configuration=Debug", out var output);
var rv = ExecutionHelper.Execute ("xibuild", $"-- ../MyAppWithPackageReference/MyAppWithPackageReference.csproj /p:Platform={Platform} /p:Configuration=Debug", out var output);
if (rv != 0) {
Console.WriteLine ("Build failed:");
Console.WriteLine (output);

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

@ -12,7 +12,7 @@ XamarinMacFrameworkRoot="$xammac_framework_dir"
TargetFrameworkIdentifier=Xamarin.Mac
TargetFrameworkVersion=v2.0
/Library/Frameworks/Mono.framework/Commands/msbuild \
$(self)/../tools/xibuild/bin/Debug/xibuild.exe -- \
/property:XamarinMacFrameworkRoot="$XamarinMacFrameworkRoot" \
/property:TargetFrameworkIdentifier="$TargetFrameworkIdentifier" \
/property:TargetFrameworkVersion="$TargetFrameworkVersion" \

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

@ -37,7 +37,7 @@ BCL_TEST_SUITES=mscorlib \
System.IdentityModel \
ALL_TEST_SUITES=$(TEST_SUITES) $(BCL_TEST_SUITES)
EXEC_UNIT_SERVER=XCODE_DEVELOPER_ROOT=$(XCODE_DEVELOPER_ROOT) MONOTOUCH_ROOT=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX) $(SYSTEM_MONO) --debug $(UNIT_SERVER)
EXEC_UNIT_SERVER=XCODE_DEVELOPER_ROOT=$(XCODE_DEVELOPER_ROOT) MONOTOUCH_ROOT=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(UNIT_SERVER)
export MD_APPLE_SDK_ROOT=$(abspath $(XCODE_DEVELOPER_ROOT)/../..)
export MD_MTOUCH_SDK_ROOT=$(IOS_DESTDIR)/$(MONOTOUCH_PREFIX)
@ -47,6 +47,8 @@ export MSBuildExtensionsPathFallbackPathsOverride=$(IOS_DESTDIR)/Library/Framewo
export XAMMAC_FRAMEWORK_PATH=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current
export XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current
export PATH := $(abspath $(TOP)/tools/xibuild:$(PATH))
ifneq ($(RELEASE),)
ifneq ($(BITCODE),)
CONFIG=Release-bitcode
@ -165,24 +167,24 @@ logdev:
$(MTOUCH) --logdev
$(UNIT_SERVER): $(wildcard $(UNIT_SERVER_DIR)/*.cs)
(cd $(UNIT_SERVER_DIR) && $(SYSTEM_XBUILD))
(cd $(UNIT_SERVER_DIR) && $(SYSTEM_XIBUILD))
build-test-libraries:
@$(MAKE) -C $(TOP)/tests/test-libraries
Makefile.inc: xharness/xharness.exe
$(Q_GEN) $(SYSTEM_MONO) --debug $< $(XHARNESS_VERBOSITY) --configure --autoconf --rootdir $(CURDIR)
$(Q_GEN) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/$< $(XHARNESS_VERBOSITY) --configure --autoconf --rootdir $(CURDIR)
-include Makefile.inc
$(GUI_UNIT_PATH)/bin/net_4_5/GuiUnit.exe:
TargetFrameworkFallbackSearchPaths=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPathFallbackPathsOverride=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) $(GUI_UNIT_PATH)/src/framework/GuiUnit_NET_4_5.csproj
TargetFrameworkFallbackSearchPaths=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPathFallbackPathsOverride=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) $(GUI_UNIT_PATH)/src/framework/GuiUnit_NET_4_5.csproj
$(GUI_UNIT_PATH)/bin/xammac_mobile/GuiUnit.exe:
TargetFrameworkFallbackSearchPaths=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPathFallbackPathsOverride=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) $(GUI_UNIT_PATH)/src/framework/GuiUnit_xammac_mobile.csproj
TargetFrameworkFallbackSearchPaths=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild-frameworks MSBuildExtensionsPathFallbackPathsOverride=$(MAC_DESTDIR)/Library/Frameworks/Mono.framework/External/xbuild XamarinMacFrameworkRoot=$(MAC_DESTDIR)/Library/Frameworks/Xamarin.Mac.framework/Versions/Current $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) $(GUI_UNIT_PATH)/src/framework/GuiUnit_xammac_mobile.csproj
Makefile-mac.inc: xharness/xharness.exe
$(Q_GEN) $(SYSTEM_MONO) --debug $< $(XHARNESS_VERBOSITY) --configure --autoconf --mac --rootdir $(CURDIR)
$(Q_GEN) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/$< $(XHARNESS_VERBOSITY) --configure --autoconf --mac --rootdir $(CURDIR)
-include Makefile-mac.inc
@ -198,7 +200,7 @@ xharness/xharness.exe: $(wildcard xharness/*.cs) xharness/xharness.csproj $(TOP)
make -j8 -C $(TOP)/external/mono/mcs/class -i do-xunit-test PROFILE=MONOTOUCH # TODO: This should not be needed and we should get the dlls from the SDK.
nuget restore xharness/xharness.csproj
nuget restore bcl-test/BCLTests/BCLTests.csproj
$(Q_GEN) $(SYSTEM_MSBUILD) $(MSBUILD_VERBOSITY_QUIET) xharness/xharness.csproj
$(Q_GEN) $(SYSTEM_XIBUILD) -- $(MSBUILD_VERBOSITY_QUIET) xharness/xharness.csproj
killall:
@killall "iPhone Simulator" >/dev/null 2>&1 || true
@ -207,14 +209,14 @@ killall:
NUNIT_MSBUILD_DIR=$(TOP)/packages/NUnit.Runners.2.6.4/tools/lib
test-ios-tasks:
$(SYSTEM_XBUILD) $(TOP)/msbuild/Xamarin.MacDev.Tasks.sln
cd $(NUNIT_MSBUILD_DIR) && $(SYSTEM_MONO) ../nunit-console.exe ../../../../msbuild/tests/bin/Xamarin.iOS.Tasks.Tests.dll -xml=TestResults_Xamarin.iOS.Tasks.Tests.xml -labels $(TEST_FIXTURE) || touch .failed-stamp
$(SYSTEM_XIBUILD) -- $(TOP)/msbuild/Xamarin.MacDev.Tasks.sln
cd $(NUNIT_MSBUILD_DIR) && $(SYSTEM_XIBUILD) -t -- ../nunit-console.exe ../../../../msbuild/tests/bin/Xamarin.iOS.Tasks.Tests.dll -xml=TestResults_Xamarin.iOS.Tasks.Tests.xml -labels $(TEST_FIXTURE) || touch .failed-stamp
@[[ -z "$$BUILD_REPOSITORY" ]] || ( xsltproc $(TOP)/tests/HtmlTransform.xslt $(NUNIT_MSBUILD_DIR)/TestResults_Xamarin.iOS.Tasks.Tests.xml > $(TOP)/tests/index.html && echo "@MonkeyWrench: AddFile: $$PWD/index.html" )
@if test -e $(NUNIT_MSBUILD_DIR)/.failed-stamp; then rm $(NUNIT_MSBUILD_DIR)/.failed-stamp; exit 1; fi
test-install-sources:
$(SYSTEM_XBUILD) $(TOP)/tools/install-source/InstallSourcesTests/InstallSourcesTests.csproj
cd $(NUNIT_MSBUILD_DIR) && $(SYSTEM_MONO) ../nunit-console.exe ../../../../tools/install-source/InstallSourcesTests/bin/Release/InstallSourcesTests.dll -xml=TestResults_InstallSourcesTests.xml -labels $(TEST_FIXTURE) || touch .failed-stamp
$(SYSTEM_XIBUILD) -- $(TOP)/tools/install-source/InstallSourcesTests/InstallSourcesTests.csproj
cd $(NUNIT_MSBUILD_DIR) && $(SYSTEM_XIBUILD) -t -- ../nunit-console.exe ../../../../tools/install-source/InstallSourcesTests/bin/Release/InstallSourcesTests.dll -xml=TestResults_InstallSourcesTests.xml -labels $(TEST_FIXTURE) || touch .failed-stamp
@[[ -z "$$BUILD_REPOSITORY" ]] || ( xsltproc $(TOP)/tests/HtmlTransform.xslt $(NUNIT_MSBUILD_DIR)/TestResults_InstallSourcesTests.xml > $(TOP)/tests/index.html && echo "@MonkeyWrench: AddFile: $$PWD/index.html" )
@if test -e $(NUNIT_MSBUILD_DIR)/.failed-stamp; then rm $(NUNIT_MSBUILD_DIR)/.failed-stamp; exit 1; fi
@ -352,7 +354,7 @@ wrench-%:
wrench-jenkins: xharness/xharness.exe
$(Q) rm -f $@-failed.stamp
$(Q) ulimit -n 4096 && $(SYSTEM_MONO) --trace=E:all --debug $< $(XHARNESS_VERBOSITY) --jenkins --autoconf --rootdir $(CURDIR) --sdkroot $(XCODE_DEVELOPER_ROOT) --label run-all-tests,skip-ios-device-tests --markdown-summary=$(abspath $(CURDIR))/TestSummary.md $(TESTS_PERIODIC_COMMAND) || echo "$$?" > $@-failed.stamp
$(Q) ulimit -n 4096 && $(SYSTEM_MONO) --trace=E:all --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/$< $(XHARNESS_VERBOSITY) --jenkins --autoconf --rootdir $(CURDIR) --sdkroot $(XCODE_DEVELOPER_ROOT) --label run-all-tests,skip-ios-device-tests --markdown-summary=$(abspath $(CURDIR))/TestSummary.md $(TESTS_PERIODIC_COMMAND) || echo "$$?" > $@-failed.stamp
@echo "@MonkeyWrench: SetSummary: <br/>`cat $(abspath $(CURDIR))/TestSummary.md | awk 1 ORS='<br/>'`"
@echo "@MonkeyWrench: AddFile: $(abspath $(CURDIR))/TestSummary.md"
$(Q) if test -e $@-failed.stamp; then EC=`cat $@-failed.stamp`; rm -f $@-failed.stamp; exit $$EC; fi
@ -361,17 +363,17 @@ wrench-xtro:
@echo Not here anymore
jenkins: xharness/xharness.exe
$(Q) $(SYSTEM_MONO) --trace=E:all --debug $< $(XHARNESS_VERBOSITY) --jenkins --autoconf --rootdir $(CURDIR) --sdkroot $(XCODE_DEVELOPER_ROOT) --markdown-summary=$(abspath $(CURDIR))/TestSummary.md
$(Q) $(SYSTEM_MONO) --trace=E:all --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/$< $(XHARNESS_VERBOSITY) --jenkins --autoconf --rootdir $(CURDIR) --sdkroot $(XCODE_DEVELOPER_ROOT) --markdown-summary=$(abspath $(CURDIR))/TestSummary.md
# This will launch xharness' interactive test runner in the system's default browser
runner: xharness/xharness.exe
@echo "Running xharness in server mode. Press Ctrl-C to exit (or click Quit / press Q in the browser page)"
$(Q) $(SYSTEM_MONO) --debug $< $(XHARNESS_VERBOSITY) --jenkins:server --autoconf --rootdir $(CURDIR) --sdkroot $(XCODE_DEVELOPER_ROOT)
$(Q) $(SYSTEM_XIBUILD) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --jenkins:server --autoconf --rootdir $(CURDIR) --sdkroot $(XCODE_DEVELOPER_ROOT)
# This makefile target will run the device tests using the Xamarin.iOS version
# installed on the system.
vsts-device-tests: xharness/xharness.exe
$(Q) ulimit -n 4096 && $(SYSTEM_MONO) --debug $< $(XHARNESS_VERBOSITY) --jenkins --autoconf --rootdir $(CURDIR) --sdkroot $(XCODE_DEVELOPER_ROOT) --use-system:true --label=skip-mac-tests,skip-ios-simulator-tests,skip-ios-msbuild-tests,skip-system-permission-tests,run-ios-device-tests,run-bcl-tests,run-ios-extensions-tests --markdown-summary=$(CURDIR)/TestSummary.md $(TESTS_PERIODIC_COMMAND)
$(Q) ulimit -n 4096 && $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/$< $(XHARNESS_VERBOSITY) --jenkins --autoconf --rootdir $(CURDIR) --sdkroot $(XCODE_DEVELOPER_ROOT) --use-system:true --label=skip-mac-tests,skip-ios-simulator-tests,skip-ios-msbuild-tests,skip-system-permission-tests,run-ios-device-tests,run-bcl-tests,run-ios-extensions-tests --markdown-summary=$(CURDIR)/TestSummary.md $(TESTS_PERIODIC_COMMAND)
ifdef ENABLE_XAMARIN
wrench-launch-external wrench-report-external:

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

@ -72,5 +72,5 @@ run run-test run-tests: build/compat.app build/mobile-32.app build/mobile-64.app
build/GuiUnit.exe: $(shell find $(GUI_UNIT_PATH)/src/framework -name \*.cs -or -name \*.csproj)
@mkdir -p build
@$(SYSTEM_XBUILD) $(GUI_UNIT_PATH)/src/framework/GuiUnit_NET_4_5.csproj
@$(SYSTEM_XIBUILD) -- $(GUI_UNIT_PATH)/src/framework/GuiUnit_NET_4_5.csproj
@cp $(GUI_UNIT_PATH)/bin/net_4_5/GuiUnit.exe $@

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

@ -84,7 +84,7 @@ namespace Xamarin.Tests
output.Clear ();
output_lines = null;
var rv = ExecutionHelper.Execute (toolPath, string.Format (arguments, args), EnvironmentVariables, output, output, workingDirectory: WorkingDirectory);
var rv = ExecutionHelper.Execute ("xibuild", $"-t -- {toolPath} " + string.Format (arguments, args), EnvironmentVariables, output, output, workingDirectory: WorkingDirectory);
if ((rv != 0 || always_show_output) && output.Length > 0)
Console.WriteLine ("\t" + output.ToString ().Replace ("\n", "\n\t"));
@ -375,13 +375,13 @@ namespace Xamarin.Tests
public static string ToolPath {
get
{
return "/Library/Frameworks/Mono.framework/Commands/msbuild";
return "xibuild";
}
}
public static void Build (string project, string configuration = "Debug", string platform = "iPhoneSimulator", string verbosity = null, TimeSpan? timeout = null)
{
ExecutionHelper.Execute (ToolPath, string.Format ("/p:Configuration={0} /p:Platform={1} {2} \"{3}\"", configuration, platform, verbosity == null ? string.Empty : "/verbosity:" + verbosity, project), timeout: timeout);
ExecutionHelper.Execute (ToolPath, string.Format ("-- /p:Configuration={0} /p:Platform={1} {2} \"{3}\"", configuration, platform, verbosity == null ? string.Empty : "/verbosity:" + verbosity, project), timeout: timeout);
}
}

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

@ -227,7 +227,7 @@ namespace Xamarin.MMP.Tests
// In most cases we generate projects in tmp and this is not needed. But nuget and test projects can make that hard
public static void CleanUnifiedProject (string csprojTarget)
{
RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/msbuild", new StringBuilder (csprojTarget + " /t:clean"), "Clean");
RunAndAssert ("xibuild", new StringBuilder ("-- " + csprojTarget + " /t:clean"), "Clean");
}
public static string BuildProject (string csprojTarget, bool isUnified, bool shouldFail = false, bool release = false, string[] environment = null)
@ -265,9 +265,10 @@ namespace Xamarin.MMP.Tests
return csprojText + fileList;
};
if (isUnified)
return RunAndAssert ("/Library/Frameworks/Mono.framework/Commands/msbuild", buildArgs, "Compile", shouldFail, getBuildProjectErrorInfo, environment);
else
if (isUnified) {
buildArgs.Insert (0, " -- ");
return RunAndAssert ("xibuild", buildArgs, "Compile", shouldFail, getBuildProjectErrorInfo, environment);
} else
return RunAndAssert ("/Applications/Visual Studio.app/Contents/MacOS/vstool", buildArgs, "Compile", shouldFail, getBuildProjectErrorInfo, environment);
}
@ -573,7 +574,14 @@ namespace TestCase
public static void NugetRestore (string project)
{
var rv = ExecutionHelper.Execute ("nuget", $"restore {StringUtils.Quote (project)}", out var output);
string rootDirectory = FindRootDirectory ();
Environment.SetEnvironmentVariable ("TargetFrameworkFallbackSearchPaths", rootDirectory + "/Library/Frameworks/Mono.framework/External/xbuild-frameworks");
Environment.SetEnvironmentVariable ("MSBuildExtensionsPathFallbackPathsOverride", rootDirectory + "/Library/Frameworks/Mono.framework/External/xbuild");
Environment.SetEnvironmentVariable ("XAMMAC_FRAMEWORK_PATH", rootDirectory + "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current");
Environment.SetEnvironmentVariable ("XamarinMacFrameworkRoot", rootDirectory + "/Library/Frameworks/Xamarin.Mac.framework/Versions/Current");
var rv = ExecutionHelper.Execute ("xibuild", $"-- /restore {StringUtils.Quote (project)}", out var output);
if (rv != 0) {
Console.WriteLine ("nuget restore failed:");
Console.WriteLine (output);

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

@ -6,11 +6,11 @@ all-local:: run-unit-tests
build-unit-tests:
$(Q) $(SYSTEM_MONO) /Library/Frameworks//Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore $(TOP)/src/generator.sln
$(SYSTEM_MSBUILD) generator-tests.csproj $(XBUILD_VERBOSITY)
$(SYSTEM_XIBUILD) -- generator-tests.csproj $(XBUILD_VERBOSITY)
run-unit-tests: build-unit-tests
rm -f .failed-stamp
$(SYSTEM_MONO) --debug $(TOP)/packages/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe $(abspath $(TOP)/tests/generator/bin/Debug/generator-tests.dll) "--result=$(abspath $(CURDIR)/TestResult.xml);format=nunit2" $(TEST_FIXTURE) --labels=All || touch $(CURDIR)/.failed-stamp
$(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(TOP)/packages/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe $(abspath $(TOP)/tests/generator/bin/Debug/generator-tests.dll) "--result=$(abspath $(CURDIR)/TestResult.xml);format=nunit2" $(TEST_FIXTURE) --labels=All || touch $(CURDIR)/.failed-stamp
@# Create an html file and tell MonkeyWrench to upload it (if we're running there)
@[[ -z "$$BUILD_REPOSITORY" ]] || \
( xsltproc $(TOP)/tests/HtmlTransform.xslt TestResult.xml > index.html && \

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

@ -27,45 +27,45 @@ bin/SimpleClassStatic.a: bin bin/SimpleClass.i386.a bin/SimpleClass.x86_64.a
$(Q) lipo -create bin/SimpleClass.i386.a bin/SimpleClass.x86_64.a -output $@
bin/Mobile-dynamic/MobileBinding.dll: bin/SimpleClassDylib.dylib
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_dynamic.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_dynamic.csproj
bin/Mobile-dynamic-newstyle/MobileBinding.dll: bin/SimpleClassDylib.dylib
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_dynamic_newstyle.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_dynamic_newstyle.csproj
bin/Mobile-dynamic-spaces/Mobile\ Binding.dll: bin/SimpleClass\ Dylib.dylib
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_dynamic_spaces.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_dynamic_spaces.csproj
bin/Mobile-static/MobileBinding.dll: bin/SimpleClassStatic.a
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_static.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_static.csproj
bin/Mobile-static-newstyle/MobileBinding.dll: bin/SimpleClassStatic.a
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_static_newstyle.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_static_newstyle.csproj
bin/Mobile-framework/MobileBinding.dll:
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_framework.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileBinding/MobileBinding_framework.csproj
bin/MobileTest-static/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-static/MobileBinding.dll
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_static.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_static.csproj
bin/MobileTest-static-newstyle/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-static-newstyle/MobileBinding.dll
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_static_newstyle.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_static_newstyle.csproj
bin/MobileTest-withLinker/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-static/MobileBinding.dll
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_WithLinker.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_WithLinker.csproj
bin/MobileTest-dynamic/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-dynamic/MobileBinding.dll
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_dynamic.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_dynamic.csproj
bin/MobileTest-dynamic-newstyle/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-dynamic-newstyle/MobileBinding.dll
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_dynamic_newstyle.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_dynamic_newstyle.csproj
bin/MobileTest-dynamic-spaces/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-dynamic-spaces/Mobile\ Binding.dll
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_dynamic_spaces.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_dynamic_spaces.csproj
bin/MobileTest-framework/MobileTestApp.app/Contents/MacOS/MobileTestApp: bin/Mobile-framework/MobileBinding.dll
$(Q) $(SYSTEM_XBUILD) $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_framework.csproj
$(Q) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) MobileTestApp/MobileTestApp_framework.csproj

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

@ -29,7 +29,7 @@ endif
run: build
rm -f .failed-stamp
$(SYSTEM_MONO) --debug $(TOP)/packages/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe $(abspath $(TOP)/tests/mmptest/bin/Debug/mmptest.dll) "--result=$(abspath $(CURDIR)/TestResult.xml);format=nunit2" $(TEST_FIXTURE) --labels=All || touch $(CURDIR)/.failed-stamp
$(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(TOP)/packages/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe $(abspath $(TOP)/tests/mmptest/bin/Debug/mmptest.dll) "--result=$(abspath $(CURDIR)/TestResult.xml);format=nunit2" $(TEST_FIXTURE) --labels=All || touch $(CURDIR)/.failed-stamp
@# Create an html file and tell MonkeyWrench to upload it (if we're running there)
@[[ -z "$$BUILD_REPOSITORY" ]] || \
( xsltproc $(TOP)/tests/HtmlTransform.xslt TestResult.xml > index.html && \
@ -38,7 +38,7 @@ run: build
build:
$(Q) $(SYSTEM_MONO) /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore ../tests-mac.sln
$(SYSTEM_XBUILD) mmptest.csproj $(XBUILD_VERBOSITY)
$(SYSTEM_XIBUILD) -- mmptest.csproj $(XBUILD_VERBOSITY)
clean-local::
@rm -rf ./obj

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

@ -56,7 +56,7 @@ ALL_TESTS = \
all-local:: run
embedded-mono/bin system-mono/bin embedded-mono-profile/bin system-mono-profile/bin $(foreach test,$(TESTS_UNIFIED),$(test)/bin): dylib/libTest.dylib
DEVELOPER_DIR=$(XCODE94_DEVELOPER_ROOT) XAMMAC_FRAMEWORK_PATH=$(abspath $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)) $(SYSTEM_XBUILD) $(@D)/$(@D).csproj
DEVELOPER_DIR=$(XCODE94_DEVELOPER_ROOT) XAMMAC_FRAMEWORK_PATH=$(abspath $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)) $(SYSTEM_XIBUILD) -- $(@D)/$(@D).csproj
%/bin: dylib/libTest.dylib
DEVELOPER_DIR=$(XCODE94_DEVELOPER_ROOT) XAMMAC_FRAMEWORK_PATH=$(abspath $(MAC_DESTDIR)$(MAC_FRAMEWORK_CURRENT_DIR)) $(MDTOOL) build $*/$*.csproj

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

@ -21,7 +21,7 @@ all-local::
run-tests: test.config
rm -f .failed-stamp
$(SYSTEM_MONO) --debug $(TOP)/packages/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe $(abspath $(TOP)/tests/mtouch/bin/Debug/mtouch.dll) "--result=$(abspath $(CURDIR)/TestResult.xml);format=nunit2" $(TEST_FIXTURE) --labels=All || touch $(CURDIR)/.failed-stamp
$(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(TOP)/packages/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe $(abspath $(TOP)/tests/mtouch/bin/Debug/mtouch.dll) "--result=$(abspath $(CURDIR)/TestResult.xml);format=nunit2" $(TEST_FIXTURE) --labels=All || touch $(CURDIR)/.failed-stamp
@# Create an html file and tell MonkeyWrench to upload it (if we're running there)
@[[ -z "$$BUILD_REPOSITORY" ]] || \
( xsltproc $(TOP)/tests/HtmlTransform.xslt TestResult.xml > index.html && \
@ -30,7 +30,7 @@ run-tests: test.config
build:
$(Q) $(SYSTEM_MONO) /Library/Frameworks//Mono.framework/Versions/Current/lib/mono/nuget/NuGet.exe restore packages.config
$(SYSTEM_XBUILD) mtouch.csproj $(XBUILD_VERBOSITY)
$(SYSTEM_XIBUILD) -- mtouch.csproj $(XBUILD_VERBOSITY)
$(Q) rm -f .failed-stamp
test.config: $(TOP)/Make.config Makefile

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

@ -2760,8 +2760,9 @@ function toggleAll (show)
await RestoreNugetsAsync (log, resource);
using (var xbuild = new Process ()) {
xbuild.StartInfo.FileName = UseMSBuild ? "msbuild" : "msbuild";
xbuild.StartInfo.FileName = "xibuild";
var args = new StringBuilder ();
args.Append ("-- ");
args.Append ("/verbosity:diagnostic ");
if (SpecifyPlatform)
args.Append ($"/p:Platform={ProjectPlatform} ");
@ -2796,8 +2797,9 @@ function toggleAll (show)
{
// Don't require the desktop resource here, this shouldn't be that resource sensitive
using (var xbuild = new Process ()) {
xbuild.StartInfo.FileName = "msbuild";
xbuild.StartInfo.FileName = "xibuild";
var args = new StringBuilder ();
args.Append ("-- ");
args.Append ("/verbosity:diagnostic ");
if (project_platform != null)
args.Append ($"/p:Platform={project_platform} ");
@ -2872,8 +2874,9 @@ function toggleAll (show)
using (var proc = new Process ()) {
proc.StartInfo.WorkingDirectory = WorkingDirectory;
proc.StartInfo.FileName = "/Library/Frameworks/Mono.framework/Commands/mono";
proc.StartInfo.FileName = "xibuild";
var args = new StringBuilder ();
args.Append ("-t -- ");
args.Append (StringUtils.Quote (Path.GetFullPath (TestExecutable))).Append (' ');
args.Append (StringUtils.Quote (Path.GetFullPath (TestLibrary))).Append (' ');
if (IsNUnit3) {

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

@ -92,7 +92,7 @@ namespace xharness
var makefile = Path.Combine (harness.RootDirectory, "Makefile-mac.inc");
using (var writer = new StreamWriter (makefile, false, new UTF8Encoding (false))) {
writer.WriteLine (".stamp-configure-projects-mac: Makefile xharness/xharness.exe");
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --configure --autoconf --rootdir $(CURDIR)");
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --configure --autoconf --rootdir $(CURDIR)");
writer.WriteLine ("\t$(Q) touch $@");
writer.WriteLine ();
var nuget_restore_dependency = ".stamp-nuget-restore-mac";
@ -154,17 +154,17 @@ namespace xharness
string guiUnitDependency = ((MacUnifiedTarget)target).Mobile ? "$(GUI_UNIT_PATH)/bin/xammac_mobile/GuiUnit.exe" : "$(GUI_UNIT_PATH)/bin/net_4_5/GuiUnit.exe";
writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Build), "{0}", target.ProjectPath.Replace (" ", "\\ ") + " " + guiUnitDependency + " " + nuget_restore_dependency);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XIBUILD) -- \"/property:Configuration=$(CONFIG)\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ();
writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Clean), "");
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XIBUILD) -- \"/property:Configuration=$(CONFIG)\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ();
writer.WriteTarget (MakeMacUnifiedTargetName (target, MacTargetNameType.Exec), "");
if (target.IsNUnitProject) {
writer.WriteLine ("\t$(Q)rm -f $(CURDIR)/.{0}-failed.stamp", make_escaped_name);
writer.WriteLine ("\t$(SYSTEM_MONO) --debug $(TOP)/packages/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe \"{1}/bin/$(CONFIG)/mmptest.dll\" \"--result=$(abspath $(CURDIR)/{0}-TestResult.xml);format=nunit2\" $(TEST_FIXTURE) --labels=All || touch $(CURDIR)/.{0}-failed.stamp", make_escaped_name, Path.GetDirectoryName (target.ProjectPath));
writer.WriteLine ("\t$(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(TOP)/packages/NUnit.ConsoleRunner.3.5.0/tools/nunit3-console.exe \"{1}/bin/$(CONFIG)/mmptest.dll\" \"--result=$(abspath $(CURDIR)/{0}-TestResult.xml);format=nunit2\" $(TEST_FIXTURE) --labels=All || touch $(CURDIR)/.{0}-failed.stamp", make_escaped_name, Path.GetDirectoryName (target.ProjectPath));
writer.WriteLine ("\t$(Q)[[ -z \"$$BUILD_REPOSITORY\" ]] || ( xsltproc $(TOP)/tests/HtmlTransform.xslt {0}-TestResult.xml > {0}-index.html && echo \"@MonkeyWrench: AddFile: $$PWD/{0}-index.html\")", make_escaped_name);
writer.WriteLine ("\t$(Q)[[ ! -e .{0}-failed.stamp ]]", make_escaped_name);
} else if (target.IsBCLProject)
@ -285,7 +285,7 @@ namespace xharness
var makefile = Path.Combine (harness.RootDirectory, "Makefile.inc");
using (var writer = new StreamWriter (makefile, false, new UTF8Encoding (false))) {
writer.WriteLine (".stamp-configure-projects: Makefile xharness/xharness.exe");
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --configure --autoconf --rootdir $(CURDIR)");
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --configure --autoconf --rootdir $(CURDIR)");
writer.WriteLine ("\t$(Q) touch $@");
writer.WriteLine ();
@ -321,7 +321,7 @@ namespace xharness
writer.WriteLine ();
}
writer.WriteTarget ("build{0}-sim{3}-{1}", "{2}", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "), target.MakefileWhereSuffix);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XIBUILD) -- \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ();
// clean sim project target
@ -331,7 +331,7 @@ namespace xharness
writer.WriteLine ();
}
writer.WriteTarget ("clean{0}-sim{2}-{1}", string.Empty, make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "), target.MakefileWhereSuffix);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XIBUILD) -- \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhoneSimulator\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ();
// run sim project target
@ -379,19 +379,19 @@ namespace xharness
// exec sim project target
if (target.IsMultiArchitecture) {
writer.WriteTarget ("exec{0}-sim64-{1}", "$(UNIT_SERVER)", make_escaped_suffix, make_escaped_name);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-simulator-64 --sdkroot $(XCODE_DEVELOPER_ROOT) --logdirectory \"$(abspath $(CURDIR))/logs/$@\" --configuration $(CONFIG)", target.ProjectPath, target.Platform);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-simulator-64 --sdkroot $(XCODE_DEVELOPER_ROOT) --logdirectory \"$(abspath $(CURDIR))/logs/$@\" --configuration $(CONFIG)", target.ProjectPath, target.Platform);
writer.WriteLine ();
writer.WriteTarget ("exec{0}-sim32-{1}", "$(UNIT_SERVER)", make_escaped_suffix, make_escaped_name);
if (executeSim32) {
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-simulator-32 --sdkroot $(XCODE_DEVELOPER_ROOT) --logdirectory \"$(abspath $(CURDIR))/logs/$@\" --configuration $(CONFIG)", target.ProjectPath, target.Platform);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-simulator-32 --sdkroot $(XCODE_DEVELOPER_ROOT) --logdirectory \"$(abspath $(CURDIR))/logs/$@\" --configuration $(CONFIG)", target.ProjectPath, target.Platform);
} else {
writer.WriteLine ("\t$(Q) echo 'Execution of sim32 has been disabled.'");
}
writer.WriteLine ();
} else {
writer.WriteTarget ("exec{0}-sim{2}-{1}", "$(UNIT_SERVER)", make_escaped_suffix, make_escaped_name, target.MakefileWhereSuffix);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-simulator --sdkroot $(XCODE_DEVELOPER_ROOT) --logdirectory \"$(abspath $(CURDIR))/logs/$@\" --configuration $(CONFIG)", target.ProjectPath, target.Platform);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-simulator --sdkroot $(XCODE_DEVELOPER_ROOT) --logdirectory \"$(abspath $(CURDIR))/logs/$@\" --configuration $(CONFIG)", target.ProjectPath, target.Platform);
writer.WriteLine ();
}
@ -424,15 +424,15 @@ namespace xharness
writer.WriteLine ();
writer.WriteTarget ("build{0}-dev32-{1}", "{2} xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "));
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XIBUILD) -- \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ();
writer.WriteTarget ("build{0}-dev64-{1}", "{2} xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "));
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XIBUILD) -- \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ();
} else {
writer.WriteTarget ("build{0}-dev{3}-{1}", "{2} xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.ProjectPath.Replace (" ", "\\ "), target.MakefileWhereSuffix);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XIBUILD) -- \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /t:Build $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ();
}
@ -448,25 +448,25 @@ namespace xharness
writer.WriteLine ();
writer.WriteTarget ("clean{0}-dev32-{1}", string.Empty, make_escaped_suffix, make_escaped_name);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XIBUILD) -- \"/property:Configuration=$(CONFIG)32\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ();
writer.WriteTarget ("clean{0}-dev64-{1}", string.Empty, make_escaped_suffix, make_escaped_name);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XIBUILD) -- \"/property:Configuration=$(CONFIG)64\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ();
} else {
writer.WriteTarget ("clean{0}-dev{2}-{1}", string.Empty, make_escaped_suffix, make_escaped_name, target.MakefileWhereSuffix);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XBUILD) \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ("\t$(Q_XBUILD) $(SYSTEM_XIBUILD) -- \"/property:Configuration=$(CONFIG)\" \"/property:Platform=iPhone\" /t:Clean $(XBUILD_VERBOSITY) \"{0}\"", target.ProjectPath);
writer.WriteLine ();
}
// install dev project target
if (target.IsMultiArchitecture) {
writer.WriteTarget ("install{0}-dev32-{1}", "xharness/xharness.exe", make_escaped_suffix, make_escaped_name);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --install \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG)32", target.ProjectPath, target.Platform);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --install \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG)32", target.ProjectPath, target.Platform);
writer.WriteLine ();
writer.WriteTarget ("install{0}-dev64-{1}", "xharness/xharness.exe", make_escaped_suffix, make_escaped_name);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --install \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG)64", target.ProjectPath, target.Platform);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --install \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG)64", target.ProjectPath, target.Platform);
writer.WriteLine ();
} else {
if (target.IsBCLProject) {
@ -475,7 +475,7 @@ namespace xharness
writer.WriteLine ();
}
writer.WriteTarget ("install{0}-dev{2}-{1}", "xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.MakefileWhereSuffix);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --install \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG)", target.ProjectPath, target.Platform);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --install \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG)", target.ProjectPath, target.Platform);
writer.WriteLine ();
}
@ -545,7 +545,7 @@ namespace xharness
var target_name = string.Format ("exec{0}-dev{2}-{1}-{3}", make_escaped_suffix, make_escaped_name, suffix, chunk_name);
writer.WriteTarget (target_name, "xharness/xharness.exe");
writer.WriteLine ("\t@echo Executing subset: {0}-{1}", chunk [0], chunk [1]);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG){4} --logdirectory \"$(abspath $(CURDIR))/logs/$@\" --setenv:NUNIT_FILTER_START={2} --setenv:NUNIT_FILTER_END={3}", target.ProjectPath, target.Platform, chunk [0], chunk [1], suffix);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG){4} --logdirectory \"$(abspath $(CURDIR))/logs/$@\" --setenv:NUNIT_FILTER_START={2} --setenv:NUNIT_FILTER_END={3}", target.ProjectPath, target.Platform, chunk [0], chunk [1], suffix);
writer.WriteLine ();
writer.WriteTarget ("run{0}-dev{2}-{1}-{3}", "xharness/xharness.exe", make_escaped_suffix, make_escaped_name, suffix, chunk_name);
writer.WriteLine ("\t$(Q) $(MAKE) build{0}-dev{2}-{1}", make_escaped_suffix, make_escaped_name, suffix);
@ -560,15 +560,15 @@ namespace xharness
} else {
if (target.IsMultiArchitecture) {
writer.WriteTarget ("exec{0}-dev32-{1}", "xharness/xharness.exe", make_escaped_suffix, make_escaped_name);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG)32 --logdirectory \"$(abspath $(CURDIR))/logs/$@\"", target.ProjectPath, target.Platform);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG)32 --logdirectory \"$(abspath $(CURDIR))/logs/$@\"", target.ProjectPath, target.Platform);
writer.WriteLine ();
writer.WriteTarget ("exec{0}-dev64-{1}", "xharness/xharness.exe", make_escaped_suffix, make_escaped_name);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG)64 --logdirectory \"$(abspath $(CURDIR))/logs/$@\"", target.ProjectPath, target.Platform);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG)64 --logdirectory \"$(abspath $(CURDIR))/logs/$@\"", target.ProjectPath, target.Platform);
writer.WriteLine ();
} else {
writer.WriteTarget ("exec{0}-dev{2}-{1}", "xharness/xharness.exe", make_escaped_suffix, make_escaped_name, target.MakefileWhereSuffix);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG) --logdirectory \"$(abspath $(CURDIR))/logs/$@\"", target.ProjectPath, target.Platform);
writer.WriteLine ("\t$(Q) $(SYSTEM_MONO) --debug $(XIBUILD_EXE_PATH) -t -- $(CURDIR)/xharness/xharness.exe $(XHARNESS_VERBOSITY) --run \"{0}\" --target {1}-device --sdkroot $(XCODE_DEVELOPER_ROOT) --configuration $(CONFIG) --logdirectory \"$(abspath $(CURDIR))/logs/$@\"", target.ProjectPath, target.Platform);
}
}
writer.WriteLine ();

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

@ -16,7 +16,7 @@ clean-local::
bin/Debug/xtro-sharpie.exe xtro-report/bin/Debug/xtro-report.exe build:
$(Q) nuget restore xtro-sharpie.sln
$(Q_BUILD) $(SYSTEM_MSBUILD) $(XBUILD_VERBOSITY) xtro-sharpie.sln
$(Q_BUILD) $(SYSTEM_XIBUILD) -- $(XBUILD_VERBOSITY) xtro-sharpie.sln
XIOS ?= $(TOP)/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/lib/64bits/Xamarin.iOS.dll
XIOS_GL ?= $(TOP)/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/Xamarin.iOS/OpenTK-1.0.dll

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

@ -1,3 +1,3 @@
TOP=..
SUBDIRS=mmp mtouch install-source mlaunch
SUBDIRS=mmp mtouch install-source mlaunch xibuild
include $(TOP)/Make.config

232
tools/xibuild/Main.cs Normal file
Просмотреть файл

@ -0,0 +1,232 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Xml;
using Mono.Options;
namespace xibuild {
class MainClass {
public static int Main (string [] args)
{
bool runTool = false;
bool configGenerationOnly = false;
string baseConfigFile = null;
bool show_help = false;
OptionSet p = null;
p = new OptionSet () {
"xibuild: Run msbuild or a tool with a custom msbuild config file which adds fallback paths from $MSBuildExtensionsPathFallbackPathsOverride.",
String.Empty,
"Usage: xibuild [-c] [-t] [-m <base config file>] [-h] -- [path to managed tool] [arguments...]",
String.Empty,
"Default: Generate a temporary app.config file and run msbuild",
String.Empty,
"Options:",
{ "c", "Generate config file only", c => configGenerationOnly = true }, // merge
{ "t", "Path to the managed tool to run. If this and `-c` are not used, then this runs msbuild", t => runTool = true },
{ "m=", "< base config file >: Config file to merge with the one from msbuild.dll.confi", m => baseConfigFile = m },
{ "h|?|help", "Show this help message and exit.", v => show_help = true },
String.Empty,
"Note: Adds the path from the environment variable named",
"`$MSBuildExtensionsPathFallbackPathsOverride` to the list of fallback paths in the generated app.config",
String.Empty,
"Examples:",
String.Empty,
"Generate /path/to/foo.exe.config:",
"\txibuild -c /path/to/foo.exe",
"Run msbuild with a custom app.config and the arguments passed to msbuild:",
"\txibuild -- /v:diag /path/to/project.csproj",
"Run managed_tool.exe with the arguments, and a custom app.config:",
"\txibuild -t -- /path/to/managed_tool.exe args",
String.Empty,
"Add `-m /path/to/base.exe.config` to merge the generated app.config with base.exe.config ."
};
Console.WriteLine ($"Running xibuild with args: {String.Join (" ", args)}\n");
List<string> remaining = null;
try {
remaining = p.Parse (args);
} catch (OptionException oe) {
Console.WriteLine (oe.Message);
return -1;
}
if (show_help) {
p.WriteOptionDescriptions (Console.Out);
return 0;
}
if (configGenerationOnly && runTool) {
Console.WriteLine ("Use either -c or -t, but not both.\n");
p.WriteOptionDescriptions (Console.Out);
return -1;
}
if (!String.IsNullOrEmpty (baseConfigFile) && !File.Exists (baseConfigFile)) {
Console.WriteLine ($"Base config file {baseConfigFile} not found.");
return -1;
}
if (configGenerationOnly && remaining.Count == 0) {
Console.WriteLine ("Please specify the path to managed tool to generate an app.config file for it.");
return -1;
}
if (runTool && remaining.Count == 0) {
Console.WriteLine ("Please specify the path to managed tool to run.");
return -1;
}
bool runMSBuild = !runTool && !configGenerationOnly;
if (!runTool && !runMSBuild) {
GenerateAppConfig (remaining [0] + ".config", baseConfigFile);
return 0;
}
return RunTool (
toolPath: runMSBuild ? "msbuild" : remaining [0],
combinedArgs: BuildQuotedCommandLine (remaining, runMSBuild ? 0 : 1),
baseConfigFile: runMSBuild ? null : baseConfigFile);
string BuildQuotedCommandLine (List<string> a, int skip) => String.Join (" ", a.Skip (skip).Select (arg => $"\"{arg}\""));
}
static int RunTool (string toolPath, string combinedArgs, string baseConfigFile)
{
var tmpMSBuildExePathForConfig = Path.GetTempFileName ();
var configFilePath = tmpMSBuildExePathForConfig + ".config";
GenerateAppConfig (configFilePath, baseConfigFile);
// Required so that msbuild can read the correct config file
Environment.SetEnvironmentVariable ("MSBUILD_EXE_PATH", tmpMSBuildExePathForConfig, EnvironmentVariableTarget.Process);
var p = Process.Start (new ProcessStartInfo {
FileName = toolPath,
Arguments = combinedArgs,
UseShellExecute = false,
RedirectStandardInput = true,
});
p.WaitForExit ();
return p.ExitCode;
}
static void GenerateAppConfig (string targetConfigFile, string baseConfigFile)
{
bool IsMacOS = System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform (System.Runtime.InteropServices.OSPlatform.OSX);
//FIXME: Current? or from PATH?
string mono = IsMacOS ? "/Library/Frameworks/Mono.framework/Versions/Current/lib/mono" : "/usr/lib/mono";
string vsVersion = "15.0";
string MSBuildBin = Path.Combine (mono, "msbuild", vsVersion, "bin");
string MSBuildConfig = Path.Combine (MSBuildBin, "MSBuild.dll.config");
string MSBuildExtensionsPath = Path.Combine (mono, "xbuild");
string FrameworksDirectory = Path.Combine (mono, "xbuild-frameworks");
string MSBuildSdksPath = Path.Combine (MSBuildBin, "Sdks");
var dstXml = new XmlDocument ();
var dstConfigNode = dstXml.CreateNode (XmlNodeType.Element, "configuration", "");
dstXml.AppendChild (dstConfigNode);
if (!String.IsNullOrEmpty (baseConfigFile) && File.Exists (baseConfigFile)) {
var baseXml = new XmlDocument ();
baseXml.Load (baseConfigFile);
CopyConfigNode (baseXml, dstConfigNode);
}
// Copy over msbuild.dll.config
{
var msbuildXml = new XmlDocument ();
msbuildXml.Load (MSBuildConfig);
CopyConfigNode (msbuildXml, dstConfigNode);
}
var toolsets = dstXml.SelectSingleNode ("configuration/msbuildToolsets/toolset");
var SearchPathsOS = IsMacOS ? "osx" : "unix";
var projectImportSearchPaths = toolsets.SelectSingleNode ("projectImportSearchPaths");
var searchPaths = projectImportSearchPaths.SelectSingleNode ($"searchPaths[@os='{SearchPathsOS}']") as XmlElement;
//NOTE: on Linux, the searchPaths XML element does not exist, so we have to create it
if (searchPaths == null) {
searchPaths = dstXml.CreateElement ("searchPaths");
searchPaths.SetAttribute ("os", SearchPathsOS);
var property = dstXml.CreateElement ("property");
property.SetAttribute ("name", "MSBuildExtensionsPath");
property.SetAttribute ("value", "");
searchPaths.AppendChild (property);
property = dstXml.CreateElement ("property");
property.SetAttribute ("name", "MSBuildExtensionsPath32");
property.SetAttribute ("value", "");
searchPaths.AppendChild (property);
property = dstXml.CreateElement ("property");
property.SetAttribute ("name", "MSBuildExtensionsPath64");
property.SetAttribute ("value", "");
searchPaths.AppendChild (property);
projectImportSearchPaths.AppendChild (searchPaths);
}
string monoExternal = IsMacOS ? "/Library/Frameworks/Mono.framework/External/" : "/usr/lib/mono";
string [] ProjectImportSearchPaths = new [] { Environment.GetEnvironmentVariable ("MSBuildExtensionsPathFallbackPathsOverride"), Path.Combine (monoExternal, "xbuild") };
foreach (XmlNode property in searchPaths.SelectNodes ("property[starts-with(@name, 'MSBuildExtensionsPath')]/@value"))
property.Value = string.Join (";", ProjectImportSearchPaths);
SetToolsetProperty ("MSBuildToolsPath", MSBuildBin);
SetToolsetProperty ("MSBuildToolsPath32", MSBuildBin);
SetToolsetProperty ("MSBuildToolsPath64", MSBuildBin);
SetToolsetProperty ("MSBuildExtensionsPath", MSBuildExtensionsPath);
SetToolsetProperty ("MSBuildExtensionsPath32", MSBuildExtensionsPath);
SetToolsetProperty ("MSBuildExtensionsPath64", MSBuildExtensionsPath);
SetToolsetProperty ("RoslynTargetsPath", Path.Combine (MSBuildBin, "Roslyn"));
SetToolsetProperty ("TargetFrameworkRootPath", FrameworksDirectory + Path.DirectorySeparatorChar); //NOTE: Must include trailing \
SetToolsetProperty ("MSBuildSdksPath", MSBuildSdksPath);
dstXml.Save (targetConfigFile);
return;
void CopyConfigNode (XmlDocument src, XmlNode dstNode)
{
var srcConfigNode = src.SelectSingleNode ("configuration");
if (srcConfigNode != null && srcConfigNode.HasChildNodes) {
srcConfigNode.ChildNodes.OfType<XmlNode> ().ToList ()
.ForEach (node => dstNode.AppendChild (dstXml.ImportNode (node, deep: true)));
}
}
/// <summary>
/// If the value exists, sets value attribute, else creates the element
/// </summary>
void SetToolsetProperty (string name, string value)
{
if (string.IsNullOrEmpty (value))
return;
var valueAttribute = toolsets.SelectSingleNode ($"property[@name='{name}']/@value");
if (valueAttribute != null) {
valueAttribute.Value = value;
} else {
var property = toolsets.OwnerDocument.CreateElement ("property");
property.SetAttribute ("name", name);
property.SetAttribute ("value", value);
toolsets.PrependChild (property);
}
}
}
}
}

15
tools/xibuild/Makefile Normal file
Просмотреть файл

@ -0,0 +1,15 @@
TOP = ../..
include $(TOP)/Make.config
CONFIGURATION=Release
SRC_FILES=Main.cs \
../../external/mono/mcs/class/Mono.Options/Mono.Options/Options.cs
all: bin/$(CONFIGURATION)/xibuild.exe
bin/$(CONFIGURATION)/xibuild.exe: xibuild.csproj $(SRC_FILES)
$(SYSTEM_MSBUILD) xibuild.csproj
clean-local::
$(SYSTEM_MSBUILD) /t:Clean xibuild.csproj

5
tools/xibuild/xibuild Executable file
Просмотреть файл

@ -0,0 +1,5 @@
#!/bin/sh
ABSOLUTE_PATH=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)/`basename "${BASH_SOURCE[0]}"`
TOOL_DIR=`dirname $ABSOLUTE_PATH`
mono $TOOL_DIR/bin/Debug/xibuild.exe "$@"

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

@ -0,0 +1,41 @@
<?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)' == '' ">x86</Platform>
<ProjectGuid>{F045D371-40B4-487F-B2A3-3CF318A77CA4}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>xibuild</RootNamespace>
<AssemblyName>xibuild</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ExternalConsole>true</ExternalConsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="../../external/mono/mcs/class/Mono.Options/Mono.Options/Options.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>