Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=25086
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=31875
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=32171
Reverts and reworks commit
bcfec743.
The problem is that when Xamarin.Android is running mkbundle, dos2unix
should NEVER be used, because the Android NDK NEVER wants Unix-like
paths, which is what dos2unix creates.
Commit
bcfec743 attempted to fix this by removing dos2unix invocation
from the Xamarin.Android codepath.
The problem is that the logic was backwards: it removed dos2unix
invocation when XAMARIN_ANDROID was NOT defined, and PRESERVED
dos2unix invocation when XAMARIN_ANDROID WAS defined.
Meaning commit
bcfec743 broke normal/default mkbundle.exe use on
Windows -- it would no longer probe for and use dos2unix if present --
and Xamarin.Android use of mkbundle continued to check for and use
dos2unix if it was present, continuing the buggy behavior.
Doh!
Thus, a reworking: Add a `mkbundle --dos2unix` parameter.
If `mkbundle --dos2unix=false` is specified, dos2unix will NOT be
probed for, and will NOT be used. If `mkbundle --dos2unix` or
`mkbundle --dos2unix=true` is used, then dos2unix WILL be used.
This allows the caller to consistently, ahead of time, control
mkbundle's behavior regarding dos2unix, which will e.g. allow
Xamarin.Android to *always* specify --dos2unix=false, allowing things
to build as desired there.
}
ctor_func = args [++i];
break;
+ case "--dos2unix":
+ case "--dos2unix=true":
+ use_dos2unix = true;
+ break;
+ case "--dos2unix=false":
+ use_dos2unix = false;
+ break;
default:
sources.Add (args [i]);
break;
" -L path Adds `path' to the search path for assemblies\n" +
" --nodeps Turns off automatic dependency embedding (default)\n" +
" --deps Turns on automatic dependency embedding\n" +
+ " --dos2unix[=true|false]\n" +
+ " When no value provided, or when `true` specified\n" +
+ " `dos2unix` will be invoked to convert paths on Windows.\n" +
+ " When `--dos2unix=false` used, dos2unix is NEVER used.\n" +
" --keeptemp Keeps the temporary files\n" +
" --config F Bundle system config file `F'\n" +
" --config-dir D Set MONO_CFG_DIR to `D'\n" +
return system (cmdLine);
}
-#if XAMARIN_ANDROID
// on Windows, we have to pipe the output of a
// `cmd` interpolation to dos2unix, because the shell does not
// strip the CRLFs generated by the native pkg-config distributed
}
// and if there is no dos2unix, just run cmd /c.
if (use_dos2unix == false) {
-#endif
Console.WriteLine (cmdLine);
ProcessStartInfo dos2unix = new ProcessStartInfo ();
dos2unix.UseShellExecute = false;
p.WaitForExit ();
return p.ExitCode;
}
-#if XAMARIN_ANDROID
}
-#endif
StringBuilder b = new StringBuilder ();
int count = 0;
for (int i = 0; i < cmdLine.Length; i++) {
if (cmdLine [i] == '`') {
-#if XAMARIN_ANDROID
if (count % 2 != 0) {
b.Append ("|dos2unix");
}
-#endif
count++;
}
b.Append (cmdLine [i]);