-
Notifications
You must be signed in to change notification settings - Fork 531
/
Makefile
167 lines (129 loc) · 5.05 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
-include bin/configuration.mk
V ?= 0
prefix = /usr/local
CONFIGURATION ?= Debug
RUNTIME := $(shell which mono64 2> /dev/null && echo mono64 || echo mono) --debug=casts
SOLUTION = Xamarin.Android.sln
TEST_TARGETS = build-tools/scripts/RunTests.targets
API_LEVEL ?=
PREPARE_NET_FX = net8.0
PREPARE_ARGS =
PREPARE_PROJECT = build-tools/xaprepare/xaprepare/xaprepare.csproj
PREPARE_MSBUILD_FLAGS = $(PREPARE_MSBUILD_ARGS) $(MSBUILD_ARGS)
PREPARE_SCENARIO =
PREPARE_CI_PR ?= 0
PREPARE_CI ?= 0
PREPARE_AUTOPROVISION ?= 0
_PREPARE_CI_MODE_PR_ARGS = --no-emoji --run-mode=CI
_PREPARE_CI_MODE_ARGS = $(_PREPARE_CI_MODE_PR_ARGS) -a
_PREPARE_ARGS =
all:
$(call DOTNET_BINLOG,all) $(MSBUILD_FLAGS) $(SOLUTION)
$(call DOTNET_BINLOG,setup-workload) -t:ConfigureLocalWorkload build-tools/create-packs/Microsoft.Android.Sdk.proj
ifeq ($(OS_NAME),)
export OS_NAME := $(shell uname)
endif
ifeq ($(OS_ARCH),)
export OS_ARCH := $(shell uname -m)
endif
export NO_SUDO ?= false
ifneq ($(NO_SUDO),false)
_PREPARE_ARGS += --auto-provisioning-uses-sudo=false
endif
ifneq ($(V),0)
MONO_OPTIONS += --debug
NUGET_VERBOSITY = -Verbosity Detailed
_PREPARE_ARGS += -v:d
endif
ifneq ($(PREPARE_CI_PR),0)
_PREPARE_ARGS += $(_PREPARE_CI_MODE_PR_ARGS)
endif
ifneq ($(PREPARE_CI),0)
_PREPARE_ARGS += $(_PREPARE_CI_MODE_ARGS)
endif
ifneq ($(PREPARE_AUTOPROVISION),0)
_PREPARE_ARGS += --auto-provision=yes --auto-provision-uses-sudo=yes
endif
ifneq ($(PREPARE_SCENARIO),)
_PREPARE_ARGS += -s:"$(PREPARE_SCENARIO)"
endif
ifeq ($(XA_FORCE_COMPONENT_REFRESH),true)
_PREPARE_ARGS += -refresh
endif
_PREPARE_ARGS += $(PREPARE_ARGS)
include build-tools/scripts/msbuild.mk
ifeq ($(USE_MSBUILD),1)
_SLN_BUILD = $(MSBUILD)
endif # $(USE_MSBUILD) == 1
ifneq ($(API_LEVEL),)
MSBUILD_FLAGS += /p:AndroidApiLevel=$(API_LEVEL) /p:AndroidFrameworkVersion=$(word $(API_LEVEL), $(ALL_FRAMEWORKS)) /p:AndroidPlatformId=$(word $(a), $(ALL_PLATFORM_IDS))
endif
pack-dotnet::
$(call DOTNET_BINLOG,pack-dotnet) $(MSBUILD_FLAGS) -m:1 $(SOLUTION) -t:PackDotNet
topdir := $(shell pwd)
include build-tools/scripts/BuildEverything.mk
# Must be after BuildEverything.mk - it uses variables defined there
include build-tools/scripts/Packaging.mk
run-all-tests:
@echo "PRINTING MONO VERSION"
mono --version
_r=0 ; \
$(call MSBUILD_BINLOG,run-all-tests,,Test) $(TEST_TARGETS) /t:RunAllTests || _r=$$? ; \
exit $$_r
clean:
$(call DOTNET_BINLOG,clean) -t:Clean $(SOLUTION) -m:1
distclean:
# It may fail if we're cleaning a half-built tree, no harm done if we ignore it
-$(MAKE) clean
git clean -xdff
git submodule foreach git clean -xdff
run-nunit-tests:
ifeq ($(SKIP_NUNIT_TESTS),)
$(call MSBUILD_BINLOG,run-nunit-tests,,Test) $(TEST_TARGETS) /t:RunNUnitTests
endif # $(SKIP_NUNIT_TESTS) == ''
run-ji-tests:
$(call MSBUILD_BINLOG,run-ji-tests,,Test) $(TEST_TARGETS) /t:RunJavaInteropTests
ifneq ($(PACKAGES),)
APK_TESTS_PROP = /p:ApkTests='"$(PACKAGES)"'
endif
list-nunit-tests:
$(MSBUILD) $(MSBUILD_FLAGS) $(TEST_TARGETS) /t:ListNUnitTests
include build-tools/scripts/runtime-helpers.mk
.PHONY: prepare
prepare:
$(call SYSTEM_DOTNET_BINLOG,prepare-run,run) $(PREPARE_MSBUILD_FLAGS) --project "$(PREPARE_PROJECT)" --framework $(PREPARE_NET_FX) -- $(_PREPARE_ARGS)
$(call SYSTEM_DOTNET_BINLOG,prepare-bootstrap) Xamarin.Android.BootstrapTasks.sln
$(call DOTNET_BINLOG,prepare-java.interop) $(SOLUTION) -t:PrepareJavaInterop
.PHONY: prepare-help
prepare-help:
$(call SYSTEM_DOTNET_BINLOG,prepare-help,run) --project "$(PREPARE_PROJECT)" --framework $(PREPARE_NET_FX) -- -h
.PHONY: shutdown-compiler-server
shutdown-compiler-server:
# Ensure the VBCSCompiler.exe process isn't running during the mono update
pgrep -lfi VBCSCompiler.exe 2>/dev/null || true
@pid=`pgrep -lfi VBCSCompiler.exe 2>/dev/null | awk '{ print $$1 }'` ; \
echo "VBCSCompiler process ID (if running): $$pid" ;\
if [[ -n "$$pid" ]]; then \
echo "Terminating the VBCSCompiler '$$pid' server process prior to updating mono" ; \
exitCode=0 ;\
kill -HUP $$pid 2>/dev/null || exitCode=$$? ;\
if [[ $$exitCode -eq 0 ]]; then \
sleep 2 ;\
pgrep -lfi VBCSCompiler.exe 2>/dev/null&&echo "ERROR: VBCSCompiler server still exists" || echo "Verified that the VBCSCompiler server process no longer exists" ;\
else \
echo "ERROR: Kill command failed with exit code $$exitCode" ;\
fi \
fi
.PHONY: prepare-update-mono
prepare-update-mono: shutdown-compiler-server
$(call SYSTEM_DOTNET_BINLOG,prepare-update-mono,run) --project "$(PREPARE_PROJECT)" --framework $(PREPARE_NET_FX) \
-- -s:UpdateMono $(_PREPARE_ARGS)
prepare-external-git-dependencies:
$(call SYSTEM_DOTNET_BINLOG,prepare-external-git-dependencies,run) --project "$(PREPARE_PROJECT)" --framework $(PREPARE_NET_FX) \
-- -s:PrepareExternalGitDependencies $(_PREPARE_ARGS)
APK_SIZES_REFERENCE_DIR=tests/apk-sizes-reference
update-apk-sizes-reference:
-mkdir -p $(APK_SIZES_REFERENCE_DIR)
cp -v *values-$(CONFIGURATION).csv $(APK_SIZES_REFERENCE_DIR)/
update-api-docs:
$(call DOTNET_BINLOG,update-api-docs) -t:UpdateExternalDocumentation src/Mono.Android/Mono.Android.csproj