Skip to content
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

[jcw-gen] use Assembly Name instead of FullName for typemaps #227

Merged
merged 1 commit into from
Dec 20, 2017

Commits on Dec 18, 2017

  1. [jcw-gen] use Assembly Name instead of FullName for typemaps

    Context: https://bugzilla.xamarin.com/show_bug.cgi?id=61073
    
    The Java-to-Managed typemaps list types such as:
    ```
    android/app/Activity
    Android.App.Activity, Mono.Android, Version=0.0.0.0, Culture=neutral,
    PublicKeyToken=84e04ff9cfb79065
    ```
    
    Let’s assume you have an Android project with the following
    assembly-level attribute:
    ```
    [assembly:AssemblyVersion("1.0.0.*")]
    ```
    
    Then on *every* build, the typemap is invalidated because your version
    number has been incremented.
    
    The fix here is to use the assembly’s short name via `GetName ().Name`
    or Mono.Cecil’s equivalent `AssemblyDefinition.Name.Name`. So the above
    typemap would only be `Android.App.Activity, Mono.Android`. These
    changes needed to happen in both `JavaNativeTypeManager` and
    `TypeNameMapGenerator`.
    
    The final fix is to find *every* instance of
    `TypeDefinitionRocks.GetAssemblyQualifiedName` and use
    `TypeDefinitionRocks.GetPartialAssemblyQualifiedName` in its place.
    The latter also had the issue of needing to replace the `/` character
    with `+`, so both methods return valid nested type names.
    jonathanpeppers committed Dec 18, 2017
    Configuration menu
    Copy the full SHA
    364b645 View commit details
    Browse the repository at this point in the history