Skip to content

Commit

Permalink
Merge branch 'NetStandard' of https://github.com/vchelaru/FlatRedBall
Browse files Browse the repository at this point in the history
…into NetStandard
  • Loading branch information
vchelaru committed Apr 5, 2024
2 parents 1e3d91a + dfe05a6 commit 62f521e
Show file tree
Hide file tree
Showing 13 changed files with 167 additions and 37 deletions.
38 changes: 33 additions & 5 deletions .github/workflows/Engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,14 @@ jobs:
with:
name: iOSMonoGameNet8Release
path: FlatRedBall\Engines\Forms\FlatRedBall.Forms\FlatRedBall.Forms.iOSMonoGame\bin\Release\net8.0-ios\



- name: Publish NuGet package iOS .NET 8
run: |
$files = Get-ChildItem -Path 'FlatRedBall\Engines\FlatRedBallXNA\FlatRedBalliOS\bin\Debug\*.nupkg'
foreach ($file in $files) {
dotnet nuget push $file.FullName --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json
}
- name: Build FlatRedBall Android .NET 8 Debug
run: dotnet build -c Debug 'FlatRedBall\Engines\Forms\FlatRedBall.Forms\FlatRedBall.Forms.Android.Net8.sln'
Expand All @@ -79,6 +85,13 @@ jobs:
with:
name: AndroidMonoGameNet8Release
path: FlatRedBall\Engines\Forms\FlatRedBall.Forms\FlatRedBall.Forms.AndroidMonoGame\bin\Release\net8.0-android\

- name: Publish NuGet package Android .NET 8
run: |
$files = Get-ChildItem -Path 'FlatRedBall\Engines\FlatRedBallXNA\FlatRedBallAndroid\bin\Debug\*.nupkg'
foreach ($file in $files) {
dotnet nuget push $file.FullName --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json
}
Expand All @@ -97,23 +110,38 @@ jobs:
with:
name: DesktopGlFnaNet7Release
path: FlatRedBall/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.FNA/bin/Release/net7.0/

- name: Publish NuGet package FNA
run: |
$files = Get-ChildItem -Path 'FlatRedBall\Engines\FlatRedBallXNA\3rd Party Libraries\FNA\bin\x64\Debug\*.nupkg'
foreach ($file in $files) {
dotnet nuget push $file.FullName --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json
}
- name: Publish NuGet package FRB FNA .NET 7
run: |
$files = Get-ChildItem -Path 'FlatRedBall\Engines\FlatRedBallXNA\FlatRedBall.FNA\bin\Debug\*.nupkg'
foreach ($file in $files) {
dotnet nuget push $file.FullName --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json
}
- name: Build FlatRedBall .NET 6 Debug
- name: Build FlatRedBall DesktopGL .NET 6 Debug
run: dotnet build -c Debug 'FlatRedBall\Engines\Forms\FlatRedBall.Forms\FlatRedBall.Forms.DesktopGLNet6.sln'
- name: Package FlatRedBall .NET 6
uses: actions/upload-artifact@v3
with:
name: DesktopGlNet6Debug
path: FlatRedBall/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.DesktopGlNet6/bin/Debug/net6.0/

- name: Build FlatRedBall .NET 6 Release
- name: Build FlatRedBall DesktopGL .NET 6 Release
run: dotnet build -c Release 'FlatRedBall\Engines\Forms\FlatRedBall.Forms\FlatRedBall.Forms.DesktopGLNet6.sln'
- name: Package FlatRedBall .NET 6
uses: actions/upload-artifact@v3
with:
name: DesktopGlNet6Release
path: FlatRedBall/Engines/Forms/FlatRedBall.Forms/FlatRedBall.Forms.DesktopGlNet6/bin/Release/net6.0/
- name: Publish NuGet package
- name: Publish NuGet package DesktopGL .NET 6
run: |
$files = Get-ChildItem -Path 'FlatRedBall\Engines\FlatRedBallXNA\FlatRedBallDesktopGLNet6\bin\Debug\*.nupkg'
foreach ($file in $files) {
Expand Down
28 changes: 20 additions & 8 deletions Engines/FlatRedBallXNA/FlatRedBall.FNA/FlatRedBall.FNA.csproj
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<DefineConstants>TRACE; DESKTOP_GL; XNA4; FRB_XNA; FNA;</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<Title>FlatRedBall (.NET FNA)</Title>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Description>FlatRedBall Game Engine</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>1.0.1</Version>
<TargetFramework>net7.0</TargetFramework>
<Version>1.0.0</Version>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\3rd Party Libraries\FNA\FNA.Core.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\3rd Party Libraries\FNA\FNA.Core.csproj">
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
<IncludeAssets>FNA.Core.dll</IncludeAssets>
</ProjectReference>
</ItemGroup>

<Import Project="..\FlatRedBall\FlatRedBallShared.projitems" Label="Shared" />
<Target DependsOnTargets="ResolveReferences" Name="CopyProjectReferencesToPackage">
<ItemGroup>
<BuildOutputInPackage Include="@(ReferenceCopyLocalPaths->WithMetadataValue('ReferenceSourceTarget', 'ProjectReference'))"/>
</ItemGroup>
</Target>


<PropertyGroup>
<TargetsForTfmSpecificBuildOutput>$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage</TargetsForTfmSpecificBuildOutput>
</PropertyGroup>

<Import Project="..\FlatRedBall\FlatRedBallShared.projitems" Label="Shared" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,14 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<Title>FlatRedBall (.NET 8 Android)</Title>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Description>FlatRedBall Game Engine</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>1.0.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants);ANDROID;FRB_XNA;MONOGAME;MONOGAME_381;XNA4;USE_ISOLATED_STORAGE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<DefineConstants>TRACE;MONOGAME; DESKTOP_GL; XNA4; FRB_XNA;MONOGAME_381;</DefineConstants>
<Title>FlatRedBall (.NET 6 Desktop GL)</Title>
</PropertyGroup>
<PropertyGroup>
<Title>FlatRedBall (.NET 6 Desktop GL)</Title>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Description>FlatRedBall Game Engine</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>1.0.1</Version>
<Version>1.0.0</Version>
</PropertyGroup>
<Import Project="..\FlatRedBall\FlatRedBallShared.projitems" Label="Shared" />

Expand Down
8 changes: 7 additions & 1 deletion Engines/FlatRedBallXNA/FlatRedBalliOS/FlatRedBalliOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup>
<Title>FlatRedBall (.NET 8 iOS)</Title>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Description>FlatRedBall Game Engine</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>1.0.0</Version>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>$(DefineConstants);FRB_XNA;IOS;MONOGAME;XNA4;MONOGAME_381;USE_ISOLATED_STORAGE</DefineConstants>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
<Compile Include="Data\EngineFileData.cs" />
<Compile Include="Processes\AddRunFlatRedBallBatch.cs" />
<Compile Include="Processes\BuildGlue.cs" />
<Compile Include="Processes\InjectFnaNugetAndVersion.cs" />
<Compile Include="Processes\PublishGlue.cs" />
<Compile Include="Processes\TraceResults.cs" />
<Compile Include="Processes\ZipGum.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,15 @@ public static string CheckoutDirectory
{
get
{
return FileManager.MakeAbsolute("../../../../../../../");

var githubPath = GithubFilePath;
if(System.IO.Directory.Exists(githubPath))
{
return githubPath + "\\";
}
else
{
return FileManager.MakeAbsolute("../../../../../../../");
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BuildServerUploaderConsole.Processes
{
internal class InjectFnaNugetAndVersion : ProcessStep
{
public InjectFnaNugetAndVersion(IResults results) : base("Injects the FNA NuGet package and updates the version number.", results)
{
}

public override void ExecuteStep()
{
var csprojLocation =
Path.Combine(DirectoryHelper.CheckoutDirectory, @"FlatRedBall\Engines\FlatRedBallXNA\3rd Party Libraries\FNA\FNA.Core.csproj");

var contents = File.ReadAllText(csprojLocation);

var index = contents.IndexOf("</PropertyGroup>");

var whatToInject = $@"
<PackageId>FNA_for_FlatRedBall</PackageId>
<Title>FNA (for FlatRedBall.FNA)</Title>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Description>FNA Core Nuget package created for FlatRedBall. This is NOT an official NuGet package from the FNA team, although you are free to use it in any FNA project.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>{UpdateAssemblyVersions.VersionString}</Version>
";

contents = contents.Insert(index, whatToInject);

File.WriteAllText(csprojLocation, contents);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ public override void ExecuteStep()
}
}
}


// If we list a csproj, then update that:
foreach(var engine in AllData.Engines)
foreach (var engine in AllData.Engines)
{
if(!string.IsNullOrEmpty(engine.EngineCSProjLocation))
if (!string.IsNullOrEmpty(engine.EngineCSProjLocation))
{
var csProjAbsolute = DirectoryHelper.CheckoutDirectory + engine.EngineCSProjLocation;
ModifyCsprojAssemblyInfoVersion(csProjAbsolute, VersionString);
Expand All @@ -65,9 +65,7 @@ public override void ExecuteStep()
}
}

var net6Engine = AllData.Engines.First(item => item.EngineCSProjLocation?.Contains("FlatRedBallDesktopGLNet6.csproj") == true);
var templateLocation = net6Engine.TemplateCsProjFolder + "FlatRedBallDesktopGlNet6Template.csproj";
ModifyNugetVersionInAssembly(DirectoryHelper.TemplateDirectory + templateLocation, VersionString);
UpdateTemplateNugets();

Results.WriteMessage("Glue assembly versions updated to " + VersionString);

Expand All @@ -91,6 +89,27 @@ public override void ExecuteStep()
Results.WriteMessage("VersionInfo file created.");
}

private void UpdateTemplateNugets()
{
var engineName = "FlatRedBallDesktopGLNet6";
var templateName = "FlatRedBallDesktopGLNet6Template";

UpdateTemplateNuget(engineName, templateName);

UpdateTemplateNuget("FlatRedBall.FNA", "FlatRedBallDesktopFnaTemplate");

UpdateTemplateNuget("FlatRedBallAndroid", "FlatRedBallAndroidMonoGameTemplate");

UpdateTemplateNuget("FlatRedBalliOS", "FlatRedBalliOSMonoGameTemplate");
}

private void UpdateTemplateNuget(string engineName, string templateName)
{
var matchingEngine = AllData.Engines.First(item => item.EngineCSProjLocation?.Contains($"{engineName}.csproj") == true);
var templateLocation = matchingEngine.TemplateCsProjFolder + templateName + ".csproj";
ModifyNugetVersionInAssembly(DirectoryHelper.TemplateDirectory + templateLocation, engineName, VersionString);
}

private static void ModifyAssemblyInfoVersion(string assemblyInfoLocation, string versionString)
{
string assemblyInfoText = FileManager.FromFileText(assemblyInfoLocation);
Expand Down Expand Up @@ -121,7 +140,7 @@ private static void ModifyCsprojAssemblyInfoVersion(string csprojLocation, strin

}

private void ModifyNugetVersionInAssembly(string csprojLocation, string versionString)
private void ModifyNugetVersionInAssembly(string csprojLocation, string packageName, string versionString)
{
if (System.IO.File.Exists(csprojLocation) == false)
{
Expand All @@ -131,8 +150,8 @@ private void ModifyNugetVersionInAssembly(string csprojLocation, string versionS
string csprojText = FileManager.FromFileText(csprojLocation);

csprojText = System.Text.RegularExpressions.Regex.Replace(csprojText,
"<PackageReference Include=\"FlatRedBallDesktopGLNet6\" Version=\"[0-9]*.[0-9]*.[0-9]*.[0-9]*\" />",
$"<PackageReference Include=\"FlatRedBallDesktopGLNet6\" Version=\"{versionString}\" />");
$"<PackageReference Include=\"{packageName}\" Version=\"[0-9]*.[0-9]*.[0-9]*.[0-9]*\" />",
$"<PackageReference Include=\"{packageName}\" Version=\"{versionString}\" />");

Results.WriteMessage("Modified " + csprojLocation + $" to have FlatRedBall Nuget package {VersionString}");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ static async Task Main(string[] args)

private static void CreateChangeEngineVersion()
{
//ProcessSteps.Add(new InjectFnaNugetAndVersion(Results));
ProcessSteps.Add(new UpdateAssemblyVersions(Results, UpdateType.Engine));

}

private static void CreateChangeFrbdkVersion()
Expand Down
8 changes: 6 additions & 2 deletions FRBDK/Glue/NpcWpfLib/Data/EmptyTemplates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ static class EmptyTemplates
static EmptyTemplates()
{
Add("Desktop GL .NET 6 (Windows, Mac, Linux)", "FlatRedBallDesktopGlNet6Template", "FlatRedBallDesktopGlNet6Template.zip", "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBallDesktopGlNet6Template.zip", true);
Add("Android .NET (Phone, Tablet, Fire TV)", "FlatRedBallAndroidMonoGameTemplate", "FlatRedBallAndroidMonoGameTemplate.zip", "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBallAndroidMonoGameTemplate.zip", true);
Add("iOS .NET (iPhone, iPad, iPod Touch)", "FlatRedBalliOSTemplate", "FlatRedBalliOSTemplate.zip", "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBalliOSTemplate.zip", true);

Add("[Experimental] FNA .NET 7 (Windows, Mac, Linux)", "FlatRedBallDesktopFnaTemplate", "FlatRedBallDesktopFnaTemplate.zip", "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBallDesktopFnaTemplate.zip", true);
Add("Android (Phone, Tablet, Fire TV)", "FlatRedBallAndroidTemplate", "FlatRedBallAndroidTemplate.zip", "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBallAndroidTemplate.zip", true);
Add("iOS (iPhone, iPad, iPod Touch)", "FlatRedBalliOSTemplate", "FlatRedBalliOSTemplate.zip", "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBalliOSTemplate.zip" ,true);

Add("[deprecated, use .NET] Android Xamarin (Phone, Tablet, Fire TV)", "FlatRedBallAndroidTemplate", "FlatRedBallAndroidTemplate.zip", "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBallAndroidTemplate.zip", true);
Add("[deprecated, use .NET] iOS Xamarin (iPhone, iPad, iPod Touch)", "FlatRedBalliOSTemplate", "FlatRedBalliOSTemplate.zip", "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBalliOSTemplate.zip" ,true);
Add("[deprecated] Winows UWP (Windows Desktop, Xbox One, Tablet)", "FlatRedBallUwpTemplate", "FlatRedBallUwpTemplate.zip", "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBallUwpTemplate.zip" ,true);
Add("[deprecated, use Desktop GL .NET 6] Desktop GL .NET Framework 4.7.1 (Windows, Mac, Linux)", "FlatRedBallDesktopGlTemplate", "FlatRedBallDesktopGL.zip", "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBallDesktopGlTemplate.zip", true);
Add("[deprecated, use Desktop GL .NET 6] Desktop XNA (Windows, requires XNA install)", "FlatRedBallXna4Template", "FlatRedBallXna4Template.zip" , "http://files.flatredball.com/content/FrbXnaTemplates/DailyBuild/ZippedTemplates/FlatRedBallXna4Template.zip", true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,22 @@
<Compile Include="Game1.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FlatRedBallAndroid" Version="2024.4.3.751" />
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" />
<PackageReference Include="MonoGame.Framework.Android" Version="3.8.1.303" />
</ItemGroup>
<ItemGroup>
<Folder Include="Libraries\Android\Debug\" />
</ItemGroup>
<ItemGroup>
<Reference Include="FlatRedBallAndroid">
<HintPath>Libraries\Android\Debug\FlatRedBallAndroid.dll</HintPath>
<Reference Include="FlatRedBall.Forms.AndroidMonoGame">
<HintPath>Libraries\Android\Debug\FlatRedBall.Forms.AndroidMonoGame.dll</HintPath>
</Reference>
<Reference Include="GumCoreAndroid">
<HintPath>Libraries\Android\Debug\GumCoreAndroid.dll</HintPath>
</Reference>
<Reference Include="StateInterpolation.AndroidMonoGame">
<HintPath>Libraries\Android\Debug\StateInterpolation.AndroidMonoGame.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="RestoreDotnetTools" BeforeTargets="Restore">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,13 @@
<EmbeddedResource Include="Icon.bmp" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FlatRedBall.FNA" Version="2024.4.4.693" />
<PackageReference Include="SkiaSharp" Version="2.88.6" />
</ItemGroup>
<ItemGroup>
<Reference Include="FlatRedBall.FNA">
<HintPath>Libraries\FNA\Debug\FlatRedBall.FNA.dll</HintPath>
</Reference>
<Reference Include="FlatRedBall.Forms.FNA">
<HintPath>Libraries\FNA\Debug\FlatRedBall.Forms.FNA.dll</HintPath>
</Reference>
<Reference Include="FNA">
<HintPath>Libraries\FNA\Debug\FNA.dll</HintPath>
</Reference>
<Reference Include="GumCore.FNA">
<HintPath>Libraries\FNA\Debug\GumCore.FNA.dll</HintPath>
</Reference>
Expand Down

0 comments on commit 62f521e

Please sign in to comment.