-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from KoblizekXD/runtime/v1.1
v1.1
- Loading branch information
Showing
10 changed files
with
99 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/main/kotlin/lol/koblizek/torch/plugin/tasks/ApplyPatchTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package lol.koblizek.torch.plugin.tasks | ||
|
||
import codechicken.diffpatch.PatchOperation | ||
import codechicken.diffpatch.util.PatchMode | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
|
||
abstract class ApplyPatchTask : DefaultTask() { | ||
init { | ||
group = "torch" | ||
description = "applies patches from origin/ directory to source" | ||
} | ||
|
||
@TaskAction | ||
fun apply() { | ||
val patchDir = project.file("patches/") | ||
val base = project.file("src/main/java/") | ||
val patchOperation = PatchOperation.builder() | ||
.basePath(base.toPath()) | ||
.patchesPath(patchDir.toPath()) | ||
.outputPath(base.toPath()) | ||
.mode(PatchMode.OFFSET) | ||
.build() | ||
val status = patchOperation.doPatch() | ||
println("Patch status: $status") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/main/kotlin/lol/koblizek/torch/plugin/tasks/GenPatchTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package lol.koblizek.torch.plugin.tasks | ||
|
||
import codechicken.diffpatch.DiffOperation | ||
import org.gradle.api.DefaultTask | ||
import org.gradle.api.tasks.TaskAction | ||
|
||
abstract class GenPatchTask : DefaultTask() { | ||
init { | ||
group = "torch" | ||
description = "generates patch files from origin/ directory" | ||
} | ||
|
||
@TaskAction | ||
fun genPatches() { | ||
val patchDir = project.file("patches/") | ||
if (!patchDir.exists()) { | ||
patchDir.mkdirs() | ||
} | ||
val diffOperation = DiffOperation.builder() | ||
.aPath(project.file("origin/").toPath()) | ||
.bPath(project.file("src/main/java/").toPath()) | ||
.aPrefix(null) | ||
.bPrefix(null) | ||
.filter { it.endsWith(".java") } | ||
.outputPath(patchDir.toPath()) | ||
.build() | ||
diffOperation.doDiff() | ||
println("Patch done.") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters