group = "app.twitter" patches { about { name = "X Patches" description = "Patches for X (Twitter)" source = "https://git.krtss.de/StanPonomarev/twitter-patch" author = "Stan Ponomarev" contact = "contact@krtss.de" website = "https://git.krtss.de/StanPonomarev/twitter-patch" license = "GPLv3" } } kotlin { compilerOptions { freeCompilerArgs.add("-Xcontext-parameters") } } // Separate configuration so gson is available at runtime for the // generatePatchesList task but never bundled into the APK. val patchListGeneratorClasspath = configurations.create("patchListGeneratorClasspath") val integrationTestSourceSet = sourceSets.create("integrationTest") { compileClasspath += sourceSets.main.get().output runtimeClasspath += sourceSets.main.get().output } configurations[integrationTestSourceSet.implementationConfigurationName] .extendsFrom(configurations.testImplementation.get()) configurations[integrationTestSourceSet.runtimeOnlyConfigurationName] .extendsFrom(configurations.testRuntimeOnly.get()) dependencies { compileOnly(libs.gson) patchListGeneratorClasspath(libs.gson) add(integrationTestSourceSet.implementationConfigurationName, kotlin("test-junit")) add(integrationTestSourceSet.implementationConfigurationName, libs.gson) } tasks { register("generatePatchesList") { description = "Build patch with patch list" dependsOn(buildAndroid) classpath = sourceSets["main"].runtimeClasspath + patchListGeneratorClasspath mainClass.set("util.PatchListGeneratorKt") } // Used by gradle-semantic-release-plugin. publish { dependsOn("generatePatchesList") } } tasks.register("integrationTest") { group = "verification" description = "Downloads Morphe Desktop and applies the patch bundle to twitter.apkm." dependsOn("buildAndroid") testClassesDirs = integrationTestSourceSet.output.classesDirs classpath = integrationTestSourceSet.runtimeClasspath val inputApkm = rootProject.layout.projectDirectory.file("twitter.apkm") val patchBundle = layout.buildDirectory.file("libs/${project.name}-${project.version}.mpp") val morpheCache = layout.buildDirectory.dir("verification/tools") inputs.file(inputApkm) inputs.file(patchBundle) systemProperty("integrationTest.inputApkm", inputApkm.asFile.absolutePath) systemProperty("integrationTest.patchBundle", patchBundle.get().asFile.absolutePath) systemProperty("integrationTest.morpheCache", morpheCache.get().asFile.absolutePath) systemProperty( "integrationTest.javaExecutable", javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(21) }.get().executablePath.asFile.absolutePath ) }