Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(docs): init docs #157

Draft
wants to merge 29 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6a093ea
feat: init docs
Ushie Aug 7, 2023
41499e1
feat: docs nav
Ushie Aug 7, 2023
0437770
build: use npm
Ushie Aug 7, 2023
8f5cb02
build: specify "run"
Ushie Aug 7, 2023
7c118cc
build: install docusaurus dependencies
Ushie Aug 7, 2023
c390b00
feat(docs): use dark theme by default
Ushie Aug 7, 2023
282a387
feat: update favicon
Ushie Aug 7, 2023
dc07dac
refactor: remove example pages
Ushie Aug 7, 2023
5b1c3d7
refactor: remove unnecessary properties
Ushie Aug 7, 2023
ab5bed0
refactor: use URL class over manually splitting
Ushie Aug 7, 2023
175f133
feat: auto-collapse categories
Ushie Aug 7, 2023
b46374b
feat: use URL from config for logo href
Ushie Aug 7, 2023
6bd4de7
fix: use URL host instead of hostname for /docs
Ushie Aug 7, 2023
a487ca2
fix: append https to specify external link
Ushie Aug 7, 2023
dd7836b
refactor: use origin instead of manually append https
Ushie Aug 7, 2023
79c32c1
feat: make a url var instead of modifying config
Ushie Aug 8, 2023
d5cd2d3
feat: disable switching between themes
Ushie Aug 8, 2023
d71178a
feat: match the main website design
Ushie Aug 8, 2023
b7e765a
feat: add navbar shadow effect on scroll
Ushie Aug 8, 2023
526f825
make design consistent with website
xafn Aug 8, 2023
c70dba2
fix: navbar sometimes hiding
Ushie Aug 8, 2023
e7a5526
Merge branch 'dev' into feat/docusaurus
Ushie Aug 9, 2023
12b1192
fix: update csp
xafn Aug 9, 2023
5b4dcff
feat: more design consistency with website
xafn Aug 10, 2023
3e54c92
refactor: organize css and add comments
xafn Aug 10, 2023
fbfdad1
feat: improve mobile nav consistency
xafn Aug 10, 2023
ac322ac
fix: remove css nesting
xafn Aug 10, 2023
ad13ada
fix: home page path + final mobile nav touches
xafn Aug 10, 2023
d0d9b43
fix: nav media queries
xafn Aug 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docusaurus/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
3 changes: 3 additions & 0 deletions docusaurus/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
7 changes: 7 additions & 0 deletions docusaurus/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Intro
slug: /
sidebar_position: 1
---

HIIIIIIIIIIIIIIIIIIIII
7 changes: 7 additions & 0 deletions docusaurus/docs/development/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "Development",
"position": 2,
"link": {
"type": "generated-index"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 💼 Prerequisites

To develop with ReVanced, you will need to fulfill certain requirements.

## 🤝 Requirements

- A Java IDE such as [IntelliJ IDEA](https://www.jetbrains.com/idea/)
- An Android IDE such as [Android Studio](https://developer.android.com/studio)
- Understanding on how to use the ReVanced CLI
- Java SDK 17 (Azul JDK or OpenJDK)
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# 👨‍💻 Setup a development environment for ReVanced

A certain development environment is suggested to allow for streamlined development on ReVanced.

## 1. ⬇️ Clone necessary repositories

```bash
repositories=(
"revanced-cli"
"revanced-patches"
"revanced-patcher" # optional
"revanced-integrations"
)

for repository in "${repositories[@]}" ; do
git clone -b dev --single-branch --depth 1 https://github.com/revanced/$repository
done
```

## 2. 🛠️ Build from source

### Before building you need to be authenticated to GitHub Packages. This will assume you have a GitHub account

Create a PAT with the scope `read:packages` [here](https://github.com/settings/tokens/new?scopes=read:packages&description=ReVanced) and add your token to `~/.gradle/gradle.properties`.

Example `gradle.properties` file:

```properties
gpr.user = ReVanced
gpr.key = ghp_key
```

### To build all projects, run the following command from the directory which contains the repositories

```bash
repositories=(
"revanced-cli"
"revanced-patches"
"revanced-patcher" # optional
"revanced-integrations"
)

for repository in "${repositories[@]}" ; do
cd $repository
./gradlew build
cd ..
done
```

## 3. ⚙️ Setup IntelliJ IDEA

1. Open the `revanced-cli` project in IntelliJ IDEA and ensure you are using the right JDK from [💼 Prerequisites](0_prerequisites.md)
2. Import the `revanced-patches` and optionally the `revanced-patcher` project as modules into the `revanced-cli` project
3. Add a new Run/Debug configuration for the `revanced-cli` project; Make sure to add `Before launch` tasks to build `revanced-patches` and optionally publish `revanced-patcher`

Example configuration:

```xml
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run ReVanced CLI" type="JetRunConfigurationType">
<option name="MAIN_CLASS_NAME" value="app.revanced.cli.main.MainKt" />
<module name="revanced-cli.main" />
<option name="PROGRAM_PARAMETERS" value="
--options ../options.toml
-o ../revanced.apk
-a ../binaries/unpatched-input.apk
-t ../revanced-cache
-b ../revanced-patches/build/libs/revanced-patches-<version>.jar
-m ../revanced-integrations/app/build/outputs/apk/release/revanced-integrations-<version>.apk
-d device-name"
/>
<method v="2">
<option name="RunConfigurationTask" enabled="true" run_configuration_name="revanced-patcher [publish]" run_configuration_type="GradleRunConfiguration" />
<option name="RunConfigurationTask" enabled="true" run_configuration_name="revanced-patches [build]" run_configuration_type="GradleRunConfiguration" />
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
```

> **Note**: The build file names of `revanced-patches` and `revanced-integrations` change. **Do not forget to update them in the run configuration program arguments.**

## 4. ⚙️ Setup Android Studio

1. Open the `revanced-integrations` project in Android Studio and ensure you are using the latest Android SDK.
2. Add a new default build configuration and confirm if it succeeds.

## 5. ⚠️ Troubleshoot your development environment

To confirm your development environment works as intended, set a breakpoint in any patch from the `revanced-patches` project in IntelliJ IDEA. Run the build configuration for `revanced-cli` and confirm that your IDE reaches and breaks at the breakpoint. Continue and let ReVanced CLI exit.

- If ReVanced CLI output is unexpected, confirm if you supplied the correct program arguments by following [💻 ReVanced CLI](/docs/category/revanced-cli).

- If the breakpoint was not hit, confirm that you correctly added the necessary projects as modules to the `revanced-cli` project

## ❗ Afterword

A couple of things should be considered with the development environment for ReVanced:

- Follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/)

- Pull new commits from remote to keep your branch up to date

- Keep your Run/Debug configuration up to date. Ensure you use the correct paths in your program argument after pulling new commits. If you forget to do this, you might end up debugging for hours until realising, you supply the wrong paths to ReVanced CLI

- Use development branches and always branch off and PR to `dev` branches

- To use the local `revanced-patcher` project in the `revanced-cli` and `revanced-patches` projects, make sure you publish it to the local Maven repository with `./gradlew publish` and use the correct version in the `build.gradle.kts` file in the `revanced-cli` and `revanced-patches` projects, otherwise, it will use the package from GitHub Packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "ReVanced Development",
"position": 1,
"link": {
"type": "generated-index"
}
}
25 changes: 25 additions & 0 deletions docusaurus/docs/development/revanced-patches/0_preparation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 👶 Preparing a development environment

To develop ReVanced patches, a certain development environment is required.

## 📝 Prerequisites

- A Java IDE supporting Kotlin such as [IntelliJ IDEA](https://www.jetbrains.com/idea/)
- Knowledge of Java, [Kotlin](https://kotlinlang.org) and [Dalvik bytecode](https://source.android.com/docs/core/runtime/dalvik-bytecode)
- Android reverse engineering tools such as [jadx](https://github.com/skylot/jadx)

## 🏃 Prepare the environment

For this guide, [ReVanced Patches](https://github.com/revanced/revanced-patches) will be used as a base.

1. Clone the repository

```bash
git clone https://github.com/revanced/revanced-patches && cd revanced-patches
```

2. Build the patches

```bash
./gradlew build
```
37 changes: 37 additions & 0 deletions docusaurus/docs/development/revanced-patches/1_introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 💉 Introduction to ReVanced Patcher

Familiarize yourself with [ReVanced Patcher](https://github.com/revanced/revanced-patcher).

## 📙 How it works

```kt
// Prepare patches to apply and files to merge

val patches = PatchBundle.Jar("revanced-patches.jar").loadPatches()
val mergeList = listOf("integrations.apk")

// Create the options for the patcher

val options = PatcherOptions(
inputFile = File("some.apk"),
resourceCacheDirectory = File("cache"),
)

// Create the patcher and add the prepared patches and files

val patcher = Patcher(options)
.also { it.addPatches(patches) }
.also { it.addFiles(mergeList) }

// Execute and save the patched files

patcher.executePatches().forEach { (patch, result) ->
val log = if (!result.isSuccess)
"failed"
else
"succeeded"
println("$patch $log")
}

val result = patcher.save()
```
Loading