1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Improve the C# API projects generation

- Now there is only one solution that contains both GodotSharp and GodotSharpEditor project. Previously we had one solution for each project
- GodotSharpEditor reference GodotShatp with a 'ProjectReference'. Previously it was a 'Reference' to the assembly
- This also simplifies the command line option to generate this solution: 'godot --generate-cs-api <OutputDir>'
This commit is contained in:
Ignacio Etcheverry
2018-11-08 01:05:19 +01:00
parent 2cf02f302f
commit 02d5ff4cd0
15 changed files with 238 additions and 208 deletions

View File

@@ -42,8 +42,8 @@
#include "../utils/path_utils.h"
#include "bindings_generator.h"
#include "csharp_project.h"
#include "dotnet_solution.h"
#include "godotsharp_export.h"
#include "net_solution.h"
#ifdef OSX_ENABLED
#include "../utils/osx_utils.h"
@@ -71,17 +71,21 @@ bool GodotSharpEditor::_create_project_solution() {
if (guid.length()) {
NETSolution solution(name);
DotNetSolution solution(name);
if (!solution.set_path(path)) {
show_error_dialog(TTR("Failed to create solution."));
return false;
}
Vector<String> extra_configs;
extra_configs.push_back("Tools");
DotNetSolution::ProjectInfo proj_info;
proj_info.guid = guid;
proj_info.relpath = name + ".csproj";
proj_info.configs.push_back("Debug");
proj_info.configs.push_back("Release");
proj_info.configs.push_back("Tools");
solution.add_new_project(name, guid, extra_configs);
solution.add_new_project(name, proj_info);
Error sln_error = solution.save();
@@ -90,10 +94,10 @@ bool GodotSharpEditor::_create_project_solution() {
return false;
}
if (!GodotSharpBuilds::make_api_sln(APIAssembly::API_CORE))
if (!GodotSharpBuilds::make_api_assembly(APIAssembly::API_CORE))
return false;
if (!GodotSharpBuilds::make_api_sln(APIAssembly::API_EDITOR))
if (!GodotSharpBuilds::make_api_assembly(APIAssembly::API_EDITOR))
return false;
pr.step(TTR("Done"));
@@ -122,15 +126,15 @@ void GodotSharpEditor::_make_api_solutions_if_needed_impl() {
// If the project has a solution and C# project make sure the API assemblies are present and up to date
String res_assemblies_dir = GodotSharpDirs::get_res_assemblies_dir();
if (!FileAccess::exists(res_assemblies_dir.plus_file(API_ASSEMBLY_NAME ".dll")) ||
if (!FileAccess::exists(res_assemblies_dir.plus_file(CORE_API_ASSEMBLY_NAME ".dll")) ||
GDMono::get_singleton()->metadata_is_api_assembly_invalidated(APIAssembly::API_CORE)) {
if (!GodotSharpBuilds::make_api_sln(APIAssembly::API_CORE))
if (!GodotSharpBuilds::make_api_assembly(APIAssembly::API_CORE))
return;
}
if (!FileAccess::exists(res_assemblies_dir.plus_file(EDITOR_API_ASSEMBLY_NAME ".dll")) ||
GDMono::get_singleton()->metadata_is_api_assembly_invalidated(APIAssembly::API_EDITOR)) {
if (!GodotSharpBuilds::make_api_sln(APIAssembly::API_EDITOR))
if (!GodotSharpBuilds::make_api_assembly(APIAssembly::API_EDITOR))
return; // Redundant? I don't think so
}
}