Skip to content

Commit aba7c90

Browse files
authored
Merge pull request #84 from jss2a98aj/cherry-pick-4.4-cicd
[4.4 backport] Assorted CICD fixes
2 parents fd95bb9 + eabf05a commit aba7c90

File tree

7 files changed

+55
-21
lines changed

7 files changed

+55
-21
lines changed

modules/mono/build_scripts/build_assemblies.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def run_msbuild(tools: ToolsLocation, sln: str, chdir_to: str, msbuild_args: Opt
194194
return subprocess.call(args, env=msbuild_env, cwd=chdir_to)
195195

196196

197-
def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision):
197+
def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision, no_deprecated):
198198
target_filenames = [
199199
"GodotSharp.dll",
200200
"GodotSharp.pdb",
@@ -217,6 +217,8 @@ def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, pre
217217
args += ["/p:ClearNuGetLocalCache=true", "/p:PushNuGetToLocalSource=" + push_nupkgs_local]
218218
if precision == "double":
219219
args += ["/p:GodotFloat64=true"]
220+
if no_deprecated:
221+
args += ["/p:GodotNoDeprecated=true"]
220222

221223
sln = os.path.join(module_dir, "glue/GodotSharp/GodotSharp.sln")
222224
exit_code = run_msbuild(msbuild_tool, sln=sln, chdir_to=module_dir, msbuild_args=args)
@@ -336,12 +338,14 @@ def generate_sdk_package_versions():
336338
f.write(constants)
337339

338340

339-
def build_all(msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, push_nupkgs_local, precision):
341+
def build_all(
342+
msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, push_nupkgs_local, precision, no_deprecated
343+
):
340344
# Generate SdkPackageVersions.props and VersionDocsUrl constant
341345
generate_sdk_package_versions()
342346

343347
# Godot API
344-
exit_code = build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision)
348+
exit_code = build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local, precision, no_deprecated)
345349
if exit_code != 0:
346350
return exit_code
347351

@@ -364,6 +368,8 @@ def build_all(msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, p
364368
args += ["/p:ClearNuGetLocalCache=true", "/p:PushNuGetToLocalSource=" + push_nupkgs_local]
365369
if precision == "double":
366370
args += ["/p:GodotFloat64=true"]
371+
if no_deprecated:
372+
args += ["/p:GodotNoDeprecated=true"]
367373
sln = os.path.join(module_dir, "editor/Godot.NET.Sdk/Godot.NET.Sdk.sln")
368374
exit_code = run_msbuild(msbuild_tool, sln=sln, chdir_to=module_dir, msbuild_args=args)
369375
if exit_code != 0:
@@ -390,6 +396,12 @@ def main():
390396
parser.add_argument(
391397
"--precision", type=str, default="single", choices=["single", "double"], help="Floating-point precision level"
392398
)
399+
parser.add_argument(
400+
"--no-deprecated",
401+
action="store_true",
402+
default=False,
403+
help="Build GodotSharp without using deprecated features. This is required, if the engine was built with 'deprecated=no'.",
404+
)
393405

394406
args = parser.parse_args()
395407

@@ -414,6 +426,7 @@ def main():
414426
args.dev_debug,
415427
push_nupkgs_local,
416428
args.precision,
429+
args.no_deprecated,
417430
)
418431
sys.exit(exit_code)
419432

modules/mono/editor/bindings_generator.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ Error BindingsGenerator::_populate_method_icalls_table(const TypeInterface &p_it
14521452
}
14531453

14541454
const TypeInterface *return_type = _get_type_or_null(imethod.return_type);
1455-
ERR_FAIL_NULL_V(return_type, ERR_BUG); // Return type not found
1455+
ERR_FAIL_NULL_V_MSG(return_type, ERR_BUG, "Return type '" + imethod.return_type.cname + "' was not found.");
14561456

14571457
String im_unique_sig = get_ret_unique_sig(return_type) + ",CallMethodBind";
14581458

@@ -1463,7 +1463,7 @@ Error BindingsGenerator::_populate_method_icalls_table(const TypeInterface &p_it
14631463
// Get arguments information
14641464
for (const ArgumentInterface &iarg : imethod.arguments) {
14651465
const TypeInterface *arg_type = _get_type_or_null(iarg.type);
1466-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Argument type not found
1466+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + iarg.type.cname + "' was not found.");
14671467

14681468
im_unique_sig += ",";
14691469
im_unique_sig += get_arg_unique_sig(*arg_type);
@@ -2313,7 +2313,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
23132313
const ArgumentInterface &iarg = *itr;
23142314

23152315
const TypeInterface *arg_type = _get_type_or_null(iarg.type);
2316-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Argument type not found
2316+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + iarg.type.cname + "' was not found.");
23172317

23182318
if (i != 0) {
23192319
output << ", ";
@@ -2333,7 +2333,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
23332333

23342334
if (imethod.return_type.cname != name_cache.type_void) {
23352335
const TypeInterface *return_type = _get_type_or_null(imethod.return_type);
2336-
ERR_FAIL_NULL_V(return_type, ERR_BUG); // Return type not found
2336+
ERR_FAIL_NULL_V_MSG(return_type, ERR_BUG, "Return type '" + imethod.return_type.cname + "' was not found.");
23372337

23382338
output << INDENT3 "ret = "
23392339
<< sformat(return_type->cs_managed_to_variant, "callRet", return_type->cs_type, return_type->name)
@@ -2552,7 +2552,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
25522552
const TypeReference &proptype_name = getter ? getter->return_type : setter->arguments.back()->get().type;
25532553

25542554
const TypeInterface *prop_itype = _get_type_or_singleton_or_null(proptype_name);
2555-
ERR_FAIL_NULL_V(prop_itype, ERR_BUG); // Property type not found
2555+
ERR_FAIL_NULL_V_MSG(prop_itype, ERR_BUG, "Property type '" + proptype_name.cname + "' was not found.");
25562556

25572557
ERR_FAIL_COND_V_MSG(prop_itype->is_singleton, ERR_BUG,
25582558
"Property type is a singleton: '" + p_itype.name + "." + String(p_iprop.cname) + "'.");
@@ -2651,7 +2651,7 @@ Error BindingsGenerator::_generate_cs_property(const BindingsGenerator::TypeInte
26512651

26522652
Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterface &p_itype, const BindingsGenerator::MethodInterface &p_imethod, int &p_method_bind_count, StringBuilder &p_output) {
26532653
const TypeInterface *return_type = _get_type_or_singleton_or_null(p_imethod.return_type);
2654-
ERR_FAIL_NULL_V(return_type, ERR_BUG); // Return type not found
2654+
ERR_FAIL_NULL_V_MSG(return_type, ERR_BUG, "Return type '" + p_imethod.return_type.cname + "' was not found.");
26552655

26562656
ERR_FAIL_COND_V_MSG(return_type->is_singleton, ERR_BUG,
26572657
"Method return type is a singleton: '" + p_itype.name + "." + p_imethod.name + "'.");
@@ -2690,7 +2690,7 @@ Error BindingsGenerator::_generate_cs_method(const BindingsGenerator::TypeInterf
26902690
const ArgumentInterface &first = p_imethod.arguments.front()->get();
26912691
for (const ArgumentInterface &iarg : p_imethod.arguments) {
26922692
const TypeInterface *arg_type = _get_type_or_singleton_or_null(iarg.type);
2693-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Argument type not found
2693+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + iarg.type.cname + "' was not found.");
26942694

26952695
ERR_FAIL_COND_V_MSG(arg_type->is_singleton, ERR_BUG,
26962696
"Argument type is a singleton: '" + iarg.name + "' of method '" + p_itype.name + "." + p_imethod.name + "'.");
@@ -2944,7 +2944,7 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
29442944
const ArgumentInterface &first = p_isignal.arguments.front()->get();
29452945
for (const ArgumentInterface &iarg : p_isignal.arguments) {
29462946
const TypeInterface *arg_type = _get_type_or_singleton_or_null(iarg.type);
2947-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Argument type not found
2947+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + iarg.type.cname + "' was not found.");
29482948

29492949
ERR_FAIL_COND_V_MSG(arg_type->is_singleton, ERR_BUG,
29502950
"Argument type is a singleton: '" + iarg.name + "' of signal '" + p_itype.name + "." + p_isignal.name + "'.");
@@ -3013,7 +3013,7 @@ Error BindingsGenerator::_generate_cs_signal(const BindingsGenerator::TypeInterf
30133013
int idx = 0;
30143014
for (const ArgumentInterface &iarg : p_isignal.arguments) {
30153015
const TypeInterface *arg_type = _get_type_or_null(iarg.type);
3016-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Argument type not found
3016+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + iarg.type.cname + "' was not found.");
30173017

30183018
if (idx != 0) {
30193019
p_output << ", ";
@@ -3113,7 +3113,7 @@ Error BindingsGenerator::_generate_cs_native_calls(const InternalCall &p_icall,
31133113
bool ret_void = p_icall.return_type.cname == name_cache.type_void;
31143114

31153115
const TypeInterface *return_type = _get_type_or_null(p_icall.return_type);
3116-
ERR_FAIL_NULL_V(return_type, ERR_BUG); // Return type not found
3116+
ERR_FAIL_NULL_V_MSG(return_type, ERR_BUG, "Return type '" + p_icall.return_type.cname + "' was not found.");
31173117

31183118
StringBuilder c_func_sig;
31193119
StringBuilder c_in_statements;
@@ -3129,7 +3129,7 @@ Error BindingsGenerator::_generate_cs_native_calls(const InternalCall &p_icall,
31293129
int i = 0;
31303130
for (const TypeReference &arg_type_ref : p_icall.argument_types) {
31313131
const TypeInterface *arg_type = _get_type_or_null(arg_type_ref);
3132-
ERR_FAIL_NULL_V(arg_type, ERR_BUG); // Return type not found
3132+
ERR_FAIL_NULL_V_MSG(arg_type, ERR_BUG, "Argument type '" + arg_type_ref.cname + "' was not found.");
31333133

31343134
String c_param_name = "arg" + itos(i + 1);
31353135

@@ -3389,7 +3389,7 @@ const String BindingsGenerator::_get_generic_type_parameters(const TypeInterface
33893389
String params = "<";
33903390
for (const TypeReference &param_type : p_generic_type_parameters) {
33913391
const TypeInterface *param_itype = _get_type_or_singleton_or_null(param_type);
3392-
ERR_FAIL_NULL_V(param_itype, ""); // Parameter type not found
3392+
ERR_FAIL_NULL_V_MSG(param_itype, "", "Parameter type '" + param_type.cname + "' was not found.");
33933393

33943394
ERR_FAIL_COND_V_MSG(param_itype->is_singleton, "",
33953395
"Generic type parameter is a singleton: '" + param_itype->name + "'.");

modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
<Compile Include="Properties\AssemblyInfo.cs" />
136136
</ItemGroup>
137137
<!-- Compat Sources -->
138-
<ItemGroup>
138+
<ItemGroup Condition=" '$(GodotNoDeprecated)' == '' ">
139139
<Compile Include="Compat.cs" />
140140
</ItemGroup>
141141
<!--

modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</ProjectReference>
3737
</ItemGroup>
3838
<!-- Compat Sources -->
39-
<ItemGroup>
39+
<ItemGroup Condition=" '$(GodotNoDeprecated)' == '' ">
4040
<Compile Include="Compat.cs" />
4141
</ItemGroup>
4242
<!--

platform/android/java/lib/src/org/godotengine/godot/utils/PermissionsUtil.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public static boolean requestPermissions(Activity activity, List<String> permiss
108108
} else {
109109
PermissionInfo permissionInfo = getPermissionInfo(activity, permission);
110110
int protectionLevel = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P ? permissionInfo.getProtection() : permissionInfo.protectionLevel;
111-
if (protectionLevel == PermissionInfo.PROTECTION_DANGEROUS && ContextCompat.checkSelfPermission(activity, permission) != PackageManager.PERMISSION_GRANTED) {
111+
if ((protectionLevel & PermissionInfo.PROTECTION_DANGEROUS) == PermissionInfo.PROTECTION_DANGEROUS && ContextCompat.checkSelfPermission(activity, permission) != PackageManager.PERMISSION_GRANTED) {
112112
Log.d(TAG, "Requesting permission " + permission);
113113
requestedPermissions.add(permission);
114114
}
@@ -174,7 +174,7 @@ public static boolean requestPermission(String permissionName, Activity activity
174174
try {
175175
PermissionInfo permissionInfo = getPermissionInfo(activity, permissionName);
176176
int protectionLevel = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P ? permissionInfo.getProtection() : permissionInfo.protectionLevel;
177-
if (protectionLevel == PermissionInfo.PROTECTION_DANGEROUS && ContextCompat.checkSelfPermission(activity, permissionName) != PackageManager.PERMISSION_GRANTED) {
177+
if ((protectionLevel & PermissionInfo.PROTECTION_DANGEROUS) == PermissionInfo.PROTECTION_DANGEROUS && ContextCompat.checkSelfPermission(activity, permissionName) != PackageManager.PERMISSION_GRANTED) {
178178
activity.requestPermissions(new String[] { permissionName }, REQUEST_SINGLE_PERMISSION_REQ_CODE);
179179
return false;
180180
}
@@ -259,7 +259,7 @@ public static String[] getGrantedPermissions(Context context) {
259259
} else {
260260
PermissionInfo permissionInfo = getPermissionInfo(context, manifestPermission);
261261
int protectionLevel = Build.VERSION.SDK_INT >= Build.VERSION_CODES.P ? permissionInfo.getProtection() : permissionInfo.protectionLevel;
262-
if (protectionLevel == PermissionInfo.PROTECTION_DANGEROUS && ContextCompat.checkSelfPermission(context, manifestPermission) == PackageManager.PERMISSION_GRANTED) {
262+
if ((protectionLevel & PermissionInfo.PROTECTION_DANGEROUS) == PermissionInfo.PROTECTION_DANGEROUS && ContextCompat.checkSelfPermission(context, manifestPermission) == PackageManager.PERMISSION_GRANTED) {
263263
grantedPermissions.add(manifestPermission);
264264
}
265265
}

platform/macos/doc_classes/EditorExportPlatformMacOS.xml

+7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@
7272
<member name="codesign/custom_options" type="PackedStringArray" setter="" getter="">
7373
Array of the additional command line arguments passed to the code signing tool.
7474
</member>
75+
<member name="codesign/entitlements/additional" type="String" setter="" getter="">
76+
Additional data added to the root [code]&lt;dict&gt;[/code] section of the [url=https://developer.apple.com/documentation/bundleresources/entitlements].entitlements[/url] file. The value should be an XML section with pairs of key-value elements, e.g.:
77+
[codeblock lang=text]
78+
&lt;key&gt;key_name&lt;/key&gt;
79+
&lt;string&gt;value&lt;/string&gt;
80+
[/codeblock]
81+
</member>
7582
<member name="codesign/entitlements/address_book" type="bool" setter="" getter="">
7683
Enable to allow access to contacts in the user's address book, if it's enabled you should also provide usage message in the [member privacy/address_book_usage_description] option. See [url=https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_personal-information_addressbook]com.apple.security.personal-information.addressbook[/url].
7784
</member>

platform/macos/export/export_plugin.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ bool EditorExportPlatformMacOS::get_export_option_visibility(const EditorExportP
327327
}
328328

329329
bool advanced_options_enabled = p_preset->are_advanced_options_enabled();
330-
if (p_option.begins_with("privacy")) {
330+
if (p_option.begins_with("privacy") || p_option == "codesign/entitlements/additional") {
331331
return advanced_options_enabled;
332332
}
333333
}
@@ -503,6 +503,7 @@ void EditorExportPlatformMacOS::get_export_options(List<ExportOption> *r_options
503503
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/entitlements/app_sandbox/files_movies", PROPERTY_HINT_ENUM, "No,Read-only,Read-write"), 0));
504504
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "codesign/entitlements/app_sandbox/files_user_selected", PROPERTY_HINT_ENUM, "No,Read-only,Read-write"), 0));
505505
r_options->push_back(ExportOption(PropertyInfo(Variant::ARRAY, "codesign/entitlements/app_sandbox/helper_executables", PROPERTY_HINT_ARRAY_TYPE, itos(Variant::STRING) + "/" + itos(PROPERTY_HINT_GLOBAL_FILE) + ":"), Array()));
506+
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "codesign/entitlements/additional", PROPERTY_HINT_MULTILINE_TEXT), ""));
506507
r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "codesign/custom_options"), PackedStringArray()));
507508

508509
#ifdef MACOS_ENABLED
@@ -2114,6 +2115,11 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
21142115
}
21152116
}
21162117

2118+
const String &additional_entitlements = p_preset->get("codesign/entitlements/additional");
2119+
if (!additional_entitlements.is_empty()) {
2120+
ent_f->store_line(additional_entitlements);
2121+
}
2122+
21172123
ent_f->store_line("</dict>");
21182124
ent_f->store_line("</plist>");
21192125
} else {
@@ -2271,6 +2277,14 @@ Error EditorExportPlatformMacOS::export_project(const Ref<EditorExportPreset> &p
22712277
}
22722278
}
22732279

2280+
if (FileAccess::exists(ent_path)) {
2281+
print_verbose("entitlements:\n" + FileAccess::get_file_as_string(ent_path));
2282+
}
2283+
2284+
if (FileAccess::exists(hlp_ent_path)) {
2285+
print_verbose("helper entitlements:\n" + FileAccess::get_file_as_string(hlp_ent_path));
2286+
}
2287+
22742288
// Clean up temporary entitlements files.
22752289
if (FileAccess::exists(hlp_ent_path)) {
22762290
DirAccess::remove_file_or_error(hlp_ent_path);

0 commit comments

Comments
 (0)