forked from Beepiz/BleGattCoroutines
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to AndroidX and Gradle Kotlin DSL
Also updates Kotlin to 1.3.31, kotlinx.coroutines to 1.2.1, Gradle to 5.4.1 and Splitties to 3.0.0-alpha06
- Loading branch information
Showing
84 changed files
with
2,951 additions
and
444 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@file:Suppress("SpellCheckingInspection") | ||
|
||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
allprojects { | ||
repositories { | ||
setupForProject() | ||
} | ||
} | ||
|
||
task<Delete>("clean") { | ||
delete(rootProject.buildDir) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
repositories { | ||
google() | ||
jcenter() | ||
maven(url = "https://dl.bintray.com/kotlin/kotlin-eap") | ||
} | ||
|
||
val kotlinVersion = "1.3.31" // Don't forget to update in Dependencies.kt too! | ||
|
||
dependencies { | ||
compileOnly(gradleApi()) | ||
implementation("com.android.tools.build:gradle:3.5.0-alpha13") | ||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") | ||
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4") | ||
} | ||
|
||
configurations.all { | ||
val isKotlinCompiler = name == "embeddedKotlin" || | ||
name.startsWith("kotlin") || | ||
name.startsWith("kapt") | ||
if (!isKotlinCompiler) { | ||
resolutionStrategy.eachDependency { | ||
@Suppress("UnstableApiUsage") | ||
if (requested.group == "org.jetbrains.kotlin" && | ||
requested.module.name == "kotlin-compiler-embeddable" | ||
) useVersion(kotlinVersion) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import org.gradle.api.Action | ||
import com.android.build.gradle.LibraryExtension as AndroidLibraryExtension | ||
|
||
fun AndroidLibraryExtension.setDefaults() { | ||
compileSdkVersion(ProjectVersions.androidSdk) | ||
buildToolsVersion(ProjectVersions.androidBuildTools) | ||
defaultConfig { | ||
minSdkVersion(14) | ||
targetSdkVersion(ProjectVersions.androidSdk) | ||
versionCode = 1 | ||
versionName = ProjectVersions.thisLibrary | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
getByName("release") { | ||
isMinifyEnabled = false | ||
} | ||
} | ||
sourceSets.getByName("main") { | ||
manifest.srcFile("src/androidMain/AndroidManifest.xml") | ||
res.srcDir("src/androidMain/res") | ||
} | ||
// TODO replace with https://issuetracker.google.com/issues/72050365 once released. | ||
libraryVariants.all(Action { | ||
generateBuildConfigProvider.configure { | ||
enabled = false | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
@file:Suppress("UnusedImport") // Needed for delegates imports to not be removed by the IDE. | ||
|
||
import com.android.build.gradle.internal.tasks.factory.dependsOn | ||
import com.jfrog.bintray.gradle.BintrayExtension | ||
import org.codehaus.groovy.runtime.ProcessGroovyMethods | ||
import org.gradle.api.Project | ||
import org.gradle.api.Task | ||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.tasks.TaskProvider | ||
import org.gradle.kotlin.dsl.closureOf | ||
import org.gradle.kotlin.dsl.existing | ||
import org.gradle.kotlin.dsl.getValue | ||
import org.gradle.kotlin.dsl.provideDelegate | ||
|
||
fun BintrayExtension.setupPublicationsUpload( | ||
project: Project, | ||
publishing: PublishingExtension, | ||
skipMetadataPublication: Boolean = false, | ||
skipMultiplatformPublication: Boolean = skipMetadataPublication | ||
) { | ||
val bintrayUpload: TaskProvider<Task> by project.tasks.existing | ||
val publishToMavenLocal: TaskProvider<Task> by project.tasks.existing | ||
bintrayUpload.dependsOn(publishToMavenLocal) | ||
if (!isDevVersion) { | ||
project.checkNoVersionRanges() | ||
bintrayUpload.configure { | ||
doFirst { | ||
val gitTag = ProcessGroovyMethods.getText( | ||
Runtime.getRuntime().exec("git describe --dirty") | ||
).trim() | ||
val expectedTag = "v${ProjectVersions.thisLibrary}" | ||
if (gitTag != expectedTag) error("Expected git tag '$expectedTag' but got '$gitTag'") | ||
} | ||
} | ||
} | ||
user = project.findProperty("beepiz_bintray_user") as String? | ||
key = project.findProperty("beepiz_bintray_api_key") as String? | ||
val publicationNames: Array<String> = publishing.publications.filterNot { | ||
skipMetadataPublication && it.name == "metadata" || | ||
skipMultiplatformPublication && it.name == "kotlinMultiplatform" | ||
}.map { it.name }.toTypedArray() | ||
setPublications(*publicationNames) | ||
pkg(closureOf<BintrayExtension.PackageConfig> { | ||
repo = if (isDevVersion) "maven-dev" else "maven" | ||
name = "blegattcoroutines" | ||
desc = Publishing.libraryDesc | ||
websiteUrl = Publishing.siteUrl | ||
issueTrackerUrl = "https://github.com/Beepiz/BleGattCoroutines/issues" | ||
vcsUrl = Publishing.gitUrl | ||
setLicenses("Apache-2.0") | ||
publicDownloadNumbers = true | ||
githubRepo = "Beepiz/BleGattCoroutines" | ||
publish = isDevVersion | ||
}) | ||
} |
Oops, something went wrong.