Skip to content

Conversation

jonpryor
Copy link
Contributor

@jonpryor jonpryor commented Jun 6, 2020

Context: #4567

The Android SDK lint utility is now in two Android SDK packages:
the tools package, and the cmdline-tools package, e.g. as of commit
d99facb, both of these exist on e.g. macOS:

  • $HOME/android-toolchain/sdk/tools/bin/lint
  • $HOME/android-toolchain/sdk/cmdline-tools/1.0/bin/lint

There are two important differences of interest:

  1. tools/bin/lint will not run on OpenJDK 11.

  2. cmdline-tools/1.0/bin/lint has a lower version than
    tools/bin/lint. Much lower:

    % ~/android-toolchain/sdk/tools/bin/lint --version
    lint: version 26.1.1
    % ~/android-toolchain/sdk/cmdline-tools/1.0/bin/lint --version
    lint: version 3.6.0
    

(1) means that we can't use the previous lint in an OpenJDK11 world,
and thus we should migrate to the cmdline-tools lint.

Support this by adding a new $(AndroidCommandLineToolsVersion)
MSBuild property to Xamarin.Android.Common.props.in and
Microsoft.Android.Sdk.props, which allows controlling which
cmdline-tools package version to use, if more than one is present.
The default value is 1.0.

(2) means that the <Lint/> Task is broken when using the
cmdline-tools version of lint, becasuse certain lint --disable
flags are protected by version checks, which are now all "wrong" when
we "expect" >= 26.1.1 and instead get 3.6.0.

Attempt to address (2) by assuming that we're using the cmdline-tools
package if ToolPath contains cmdline-tools, in which case we treat
lint as newer than any previous version.

(This may be less than ideal.)

Context: dotnet#4567

The Android SDK `lint` utility is now in *two* Android SDK packages:
the `tools` package, and the `cmdline-tools` package, e.g. as of commit
d99facb, *both* of these exist on e.g. macOS:

  * `$HOME/android-toolchain/sdk/tools/bin/lint`
  * `$HOME/android-toolchain/sdk/cmdline-tools/1.0/bin/lint`

There are two important differences of interest:

 1. `tools/bin/lint` will not run on OpenJDK 11.
 2. `cmdline-tools/1.0/bin/lint` has a *lower version* than
    `tools/bin/lint`.  *Much* lower:

        % ~/android-toolchain/sdk/tools/bin/lint --version
        lint: version 26.1.1
        % ~/android-toolchain/sdk/cmdline-tools/1.0/bin/lint --version
        lint: version 3.6.0

(1) means that we can't use the previous `lint` in an OpenJDK11 world,
and thus we should migrate to the cmdline-tools `lint`.

Support this by adding a new `$(AndroidCommandLineToolsVersion)`
MSBuild property to `Xamarin.Android.Common.props.in` and
`Microsoft.Android.Sdk.props`, which allows controlling which
`cmdline-tools` package version to use, if more than one is present.
The default value is `1.0`.

(2) means that the `<Lint/>` Task is *broken* when using the
cmdline-tools version of `lint`, becasuse certain `lint --disable`
flags are protected by version checks, which are now all "wrong" when
we "expect" >= 26.1.1 and instead get 3.6.0.

Attempt to address (2) by assuming that we're using the cmdline-tools
package if `ToolPath` contains `cmdline-tools`, in which case we treat
`lint` as newer than any previous version.

(This may be less than ideal.)
@jonpryor jonpryor merged commit 89f3dc1 into dotnet:master Jun 6, 2020
jonpryor added a commit that referenced this pull request Jun 8, 2020
Context: #4567

The Android SDK `lint` utility is now in *two* Android SDK packages:
the `tools` package, and the `cmdline-tools` package, e.g. as of commit
d99facb, *both* of these exist on e.g. macOS:

  * `$HOME/android-toolchain/sdk/tools/bin/lint`
  * `$HOME/android-toolchain/sdk/cmdline-tools/1.0/bin/lint`

There are two important differences of interest:

 1. `tools/bin/lint` will not run on OpenJDK 11.
 2. `cmdline-tools/1.0/bin/lint` has a *lower version* than
    `tools/bin/lint`.  *Much* lower:

        % ~/android-toolchain/sdk/tools/bin/lint --version
        lint: version 26.1.1
        % ~/android-toolchain/sdk/cmdline-tools/1.0/bin/lint --version
        lint: version 3.6.0

(1) means that we can't use the previous `lint` in an OpenJDK11 world,
and thus we should migrate to the cmdline-tools `lint`.

Support this by adding a new `$(AndroidCommandLineToolsVersion)`
MSBuild property to `Xamarin.Android.Common.props.in` and
`Microsoft.Android.Sdk.props`, which allows controlling which
`cmdline-tools` package version to use, if more than one is present.
The default value is `1.0`.

(2) means that the `<Lint/>` Task is *broken* when using the
cmdline-tools version of `lint`, becasuse certain `lint --disable`
flags are protected by version checks, which are now all "wrong" when
we "expect" >= 26.1.1 and instead get 3.6.0.

Attempt to address (2) by assuming that we're using the cmdline-tools
package if `ToolPath` contains `cmdline-tools`, in which case we treat
`lint` as newer than any previous version.

(This may be less than ideal.)
@github-actions github-actions bot locked and limited conversation to collaborators Jan 26, 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