diff options
| author | Konsta Alajärvi <konsta.alajarvi@qt.io> | 2024-08-07 10:24:21 +0300 |
|---|---|---|
| committer | Soheil Armin <soheil.armin@qt.io> | 2024-08-25 10:58:52 +0000 |
| commit | 1ed1bdde285246bee9f2aba2e93fce421c89eca3 (patch) | |
| tree | 4591c862eae6b27dc69ef5b3e37e5e37722b2bcf /examples/platforms/android | |
| parent | 3ae2b98a7f226495c63d64b98473d95528da6b0b (diff) | |
Android: migrate examples build confs to Kotlin KTS
Refactor build.gradle(app and top level) from both qtquickview_kotlin
and abstractlistmodel_kotlin to Kotlin.
Rename build.gradle file extensions
Refactor settings.gradle from both examples to Kotlin.
Rename settings.gradle file extensions
Update build.gradle dependencies in qtquickview_kotlin
Task-number: QTTA-111
Pick-to: 6.8
Change-Id: Ife72ba1e7c88d46506292d5aa7f925f485d51866
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'examples/platforms/android')
| -rw-r--r-- | examples/platforms/android/models/qtabstractlistmodel_kotlin/app/build.gradle | 53 | ||||
| -rw-r--r-- | examples/platforms/android/models/qtabstractlistmodel_kotlin/app/build.gradle.kts | 54 | ||||
| -rw-r--r-- | examples/platforms/android/models/qtabstractlistmodel_kotlin/build.gradle | 5 | ||||
| -rw-r--r-- | examples/platforms/android/models/qtabstractlistmodel_kotlin/build.gradle.kts | 6 | ||||
| -rw-r--r-- | examples/platforms/android/models/qtabstractlistmodel_kotlin/settings.gradle.kts (renamed from examples/platforms/android/models/qtabstractlistmodel_kotlin/settings.gradle) | 3 | ||||
| -rw-r--r-- | examples/platforms/android/qtquickview_kotlin/app/build.gradle | 73 | ||||
| -rw-r--r-- | examples/platforms/android/qtquickview_kotlin/app/build.gradle.kts | 62 | ||||
| -rw-r--r-- | examples/platforms/android/qtquickview_kotlin/build.gradle | 5 | ||||
| -rw-r--r-- | examples/platforms/android/qtquickview_kotlin/build.gradle.kts | 6 | ||||
| -rw-r--r-- | examples/platforms/android/qtquickview_kotlin/settings.gradle.kts (renamed from examples/platforms/android/qtquickview_kotlin/settings.gradle) | 5 |
10 files changed, 133 insertions, 139 deletions
diff --git a/examples/platforms/android/models/qtabstractlistmodel_kotlin/app/build.gradle b/examples/platforms/android/models/qtabstractlistmodel_kotlin/app/build.gradle deleted file mode 100644 index 38d184c852..0000000000 --- a/examples/platforms/android/models/qtabstractlistmodel_kotlin/app/build.gradle +++ /dev/null @@ -1,53 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' - id 'org.qtproject.qt.gradleplugin' version '0.1-SNAPSHOT+' -} - -//! [build.gradle QtBuild config] -QtBuild { - // Relative for pre-installed (Installer or MaintenanceTool) installations. - qtPath file('../../../../../../../6.8.0') - projectPath file('../../qtabstractlistmodel') -} -//! [build.gradle QtBuild config] - -android { - namespace 'com.example.qtabstractlistmodel_kotlin' - compileSdk 34 - - defaultConfig { - applicationId "com.example.qtabstractlistmodel_kotlin" - minSdk 28 - targetSdk 34 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - packagingOptions { - jniLibs { - useLegacyPackaging true - } - } - kotlinOptions { - jvmTarget = '1.8' - } -} - -dependencies { - implementation 'androidx.core:core-ktx:1.13.1' - implementation 'androidx.appcompat:appcompat:1.7.0' - implementation 'com.google.android.material:material:1.12.0' -} diff --git a/examples/platforms/android/models/qtabstractlistmodel_kotlin/app/build.gradle.kts b/examples/platforms/android/models/qtabstractlistmodel_kotlin/app/build.gradle.kts new file mode 100644 index 0000000000..bb1bb10f49 --- /dev/null +++ b/examples/platforms/android/models/qtabstractlistmodel_kotlin/app/build.gradle.kts @@ -0,0 +1,54 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("org.qtproject.qt.gradleplugin") version "0.1-SNAPSHOT+" +} + +//! [build.gradle QtBuild config] +QtBuild { + // Relative for pre-installed (Installer or MaintenanceTool) installations. + qtPath = file("../../../../../../../6.8.0") + projectPath = file("../../abstractlistmodel_qml") +} +//! [build.gradle QtBuild config] + +android { + namespace = "com.example.qtabstractlistmodel_kotlin" + compileSdk = 34 + + defaultConfig { + applicationId = "com.example.qtabstractlistmodel_kotlin" + minSdk = 28 + targetSdk = 34 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + named("release") { + isMinifyEnabled = false + setProguardFiles(listOf(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + packaging { + jniLibs { + useLegacyPackaging = true + } + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + implementation("androidx.core:core-ktx:1.13.1") + implementation("androidx.appcompat:appcompat:1.7.0") + implementation("com.google.android.material:material:1.12.0") +} + diff --git a/examples/platforms/android/models/qtabstractlistmodel_kotlin/build.gradle b/examples/platforms/android/models/qtabstractlistmodel_kotlin/build.gradle deleted file mode 100644 index 854a4c5492..0000000000 --- a/examples/platforms/android/models/qtabstractlistmodel_kotlin/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -plugins { - id 'com.android.application' version '8.2.2' apply false - id 'org.jetbrains.kotlin.android' version '2.0.0' apply false -} diff --git a/examples/platforms/android/models/qtabstractlistmodel_kotlin/build.gradle.kts b/examples/platforms/android/models/qtabstractlistmodel_kotlin/build.gradle.kts new file mode 100644 index 0000000000..95b7f57b22 --- /dev/null +++ b/examples/platforms/android/models/qtabstractlistmodel_kotlin/build.gradle.kts @@ -0,0 +1,6 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id("com.android.application") version "8.2.2" apply false + id("org.jetbrains.kotlin.android") version "2.0.0" apply false +} + diff --git a/examples/platforms/android/models/qtabstractlistmodel_kotlin/settings.gradle b/examples/platforms/android/models/qtabstractlistmodel_kotlin/settings.gradle.kts index ea9430ce30..322bc45324 100644 --- a/examples/platforms/android/models/qtabstractlistmodel_kotlin/settings.gradle +++ b/examples/platforms/android/models/qtabstractlistmodel_kotlin/settings.gradle.kts @@ -9,7 +9,7 @@ pluginManagement { } mavenCentral() maven { - url "https://android.qt.io/maven/snapshots" + url = uri("https://android.qt.io/maven/snapshots") } gradlePluginPortal() } @@ -24,3 +24,4 @@ dependencyResolutionManagement { rootProject.name = "qtabstractlistmodel_kotlin" include ':app' + diff --git a/examples/platforms/android/qtquickview_kotlin/app/build.gradle b/examples/platforms/android/qtquickview_kotlin/app/build.gradle deleted file mode 100644 index f191fda134..0000000000 --- a/examples/platforms/android/qtquickview_kotlin/app/build.gradle +++ /dev/null @@ -1,73 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' - id 'org.qtproject.qt.gradleplugin' version '0.1-SNAPSHOT+' -} - -QtBuild { - // Relative for pre-installed (Installer or MaintenanceTool) installations. - qtPath = file("../../../../../../6.8.0") - projectPath = file("../../qtquickview") - // Optional. Commented builds multi-abi. Define for a single ABI build. - // qtKitDir = file("home/<your-username>/<your-Qt-builds>/<your-Qt-kit>") - } - -android { - namespace 'com.example.qtquickview_kotlin' - compileSdk 34 - - defaultConfig { - applicationId "com.example.qtquickview_kotlin" - minSdk 28 - targetSdk 34 - versionCode 1 - versionName "1.0" - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildFeatures { - viewBinding = true - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' - } - packagingOptions { - jniLibs { - useLegacyPackaging true - } - } - sourceSets { - main { - assets { - srcDirs 'assets' - } - jniLibs { - srcDirs 'libs' - } - } - } -} - -dependencies { - - implementation 'androidx.core:core-ktx:1.10.1' - implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.11.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar']) - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.5' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' -} diff --git a/examples/platforms/android/qtquickview_kotlin/app/build.gradle.kts b/examples/platforms/android/qtquickview_kotlin/app/build.gradle.kts new file mode 100644 index 0000000000..b9b1af6322 --- /dev/null +++ b/examples/platforms/android/qtquickview_kotlin/app/build.gradle.kts @@ -0,0 +1,62 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("org.qtproject.qt.gradleplugin") version "0.1-SNAPSHOT+" +} + +QtBuild { + // Relative for pre-installed (Installer or MaintenanceTool) installations. + qtPath = file("../../../../../../6.8.0") + projectPath = file("../../qtquickview") + // Optional. Commented builds multi-abi. Define for a single ABI build. + // qtKitDir = file("home/<your-username>/<your-Qt-builds>/<your-Qt-kit>") +} + +android { + namespace = "com.example.qtquickview_kotlin" + compileSdk = 34 + + defaultConfig { + applicationId = "com.example.qtquickview_kotlin" + minSdk = 28 + targetSdk = 34 + versionCode = 1 + versionName = "1.0" + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildFeatures { + viewBinding = true + } + + buildTypes { + release { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } + packaging { + jniLibs { + useLegacyPackaging = true + } + } +} + +dependencies { + implementation("androidx.core:core-ktx:1.13.1") + implementation("androidx.appcompat:appcompat:1.7.0") + implementation("com.google.android.material:material:1.12.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") + testImplementation("junit:junit:4.13.2") + androidTestImplementation("androidx.test.ext:junit:1.2.1") + androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") +} + diff --git a/examples/platforms/android/qtquickview_kotlin/build.gradle b/examples/platforms/android/qtquickview_kotlin/build.gradle deleted file mode 100644 index 97e3f23ff2..0000000000 --- a/examples/platforms/android/qtquickview_kotlin/build.gradle +++ /dev/null @@ -1,5 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -plugins { -id 'com.android.application' version '8.2.2' apply false - id 'org.jetbrains.kotlin.android' version '1.9.22' apply false -} diff --git a/examples/platforms/android/qtquickview_kotlin/build.gradle.kts b/examples/platforms/android/qtquickview_kotlin/build.gradle.kts new file mode 100644 index 0000000000..4688324501 --- /dev/null +++ b/examples/platforms/android/qtquickview_kotlin/build.gradle.kts @@ -0,0 +1,6 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +plugins { + id("com.android.application") version "8.2.2" apply false + id("org.jetbrains.kotlin.android") version "1.9.22" apply false +} + diff --git a/examples/platforms/android/qtquickview_kotlin/settings.gradle b/examples/platforms/android/qtquickview_kotlin/settings.gradle.kts index 8f3b136a56..367d0585df 100644 --- a/examples/platforms/android/qtquickview_kotlin/settings.gradle +++ b/examples/platforms/android/qtquickview_kotlin/settings.gradle.kts @@ -4,7 +4,7 @@ pluginManagement { mavenCentral() gradlePluginPortal() maven { - url "https://android.qt.io/maven/snapshots" + url = uri("https://android.qt.io/maven/snapshots") } } } @@ -17,4 +17,5 @@ dependencyResolutionManagement { } rootProject.name = "qtquickview_kotlin" -include ':app' +include(":app") + |
