diff --git a/.gitignore b/.gitignore index b558723353d..34f0b2461bf 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props external/monodroid/ external/mono/ tests/api-compatibility/reference/*.dll +tests/api-compatibility/reference/*.cs Novell \ No newline at end of file diff --git a/Before.Xamarin.Android.sln.targets b/Before.Xamarin.Android.sln.targets index 79b1b4ac8b3..d121e6c86c3 100644 --- a/Before.Xamarin.Android.sln.targets +++ b/Before.Xamarin.Android.sln.targets @@ -3,4 +3,5 @@ + \ No newline at end of file diff --git a/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/Zip.cs b/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/Zip.cs index 56939f798af..755e1364871 100644 --- a/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/Zip.cs +++ b/build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/Zip.cs @@ -57,7 +57,13 @@ public override bool Execute () if (prefix != null && entryDir.StartsWith (prefix, StringComparison.OrdinalIgnoreCase)) { zipDir = entryDir.Substring (prefix.Length); } - zip.AddFileToDirectory (entryPath, zipDir, useFileDirectory: false); + if (string.IsNullOrEmpty (zipDir)) { + // JonP can't figure out how to actually clear the archive directory name + // using AddFileToDirectory(). This works as desired. + zip.AddFile (entryPath, Path.GetFileName (entryPath)); + } else { + zip.AddFileToDirectory (entryPath, zipDir, useFileDirectory: false); + } } } return !Log.HasLoggedErrors; diff --git a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/Git.cs b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/Git.cs index e21b484c60c..9860ee67a4c 100644 --- a/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/Git.cs +++ b/build-tools/xa-prep-tasks/Xamarin.Android.BuildTools.PrepTasks/Git.cs @@ -26,6 +26,10 @@ protected virtual bool LogTaskMessages { get { return true; } } + protected virtual bool PreserveOutput { + get { return true; } + } + protected override string ToolBaseName { get { return "git"; } } @@ -68,7 +72,9 @@ protected override string GetWorkingDirectory () protected override void LogEventsFromTextOutput (string singleLine, MessageImportance messageImportance) { base.LogEventsFromTextOutput (singleLine, messageImportance); - Lines.Add (singleLine); + if (PreserveOutput) { + Lines.Add (singleLine); + } } } } diff --git a/src/Mono.Android/Mono.Android.targets b/src/Mono.Android/Mono.Android.targets index 373e64eac0f..79d6044ca4d 100644 --- a/src/Mono.Android/Mono.Android.targets +++ b/src/Mono.Android/Mono.Android.targets @@ -1,5 +1,6 @@ + @@ -174,23 +175,41 @@ - + <_RunApiDiff Condition=" '$(MSBuildLastTaskResult)' == 'False' ">True + <_GenAPI>"$(XAPackagesDir)\microsoft.dotnet.genapi\5.0.0-beta.20078.1\tools\net472\Microsoft.DotNet.GenAPI.exe" + <_ContractRefSrc>"$(ApiCompatibilityDir)\reference\Mono.Android.dll.cs" + <_TargetRefSrc>"$(TargetPath).cs" + + + + diff --git a/tests/api-compatibility/README.md b/tests/api-compatibility/README.md index cbb29579c4d..bc3624538af 100644 --- a/tests/api-compatibility/README.md +++ b/tests/api-compatibility/README.md @@ -16,6 +16,15 @@ current version of an assembly. We could also called it the V2 assembly. [mdac]: https://github.com/dotnet/arcade/tree/master/src/Microsoft.DotNet.ApiCompat +## Update Contract Assembly + +To update the contract assembly, run the `UpdateMonoAndroidContract` target +and provide the `$(ContractAssembly)` MSBuild property. `$(ContractAssembly)` +should be the path to the new contract assembly to use: + + msbuild Xamarin.Android.sln /t:UpdateMonoAndroidContract '/p:ContractAssembly=/Users/example/Downloads/\$ReferenceAssemblies/Microsoft/Framework/MonoAndroid/v10.0/Mono.Android.dll' + + ## Build Task We have developed a build task that will wrap *Microsoft.DotNet.ApiCompat.exe* diff --git a/tests/api-compatibility/api-compatibility.targets b/tests/api-compatibility/api-compatibility.targets new file mode 100644 index 00000000000..45ec78f0ee1 --- /dev/null +++ b/tests/api-compatibility/api-compatibility.targets @@ -0,0 +1,43 @@ + + + + + + + + <_GenAPI>"$(XAPackagesDir)\microsoft.dotnet.genapi\5.0.0-beta.20078.1\tools\net472\Microsoft.DotNet.GenAPI.exe" + <_CilStrip>"$(XAInstallPrefix)\xbuild\Xamarin\Android\cil-strip.exe" + <_ContractRefDll>$(MSBuildThisFileDirectory)\reference\Mono.Android.dll + <_ContractRefSrc>$(MSBuildThisFileDirectory)\reference\Mono.Android.dll.cs + + + + + + <_ZipEntry Include="$(_ContractRefDll)" /> + <_ZipEntry Include="$(_ContractRefSrc)" /> + + + + + diff --git a/tests/api-compatibility/reference/Mono.Android.dll.zip b/tests/api-compatibility/reference/Mono.Android.dll.zip deleted file mode 100644 index 0add511274f..00000000000 Binary files a/tests/api-compatibility/reference/Mono.Android.dll.zip and /dev/null differ diff --git a/tests/api-compatibility/reference/Mono.Android.zip b/tests/api-compatibility/reference/Mono.Android.zip new file mode 100644 index 00000000000..1bc9c089488 Binary files /dev/null and b/tests/api-compatibility/reference/Mono.Android.zip differ