add back UE5 Compiler (create ZIP packages of Universal Editor content plugins), still WIP

This commit is contained in:
Michael Becker 2021-05-14 23:58:07 -04:00
parent 1bebcdbd77
commit b808623ca9
No known key found for this signature in database
GPG Key ID: 98C333A81F18C22C
4 changed files with 187 additions and 0 deletions

View File

@ -0,0 +1,87 @@
//
// Program.cs - the main entry point for the Universal Editor Extension Compiler
//
// Author:
// Michael Becker <alcexhim@gmail.com>
//
// Copyright (c) 2020 Mike Becker's Software
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using UniversalEditor;
using UniversalEditor.Accessors;
using UniversalEditor.DataFormats.Package.OpenDocument;
using UniversalEditor.DataFormats.UEPackage;
using UniversalEditor.DataFormats.UEPackage.Binary;
using UniversalEditor.ObjectModels.Package;
using UniversalEditor.ObjectModels.UEPackage;
namespace UniversalEditor.Compiler
{
public class Program
{
public static void Main(string[] args)
{
Console.Error.WriteLine("uex started...");
List<string> listFileNames = new List<string>();
string outputFileName = "output.uex";
bool foundFileName = false;
for (int i = 0; i < args.Length; i++)
{
if (args[i].StartsWith("/") && !foundFileName)
{
if (args[i].StartsWith("/out:"))
{
outputFileName = args[i].Substring(5);
}
}
else
{
// is file name
foundFileName = true;
listFileNames.Add(args[i]);
}
}
PackageObjectModel ue = new PackageObjectModel();
OpenDocumentDataFormat odf = new OpenDocumentDataFormat();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
int totalInstances = 0;
string exefilename = System.Environment.GetCommandLineArgs()[0];
string workingdir = System.IO.Path.GetDirectoryName(exefilename);
for (int i = 0; i < listFileNames.Count; i++)
{
string relpath = listFileNames[i];
if (relpath.StartsWith(workingdir))
{
relpath = relpath.Substring(workingdir.Length);
}
relpath = "Content/" + relpath;
byte[] filedata = System.IO.File.ReadAllBytes(listFileNames[i]);
ue.FileSystem.AddFile(relpath, filedata);
}
FileAccessor faout = new FileAccessor(outputFileName, true, true);
Document.Save(ue, odf, faout);
Console.Error.WriteLine("uex written to {0}!", outputFileName);
}
}
}

View File

@ -0,0 +1,46 @@
//
// AssemblyInfo.cs
//
// Author:
// Michael Becker <alcexhim@gmail.com>
//
// Copyright (c) 2020 Mike Becker's Software
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("Mocha.Compiler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Mike Becker's Software")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Mike Becker's Software")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

View File

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5E639F63-97B0-4B34-8928-29A5A3C661F4}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>UniversalEditor.Compiler</RootNamespace>
<AssemblyName>uecc</AssemblyName>
<ReleaseVersion>4.0.2019.12</ReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\UniversalEditor\Libraries\UniversalEditor.Core\UniversalEditor.Core.csproj">
<Project>{2D4737E6-6D95-408A-90DB-8DFF38147E85}</Project>
<Name>UniversalEditor.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\UniversalEditor\Libraries\UniversalEditor.Essential\UniversalEditor.Essential.csproj">
<Project>{30467E5C-05BC-4856-AADC-13906EF4CADD}</Project>
<Name>UniversalEditor.Essential</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -207,6 +207,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.Blo
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Plugins.AutoSave", "Plugins\UniversalEditor.Plugins.AutoSave\UniversalEditor.Plugins.AutoSave.csproj", "{385AB5A6-3EB6-4DF6-A7BF-DF9FFE43F192}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UniversalEditor.Compiler", "Applications\UniversalEditor.Compiler\UniversalEditor.Compiler.csproj", "{5E639F63-97B0-4B34-8928-29A5A3C661F4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -599,6 +601,10 @@ Global
{385AB5A6-3EB6-4DF6-A7BF-DF9FFE43F192}.Debug|Any CPU.Build.0 = Debug|Any CPU
{385AB5A6-3EB6-4DF6-A7BF-DF9FFE43F192}.Release|Any CPU.ActiveCfg = Release|Any CPU
{385AB5A6-3EB6-4DF6-A7BF-DF9FFE43F192}.Release|Any CPU.Build.0 = Release|Any CPU
{5E639F63-97B0-4B34-8928-29A5A3C661F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5E639F63-97B0-4B34-8928-29A5A3C661F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5E639F63-97B0-4B34-8928-29A5A3C661F4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5E639F63-97B0-4B34-8928-29A5A3C661F4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{6F0AB1AF-E1A1-4D19-B19C-05BBB15C94B2} = {05D15661-E684-4EC9-8FBD-C014BA433CC5}
@ -697,6 +703,7 @@ Global
{C54F6BCD-60CD-4603-B0C9-CD0864455CB1} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
{B6E600F5-E5BC-4DC2-8B41-7B11EB0A11B3} = {7B535D74-5496-4802-B809-89ED88274A91}
{385AB5A6-3EB6-4DF6-A7BF-DF9FFE43F192} = {2ED32D16-6C06-4450-909A-40D32DA67FB4}
{5E639F63-97B0-4B34-8928-29A5A3C661F4} = {05D15661-E684-4EC9-8FBD-C014BA433CC5}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0