-
Notifications
You must be signed in to change notification settings - Fork 564
[tests] fix failures related to AndroidSdkDirectory property #977
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Context in dotnet#910 When switching to `xabuild.exe`, two mistakes were made: - `xabuild.exe` shouldn’t set `AndroidSdkDirectory` or `AndroidNdkDirectory` - Xamarin.Android.Build.Tests should pass these values to xabuild This restores some of the code in `Builder.cs` removed in f9d15dd
|
@jonathanpeppers, |
dellis1972
approved these changes
Oct 25, 2017
jonathanpeppers
added a commit
to jonathanpeppers/xamarin-android
that referenced
this pull request
Oct 27, 2017
Context: https://github.com/xamarin/xamarin-android/blob/master/tools/scripts/xabuild#L105 `xabuild`, the shell script, has some logic to set MSBuild properties for `AndroidSdkDirectory` and `AndroidNdkDirectory`. The issue here is on Windows, `xabuild.exe` is not invoked from this shell script. So we need to replicate the logic in C# in `xabuild.exe`, but not break what was fixed in dotnet#977. Changes: - check for `ANDROID_SDK_PATH` or `ANDROID_NDK_PATH` environment variables - Run `Paths.targets` via a new MSBuild process, the same way as `xabuild`, the script - Set the `AndroidSdkDirectory` and `AndroidNdkDirectory` values in the config file if they are not blank - `AndroidSdkDirectory` and `AndroidNdkDirectory` can still be overridden by a user, because incoming values supersede what is found in the config file
jonpryor
pushed a commit
that referenced
this pull request
Oct 27, 2017
Context: https://github.com/xamarin/xamarin-android/blob/master/tools/scripts/xabuild#L105 `xabuild`, the shell script, has some logic to set MSBuild properties for `AndroidSdkDirectory` and `AndroidNdkDirectory`. The issue here is on Windows, `xabuild.exe` is not invoked from this shell script. So we need to replicate the logic in C# in `xabuild.exe`, but not break what was fixed in #977. Changes: * Check for `ANDROID_SDK_PATH` or `ANDROID_NDK_PATH` environment variables * Run `Paths.targets` via a new MSBuild process, the same way as `tools/scripts/xabuild` * Set the `AndroidSdkDirectory` and `AndroidNdkDirectory` properties in the config file if they are not blank * `AndroidSdkDirectory` and `AndroidNdkDirectory` can still be overridden by a user, because incoming values supersede what is found in the config file
Redth
pushed a commit
to Redth/xamarin-android
that referenced
this pull request
Oct 30, 2017
) The introduction of `xabuild` in commit f9d15dd omitted a design requirement: `xabuild` needs to be runnable on a machine which does *does not* have a xamarin-android build environment. The idea is that e.g. Windows developers could download a Jenkins-built `oss-xamarin.android*.zip` file, extract it, and run `bin\Debug\bin\xabuild.exe` to use the extract artifacts *without* requiring system-wide installation via `setup-windows.exe`. This not-very-well-stated requirement brought along two mistakes: 1. `xabuild.exe` should *not* set the `$(AndroidSdkDirectory)` and `$(AndroidNdkDirectory)` MSBuild properties. It *can't*; it could be executed on ~any machine, in particular one which hasn't built xamarin-android, so setting these properties to "build-tree" values doesn't make sense and will fail. 2. Even if (1) weren't the case, commit f9d15dd still allowed the `Xamarin.Android.Build.Tests` unit tests to use `xbuild` as the MSBuild engine, via the `tools/scripts/xabuild` script. This script *does not* always set `$(AndroidSdkDirectory)` or `$(AndroidNdkDirectory)`. As a result of (2), many unit tests *fail*: Error executing task ResolveSdks: System.InvalidOperationException: Could not determine Android SDK location. Please provide `androidSdkPath`. at Xamarin.Android.Tools.AndroidSdkInfo..ctor (System.Action`2[T1,T2] logger, System.String androidSdkPath, System.String androidNdkPath, System.String javaSdkPath) [0x0008e] in …/xamarin-android/external/xamarin-android-tools/src/Xamarin.Android.Tools.AndroidSdk/AndroidSdkInfo.cs:28 at Xamarin.Android.Tasks.MonoAndroidHelper.RefreshAndroidSdk (System.String sdkPath, System.String ndkPath, System.String javaPath) [0x00021] in …/xamarin-android/src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.cs:111 at Xamarin.Android.Tasks.ResolveSdks.RunTask () [0x001a0] in …/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs:157 at Xamarin.Android.Tasks.ResolveSdks.Execute () [0x00002] in …/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/ResolveSdksTask.cs:130 at Microsoft.Build.BuildEngine.TaskEngine.Execute () [0x00000] in …/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TaskEngine.cs:134 at Microsoft.Build.BuildEngine.BuildTask.Execute () [0x0008d] in …/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildTask.cs:101 Update `xabuild` to *never* explicitly set `$(AndroidSdkDirectory)` and `$(AndroidNdkDirectory)`, and update `Xamarin.Android.Build.Tests` to *always* explicitly provide these MSBuild properties. This allows unit test execution to be more reliable, and will prevent `xabuild.exe` from looking at "random" non-existent directories.
Redth
pushed a commit
to Redth/xamarin-android
that referenced
this pull request
Oct 30, 2017
Context: https://github.com/xamarin/xamarin-android/blob/master/tools/scripts/xabuild#L105 `xabuild`, the shell script, has some logic to set MSBuild properties for `AndroidSdkDirectory` and `AndroidNdkDirectory`. The issue here is on Windows, `xabuild.exe` is not invoked from this shell script. So we need to replicate the logic in C# in `xabuild.exe`, but not break what was fixed in dotnet#977. Changes: * Check for `ANDROID_SDK_PATH` or `ANDROID_NDK_PATH` environment variables * Run `Paths.targets` via a new MSBuild process, the same way as `tools/scripts/xabuild` * Set the `AndroidSdkDirectory` and `AndroidNdkDirectory` properties in the config file if they are not blank * `AndroidSdkDirectory` and `AndroidNdkDirectory` can still be overridden by a user, because incoming values supersede what is found in the config file
jonpryor
added a commit
to jonpryor/xamarin-android
that referenced
this pull request
May 5, 2022
Changes: dotnet/java-interop@2a882d2...4787e01 * dotnet/java-interop@4787e017: [Java.Base-Tests] Test Java-to-Managed invocations for Java.Base (dotnet#975) * dotnet/java-interop@59716252: [build] `main` *conceptually* targets .NET 7 (dotnet#978) * dotnet/java-interop@61cdb40d: [generator] Fix reserved keywords binary search (dotnet#977)
jonpryor
added a commit
that referenced
this pull request
May 6, 2022
Changes: dotnet/java-interop@2a882d2...843f3c7 * dotnet/java-interop@843f3c78: [Java.Base-Tests] Use $(UtilityOutputFullPath)/jcw-gen.dll (#979) * dotnet/java-interop@4787e017: [Java.Base-Tests] Test Java-to-Managed invocations for Java.Base (#975) * dotnet/java-interop@59716252: [build] `main` *conceptually* targets .NET 7 (#978) * dotnet/java-interop@61cdb40d: [generator] Fix reserved keywords binary search (#977)
jonpryor
added a commit
that referenced
this pull request
May 6, 2022
Changes: dotnet/java-interop@2a882d2...843f3c7 * dotnet/java-interop@843f3c78: [Java.Base-Tests] Use $(UtilityOutputFullPath)/jcw-gen.dll (#979) * dotnet/java-interop@4787e017: [Java.Base-Tests] Test Java-to-Managed invocations for Java.Base (#975) * dotnet/java-interop@59716252: [build] `main` *conceptually* targets .NET 7 (#978) * dotnet/java-interop@61cdb40d: [generator] Fix reserved keywords binary search (#977)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context in #910
When switching to
xabuild.exe, two mistakes were made:xabuild.exeshouldn’t setAndroidSdkDirectoryorAndroidNdkDirectoryThis restores some of the code in
Builder.csremoved in f9d15dd