Skip to content

Commit

Permalink
Merge branch 'dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
akir45 authored May 13, 2024
2 parents 2713558 + 3240f14 commit 829b006
Show file tree
Hide file tree
Showing 1,249 changed files with 49,775 additions and 37,852 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build_pull_request.yml
Original file line number Diff line number Diff line change
@@ -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
File renamed without changes.
18 changes: 18 additions & 0 deletions .github/workflows/update-gradle-wrapper.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

817 changes: 3 additions & 814 deletions CHANGELOG.md

Large diffs are not rendered by default.

68 changes: 20 additions & 48 deletions README-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,71 +15,43 @@ Example:
```json
[
{
"name": "Default video quality",
"description": "Adds an option to set the default video quality.",
"name": "Alternative thumbnails",
"description": "Adds options to replace video thumbnails using the DeArrow API or image captures from the video.",
"compatiblePackages":[
{
"name":"com.google.android.youtube",
"versions":[
"18.25.40",
"18.27.36",
"18.29.38",
"18.30.37",
"18.31.40",
"18.32.39",
"18.33.40",
"18.34.38",
"18.35.36",
"18.36.39",
"18.37.36",
"18.38.44",
"18.39.41",
"18.40.34",
"18.41.39",
"18.42.41",
"18.43.45",
"18.44.41",
"18.45.43",
"18.46.45",
"18.48.39",
"18.49.37",
"19.01.34",
"19.02.39",
"19.03.36",
"19.04.38",
"19.05.36",
"19.06.39",
"19.07.40",
"19.08.36",
"19.09.38",
"19.10.39",
"19.11.43",
"19.12.41",
"19.13.37",
"19.14.43",
"19.15.36",
"19.16.38"
]
"name": "com.google.android.youtube",
"versions": "COMPATIBLE_PACKAGE_YOUTUBE"
}
],
"use":true,
"requiresIntegrations":false,
"options": []
},
{
"name": "Remember video quality",
"description": "Adds an option to remember the last video quality selected.",
"name": "Bitrate default value",
"description": "Sets the audio quality to 'Always High' when you first install the app.",
"compatiblePackages": [
{
"name": "com.google.android.apps.youtube.music",
"versions": [
"6.21.52+"
]
"versions": "COMPATIBLE_PACKAGE_MUSIC"
}
],
"use":true,
"requiresIntegrations":false,
"options": []
},
{
"name": "Hide ads",
"description": "Adds options to hide ads.",
"compatiblePackages": [
{
"name": "com.reddit.frontpage",
"versions": "COMPATIBLE_PACKAGE_REDDIT"
}
],
"use":true,
"requiresIntegrations":true,
"options": []
}
]
```
362 changes: 127 additions & 235 deletions README.md

Large diffs are not rendered by default.

3,520 changes: 843 additions & 2,677 deletions api/revanced-patches.api

Large diffs are not rendered by default.

18 changes: 1 addition & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,6 @@ tasks {
}
}

register("updatePrefsXml") {
description = "Update revanced_prefs.xml with the new version"

doLast {
val prefsFile = file("src/main/resources/youtube/settings/xml/revanced_prefs.xml")
val old = Regex("""Patches" (.*)summary="[^"]*"""")
val new = """Patches" $1summary="$version""""

prefsFile.writeText(prefsFile.readText().replace(old, new))
}
}

register("buildDexJar") {
description = "Build and add a DEX to the JAR file"
group = "build"
Expand Down Expand Up @@ -96,7 +84,7 @@ tasks {
dependsOn(build)

classpath = sourceSets["main"].runtimeClasspath
mainClass.set("app.revanced.meta.PatchesFileGenerator")
mainClass.set("app.revanced.generator.MainKt")
}

// Needed by gradle-semantic-release-plugin.
Expand Down Expand Up @@ -156,7 +144,3 @@ signing {

sign(publishing.publications["revanced-patches-publication"])
}

tasks.named("processResources") {
dependsOn("updatePrefsXml")
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.parallel = true
org.gradle.caching = true
kotlin.code.style = official
version = 2.225.0-dev.7
version = 2.225.0-dev.10
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ smali = "3.0.5"
guava = "33.0.0-jre"
gson = "2.10.1"
binary-compatibility-validator = "0.14.0"
kotlin = "1.9.22"
kotlin = "1.9.23"

[libraries]
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
8 changes: 5 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
distributionSha256Sum=544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dist
zipStorePath=wrapper/dists
20 changes: 10 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
"gradle-semantic-release-plugin": "^1.9.1",
"semantic-release": "^23.0.2"
}
}
}
2 changes: 1 addition & 1 deletion patches.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ rootProject.name = "revanced-patches"

buildCache {
local {
isEnabled = !System.getenv().containsKey("CI")
isEnabled = "CI" !in System.getenv()
}
}
49 changes: 49 additions & 0 deletions src/main/kotlin/app/revanced/generator/JsonPatchesFileGenerator.kt
Original file line number Diff line number Diff line change
@@ -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,
)
}
}
12 changes: 12 additions & 0 deletions src/main/kotlin/app/revanced/generator/Main.kt
Original file line number Diff line number Diff line change
@@ -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) }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package app.revanced.generator

import app.revanced.patcher.PatchSet

internal interface PatchesFileGenerator {
fun generate(patches: PatchSet)
}
Loading

0 comments on commit 829b006

Please sign in to comment.