Skip to content

Commit

Permalink
Merge pull request godotengine#64207 from bruvzg/rcs
Browse files Browse the repository at this point in the history
[macOS export] Simplify code signing options, add support for rcodesign tool for signing and notarization.
  • Loading branch information
akien-mga authored Aug 26, 2022
2 parents 1c97dde + d91cb1d commit 390333e
Show file tree
Hide file tree
Showing 16 changed files with 488 additions and 224 deletions.
1 change: 1 addition & 0 deletions core/core_constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ void register_global_constants() {
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_LOCALIZABLE_STRING);
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_NODE_TYPE);
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_HIDE_QUATERNION_EDIT);
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_PASSWORD);
BIND_CORE_ENUM_CONSTANT(PROPERTY_HINT_MAX);

BIND_CORE_ENUM_CONSTANT(PROPERTY_USAGE_NONE);
Expand Down
1 change: 1 addition & 0 deletions core/object/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ enum PropertyHint {
PROPERTY_HINT_LOCALIZABLE_STRING,
PROPERTY_HINT_NODE_TYPE, ///< a node object type
PROPERTY_HINT_HIDE_QUATERNION_EDIT, /// Only Node3D::transform should hide the quaternion editor.
PROPERTY_HINT_PASSWORD,
PROPERTY_HINT_MAX,
// When updating PropertyHint, also sync the hardcoded list in VisualScriptEditorVariableEdit
};
Expand Down
5 changes: 4 additions & 1 deletion doc/classes/@GlobalScope.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2711,7 +2711,10 @@
<constant name="PROPERTY_HINT_HIDE_QUATERNION_EDIT" value="45" enum="PropertyHint">
Hints that a quaternion property should disable the temporary euler editor.
</constant>
<constant name="PROPERTY_HINT_MAX" value="46" enum="PropertyHint">
<constant name="PROPERTY_HINT_PASSWORD" value="46" enum="PropertyHint">
Hints that a string property is a password, and every character is replaced with the secret character.
</constant>
<constant name="PROPERTY_HINT_MAX" value="47" enum="PropertyHint">
</constant>
<constant name="PROPERTY_USAGE_NONE" value="0" enum="PropertyUsageFlags">
</constant>
Expand Down
10 changes: 10 additions & 0 deletions editor/editor_properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ void EditorPropertyText::set_string_name(bool p_enabled) {
string_name = p_enabled;
}

void EditorPropertyText::set_secret(bool p_enabled) {
text->set_secret(p_enabled);
}

void EditorPropertyText::set_placeholder(const String &p_string) {
text->set_placeholder(p_string);
}
Expand Down Expand Up @@ -4408,6 +4412,9 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_
EditorPropertyText *editor = memnew(EditorPropertyText);
if (p_hint == PROPERTY_HINT_PLACEHOLDER_TEXT) {
editor->set_placeholder(p_hint_text);
} else if (p_hint == PROPERTY_HINT_PASSWORD) {
editor->set_secret(true);
editor->set_placeholder(p_hint_text);
}
return editor;
}
Expand Down Expand Up @@ -4532,6 +4539,9 @@ EditorProperty *EditorInspectorDefaultPlugin::get_editor_for_property(Object *p_
EditorPropertyText *editor = memnew(EditorPropertyText);
if (p_hint == PROPERTY_HINT_PLACEHOLDER_TEXT) {
editor->set_placeholder(p_hint_text);
} else if (p_hint == PROPERTY_HINT_PASSWORD) {
editor->set_secret(true);
editor->set_placeholder(p_hint_text);
}
editor->set_string_name(true);
return editor;
Expand Down
1 change: 1 addition & 0 deletions editor/editor_properties.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class EditorPropertyText : public EditorProperty {
void set_string_name(bool p_enabled);
virtual void update_property() override;
void set_placeholder(const String &p_string);
void set_secret(bool p_enabled);
EditorPropertyText();
};

Expand Down
6 changes: 6 additions & 0 deletions editor/editor_property_name_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["aabb"] = "AABB";
capitalize_string_remaps["adb"] = "ADB";
capitalize_string_remaps["ao"] = "AO";
capitalize_string_remaps["api"] = "API";
capitalize_string_remaps["apk"] = "APK";
capitalize_string_remaps["arm64-v8a"] = "arm64-v8a";
capitalize_string_remaps["armeabi-v7a"] = "armeabi-v7a";
Expand Down Expand Up @@ -191,11 +192,14 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["opengl"] = "OpenGL";
capitalize_string_remaps["opentype"] = "OpenType";
capitalize_string_remaps["openxr"] = "OpenXR";
capitalize_string_remaps["osslsigncode"] = "osslsigncode";
capitalize_string_remaps["pck"] = "PCK";
capitalize_string_remaps["png"] = "PNG";
capitalize_string_remaps["po2"] = "(Power of 2)"; // Unit.
capitalize_string_remaps["pvrtc"] = "PVRTC";
capitalize_string_remaps["pvs"] = "PVS";
capitalize_string_remaps["rcedit"] = "rcedit";
capitalize_string_remaps["rcodesign"] = "rcodesign";
capitalize_string_remaps["rgb"] = "RGB";
capitalize_string_remaps["rid"] = "RID";
capitalize_string_remaps["rmb"] = "RMB";
Expand All @@ -205,6 +209,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["sdfgi"] = "SDFGI";
capitalize_string_remaps["sdk"] = "SDK";
capitalize_string_remaps["sec"] = "(sec)"; // Unit.
capitalize_string_remaps["signtool"] = "signtool";
capitalize_string_remaps["sms"] = "SMS";
capitalize_string_remaps["srgb"] = "sRGB";
capitalize_string_remaps["ssao"] = "SSAO";
Expand Down Expand Up @@ -237,6 +242,7 @@ EditorPropertyNameProcessor::EditorPropertyNameProcessor() {
capitalize_string_remaps["webp"] = "WebP";
capitalize_string_remaps["webrtc"] = "WebRTC";
capitalize_string_remaps["websocket"] = "WebSocket";
capitalize_string_remaps["wine"] = "wine";
capitalize_string_remaps["wifi"] = "Wi-Fi";
capitalize_string_remaps["x86"] = "x86";
capitalize_string_remaps["xr"] = "XR";
Expand Down
2 changes: 2 additions & 0 deletions editor/export/editor_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,14 @@ void EditorExport::update_export_presets() {
// Clear the preset properties and values prior to reloading
preset->properties.clear();
preset->values.clear();
preset->update_visibility.clear();

for (const EditorExportPlatform::ExportOption &E : options) {
preset->properties.push_back(E.option);

StringName option_name = E.option.name;
preset->values[option_name] = previous_values.has(option_name) ? previous_values[option_name] : E.default_value;
preset->update_visibility[option_name] = E.update_visibility;
}
}
}
Expand Down
1 change: 1 addition & 0 deletions editor/export/editor_export_platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ Ref<EditorExportPreset> EditorExportPlatform::create_preset() {
for (const ExportOption &E : options) {
preset->properties.push_back(E.option);
preset->values[E.option.name] = E.default_value;
preset->update_visibility[E.option.name] = E.update_visibility;
}

return preset;
Expand Down
14 changes: 8 additions & 6 deletions editor/export/editor_export_platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,12 @@ class EditorExportPlatform : public RefCounted {
struct ExportOption {
PropertyInfo option;
Variant default_value;
bool update_visibility = false;

ExportOption(const PropertyInfo &p_info, const Variant &p_default) :
ExportOption(const PropertyInfo &p_info, const Variant &p_default, bool p_update_visibility = false) :
option(p_info),
default_value(p_default) {
default_value(p_default),
update_visibility(p_update_visibility) {
}
ExportOption() {}
};
Expand All @@ -136,13 +138,13 @@ class EditorExportPlatform : public RefCounted {
messages.push_back(msg);
switch (p_type) {
case EXPORT_MESSAGE_INFO: {
print_line(vformat("%s: %s\n", msg.category, msg.text));
print_line(vformat("%s: %s", msg.category, msg.text));
} break;
case EXPORT_MESSAGE_WARNING: {
WARN_PRINT(vformat("%s: %s\n", msg.category, msg.text));
WARN_PRINT(vformat("%s: %s", msg.category, msg.text));
} break;
case EXPORT_MESSAGE_ERROR: {
ERR_PRINT(vformat("%s: %s\n", msg.category, msg.text));
ERR_PRINT(vformat("%s: %s", msg.category, msg.text));
} break;
default:
break;
Expand Down Expand Up @@ -170,7 +172,7 @@ class EditorExportPlatform : public RefCounted {

virtual void get_export_options(List<ExportOption> *r_options) = 0;
virtual bool should_update_export_options() { return false; }
virtual bool get_export_option_visibility(const String &p_option, const HashMap<StringName, Variant> &p_options) const { return true; }
virtual bool get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option, const HashMap<StringName, Variant> &p_options) const { return true; }

virtual String get_os_name() const = 0;
virtual String get_name() const = 0;
Expand Down
5 changes: 4 additions & 1 deletion editor/export/editor_export_preset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ bool EditorExportPreset::_set(const StringName &p_name, const Variant &p_value)
if (values.has(p_name)) {
values[p_name] = p_value;
EditorExport::singleton->save_presets();
if (update_visibility[p_name]) {
notify_property_list_changed();
}
return true;
}

Expand All @@ -51,7 +54,7 @@ bool EditorExportPreset::_get(const StringName &p_name, Variant &r_ret) const {

void EditorExportPreset::_get_property_list(List<PropertyInfo> *p_list) const {
for (const PropertyInfo &E : properties) {
if (platform->get_export_option_visibility(E.name, values)) {
if (platform->get_export_option_visibility(this, E.name, values)) {
p_list->push_back(E);
}
}
Expand Down
1 change: 1 addition & 0 deletions editor/export/editor_export_preset.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class EditorExportPreset : public RefCounted {

List<PropertyInfo> properties;
HashMap<StringName, Variant> values;
HashMap<StringName, bool> update_visibility;

String name;

Expand Down
8 changes: 6 additions & 2 deletions platform/macos/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@
#include "export_plugin.h"

void register_macos_exporter() {
EDITOR_DEF("export/macos/force_builtin_codesign", false);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::BOOL, "export/macos/force_builtin_codesign", PROPERTY_HINT_NONE));
EDITOR_DEF("export/macos/rcodesign", "");
#ifdef WINDOWS_ENABLED
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/macos/rcodesign", PROPERTY_HINT_GLOBAL_FILE, "*.exe"));
#else
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING, "export/macos/rcodesign", PROPERTY_HINT_GLOBAL_FILE));
#endif

Ref<EditorExportPlatformMacOS> platform;
platform.instantiate();
Expand Down
Loading

0 comments on commit 390333e

Please sign in to comment.