Bug 58178 - macOS installer will fail if javac is not available
Summary: macOS installer will fail if javac is not available
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: 15.4
Assignee: Jonathan Pryor
Depends on:
Reported: 2017-07-15 18:54 UTC by Aaron Bockover [MSFT]
Modified: 2017-07-28 11:32 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Aaron Bockover [MSFT] 2017-07-15 18:54:26 UTC
There is a postinstall step in the .pkg installer for macOS that invokes "javac -version" for the (seemingly) sole purpose of bringing up the built-in macOS UI to prompt a user to install Java, since macOS no longer (and hasn't in a very long time) ships Java out of the box.

The postinstall script in Xamarin.Android however does not handle the exit code of the javac invocation, causing it to propagate up to the installer process itself.

Thus, installing Xamarin.Android on a macOS system without Java previously installed results in the Xamarin.Android installer failing.
Comment 1 Aaron Bockover [MSFT] 2017-07-15 18:55:33 UTC
Based on the comments in the postinstall.in file in Xamarin.Android, `javac -version` returning non-zero might actually be a new behavior in High Sierra.
Comment 2 Jonathan Pryor 2017-07-15 19:01:30 UTC
I never realized that a shell script would return the exit code of the last command executed. Hm...

TIL. :-)

Also, as Comment #1 mentions, the intent was to use `javac -version`.

Fix in: https://github.com/xamarin/monodroid/pull/640
Comment 3 Aaron Bockover [MSFT] 2017-07-15 19:03:38 UTC
PR here: https://github.com/xamarin/monodroid/pull/641
Comment 4 Jonathan Pryor 2017-07-15 19:35:11 UTC
Fixed in monodroid/2e31620c.
Comment 5 Jonathan Pryor 2017-07-18 02:08:47 UTC
Fixed in monodroid/d15-4/880daec4.
Comment 6 Mohak Barokar 2017-07-28 11:32:47 UTC
This bug is verified on d15_4 Branch build having following config:

 -Visual Studio Community 2017 for Mac (Preview) Version 7.2 Preview (7.2 build 446)
 -Xamarin.iOS Version: 
 -Xamarin.Android Version: 
 -Xamarin.Mac Version:

 Detailed Build Config: https://gist.github.com/mohakbarokar/418919d3b553dfb691ded2ed16a6f4b4

 The bug is found to be fixed. Hence marking the bug as Verified Fixed.

 Screencast Link: https://www.screencast.com/t/YbBkAC33tSkm