Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit a840d5c

Browse files
committed
Fix api-diff build step
1 parent a03ad30 commit a840d5c

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

build.cake

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ var AAR_VERSION = "23.4.0";
1616
var M2_REPOSITORY_URL = "https://dl-ssl.google.com/android/repository/android_m2repository_r32.zip";
1717
var BUILD_TOOLS_URL = "https://dl-ssl.google.com/android/repository/build-tools_r23-macosx.zip";
1818
var DOCS_URL = "https://dl-ssl.google.com/android/repository/docs-23_r01.zip";
19+
var MONO_API_TOOLS_URL = "http://xamarin-components-apiinfo.s3.amazonaws.com/mono-api-tools.zip";
1920

2021
var AAR_DIRS = new [] {
2122
"support-v4", "support-v13", "appcompat-v7", "gridlayout-v7", "mediarouter-v7", "recyclerview-v7",
@@ -169,6 +170,9 @@ Task ("externals")
169170

170171
Task ("merge").IsDependentOn ("libs").Does (() =>
171172
{
173+
if (FileExists ("./output/AndroidSupport.Merged.dll"))
174+
DeleteFile ("./output/AndroidSupport.Merged.dll");
175+
172176
var mergeDlls = GetFiles ("./output/*.dll");
173177

174178
// Wait for ILRepack support in cake-0.5.2
@@ -181,45 +185,51 @@ Task ("merge").IsDependentOn ("libs").Does (() =>
181185
},
182186
});
183187

188+
Information ("Completed: {0}", "ILRepack");
189+
184190
// Don't want to think about what the paths will do to this on windows right now
185191
if (!IsRunningOnWindows ()) {
192+
// Download the tools needed to run the next steps
193+
if (!DirectoryExists ("./tools/mono-api-tools")) {
194+
EnsureDirectoryExists ("./tools/mono-api-tools/");
195+
DownloadFile (MONO_API_TOOLS_URL, "./tools/mono-api-tools.zip");
196+
Unzip ("./tools/mono-api-tools.zip", "./tools/mono-api-tools/");
197+
}
198+
186199
// Next run the mono-api-info.exe to generate xml api info we can later diff with
187-
var monoApiInfoExe = GetFiles ("../../**/mono-api-info.exe").FirstOrDefault ();
188-
var monoApiDiffExe = GetFiles ("../../**/mono-api-diff.exe").FirstOrDefault ();
189-
var monoApiHtmlExe = GetFiles ("../../**/mono-api-html.exe").FirstOrDefault ();
200+
var monoApiInfoExe = GetFiles ("./tools/**/mono-api-info.exe").FirstOrDefault ();
201+
var monoApiDiffExe = GetFiles ("./tools/**/mono-api-diff.exe").FirstOrDefault ();
202+
var monoApiHtmlExe = GetFiles ("./tools/**/mono-api-html.exe").FirstOrDefault ();
190203

204+
IEnumerable<string> procStdOut;
205+
206+
var interopPath = "/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mono/2.1/";
191207
//eg: mono mono-api-info.exe --search-directory=/Library/Frameworks/Xamarin.Android.framework/Libraries/mandroid/platforms/android-23 ./Some.dll > api-info.xml
192-
using(var process = StartAndReturnProcess (monoApiInfoExe, new ProcessSettings {
193-
Arguments = "--search-directory=" + MONODROID_PATH + " ./output/AndroidSupport.Merged.dll",
208+
StartProcess (monoApiInfoExe, new ProcessSettings {
209+
Arguments = "--search-directory=" + MONODROID_PATH + " --search-directory=" + interopPath + " ./output/AndroidSupport.Merged.dll",
194210
RedirectStandardOutput = true,
195-
})) {
196-
process.WaitForExit();
197-
FileWriteLines ("./output/AndroidSupport.api-info.xml", process.GetStandardOutput ().ToArray ());
198-
}
211+
}, out procStdOut);
212+
FileWriteLines ("./output/AndroidSupport.api-info.xml", procStdOut.ToArray ());
199213

200214
// Grab the latest published api info from S3
201215
var latestReleasedApiInfoUrl = "http://xamarin-components-apiinfo.s3.amazonaws.com/Support.Android-Latest.xml";
202216
DownloadFile (latestReleasedApiInfoUrl, "./output/AndroidSupport.api-info.previous.xml");
203217

204218
// Now diff against current release'd api info
205219
// eg: mono mono-api-diff.exe ./gps.r26.xml ./gps.r27.xml > gps.diff.xml
206-
using(var process = StartAndReturnProcess (monoApiDiffExe, new ProcessSettings {
220+
StartProcess (monoApiDiffExe, new ProcessSettings {
207221
Arguments = "./output/AndroidSupport.api-info.previous.xml ./output/AndroidSupport.api-info.xml",
208222
RedirectStandardOutput = true,
209-
})) {
210-
process.WaitForExit();
211-
FileWriteLines ("./output/AndroidSupport.api-diff.xml", process.GetStandardOutput ().ToArray ());
212-
}
223+
}, out procStdOut);
224+
FileWriteLines ("./output/AndroidSupport.api-diff.xml", procStdOut.ToArray ());
213225

214226
// Now let's make a purty html file
215227
// eg: mono mono-api-html.exe -c -x ./gps.previous.info.xml ./gps.current.info.xml > gps.diff.html
216-
using(var process = StartAndReturnProcess (monoApiHtmlExe, new ProcessSettings {
228+
StartProcess (monoApiHtmlExe, new ProcessSettings {
217229
Arguments = "-c -x ./output/AndroidSupport.api-info.previous.xml ./output/AndroidSupport.api-info.xml",
218230
RedirectStandardOutput = true,
219-
})) {
220-
process.WaitForExit();
221-
FileWriteLines ("./output/AndroidSupport.api-diff.html", process.GetStandardOutput ().ToArray ());
222-
}
231+
}, out procStdOut);
232+
FileWriteLines ("./output/AndroidSupport.api-diff.html", procStdOut.ToArray ());
223233
}
224234
});
225235

0 commit comments

Comments
 (0)