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

Make AGP and KGP deps compileOnly #1105

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ docs/1.x
docs/changelog.md
docs/index.md
site/

# Generated in tests
/paparazzi-gradle-plugin/src/test/projects/rerun-resource-change/src/main/res/values/colors.xml
/paparazzi-gradle-plugin/src/test/projects/rerun-asset-change/src/main/assets/secret.txt
Comment on lines +23 to +24
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These were getting generated as untracked files when I ran tests locally, so opportunistically adding them here

28 changes: 25 additions & 3 deletions paparazzi-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,37 @@ gradlePlugin {
}
}

// Fix missing implicit task dependency in Gradle's test kit
tasks.named("processTestResources") { dependsOn("pluginUnderTestMetadata") }

// Fix missing implicit task dependency in Gradle's test kit
tasks.named("processTestResources") { it.dependsOn("pluginUnderTestMetadata") }

Configuration addTestPlugin = configurations.create("addTestPlugin")

configurations {
testImplementation.extendsFrom(addTestPlugin)
}

tasks.pluginUnderTestMetadata {
// make sure the test can access plugins for coordination.
pluginClasspath.from(addTestPlugin)
}
Comment on lines +29 to +38
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pattern is what we use in Keeper to test against non-bundled KGP/AGP deps


dependencies {
compileOnly gradleApi()
implementation platform(libs.kotlin.bom)
implementation libs.plugin.kotlin
implementation libs.plugin.android
implementation(libs.tools.sdkCommon) {
compileOnly libs.plugin.kotlin
compileOnly libs.plugin.android
compileOnly(libs.tools.sdkCommon) {
because "SymbolUtils.getPackageNameFromManifest removed in AGP 7.0. Replace?"
}

add(addTestPlugin.name, libs.plugin.kotlin)
add(addTestPlugin.name, libs.plugin.android)
add(addTestPlugin.name, libs.tools.sdkCommon) {
because "SymbolUtils.getPackageNameFromManifest removed in AGP 7.0. Replace?"
}
testImplementation libs.junit
testImplementation libs.truth
}
Expand Down