Skip to content
This repository was archived by the owner on Jul 6, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line numberDiff line numberDiff line change
Expand Up@@ -48,7 +48,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Java.Runtime.Environment.dll.config">
<Content Include="Java.Runtime.Environment.dll.config" Condition=" '$(OS)' != 'Windows_NT' ">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
Expand Down
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\..\Configuration.props" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand DownExpand Up@@ -73,8 +74,8 @@
</PropertyGroup>
<Target Name="BuildClasses" Inputs="@(TestJar)" Outputs="@(TestJar-&gt;'$(IntermediateOutputPath)classes\%(RecursiveDir)%(Filename).class')">
<MakeDir Directories="$(IntermediateOutputPath)classes" />
<Exec Command="&quot;javac&quot; -parameters -source 1.5 -target 1.6 -g -d &quot;$(IntermediateOutputPath)classes&quot; @(TestJar->'%(Identity)', ' ')" />
<Exec Command="&quot;javac&quot; -source 1.5 -target 1.6 -g -d &quot;$(IntermediateOutputPath)classes&quot; @(TestJarNoParameters->'%(Identity)', ' ')" />
<Exec Command="&quot;$(JavaCPath)&quot; -parameters -source 1.5 -target 1.6 -g -d &quot;$(IntermediateOutputPath)classes&quot; @(TestJar->'%(Identity)', ' ')" />
<Exec Command="&quot;$(JavaCPath)&quot; -source 1.5 -target 1.6 -g -d &quot;$(IntermediateOutputPath)classes&quot; @(TestJarNoParameters->'%(Identity)', ' ')" />
</Target>
<ItemGroup>
<ProjectReference Include="..\Xamarin.Android.Tools.Bytecode.csproj">
Expand Down
22 changes: 19 additions & 3 deletions tools/generator/Tests/BaseGeneratorTest.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -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);
Expand DownExpand Up@@ -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));
Expand All@@ -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);
Expand Down
10 changes: 7 additions & 3 deletions tools/generator/Tests/Compiler.cs
Original file line numberDiff line numberDiff line change
Expand Up@@ -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;
}
}
}
Expand Down