diff --git a/README.md b/README.md index 9073475f..c4f01000 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ## Requirements -1. Android SDK 26+ is required as the `minSdkVersion` in your `build.gradle.kts` file. +1. Android SDK 26+ is required as the `minSdk` in your `build.gradle.kts` file. 1. This library is written entirely in [Kotlin](https://kotlinlang.org/), and your app should use Kotlin as well. Compatibility with Java is not provided or supported. 1. This library supports web apps using either Turbo 7 or Turbolinks 5. 1. `Turbo` (or `Turbolinks`) is exposed on the `window` object on the WebView page being loaded. diff --git a/build.gradle b/build.gradle.kts similarity index 58% rename from build.gradle rename to build.gradle.kts index 855c819c..cd4080c2 100644 --- a/build.gradle +++ b/build.gradle.kts @@ -7,8 +7,8 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:8.1.4' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0' + classpath("com.android.tools.build:gradle:8.1.4") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.10") } } @@ -19,6 +19,6 @@ allprojects { } } -task clean(type: Delete) { - delete rootProject.buildDir +tasks.register("clean").configure { + delete(rootProject.buildDir) } diff --git a/demo/build.gradle b/demo/build.gradle deleted file mode 100644 index 47139b63..00000000 --- a/demo/build.gradle +++ /dev/null @@ -1,82 +0,0 @@ -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply plugin: 'kotlinx-serialization' - -buildscript { - repositories { - google() - mavenCentral() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-serialization:1.8.0" - } -} - -android { - compileSdk 34 - - defaultConfig { - applicationId "dev.hotwire.turbo.demo" - minSdkVersion 26 - targetSdkVersion 34 - versionCode 1 - versionName "1.0" - vectorDrawables.useSupportLibrary = true - } - - buildFeatures { - viewBinding = true - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - - debug { - debuggable true - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - kotlinOptions { - jvmTarget = "17" - } - - compileOptions { - sourceCompatibility JavaVersion.VERSION_17 - targetCompatibility JavaVersion.VERSION_17 - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' - test.java.srcDirs += 'src/test/kotlin' - debug.java.srcDirs += 'src/debug/kotlin' - } - - lint { - lintConfig = file("android-lint.xml") - } - - namespace 'dev.hotwire.turbo.demo' -} - -dependencies { - implementation fileTree(include: ['*.jar'], dir: 'libs') - implementation 'com.google.android.material:material:1.10.0' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.recyclerview:recyclerview:1.3.2' - implementation 'androidx.browser:browser:1.7.0' - implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0' - implementation 'com.github.bumptech.glide:glide:4.15.1' - implementation 'dev.hotwire:strada:1.0.0-beta2' - - implementation project(':turbo') -} - -repositories { - google() - mavenCentral() -} diff --git a/demo/build.gradle.kts b/demo/build.gradle.kts new file mode 100644 index 00000000..9539247a --- /dev/null +++ b/demo/build.gradle.kts @@ -0,0 +1,84 @@ +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("org.jetbrains.kotlin.plugin.serialization") version "1.9.10" +} + +buildscript { + repositories { + google() + mavenCentral() + } + + dependencies { + classpath("org.jetbrains.kotlin:kotlin-serialization:1.9.10") + } +} + +android { + compileSdk = 34 + + defaultConfig { + applicationId = "dev.hotwire.turbo.demo" + minSdk = 26 + targetSdk = 34 + versionCode = 1 + versionName = "1.0" + vectorDrawables.useSupportLibrary = true + } + + buildFeatures { + viewBinding = true + } + + buildTypes { + getByName("release") { + isMinifyEnabled = false + setProguardFiles(listOf(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")) + } + + getByName("debug") { + isDebuggable = true + setProguardFiles(listOf(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")) + } + } + + kotlinOptions { + jvmTarget = "17" + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + sourceSets { + named("main") { java { srcDirs("src/main/kotlin") } } + named("test") { java { srcDirs("src/test/kotlin") } } + named("debug") { java { srcDirs("src/debug/kotlin") } } + } + + lint { + lintConfig = file("android-lint.xml") + } + + namespace = "dev.hotwire.turbo.demo" +} + +dependencies { + implementation(fileTree(mapOf("include" to listOf("*.jar"), "dir" to "libs"))) + implementation("com.google.android.material:material:1.11.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") + implementation("androidx.recyclerview:recyclerview:1.3.2") + implementation("androidx.browser:browser:1.7.0") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0") + implementation("com.github.bumptech.glide:glide:4.15.1") + implementation("dev.hotwire:strada:1.0.0-beta2") + + implementation(project(":turbo")) +} + +repositories { + google() + mavenCentral() +} diff --git a/demo/proguard-rules.pro b/demo/proguard-rules.pro index f1b42451..2f9dc5a4 100644 --- a/demo/proguard-rules.pro +++ b/demo/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/docs/BUILD-PROJECT.md b/docs/BUILD-PROJECT.md index b26d7f67..2b918f33 100644 --- a/docs/BUILD-PROJECT.md +++ b/docs/BUILD-PROJECT.md @@ -2,7 +2,7 @@ ## From Android Studio: -- Open the [project's Gradle file](../build.gradle). +- Open the [project's Gradle file](../build.gradle.kts). - In the menu, choose Build --> Rebuild project. ## From command line: diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index 35917321..3b59b7c4 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -14,15 +14,15 @@ dependencies { See the [latest version](https://search.maven.org/artifact/dev.hotwire/turbo) available on Maven Central. -## Required `minSdkVersion` +## Required `minSdk` -Android SDK 26 (or greater) is required as the `minSdkVersion` in your app module's `build.gradle.kts` file: +Android SDK 26 (or greater) is required as the `minSdk` in your app module's `build.gradle.kts` file: ```kotlin compileSdk = 34 defaultConfig { - minSdkVersion = 26 + minSdk = 26 targetSdk = 34 // ... } diff --git a/turbo/proguard-rules.pro b/turbo/proguard-rules.pro index 58fe3dcd..9e9e5917 100644 --- a/turbo/proguard-rules.pro +++ b/turbo/proguard-rules.pro @@ -2,7 +2,7 @@ # By default, the flags in this file are appended to flags specified # in /Users/dankim/android/sdk/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. +# directive in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html