Skip to content

Commit 9c47178

Browse files
authored
Merge pull request #99 from patchkit-net/feature/v3.x.x/1074-manifest-capabilities
Feature 1074: Added the capabilities field in patcher manifest
2 parents eafb250 + dfe2e24 commit 9c47178

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

Assets/PatchKit Patcher/Editor/Manifest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public struct Argument
2323
public string Target;
2424

2525
[JsonProperty(PropertyName = "target_arguments")]
26-
public Argument[] Arguments;
26+
public Argument[] Arguments;
27+
28+
[JsonProperty(PropertyName = "capabilities")]
29+
public string[] Capabilities;
2730
}
2831
}

Assets/PatchKit Patcher/Editor/PatcherManifestCreator.cs

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,32 @@ namespace PatchKit.Unity.Editor
99
{
1010
public static class PatcherManifestCreator
1111
{
12-
private const int ManifestVersion = 3;
12+
private const int ManifestVersion = 4;
13+
14+
private static void SaveTestManifest(Manifest manifest)
15+
{
16+
string targetLocation = EditorUtility.SaveFilePanel("Choose test manifest location", "", "patcher.manifest", "test");
17+
18+
File.WriteAllText(targetLocation, JsonConvert.SerializeObject(manifest, Formatting.Indented));
19+
}
20+
21+
[MenuItem("Tools/PatchKit Patcher Internal/Manifest/Windows")]
22+
private static void CreateTestManifestWindows()
23+
{
24+
SaveTestManifest(WindowsManifest("BUILD_PATH"));
25+
}
26+
27+
[MenuItem("Tools/PatchKit Patcher Internal/Manifest/Linux")]
28+
private static void CreateTestManifestLinux()
29+
{
30+
SaveTestManifest(LinuxManifest("BUILD_PATH"));
31+
}
32+
33+
[MenuItem("Tools/PatchKit Patcher Internal/Manifest/Osx")]
34+
private static void CreateTestManifestOsx()
35+
{
36+
SaveTestManifest(OsxManifest("BUILD_PATH"));
37+
}
1338

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

73+
private static string[] Capabilities()
74+
{
75+
return new []{
76+
"pack1_compression_lzma2",
77+
};
78+
}
79+
4880
private static Manifest LinuxManifest(string buildPath)
4981
{
5082
string patcherExe = Path.GetFileName(buildPath);
@@ -58,6 +90,7 @@ private static Manifest LinuxManifest(string buildPath)
5890

5991
Version = ManifestVersion,
6092
Target = "sh",
93+
Capabilities = Capabilities(),
6194
Arguments = new Manifest.Argument[] {
6295
CreateManifestAgument(launchScriptPath),
6396
CreateManifestAgument("--exedir={exedir}"),
@@ -79,6 +112,7 @@ private static Manifest WindowsManifest(string buildPath)
79112

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

98132
Version = ManifestVersion,
99133
Target = "open",
134+
Capabilities = Capabilities(),
100135
Arguments = new Manifest.Argument[] {
101136
CreateManifestAgument("{exedir}/" + targetFile),
102137
CreateManifestAgument("--args"),
@@ -108,4 +143,4 @@ private static Manifest OsxManifest(string buildPath)
108143
};
109144
}
110145
}
111-
}
146+
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1515
- Handling failures when accessing the file system
1616
- Attaching "system-info" to Sentry events as tag
1717
- Support for PK_OFFICIAL define
18+
- capabilities field in the manifest
1819

1920
### Changed
2021
- Linux launch script

0 commit comments

Comments
 (0)