4.8 KiB
👨💻 Setup a development environment for ReVanced
A certain development environment is suggested to allow for streamlined development on ReVanced.
🚀 Get started
-
⬇️ Clone repositories
mkdir revanced && cd revanced repositories=( "revanced-cli" "revanced-patches" "revanced-patcher" # Only if you want to work on ReVanced Patcher "revanced-library" # Only if you want to work on ReVanced Library "revanced-integrations" ) for repository in "${repositories[@]}" ; do git clone -b dev --single-branch --depth 1 https://github.com/revanced/$repository done -
🛠️ Build
To build all projects, run the following command from the directory which contains the repositories.
for project in */; do cd "$project" && ./gradlew build && cd .. done
Note
If the build fails due to authentication, you may need to authenticate to GitHub Packages. Create a personal access tokens with the scope
read:packageshere and add your token to ~/.gradle/gradle.properties. Create the file if it does not exist.Example
gradle.propertiesfile:gpr.user = <GitHub username> gpr.key = <Personal access token>
⚙️ Setup your workspace in IntelliJ IDEA
-
Open the
revanced-cliproject in IntelliJ IDEA and ensure you are using the right JDK from 💼 Prerequisites -
Import other projects you cloned earlier as modules to the
revanced-cliproject- Open the
Project Structuredialog by pressingCtrl + Alt + Shift + S - Click on
Modulesand add the other projects as modules to therevanced-cliproject
- Open the
-
Add a new Run/Debug configuration for
revanced-cli; Make sure to addBefore launchtasks to buildrevanced-patchesorrevanced-integrationsif necessary-
Open the
Run/Debug Configurationsdialog by pressingAlt + Shift + F10and selectingEdit Configurations... -
Add a new
Kotlinconfiguration and configure it as follows:-
Main class:app.revanced.cli.command.MainCommandKt -
Program arguments: The program arguments you would use to run ReVanced CLI from the command line Example program arguments:patch -b revanced-patches\build\libs\revanced-patches-<version>.jar -m revanced-integrations\app\build\outputs\apk\release\revanced-integrations-<version>.apk binaries\some.apk -d -
Working directory: The parent directory of therevanced-cliproject ($ProjectFileDir$/..) -
Before launch: Add aGradletask to buildrevanced-patches(andrevanced-integrationsif necessary)- Click on the
+button and selectGradle - Select the
revanced-patchesproject and add thebuildtask - Optionally, add the
revanced-integrationsproject and thebuildtask
Ensure the
Buildtask of therevanced-cliproject is the last task in the list. - Click on the
-
-
Warning
With every release in the
revanced-patchesandrevanced-integrationsprojects, the names of the artifacts change. Do not forget to update them in the run configuration program arguments when you pull new commits.
Tip
To test the
revanced-patcherandrevanced-libraryprojects, publish them to your local Maven repository by running./gradlew publishToMavenLocal.
You can now use them as dependencies in local projects such asrevanced-patchesorrevanced-cli.
⚠️ Troubleshoot your development environment
Confirm that your development environment works as intended:
-
Debug the build configuration for
revanced-cliand confirm that your IDE reaches and breaks at the breakpoint. Continue and let ReVanced CLI exit.- If the ReVanced CLI output is unexpected, confirm that you supplied the correct program arguments by following 💻 ReVanced CLI.
- If the breakpoint was not hit, confirm that you correctly added the necessary projects as modules to the
revanced-cliproject
❗ Afterword
A couple of things should be considered with the development environment for ReVanced:
- Follow conventional commits
- If you intend to contribute to ReVanced, ensure that you branch off and PR to
devbranches and follow the contribution guidelines of the respective repository - Merge new commits regularly from the remotes to keep your branch up to date
- Keep your Run/Debug configuration up to date. After pulling new commits, ensure you use the correct paths in
Program arguments. If you forget to do this, you might end up debugging for hours until realizing, you supply paths to old artifacts, because the artifact names change with new releases