Skip to content

Commit e9d0210

Browse files
RichSutherSkyclaudekrizoulokmane
authored
[DON-2469] chore: update Gradle to 9.1 and address warnings in build … (#2559)
* [DON-2469] chore: update Gradle to 9.1 and address warnings in build scripts Co-authored-by: Claude <noreply@anthropic.com> * feat: add Backpack Android plugins for application, library, and publishing Co-authored-by: Claude <noreply@anthropic.com> * update kotlin version Co-authored-by: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: lokmane.krizou@skyscanner.net <lokmane.krizou@skyscanner.net>
1 parent 56e210b commit e9d0210

File tree

13 files changed

+352
-248
lines changed

13 files changed

+352
-248
lines changed

build-logic/conventions/build.gradle.kts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
plugins {
2020
`kotlin-dsl`
21+
`java-gradle-plugin`
22+
alias(libs.plugins.kotlin.jvm)
2123
}
2224

2325
dependencies {
@@ -29,3 +31,28 @@ java {
2931
sourceCompatibility = JavaVersion.VERSION_17
3032
targetCompatibility = JavaVersion.VERSION_17
3133
}
34+
35+
kotlin {
36+
jvmToolchain(17)
37+
}
38+
39+
gradlePlugin {
40+
plugins {
41+
register("backpackAndroidLibrary") {
42+
id = "backpack.android-library"
43+
implementationClass = "net.skyscanner.backpack.conventions.BackpackAndroidLibraryPlugin"
44+
}
45+
register("backpackAndroidApp") {
46+
id = "backpack.android-app"
47+
implementationClass = "net.skyscanner.backpack.conventions.BackpackAndroidAppPlugin"
48+
}
49+
register("backpackKotlinLibrary") {
50+
id = "backpack.kotlin-library"
51+
implementationClass = "net.skyscanner.backpack.conventions.BackpackKotlinLibraryPlugin"
52+
}
53+
register("backpackPublishing") {
54+
id = "backpack.publishing"
55+
implementationClass = "net.skyscanner.backpack.conventions.BackpackPublishingPlugin"
56+
}
57+
}
58+
}

build-logic/conventions/src/main/kotlin/backpack.android-app.gradle.kts

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

build-logic/conventions/src/main/kotlin/backpack.android-library.gradle.kts

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

build-logic/conventions/src/main/kotlin/backpack.kotlin-library.gradle.kts

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

build-logic/conventions/src/main/kotlin/backpack.publishing.gradle.kts

Lines changed: 0 additions & 87 deletions
This file was deleted.
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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+
package net.skyscanner.backpack.conventions
20+
21+
import SdkVersions
22+
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
23+
import org.gradle.api.JavaVersion
24+
import org.gradle.api.Plugin
25+
import org.gradle.api.Project
26+
import org.gradle.kotlin.dsl.configure
27+
import org.gradle.kotlin.dsl.withType
28+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
29+
import org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension
30+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
31+
32+
class BackpackAndroidAppPlugin : Plugin<Project> {
33+
override fun apply(target: Project) {
34+
with(target) {
35+
plugins.apply("com.android.application")
36+
plugins.apply("org.jetbrains.kotlin.android")
37+
38+
extensions.configure<BaseAppModuleExtension> {
39+
compileSdk = SdkVersions.COMPILE_SDK
40+
41+
defaultConfig {
42+
minSdk = SdkVersions.MIN_SDK
43+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
44+
}
45+
46+
compileOptions {
47+
sourceCompatibility = JavaVersion.VERSION_17
48+
targetCompatibility = JavaVersion.VERSION_17
49+
}
50+
51+
testOptions {
52+
animationsDisabled = true
53+
unitTests {
54+
isIncludeAndroidResources = true
55+
}
56+
}
57+
58+
buildFeatures {
59+
compose = true
60+
}
61+
62+
packaging {
63+
resources.excludes.add("**/attach_hotspot_windows.dll")
64+
resources.excludes.add("META-INF/licenses/**")
65+
resources.excludes.add("META-INF/AL2.0")
66+
resources.excludes.add("META-INF/LGPL2.1")
67+
}
68+
}
69+
70+
extensions.configure<KotlinAndroidProjectExtension> {
71+
jvmToolchain(17)
72+
}
73+
74+
tasks.withType<KotlinCompile>().configureEach {
75+
compilerOptions {
76+
jvmTarget.set(JvmTarget.JVM_17)
77+
freeCompilerArgs.addAll(
78+
"-opt-in=kotlin.RequiresOptIn",
79+
"-opt-in=net.skyscanner.backpack.util.InternalBackpackApi",
80+
)
81+
}
82+
}
83+
}
84+
}
85+
}

0 commit comments

Comments
 (0)