Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Assets/PatchKit Patcher/Editor/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ public struct Argument
public string Target;

[JsonProperty(PropertyName = "target_arguments")]
public Argument[] Arguments;
public Argument[] Arguments;

[JsonProperty(PropertyName = "capabilities")]
public string[] Capabilities;
}
}
39 changes: 37 additions & 2 deletions Assets/PatchKit Patcher/Editor/PatcherManifestCreator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,32 @@ namespace PatchKit.Unity.Editor
{
public static class PatcherManifestCreator
{
private const int ManifestVersion = 3;
private const int ManifestVersion = 4;

private static void SaveTestManifest(Manifest manifest)
{
string targetLocation = EditorUtility.SaveFilePanel("Choose test manifest location", "", "patcher.manifest", "test");

File.WriteAllText(targetLocation, JsonConvert.SerializeObject(manifest, Formatting.Indented));
}

[MenuItem("Tools/PatchKit Patcher Internal/Manifest/Windows")]
private static void CreateTestManifestWindows()
{
SaveTestManifest(WindowsManifest("BUILD_PATH"));
}

[MenuItem("Tools/PatchKit Patcher Internal/Manifest/Linux")]
private static void CreateTestManifestLinux()
{
SaveTestManifest(LinuxManifest("BUILD_PATH"));
}

[MenuItem("Tools/PatchKit Patcher Internal/Manifest/Osx")]
private static void CreateTestManifestOsx()
{
SaveTestManifest(OsxManifest("BUILD_PATH"));
}

[PostProcessBuild, UsedImplicitly]
private static void PostProcessBuild(BuildTarget buildTarget, string buildPath)
Expand Down Expand Up @@ -45,6 +70,13 @@ private static Manifest.Argument CreateManifestAgument(params string[] args)
return new Manifest.Argument { Value = args };
}

private static string[] Capabilities()
{
return new []{
"pack1_compression_lzma2",
};
}

private static Manifest LinuxManifest(string buildPath)
{
string patcherExe = Path.GetFileName(buildPath);
Expand All @@ -58,6 +90,7 @@ private static Manifest LinuxManifest(string buildPath)

Version = ManifestVersion,
Target = "sh",
Capabilities = Capabilities(),
Arguments = new Manifest.Argument[] {
CreateManifestAgument(launchScriptPath),
CreateManifestAgument("--exedir={exedir}"),
Expand All @@ -79,6 +112,7 @@ private static Manifest WindowsManifest(string buildPath)

Version = ManifestVersion,
Target = "{exedir}/" + targetFile,
Capabilities = Capabilities(),
Arguments = new Manifest.Argument[] {
CreateManifestAgument("--installdir", "{installdir}"),
CreateManifestAgument("--lockfile", "{lockfile}"),
Expand All @@ -97,6 +131,7 @@ private static Manifest OsxManifest(string buildPath)

Version = ManifestVersion,
Target = "open",
Capabilities = Capabilities(),
Arguments = new Manifest.Argument[] {
CreateManifestAgument("{exedir}/" + targetFile),
CreateManifestAgument("--args"),
Expand All @@ -108,4 +143,4 @@ private static Manifest OsxManifest(string buildPath)
};
}
}
}
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Handling failures when accessing the file system
- Attaching "system-info" to Sentry events as tag
- Support for PK_OFFICIAL define
- capabilities field in the manifest

### Changed
- Linux launch script
Expand Down