Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build bgen and the product assemblies using/referencing netcore3.1. #8070

Merged
merged 29 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
0500cd8
[src] Create bgen subdirectory and move the bgen script there.
rolfbjarne Feb 25, 2020
eef4ea7
[builds] Download the netcore 3.1 assemblies to use as reference asse…
rolfbjarne Mar 5, 2020
5135ce2
[bgen] Build bgen as a .netcoreapp 3.1.
rolfbjarne Feb 27, 2020
d242066
Add .NET 5 target frameworks.
rolfbjarne Feb 27, 2020
d659a86
[bgen] Don't try to load assemblies we've already loaded.
rolfbjarne Feb 27, 2020
72626bd
[src] Hide API usage that doesn't compile (but which we'll have to re…
rolfbjarne Feb 27, 2020
11fb1fd
[src] Adjust to .NET 5 API.
rolfbjarne Feb 27, 2020
4648db4
[src] Build platform assemblies referencing the .NET5 BCL.
rolfbjarne Feb 27, 2020
9b65dd5
[bgen] Don't yield the old-style location for product assemblies when…
rolfbjarne Mar 5, 2020
342e60c
[bgen] Don't fix references when in .NET mode.
rolfbjarne Mar 5, 2020
36db0dd
[bgen] .NET 5 has System.Drawing.dll, no need to skip it.
rolfbjarne Mar 5, 2020
2fa6989
[bgen] Intercept IKVM's assembly resolution to find assemblies oursel…
rolfbjarne Mar 5, 2020
7a1a8bb
[bgen] Add netcore version of the generator tests.
rolfbjarne Mar 6, 2020
1fc2f8e
[xharness] Add support for running the generator tests in .NET mode.
rolfbjarne Mar 9, 2020
0c10206
[System.Net.Http] Add issue about CFNetworkHandler .NET todo.
rolfbjarne Mar 10, 2020
398989a
[Compression] Obsolete [Begin|End][Read|Write] in .NET.
rolfbjarne Mar 10, 2020
7bef994
Revert whitespace change.
rolfbjarne Mar 10, 2020
d7d9bae
Use full path to the 'dotnet' executable.
rolfbjarne Mar 10, 2020
5c323ce
Merge remote-tracking branch 'origin/master' into dotnet-bgen
rolfbjarne Mar 10, 2020
187a5d7
[bgen] Don't handle resources quite yet in the .NET version of bgen.
rolfbjarne Mar 10, 2020
7108f59
Merge remote-tracking branch 'origin/master' into dotnet-bgen
rolfbjarne Mar 10, 2020
2f2c8c3
[src] Reduce the list of referenced netcore assemblies.
rolfbjarne Mar 11, 2020
1acba86
[Compression] Copy the TaskToApm implementation to provide a backward…
rolfbjarne Mar 11, 2020
53b54fa
[src] Define NET[_TODO] instead of DOTNET[_TODO].
rolfbjarne Mar 11, 2020
dac68f3
Merge remote-tracking branch 'origin/master' into dotnet-bgen
rolfbjarne Mar 11, 2020
067c88e
[xharness] Fix merge problem.
rolfbjarne Mar 11, 2020
f56fe80
Bump system mono to fix a csc compilation problem.
rolfbjarne Mar 12, 2020
5dda97a
[xharness] Unset a few environment variables when running .NET tests.
rolfbjarne Mar 12, 2020
800d63b
Merge remote-tracking branch 'origin/master' into dotnet-bgen
rolfbjarne Mar 12, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Make.config
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,9 @@ endif

DOTNET_VERSION=3.1.100
DOTNET_URL=https://download.visualstudio.microsoft.com/download/pr/787e81f1-f0da-4e3b-a989-8a199132ed8c/61a8dba81fbf2b3d533562d7b96443ec/dotnet-sdk-3.1.100-osx-x64.pkg
DOTNET_BCL_REF_URL=https://www.nuget.org/api/v2/package/Microsoft.NETCore.App.Ref/3.1.0
DOTNET_BCL_REF_NAME=microsoft.netcore.app.ref.3.1.0.nupkg
DOTNET_BCL_DIR:=$(abspath $(TOP)/builds/downloads/$(basename $(DOTNET_BCL_REF_NAME)))/ref/netcoreapp3.1

.SUFFIXES:
MAKEFLAGS += --no-builtin-rules
24 changes: 23 additions & 1 deletion builds/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ download-mono: downloads/$(basename $(MONO_IOS_FILENAME)) downloads/$(basename $

downloads/$(basename $(MONO_IOS_FILENAME)): MONO_URL=$(MONO_IOS_URL)
downloads/$(basename $(MONO_MAC_FILENAME)): MONO_URL=$(MONO_MAC_URL)
downloads/$(DOTNET_BCL_REF_NAME): MONO_URL=$(DOTNET_BCL_REF_URL)

include $(TOP)/mk/colors.mk

DOWNLOADS = \
downloads/$(MONO_IOS_FILENAME) \
downloads/$(MONO_MAC_FILENAME) \
downloads/$(DOTNET_BCL_REF_NAME) \

# This target downloads the mono archives, there's one for Xamarin.iOS and one for Xamarin.Mac.
# If doing many clean builds, it's possible to copy the downloaded zip file to ~/Library/Caches/xamarin-macios
# to avoid having to download it every time. The zip files have to be copied manually, otherwise
# we'd end up filling up a lot of hard drives around the world.
downloads/$(MONO_IOS_FILENAME) downloads/$(MONO_MAC_FILENAME):
$(DOWNLOADS):
$(Q) mkdir -p downloads
$(Q) echo "Downloading $(MONO_URL)..."
$(Q) if test -f ~/Library/Caches/xamarin-macios/$(notdir $@); then \
Expand All @@ -49,9 +55,25 @@ downloads/%: downloads/%.7z
$(Q) mv [email protected] $@
$(Q) echo "Unzipped $*."

downloads/%: downloads/%.nupkg
$(Q) echo "Unzipping $*..."
$(Q) rm -Rf [email protected]
$(Q) unzip -d [email protected] $<
$(Q) find [email protected] -exec touch {} +
$(Q) mv [email protected] $@
$(Q) echo "Unzipped $*."

.stamp-download-mono: download-mono $(TOP)/Make.config $(TOP)/mk/mono.mk
$(Q) touch $@

DOTNET_DOWNLOADS = \
downloads/$(basename $(DOTNET_BCL_REF_NAME)) \

dotnet: $(DOTNET_DOWNLOADS)
ifdef ENABLE_DOTNET
all-local:: $(DOTNET_DOWNLOADS)
endif

clean-local::
$(Q) rm -Rf downloads .stamp-download-mono

Expand Down
3 changes: 3 additions & 0 deletions mk/quiet.mk
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Q_XBUILD=$(if $(V),,@echo "XBUILD $(@F)";)
Q_TT= $(if $(V),,@echo "TT $(@F)";)
Q_BUILD=$(if $(V),,@echo "BUILD $(@F)";)

Q_DOTNET_BUILD=$(if $(V),,@echo "CSC [dotnet] $(@F)";)
Q_DOTNET_GEN =$(if $(V),,@echo "GEN [dotnet] $(@F)";)

Q_PROF_MCS = $(if $(V),,@echo "MCS [$(1)] $(@F)";)
Q_PROF_CSC = $(if $(V),,@echo "CSC [$(1)] $(@F)";)
Q_PROF_GEN = $(if $(V),,@echo "GEN [$(1)] $(@F)";)
Expand Down
2 changes: 1 addition & 1 deletion src/CFNetwork/Content.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal Content (WebResponseStream stream)
this.responseStream = stream;
}

#if MONOMAC && XAMCORE_2_0
#if (MONOMAC && XAMCORE_2_0) && !DOTNET
internal
#endif
protected override bool TryComputeLength (out long length)
Expand Down
2 changes: 1 addition & 1 deletion src/CFNetwork/MessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public WorkerThread WorkerThread {
CFHTTPAuthentication auth;

#region implemented abstract members of HttpMessageHandler
#if MONOMAC && XAMCORE_2_0
#if (MONOMAC && XAMCORE_2_0) && !DOTNET
internal
#endif
protected override async Task<HttpResponseMessage> SendAsync (HttpRequestMessage request,
Expand Down
11 changes: 11 additions & 0 deletions src/Compression/Compression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,19 @@ private static void ThrowCannotWriteToDeflateStreamException()
throw new InvalidOperationException ("Writing to the compression stream is not supported.");
}

#if !DOTNET_TODO
// DOTNET_TODO: TaskToApm is internal API in mscorlib, so we can't use it.
// Although I'm not sure if we even need to override these methods,
// the base class implementation works (but synchronously),
// and the documentation recommends using ReadAsync instead.
// If we decide to implement this, we could just copy the TaskToApm implementation:
// https://github.com/microsoft/referencesource/blob/a7bd3242bd7732dec4aebb21fbc0f6de61c2545e/mscorlib/system/threading/Tasks/TaskToApm.cs
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState) =>
TaskToApm.Begin(ReadAsync (buffer, offset, count, CancellationToken.None), asyncCallback, asyncState);

public override int EndRead (IAsyncResult asyncResult) =>
TaskToApm.End<int> (asyncResult);
#endif // !DOTNET_TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, this was a similar implementation to what it was done back in the day in the compression implementations of mono for zips. The APIs is not very used. If the base class implementation works (sync) is not a big issues since they should be using the Task version. I think it might be a good opportunity to get this out as outdated code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is actually problematic. Sorry I didn't notice your comment and started new thread below.


public override Task<int> ReadAsync (byte[] array, int offset, int count, CancellationToken cancellationToken)
{
Expand Down Expand Up @@ -547,10 +555,13 @@ protected override void Dispose (bool disposing)
}
}

#if !DOTNET_TODO
// DOTNET_TODO: See comment about TaskToApm elsewhere in this file.
public override IAsyncResult BeginWrite (byte[] array, int offset, int count, AsyncCallback asyncCallback, object asyncState) =>
TaskToApm.Begin(WriteAsync (array, offset, count, CancellationToken.None), asyncCallback, asyncState);

public override void EndWrite (IAsyncResult asyncResult) => TaskToApm.End (asyncResult);
#endif // !DOTNET_TODO
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same, I think it is safe to remove since we do not change the API. is less efficient but users should have moved (if we do have any of them in this API).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the base implementation works then let's add [Obsolete] to point customers into the best direction and call base (for compatibility)


public override Task WriteAsync (byte[] array, int offset, int count, CancellationToken cancellationToken)
{
Expand Down
7 changes: 5 additions & 2 deletions src/Foundation/NSUrlSessionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ async Task<NSUrlRequest> CreateRequest (HttpRequestMessage request)
return nsrequest;
}

#if SYSTEM_NET_HTTP || MONOMAC
#if (SYSTEM_NET_HTTP || MONOMAC) && !DOTNET
internal
#endif
protected override async Task<HttpResponseMessage> SendAsync (HttpRequestMessage request, CancellationToken cancellationToken)
Expand Down Expand Up @@ -935,7 +935,10 @@ protected override Task SerializeToStreamAsync (Stream stream, TransportContext
return content.CopyToAsync (stream, bufferSize, cancellationToken);
}

protected internal override bool TryComputeLength (out long length)
#if !DOTNET
internal
#endif
protected override bool TryComputeLength (out long length)
{
if (!content.CanSeek) {
length = 0;
Expand Down
Loading