feat: Add --options-file json patch/option configuration#53
feat: Add --options-file json patch/option configuration#53LisoUseInAIKyrios merged 10 commits intoMorpheApp:devfrom
--options-file json patch/option configuration#53Conversation
allows users to export a patch.mpp file's patches and its options to a json file.
|
Please check this thoroughly once. I used a lot of claude to write this. Even though it seems to work in my testing, check the code quality once and if it is following your standards of the project. |
Create the options.json file by default when not present and start patching using default options. Says it in the logs too
|
try this once |
|
Everything seems to be working. This is a big improvement from the old xargs nonsense that was previously required. |
--options-file json patch/option configuration
0d76eab to
f667c5f
Compare
|
When patching with the option-file argument, can the updated options.json be wrote to disk earlier? Right now it waits until all patching is done, but it would be more convenient if it updated the file immediately. But if this behavior is difficult to add or adds to much complexity to the code then we should not make this change. |
I think the behavior of this flag should be reversed, for safety reasons. It's not hard to envision situations where this might result in data loss. It should either be an explicit opt-in, or the CLI should generate a new timestamped JSON that the user can load next time if it notices that the patch options have changed. |
That makes sense. Can invert the logic and change it to |
|
Will make it so that it adds the timestamp too like: Also, should we generate 2 files like options.json and patches.json as the issue author suggested? Does it have more benefits than our current system? |
|
I think a timestamp in the file name makes it slightly less convenient because it's a weird file name and not the name the CLI command specified. At least for me I would immediately rename it to what I wanted so it's a second step. How about timestamps inside the json? It can be the first fields. Stuff like |
|
I think a single JSON is ok. I'm not sure what useful situation two files would provide, especially since options are rarely the same between different patch repos. |
|
Now if we reverse that flag, when the user doesn't use the flag the updation doesn't happen right? But if they do use that flag, do we overwrite the file? |
|
If they use If they don't use |
|
See if this does the trick. Also currently the json updates once the apk is patched and written to disk. Should we maybe update the json file before the patching process begins? |
|
Yes, I think that's the last change. |
Give them a warning that their options JSON is out of date if (a) they don't provide the flag, and (b) the available options really did change. That way, they know to use the flag and don't forget. |
|
Once issue we have right now is: What we don't have is, there's no way to do a merge without patching. If the user gets a new .mpp and just wants to see "what's new?", they either nuke their file with options-create or they have to run a full patch with --options-update. So to solve this, we could simple let options-create do a merge too instead of remove and recreate the file? Add a --force flag to nuke and recreate the json file if they want to. And then ofc move the joson updation of --options-update to happen before the patching starts. This will cover almost all edge cases but is it even necessary is the question? What do you think of this? |
|
I think having options-create and --options-update might be a bit too extra. Maybe instead of options-create, add a new flag --dry-run which does the options merging and shows what patch options would have been selected (and exports the file), but doesn't actually patch/sign/install. |
|
To prevent nuking, the existing So if the user wants to completely reset their options.json file, they would manually need to delete it before they run |
I'm thinking do both operations in a single command. Create if the file isn't present, and update if it is. Then there will be just 3 JSON CLI commands/arguments, and it handles all use cases. If a user wants to nuke their options and start over then they can manually delete it and create again. |
|
Name it |
Hmm, if it's updating then dump isn't quite right. But the existing |
This feels like the best option. |
Users now get a warning if their optisn.json file has differences with the patch.mpp file when using --options-file without --options-update. CLI flags overriding JSON values now logs the information. options-create now merges instead of deleting the entire file. Users can still create a completely new file by deleteing or renaming the old or the new file. Potential memory leak fix by moving heavy patches (Set<Patch<*>> with DEX classloaders) inside the try block. The finally block now uses a lightweight patchesSnapshot (PatchOptionsFile) instead.
I've left it as options-create as of right now, but will change it once somebody comes up with a better name |
|
I think Updating is technically creation for most cases, and it accurately conveys the command as the starting point of JSON usage which is important. |
Now the patches are checked against the target app making sure no extra patch throws new update warning
# [1.4.0-dev.6](v1.4.0-dev.5...v1.4.0-dev.6) (2026-02-19) ### Features * Add `--options-file` json patch/option configuration ([#53](#53)) ([44943da](44943da))
# [1.4.0](v1.3.0...v1.4.0) (2026-02-21) ### Bug Fixes * Allow enabling/disabling patches using case insensitive patch names ([#48](#48)) ([03a280a](03a280a)) * Do not log patch name more than once if disabled ([#49](#49)) ([b980bb8](b980bb8)) ### Features * Add `--continue-on-error` argument, return non zero exit code if patching fails ([#47](#47)) ([255646b](255646b)) * Add `--options-file` json patch/option configuration ([#53](#53)) ([44943da](44943da)) * Add `--striplibs` argument to strip unwanted architectures ([#46](#46)) ([7442d94](7442d94)) * Support patching APKM bundles ([#40](#40)) ([bfe43d0](bfe43d0))
Allows users to export a patch.mpp file's patches and its options to a json file. What's new:
New
options-createsubcommand:Exports all patches from the patch.mpp file into a json file with:
java -jar morphe-cli-all.jar options-create --patches patches.mpp --output options.jsonthis exports all patches, use
-fflag for filtering the patches for the app you need.New
--options-fileflag on the patch command:Allow users to use the json file to suggest what patches they want/ don't want to the cli.
java -jar morphe-cli-all.jar patch --patches patches-1.13.0.mpp --options-file options.json --output patched.apk input.apkNew
--skip-options-updateflag on the patch commandBy default, after patching, the JSON file is auto-updated to stay in sync with the patch.mpp:
If you don't want to update the options.json file, add
--skip-options-updateargument.