Skip to content

Commit

Permalink
Merge pull request #12896 from woocommerce/deps/update-kotlin-to-2.0.21
Browse files Browse the repository at this point in the history
[Deps] Update Kotlin to 2.0.21
  • Loading branch information
ParaskP7 authored Nov 14, 2024
2 parents b60474a + 35ddc4a commit bb66fa8
Show file tree
Hide file tree
Showing 20 changed files with 49 additions and 39 deletions.
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/
11 changes: 3 additions & 8 deletions WooCommerce-Wear/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import io.sentry.android.gradle.extensions.InstrumentationFeature
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 +78,13 @@ android {
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
sourceCompatibility libs.versions.java.get()
targetCompatibility libs.versions.java.get()
}
buildFeatures {
buildConfig true
compose true
}
composeOptions {
kotlinCompilerExtensionVersion libs.versions.androidx.compose.compiler.get()
}
packaging {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
Expand Down
9 changes: 3 additions & 6 deletions WooCommerce/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import io.sentry.android.gradle.extensions.InstrumentationFeature
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 +146,11 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility libs.versions.java.get()
targetCompatibility libs.versions.java.get()
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,17 +4,11 @@ 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(
val review: ProductReview,
val newStatus: ProductReviewStatus,
private val timeOfRequest: Long
) : Comparable<ReviewModerationRequest> {
constructor(review: ProductReview, newStatus: ProductReviewStatus) : this(
review,
newStatus,
System.currentTimeMillis()
)
private val timeOfRequest = System.currentTimeMillis()

override fun compareTo(other: ReviewModerationRequest): Int {
return timeOfRequest.compareTo(other.timeOfRequest)
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
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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 +35,7 @@ allprojects {

tasks.withType(KotlinCompile).all {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
jvmTarget = libs.versions.java.get()
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" }
4 changes: 2 additions & 2 deletions libs/cardreader/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ android {
}

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

Expand Down
7 changes: 2 additions & 5 deletions libs/commons/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
sourceCompatibility libs.versions.java.get()
targetCompatibility libs.versions.java.get()
}
}
4 changes: 2 additions & 2 deletions libs/iap/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ android {
}

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

Expand Down
4 changes: 2 additions & 2 deletions quicklogin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ android {
}

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

buildFeatures {
Expand Down

0 comments on commit bb66fa8

Please sign in to comment.