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

Fix click listener kapt bug #1327

Merged
merged 3 commits into from
May 19, 2023
Merged
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
5 changes: 0 additions & 5 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 20 additions & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,24 @@ Releasing
2. Update `CHANGELOG.md` for the impending release.
3. `git commit -am "Prepare for release X.Y.Z."` (where X.Y.Z is the version you set in step 1)
4. Add your sonatype login information under gradle properties mavenCentralUsername and mavenCentralPassword in your local user gradle.properties file
5. Make sure you have a gpg signing key configured (https://vanniktech.github.io/gradle-maven-publish-plugin/central/#secrets)
5. `./gradlew publish` to build the artifacts and publish them to maven
7. Open PR on Github, merge, and publish release through Github UI.
7. Open PR on Github, merge, and publish release through Github UI.

Publishing a release to an internal repository
========

To publish an internal release to an Artifactory repository:

1. Set credential values for ARTIFACTORY_USERNAME and ARTIFACTORY_PASSWORD in your local gradle.properties
2. Set values for ARTIFACTORY_RELEASE_URL (and optionally ARTIFACTORY_SNAPSHOT_URL if you are publishing a snapshot)
3. /gradlew publishAllPublicationsToAirbnbArtifactoryRepository -PdoNotSignRelease=true
4. "-PdoNotSignRelease=true" is optional, but we don't need to sign artifactory releases and this allows everyone to publish without setting up a gpg key

If you need to publish to a different repository, look at the configuration in 'publishing.gradle'
to see how to configure additional repositories.

Maven Local Installation
=======================

If testing changes locally, you can install to mavenLocal via `./gradlew publishToMavenLocal`
2 changes: 1 addition & 1 deletion epoxy-adapter/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-parcelize'
apply plugin: "com.vanniktech.maven.publish"
apply from: '../publishing.gradle'

android {
compileSdkVersion rootProject.COMPILE_SDK_VERSION
Expand Down
2 changes: 1 addition & 1 deletion epoxy-annotations/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apply plugin: 'java'
apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: "com.vanniktech.maven.publish"
apply from: '../publishing.gradle'

sourceCompatibility = rootProject.JAVA_SOURCE_VERSION
targetCompatibility = rootProject.JAVA_TARGET_VERSION
Expand Down
2 changes: 1 addition & 1 deletion epoxy-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id 'kotlin-android'
id 'kotlin-kapt'
}
apply plugin: "com.vanniktech.maven.publish"
apply from: '../publishing.gradle'

android {
compileSdkVersion rootProject.COMPILE_SDK_VERSION
Expand Down
2 changes: 1 addition & 1 deletion epoxy-databinding/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: "com.vanniktech.maven.publish"
apply from: '../publishing.gradle'

android {
compileSdkVersion rootProject.COMPILE_SDK_VERSION
Expand Down
2 changes: 1 addition & 1 deletion epoxy-glide-preloader/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: "com.vanniktech.maven.publish"
apply from: '../publishing.gradle'

android {
compileSdkVersion rootProject.COMPILE_SDK_VERSION
Expand Down
2 changes: 1 addition & 1 deletion epoxy-modelfactory/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'com.android.library'
apply plugin: "com.vanniktech.maven.publish"
apply from: '../publishing.gradle'

android {
compileSdkVersion rootProject.COMPILE_SDK_VERSION
Expand Down
2 changes: 1 addition & 1 deletion epoxy-paging3/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: "com.vanniktech.maven.publish"
apply from: '../publishing.gradle'

android {
compileSdkVersion rootProject.COMPILE_SDK_VERSION
Expand Down
2 changes: 1 addition & 1 deletion epoxy-processor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'org.jetbrains.kotlin.kapt'
apply plugin: "com.vanniktech.maven.publish"
apply from: '../publishing.gradle'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ class Type(val xType: XType, memoizer: Memoizer) {
xType.isTypeOf(CharSequence::class) || xType.isTypeOf(String::class) -> StringOrCharSequence
xType.typeName == ClassNames.EPOXY_STRING_ATTRIBUTE_DATA -> StringAttributeData
// We don't care about nullability for the purposes of type checking
nonNullType == memoizer.viewOnClickListenerType -> ViewClickListener
nonNullType == memoizer.viewOnLongClickListenerType -> ViewLongClickListener
nonNullType == memoizer.viewOnCheckChangedType -> ViewCheckedChangeListener
// Note, == does not work for type comparisons when comparing types between classpath
Copy link
Collaborator

Choose a reason for hiding this comment

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

any chance you could maybe describe the bug a bit more in the PR description. Just helps me understand a bit better. I can follow that the equals check wasn't what was needed but didn't understand what the difference in the generated code looked like

Copy link
Collaborator

Choose a reason for hiding this comment

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

is there any test case that could be added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hard to test because this happens when they are in different modules

// and compiled sources so we must use isSameType.
nonNullType.isSameType(memoizer.viewOnClickListenerType) -> ViewClickListener
nonNullType.isSameType(memoizer.viewOnLongClickListenerType) -> ViewLongClickListener
nonNullType.isSameType(memoizer.viewOnCheckChangedType) -> ViewCheckedChangeListener
xType.isTypeOf(List::class) -> {
val listType = xType.typeArguments.singleOrNull()
when {
Expand All @@ -54,6 +56,7 @@ class Type(val xType: XType, memoizer: Memoizer) {
else -> Unknown
}
}

else -> Unknown
}
}
Expand Down
2 changes: 1 addition & 1 deletion epoxy-viewbinder/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: "com.vanniktech.maven.publish"
apply from: '../publishing.gradle'

android {
compileSdkVersion rootProject.COMPILE_SDK_VERSION
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=5.1.1
VERSION_NAME=5.1.2
GROUP=com.airbnb.android
POM_DESCRIPTION=Epoxy is a system for composing complex screens with a ReyclerView in Android.
POM_URL=https://github.com/airbnb/epoxy
Expand All @@ -21,7 +21,6 @@ org.gradle.parallel=true

# Publishing configuration for vanniktech/gradle-maven-publish-plugin
SONATYPE_HOST=DEFAULT
RELEASE_SIGNING_ENABLED=true
SONATYPE_AUTOMATIC_RELEASE=true

# Dokka fails without a larger metaspace https://github.com/Kotlin/dokka/issues/1405
Expand Down
29 changes: 29 additions & 0 deletions publishing.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Sets up publishing of release artifacts.
// Note: Keep this script in sync across all airbnb open source projects.
apply plugin: 'com.vanniktech.maven.publish'


// https://vanniktech.github.io/gradle-maven-publish-plugin/other/
publishing {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you for this file, I ended up using this for Showkase publishing as well 🙏

repositories {
maven {
// The "name" value creates a task like `publishAllPublicationsTo[Name]Repository
// In this case, publishAllPublicationsToAirbnbArtifactoryRepository
name = 'airbnbArtifactory'
url = version.toString().endsWith("SNAPSHOT") ? findProperty("ARTIFACTORY_SNAPSHOT_URL") : findProperty("ARTIFACTORY_RELEASE_URL")
credentials {
username = getProperty("ARTIFACTORY_USERNAME")
password = getProperty("ARTIFACTORY_PASSWORD")
}
}
}
}

mavenPublishing {
if (findProperty("doNotSignRelease").toString().toBoolean()) {
println("Skipping release signing")
} else {
println("Signing release with gpg")
signAllPublications()
}
}