|
1 | 1 | # Patchify |
2 | 2 |
|
3 | | -Tool used to manage/automate code projects that require source-code patching. |
| 3 | +Tool used to manage/automate code projects that require source-code patching. This project was inspired by the tool used |
| 4 | +by [PaperMC](https://github.com/PaperMC/Paper). |
4 | 5 |
|
5 | | -This project was inspired by the tool used by [PaperMC](https://github.com/PaperMC/Paper). |
| 6 | +## Gradle Plugin |
6 | 7 |
|
7 | | -# Example |
| 8 | +The Gradle plugin is used to automatically manage the source-code patching process for projects that use Gradle without |
| 9 | +requiring manual use of the cli tool. |
| 10 | + |
| 11 | +To use the Gradle plugin, add the following to your settings.gradle.kts file: |
| 12 | + |
| 13 | +```kotlin |
| 14 | +pluginManagement { |
| 15 | + repositories { |
| 16 | + gradlePluginPortal() |
| 17 | + maven("https://maven.quiltmc.org/repository/release/") |
| 18 | + maven("https://raw.githubusercontent.com/NickAcPT/LightCraftMaven/main/") |
| 19 | + } |
| 20 | +} |
| 21 | +``` |
| 22 | + |
| 23 | +Now that the required plugin repositories have been added, Gradle can now find the plugin. To add it to your project, |
| 24 | +add the following to your build.gradle.kts file: |
| 25 | + |
| 26 | +```kotlin |
| 27 | +plugins { |
| 28 | + id("io.github.nickacpt.patchify.gradle") version "2.1.0-SNAPSHOT" |
| 29 | +} |
| 30 | +``` |
| 31 | + |
| 32 | +Then you can define the patchify configuration in your build.gradle.kts file: |
| 33 | + |
| 34 | +```kotlin |
| 35 | +patchify { |
| 36 | + projectWorkspace(/* Name */ "Api", /* Project */ project(":sample-api")) { |
| 37 | + initializer { |
| 38 | + decompileJar(project.file("path/to/jar/to/decompile.jar"), "src/main/java") |
| 39 | + } |
| 40 | + } |
| 41 | +} |
| 42 | +``` |
| 43 | + |
| 44 | +When using the `projectWorkspace` workspace definition, the Patchify Gradle plugin willautomatically find the best paths |
| 45 | +to use. |
| 46 | + |
| 47 | +If you want Patchify to handle decompilation and patching for you, use the `decompileJar` initializer. This is the step |
| 48 | +that is done to prepare the source-code for patching. |
| 49 | + |
| 50 | +## Command-line interface |
| 51 | + |
| 52 | +Patchify also provides a command-line interface that can be used to manage and automate patching of source-code. |
8 | 53 |
|
9 | 54 | ``` |
10 | 55 | Usage: patchify [OPTIONS] COMMAND [ARGS]... |
11 | 56 |
|
| 57 | + Patchify is a tool used to manage/automate code projects that require |
| 58 | + source-code patching. |
| 59 | +
|
12 | 60 | Options: |
13 | 61 | -h, --help Show this message and exit |
14 | 62 |
|
15 | 63 | Commands: |
16 | | - init Initializes a git repository to be able to patch |
17 | | - source-code |
18 | | - rebuild-patches Rebuild patches. |
19 | | - apply-patches Apply all patches to the project. |
20 | | - edit-patch Edits a patch |
| 64 | + init Initialize a new patchify workspace |
| 65 | + apply-patches Apply all patches to the source code |
| 66 | + rebuild-patches Rebuilds all patches |
21 | 67 | ``` |
22 | 68 |
|
23 | | -## Commands |
| 69 | +### Commands |
24 | 70 |
|
25 | | -| Command | Description | |
26 | | -|:-----------------------:| ---------------------------------------------------------------------------- | |
27 | | -| `init` | Initializes a git repository to be able to patch source-code. | |
28 | | -| `rebuild-patches` | Rebuild patch files through the commits done to the source directory. | |
29 | | -| `apply-patches` | Applies the patches on the `patches` directory to the `source` directory | |
30 | | -| `edit-patch` | Allows you to edit an existing patch by rolling back to the commit. | |
31 | | -| `edit-patch --continue` | Finishes the edit of the specific patch. Automatically rebuilds the patches. | |
32 | | -| `edit-patch --abort` | Cancels the edit of the specific patch. | |
| 71 | +| Command | Description | |
| 72 | +|:-----------------------:|------------------------------------------------------------------------------| |
| 73 | +| `init` | Initializes a git repository to be able to patch source-code. | |
| 74 | +| `rebuild-patches` | Rebuild patch files through the commits done to the source directory. | |
| 75 | +| `apply-patches` | Applies the patches on the `patches` directory to the `source` directory | |
0 commit comments