-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate Gradle builds from Groovy to Kotlin
- Loading branch information
Showing
14 changed files
with
436 additions
and
401 deletions.
There are no files selected for viewing
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
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,87 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
|
||
buildscript { | ||
repositories { | ||
maven(url = "https://maven.google.com") | ||
google() | ||
mavenCentral() | ||
} | ||
dependencies { | ||
classpath(libs.gradle) | ||
classpath(libs.kotlin.plugin) | ||
classpath(libs.navigation.safe.args.plugin) | ||
// NOTE: Do not place your application dependencies here; they belong | ||
// in the individual module build.gradle files | ||
} | ||
} | ||
|
||
plugins { | ||
id("base") | ||
id("signing") | ||
id("maven-publish") | ||
} | ||
|
||
allprojects { | ||
repositories { | ||
mavenLocal() // look into local .m2 cache. | ||
google() | ||
mavenCentral() | ||
} | ||
} | ||
|
||
subprojects { | ||
|
||
// apply publishing plugins to all subprojects to global control of publishing repositories. | ||
apply(plugin = "base") | ||
apply(plugin = "signing") | ||
apply(plugin = "maven-publish") | ||
|
||
val isReleaseVersion = !version.toString().lowercase().endsWith("snapshot") | ||
|
||
tasks { | ||
// Always run tests as part of the `build` task. | ||
findByName("test")?.apply { | ||
named("check") { | ||
dependsOn(named("test")) | ||
} | ||
} | ||
} | ||
|
||
// Setup global publishing repository settings. | ||
signing { | ||
useGpgCmd() | ||
sign(publishing.publications) | ||
} | ||
|
||
publishing { | ||
repositories { | ||
maven { | ||
// Dynamically select either Maven Central or na Internal repository depending on the value of uploadcare.publish.type / UPLOADCARE_PUBLISH_TYPE | ||
name = "selected" | ||
|
||
// Allow deploying to a custom repository (for testing purposes) | ||
val publishInternally = project.findProperty("uploadcare.publish.type")?.toString() == "internal" | ||
val repositoryUrl = if (isReleaseVersion) { | ||
val releaseMavenCentral = "https://oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
val releaseInternal = (project.findProperty("uploadcare.publish.internal.release") ?: System.getenv("UPLOADCARE_PUBLISH_INTERNAL_RELEASE") ?: "") as String | ||
if (releaseInternal != "" && publishInternally) releaseInternal else releaseMavenCentral | ||
} else { | ||
val snapshotMavenCentral = "https://oss.sonatype.org/content/repositories/snapshots/" | ||
val snapshotInternal = (project.findProperty("uploadcare.publish.internal.snapshot") ?: System.getenv("UPLOADCARE_PUBLISH_INTERNAL_SNAPSHOT") ?: "") as String | ||
if (snapshotInternal != "" && publishInternally) snapshotInternal else snapshotMavenCentral | ||
} | ||
|
||
url = uri(repositoryUrl) | ||
|
||
credentials { | ||
val mavenCentralUser = (project.findProperty("uploadcare.publish.sonatype.user") ?: System.getenv("UPLOADCARE_PUBLISH_SONATYPE_USER") ?: "") as String | ||
val mavenCentralPass = (project.findProperty("uploadcare.publish.sonatype.pass") ?: System.getenv("UPLOADCARE_PUBLISH_SONATYPE_PASS") ?: "") as String | ||
val internalUser = (project.findProperty("uploadcare.publish.internal.user") ?: System.getenv("UPLOADCARE_PUBLISH_INTERNAL_USER") ?: "") as String | ||
val internalPass = (project.findProperty("uploadcare.publish.internal.pass") ?: System.getenv("UPLOADCARE_PUBLISH_INTERNAL_PASS") ?: "") as String | ||
username = if (publishInternally) internalUser else mavenCentralUser | ||
password = if (publishInternally) internalPass else mavenCentralPass | ||
} | ||
} | ||
} | ||
} | ||
} |
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,78 @@ | ||
plugins { | ||
id("com.android.application") | ||
id("kotlin-android") | ||
id("kotlin-parcelize") | ||
id("kotlin-kapt") | ||
id("androidx.navigation.safeargs.kotlin") | ||
} | ||
|
||
android { | ||
compileSdk = libs.versions.compileSdk.get().toInt() | ||
namespace = "com.uploadcare.android.example" | ||
|
||
defaultConfig { | ||
applicationId = "com.uploadcare.android.example" | ||
minSdkPreview = libs.versions.minSdk.get() | ||
targetSdkPreview = libs.versions.targetSdk.get() | ||
versionCode = 10 | ||
versionName = libs.versions.appVersion.get() | ||
} | ||
|
||
buildFeatures { | ||
dataBinding = true | ||
} | ||
|
||
buildTypes { | ||
release { | ||
isMinifyEnabled = false | ||
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") | ||
} | ||
} | ||
|
||
packaging { | ||
resources { | ||
excludes += "META-INF/NOTICE" | ||
excludes += "META-INF/LICENSE" | ||
} | ||
} | ||
|
||
lint { | ||
abortOnError = false | ||
} | ||
|
||
compileOptions { | ||
val javaVersion = JavaVersion.toVersion(libs.versions.jdk.get()) | ||
sourceCompatibility(javaVersion) | ||
targetCompatibility(javaVersion) | ||
} | ||
|
||
kotlinOptions { | ||
jvmTarget = libs.versions.jdk.get() | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":widget")) | ||
implementation(project(":library")) | ||
|
||
implementation(libs.kotlin.stdlib) | ||
implementation(libs.kotlin.reflect) | ||
|
||
implementation (libs.androidx.core) | ||
|
||
implementation (libs.navigation.fragment) | ||
implementation (libs.navigation.ui) | ||
|
||
implementation (libs.fragment.ktx) | ||
implementation (libs.appcompat) | ||
implementation (libs.material) | ||
implementation (libs.constraintlayout) | ||
|
||
implementation (libs.lifecycle.common) | ||
implementation (libs.lifecycle.viewmodel) | ||
|
||
implementation(libs.picasso) | ||
|
||
androidTestImplementation (libs.test.runner) | ||
androidTestImplementation (libs.test.espresso.core) | ||
} |
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
Oops, something went wrong.