Skip to content

Commit

Permalink
Merge pull request #82762 from raulsntos/dotnet/android-ux
Browse files Browse the repository at this point in the history
C#: Add checks to Android export
  • Loading branch information
akien-mga committed Oct 10, 2023
2 parents 6b727eb + cea77d0 commit 7233001
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ public static ProjectRootElement GenGameProject(string name)

var mainGroup = root.AddPropertyGroup();
mainGroup.AddProperty("TargetFramework", "net6.0");
mainGroup.AddProperty("EnableDynamicLoading", "true");

var net7 = mainGroup.AddProperty("TargetFramework", "net7.0");
net7.Condition = " '$(GodotTargetPlatform)' == 'android' ";

var net8 = mainGroup.AddProperty("TargetFramework", "net8.0");
net8.Condition = " '$(GodotTargetPlatform)' == 'ios' ";

mainGroup.AddProperty("EnableDynamicLoading", "true");

string sanitizedName = IdentifierUtils.SanitizeQualifiedIdentifier(name, allowEmptyIdentifiers: true);

// If the name is not a valid namespace, manually set RootNamespace to a sanitized one.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private void _ExportBeginImpl(string[] features, bool isDebug, string path, long

List<string> outputPaths = new();

bool embedBuildResults = (bool)GetOption("dotnet/embed_build_outputs") || features.Contains("android");
bool embedBuildResults = (bool)GetOption("dotnet/embed_build_outputs") || platform == OS.Platforms.Android;

foreach (PublishConfig config in targets)
{
Expand Down
13 changes: 13 additions & 0 deletions platform/android/export/export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2238,6 +2238,19 @@ bool EditorExportPlatformAndroid::has_valid_export_configuration(const Ref<Edito
#ifdef MODULE_MONO_ENABLED
// Android export is still a work in progress, keep a message as a warning.
err += TTR("Exporting to Android when using C#/.NET is experimental.") + "\n";

bool unsupported_arch = false;
Vector<ABI> enabled_abis = get_enabled_abis(p_preset);
for (ABI abi : enabled_abis) {
if (abi.arch != "arm64" && abi.arch != "x86_64") {
err += vformat(TTR("Android architecture %s not supported in C# projects."), abi.arch) + "\n";
unsupported_arch = true;
}
}
if (unsupported_arch) {
r_error = err;
return false;
}
#endif

// Look for export templates (first official, and if defined custom templates).
Expand Down

0 comments on commit 7233001

Please sign in to comment.