Skip to content

Commit

Permalink
Use buildscripts submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
harry-cpp committed Nov 8, 2023
1 parent 819c7c1 commit 1c4a92b
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 123 deletions.
37 changes: 11 additions & 26 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,24 @@ jobs:
os: [windows-latest, macos-latest, ubuntu-22.04]
fail-fast: false
steps:
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Add msbuild to PATH
if: runner.os == 'Windows'
uses: microsoft/[email protected]
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get install build-essential git make cmake autoconf automake libpng-dev
run: sudo apt-get install build-essential git make cmake autoconf automake libpng-dev pkg-config
shell: bash
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Run CAKE
run: dotnet run --project ./build/Build.csproj
- name: Package artifacts
uses: actions/upload-artifact@main
with:
name: FreeType-${{ matrix.os }}
path: |
artifacts/*
env:
ACTIONS_RUNTIME_TOKEN: ${{ env.ACTIONS_RUNTIME_TOKEN }}
ACTIONS_RUNTIME_URL: "${{ env.ACTIONS_RUNTIME_URL }}"
deploy:
name: deploy
runs-on: ubuntu-latest
Expand All @@ -41,30 +39,17 @@ jobs:
needs: [ build ]
if: ${{ github.event_name == 'push' }}
steps:
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
- name: Clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Download artifacts for Windows x64
uses: actions/download-artifact@v3
with:
name: FreeType-windows-latest
path: artifacts-windows-x64
- name: Download artifacts for macOS
uses: actions/download-artifact@v3
with:
name: FreeType-macos-latest
path: artifacts-macos
- name: Download artifacts for Linux x64
uses: actions/download-artifact@v3
with:
name: FreeType-ubuntu-22.04
path: artifacts-linux-x64
- name: Run CAKE
run: dotnet run --project ./build/Build.csproj -- "--target=Package"
- name: Push packages
run: dotnet nuget push src/bin/Release/*.nupkg --source https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json --api-key ${GITHUB_TOKEN}
run: dotnet run --project ./build/Build.csproj -- --target=Package --libraryname=FreeType --licensepath=freetype/LICENSE.txt
env:
ACTIONS_RUNTIME_TOKEN: ${{ env.ACTIONS_RUNTIME_TOKEN }}
ACTIONS_RUNTIME_URL: "${{ env.ACTIONS_RUNTIME_URL }}"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Make a release
uses: ncipollo/release-action@v1
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "freetype"]
path = freetype
url = https://gitlab.freedesktop.org/freetype/freetype.git
[submodule "buildscripts"]
path = buildscripts
url = https://github.com/MonoGame/MonoGame.Library.BuildScripts.git
8 changes: 6 additions & 2 deletions MonoGame.Library.FreeType.sln → Build.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Library.FreeType", "src\MonoGame.Library.FreeType.csproj", "{829E8EA7-C85D-47F0-81B6-025F19148940}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Build", "build\Build.csproj", "{B913F09D-F1D8-41F4-81C0-1F35E21F54B4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoGame.Library.BuildScripts", "buildscripts\MonoGame.Library.BuildScripts.csproj", "{CC531012-FE1D-4F79-92BB-A286E106B60F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -24,5 +24,9 @@ Global
{B913F09D-F1D8-41F4-81C0-1F35E21F54B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B913F09D-F1D8-41F4-81C0-1F35E21F54B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B913F09D-F1D8-41F4-81C0-1F35E21F54B4}.Release|Any CPU.Build.0 = Release|Any CPU
{CC531012-FE1D-4F79-92BB-A286E106B60F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC531012-FE1D-4F79-92BB-A286E106B60F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC531012-FE1D-4F79-92BB-A286E106B60F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC531012-FE1D-4F79-92BB-A286E106B60F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
14 changes: 13 additions & 1 deletion build/Build.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
<Using Include="Cake.Frosting" />
<Using Include="Cake.Common.Build" />
<Using Include="Cake.Common.Diagnostics" />
<Using Include="Cake.Common.Tools.DotNet" />
<Using Include="Cake.Common.Tools.DotNet.MSBuild" />
<Using Include="Cake.Common.Tools.DotNet.Pack" />
Expand All @@ -17,8 +23,14 @@
<Using Include="Cake.Core.IO" />
<Using Include="Cake.FileHelpers" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Cake.FileHelpers" Version="6.1.3" />
<PackageReference Include="Cake.Frosting" Version="3.1.0" />
</ItemGroup>
</Project>

<ItemGroup>
<ProjectReference Include="..\buildscripts\MonoGame.Library.BuildScripts.csproj" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions build/BuildLinuxTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ namespace BuildScripts;

[TaskName("Build Linux")]
[IsDependentOn(typeof(PrepTask))]
[IsDependeeOf(typeof(BuildLibraryTask))]
public sealed class BuildLinuxTask : FrostingTask<BuildContext>
{
public override bool ShouldRun(BuildContext context) => context.IsRunningOnLinux();
Expand Down
4 changes: 1 addition & 3 deletions build/BuildMacOSTask.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@

using Cake.Cli;
using Cake.Common.Diagnostics;

namespace BuildScripts;

[TaskName("Build macOS")]
[IsDependentOn(typeof(PrepTask))]
[IsDependeeOf(typeof(BuildLibraryTask))]
public sealed class BuildMacOSTask : FrostingTask<BuildContext>
{
public override bool ShouldRun(BuildContext context) => context.IsRunningOnMacOs();
Expand Down
2 changes: 1 addition & 1 deletion build/BuildWindowsTask.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

using Cake.Common.Tools.MSBuild;

namespace BuildScripts;

[TaskName("Build Windows")]
[IsDependentOn(typeof(PrepTask))]
[IsDependeeOf(typeof(BuildLibraryTask))]
public sealed class BuildWindowsTask : FrostingTask<BuildContext>
{
public override bool ShouldRun(BuildContext context) => context.IsRunningOnWindows();
Expand Down
24 changes: 0 additions & 24 deletions build/PackageTask.cs

This file was deleted.

12 changes: 0 additions & 12 deletions build/PrepTask.cs

This file was deleted.

19 changes: 1 addition & 18 deletions build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,8 @@ public static class Program
{
public static int Main(string[] args)
=> new CakeHost()
.AddAssembly(typeof(BuildContext).Assembly)
.UseWorkingDirectory("../")
.UseContext<BuildContext>()
.Run(args);
}

public class BuildContext : FrostingContext
{
public string ArtifactsDir { get; }

public BuildContext(ICakeContext context) : base(context)
{
ArtifactsDir = context.Arguments("artifactsDir", "artifacts").FirstOrDefault();
}
}

[TaskName("Default")]
[IsDependentOn(typeof(BuildWindowsTask))]
[IsDependentOn(typeof(BuildMacOSTask))]
[IsDependentOn(typeof(BuildLinuxTask))]
public class DefaultTask : FrostingTask
{
}
1 change: 1 addition & 0 deletions buildscripts
Submodule buildscripts added at 158f1c
Binary file removed src/Icon.png
Binary file not shown.
36 changes: 0 additions & 36 deletions src/MonoGame.Library.FreeType.csproj

This file was deleted.

0 comments on commit 1c4a92b

Please sign in to comment.