Skip to content

[Xamarin.Android.Build.Tasks] Unable to build projects with lint checks enabled against 15.3 #649

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
merged 1 commit into from
Jun 20, 2017

Conversation

dellis1972
Copy link
Contributor

@dellis1972 dellis1972 commented Jun 16, 2017

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

The Directory test from commit 9cf367f did not really work.
This is because the 'bin' directory existed prior to 25.3.0.
But the lint tool only moved in 25.3.0.

To fix this we are adding new code to the ResolveSdks Task. This
will find the correct location of the lint tool. It will also
use the $(LintToolPath) the user provides.

If the tool cannot be found an appropriate error message will
be raised.

@dellis1972
Copy link
Contributor Author

no idea why the linux build failed there?

@dellis1972
Copy link
Contributor Author

build

@@ -221,7 +227,10 @@ protected override string GenerateCommandLineCommands ()

protected override string GenerateFullPathToTool ()
{
return Path.Combine (ToolPath, ToolExe);
var fullToolPath = Path.Combine (ToolPath, ToolExe);;
Copy link
Contributor

Choose a reason for hiding this comment

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

Double ;;. Typo?


if (!string.IsNullOrEmpty (ToolPath) && ToolPath != null) {
if (!File.Exists (Path.Combine (ToolPath, ToolExe)))
ToolPath = Path.Combine (ToolPath, "bin");
Copy link
Contributor

Choose a reason for hiding this comment

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

...and if $"{ToolPath}/bin/{ToolExe}" doesn't exist, what should happen?

Perhaps ToolTask reports a sane error if the file doesn't exist? But I don't think so; I think e.g. on macOS it turns into a "cryptic" error 127.

I think we should do our own error checking with a decent error message.

var fullToolPath = Path.Combine (ToolPath, ToolExe);;
if (File.Exists (fullToolPath))
return fullToolPath;
return Path.Combine (ToolPath, "bin", ToolExe);
Copy link
Contributor

Choose a reason for hiding this comment

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

This method seems weirdly duplicative of what's being added to Execute(). Is that duplication necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the ToolPath is set to empty (by the user) this code path will get hit. So we kinda need the same code. I will move it into one method

@@ -750,12 +750,6 @@ because xbuild doesn't support framework reference assemblies.
/>
</CreateProperty>

<CreateProperty Value="$(_AndroidToolsDirectory)bin\" Condition="Exists ('$(_AndroidToolsDirectory)bin\')">
<Output TaskParameter="Value" PropertyName="LintToolPath"
Copy link
Contributor

Choose a reason for hiding this comment

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

This and the commit message confuses me.

We're going to make $(LintToolPath) unset/empty by default, and add additional File.Exists() checking to the <Lint/> task...?

Why not instead update the <ResolveSdks/> Task to output a ResolveSdks.LintToolPath property, and let <ResolveSdks/> check for the appropriate directories?

@@ -121,6 +124,7 @@ public bool RunTask ()
.Select (e => e.Value)
.ToArray ();
AndroidSequencePointsMode = sdk.Element ("AndroidSequencePointsMode")?.Value ?? "None";
LintToolPath = sdk.Element ("LintToolPath")?.Value ?? Path.Combine (AndroidSdkBuildToolsPath);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have Path.Combine (AndroidSdkBuildToolsPath)? You're not combining anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point.. :P

…ks enabled against 15.3

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

The Directory test from commit 9cf367f did not really work.
This is because the 'bin' directory existed prior to 25.3.0.
But the lint tool only moved in 25.3.0.

To fix this we are adding new code to the ResolveSdks Task. This
will find the correct location of the `lint` tool. It will also
use the `$(LintToolPath)` the user provides.

If the tool cannot be found an appropriate error message will
be raised.
@jonpryor jonpryor merged commit 010332d into dotnet:master Jun 20, 2017
dellis1972 added a commit that referenced this pull request Jun 20, 2017
…ks enabled against 15.3 (#649)

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

The Directory test from commit 9cf367f did not really work.
This is because the 'bin' directory existed prior to 25.3.0.
But the lint tool only moved in 25.3.0.

To fix this we are adding new code to the ResolveSdks Task. This
will find the correct location of the `lint` tool. It will also
use the `$(LintToolPath)` the user provides.

If the tool cannot be found an appropriate error message will
be raised.
@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.

3 participants