Skip to content

Commit 0aebe90

Browse files
authored
[sdks] Create archive targets for pre-building on CI (mono#10882)
* [sdks] Remove redundant --enable-cxx * [sdks] Shorten `-m32`/`-m64` parameters detection for runtimes * [sdks] Build BCL profiles without configure flags * [sdks] Add BclTemplate to build BCL profiles This is to avoid building all the profiles in a single `sdks/out/bcl` directory which will be shared between android, ios and wasm. * [sdks] Create archive targets for pre-building on CI * [sdks] Use archive-{android,ios,wasm} on CI * [sdks] Run archive-llvm-llvm{,win}{32,64} on CI
1 parent 9182bcc commit 0aebe90

File tree

13 files changed

+235
-165
lines changed

13 files changed

+235
-165
lines changed

runtime/Makefile.am

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
tmpinst = _tmpinst
23

34
noinst_SCRIPTS = mono-wrapper monodis-wrapper
@@ -81,34 +82,49 @@ endif
8182

8283
test_profiles = $(filter-out binary_reference_assemblies monodroid_tools,$(build_profiles))
8384

84-
if BUILD_MCS
85-
8685
MAKE_FLAGS=$(if $(V),,--no-print-directory -s)
8786

8887
# The write check is to foil 'make distcheck'
89-
all-local: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
88+
all-mcs: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
9089
if test -w $(mcs_topdir); then :; else chmod -R +w $(mcs_topdir); fi
9190
cd $(mcs_topdir) && $(MAKE) $(MAKE_FLAGS) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' CC='$(CC)' all-profiles
9291

93-
# override automake
94-
install: install-exec install-data
92+
install-mcs: install-mcs-exec install-mcs-data
9593

9694
# override automake
97-
install-exec: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
95+
install-mcs-exec: $(SUPPORT_FILES) $(TEST_SUPPORT_FILES)
9896
cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) install-profiles
9997

10098
# override automake
101-
install-data:
99+
install-mcs-data:
102100
@:
103101

104102
# override automake
105-
uninstall:
103+
uninstall-mcs:
106104
cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' RUNTIME_HAS_CONSISTENT_GACDIR=yes prefix=$(prefix) uninstall-profiles
107105

108-
clean-local:
106+
clean-mcs:
109107
cd $(mcs_topdir) && $(MAKE) NO_DIR_CHECK=1 PROFILES='$(build_profiles)' clean-profiles
110108
-rm -fr $(etctmp) $(tmpinst)
111109

110+
if BUILD_MCS
111+
112+
all-local: all-mcs
113+
114+
# override automake
115+
install: install-mcs
116+
117+
# override automake
118+
install-exec: install-mcs-exec
119+
120+
# override automake
121+
install-data: install-mcs-data
122+
123+
# override automake
124+
uninstall: uninstall-mcs
125+
126+
clean-local: clean-mcs
127+
112128
endif BUILD_MCS
113129

114130
TEST_SUPPORT_FILES = $(tmpinst)/bin/mono $(tmpinst)/bin/ilasm $(tmpinst)/bin/csc $(tmpinst)/bin/mcs $(tmpinst)/bin/al

scripts/ci/run-jenkins.sh

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,23 @@ then
9494
wget -qO- https://download.mono-project.com/test/new-certs.tgz| tar zx -C ~/.config/.mono/
9595
fi
9696

97+
if [[ ${CI_TAGS} == *'sdks-llvm'* ]]; then
98+
${TESTCMD} --label=archive --timeout=120m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds archive-llvm36-llvm32 archive-llvm-llvm{,win}{32,64} NINJA=
99+
exit 0
100+
fi
101+
97102
if [[ ${CI_TAGS} == *'product-sdks-ios'* ]];
98103
then
99104
echo "DISABLE_ANDROID=1" > sdks/Make.config
100105
echo "DISABLE_WASM=1" >> sdks/Make.config
106+
echo "DISABLE_DESKTOP=1" >> sdks/Make.config
101107
if [[ ${CI_TAGS} == *'cxx'* ]]; then
102108
echo "ENABLE_CXX=1" >> sdks/Make.config
103109
fi
104110
export device_test_suites="Mono.Runtime.Tests System.Core"
105111

106-
${TESTCMD} --label=provision-llvm --timeout=60m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds provision-llvm36-llvm32 provision-llvm-llvm64
112+
${TESTCMD} --label=archive --timeout=180m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds archive-ios NINJA=
107113

108-
${TESTCMD} --label=build-sim-runtimes --timeout=60m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds package-ios-{sim64,sim32,simtv,simwatch}
109-
${TESTCMD} --label=build-dev-runtimes --timeout=60m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds package-ios-{target64,target32,targettv,targetwatch}
110-
${TESTCMD} --label=build-cross-compilers --timeout=60m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds package-ios-{cross64,cross32,cross32-64,crosswatch}
111-
112-
${TESTCMD} --label=bcl --timeout=60m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds package-bcl
113114
${TESTCMD} --label=build-tests --timeout=10m --fatal make -C sdks/ios compile-tests
114115
${TESTCMD} --label=run-sim --timeout=20m make -C sdks/ios run-ios-sim-all
115116
${TESTCMD} --label=build-ios-dev --timeout=60m make -C sdks/ios build-ios-dev-all
@@ -128,28 +129,25 @@ if [[ ${CI_TAGS} == *'product-sdks-ios'* ]];
128129
if [[ ${CI_TAGS} == *'run-device-tests'* ]]; then
129130
for suite in ${device_test_suites}; do ${TESTCMD} --label=run-ios-dev-interp-mixed-${suite} --timeout=10m make -C sdks/ios run-ios-dev-${suite}; done
130131
fi
131-
${TESTCMD} --label=package --timeout=60m tar cvzf mono-product-sdk-$GIT_COMMIT.tar.gz -C sdks/out/ bcl llvm-llvm64 llvm36-llvm32 ios-cross32-release ios-cross64-release
132132
exit 0
133133
fi
134134

135135
if [[ ${CI_TAGS} == *'product-sdks-android'* ]];
136136
then
137-
echo "IGNORE_PROVISION_ANDROID=1" > sdks/Make.config
138-
echo "IGNORE_PROVISION_MXE=1" >> sdks/Make.config
139-
echo "IGNORE_PROVISION_LLVM=1" >> sdks/Make.config
137+
echo "DISABLE_IOS=1" > sdks/Make.config
138+
echo "DISABLE_WASM=1" >> sdks/Make.config
139+
echo "DISABLE_DESKTOP=1" >> sdks/Make.config
140140
echo "DISABLE_CCACHE=1" >> sdks/Make.config
141141
if [[ ${CI_TAGS} == *'cxx'* ]]; then
142142
echo "ENABLE_CXX=1" >> sdks/Make.config
143143
fi
144+
144145
# For some very strange reasons, `make -C sdks/android accept-android-license` get stuck when invoked through ${TESTCMD}
145146
# but doesn't get stuck when called via the shell, so let's just call it here now.
146147
${TESTCMD} --label=provision-android --timeout=120m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds provision-android && make -C sdks/android accept-android-license
147-
if [[ ${CI_TAGS} == *'provision-mxe'* ]]; then
148-
${TESTCMD} --label=provision-mxe --timeout=240m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds provision-mxe
149-
fi
150-
${TESTCMD} --label=provision-llvm --timeout=240m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds provision-llvm-llvm{,win}{32,64}
151-
${TESTCMD} --label=runtimes --timeout=120m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds package-android-{armeabi-v7a,arm64-v8a,x86,x86_64} package-android-host-{Darwin,mxe-Win64} package-android-cross-{arm,arm64,x86,x86_64}{,-win}
152-
${TESTCMD} --label=package --timeout=60m --fatal make -C sdks/android package
148+
${TESTCMD} --label=provision-mxe --timeout=240m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds provision-mxe
149+
${TESTCMD} --label=archive --timeout=180m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds archive-android NINJA= IGNORE_PROVISION_ANDROID=1 IGNORE_PROVISION_MXE=1
150+
153151
${TESTCMD} --label=mini --timeout=60m make -C sdks/android check-mini
154152
${TESTCMD} --label=corlib --timeout=60m make -C sdks/android check-corlib
155153
${TESTCMD} --label=System --timeout=60m make -C sdks/android check-System
@@ -181,8 +179,9 @@ if [[ ${CI_TAGS} == *'webassembly'* ]];
181179
if [[ ${CI_TAGS} == *'cxx'* ]]; then
182180
echo "ENABLE_CXX=1" >> sdks/Make.config
183181
fi
184-
${TESTCMD} --label=runtimes --timeout=60m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds package-wasm-runtime package-wasm-cross
185-
${TESTCMD} --label=bcl --timeout=60m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds package-bcl
182+
183+
${TESTCMD} --label=archive --timeout=180m --fatal make -j ${CI_CPU_COUNT} -C sdks/builds archive-wasm NINJA=
184+
186185
${TESTCMD} --label=wasm-build --timeout=60m --fatal make -j ${CI_CPU_COUNT} -C sdks/wasm build
187186
${TESTCMD} --label=ch-mini-test --timeout=60m make -C sdks/wasm run-ch-mini
188187
${TESTCMD} --label=v8-mini-test --timeout=60m make -C sdks/wasm run-v8-mini

sdks/builds/Makefile

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CCACHE:=$(if $(DISABLE_CCACHE),,$(shell which ccache))
1111
NINJA:=$(shell which ninja)
1212

1313
UNAME=$(shell uname)
14+
1415
ifneq ($(UNAME),Darwin)
1516
# iOS requires Xcode to be available, and Xcode is only available on macOS
1617
DISABLE_IOS=1
@@ -41,7 +42,20 @@ $(TOP)/configure: $(TOP)/configure.ac $(TOP)/autogen.sh
4142

4243
TARGETS=
4344

45+
ifndef DISABLE_ANDROID
46+
android_TARGETS=
47+
endif
48+
49+
ifndef DISABLE_IOS
50+
ios_TARGETS=
51+
endif
52+
53+
ifndef DISABLE_WASM
54+
wasm_TARGETS=
55+
endif
56+
4457
include runtime.mk
58+
include bcl.mk
4559

4660
## MXE targets
4761
ifeq ($(and $(DISABLE_ANDROID),$(DISABLE_WASM_CROSS)),)
@@ -52,11 +66,6 @@ endif
5266
## LLVM targets
5367
include llvm.mk
5468

55-
## BCL targets
56-
ifndef DISABLE_BCL
57-
include bcl.mk
58-
endif
59-
6069
## Android targets
6170
ifndef DISABLE_ANDROID
6271
include android.mk
@@ -78,6 +87,32 @@ ifndef DISABLE_WASM
7887
include wasm.mk
7988
endif
8089

90+
## Archive targets
91+
92+
##
93+
# Parameters:
94+
# $(1): target (android, ios, wasm)
95+
define ArchiveTemplate
96+
_$(1)_HASH = $$(shell git -C $$(TOP) rev-parse HEAD)
97+
_$(1)_PACKAGE = $(1)-$$(CONFIGURATION)-$$(_$(1)_HASH)-$$(UNAME).tar.gz
98+
99+
.PHONY: archive-$(1)
100+
archive-$(1): $$(foreach target,$$(filter $(1)-%,$$(patsubst %-$$(CONFIGURATION),%,$$($(1)_TARGETS))),package-$$(target))
101+
tar -cvzf $$(TOP)/$$(_$(1)_PACKAGE) -C $$(TOP)/sdks/out $$(sort $$(foreach target,$$($(1)_TARGETS),$$(or $$(wildcard $$(target)-$$(CONFIGURATION)),$$(target))))
102+
endef
103+
104+
ifndef DISABLE_ANDROID
105+
$(eval $(call ArchiveTemplate,android))
106+
endif
107+
108+
ifndef DISABLE_IOS
109+
$(eval $(call ArchiveTemplate,ios))
110+
endif
111+
112+
ifndef DISABLE_WASM
113+
$(eval $(call ArchiveTemplate,wasm))
114+
endif
115+
81116
## Generic targets
82117
.PHONY: $(foreach target,$(TARGETS),toolchain-$(target))
83118
$(foreach target,$(TARGETS),toolchain-$(target)): toolchain-%: .stamp-%-toolchain

sdks/builds/android.mk

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ provision-android-$(3)-$(1): $$(ANDROID_TOOLCHAIN_DIR)/$(3)$$(if $(2),/$(2))/.st
2929
.PHONY: provision-android
3030
provision-android: provision-android-$(3)-$(1)
3131

32-
.PHONY: provision
33-
provision: provision-android-$(3)-$(1)
34-
3532
endef
3633

3734
AndroidNDKProvisioningTemplate=$(call AndroidProvisioningTemplate,$(1),,ndk,$(ANDROID_URI))
@@ -141,7 +138,6 @@ _android-$(1)_LDFLAGS= \
141138
-L$$(ANDROID_TOOLCHAIN_DIR)/ndk/platforms/android-$$(ANDROID_SDK_VERSION_$(1))/arch-$(2)/usr/lib
142139

143140
_android-$(1)_CONFIGURE_FLAGS= \
144-
$(if $(ENABLE_CXX),--enable-cxx) \
145141
--disable-boehm \
146142
--disable-executables \
147143
--disable-iconv \
@@ -165,6 +161,8 @@ _android-$(1)_CONFIGURE_FLAGS= \
165161

166162
$$(eval $$(call RuntimeTemplate,android-$(1),$(4)))
167163

164+
android_TARGETS += android-$(1)-$$(CONFIGURATION)
165+
168166
endef
169167

170168
## android-armeabi-v7a
@@ -204,18 +202,19 @@ _android-$(1)_LD=ld
204202
_android-$(1)_RANLIB=ranlib
205203
_android-$(1)_STRIP=strip
206204

205+
_android-$(1)_CFLAGS= \
206+
$$(if $$(filter $$(UNAME),Darwin),-mmacosx-version-min=10.9)
207+
207208
_android-$(1)_CONFIGURE_FLAGS= \
208-
$(if $(ENABLE_CXX),--enable-cxx) \
209209
--disable-boehm \
210210
--disable-iconv \
211211
--disable-mono-debugger \
212212
--disable-nls \
213+
--disable-mcs-build \
213214
--enable-dynamic-btls \
214215
--enable-maintainer-mode \
215216
--enable-monodroid \
216217
--with-mcs-docs=no \
217-
--with-monodroid \
218-
--with-profile4_x=no \
219218
--without-ikvm-native \
220219
--disable-crash-reporting
221220

@@ -224,11 +223,11 @@ _android-$(1)_CONFIGURE_FLAGS= \
224223

225224
$$(eval $$(call RuntimeTemplate,android-$(1)))
226225

226+
android_TARGETS += android-$(1)-$$(CONFIGURATION)
227+
227228
endef
228229

229-
android-host-Darwin_CFLAGS=-mmacosx-version-min=10.9
230-
$(eval $(call AndroidHostTemplate,host-Darwin))
231-
$(eval $(call AndroidHostTemplate,host-Linux))
230+
$(eval $(call AndroidHostTemplate,host-$(UNAME)))
232231

233232
##
234233
# Parameters
@@ -259,7 +258,6 @@ _android-$(1)_CXXFLAGS= \
259258
-DXAMARIN_PRODUCT_VERSION=0
260259

261260
_android-$(1)_CONFIGURE_FLAGS= \
262-
$(if $(ENABLE_CXX),--enable-cxx) \
263261
--disable-boehm \
264262
--disable-llvm \
265263
--disable-mcs-build \
@@ -276,12 +274,12 @@ _android-$(1)_CONFIGURE_FLAGS= \
276274

277275
$$(eval $$(call RuntimeTemplate,android-$(1),$(2)-w64-mingw32$$(if $$(filter $(UNAME),Darwin),.static)))
278276

277+
android_TARGETS += android-$(1)-$$(CONFIGURATION)
278+
279279
endef
280280

281-
ifneq ($(MXE_PREFIX),)
282281
$(eval $(call AndroidHostMxeTemplate,host-mxe-Win32,i686))
283282
$(eval $(call AndroidHostMxeTemplate,host-mxe-Win64,x86_64))
284-
endif
285283

286284
##
287285
# Parameters
@@ -315,7 +313,6 @@ _android-$(1)_CXXFLAGS= \
315313
-DXAMARIN_PRODUCT_VERSION=0
316314

317315
_android-$(1)_CONFIGURE_FLAGS= \
318-
$(if $(ENABLE_CXX),--enable-cxx) \
319316
--disable-boehm \
320317
--disable-mcs-build \
321318
--disable-nls \
@@ -325,6 +322,8 @@ _android-$(1)_CONFIGURE_FLAGS= \
325322

326323
$$(eval $$(call CrossRuntimeTemplate,android-$(1),$$(if $$(filter $$(UNAME),Darwin),$(2)-apple-darwin10,$$(if $$(filter $$(UNAME),Linux),$(2)-linux-gnu,$$(error "Unknown UNAME='$$(UNAME)'"))),$(3)-linux-android,$(4),$(5),$(6)))
327324

325+
android_TARGETS += android-$(1)-$$(CONFIGURATION) $(5)
326+
328327
endef
329328

330329
$(eval $(call AndroidCrossTemplate,cross-arm,i686,armv7,android-armeabi-v7a,llvm-llvm32,armv7-none-linux-androideabi))
@@ -374,7 +373,6 @@ _android-$(1)_LDFLAGS= \
374373
-static-libstdc++
375374

376375
_android-$(1)_CONFIGURE_FLAGS= \
377-
$(if $(ENABLE_CXX),--enable-cxx) \
378376
--disable-boehm \
379377
--disable-mcs-build \
380378
--disable-nls \
@@ -386,9 +384,25 @@ _android-$(1)_CONFIGURE_FLAGS= \
386384

387385
$$(eval $$(call CrossRuntimeTemplate,android-$(1),$(2)-w64-mingw32$$(if $$(filter $(UNAME),Darwin),.static),$(3)-linux-android,$(4),$(5),$(6)))
388386

387+
android_TARGETS += android-$(1)-$$(CONFIGURATION) $(5)
388+
389389
endef
390390

391391
$(eval $(call AndroidCrossMXETemplate,cross-arm-win,i686,armv7,android-armeabi-v7a,llvm-llvmwin32,armv7-none-linux-androideabi))
392392
$(eval $(call AndroidCrossMXETemplate,cross-arm64-win,x86_64,aarch64-v8a,android-arm64-v8a,llvm-llvmwin64,aarch64-v8a-linux-android))
393393
$(eval $(call AndroidCrossMXETemplate,cross-x86-win,i686,i686,android-x86,llvm-llvmwin32,i686-none-linux-android))
394394
$(eval $(call AndroidCrossMXETemplate,cross-x86_64-win,x86_64,x86_64,android-x86_64,llvm-llvmwin64,x86_64-none-linux-android))
395+
396+
##
397+
# Parameters
398+
# $(1): build profiles
399+
# $(2): test profile
400+
define AndroidBclTemplate
401+
402+
$$(eval $$(call BclTemplate,android,$(1),$(2)))
403+
404+
android_TARGETS += android-bcl
405+
406+
endef
407+
408+
$(eval $(call AndroidBclTemplate,monodroid monodroid_tools,monodroid))

0 commit comments

Comments
 (0)