Convert build scripts from Groovy to Kotlin DSL.

This exposed some obsolete statements, and fixes some plugin version
warnings.
This commit is contained in:
Phil Jones 2022-04-29 10:45:06 +01:00
parent 6ec67ffdc5
commit 8c1b41e9ec
No known key found for this signature in database
GPG Key ID: 7E6F59EE25CDC6A5
7 changed files with 122 additions and 119 deletions

View File

@ -1,88 +0,0 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 32
buildToolsVersion "32.0.0"
defaultConfig {
applicationId "com.philj56.gbcc"
minSdkVersion 21
targetSdkVersion 32
versionCode 38
versionName "beta38"
archivesBaseName = "gbcc"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
targets "gbcc"
}
}
splits {
abi {
enable true
universalApk true
}
}
}
buildTypes {
release {
proguardFiles getDefaultProguardFile(
'proguard-android-optimize.txt'),
'proguard-rules.pro'
minifyEnabled true
shrinkResources true
ndk {
debugSymbolLevel = 'FULL'
}
}
debug {
minifyEnabled = false
}
}
buildFeatures {
viewBinding true
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
useIR = true
}
ndkVersion '24.0.8215888'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.camera:camera-core:1.1.0-beta03"
implementation "androidx.camera:camera-camera2:1.1.0-beta03"
implementation "androidx.camera:camera-lifecycle:1.1.0-beta03"
implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.3"
implementation "androidx.coordinatorlayout:coordinatorlayout:1.2.0"
implementation "androidx.preference:preference-ktx:1.2.0"
implementation "androidx.recyclerview:recyclerview:1.2.1"
implementation "com.google.android.material:material:1.6.0-rc01"
testImplementation 'junit:junit:4.13.1'
androidTestImplementation "androidx.test:runner:1.4.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
}
task copyAssets(type: Copy) {
from "libs/gbcc/tileset.png"
from "libs/gbcc/camera.png"
from "libs/gbcc/print.wav"
into "src/main/assets"
}
preBuild.dependsOn copyAssets

92
app/build.gradle.kts Normal file
View File

@ -0,0 +1,92 @@
plugins {
id("com.android.application") apply true
kotlin("android") apply true
}
base {
archivesName.set("gbcc")
}
android {
compileSdk = 32
buildToolsVersion = "32.0.0"
defaultConfig {
applicationId = "com.philj56.gbcc"
minSdk = 21
targetSdk = 32
versionCode = 38
versionName = "beta38"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
targets.add("gbcc")
}
}
splits {
abi {
isEnable = true
isUniversalApk = true
}
}
}
buildTypes {
release {
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
isMinifyEnabled = true
isShrinkResources = true
ndk {
debugSymbolLevel = "FULL"
}
}
debug {
isMinifyEnabled = false
}
}
buildFeatures {
viewBinding = true
}
externalNativeBuild {
cmake {
path("src/main/cpp/CMakeLists.txt")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}
ndkVersion = "24.0.8215888"
}
dependencies {
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation("androidx.camera:camera-core:1.1.0-beta03")
implementation("androidx.camera:camera-camera2:1.1.0-beta03")
implementation("androidx.camera:camera-lifecycle:1.1.0-beta03")
implementation("androidx.core:core-ktx:1.7.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
implementation("androidx.coordinatorlayout:coordinatorlayout:1.2.0")
implementation("androidx.preference:preference-ktx:1.2.0")
implementation("androidx.recyclerview:recyclerview:1.2.1")
implementation("com.google.android.material:material:1.6.0-rc01")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test:runner:1.4.0")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
}
tasks.register<Copy>("copyAssets") {
from("libs/gbcc/tileset.png")
from("libs/gbcc/camera.png")
from("libs/gbcc/print.wav")
into("src/main/assets")
}
tasks["preBuild"].dependsOn("copyAssets")

View File

@ -1,26 +0,0 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.6.20'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

9
build.gradle.kts Normal file
View File

@ -0,0 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "7.1.3" apply false
kotlin("android") version "1.6.20" apply false
}
tasks.register<Delete>("clean") {
delete(rootProject.buildDir)
}

View File

@ -1,6 +1,6 @@
#Sun Mar 21 21:06:55 GMT 2021
#Fri Apr 29 02:09:13 BST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
zipStoreBase=GRADLE_USER_HOME

View File

@ -1,2 +0,0 @@
include ':app'
rootProject.name='gbcc'

18
settings.gradle.kts Normal file
View File

@ -0,0 +1,18 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "gbcc"
include(":app")