diff --git a/src/Java.Runtime.Environment/Java.Runtime.Environment.csproj b/src/Java.Runtime.Environment/Java.Runtime.Environment.csproj index 645d62f81..d593db91d 100644 --- a/src/Java.Runtime.Environment/Java.Runtime.Environment.csproj +++ b/src/Java.Runtime.Environment/Java.Runtime.Environment.csproj @@ -48,7 +48,7 @@ - + PreserveNewest diff --git a/src/Xamarin.Android.Tools.Bytecode/Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj b/src/Xamarin.Android.Tools.Bytecode/Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj index c66587660..ffbbc7b0d 100644 --- a/src/Xamarin.Android.Tools.Bytecode/Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj +++ b/src/Xamarin.Android.Tools.Bytecode/Tests/Xamarin.Android.Tools.Bytecode-Tests.csproj @@ -1,5 +1,6 @@ + Debug AnyCPU @@ -73,8 +74,8 @@ - - + + diff --git a/tools/generator/Tests/BaseGeneratorTest.cs b/tools/generator/Tests/BaseGeneratorTest.cs index c9b0de4d5..4a0283bd4 100644 --- a/tools/generator/Tests/BaseGeneratorTest.cs +++ b/tools/generator/Tests/BaseGeneratorTest.cs @@ -40,7 +40,7 @@ public void Execute () } bool hasErrors; string compilerOutput; - BuiltAssembly = Compiler.Compile (Options, "Mono.Andoroid", AdditionalSourceDirectories, + BuiltAssembly = Compiler.Compile (Options, "Mono.Android", AdditionalSourceDirectories, out hasErrors, out compilerOutput); Assert.AreEqual (false, hasErrors, compilerOutput); Assert.IsNotNull (BuiltAssembly); @@ -79,8 +79,8 @@ protected bool FileCompare (string file1, string file2) result = File.Exists (file1) && File.Exists (file2); if (result) { - byte[] f1 = File.ReadAllBytes (file1); - byte[] f2 = File.ReadAllBytes (file2); + byte[] f1 = ReadAllBytesIgnoringLineEndings (file1); + byte[] f2 = ReadAllBytesIgnoringLineEndings (file2); var hash = MD5.Create (); var f1hash = Convert.ToBase64String (hash.ComputeHash (f1)); @@ -91,6 +91,22 @@ protected bool FileCompare (string file1, string file2) return result; } + private byte[] ReadAllBytesIgnoringLineEndings (string path) + { + using (var memoryStream = new MemoryStream ()) { + using (var file = File.OpenRead (path)) { + int readByte; + while ((readByte = file.ReadByte()) != -1) { + byte b = (byte)readByte; + if (b != '\r' && b != '\n') { + memoryStream.WriteByte (b); + } + } + } + return memoryStream.ToArray (); + } + } + protected void RunAllTargets (string outputRelativePath, string apiDescriptionFile, string expectedRelativePath, string[] additionalSupportPaths = null) { Run (CodeGenerationTarget.XamarinAndroid, Path.Combine ("out", outputRelativePath), apiDescriptionFile, Path.Combine ("expected", expectedRelativePath), additionalSupportPaths); diff --git a/tools/generator/Tests/Compiler.cs b/tools/generator/Tests/Compiler.cs index b41fb6168..1fccf85f1 100644 --- a/tools/generator/Tests/Compiler.cs +++ b/tools/generator/Tests/Compiler.cs @@ -70,9 +70,13 @@ static string GetFacadesPath () var env = Environment.GetEnvironmentVariable ("FACADES_PATH"); if (env != null) return env; - return Path.Combine ( - Path.GetDirectoryName (typeof (object).Assembly.Location), - "Facades"); + + var dir = Path.GetDirectoryName (typeof (object).Assembly.Location); + var facades = Path.Combine (dir, "Facades"); + if (Directory.Exists (facades)) + return facades; + + return dir; } } }