-
Notifications
You must be signed in to change notification settings - Fork 222
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
Add support for snapshots for android multiplatform #1649
base: master
Are you sure you want to change the base?
Conversation
e6defe1
to
f71a4cb
Compare
@@ -89,7 +90,30 @@ public class PaparazziPlugin @Inject constructor( | |||
project.addTestDependency() | |||
val layoutlibNativeRuntimeFileCollection = project.setupLayoutlibRuntimeDependency() | |||
val layoutlibResourcesFileCollection = project.setupLayoutlibResourcesDependency() | |||
val snapshotOutputDir = project.layout.projectDirectory.dir("src/test/snapshots") | |||
val testSourceSetProvider = project.objects.directoryProperty() | |||
testSourceSetProvider.set(project.layout.projectDirectory.dir("src/test")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there should be a way to query Gradle for the test source set, vs hardcoding them
androidTarget { | ||
publishLibraryVariants('release') | ||
} | ||
|
||
sourceSets { | ||
commonTest.dependencies { | ||
|
||
} | ||
commonMain.dependencies { | ||
|
||
} | ||
androidMain { | ||
dependencies { | ||
implementation 'androidx.appcompat:appcompat:1.7.0' | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
androidTarget { | |
publishLibraryVariants('release') | |
} | |
sourceSets { | |
commonTest.dependencies { | |
} | |
commonMain.dependencies { | |
} | |
androidMain { | |
dependencies { | |
implementation 'androidx.appcompat:appcompat:1.7.0' | |
} | |
} | |
} | |
androidTarget() |
none of this KMP boilerplate affects the test purpose
dependencies { | ||
testImplementation libs.junit | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dependencies { | |
testImplementation libs.junit | |
} |
|
||
@Test | ||
fun test() { | ||
paparazzi.snapshot(HelloPaparazzi(paparazzi.context)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paparazzi.snapshot(HelloPaparazzi(paparazzi.context)) | |
paparazzi.snapshot(TextView(paparazzi.context).apply { text = "Hello Paparazzi!" }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
kotlinOptions { | ||
jvmTarget = libs.versions.javaTarget.get() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
interesting that KMP requires this, but the other projects don't!
project.plugins.withId("org.jetbrains.kotlin.multiplatform") { | ||
val kmpExtension = project.extensions.getByType(KotlinMultiplatformExtension::class.java) | ||
kmpExtension.sourceSets.all { sourceSet -> | ||
if (sourceSet.name == "androidUnitTest" || sourceSet.name == "androidTest") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar, is there a way for the plugin to tell us test source sets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while i agree that hardcoded values aren't great, this is still an improvement over our current setup which breaks the directory structure for multiplatform projects.
f71a4cb
to
b4d6694
Compare
hey, any updates on this? :) |
Adds source set support for Android Multiplatform projects.
Closes #595.