Skip to content

Commit 45e5048

Browse files
authored
chore: Merge branch dev to main (#3430)
2 parents 66f773e + 513bf5d commit 45e5048

File tree

15 files changed

+351
-131
lines changed

15 files changed

+351
-131
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[*.{kt,kts}]
2+
ktlint_code_style = intellij_idea
3+
ktlint_standard_no-wildcard-imports = disabled

.github/workflows/release.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Cache Gradle
2828
uses: burrunan/gradle-cache-action@v1
2929

30-
- name: Build with Gradle
30+
- name: Build
3131
env:
3232
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3333
run: ./gradlew build clean
@@ -41,6 +41,13 @@ jobs:
4141
- name: Install dependencies
4242
run: npm install
4343

44+
- name: Import GPG key
45+
uses: crazy-max/ghaction-import-gpg@v6
46+
with:
47+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
48+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
49+
fingerprint: ${{ env.GPG_FINGERPRINT }}
50+
4451
- name: Release
4552
env:
4653
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}

.releaserc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@
3333
{
3434
"assets": [
3535
{
36-
"path": "build/libs/*.jar"
37-
},
38-
{
39-
"path": "patches.json"
36+
"path": "build/libs/revanced-patches*"
4037
}
4138
],
4239
successComment: false

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## [1.0.1-dev.1](https://github.com/ReVanced/revanced-patches-template/compare/v1.0.0...v1.0.1-dev.1) (2024-02-21)
2+
3+
4+
### Bug Fixes
5+
6+
* Compile DEX without debugging information ([73f6506](https://github.com/ReVanced/revanced-patches-template/commit/73f6506bccc01e5622a6e19bedcf6d54d3f701c7))
7+
18
# 1.0.0 (2024-01-26)
29

310

README.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,15 @@ For an example repository, see [ReVanced Patches](https://github.com/revanced/re
1010
To start using this template, follow these steps:
1111

1212
1. [Create a new repository using this template](https://github.com/new?template_name=revanced-patches-template&template_owner=ReVanced)
13-
2. Set up the [build.gradle.kts](build.gradle.kts) file (Match the [group of the project](build.gradle.kts#L8), [manifest attributes](build.gradle.kts#L35-L43), and the [POM](build.gradle.kts#L84-L106) that will be published to yours)
14-
3. Update the dependencies in the [libs.versions.toml](gradle/libs.versions.toml) file
15-
4. [Add a secret](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) to your repository named [REPOSITORY_PUSH_ACCESS](.github/workflows/release.yml#L47) containing a GitHub access token with [push access](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication)
16-
5. Set up the [README.md](README.md) file[^1] (e.g, title, description, license, summary of the patches that are included in the repository)
13+
2. Set up the [build.gradle.kts](build.gradle.kts) file (Specifically, the [group of the project](build.gradle.kts#L10), [manifest attributes](build.gradle.kts#L37-L47), and the [POM](build.gradle.kts#L98-L121))
14+
3. Update dependencies in the [libs.versions.toml](gradle/libs.versions.toml) file
15+
4. [Create a pass-phrased GPG master key and subkey](https://mikeross.xyz/create-gpg-key-pair-with-subkeys/)
16+
1. Add the private key as a secret named [GPG_PRIVATE_KEY](.github/workflows/release.yml#L47) to your repository
17+
2. Add the passphrase as a secret named [GPG_PASSPHRASE](.github/workflows/release.yml#L48) to your repository
18+
3. Add the fingerprint of the GPG subkey as a secret named [GPG_FINGERPRINT](.github/workflows/release.yml#L49) to your repository
19+
6. [Create a PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) with [push access](https://github.com/semantic-release/semantic-release/blob/master/docs/usage/ci-configuration.md#authentication)
20+
1. Add it as a secret named [REPOSITORY_PUSH_ACCESS](.github/workflows/release.yml#L53) to your repository
21+
7. Set up the [README.md](README.md) file[^1] (e.g, title, description, license, summary of the patches that are included in the repository)
1722

1823
🎉 You are now ready to start creating patches!
1924

@@ -34,9 +39,21 @@ You can also add the following things to the repository:
3439

3540
In order to develop and release ReVanced Patches using this template, some things need to be considered:
3641

37-
- Development originates in feature branches. Once a feature branch is ready, it is squshed and merged into the `dev` branch
42+
- Development occurs in feature branches. Once a feature branch is ready, it is squshed and merged into the `dev` branch
3843
- The `dev` branch is merged into the `main` branch once it is ready for release
3944
- Semantic versioning is used for versioning ReVanced Patches. ReVanced Patches have a public API for other patches to use
4045
- Semantic commit messages are used for commits
4146
- Commits on the `dev` branch and `main` branch are automatically released via the [release.yml](.github/workflows/release.yml) workflow, which is also responsible for generating the changelog and updating the version of ReVanced Patches. It is triggered by pushing to the `dev` or `main` branch. The workflow uses the `publish` task to publish the release of ReVanced Patches
42-
- In order to build ReVanced Patches, that can be used on Android, the [`generateBundle`](build.gradle.kts#L48-L70) task needs to be run. The [`publish` task depends on the `generateBundle`](build.gradle.kts#L74-L76) task, so it will be run automatically when publishing a release.
47+
- In order to build ReVanced Patches, that can be used on Android, the [`buildDexJar`](build.gradle.kts#L50-L73) task needs to be run. The [`publish` task depends on the `buildDexJar`](build.gradle.kts#L78) task, so it will be run automatically when publishing a release.
48+
49+
## 📚 Everything else
50+
51+
### 🛠️ Building
52+
53+
In order to build ReVanced Patches template, you can follow the [ReVanced documentation](https://github.com/ReVanced/revanced-documentation).
54+
55+
## 📜 Licence
56+
57+
ReVanced Patches template is licensed under the GPLv3 licence. Please see the [licence file](LICENSE) for more information.
58+
[tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) you may copy, distribute and modify ReVanced Patches template as long as you track changes/dates in source files.
59+
Any modifications to ReVanced Patches template must also be made available under the GPL along with build & install instructions.

api/revanced-patches-template.api

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
public final class app/revanced/patches/example/ExamplePatch : app/revanced/patcher/patch/BytecodePatch {
2+
public static final field INSTANCE Lapp/revanced/patches/example/ExamplePatch;
3+
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
4+
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
5+
}
6+

build.gradle.kts

Lines changed: 60 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,104 @@
11
import org.gradle.kotlin.dsl.support.listFilesOrdered
22

33
plugins {
4-
kotlin("jvm") version "1.9.10"
4+
alias(libs.plugins.kotlin)
5+
alias(libs.plugins.binary.compatibility.validator)
56
`maven-publish`
7+
signing
68
}
79

8-
group = "your.org"
10+
group = "app.revanced"
911

1012
repositories {
1113
mavenCentral()
1214
mavenLocal()
1315
google()
14-
maven { url = uri("https://jitpack.io") }
16+
maven {
17+
// A repository must be speficied for some reason. "registry" is a dummy.
18+
url = uri("https://maven.pkg.github.com/revanced/registry")
19+
credentials {
20+
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
21+
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
22+
}
23+
}
1524
}
1625

1726
dependencies {
1827
implementation(libs.revanced.patcher)
1928
implementation(libs.smali)
20-
// TODO: Required because build fails without it. Find a way to remove this dependency.
21-
implementation(libs.guava)
22-
// Used in JsonGenerator.
23-
implementation(libs.gson)
24-
25-
// A dependency to the Android library unfortunately fails the build, which is why this is required.
26-
compileOnly(project("dummy"))
2729
}
2830

2931
kotlin {
3032
jvmToolchain(11)
3133
}
3234

33-
tasks.withType(Jar::class) {
34-
manifest {
35-
attributes["Name"] = "Your Patches"
36-
attributes["Description"] = "Patches for ReVanced."
37-
attributes["Version"] = version
38-
attributes["Timestamp"] = System.currentTimeMillis().toString()
39-
attributes["Source"] = "[email protected]:you/revanced-patches.git"
40-
attributes["Author"] = "You"
41-
attributes["Contact"] = "[email protected]"
42-
attributes["Origin"] = "https://your.homepage"
43-
attributes["License"] = "GNU General Public License v3.0"
35+
tasks {
36+
withType(Jar::class) {
37+
manifest {
38+
attributes["Name"] = "ReVanced Patches template"
39+
attributes["Description"] = "Patches template for ReVanced."
40+
attributes["Version"] = version
41+
attributes["Timestamp"] = System.currentTimeMillis().toString()
42+
attributes["Source"] = "[email protected]:revanced/revanced-patches-template.git"
43+
attributes["Author"] = "ReVanced"
44+
attributes["Contact"] = "[email protected]"
45+
attributes["Origin"] = "https://revanced.app"
46+
attributes["License"] = "GNU General Public License v3.0"
47+
}
4448
}
45-
}
4649

47-
tasks {
48-
register<DefaultTask>("generateBundle") {
49-
description = "Generate DEX files and add them in the JAR file"
50+
register("buildDexJar") {
51+
description = "Build and add a DEX to the JAR file"
52+
group = "build"
5053

5154
dependsOn(build)
5255

5356
doLast {
5457
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools")
5558
.listFilesOrdered().last().resolve("d8").absolutePath
5659

57-
val artifacts = configurations.archives.get().allArtifacts.files.files.first().absolutePath
60+
val patchesJar = configurations.archives.get().allArtifacts.files.files.first().absolutePath
5861
val workingDirectory = layout.buildDirectory.dir("libs").get().asFile
5962

6063
exec {
6164
workingDir = workingDirectory
62-
commandLine = listOf(d8, artifacts)
65+
commandLine = listOf(d8, "--release", patchesJar)
6366
}
6467

6568
exec {
6669
workingDir = workingDirectory
67-
commandLine = listOf("zip", "-u", artifacts, "classes.dex")
70+
commandLine = listOf("zip", "-u", patchesJar, "classes.dex")
6871
}
6972
}
7073
}
7174

72-
// Required to run tasks because Gradle semantic-release plugin runs the publish task.
75+
// Needed by gradle-semantic-release-plugin.
7376
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
74-
named("publish") {
75-
dependsOn("generateBundle")
77+
publish {
78+
dependsOn("buildDexJar")
7679
}
7780
}
7881

7982
publishing {
83+
repositories {
84+
maven {
85+
name = "GitHubPackages"
86+
url = uri("https://maven.pkg.github.com/revanced/revanced-patches-template")
87+
credentials {
88+
username = System.getenv("GITHUB_ACTOR")
89+
password = System.getenv("GITHUB_TOKEN")
90+
}
91+
}
92+
}
93+
8094
publications {
8195
create<MavenPublication>("revanced-patches-publication") {
8296
from(components["java"])
8397

8498
pom {
85-
name = "Your Patches"
86-
description = "Patches for ReVanced."
87-
url = "https://your.homepage"
99+
name = "ReVanced Patches template"
100+
description = "Patches template for ReVanced."
101+
url = "https://revanced.app"
88102

89103
licenses {
90104
license {
@@ -94,17 +108,23 @@ publishing {
94108
}
95109
developers {
96110
developer {
97-
id = "Your ID"
98-
name = "Your Name"
99-
email = "contact@your.homepage"
111+
id = "ReVanced"
112+
name = "ReVanced"
113+
email = "contact@revanced.app"
100114
}
101115
}
102116
scm {
103-
connection = "scm:git:git://github.com/you/revanced-patches.git"
104-
developerConnection = "scm:git:[email protected]:you/revanced-patches.git"
105-
url = "https://github.com/you/revanced-patches"
117+
connection = "scm:git:git://github.com/revanced/revanced-patches-template.git"
118+
developerConnection = "scm:git:[email protected]:revanced/revanced-patches-template.git"
119+
url = "https://github.com/revanced/revanced-patches-template"
106120
}
107121
}
108122
}
109123
}
110124
}
125+
126+
signing {
127+
useGpgCmd()
128+
129+
sign(publishing.publications["revanced-patches-publication"])
130+
}

dummy/build.gradle.kts

Lines changed: 0 additions & 9 deletions
This file was deleted.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
org.gradle.parallel = true
22
org.gradle.caching = true
33
kotlin.code.style = official
4-
version = 1.0.0
4+
version = 1.0.1-dev.1

gradle/libs.versions.toml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
[versions]
2-
revanced-patcher = "19.0.0"
3-
smali = "3.0.3"
4-
guava = "32.1.2-jre"
5-
gson = "2.10.1"
2+
revanced-patcher = "19.3.1"
3+
smali = "3.0.4"
4+
binary-compatibility-validator = "0.14.0"
5+
kotlin = "1.9.22"
66

77
[libraries]
88
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
99
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" }
10-
guava = { module = "com.google.guava:guava", version.ref = "guava" }
11-
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
10+
11+
[plugins]
12+
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" }
13+
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }

0 commit comments

Comments
 (0)