-
Notifications
You must be signed in to change notification settings - Fork 564
Remove DroidDoc dependencies from enumification helpers. #1044
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
Remove DroidDoc dependencies from enumification helpers. #1044
Conversation
Changes in enumification-helpers and applying the changes from the new tools dotnet/android#1044 results in https://jenkins.mono-project.com/job/xamarin-android-pr-builder/2106/ : 17:49:44 ABI BREAK IN: Mono.Android.dll 17:49:46 <!-- start namespace Android.Views --> <div> 17:49:46 <h2>Namespace Android.Views</h2> 17:49:46 <!-- start type Display --> <div> 17:49:46 <h3>Type Changed: Android.Views.Display</h3> 17:49:46 <p>Removed field:</p> 17:49:46 17:49:46 <pre> 17:49:46 <span class='removed removed-field breaking' data-is-breaking>public static const int StateDozing;</span> 17:49:46 </pre> 17:49:46 17:49:46 </div> <!-- end type Display --> 17:49:46 <!-- start type View --> <div> 17:49:46 <h3>Type Changed: Android.Views.View</h3> 17:49:46 <p>Modified fields:</p> 17:49:46 <pre> 17:49:46 <div data-is-breaking> public const <span class='removed removed-inline removed-breaking-inline'>int</span> <span class='added '>TextAlignment</span> TextAlignmentResolvedDefault = 131072; 17:49:46 </div></pre> 17:49:46 17:49:46 </div> <!-- end type View --> 17:49:46 <!-- start type WindowManagerLayoutParams --> <div> 17:49:46 <h3>Type Changed: Android.Views.WindowManagerLayoutParams</h3> 17:49:46 <p>Removed field:</p> 17:49:46 17:49:46 <pre> 17:49:46 <span class='removed removed-field breaking' data-is-breaking>public static const int TypeKeyguard;</span> 17:49:46 </pre> 17:49:46 17:49:46 </div> <!-- end type WindowManagerLayoutParams --> 17:49:46 17:49:46 </div> <!-- end namespace Android.Views --> 17:49:47 make[2]: *** [check] Error 1 17:49:47 make[1]: *** [run-api-compatibility-tests] Error 2 17:49:47 make: *** [run-all-tests] Error 2 17:49:47 + exit 1 But what are they? - STATE_DOZING in https://developer.android.com/reference/android/view/Display.html ... it doesn't exist! - TEXT_ALIGNMENT_RESOLVED_DEFAULT in https://developer.android.com/reference/android/view/View.html ... ditto! - TYPE_KEYGUARD in https://developer.android.com/reference/android/view/WindowManager.LayoutParams.html ... neither! They are all false alarm. They should vanish.
I don't understand this: Why did these lines need to change at all? |
| @@ -71,19 +49,6 @@ | |||
| 0,,,android/view/Surface.FX_SURFACE_MASK,98304 | |||
| 0,,,android/view/Surface.FX_SURFACE_NORMAL,0 | |||
|
|
|||
| 18,Android.Hardware.Location.GeofenceTransition,Entered,android/hardware/location/GeofenceHardware.GEOFENCE_ENTERED,1 | |||
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.
Why did this "block" of mappings need to be moved, or otherwise touched? It makes for a noisier diff.
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.
Those lines above around line # 100 were manually added because they could not be automatically generated (because, they didn't exist in DroidDoc anymore!).
Now we generate enum const list based on api-*.xml.in they can be automatically generated again and therefore they went below # 100. It is a good thing!
| // - Automatically generated mappings (see tools/enumification-helpers how map.ext.csv is generated.) | ||
|
|
||
| 1,Org.XmlPull.V1.XmlPullParserNode,Cdsect,I:org/xmlpull/v1/XmlPullParser.CDSECT,5 |
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.
As per a previous comment, I don't understand why the first column here actually needed to change.
|
|
||
| static string GetApiLevel (string file) | ||
| { | ||
| Console.Error.WriteLine ($"[{file}]"); |
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.
Do you still need this debug spew?
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.
It's not a big deal, we (well most likely only I) use it only when we are going to deal with new API for enumification.
I believe that this is a non-issue, as we only generate We don't currently emit In a post PR #1032 world, we'll replace all instances of |
|
It would be nice if the documentation could be updated to explain the use/workflow of the XML files that |
From the "data" perspective they don't have to change, but for "tools" perspective there is nothing else we CAN do. There is only filename that could give us API level information in api-*.xml.in. And we don't have api-1.xml.in, api-4.xml,in, api-20.xml.in etc. |
No, that's not going to happen because we still don't have api-1.xml.in. |
Good call! It will be updated. |
1582d0d to
f9b92bd
Compare
api-*.xml.in can be generated dynamically (up to [*1]) but enumification helper tools still depended on DroidDoc, meaning that we cannot remove package download dependencies. This fixes the situation by eliminating the dependencies. Especially it is easier to just parse api-*.xml.in to extract int consts from Java API. ... thought so? It turnd out to not be that easy. Unlike DroidDoc, api-*.xml.in does not contain "api-since" information, so we need to parse ALL the API XML. And they cannot be **precise** because we only have a subset of the API definitions. For example, "since API Level 1" now becomes "since API Level 10" because we don't have api-1.xml.in (not even api-4.xml.in). So they will become non-precise. (A slightly better possibility to "fix" this is to parse `android-sdk-whatever/platform-tools/api/api-versions.xml`, but it won't contain "already vanished" constants so it will be incomplete either. I didn't bother to do "better" so far. We don't need that for enumification.) Therefore, there is a lot of changes in `map.csv` to reflect those "insignificant" changes to remap "API since" column (e.g. from "1" to "10"). Regeneration from api-LEVEL.xml.in instead of DroidDoc has some other side effects; some consts are back to the list so that we don't have to manually copy existing mapped consts that could not be generated from the latest DroidDocs (due to disappearance) anymore. Instead we have to remove manually-mapped constants (either from the sources or `map.csv`). Therefore, a handful of heading lines in `map.csv` were removed, and some definitions in `enum-conversion-mappings.xml` are back. [*1] dotnet#1038
f9b92bd to
209a285
Compare
|
@atsushieno wrote:
That doesn't matter. We currently emit $ grep -r -E '\[Register.*ApiSince = 1\)' src/Mono.Android/obj/Debug/android-27/mcw
src/Mono.Android/obj/Debug/android-27/mcw/Android.App.DatePickerDialog.cs: [Register ("android/app/DatePickerDialog$OnDateSetListener", "", "Android.App.DatePickerDialog/IOnDateSetListenerInvoker", ApiSince = 1)]
src/Mono.Android/obj/Debug/android-27/mcw/Android.App.KeyguardManager.cs: [Register ("android/app/KeyguardManager$OnKeyguardExitResult", "", "Android.App.KeyguardManager/IOnKeyguardExitResultInvoker", ApiSince = 1)]
...There are 464 instances of They are instead coming from <class name="android/app/DatePickerDialog$OnDateSetListener" since="1">
<extends name="java/lang/Object" />
<method name="onDateSet(Landroid/widget/DatePicker;III)V" />
</class>Again, I reiterate: I do not believe that |
|
You don't really understand what I have been writing. map.csv is NOT generated BY generator. It WAS generated by scraping DroidDoc which HAD "since" section. api-*.xml.in does NOT have that information. There is NO SOURCE that retrieves that information. Note that api-versions.xml does not contain any information about old API. |
Indeed.
This implies that The first comment in If If |
|
Everyone can track git history and see how those things are made changes. Did you add "it is automatically generated" comments on EVERYTHING you make it to generate? Which is automatically generated for If you want to add those lines you can create a PR and ask me for merging permission. |
No, I can't. Git history isn't going to contain what commands were used to generate the changes, or when those commands were executed, or what the implications are. That's what documentation is for (previously requested). I've been under the assumption that everything in All I see from git history and PRs is that
Good point. I should update everything to do so. |
|
The updated documentation is in this revised PR. |
|
It is going to be unnecessary once PR #1045 gets merged as it contains this change too. |
|
Superceded by #1045 |
api-*.xml.in can be generated dynamically (up to [1]) but enumification
helper tools still depended on DroidDoc, meaning that we cannot remove
package download dependencies. This fixes the situation by eliminating
the dependencies. Especially it is easier to just parse api-.xml.in to
extract int consts from Java API.
... thought so? It turnd out to not be that easy.
Unlike DroidDoc, api-*.xml.in does not contain "api-since" information,
so we need to parse ALL the API XML. And they cannot be precise
because we only have a subset of the API definitions. For example,
"since API Level 1" now becomes "since API Level 10" because we don't
have api-1.xml.in (not even api-4.xml.in). So they will become non-precise.
(A slightly better possibility to "fix" this is to parse
android-sdk-whatever/platform-tools/api/api-versions.xml, but it won'tcontain "already vanished" constants so it will be incomplete either.
I didn't bother to do "better" so far. We don't need that for enumification.)
Therefore, there is a lot of changes in
map.csvto reflect those"insignificant" changes to remap "API since" column (e.g. from "1" to "10").
Regeneration from api-LEVEL.xml.in instead of DroidDoc has some other
side effects; some consts are back to the list so that we don't have to
manually copy existing mapped consts that could not be generated from
the latest DroidDocs (due to disappearance) anymore. Instead we have to
remove manually-mapped constants (either from the sources or
map.csv).Therefore, a handful of heading lines in
map.csvwere removed, andsome definitions in
enum-conversion-mappings.xmlare back.[*1] #1038