Skip to content

Conversation

@jpobst
Copy link
Contributor

@jpobst jpobst commented May 15, 2020

Creates a new format for map.csv to make enumification easier and more audit-able. Details are in Documentation/EnumMappingFile.md.

Refactors and adds tests for existing map.csv format.

Creates a new Java.Interop.Tools.Common.dll to allow code sharing between assemblies. For example, the enum map file support and models should be shared between generator and forthcoming generator-utilities.

@jpobst jpobst force-pushed the enum-v2 branch 3 times, most recently from 84fbd8b to f61feda Compare May 15, 2020 19:15
@jpobst jpobst marked this pull request as ready for review May 18, 2020 15:34
@jonpryor jonpryor merged commit b00e644 into master May 19, 2020
@jonpryor jonpryor deleted the enum-v2 branch May 19, 2020 19:09
@jpobst jpobst added this to the 10.5 (16.8 / 8.8) milestone May 19, 2020
jonpryor pushed a commit that referenced this pull request May 26, 2020
For ages, `generator --enumfields` has supported a `map.csv` format,
which was used within xamarin-android to "enumify" `Mono.Android.dll`.

This format was entirely undocumented.

Add `Documentation/EnumMappingFile.md` and document the format.

The previous `map.csv` line is 5-6 "columns", comma-delimited:

  * API level the field was added in
  * C# namespace and type of the C# enum to create.
  * C# enum member name to create.
  * C# enum member value
  * JNI field to convert to the C# enum member, in the format
    `{JNI type reference}.{Java field name}`.
  * Flags?  If (1) present, and (2) has the value `flags`, the
    created C# enum has the `[Flags]` attribute.

Add support for a new 7-8 column line format, also documented in
`EnumMappingFile.md`:

  * Action: `E`num, `A`dd, `R`emove, `I`gnore, `?` (decide later)
  * API level
  * JNI field to convert to the C# enum member, in the format
    `{JNI type reference}.{Java field name}`.
  * C# enum member value (which is the Java field value)
  * C# namespace and type of C# enum to create
  * C# enum member name to create.
  * What to do with the Java field: `remove` it or `keep` it.
    Replaces the previous `- ENTER TRANSIENT MODE -` "command".
  * Flags?  If (1) present, and (2) has the value `flags`, the
    created C# enum has the `[Flags]` attribute.

Note that the column ordering for the 7-8 column format differs from
the previous 5-6 column format.  This change in ordering is done for
improved "enumification workflow" support: future tooling will
generate the 7-8 column output *without* knowing what the C# enum type
and members will be.  Placing the JNI information "leftmost" allows
the output to be "sensibly grouped" by tooling:

	?,0,com/example/Class.FIELD,0,,,remove,

Support for parsing `map.csv` has been moved out of `generator.exe`
and into the new `Java.Interop.Tools.Generator.dll` assembly, in
`src/Java.Interop.Tools.Generator`.  This new assembly will also be
used by a forthcoming `generator-utilities` app.
@github-actions github-actions bot locked and limited conversation to collaborators Apr 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants