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

Pull out SDK into its own module #1462

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

jrodbx
Copy link
Collaborator

@jrodbx jrodbx commented May 29, 2024

Note that this does not rename the artifacts as that would be a breaking change; this should remain binary compatible until 2.0

Also, many of the files in this changeset are simply file renames/moves, so hopefully not as intimidating to review :)

@@ -1,3 +1,5 @@
@file:Suppress("invisible_reference", "invisible_member")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

allows "friend references", i.e., extending internal access across cross project-modules. By default, kotlin only allows code within the same module to access internal members.

Copy link
Contributor

Choose a reason for hiding this comment

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

@@ -42,7 +42,6 @@ dependencies {
api libs.tools.ninepatch
api libs.tools.sdkCommon
api libs.kxml2
api libs.junit
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🎉

"paparazzi.layoutlib.resources.root",
configurations.layoutlibResources.singleFile.absolutePath
)
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

a bit unfortunate that both the sdk and junit rule needs this; but it makes sense, the actual config in practice would come from the (gradle) plugin. might make sense to evolve the sdk into a builder pattern; i'll mess around with this in a follow-up.

@@ -329,7 +329,7 @@ public class PaparazziPlugin : Plugin<Project> {

private fun Project.addTestDependency() {
val dependency = if (isInternal()) {
dependencies.project(mapOf("path" to ":paparazzi"))
dependencies.project(mapOf("path" to ":paparazzi-junit4"))
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

deliberate for now. can query gradle extension config for junit4 vs junit5, but not sure how to keep it generic for other 3rd party wrappers.

dependencies {
testImplementationAarAsJar libs.androidx.compose.ui.android
compileOnlyAarAsJar libs.androidx.compose.ui.android
compileOnlyAarAsJar libs.androidx.compose.runtime
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

calling out this switcheroo; replacing compileOnlyAarAsJar libs.androidx.activity with this: https://github.com/cashapp/paparazzi/pull/1462/files#diff-697f70cdd88ba88fe77eebda60c7e143f6ad1286bca75017421e93ad84fb87df

Copy link
Collaborator

Choose a reason for hiding this comment

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

nice, much better dependency

Base automatically changed from jrod/2024-05-29/build-script-cleanup to master May 29, 2024 18:36
@jrodbx jrodbx force-pushed the jrod/2024-05-17/sdk-module branch from 59ea47e to 98db626 Compare May 29, 2024 18:37
Copy link
Collaborator

@BrianGardnerAtl BrianGardnerAtl left a comment

Choose a reason for hiding this comment

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

Looks good! Looking forward to the sdk builder pattern

@@ -1,3 +1,5 @@
@file:Suppress("invisible_reference", "invisible_member")
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using all uppercase to highlight that you're suppressing compiler errors

See https://github.com/JetBrains/kotlin/blob/master/compiler/frontend/src/org/jetbrains/kotlin/diagnostics/rendering/DefaultErrorMessages.java

Suggested change
@file:Suppress("invisible_reference", "invisible_member")
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER")

Copy link
Contributor

@TWiStErRob TWiStErRob Jun 19, 2024

Choose a reason for hiding this comment

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

Did you intentionally keep the ...:paparazzi Maven coordinate here?

Consider publishing the -junit4 from the -junit4 module and reintroduce a :paparazzi module that apis both the sdk and the junit4.

}

tasks.named("dokkaGfm").configure {
outputDirectory = rootProject.file("docs/1.x")
Copy link
Contributor

Choose a reason for hiding this comment

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

Amazing that you did all this while keeping 1.x 👏🏻

@@ -28,7 +28,7 @@ import java.util.logging.Logger.getLogger
* This logger delegates to java.util.Logging.
*/
internal class PaparazziLogger : ILayoutLog, ILogger {
Copy link
Contributor

Choose a reason for hiding this comment

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

rename class to match module/logger?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants