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] set file extension for common ToolExe values #8267

Merged
merged 1 commit into from
Aug 17, 2023

Conversation

jonathanpeppers
Copy link
Member

Running the -t:Install target with a local xamarin-android build on Windows, I got the error:

AndroidAdb
Errors
    Xamarin.Android.Common.targets(2641,3): error MSB6004:
    The specified task executable location "D:\android-toolchain\sdk\platform-tools\adb" is invalid.

This appears to only happen with a local of xamarin/xamarin-android because it specifies AdbToolExe=adb in Configuration.props.

It appears that most of our tasks just use the pattern:

protected override string GenerateFullPathToTool ()
{
    return Path.Combine (ToolPath, ToolExe);
}

Where if ToolExe was completely blank, it would fall back to the value:

protected override string ToolName => OS.IsWindows ? "adb.exe" : "adb";

Searching the web:

https://grep.app/search?current=2&q=ToolExe&words=true&filter[lang][0]=C%23&filter[lang][1]=XML

It seems most other tasks use ToolExe as-is, if it is passed in. Where most of the time the default value is blank.

So, I think the simple fix here, is to specify the file extension in Configuration.props for any of our $(FooToolExe) values.

I also removed $(AndroidToolExe) because it is unused and may not event exist anymore in the Android SDK.

Running the `-t:Install` target with a local xamarin-android build on
Windows, I got the error:

    AndroidAdb
    Errors
        Xamarin.Android.Common.targets(2641,3): error MSB6004:
        The specified task executable location "D:\android-toolchain\sdk\platform-tools\adb" is invalid.

This appears to only happen with a local of xamarin/xamarin-android
because it specifies `AdbToolExe=adb` in `Configuration.props`.

It appears that most of our tasks just use the pattern:

    protected override string GenerateFullPathToTool ()
    {
        return Path.Combine (ToolPath, ToolExe);
    }

Where if `ToolExe` was completely blank, it would fall back to the value:

    protected override string ToolName => OS.IsWindows ? "adb.exe" : "adb";

Searching the web:

https://grep.app/search?current=2&q=ToolExe&words=true&filter[lang][0]=C%23&filter[lang][1]=XML

It seems most other tasks use `ToolExe` as-is, if it is passed in. Where
most of the time the default value is blank.

So, I think the simple fix here, is to specify the file extension in
`Configuration.props` for any of our `$(FooToolExe)` values.

I also removed `$(AndroidToolExe)` because it is unused and may not
event exist anymore in the Android SDK.
@jonpryor jonpryor merged commit aea7e79 into dotnet:main Aug 17, 2023
45 of 47 checks passed
@jonathanpeppers jonathanpeppers deleted the ToolExe branch August 17, 2023 15:25
grendello added a commit to grendello/xamarin-android that referenced this pull request Sep 4, 2023
* main: (57 commits)
  Bump to dotnet/installer@2809943e7a 8.0.100-rc.2.23431.5 (dotnet#8317)
  [build] Use Microsoft OpenJDK 17.0.8 (dotnet#8309)
  [Mono.Android] Add missing `[Flags]` attribute for generated enums. (dotnet#8310)
  Bump to dotnet/installer@c5e45fd659 8.0.100-rc.2.23427.4 (dotnet#8305)
  [xaprepare] Improve dotnet-install script logging (dotnet#8312)
  [xaprepare] Fix dotnet-install script size check (dotnet#8311)
  [Xamarin.Android.Build.Tasks] improve net6.0 "out of support" message (dotnet#8307)
  [monodroid] Fix the EnableNativeAnalyzers build (dotnet#8293)
  Bump to dotnet/installer@56d8c6497c 8.0.100-rc.2.23422.31 (dotnet#8291)
  [Xamarin.Android.Build.Tasks] Fix APT2264 error on Windows. (dotnet#8289)
  [Mono.Android] Marshal .NET stack trace to Throwable.getStackTrace() (dotnet#8185)
  [tests] Skip sign check when installing MAUI (dotnet#8288)
  Bump to xamarin/monodroid@057b17fe (dotnet#8286)
  [Xamarin.Android.Build.Tasks] add $(AndroidStripILAfterAOT) (dotnet#8172)
  Bump to dotnet/installer@ec2c1ec1b1 8.0.100-rc.2.23420.6 (dotnet#8281)
  Bump to dotnet/installer@001d8e4465 8.0.100-rc.2.23417.14 (dotnet#8276)
  [Mono.Android] [IntentFilter] pathSuffix & pathAdvancedPattern  (dotnet#8261)
  $(AndroidPackVersionSuffix)=rc.2; net8 is 34.0.0-rc.2 (dotnet#8278)
  Bump to xamarin/xamarin-android-tools/main@52f0866 (dotnet#8241)
  [build] set file extension for common `ToolExe` values (dotnet#8267)
  ...
grendello added a commit to grendello/xamarin-android that referenced this pull request Sep 4, 2023
* main: (102 commits)
  Bump to dotnet/installer@2809943e7a 8.0.100-rc.2.23431.5 (dotnet#8317)
  [build] Use Microsoft OpenJDK 17.0.8 (dotnet#8309)
  [Mono.Android] Add missing `[Flags]` attribute for generated enums. (dotnet#8310)
  Bump to dotnet/installer@c5e45fd659 8.0.100-rc.2.23427.4 (dotnet#8305)
  [xaprepare] Improve dotnet-install script logging (dotnet#8312)
  [xaprepare] Fix dotnet-install script size check (dotnet#8311)
  [Xamarin.Android.Build.Tasks] improve net6.0 "out of support" message (dotnet#8307)
  [monodroid] Fix the EnableNativeAnalyzers build (dotnet#8293)
  Bump to dotnet/installer@56d8c6497c 8.0.100-rc.2.23422.31 (dotnet#8291)
  [Xamarin.Android.Build.Tasks] Fix APT2264 error on Windows. (dotnet#8289)
  [Mono.Android] Marshal .NET stack trace to Throwable.getStackTrace() (dotnet#8185)
  [tests] Skip sign check when installing MAUI (dotnet#8288)
  Bump to xamarin/monodroid@057b17fe (dotnet#8286)
  [Xamarin.Android.Build.Tasks] add $(AndroidStripILAfterAOT) (dotnet#8172)
  Bump to dotnet/installer@ec2c1ec1b1 8.0.100-rc.2.23420.6 (dotnet#8281)
  Bump to dotnet/installer@001d8e4465 8.0.100-rc.2.23417.14 (dotnet#8276)
  [Mono.Android] [IntentFilter] pathSuffix & pathAdvancedPattern  (dotnet#8261)
  $(AndroidPackVersionSuffix)=rc.2; net8 is 34.0.0-rc.2 (dotnet#8278)
  Bump to xamarin/xamarin-android-tools/main@52f0866 (dotnet#8241)
  [build] set file extension for common `ToolExe` values (dotnet#8267)
  ...
grendello added a commit to grendello/xamarin-android that referenced this pull request Sep 4, 2023
* main: (68 commits)
  Bump to dotnet/installer@2809943e7a 8.0.100-rc.2.23431.5 (dotnet#8317)
  [build] Use Microsoft OpenJDK 17.0.8 (dotnet#8309)
  [Mono.Android] Add missing `[Flags]` attribute for generated enums. (dotnet#8310)
  Bump to dotnet/installer@c5e45fd659 8.0.100-rc.2.23427.4 (dotnet#8305)
  [xaprepare] Improve dotnet-install script logging (dotnet#8312)
  [xaprepare] Fix dotnet-install script size check (dotnet#8311)
  [Xamarin.Android.Build.Tasks] improve net6.0 "out of support" message (dotnet#8307)
  [monodroid] Fix the EnableNativeAnalyzers build (dotnet#8293)
  Bump to dotnet/installer@56d8c6497c 8.0.100-rc.2.23422.31 (dotnet#8291)
  [Xamarin.Android.Build.Tasks] Fix APT2264 error on Windows. (dotnet#8289)
  [Mono.Android] Marshal .NET stack trace to Throwable.getStackTrace() (dotnet#8185)
  [tests] Skip sign check when installing MAUI (dotnet#8288)
  Bump to xamarin/monodroid@057b17fe (dotnet#8286)
  [Xamarin.Android.Build.Tasks] add $(AndroidStripILAfterAOT) (dotnet#8172)
  Bump to dotnet/installer@ec2c1ec1b1 8.0.100-rc.2.23420.6 (dotnet#8281)
  Bump to dotnet/installer@001d8e4465 8.0.100-rc.2.23417.14 (dotnet#8276)
  [Mono.Android] [IntentFilter] pathSuffix & pathAdvancedPattern  (dotnet#8261)
  $(AndroidPackVersionSuffix)=rc.2; net8 is 34.0.0-rc.2 (dotnet#8278)
  Bump to xamarin/xamarin-android-tools/main@52f0866 (dotnet#8241)
  [build] set file extension for common `ToolExe` values (dotnet#8267)
  ...
grendello added a commit to grendello/xamarin-android that referenced this pull request Sep 4, 2023
* main: (53 commits)
  Bump to dotnet/installer@2809943e7a 8.0.100-rc.2.23431.5 (dotnet#8317)
  [build] Use Microsoft OpenJDK 17.0.8 (dotnet#8309)
  [Mono.Android] Add missing `[Flags]` attribute for generated enums. (dotnet#8310)
  Bump to dotnet/installer@c5e45fd659 8.0.100-rc.2.23427.4 (dotnet#8305)
  [xaprepare] Improve dotnet-install script logging (dotnet#8312)
  [xaprepare] Fix dotnet-install script size check (dotnet#8311)
  [Xamarin.Android.Build.Tasks] improve net6.0 "out of support" message (dotnet#8307)
  [monodroid] Fix the EnableNativeAnalyzers build (dotnet#8293)
  Bump to dotnet/installer@56d8c6497c 8.0.100-rc.2.23422.31 (dotnet#8291)
  [Xamarin.Android.Build.Tasks] Fix APT2264 error on Windows. (dotnet#8289)
  [Mono.Android] Marshal .NET stack trace to Throwable.getStackTrace() (dotnet#8185)
  [tests] Skip sign check when installing MAUI (dotnet#8288)
  Bump to xamarin/monodroid@057b17fe (dotnet#8286)
  [Xamarin.Android.Build.Tasks] add $(AndroidStripILAfterAOT) (dotnet#8172)
  Bump to dotnet/installer@ec2c1ec1b1 8.0.100-rc.2.23420.6 (dotnet#8281)
  Bump to dotnet/installer@001d8e4465 8.0.100-rc.2.23417.14 (dotnet#8276)
  [Mono.Android] [IntentFilter] pathSuffix & pathAdvancedPattern  (dotnet#8261)
  $(AndroidPackVersionSuffix)=rc.2; net8 is 34.0.0-rc.2 (dotnet#8278)
  Bump to xamarin/xamarin-android-tools/main@52f0866 (dotnet#8241)
  [build] set file extension for common `ToolExe` values (dotnet#8267)
  ...
grendello added a commit to grendello/xamarin-android that referenced this pull request Sep 4, 2023
* main: (25 commits)
  Bump to dotnet/installer@2809943e7a 8.0.100-rc.2.23431.5 (dotnet#8317)
  [build] Use Microsoft OpenJDK 17.0.8 (dotnet#8309)
  [Mono.Android] Add missing `[Flags]` attribute for generated enums. (dotnet#8310)
  Bump to dotnet/installer@c5e45fd659 8.0.100-rc.2.23427.4 (dotnet#8305)
  [xaprepare] Improve dotnet-install script logging (dotnet#8312)
  [xaprepare] Fix dotnet-install script size check (dotnet#8311)
  [Xamarin.Android.Build.Tasks] improve net6.0 "out of support" message (dotnet#8307)
  [monodroid] Fix the EnableNativeAnalyzers build (dotnet#8293)
  Bump to dotnet/installer@56d8c6497c 8.0.100-rc.2.23422.31 (dotnet#8291)
  [Xamarin.Android.Build.Tasks] Fix APT2264 error on Windows. (dotnet#8289)
  [Mono.Android] Marshal .NET stack trace to Throwable.getStackTrace() (dotnet#8185)
  [tests] Skip sign check when installing MAUI (dotnet#8288)
  Bump to xamarin/monodroid@057b17fe (dotnet#8286)
  [Xamarin.Android.Build.Tasks] add $(AndroidStripILAfterAOT) (dotnet#8172)
  Bump to dotnet/installer@ec2c1ec1b1 8.0.100-rc.2.23420.6 (dotnet#8281)
  Bump to dotnet/installer@001d8e4465 8.0.100-rc.2.23417.14 (dotnet#8276)
  [Mono.Android] [IntentFilter] pathSuffix & pathAdvancedPattern  (dotnet#8261)
  $(AndroidPackVersionSuffix)=rc.2; net8 is 34.0.0-rc.2 (dotnet#8278)
  Bump to xamarin/xamarin-android-tools/main@52f0866 (dotnet#8241)
  [build] set file extension for common `ToolExe` values (dotnet#8267)
  ...
grendello added a commit to grendello/xamarin-android that referenced this pull request Sep 4, 2023
* main: (38 commits)
  Bump to dotnet/installer@2809943e7a 8.0.100-rc.2.23431.5 (dotnet#8317)
  [build] Use Microsoft OpenJDK 17.0.8 (dotnet#8309)
  [Mono.Android] Add missing `[Flags]` attribute for generated enums. (dotnet#8310)
  Bump to dotnet/installer@c5e45fd659 8.0.100-rc.2.23427.4 (dotnet#8305)
  [xaprepare] Improve dotnet-install script logging (dotnet#8312)
  [xaprepare] Fix dotnet-install script size check (dotnet#8311)
  [Xamarin.Android.Build.Tasks] improve net6.0 "out of support" message (dotnet#8307)
  [monodroid] Fix the EnableNativeAnalyzers build (dotnet#8293)
  Bump to dotnet/installer@56d8c6497c 8.0.100-rc.2.23422.31 (dotnet#8291)
  [Xamarin.Android.Build.Tasks] Fix APT2264 error on Windows. (dotnet#8289)
  [Mono.Android] Marshal .NET stack trace to Throwable.getStackTrace() (dotnet#8185)
  [tests] Skip sign check when installing MAUI (dotnet#8288)
  Bump to xamarin/monodroid@057b17fe (dotnet#8286)
  [Xamarin.Android.Build.Tasks] add $(AndroidStripILAfterAOT) (dotnet#8172)
  Bump to dotnet/installer@ec2c1ec1b1 8.0.100-rc.2.23420.6 (dotnet#8281)
  Bump to dotnet/installer@001d8e4465 8.0.100-rc.2.23417.14 (dotnet#8276)
  [Mono.Android] [IntentFilter] pathSuffix & pathAdvancedPattern  (dotnet#8261)
  $(AndroidPackVersionSuffix)=rc.2; net8 is 34.0.0-rc.2 (dotnet#8278)
  Bump to xamarin/xamarin-android-tools/main@52f0866 (dotnet#8241)
  [build] set file extension for common `ToolExe` values (dotnet#8267)
  ...
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 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.

2 participants