diff options
10 files changed, 90 insertions, 40 deletions
diff --git a/modules/mono/Directory.Build.props b/modules/mono/Directory.Build.props index fbf864b11b..f7c8a825f9 100644 --- a/modules/mono/Directory.Build.props +++ b/modules/mono/Directory.Build.props @@ -1,3 +1,6 @@ <Project> - <Import Project="$(MSBuildThisFileDirectory)\SdkPackageVersions.props" /> + <PropertyGroup> + <GodotSdkPackageVersionsFilePath>$(MSBuildThisFileDirectory)\SdkPackageVersions.props</GodotSdkPackageVersionsFilePath> + </PropertyGroup> + <Import Project="$(GodotSdkPackageVersionsFilePath)" /> </Project> diff --git a/modules/mono/Directory.Build.targets b/modules/mono/Directory.Build.targets new file mode 100644 index 0000000000..98410b93ae --- /dev/null +++ b/modules/mono/Directory.Build.targets @@ -0,0 +1,22 @@ +<Project> + <PropertyGroup> + <_HasNuGetPackage Condition=" '$(_HasNuGetPackage)' == '' And '$(PackageId)' != '' And '$(GeneratePackageOnBuild.ToLower())' == 'true' ">true</_HasNuGetPackage> + <_HasNuGetPackage Condition=" '$(_HasNuGetPackage)' == '' ">false</_HasNuGetPackage> + </PropertyGroup> + <Target Name="CopyNupkgToSConsOutputDir" AfterTargets="Pack" + Condition=" '$(_HasNuGetPackage)' == 'true' "> + <PropertyGroup> + <GodotSourceRootPath>$(MSBuildThisFileDirectory)\..\..\</GodotSourceRootPath> + <GodotOutputDataDir>$(GodotSourceRootPath)\bin\GodotSharp\</GodotOutputDataDir> + </PropertyGroup> + <Copy SourceFiles="$(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg" DestinationFolder="$(GodotOutputDataDir)Tools\nupkgs\" /> + </Target> + <Target Name="PushNuGetPackagesToLocalSource" BeforeTargets="Pack" + Condition=" '$(_HasNuGetPackage)' == 'true' And '$(PushNuGetToLocalSource)' != '' "> + <Copy SourceFiles="$(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg" DestinationFolder="$(PushNuGetToLocalSource)\" /> + </Target> + <Target Name="ClearNuGetLocalPackageCache" BeforeTargets="Pack" + Condition=" '$(_HasNuGetPackage)' == 'true' And '$(ClearNuGetLocalCache.ToLower())' == 'true' "> + <RemoveDir Directories="$(NugetPackageRoot)/$(PackageId.ToLower())/$(PackageVersion)"/> + </Target> +</Project> diff --git a/modules/mono/SdkPackageVersions.props b/modules/mono/SdkPackageVersions.props index 50ef6d8d6c..65094aa34f 100644 --- a/modules/mono/SdkPackageVersions.props +++ b/modules/mono/SdkPackageVersions.props @@ -1,7 +1,8 @@ <Project> <PropertyGroup> <PackageFloatingVersion_Godot>4.0.*-*</PackageFloatingVersion_Godot> - <PackageVersion_Godot_NET_Sdk>4.0.0-dev7</PackageVersion_Godot_NET_Sdk> + <PackageVersion_GodotSharp>4.0.0-dev</PackageVersion_GodotSharp> + <PackageVersion_Godot_NET_Sdk>4.0.0-dev8</PackageVersion_Godot_NET_Sdk> <PackageVersion_Godot_SourceGenerators>4.0.0-dev8</PackageVersion_Godot_SourceGenerators> </PropertyGroup> </Project> diff --git a/modules/mono/build_scripts/build_assemblies.py b/modules/mono/build_scripts/build_assemblies.py index 9cf9330232..fa3be684bd 100755 --- a/modules/mono/build_scripts/build_assemblies.py +++ b/modules/mono/build_scripts/build_assemblies.py @@ -195,7 +195,7 @@ def run_msbuild(tools: ToolsLocation, sln: str, msbuild_args: [str] = None): return subprocess.call(args, env=msbuild_env) -def build_godot_api(msbuild_tool, module_dir, output_dir): +def build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local): target_filenames = [ "GodotSharp.dll", "GodotSharp.pdb", @@ -213,11 +213,15 @@ def build_godot_api(msbuild_tool, module_dir, output_dir): targets = [os.path.join(editor_api_dir, filename) for filename in target_filenames] + args = ["/restore", "/t:Build", "/p:Configuration=" + build_config, "/p:NoWarn=1591"] + if push_nupkgs_local: + args += ["/p:ClearNuGetLocalCache=true", "/p:PushNuGetToLocalSource=" + push_nupkgs_local] + sln = os.path.join(module_dir, "glue/GodotSharp/GodotSharp.sln") exit_code = run_msbuild( msbuild_tool, sln=sln, - msbuild_args=["/restore", "/t:Build", "/p:Configuration=" + build_config, "/p:NoWarn=1591"], + msbuild_args=args, ) if exit_code != 0: return exit_code @@ -252,9 +256,9 @@ def build_godot_api(msbuild_tool, module_dir, output_dir): return 0 -def build_all(msbuild_tool, module_dir, output_dir, dev_debug, godot_platform): +def build_all(msbuild_tool, module_dir, output_dir, godot_platform, dev_debug, push_nupkgs_local): # Godot API - exit_code = build_godot_api(msbuild_tool, module_dir, output_dir) + exit_code = build_godot_api(msbuild_tool, module_dir, output_dir, push_nupkgs_local) if exit_code != 0: return exit_code @@ -263,13 +267,18 @@ def build_all(msbuild_tool, module_dir, output_dir, dev_debug, godot_platform): args = ["/restore", "/t:Build", "/p:Configuration=" + ("Debug" if dev_debug else "Release")] + ( ["/p:GodotPlatform=" + godot_platform] if godot_platform else [] ) + if push_nupkgs_local: + args += ["/p:ClearNuGetLocalCache=true", "/p:PushNuGetToLocalSource=" + push_nupkgs_local] exit_code = run_msbuild(msbuild_tool, sln=sln, msbuild_args=args) if exit_code != 0: return exit_code # Godot.NET.Sdk + args = ["/restore", "/t:Build", "/p:Configuration=Release"] + if push_nupkgs_local: + args += ["/p:ClearNuGetLocalCache=true", "/p:PushNuGetToLocalSource=" + push_nupkgs_local] sln = os.path.join(module_dir, "editor/Godot.NET.Sdk/Godot.NET.Sdk.sln") - exit_code = run_msbuild(msbuild_tool, sln=sln, msbuild_args=["/restore", "/t:Build", "/p:Configuration=Release"]) + exit_code = run_msbuild(msbuild_tool, sln=sln, msbuild_args=args) if exit_code != 0: return exit_code @@ -290,6 +299,7 @@ def main(): ) parser.add_argument("--godot-platform", type=str, default="") parser.add_argument("--mono-prefix", type=str, default="") + parser.add_argument("--push-nupkgs-local", type=str, default="") args = parser.parse_args() @@ -304,7 +314,14 @@ def main(): print("Unable to find MSBuild") sys.exit(1) - exit_code = build_all(msbuild_tool, module_dir, output_dir, args.godot_platform, args.dev_debug) + exit_code = build_all( + msbuild_tool, + module_dir, + output_dir, + args.godot_platform, + args.dev_debug, + args.push_nupkgs_local, + ) sys.exit(exit_code) diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Godot.NET.Sdk.csproj b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Godot.NET.Sdk.csproj index 4e9e7184da..013b210ff4 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Godot.NET.Sdk.csproj +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Godot.NET.Sdk.csproj @@ -26,16 +26,8 @@ <None Include="Sdk\Sdk.props" Pack="true" PackagePath="Sdk" /> <None Include="Sdk\Sdk.targets" Pack="true" PackagePath="Sdk" /> <!-- SdkPackageVersions.props --> - <None Include="..\..\..\SdkPackageVersions.props" Pack="true" PackagePath="Sdk"> + <None Include="$(GodotSdkPackageVersionsFilePath)" Pack="true" PackagePath="Sdk"> <Link>Sdk\SdkPackageVersions.props</Link> </None> </ItemGroup> - - <Target Name="CopyNupkgToSConsOutputDir" AfterTargets="Pack"> - <PropertyGroup> - <GodotSourceRootPath>$(SolutionDir)\..\..\..\..\</GodotSourceRootPath> - <GodotOutputDataDir>$(GodotSourceRootPath)\bin\GodotSharp\</GodotOutputDataDir> - </PropertyGroup> - <Copy SourceFiles="$(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg" DestinationFolder="$(GodotOutputDataDir)Tools\nupkgs\" /> - </Target> </Project> diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props index 9bc134818a..652b9e8e43 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.props @@ -95,19 +95,4 @@ <DefineConstants>$(GodotDefineConstants);$(DefineConstants)</DefineConstants> </PropertyGroup> - - <!-- Godot API references --> - <ItemGroup> - <!-- - TODO: - We should consider a nuget package for reference assemblies. This is difficult because the - Godot scripting API is continuaslly breaking backwards compatibility even in patch releases. - --> - <Reference Include="GodotSharp"> - <HintPath>$(GodotProjectDir).godot\mono\assemblies\$(GodotApiConfiguration)\GodotSharp.dll</HintPath> - </Reference> - <Reference Include="GodotSharpEditor" Condition=" '$(Configuration)' == 'Debug' "> - <HintPath>$(GodotProjectDir).godot\mono\assemblies\$(GodotApiConfiguration)\GodotSharpEditor.dll</HintPath> - </Reference> - </ItemGroup> </Project> diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets index 397ede9644..aad4ea4553 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.NET.Sdk/Sdk/Sdk.targets @@ -19,4 +19,10 @@ <ItemGroup Condition=" '$(DisableImplicitGodotGeneratorReferences)' != 'true' "> <PackageReference Include="Godot.SourceGenerators" Version="$(PackageFloatingVersion_Godot)" /> </ItemGroup> + + <!-- Godot API references --> + <ItemGroup Condition=" '$(DisableImplicitGodotSharpReferences)' != 'true' "> + <PackageReference Include="GodotSharp" Version="$(PackageVersion_GodotSharp)" /> + <PackageReference Include="GodotSharpEditor" Version="$(PackageVersion_GodotSharp)" Condition=" '$(Configuration)' == 'Debug' " /> + </ItemGroup> </Project> diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Godot.SourceGenerators.csproj b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Godot.SourceGenerators.csproj index d61d9f7f14..f51b5970c3 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Godot.SourceGenerators.csproj +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/Godot.SourceGenerators.csproj @@ -30,12 +30,4 @@ <!-- Package the props file --> <None Include="Godot.SourceGenerators.props" Pack="true" PackagePath="build" Visible="true" /> </ItemGroup> - - <Target Name="CopyNupkgToSConsOutputDir" AfterTargets="Pack"> - <PropertyGroup> - <GodotSourceRootPath>$(SolutionDir)\..\..\..\..\</GodotSourceRootPath> - <GodotOutputDataDir>$(GodotSourceRootPath)\bin\GodotSharp\</GodotOutputDataDir> - </PropertyGroup> - <Copy SourceFiles="$(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg" DestinationFolder="$(GodotOutputDataDir)Tools\nupkgs\" /> - </Target> </Project> diff --git a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj index ce1a53cff2..2e121bb789 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj +++ b/modules/mono/glue/GodotSharp/GodotSharp/GodotSharp.csproj @@ -16,6 +16,25 @@ <NoWarn>CS1591</NoWarn> </PropertyGroup> <PropertyGroup> + <Description>Godot C# Core API.</Description> + <Authors>Godot Engine contributors</Authors> + + <PackageId>GodotSharp</PackageId> + <Version>4.0.0</Version> + <PackageVersion>$(PackageVersion_GodotSharp)</PackageVersion> + <RepositoryUrl>https://github.com/godotengine/godot/tree/master/modules/mono/glue/GodotSharp/GodotSharp</RepositoryUrl> + <PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl> + <PackageLicenseExpression>MIT</PackageLicenseExpression> + + <GeneratePackageOnBuild>true</GeneratePackageOnBuild> + </PropertyGroup> + <ItemGroup> + <!-- SdkPackageVersions.props for easy access --> + <None Include="$(GodotSdkPackageVersionsFilePath)"> + <Link>SdkPackageVersions.props</Link> + </None> + </ItemGroup> + <PropertyGroup> <DefineConstants>$(DefineConstants);GODOT</DefineConstants> </PropertyGroup> <ItemGroup> diff --git a/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj b/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj index aebf3a4a18..ebf09aab7b 100644 --- a/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj +++ b/modules/mono/glue/GodotSharp/GodotSharpEditor/GodotSharpEditor.csproj @@ -11,6 +11,19 @@ <LangVersion>10</LangVersion> </PropertyGroup> <PropertyGroup> + <Description>Godot C# Editor API.</Description> + <Authors>Godot Engine contributors</Authors> + + <PackageId>GodotSharpEditor</PackageId> + <Version>4.0.0</Version> + <PackageVersion>$(PackageVersion_GodotSharp)</PackageVersion> + <RepositoryUrl>https://github.com/godotengine/godot/tree/master/modules/mono/glue/GodotSharp/GodotSharpEditor</RepositoryUrl> + <PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl> + <PackageLicenseExpression>MIT</PackageLicenseExpression> + + <GeneratePackageOnBuild>true</GeneratePackageOnBuild> + </PropertyGroup> + <PropertyGroup> <DefineConstants>$(DefineConstants);GODOT</DefineConstants> </PropertyGroup> <ItemGroup> |