diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6c87c75..084dd9a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,7 +60,7 @@ jobs: - name: Build with Gradle run: | chmod +x ./gradlew - ./gradlew --parallel assembleRelease assembleDebug --stacktrace + ./gradlew --parallel zipRelease zipDebug --stacktrace - name: Prepare artifact if: success() @@ -128,4 +128,4 @@ jobs: if [[ "${{ job.status }}" == "success" ]]; then echo "- **Release Artifact**: ${{ steps.prepareArtifact.outputs.releaseName }}" >> $GITHUB_STEP_SUMMARY echo "- **Debug Artifact**: ${{ steps.prepareArtifact.outputs.debugName }}" >> $GITHUB_STEP_SUMMARY - fi \ No newline at end of file + fi diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 4b24a34..9976360 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -81,6 +81,7 @@ android { externalNativeBuild { cmake { path = file("src/main/cpp/CMakeLists.txt") + buildStagingDirectory = layout.buildDirectory.get().asFile version = "3.28.0+" } } @@ -103,6 +104,7 @@ afterEvaluate { val tempModuleDir = project.layout.buildDirectory.dir("tmp/module-${variantName}") tasks.register("copyFiles${capitalized}") { + dependsOn("assemble${capitalized}") val moduleFolder = project.rootDir.resolve("module") val buildDir = project.layout.buildDirectory @@ -176,13 +178,92 @@ afterEvaluate { } // Zip task uses the temp directory - tasks.register("zip${capitalized}") { - dependsOn("prepareModuleFiles${capitalized}") - archiveFileName.set("Tricky-Store-OSS-$verName-$gitCommitCount-$gitCommitHash-${capitalized}.zip") - destinationDirectory.set(project.rootDir.resolve("out")) - from(tempModuleDir) + val zipTask = + tasks.register("zip${capitalized}") { + dependsOn("prepareModuleFiles${capitalized}") + archiveFileName.set( + "TEESimulator-$verName-$gitCommitCount-$gitCommitHash-${capitalized}.zip" + ) + destinationDirectory.set(project.rootDir.resolve("out")) + from(tempModuleDir) + } + + val pushTask = + tasks.register("push${capitalized}") { + group = "TEESimulator Module Installation" + dependsOn(zipTask) + commandLine( + "adb", + "push", + zipTask.get().archiveFile.get().asFile, + "/data/local/tmp", + ) + description = "Pushes the $variantName module zip to the device." + } + + // --- Magisk Install Tasks --- + val installMagiskTask = + tasks.register("installMagisk${capitalized}") { + group = "TEESimulator Module Installation" + dependsOn(pushTask) + commandLine( + "adb", + "shell", + "su", + "-c", + "magisk --install-module /data/local/tmp/${zipTask.get().archiveFileName.get()}", + ) + description = "Installs the $variantName module via Magisk." + } + tasks.register("installMagiskAndReboot${capitalized}") { + group = "TEESimulator Module Installation" + dependsOn(installMagiskTask) + commandLine("adb", "reboot") + description = "Installs the $variantName module via Magisk and reboots." + } + + // --- KernelSU Install Tasks --- + val installKsuTask = + tasks.register("installKsu${capitalized}") { + group = "TEESimulator Module Installation" + dependsOn(pushTask) + commandLine( + "adb", + "shell", + "su", + "-c", + "ksud module install /data/local/tmp/${zipTask.get().archiveFileName.get()}", + ) + description = "Installs the $variantName module via KernelSU." + } + tasks.register("installKsuAndReboot${capitalized}") { + group = "TEESimulator Module Installation" + dependsOn(installKsuTask) + commandLine("adb", "reboot") + description = "Installs the $variantName module via KernelSU and reboots." + } + + // --- APatch Install Tasks --- + val installApatchTask = + tasks.register("installApatch${capitalized}") { + group = "TEESimulator Module Installation" + dependsOn(pushTask) + commandLine( + "adb", + "shell", + "su", + "-c", + "/data/adb/apd module install /data/local/tmp/${zipTask.get().archiveFileName.get()}", + ) + description = "Installs the $variantName module via APatch." + } + tasks.register("installApatchAndReboot${capitalized}") { + group = "TEESimulator Module Installation" + dependsOn(installApatchTask) + commandLine("adb", "reboot") + description = "Installs the $variantName module via APatch and reboots." } tasks["assemble${capitalized}"].finalizedBy("zip${capitalized}") } -} \ No newline at end of file +} diff --git a/app/src/main/cpp/CMakeLists.txt b/app/src/main/cpp/CMakeLists.txt index 561457b..74903e3 100644 --- a/app/src/main/cpp/CMakeLists.txt +++ b/app/src/main/cpp/CMakeLists.txt @@ -6,6 +6,8 @@ project(TrickyStoreOSS) find_package(cxx REQUIRED CONFIG) link_libraries(cxx::cxx) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + add_library(my_logging STATIC logging/logging.cpp) target_include_directories(my_logging PUBLIC logging/include) target_link_libraries(my_logging log)