build: bump dependencies

This commit is contained in:
inotia00 2024-03-22 18:36:50 +09:00
parent 3fb9cf01c5
commit 26f29c0a12
16 changed files with 861 additions and 4941 deletions

View File

@ -0,0 +1,25 @@
name: Build pull request
on:
workflow_dispatch:
pull_request:
branches:
- dev
jobs:
release:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Cache Gradle
uses: burrunan/gradle-cache-action@v1
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew build --no-daemon

View File

@ -6,10 +6,6 @@ on:
branches:
- main
- dev
pull_request:
branches:
- main
- dev
jobs:
release:
@ -24,22 +20,30 @@ jobs:
persist-credentials: false
fetch-depth: 0
- name: Cache Node modules
uses: actions/cache@v3
with:
path: |
node_modules
key: npm-${{ hashFiles('package-lock.json') }}
- name: Cache Gradle
uses: burrunan/gradle-cache-action@v1
- name: Build with Gradle
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew generateMeta clean
- name: Setup semantic-release
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
fingerprint: ${{ env.GPG_FINGERPRINT }}
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}

View File

@ -0,0 +1,18 @@
name: Update Gradle wrapper
on:
schedule:
- cron: "0 0 1 * *"
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Update Gradle Wrapper
uses: gradle-update/update-gradle-wrapper-action@v1
with:
target-branch: dev

View File

@ -33,7 +33,7 @@
{
"assets": [
{
"path": "build/libs/*.jar"
"path": "build/libs/revanced-patches*"
},
{
"path": "patches.json"

View File

@ -1,7 +1,10 @@
import org.gradle.kotlin.dsl.support.listFilesOrdered
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
kotlin("jvm") version "1.9.20"
alias(libs.plugins.kotlin)
`maven-publish`
signing
}
group = "app.revanced"
@ -10,7 +13,13 @@ repositories {
mavenCentral()
mavenLocal()
google()
maven { url = uri("https://jitpack.io") }
maven {
url = uri("https://maven.pkg.github.com/revanced/multidexlib2")
credentials {
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
}
}
}
dependencies {
@ -21,45 +30,120 @@ dependencies {
}
kotlin {
jvmToolchain(11)
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
}
}
java {
targetCompatibility = JavaVersion.VERSION_11
}
tasks {
register<DefaultTask>("generateBundle") {
description = "Generate dex files from build and bundle them in the jar file"
withType(Jar::class) {
exclude("app/revanced/generator")
manifest {
attributes["Name"] = "ReVanced Patches"
attributes["Description"] = "Patches for ReVanced."
attributes["Version"] = version
attributes["Timestamp"] = System.currentTimeMillis().toString()
attributes["Source"] = "git@github.com:revanced/revanced-patches.git"
attributes["Author"] = "ReVanced"
attributes["Contact"] = "contact@revanced.app"
attributes["Origin"] = "https://revanced.app"
attributes["License"] = "GNU General Public License v3.0"
}
}
register("buildDexJar") {
description = "Build and add a DEX to the JAR file"
group = "build"
dependsOn(build)
doLast {
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools")
.listFilesOrdered().last().resolve("d8").absolutePath
val artifacts = configurations.archives.get().allArtifacts.files.files.first().absolutePath
val patchesJar = configurations.archives.get().allArtifacts.files.files.first().absolutePath
val workingDirectory = layout.buildDirectory.dir("libs").get().asFile
exec {
workingDir = workingDirectory
commandLine = listOf(d8, artifacts)
commandLine = listOf(d8, "--release", patchesJar)
}
exec {
workingDir = workingDirectory
commandLine = listOf("zip", "-u", artifacts, "classes.dex")
commandLine = listOf("zip", "-u", patchesJar, "classes.dex")
}
}
}
register<JavaExec>("generateMeta") {
description = "Generate metadata for this bundle"
register<JavaExec>("generatePatchesFiles") {
description = "Generate patches files"
dependsOn(build)
classpath = sourceSets["main"].runtimeClasspath
mainClass.set("app.revanced.meta.PatchesFileGenerator")
mainClass.set("app.revanced.generator.MainKt")
}
// Required to run tasks because Gradle semantic-release plugin runs the publish task.
// Needed by gradle-semantic-release-plugin.
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
register<DefaultTask>("publish") {
dependsOn("generateBundle")
dependsOn("generateMeta")
publish {
dependsOn("buildDexJar")
dependsOn("generatePatchesFiles")
}
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/revanced/revanced-patches")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("revanced-patches-publication") {
from(components["java"])
pom {
name = "ReVanced Patches"
description = "Patches for ReVanced."
url = "https://revanced.app"
licenses {
license {
name = "GNU General Public License v3.0"
url = "https://www.gnu.org/licenses/gpl-3.0.en.html"
}
}
developers {
developer {
id = "ReVanced"
name = "ReVanced"
email = "contact@revanced.app"
}
}
scm {
connection = "scm:git:git://github.com/revanced/revanced-patches.git"
developerConnection = "scm:git:git@github.com:revanced/revanced-patches.git"
url = "https://github.com/revanced/revanced-patches"
}
}
}
}
}
signing {
useGpgCmd()
sign(publishing.publications["revanced-patches-publication"])
}

View File

@ -1,9 +1,13 @@
[versions]
revanced-patcher = "19.1.0"
smali = "3.0.3"
revanced-patcher = "19.3.1"
smali = "3.0.5"
gson = "2.10.1"
kotlin = "1.9.23"
[libraries]
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" }
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
[plugins]
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

5450
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
{
"devDependencies": {
"@saithodev/semantic-release-backmerge": "^3.2.1",
"@saithodev/semantic-release-backmerge": "^4.0.1",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"gradle-semantic-release-plugin": "^1.8.0",
"semantic-release": "^22.0.8"
"gradle-semantic-release-plugin": "^1.9.1",
"semantic-release": "^23.0.2"
}
}

View File

@ -2,6 +2,6 @@ rootProject.name = "revanced-patches"
buildCache {
local {
isEnabled = !System.getenv().containsKey("CI")
isEnabled = "CI" !in System.getenv()
}
}

View File

@ -0,0 +1,49 @@
package app.revanced.generator
import app.revanced.patcher.PatchSet
import app.revanced.patcher.patch.Patch
import com.google.gson.GsonBuilder
import java.io.File
internal class JsonPatchesFileGenerator : PatchesFileGenerator {
override fun generate(patches: PatchSet) = patches.sortedBy { it.name }.map {
JsonPatch(
it.name!!,
it.description,
it.compatiblePackages,
it.use,
it.requiresIntegrations,
it.options.values.map { option ->
JsonPatch.Option(
option.key,
option.default,
option.values,
option.title,
option.description,
option.required,
)
},
)
}.let {
File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it))
}
@Suppress("unused")
private class JsonPatch(
val name: String? = null,
val description: String? = null,
val compatiblePackages: Set<Patch.CompatiblePackage>? = null,
val use: Boolean = true,
val requiresIntegrations: Boolean = false,
val options: List<Option>,
) {
class Option(
val key: String,
val default: Any?,
val values: Map<String, Any?>?,
val title: String?,
val description: String?,
val required: Boolean,
)
}
}

View File

@ -0,0 +1,12 @@
package app.revanced.generator
import app.revanced.patcher.PatchBundleLoader
import java.io.File
internal fun main() = PatchBundleLoader.Jar(
File("build/libs/").listFiles { it -> it.name.endsWith(".jar") }!!.first(),
).also { loader ->
if (loader.isEmpty()) throw IllegalStateException("No patches found")
}.let { bundle ->
arrayOf(JsonPatchesFileGenerator(), ReadMeFileGenerator()).forEach { generator -> generator.generate(bundle) }
}

View File

@ -0,0 +1,7 @@
package app.revanced.generator
import app.revanced.patcher.PatchSet
internal interface PatchesFileGenerator {
fun generate(patches: PatchSet)
}

View File

@ -1,10 +1,10 @@
package app.revanced.meta
package app.revanced.generator
import app.revanced.patcher.PatchSet
import app.revanced.patcher.patch.Patch
import java.io.File
internal class ReadmeGenerator : PatchesFileGenerator {
internal class ReadMeFileGenerator : PatchesFileGenerator {
private companion object {
private const val TABLE_HEADER =
"| \uD83D\uDC8A Patch | \uD83D\uDCDC Description | \uD83C\uDFF9 Target Version |\n" +

View File

@ -1,51 +0,0 @@
package app.revanced.meta
import app.revanced.patcher.PatchSet
import app.revanced.patcher.patch.Patch
import com.google.gson.GsonBuilder
import java.io.File
internal class JsonGenerator : PatchesFileGenerator {
override fun generate(patches: PatchSet) = patches
.sortedBy { it.name }
.map {
JsonPatch(
it.name!!,
it.description,
it.compatiblePackages,
it.use,
it.requiresIntegrations,
it.options.values.map { option ->
JsonPatch.Option(
option.key,
option.default,
option.values,
option.title,
option.description,
option.required
)
}
)
}.let {
File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it))
}
@Suppress("unused")
private class JsonPatch(
val name: String? = null,
val description: String? = null,
val compatiblePackages: Set<Patch.CompatiblePackage>? = null,
val use: Boolean = true,
val requiresIntegrations: Boolean = false,
val options: List<Option>
) {
class Option(
val key: String,
val default: Any?,
val values: Map<String, Any?>?,
val title: String?,
val description: String?,
val required: Boolean,
)
}
}

View File

@ -1,24 +0,0 @@
package app.revanced.meta
import app.revanced.patcher.PatchBundleLoader
import app.revanced.patcher.PatchSet
import java.io.File
internal interface PatchesFileGenerator {
fun generate(patches: PatchSet)
private companion object {
@JvmStatic
fun main(args: Array<String>) = PatchBundleLoader.Jar(
File("build/libs/").listFiles { it -> it.name.endsWith(".jar") }!!.first()
).also { loader ->
if (loader.isEmpty()) throw IllegalStateException("No patches found")
}.let { bundle ->
arrayOf(JsonGenerator(), ReadmeGenerator()).forEach { generator ->
generator.generate(
bundle
)
}
}
}
}