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

Cherry-pick fixes from master #841

Merged
merged 3 commits into from
Sep 11, 2017
Merged

Conversation

jonpryor
Copy link
Member

@jonpryor jonpryor commented Sep 11, 2017

dotnet#749)

Context: https://bugzilla.xamarin.com/show_bug.cgi?id=58580

Unable to locate assemblies when running projects when
`$(Configuration)`=Release and `$(Optimize)` != True.

Commit edabe8a reworked the build logic so that `$(Optimize)`
controls the deployment of the debug or release runtimes.

	Input Property:                                                      || Output Property
	DebugSymbols    | DebugType  | EmbedAssembliesIntoApk   | Optimize   || AndroidIncludeDebugSymbols
	================+============+==========================+============++===========================
	True              *any*        True                       True          False      (Release runtime)
	True              *any*        True                       False         True       (Debug runtime)
	True              *any*        False                      True          True       (Debug runtime)
	True              *any*        False                      False         True       (Debug runtime)
	True              *empty*      True                       True          True       (Debug runtime)
	True              *empty*      True                       False         True       (Debug runtime)
	True              *empty*      False                      True          True       (Debug runtime)
	True              *empty*      False                      False         True       (Debug runtime)
	False             -            -                          -             False      (Release runtime)
	*empty*           *any*        *empty*                    False         True       (Debug runtime)

In this scenario, `$(DebugSymols)` and `$(EmbedAssembliesIntoApk)` are both empty.
As a result `$(EmbedAssembliesIntoApk)` gets a default value of 'False'.
But because `$(DebugSymols)` is empty we fall through the MSBuild case statement
and end up with `$(AndroidIncludeDebugSymbols)` = `True`. Which is NOT what we want in this case.
So if `$(EmbedAssembliesIntoApk)` we should always default `$(AndroidIncludeDebugSymbols)`
to false.

In addition there was a weird issue with the way we install debug apps.
If the app is using the Shared Runtime the deployment process sends a
broadcast to the Shared Runtime app which returns the external storage
directory. This tends to be something like

	/mnt/shell/emulated/0/

So when we deploy our debug assemblies we do so to a directory like

	/mnt/shell/emulated/0/Android/data/$(PackageName)/files/.__override__

This works as expected. Now if we try to debug an app without using the Shared
Runtime it will work as expected.. unless the Shared Runtime was not installed.
In this case the broadcast fails and we fall back to getting the external storage
using

	adb shell echo -b ${EXTERNAL_STORAGE}

This returns

	/mnt/shell/emulated/legacy

so we end up deploying the debug assemblies to

	/mnt/shell/emulated/legacy/Android/data/$(PackageName)/files/.__override__

So all is well and good. However problems start in our runtime and the
MonoPackageManager. We use

	android.os.Environment.getExternalStorageDirectory ();

to get the external storage directory. In this case it ALWAYS returns

	/mnt/shell/emulated/0/

So if we are debugging without the Shared Runtime being installed, we will
NEVER find the fast deployed assebmies. So the app will crash. The fix in
this case is to check both directories when we are running the debug
runtime.
…otnet#764)

Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=58865

Consider a project with an `App.csproj` and a referenced
`Lib.csproj`. Not all changes to C# sources within `Lib.csproj`
should require rebuilding and redeploying the `.apk` when
Fast Deployment is enabled; only those that result in changes
to Java Callable Wrappers should require rebuilding and
redeploying the `.apk`.

Unfortunately, that wasn't the case: *any* change to `Lib.csproj`
would result rebuilding and redeploying the `.apk`, because
`AndroidManifest.xml` was constantly being modified, which would
cause the `_CompileToDalvikWithDx` target to be invoked, resulting
in a `.apk` rebuild + redeploy.

The item

	<meta-data android:name="android.support.VERSION" android:value="25.4.0" />

was constantly being duplicated in the manifest. As a result it
was always newer and was triggering a change of build targets.

So we need to double check we are NOT adding 100% duplicate
values to the manifest.
…tnet#757)

Context: https://bugzilla.xamarin.com/show_bug.cgi?id=58682

Seeing a new seemingly DesignTimeBuild-related build failure when 
invoking the `Rebuild` msbuild target.

The `$(DesignTimeBuild)` value was empty when running under mac.
This cuases the error

	error MSB4044: The "GetAdditionalResourcesFromAssemblies" task was not given a value for the required parameter "DesignTimeBuild".

So we need to make sure that the value is set before we get to
`GetAdditionalResourcesFromAssemblies`. The reason we got the error
is before we used `$(DesignTimeBuild)` only in conditionals. However
when moving to use it as a property of a task it cannot be empty.
So we need to make sure we call `_SetupDesignTimeBuildForBuild`
early in the build process.
@Aguilex Aguilex merged commit 0df2d9e into dotnet:d15-4 Sep 11, 2017
@alanmcgovern
Copy link

alanmcgovern commented Sep 12, 2017

This patchset contains a known API break! It breaks the Android Designer and Forms Previewer.

@Aguilex
Copy link
Contributor

Aguilex commented Sep 12, 2017

oops... @alanmcgovern is there a bug we can track?

@alanmcgovern
Copy link

jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request May 20, 2021
Fixes: dotnet/java-interop#835
Fixes: dotnet#5921

Context: dotnet#5894

Changes: http://github.com/xamarin/Java.Interop/compare/12e670a8560f69581d3a3adf0a9d91e8ce8c9afa...2573dc8c84fd4eb68e75bcae73912c26f4942356

  * dotnet/java-interop@2573dc8c: [Java.Interop.Tools.*] IMetadataResolver not TypeDefinitionCache (dotnet#842)
  * dotnet/java-interop@412e974b: Revert "[generator] Disable [SupportedOSPlatform] until .NET 5/6. (dotnet#781)" (dotnet#841)
  * dotnet/java-interop@23baf0bc: [Java.Interop] Fix NRT warnings introduced by targeting 'net6.0' (dotnet#840)
  * dotnet/java-interop@131c1496: [generator] Fix NRE from return type not consistently set (dotnet#834)
  * dotnet/java-interop@100fffc1: [generator] Ensure "global::" is prepended to generic return casts. (dotnet#838)
  * dotnet/java-interop@9b89e90e: [generator] Ignore types without names (dotnet#837)
  * dotnet/java-interop@0e01fb5d: [Java.Interop.Tools.JavaSource] Merge @return block values (dotnet#836)
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request May 20, 2021
Fixes: dotnet/java-interop#835
Fixes: dotnet#5921

Context: dotnet#5894

Changes: http://github.com/xamarin/Java.Interop/compare/12e670a8560f69581d3a3adf0a9d91e8ce8c9afa...2573dc8c84fd4eb68e75bcae73912c26f4942356

  * dotnet/java-interop@2573dc8c: [Java.Interop.Tools.*] IMetadataResolver not TypeDefinitionCache (dotnet#842)
  * dotnet/java-interop@412e974b: Revert "[generator] Disable [SupportedOSPlatform] until .NET 5/6. (dotnet#781)" (dotnet#841)
  * dotnet/java-interop@23baf0bc: [Java.Interop] Fix NRT warnings introduced by targeting 'net6.0' (dotnet#840)
  * dotnet/java-interop@131c1496: [generator] Fix NRE from return type not consistently set (dotnet#834)
  * dotnet/java-interop@100fffc1: [generator] Ensure "global::" is prepended to generic return casts. (dotnet#838)
  * dotnet/java-interop@9b89e90e: [generator] Ignore types without names (dotnet#837)
  * dotnet/java-interop@0e01fb5d: [Java.Interop.Tools.JavaSource] Merge @return block values (dotnet#836)
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request May 21, 2021
Fixes: dotnet/java-interop#835
Fixes: dotnet#5921

Context: dotnet#5894

Changes: http://github.com/xamarin/Java.Interop/compare/12e670a8560f69581d3a3adf0a9d91e8ce8c9afa...a5ed8919fb2ec894cb8144e51ae7c29b4811ee2a

  * dotnet/java-interop@a5ed8919: [Java.Interop.Tools.Cecil] Fix the xamarin-android build
  * dotnet/java-interop@2573dc8c: [Java.Interop.Tools.*] IMetadataResolver not TypeDefinitionCache (dotnet#842)
  * dotnet/java-interop@412e974b: Revert "[generator] Disable [SupportedOSPlatform] until .NET 5/6. (dotnet#781)" (dotnet#841)
  * dotnet/java-interop@23baf0bc: [Java.Interop] Fix NRT warnings introduced by targeting 'net6.0' (dotnet#840)
  * dotnet/java-interop@131c1496: [generator] Fix NRE from return type not consistently set (dotnet#834)
  * dotnet/java-interop@100fffc1: [generator] Ensure "global::" is prepended to generic return casts. (dotnet#838)
  * dotnet/java-interop@9b89e90e: [generator] Ignore types without names (dotnet#837)
  * dotnet/java-interop@0e01fb5d: [Java.Interop.Tools.JavaSource] Merge @return block values (dotnet#836)
jonpryor added a commit that referenced this pull request May 23, 2021
Fixes: dotnet/java-interop#835
Fixes: #5921

Context: #5894

Changes: http://github.com/xamarin/Java.Interop/compare/12e670a8560f69581d3a3adf0a9d91e8ce8c9afa...a5ed8919fb2ec894cb8144e51ae7c29b4811ee2a

  * dotnet/java-interop@a5ed8919: [Java.Interop.Tools.Cecil] Fix the xamarin-android build
  * dotnet/java-interop@2573dc8c: [Java.Interop.Tools.*] IMetadataResolver not TypeDefinitionCache (#842)
  * dotnet/java-interop@412e974b: Revert "[generator] Disable [SupportedOSPlatform] until .NET 5/6. (#781)" (#841)
  * dotnet/java-interop@23baf0bc: [Java.Interop] Fix NRT warnings introduced by targeting 'net6.0' (#840)
  * dotnet/java-interop@131c1496: [generator] Fix NRE from return type not consistently set (#834)
  * dotnet/java-interop@100fffc1: [generator] Ensure "global::" is prepended to generic return casts. (#838)
  * dotnet/java-interop@9b89e90e: [generator] Ignore types without names (#837)
  * dotnet/java-interop@0e01fb5d: [Java.Interop.Tools.JavaSource] Merge @return block values (#836)
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants