Skip to content

Commit 56e210b

Browse files
RichSutherSkyLokmaneKrizoukrizoulokmane
authored
[DON-2261] Migrate Gradle build scripts from Groovy to Kotlin DSL (#2532)
* [DON-2261] Migrate Gradle build scripts from Groovy to Kotlin DSL * [DON-2261] Remove older no longer used dependency definitions from libs.versions.toml Removed incorrect afterEvaluate block. * Donburi/extract sdk versions and resolve toml plugin detection (#2560) * copyright * donburi/extract-sdk-versions-and-resolve-toml-plugin-detection * donburi/extract-sdk-versions-and-resolve-toml-plugin-detection * donburi/extract-sdk-versions-and-resolve-toml-plugin-detection --------- Co-authored-by: lokmane.krizou@skyscanner.net <lokmane.krizou@skyscanner.net> * added accediently removed dependencies * remove compiler --------- Co-authored-by: Lokmane Krizou <lokmanekrizou@skyscanner.net> Co-authored-by: lokmane.krizou@skyscanner.net <lokmane.krizou@skyscanner.net>
1 parent dbd4d73 commit 56e210b

40 files changed

+1048
-578
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ gen-external-apklibs
9898
.idea/**/sqlDataSources.xml
9999
.idea/**/dynamic.xml
100100
.idea/**/uiDesigner.xml
101+
.idea/compiler.xml
101102

102103
# Gradle:
103104
.idea/**/gradle.xml

.idea/compiler.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

Backpack/build.gradle.kts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,47 @@
1717
*/
1818

1919
plugins {
20-
id("com.android.library")
21-
id("kotlin-android")
20+
id("backpack.android-library")
21+
id("backpack.publishing")
2222
}
2323

24-
extra["artifactId"] = "backpack-android"
25-
26-
apply(from = "$rootDir/gradle-maven-push.gradle")
27-
apply(from = "$rootDir/android-configuration.gradle")
24+
backpackPublishing {
25+
artifactId = "backpack-android"
26+
}
2827

2928
android {
3029
namespace = "net.skyscanner.backpack"
3130
}
3231

3332
dependencies {
33+
// Module-specific dependencies
3434
api(libs.google.material)
3535
api(libs.androidx.constraintLayout)
3636
api(libs.androidx.cardView)
3737
api(libs.google.maps)
3838
implementation(libs.androidx.swiperefreshLayout)
3939
implementation(libs.androidx.coreKts)
40+
41+
// Test dependencies
42+
testImplementation(libs.test.junit)
4043
androidTestImplementation(libs.test.junitAndroid)
4144
androidTestImplementation(libs.test.junitKtx)
4245
androidTestImplementation(libs.test.espressoCore)
4346
androidTestImplementation(libs.test.espressoContrib)
4447
androidTestImplementation(libs.test.rules)
4548
androidTestImplementation(libs.test.mockitoKotlin)
4649
androidTestImplementation(libs.test.mockitoAndroid)
47-
androidTestImplementation(libs.test.junit)
4850
androidTestImplementation(libs.test.coroutines)
4951

5052
api(project(":backpack-common"))
5153
lintPublish(project(":backpack-lint"))
54+
55+
// Detekt rules
56+
detektPlugins(libs.detektRules.compose)
57+
detektPlugins(libs.detektRules.formatting)
58+
detektPlugins(libs.detektRules.libraries)
5259
}
5360

5461
apply(from = "tokens.gradle.kts")
5562

56-
apply(from = "$rootDir/android-configuration-check.gradle")
63+
apply(from = "$rootDir/android-configuration-check.gradle.kts")
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
* limitations under the License.
1717
*/
1818

19-
task lintOssDebug {
19+
tasks.register("lintOssDebug") {
2020
dependsOn("lintDebug")
2121
}
2222

23-
task testOssDebugUnitTest {
23+
tasks.register("testOssDebugUnitTest") {
2424
dependsOn("testDebugUnitTest")
2525
}

android-configuration.gradle

Lines changed: 0 additions & 56 deletions
This file was deleted.

android-configuration.gradle.kts

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/**
2+
* Backpack for Android - Skyscanner's Design System
3+
*
4+
* Copyright 2018 - 2026 Skyscanner Ltd
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import com.android.build.gradle.LibraryExtension
20+
import org.gradle.accessors.dm.LibrariesForLibs
21+
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
22+
23+
val libs = the<LibrariesForLibs>()
24+
25+
configure<LibraryExtension> {
26+
compileSdk = 36
27+
28+
defaultConfig {
29+
minSdk = 28
30+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
31+
}
32+
33+
compileOptions {
34+
sourceCompatibility = JavaVersion.VERSION_17
35+
targetCompatibility = JavaVersion.VERSION_17
36+
}
37+
38+
lint {
39+
lintConfig = file("$rootDir/lint.xml")
40+
baseline = file("$projectDir/lint-baseline.xml")
41+
checkReleaseBuilds = false // we're already running lint separately
42+
warningsAsErrors = true
43+
disable += "UnusedResources" // we're exposing resources for consumers
44+
targetSdk = 35
45+
}
46+
47+
buildFeatures {
48+
buildConfig = false
49+
}
50+
}
51+
52+
configure<KotlinProjectExtension> {
53+
jvmToolchain(17)
54+
}
55+
56+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
57+
compilerOptions {
58+
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
59+
freeCompilerArgs.add("-opt-in=net.skyscanner.backpack.util.InternalBackpackApi")
60+
}
61+
}
62+
63+
dependencies {
64+
"api"(libs.androidx.annotations)
65+
"api"(libs.kotlin.stdlib)
66+
"api"(libs.kotlin.coroutines)
67+
"api"(libs.androidx.appCompat)
68+
}
69+

app/build.gradle

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)