Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Reference Assembly Packages. #8274

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"jetbrains.refasmer.clitool": {
"version": "1.0.33",
"commands": [
"refasmer"
]
}
}
}
6 changes: 5 additions & 1 deletion .github/workflows/main.yml
Expand Up @@ -25,11 +25,15 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '11'
java-version: '17'

- name: Disable annotations
run: echo "::remove-matcher owner=csc::"

- name: Install required tooling
run: |
dotnet tool install --create-manifest-if-needed jetbrains.refasmer.clitool

- name: Install required workloads
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
Expand Down
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.1-develop">
<PackageReference Include="MonoGame.Framework.Ref" Version="3.8.1.1-develop">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
Expand Up @@ -3,10 +3,10 @@
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MonoGame.Framework.Content.Pipeline" Version="3.8.1.1-develop">
<PackageReference Include="MonoGame.Framework.Content.Pipeline.Ref" Version="3.8.1.1-develop">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.1-develop">
<PackageReference Include="MonoGame.Framework.Ref" Version="3.8.1.1-develop">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.Build.NoTargets/2.0.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<BaseOutputPath>..\..\Artifacts\MonoGame.Framework.Content.Pipeline.Ref</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
<Description>The MonoGame Content Pipeline reference assemblies for all platforms.</Description>
<PackageTags>monogame;.net core;core;.net standard;standard;</PackageTags>
<PackageId>MonoGame.Framework.Content.Pipeline.Ref</PackageId>
</PropertyGroup>
<ItemGroup>
<None Include="$(BaseOutputPath)\MonoGame.Framework.Content.Pipeline.dll" PackagePath="lib\$(TargetFramework)" Pack="true" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions Tools/MonoGame.Framework.Ref/MonoGame.Framework.Ref.csproj
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.Build.NoTargets/2.0.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<BaseOutputPath>..\..\Artifacts\MonoGame.Framework.Ref</BaseOutputPath>
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
<Description>The MonoGame reference assemblies for all platforms.</Description>
<PackageTags>monogame;.net core;core;.net standard;standard;</PackageTags>
<PackageId>MonoGame.Framework.Ref</PackageId>
</PropertyGroup>
<ItemGroup>
<None Include="$(BaseOutputPath)\MonoGame.Framework.dll" PackagePath="lib\$(TargetFramework)" Pack="true" />
</ItemGroup>
</Project>
17 changes: 16 additions & 1 deletion build/BuildContext.cs
Expand Up @@ -19,7 +19,7 @@ public BuildContext(ICakeContext context) : base(context)
{
var repositoryUrl = context.Argument("build-repository", DefaultRepositoryUrl);
var buildConfiguration = context.Argument("build-configuration", "Release");
BuildOutput = context.Argument("build-output", "artifacts");
BuildOutput = context.Argument("build-output", "Artifacts");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let the artifacts folder be called with a starting small letter was intentional on my part, I wanted to slowly resort the repo into:

  • artifacts
  • build
  • src
  • tests

etc. instead of our current setup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to change this because it was inconsistent across the repo. I'll have to update all the references to use lowercase if that is the intention, Not sure how this worked with mixed case on Linux in the first place.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yea, I forgot we use the artifacts folder for the build output as well.

I guess I'll try to fix it up tomorrow in a separate PR.

Version = context.Argument("build-version", DefaultBaseVersion + ".1-develop");
NuGetsDirectory = $"{BuildOutput}/NuGet/";

Expand Down Expand Up @@ -129,6 +129,21 @@ public BuildContext(ICakeContext context) : base(context)
_ => throw new ArgumentOutOfRangeException(nameof(type))
};

public bool IsToolInstalled (string tool)
{
this.StartProcess(
"dotnet",
new ProcessSettings()
{
Arguments = $"tool list",
RedirectStandardOutput = true
},
out IEnumerable<string> processOutput
);

return processOutput.Any(match => match.StartsWith($"{tool} "));
}

public bool IsWorkloadInstalled(string workload)
{
this.StartProcess(
Expand Down
33 changes: 33 additions & 0 deletions build/BuildToolsTasks/BuildReferenceAssembliesTasks.cs
@@ -0,0 +1,33 @@

namespace BuildScripts;

[TaskName("Build ReferenceAssemblies")]
[IsDependentOn(typeof(BuildContentPipelineTask))]
[IsDependentOn(typeof(BuildDesktopGLTask))]
public sealed class BuildReferenceAssembliesTasks : FrostingTask<BuildContext>
{
public override bool ShouldRun(BuildContext context) => context.IsToolInstalled("jetbrains.refasmer.clitool");
public override void Run(BuildContext context) {
// generate a reference assembly for DesktopGL and Pipelines
context.StartProcess (
"dotnet",
new ProcessSettings()
{
Arguments = $"refasmer -v --public -O Artifacts/MonoGame.Framework.Ref -c Artifacts/MonoGame.Framework/DesktopGL/{context.DotNetPackSettings.Configuration}/MonoGame.Framework.dll",
RedirectStandardOutput = true
},
out IEnumerable<string> processOutput
);
context.StartProcess (
"dotnet",
new ProcessSettings()
{
Arguments = $"refasmer -v --public -O Artifacts/MonoGame.Framework.Content.Pipeline.Ref -c Artifacts/MonoGame.Framework.Content.Pipeline/{context.DotNetPackSettings.Configuration}/MonoGame.Framework.Content.Pipeline.dll",
RedirectStandardOutput = true
},
out processOutput
);
context.DotNetPack(context.GetProjectPath(ProjectType.Tools, "MonoGame.Framework.Ref"), context.DotNetPackSettings);
context.DotNetPack(context.GetProjectPath(ProjectType.Tools, "MonoGame.Framework.Content.Pipeline.Ref"), context.DotNetPackSettings);
}
}
1 change: 1 addition & 0 deletions build/Tasks.cs
Expand Up @@ -10,6 +10,7 @@ namespace BuildScripts;
[IsDependentOn(typeof(BuildiOSTask))]
[IsDependentOn(typeof(BuildUWPTask))]
[IsDependentOn(typeof(BuildContentPipelineTask))]
[IsDependentOn(typeof(BuildReferenceAssembliesTasks))]
public sealed class BuildFrameworksTask : FrostingTask<BuildContext> { }

[TaskName("Build Tools")]
Expand Down