-
Notifications
You must be signed in to change notification settings - Fork 564
[Xamarin.Android.Build.Tests] Fix the processing of the build.log files. #968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| data.Initialize (); | ||
| fs.Read (data, 0, 1024); | ||
| var line = System.Text.Encoding.UTF8.GetString (data); | ||
| Console.WriteLine (line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a debugging leftover or why do we print the line here?
| var data =new byte [1024]; | ||
| while (fs.Position > 0) { | ||
| data.Initialize (); | ||
| fs.Read (data, 0, 1024); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be data.Length, not 1024.
| using (var fs = File.OpenRead (buildLogFullPath)) { | ||
| var data = new byte [1024]; | ||
| fs.Seek (data.Length, SeekOrigin.End); | ||
| while (fs.Position > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once concern here; assume a file that is < 1KB in size. The preceding fs.Seek(data.Length, SeekOrigin.End) will throw an ArgumentException (doh!), so it should probably instead be:
fs.Seek (Math.Min (data.Length, fs.Length), SeekOrigin.End);Additionally, if/when that happens, fs.Position will be 0 (beginning of file), which means while (fs.Position > 0) will skip over the file contents and nothing will be parsed.
So long as the file is > 1KB in size, we're fine, but if it isn't...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to a do while. and changed the seek too.
| sb.AppendFormat ("\n#stderr begin\n{0}\n#stderr end\n", p.StandardError.ReadToEnd ()); | ||
|
|
||
| Console.WriteLine ("Searching for Time Elapsed"); | ||
| using (var fs = File.OpenRead (buildLogFullPath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can buildLogFullPath be null? It's checked against null both earlier and later in this method, but it's not checked here, and thus could plausibly result in an ArgumentNullException.
Should this using block be merged with the one above, on lines 228-235 of the new file? The earlier loop reads each line individually; we could simply merge the Time Elapsed check there, and use line.StartsWith("Time Elapsed") for good measure.
Commit 029c86f kinda caused a perforanace problem because it was regex'ing the entire build log. Some of those logs can grow to 300+ meg in size. This commit reworks the build log processing to 1) Use a StringBuilder rather than concat strings. 2) Search for the build time by checking each line rarther than regex'ing the whole file.
|
build |
…#968) Attempt to quasi-"optimize" `Builder.BuildInternal()`: if we're going to read `buildLogFullPath` a line at a time *anyway* -- to collect the log file for later parsing into `Builder.LastBuildOutput` -- then we should also do any associated line-oriented parsing as well. Update `buildLogFullPath` processing to use a `StringBuilder` instead of string concatenation, and search for the `Time Elapsed` message while reading the file, instead of separately, *after* having read the entire build log into memory.
Fixes: dotnet/java-interop#967 Changes: dotnet/java-interop@05bfece...05eddd9 * dotnet/java-interop@05eddd9a: [generator] Add string cast to prevent CS1503 (dotnet#970) * dotnet/java-interop@37cff251: [Java.Base, generator] Bind all of package java.io (dotnet#968) * dotnet/java-interop@a65d6fb4: [Java.Base, generator] Bind all of package java.lang (dotnet#966) * dotnet/java-interop@ed9c2abf: [Java.Interop-MonoAndroid] Set Version after Directory.Build.props (dotnet#965)
Fixes: dotnet/java-interop#967 Changes: dotnet/java-interop@05bfece...05eddd9 * dotnet/java-interop@05eddd9a: [generator] Add string cast to prevent CS1503 (dotnet#970) * dotnet/java-interop@37cff251: [Java.Base, generator] Bind all of package java.io (dotnet#968) * dotnet/java-interop@a65d6fb4: [Java.Base, generator] Bind all of package java.lang (dotnet#966) * dotnet/java-interop@ed9c2abf: [Java.Interop-MonoAndroid] Set Version after Directory.Build.props (dotnet#965)
Fixes: dotnet/java-interop#967 Changes: dotnet/java-interop@05bfece...2a882d2 * dotnet/java-interop@2a882d2d: [generator] Fix xamarin-android/src/Mono.Android build (dotnet#972) * dotnet/java-interop@968e0f5f: [Directory.Build.props] Set dummy $(PackageVersion) to appease NuGet (dotnet#971) * dotnet/java-interop@05eddd9a: [generator] Add string cast to prevent CS1503 (dotnet#970) * dotnet/java-interop@37cff251: [Java.Base, generator] Bind all of package java.io (dotnet#968) * dotnet/java-interop@a65d6fb4: [Java.Base, generator] Bind all of package java.lang (dotnet#966) * dotnet/java-interop@ed9c2abf: [Java.Interop-MonoAndroid] Set Version after Directory.Build.props (dotnet#965)
Fixes: dotnet/java-interop#967 Changes: dotnet/java-interop@05bfece...2a882d2 * dotnet/java-interop@2a882d2d: [generator] Fix xamarin-android/src/Mono.Android build (#972) * dotnet/java-interop@968e0f5f: [Directory.Build.props] Set dummy $(PackageVersion) to appease NuGet (#971) * dotnet/java-interop@05eddd9a: [generator] Add string cast to prevent CS1503 (#970) * dotnet/java-interop@37cff251: [Java.Base, generator] Bind all of package java.io (#968) * dotnet/java-interop@a65d6fb4: [Java.Base, generator] Bind all of package java.lang (#966) * dotnet/java-interop@ed9c2abf: [Java.Interop-MonoAndroid] Set Version after Directory.Build.props (#965)
Fixes: dotnet/java-interop#967 Changes: dotnet/java-interop@05bfece...2a882d2 * dotnet/java-interop@2a882d2d: [generator] Fix xamarin-android/src/Mono.Android build (#972) * dotnet/java-interop@968e0f5f: [Directory.Build.props] Set dummy $(PackageVersion) to appease NuGet (#971) * dotnet/java-interop@05eddd9a: [generator] Add string cast to prevent CS1503 (#970) * dotnet/java-interop@37cff251: [Java.Base, generator] Bind all of package java.io (#968) * dotnet/java-interop@a65d6fb4: [Java.Base, generator] Bind all of package java.lang (#966) * dotnet/java-interop@ed9c2abf: [Java.Interop-MonoAndroid] Set Version after Directory.Build.props (#965)
Commit 029c86f kinda caused a perforanace problem because it
was regex'ing the entire build log. Some of those logs can
grow to 300+ meg in size.
This commit reworks the build log processing to
Hopefully this will improve things.