diff --git a/.editorconfig b/.editorconfig index 7b0e51f..59a2956 100644 --- a/.editorconfig +++ b/.editorconfig @@ -1,11 +1,4 @@ -[*.{kt, kts}] +[*] indent_size = 2 insert_final_newline = true max_line_length = 120 - -[*.xml] -insert_final_newline = true - -[*.gradle] -indent_size = 2 -insert_final_newline = true diff --git a/build.gradle b/build.gradle.kts similarity index 73% rename from build.gradle rename to build.gradle.kts index f99fc06..041722a 100644 --- a/build.gradle +++ b/build.gradle.kts @@ -1,5 +1,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile +import com.android.build.gradle.BaseExtension as AndroidBaseExtension +import com.android.build.gradle.BasePlugin as AndroidBasePlugin buildscript { repositories { @@ -18,20 +20,16 @@ plugins { alias(libs.plugins.dokka) apply false } -tasks.register('clean', Delete) { - delete rootProject.buildDir -} - allprojects { - plugins.withType(com.android.build.gradle.BasePlugin).configureEach { - project.android { + plugins.withType().configureEach { + configure { compileOptions { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 } } } - tasks.withType(KotlinJvmCompile).configureEach { + tasks.withType().configureEach { compilerOptions { jvmTarget.set(JvmTarget.JVM_11) } diff --git a/library/build.gradle b/library/build.gradle deleted file mode 100644 index c73afc9..0000000 --- a/library/build.gradle +++ /dev/null @@ -1,47 +0,0 @@ -plugins { - alias(libs.plugins.android.library) - alias(libs.plugins.kotlin.android) - alias(libs.plugins.mavenPublish) - alias(libs.plugins.paparazzi) -} - -android { - resourcePrefix "swipe_" - namespace "me.saket.swipe" - - defaultConfig { - minSdk libs.versions.minSdk.get().toInteger() - compileSdk libs.versions.compileSdk.get().toInteger() - } - buildFeatures { - compose = true - } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() - } - java { - toolchain.languageVersion.set(JavaLanguageVersion.of(11)) - } - lintOptions { - abortOnError true - } -} - -dependencies { - implementation libs.compose.ui - implementation libs.compose.foundation - - testImplementation libs.junit - testImplementation libs.compose.material3 - testImplementation libs.compose.materialIcons - testImplementation libs.androidx.savedstate - testImplementation libs.androidx.lifecycle -} - -// Used on CI to prevent publishing of non-snapshot versions. -tasks.register('throwIfVersionIsNotSnapshot') { - def libraryVersion = project.findProperty("VERSION_NAME") as String - if (!libraryVersion.endsWith("SNAPSHOT")) { - throw new GradleException("Project isn't using a snapshot version = $libraryVersion") - } -} diff --git a/library/build.gradle.kts b/library/build.gradle.kts new file mode 100644 index 0000000..e520db2 --- /dev/null +++ b/library/build.gradle.kts @@ -0,0 +1,46 @@ +plugins { + alias(libs.plugins.android.library) + alias(libs.plugins.kotlin.android) + alias(libs.plugins.mavenPublish) + alias(libs.plugins.paparazzi) +} + +android { + namespace = "me.saket.swipe" + + defaultConfig { + minSdk = libs.versions.minSdk.get().toInt() + compileSdk = libs.versions.compileSdk.get().toInt() + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() + } + java { + toolchain.languageVersion.set(JavaLanguageVersion.of(11)) + } + lint { + abortOnError = true + } +} + +dependencies { + implementation(libs.compose.ui) + implementation(libs.compose.foundation) + + testImplementation(libs.junit) + testImplementation(libs.compose.material3) + testImplementation(libs.compose.materialIcons) + testImplementation(libs.androidx.savedstate) + testImplementation(libs.androidx.lifecycle) +} + +// Used on CI to prevent publishing of non-snapshot versions. +tasks.register("throwIfVersionIsNotSnapshot") { + val libraryVersion = properties["VERSION_NAME"] as String + check(libraryVersion.endsWith("SNAPSHOT")) { + "Project isn't using a snapshot version = $libraryVersion" + } +} diff --git a/sample/build.gradle b/sample/build.gradle deleted file mode 100644 index 4839497..0000000 --- a/sample/build.gradle +++ /dev/null @@ -1,40 +0,0 @@ -plugins { - alias(libs.plugins.android.application) - alias(libs.plugins.kotlin.android) -} - -android { - namespace "me.saket.swipe.sample" - - defaultConfig { - applicationId namespace - minSdkVersion 31 - compileSdk libs.versions.compileSdk.get().toInteger() - versionCode 1 - versionName "1.0" - } - buildFeatures { - compose = true - } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() - } - java { - toolchain.languageVersion.set(JavaLanguageVersion.of(11)) - } - lintOptions { - abortOnError true - } -} - -dependencies { - implementation projects.library - implementation libs.androidx.appcompat - - implementation libs.androidx.activity - implementation libs.compose.foundation - implementation libs.compose.ui - implementation libs.compose.material3 - implementation libs.compose.materialIcons - implementation libs.accompanist.systemUi -} diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts new file mode 100644 index 0000000..dfeab3f --- /dev/null +++ b/sample/build.gradle.kts @@ -0,0 +1,39 @@ +plugins { + alias(libs.plugins.android.application) + alias(libs.plugins.kotlin.android) +} + +android { + namespace = "me.saket.swipe.sample" + + defaultConfig { + applicationId = namespace + minSdk = 31 + compileSdk = libs.versions.compileSdk.get().toInt() + versionCode = 1 + versionName = "1.0" + } + buildFeatures { + compose = true + } + composeOptions { + kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() + } + java { + toolchain.languageVersion.set(JavaLanguageVersion.of(11)) + } + lint { + abortOnError = true + } +} + +dependencies { + implementation(projects.library) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.activity) + implementation(libs.compose.foundation) + implementation(libs.compose.ui) + implementation(libs.compose.material3) + implementation(libs.compose.materialIcons) + implementation(libs.accompanist.systemUi) +}