Skip to content

Commit

Permalink
Updated build script for glue plugin zip generation
Browse files Browse the repository at this point in the history
  • Loading branch information
KallDrexx committed Jul 27, 2022
1 parent f52946a commit c66e22d
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Parme.CSharp/Parme.CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>8</LangVersion>
<Version>10.9.1</Version>
<Version>10.10.0</Version>
<Authors>KallDrexx</Authors>
<PackageProjectUrl>https://github.com/KallDrexx/ParME</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
Expand Down
2 changes: 1 addition & 1 deletion Parme.Cli/Parme.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Version>10.9.1</Version>
<Version>10.10.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Parme.Core/Parme.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>10.9.1</Version>
<Version>10.10.0</Version>
<Authors>KallDrexx</Authors>
<PackageProjectUrl>https://github.com/KallDrexx/ParME</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
Expand Down
2 changes: 1 addition & 1 deletion Parme.Editor/Parme.Editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<Version>10.9.1</Version>
<Version>10.10.0</Version>
<Authors>KallDrexx</Authors>
<PackageProjectUrl>https://github.com/KallDrexx/ParME</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
Expand Down
2 changes: 1 addition & 1 deletion Parme.Frb.GluePlugin/Parme.Frb.GluePlugin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netcoreapp3.1</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<Version>10.9.1</Version>
<Version>10.10.0</Version>
<Authors>KallDrexx</Authors>
<PackageProjectUrl>https://github.com/KallDrexx/ParME</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
Expand Down
2 changes: 1 addition & 1 deletion Parme.Frb/Parme.Frb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Parme.Frb</RootNamespace>
<LangVersion>8</LangVersion>
<Version>10.9.1</Version>
<Version>10.10.0</Version>
<Authors>KallDrexx</Authors>
<PackageId>Parme.Frb</PackageId>
<PackageProjectUrl>https://github.com/KallDrexx/ParME</PackageProjectUrl>
Expand Down
2 changes: 1 addition & 1 deletion Parme.MonoGame/Parme.MonoGame.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>10.9.1</Version>
<Version>10.10.0</Version>
<Authors>KallDrexx</Authors>
<PackageProjectUrl>https://github.com/KallDrexx/ParME</PackageProjectUrl>
<RepositoryType>git</RepositoryType>
Expand Down
43 changes: 43 additions & 0 deletions build-packages.csx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,48 @@ static void CreateZipArchive(string project, string version) {
ZipFile.CreateFromDirectory(folderToZip, resultingZip, CompressionLevel.Optimal, false);
}

static void CreateGluePluginArchive(string project, string version) {
if (!Directory.Exists(ArtifactsFolder)) {
Directory.CreateDirectory(ArtifactsFolder);
}

var projectName = Path.GetFileNameWithoutExtension(project);
var projectPath = Path.GetDirectoryName(project);
var binaryFolder = Path.Combine(projectPath, "bin", "Release", "netcoreapp3.1");
var pluginFolder = Path.Combine(binaryFolder, projectName);
var innerFolder = Path.Combine(pluginFolder, projectName);
var resultingZip = Path.Combine(ArtifactsFolder, $"{projectName}.{version}.zip");

if (File.Exists(resultingZip)) {
File.Delete(resultingZip);
}

if (Directory.Exists(pluginFolder))
{
Directory.Delete(pluginFolder, true);
}

Directory.CreateDirectory(innerFolder);

var includeList = new string[] {
"Parme.Core.dll", "Parme.Core.pdb", "Parme.CSharp.dll", "Parme.CSharp.pdb", "Parme.Frb.GluePlugin.dll",
"Parme.Frb.GluePlugin.pdb"
};

foreach (var file in includeList)
{
var path = Path.Combine(binaryFolder, file);
if (!File.Exists(path))
{
throw new InvalidOperationException($"File '{path}' does not exist but is expected to");
}

File.Copy(path, Path.Combine(innerFolder, file));
}

ZipFile.CreateFromDirectory(pluginFolder, resultingZip, CompressionLevel.Optimal, false);
}

static void RemoveCurrentArtifacts() {
if (!Directory.Exists(ArtifactsFolder)) {
return;
Expand Down Expand Up @@ -105,6 +147,7 @@ Console.WriteLine("Building Glue Plugin");
ReplaceVersion(gluePluginProject, version);
Directory.SetCurrentDirectory(Path.GetDirectoryName(gluePluginProject));
BuildProject(gluePluginProject);
CreateGluePluginArchive(gluePluginProject, version);

Console.WriteLine("Building Editor");
ReplaceVersion(editorProject, version);
Expand Down

0 comments on commit c66e22d

Please sign in to comment.