Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert build files to Kotlin DSL #316

Merged
merged 3 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions build.gradle → build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand All @@ -19,6 +19,6 @@ allprojects {
}
}

task clean(type: Delete) {
delete rootProject.buildDir
tasks.register<Delete>("clean").configure {
delete(rootProject.buildDir)
}
82 changes: 0 additions & 82 deletions demo/build.gradle

This file was deleted.

84 changes: 84 additions & 0 deletions demo/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 = JavaVersion.VERSION_17.toString()
}

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()
}
2 changes: 1 addition & 1 deletion demo/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/BUILD-PROJECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
// ...
}
Expand Down
Loading
Loading