Skip to content

Instantly share code, notes, and snippets.

View autonomousapps's full-sized avatar

Tony Robalik autonomousapps

View GitHub Profile
@autonomousapps
autonomousapps / AndroidApks.kt
Last active April 22, 2022 23:18
Provider for single APK using latest AGP APIs
import org.gradle.api.file.Directory
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.InputFiles
import java.io.File
import javax.inject.Inject
/**
* This essentially encapsulates the pattern described in
* [ExamplePlugin in AGP's "Gradle Recipes" repo](https://github.com/android/gradle-recipes/blob/agp-7.0/BuildSrc/getApksTest/buildSrc/src/main/kotlin/ExamplePlugin.kt#L45-L48).
@autonomousapps
autonomousapps / PluginTest.kt
Created November 16, 2023 18:43
Example usage of gradle-testkit-support
/**
* An example usage of https://github.com/autonomousapps/dependency-analysis-gradle-plugin/tree/main/testkit.
* This uses JUnit5 as the test framework. The test is paramaterized as well. The custom task `printVersions`,
* in the test fixture, unzips the jar and prints the contents of a resource file in that jar. The resource file
* is generated by "my-plugin", which is an internal plugin that bundles the runtime classpath artifact names
* (group:artifact:version) into the final jar built by the application.
*/
internal class PluginTest {
private companion object {