You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=30909
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=51293
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=55473
Bump to xamarin-android-api-compatibility/master/6fe9b17f.
Add `Documentation/HowToAddNewApiLevel.md`, to describe the process
for binding new API levels, including enumification.
Enumify API-26.
Update `build-tools/enumification-helpers` to support the latest
droiddoc `packages.html` format.
API-26 changed `Activity.findViewById(int)` to be a generic method.
Remove the `<typeParameters/>` element and "fix" the return type so
that we don't break API compatibility, as `generator` doesn't
currently do anything sane here. (Specifically, all generic
paramaters are currently bound as `Java.Lang.Object`, *even if* the
type parameter has a constraint which provides a more specific type!)
Fix binding of `Java.Nio.FileChannel` so it can be actually bound,
related `SeekableByteChannel` support fixes.
Remove `//implements[@name='AutoCloseable']` and
`//implements[@name='Destryable']`, as they add Java `default`
interface methods which can't be sanely supported at this time.
Update `api-merge` to change `default` interface methods to
non-`default` methods when merging with an older API level which
contained the non-`default` interface method. This preserves backward
compatibility with existing assemblies and source code. Remove the
associated workarounds.
Bump xamarin-android-api-compatibility to check against the
latest-and-greatest API-26 binding.
In Xamarin ages, we used to have (more complete) API upgrade guide internally. But since then we switched to new xamarin-android repository which entirely changed the build system from Makefile to MSBuild solution, as well as the managed API for manipulating Android SDK, the old documentation almost does not make sense anymore. Even though I am writing this documentation, I don't know everything required (nor those who changed the build system didn't care about API upgrades).
7
+
8
+
Hence, this documentation is written from the ground, exploring everything around.
9
+
10
+
And since the build system has changed between the first preview of Android O and the latest Android O preview (3), and it is quite possible that the build system changes over and over again, it might still not make much sense in the future.
11
+
12
+
## Steps
13
+
14
+
Anyhow, this commit would tell you what needs to be changed when the new API preview arrives (and that becomes stable): https://github.com/xamarin/xamarin-android/pull/642
15
+
16
+
1) Add/update new download to build-tools/android-toolchain.
17
+
The new API archive should be found on the web repository description
18
+
that Google Android SDK Manager uses (which can be now shown as part
19
+
of SDK Manager options in Android Studio).
20
+
21
+
As of Android O ages, it could be found at https://dl-ssl.google.com/android/repository/repository2-1.xml . It used to be different repository description URL, and it will be different URL in the future.
22
+
23
+
2) Create and add api-O.xml.in under src/Mono.Android/Profile directory.
24
+
It can be done from within `build-tools/api-xml-adjuster` directory. See `README.md` in that directory for details. You will have to make changes to Makefile in that directory to generate it. Also note that it often happens that Google does not ship documentation archive (!) and in such case we will have to scrape DroidDoc from the web and create our own docs archive.
25
+
26
+
3) Review new API (or review the changes in case of API updates).
27
+
28
+
Some of the changes are caused by API removal. Usually they come with
29
+
"deprecated" state in the previous API Level first, but that's not always true.
30
+
31
+
4) enumification: See `build-tools/enumification-helpers/README`.
Copy file name to clipboardExpand all lines: build-tools/enumification-helpers/README
+19Lines changed: 19 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -193,6 +193,16 @@ The results are to be saved as "map.ext.csv" and "methodmap.ext.csv" that are to
193
193
after "// automatically generated ones" line) just edit map.csv.
194
194
- then run "make API_LEVELS=[latest] clean all" in src/Mono.Android
195
195
to build enumified dll.
196
+
- note tht API Level description in the API docs are used to
197
+
become part of the CSV entry. The first item is the API Level.
198
+
That often brings problem. This is what happened when API Level
199
+
26 as stable has arrived: Google had published "android-26" API
200
+
which used to be "android-O", they still hadn't published the
201
+
corresponding docs and therefore the docs say "O" but the actual
202
+
API was "26". That later brought confusion at generator.exe ran.
203
+
To workaround this issue, replace the wrong API level specifier
204
+
(e.g. "O") with the actual API level (e.g. "26"). Use regex like
205
+
/^O/26/ to achieve this.
196
206
- go back to this directory and rebuild remaining-int-consts.txt
197
207
and check if the enumified lines disappeared.
198
208
- There are some constaints that are NOT enumified
@@ -221,6 +231,15 @@ The results are to be saved as "map.ext.csv" and "methodmap.ext.csv" that are to
221
231
convert to enums" methods, or blacklist-field.txt for fields.
222
232
- in general those notes do not describe *everything*. git diff
223
233
would tell what is new and what should be taken care this time.
234
+
- Here is how I worked on it at API Level 26 to add new lines to methodmap.ext.csv:
235
+
- Read git diff on remaining-int-consts.txt to iterate all the new enum types.
236
+
- For each new enum type that (typically) has prefix P_ in type T, I run `grep -R P_ | grep T | grep "\w*.html:"` in the local reference docs, to see which documentation HTML mention that const (I ran the command on GNOME terminal, so I got the final grep matches with color highlights).
237
+
- And for each HTML doc, look up that const and add records to methodmap.ext.csv.
238
+
- I usually bring in mistakes. When there are wrong const mappings, they will result in binding generator warnings for unmatched XPath selectors that you can find them by looking up enummetadata.
239
+
- For method mappings, mistakes can be twofolds:
240
+
- For the wrong matching, you'll see them as binding generator warnings for unmatched XPath selectors just like const mappings.
241
+
- For the wrong replacement enum type, that's NOT going to be unmatched XPath. Instead it will result in a reference to missing type warning that can be still found as a generator warning (but harder to find).
242
+
- It is often hard to identify why the mappings are regarded as invalid; sometimes Google API reference tells you lies(!) that there are some methods that actually don't exist(!). You'd like to check `obj/Debug/android-*/api.xml`, `obj/Debug/android-*/api.xml.fixed` (XML after applying metadata fixup) or `Profiles/api-*.xml.in` (for "raw" API data before `api-merge` step).
224
243
- At some stage, go to src/Mono.Android and append
225
244
methodmap.ext.csv contents to methodmap.csv and run
226
245
"make API_LEVELS=[latest] clean all" to get enumified dll.
0 commit comments