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

[Deps] Update Kotlin to 2.0.21 #12896

Merged
merged 15 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 11 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,6 @@ local-builds.gradle
# gitignore for retrocompatibility, so that it won't appear as a new file and
# be accidentally checked in the repository.
google-upload-credentials.json

# Kotlin
.kotlin/
12 changes: 4 additions & 8 deletions WooCommerce-Wear/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import io.sentry.android.gradle.extensions.InstrumentationFeature
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.google.dagger.hilt)
alias(libs.plugins.ksp)
Expand Down Expand Up @@ -77,19 +79,13 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
sourceCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
wzieba marked this conversation as resolved.
Show resolved Hide resolved
targetCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
}
buildFeatures {
buildConfig true
compose true
}
composeOptions {
kotlinCompilerExtensionVersion libs.versions.androidx.compose.compiler.get()
}
packaging {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
Expand Down
10 changes: 4 additions & 6 deletions WooCommerce/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import io.sentry.android.gradle.extensions.InstrumentationFeature
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.parcelize)
alias(libs.plugins.google.dagger.hilt)
alias(libs.plugins.sentry)
Expand Down Expand Up @@ -145,15 +147,11 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
targetCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
coreLibraryDesugaringEnabled true
}

composeOptions {
kotlinCompilerExtensionVersion libs.versions.androidx.compose.compiler.get()
}

flavorDimensions "buildType"

productFlavors {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class LoginWhatIsJetpackDialogFragment : DialogFragment() {
const val TAG = "LoginWhatIsJetpackDialogFragment"
}

@Deprecated("Deprecated in Java")
@Suppress("DEPRECATION")
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ class MainActivity :
}
}

@Deprecated("Deprecated in Java")
override fun onBackPressed() {
AnalyticsTracker.trackBackPressed(this)

Expand Down Expand Up @@ -1231,6 +1232,7 @@ class MainActivity :
)
}

@Deprecated("Deprecated in Java")
override fun onAttachFragment(fragment: Fragment) {
super.onAttachFragment(fragment)
updateAppBarVisibility(fragment)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class PrintShippingLabelFragment : BaseFragment(R.layout.fragment_print_shipping
private fun setupToolbar(binding: FragmentPrintShippingLabelBinding) {
binding.toolbar.title = getString(viewModel.screenTitle)
binding.toolbar.setNavigationOnClickListener {
@Suppress("DEPRECATION")
when {
requireContext().windowSizeClass != WindowSizeClass.Compact && onRequestAllowBackPress() -> {
findNavController().navigateUp()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class ParentCategoryListFragment :
viewModel.fetchParentCategories()
}

@Deprecated("Deprecated in Java")
@Suppress("DEPRECATION")
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class ProductCategoriesFragment :
})
}

@Deprecated("Deprecated in Java")
@Suppress("DEPRECATION")
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import com.woocommerce.android.util.CurrencyFormatter
typealias OnProductClickListener = (remoteProductId: Long, sharedView: View?) -> Unit

class ProductListAdapter(
private inline val clickListener: OnProductClickListener? = null,
private val clickListener: OnProductClickListener? = null,
private val loadMoreListener: OnLoadMoreListener,
private val currencyFormatter: CurrencyFormatter,
private val isProductHighlighted: (Long) -> Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.woocommerce.android.databinding.AttributeItemBinding
import com.woocommerce.android.model.ProductAttribute

abstract class AttributeBaseAdapter<T : AttributeBaseAdapter.AttributeBaseViewHolder>(
private inline val onItemClick: (attributeId: Long, attributeName: String) -> Unit
private val onItemClick: (attributeId: Long, attributeName: String) -> Unit
) : RecyclerView.Adapter<T>() {
private var attributeList = listOf<ProductAttribute>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class ReviewDetailFragment :
return inflater.inflate(R.layout.fragment_review_detail, container, false)
}

@Deprecated("Deprecated in Java")
@Suppress("DEPRECATION")
override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import com.woocommerce.android.model.ActionStatus
import com.woocommerce.android.model.ActionStatus.PENDING
import com.woocommerce.android.model.ProductReview

@Suppress("DataClassPrivateConstructor")
data class ReviewModerationRequest private constructor(
data class ReviewModerationRequest(
wzieba marked this conversation as resolved.
Show resolved Hide resolved
val review: ProductReview,
val newStatus: ProductReviewStatus,
private val timeOfRequest: Long
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class GridItemDecoration(
}

class HorizontalItemDecoration(private val spacing: Int) : ItemDecoration() {
@Deprecated("Deprecated in Java")
override fun getItemOffsets(outRect: Rect, itemPosition: Int, parent: RecyclerView) {
outRect.left = spacing
outRect.right = spacing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,10 @@ internal class UpdateAnalyticsHubStatsTest : BaseUnitTest() {

@Test
fun `when data store allows new stats fetch, then request data with ForceNew strategy`() = testBlocking {
// Given
whenever(repository.fetchVisitorsData(testRangeSelection, ForceNew))
.doReturn(testVisitorsResult)

// When
sut(testRangeSelection, this)

Expand All @@ -409,6 +413,8 @@ internal class UpdateAnalyticsHubStatsTest : BaseUnitTest() {
analyticsUpdateDataStore = analyticsDataStore,
analyticsRepository = repository
)
whenever(repository.fetchVisitorsData(testRangeSelection, Saved))
.doReturn(testVisitorsResult)

// When
sut(testRangeSelection, this)
Expand Down Expand Up @@ -437,6 +443,8 @@ internal class UpdateAnalyticsHubStatsTest : BaseUnitTest() {
analyticsUpdateDataStore = analyticsDataStore,
analyticsRepository = repository
)
whenever(repository.fetchVisitorsData(testCustomRangeSelection, Saved))
.doReturn(testVisitorsResult)

// When
sut(testCustomRangeSelection, this)
Expand All @@ -457,6 +465,8 @@ internal class UpdateAnalyticsHubStatsTest : BaseUnitTest() {
analyticsUpdateDataStore = analyticsDataStore,
analyticsRepository = repository
)
whenever(repository.fetchVisitorsData(testRangeSelection, ForceNew))
.doReturn(testVisitorsResult)

// When
sut(testRangeSelection, this, true)
Expand Down Expand Up @@ -490,6 +500,8 @@ internal class UpdateAnalyticsHubStatsTest : BaseUnitTest() {
analyticsUpdateDataStore = analyticsDataStore,
analyticsRepository = repository
)
whenever(repository.fetchVisitorsData(testRangeSelection, Saved))
.doReturn(testVisitorsResult)

// When
sut(testRangeSelection, this, false)
Expand Down Expand Up @@ -539,6 +551,8 @@ internal class UpdateAnalyticsHubStatsTest : BaseUnitTest() {
analyticsUpdateDataStore = analyticsDataStore,
analyticsRepository = repository
)
whenever(repository.fetchVisitorsData(eq(testRangeSelection), any()))
.doReturn(testVisitorsResult)

// When
sut(testRangeSelection, this)
Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import com.automattic.android.measure.MeasureBuildsExtension
import io.gitlab.arturbosch.detekt.Detekt
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
Expand All @@ -10,6 +11,7 @@ plugins {
alias(libs.plugins.android.library) apply false
alias(libs.plugins.android.test) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.compose).apply(false)
alias(libs.plugins.kotlin.parcelize) apply false
alias(libs.plugins.google.dagger.hilt) apply false
alias(libs.plugins.androidx.navigation.safeargs) apply false
Expand All @@ -34,7 +36,7 @@ allprojects {

tasks.withType(KotlinCompile).all {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
jvmTarget = JvmTarget.fromTarget(libs.versions.java.get()).target
allWarningsAsErrors = true
freeCompilerArgs += [
"-opt-in=kotlin.RequiresOptIn",
Expand Down
7 changes: 4 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ androidx-browser = '1.5.0'
androidx-camera = '1.2.3'
androidx-cardview = '1.0.0'
androidx-compose-bom = '2024.04.00'
androidx-compose-compiler = '1.5.9'
androidx-constraintlayout-compose = '1.0.1'
androidx-constraintlayout-main = '2.1.4'
androidx-core-main = '1.13.1'
Expand Down Expand Up @@ -70,12 +69,13 @@ google-services = '4.4.0'
google-zxing = '3.5.3'
gravatar = '0.2.0'
jackson-databind = '2.12.7.1'
java = '11'
jetty-webapp = '9.4.51.v20230217'
json-path = '2.9.0'
junit = '4.13.2'
kotlin = '1.9.22'
kotlin = '2.0.21'
kotlinx-coroutines = '1.8.1'
ksp = '1.9.22-1.0.17'
ksp = '2.0.21-1.0.27'
mockito-inline = '4.6.1'
mockito-kotlin = '4.0.0'
mpandroidchart = 'v3.1.0'
Expand Down Expand Up @@ -246,6 +246,7 @@ google-dagger-hilt = { id = "com.google.dagger.hilt.android", version.ref = "goo
google-protobuf = { id = "com.google.protobuf", version.ref = "google-protobuf-plugin" }
google-services = { id = "com.google.gms.google-services", version.ref = "google-services" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
sentry = { id = "io.sentry.android.gradle", version.ref = "sentry" }
6 changes: 4 additions & 2 deletions libs/cardreader/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
Expand All @@ -21,8 +23,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
targetCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
}
}

Expand Down
9 changes: 4 additions & 5 deletions libs/commons/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
Expand All @@ -13,10 +15,7 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
sourceCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
targetCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
}
}
6 changes: 4 additions & 2 deletions libs/iap/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
Expand All @@ -20,8 +22,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
targetCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
}
}

Expand Down
6 changes: 4 additions & 2 deletions quicklogin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
alias(libs.plugins.android.test)
alias(libs.plugins.kotlin.android)
Expand Down Expand Up @@ -66,8 +68,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
targetCompatibility JvmTarget.fromTarget(libs.versions.java.get()).target
}

buildFeatures {
Expand Down
Loading