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

[Xamarin.Android.Build.Tasks] delay ToJniName calls in ManifestDocument #7653

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/Xamarin.Android.Build.Tasks/Utilities/ManifestDocument.cs
Expand Up @@ -336,17 +336,20 @@ public IList<string> Merge (TaskLoggingHelper log, TypeDefinitionCache cache, Li
if (PackageName == null)
PackageName = t.Namespace;

var name = JavaNativeTypeManager.ToJniName (t, cache).Replace ('/', '.');
var compatName = JavaNativeTypeManager.ToCompatJniName (t, cache).Replace ('/', '.');
if (((string) app.Attribute (attName)) == compatName) {
app.SetAttributeValue (attName, name);
if (t.IsSubclassOf ("Android.App.Application", cache)) {
(string name, string compatName) = GetNames (t, cache);
if (((string) app.Attribute (attName)) == compatName) {
app.SetAttributeValue (attName, name);
}
continue;
}

Func<TypeDefinition, string, int, XElement> generator = GetGenerator (t, cache);
if (generator == null)
continue;

try {
(string name, string compatName) = GetNames (t, cache);
// activity not present: create a launcher for it IFF it has attribute
if (!existingTypes.Contains (name) && !existingTypes.Contains (compatName)) {
XElement fromCode = generator (t, name, targetSdkVersionValue);
Expand Down Expand Up @@ -481,6 +484,11 @@ SequencePoint FindSource (IEnumerable<MethodDefinition> methods)
}
}

(string name, string compatName) GetNames(TypeDefinition type, TypeDefinitionCache cache) => (
JavaNativeTypeManager.ToJniName (type, cache).Replace ('/', '.'),
JavaNativeTypeManager.ToCompatJniName (type, cache).Replace ('/', '.')
);

// FIXME: our manifest merger is hacky.
// To support complete manifest merger, we will have to implement fairly complicated one, described at
// http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger
Expand Down