Skip to content

Commit 9837928

Browse files
committed
[dotnet] Update/fix support for using a custom .NET runtime.
1 parent d299019 commit 9837928

File tree

5 files changed

+26
-23
lines changed

5 files changed

+26
-23
lines changed

Make.config

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,18 @@ ALL_DOTNET_PLATFORMS=iOS macOS tvOS MacCatalyst
336336
# Set this to 1 if the Microsoft.NETCore.App.Ref dependency in eng/Version.Details.xml does *not* specify a CoherentParentDependency on Microsoft.Dotnet.Sdk.Internal.
337337
TRACKING_DOTNET_RUNTIME_SEPARATELY=
338338

339+
# If you build dotnet/runtime locally, "*-dev" is the version the built artifacts will use (and which we must reference)
340+
CUSTOM_DOTNET_VERSION:=$(subst net,,$(DOTNET_TFM)).0-dev
341+
339342
-include $(TOP)/dotnet.config
340343
$(TOP)/dotnet.config: $(TOP)/eng/Version.Details.props $(TOP)/Build.props
341344
$(Q) rm -f [email protected]
342345
$(Q) grep '<MicrosoftNETSdkPackageVersion>' $(TOP)/eng/Version.Details.props | sed -e 's/<*\/*MicrosoftNETSdkPackageVersion>//g' -e 's/[ \t]*/DOTNET_VERSION=/' >> [email protected]
346+
ifdef CUSTOM_DOTNET
347+
$(Q) echo "BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION=$(CUSTOM_DOTNET_VERSION)" >> [email protected]
348+
else
343349
$(Q) grep '<MicrosoftNETCoreAppRefPackageVersion>' $(TOP)/eng/Version.Details.props | sed -e 's/<*\/*MicrosoftNETCoreAppRefPackageVersion>//g' -e 's/[ \t]*/BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION=/' >> [email protected]
350+
endif
344351
$(Q) $(foreach platform,$(ALL_DOTNET_PLATFORMS),grep '<Microsoft$(platform)SdkPackageVersion>' $(TOP)/eng/Version.Details.props | sed -e 's/<*\/*Microsoft$(platform)SdkPackageVersion>//g' -e 's/[ \t]*/NET8_$(shell echo $(platform) | tr '[:lower:]' '[:upper:]')_NUGET_VERSION_NO_METADATA=/' >> [email protected] &&) true
345352
$(Q) grep '<MicrosoftDotNetArcadeSdkPackageVersion>' $(TOP)/eng/Version.Details.props | sed -e 's/<*\/*MicrosoftDotNetArcadeSdkPackageVersion>//g' -e 's/[ \t]*/ARCADE_VERSION=/' >> [email protected]
346353
$(Q) mv [email protected] $@
@@ -365,14 +372,6 @@ DOTNET_DESTDIR ?= $(TOP)/_build
365372
DOTNET_NUPKG_DIR ?= $(DOTNET_DESTDIR)/nupkgs
366373
DOTNET_PKG_DIR ?= $(DOTNET_DESTDIR)/pkgs
367374

368-
# Configuration for .NET 6.
369-
# We're using preview versions, and there will probably be many of them, so install locally (into builds/downloads) if there's no system version to
370-
# avoid consuming a lot of disk space (since they're never automatically deleted). The system-dependencies.sh script will install locally as long
371-
# as there's a TARBALL url.
372-
373-
# If you build dotnet/runtime locally, "*-dev" is the version the built artifacts will use (and which we must reference)
374-
CUSTOM_DOTNET_VERSION=6.0.0-dev
375-
376375
ifdef CUSTOM_DOTNET
377376
DOTNET_BCL_VERSION=$(CUSTOM_DOTNET_VERSION)
378377
export CUSTOM_DOTNET_VERSION

builds/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ dotnet-install.sh: Makefile
6868

6969
ifdef CUSTOM_DOTNET
7070
DOWNLOAD_DOTNET_VERSION=$(CUSTOM_DOTNET_VERSION)
71+
ALL_NUGET_FEEDS:=$(shell grep '^[[:space:]]*<add.*value="https.*' $(TOP)/NuGet.config | sed -e 's/.*value="//' -e 's/".*//')
72+
CUSTOM_DOTNET_NUGET_FEED=\
73+
--source $(DOTNET_RUNTIME_PATH)/artifacts/packages/Debug/Shipping \
74+
$(foreach feed,$(ALL_NUGET_FEEDS), --source $(feed))
7175
else
7276
ifneq ($(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION),)
7377
DOWNLOAD_DOTNET_VERSION=$(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION)
@@ -88,6 +92,7 @@ package-download/all-package-references.csproj: $(GIT_DIRECTORY)/HEAD $(GIT_DIRE
8892
/p:PackageRuntimeIdentifiersCoreCLR="$(DOTNET_CORECLR_RUNTIME_IDENTIFIERS)" \
8993
/p:CustomDotNetVersion="$(DOWNLOAD_DOTNET_VERSION)" \
9094
/p:TrackingDotNetRuntimeSeparately="$(TRACKING_DOTNET_RUNTIME_SEPARATELY)" \
95+
$(CUSTOM_DOTNET_NUGET_FEED) \
9196
/bl \
9297
$(DOTNET_BUILD_VERBOSITY)
9398
$(Q) touch $@

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Usage: configure [options]
2525
--enable-xamarin
2626
--disable-xamarin Enable/disable additional Xamarin-specific parts of the build.
2727
28-
--custom-dotnet=[artifacts] Use a locally built version of dotnet/runtime. See docs/CORECLR.md for detailed instructions about how to build dotnet/runtime from source.
28+
--custom-dotnet=[dotnet/runtime] Use a locally built version of dotnet/runtime. Pass the path to an already build checkout of dotnet/runtime. See docs/CORECLR.md for detailed instructions about how to build dotnet/runtime from source.
2929
3030
--ignore-unknown-params alters the default behavior to not return an non-zero exit code when an unknown parameter is provided.
3131
EOL

docs/CORECLR.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,36 @@
55
1. Clone dotnet/runtime somewhere:
66

77
```shell
8-
cd ~/work
8+
cd ~/work/dotnet
99
git clone [email protected]:dotnet/runtime
1010
# Checkout any specific branch you want to test
1111
```
1212

13-
2. Configure xamarin-macios to use the cloned dotnet/runtime:
13+
2. Configure dotnet/macios to use the cloned dotnet/runtime:
1414

1515
```shell
16-
cd ~/work/xamarin-macios
16+
cd ~/work/dotnet/macios
1717
make git-clean-all # Must start from a clean state when switching between downloaded and custom built dotnet/runtime.
18-
./configure --custom-dotnet=$HOME/work/runtime
18+
./configure --custom-dotnet=$HOME/work/dotnet/runtime
1919
```
2020

2121
3. Build dotnet/runtime using our script that builds everything we need:
2222

2323
```shell
24-
cd ~/work/xamarin-macios/dotnet
24+
cd ~/work/dotnet/macios/dotnet
2525
./build-custom-runtime.sh
2626
```
2727

28-
4. Finally build xamarin-macios:
28+
4. Finally build dotnet/macios:
2929

3030
```shell
31-
cd ~/work/xamarin-macios
31+
cd ~/work/dotnet/macios
3232
make all -j8
3333
make install -j8
3434
```
3535

3636
### Caveats
3737

38-
You must clean your xamarin-macios working copy every time you switch between
38+
You must clean your dotnet/macios working copy every time you switch between
3939
using a locally built dotnet/runtime and a downloaded version. Not all parts
4040
of the build will pick up any configure changes for an incremental rebuild.

dotnet/build-custom-runtime.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ COLOR_RED=$(tput setaf 1 2>/dev/null)
77
COLOR_CLEAR=$(tput sgr0 2>/dev/null)
88

99
if test -z "$TOP"; then
10-
echo "${COLOR_RED}Could not find the top-level xamarin-macios directory.${COLOR_CLEAR}"
10+
echo "${COLOR_RED}Could not find the top-level dotnet/macios directory.${COLOR_CLEAR}"
1111
exit 1
1212
fi
1313

@@ -29,8 +29,7 @@ fi
2929

3030
cd "$DOTNET_RUNTIME_PATH"
3131

32-
# use 'arch -x86_64' because the build doesn't work on Apple Silicon with ARM64.
33-
use_installed_dotnet_cli=false arch -x86_64 ./build.sh clr+libs+host+packs+mono -configuration release -arch arm64 -cross /p:UseCrossGen2=false
34-
use_installed_dotnet_cli=false arch -x86_64 ./build.sh libs+host+packs+mono -configuration release -arch arm64 -cross /p:UseCrossGen2=false
35-
use_installed_dotnet_cli=false arch -x86_64 ./build.sh clr+libs+host+packs+mono -configuration release -arch x86_64 -cross /p:UseCrossGen2=false
36-
use_installed_dotnet_cli=false arch -x86_64 ./build.sh libs+host+packs+mono -configuration release -arch x86_64 -cross /p:UseCrossGen2=false
32+
use_installed_dotnet_cli=false ./build.sh clr+libs+host+packs+mono -configuration release -arch arm64 -cross /p:UseCrossGen2=false
33+
use_installed_dotnet_cli=false ./build.sh libs+host+packs+mono -configuration release -arch arm64 -cross /p:UseCrossGen2=false
34+
use_installed_dotnet_cli=false ./build.sh clr+libs+host+packs+mono -configuration release -arch x86_64 -cross /p:UseCrossGen2=false
35+
use_installed_dotnet_cli=false ./build.sh libs+host+packs+mono -configuration release -arch x86_64 -cross /p:UseCrossGen2=false

0 commit comments

Comments
 (0)