Skip to content

Commit

Permalink
build: Enhance gradle structure (#1128)
Browse files Browse the repository at this point in the history
* Add sub projects and handle gradle warnings

* split dependencies, for plugins and versions

* Fix dependencies

Co-authored-by: Piotr Adamczyk <piotr.adamczyk@gogoapps.io>
Co-authored-by: piotradamczyk5 <65554637+piotradamczyk5@users.noreply.github.com>
  • Loading branch information
3 people authored Sep 18, 2020
1 parent 11a542d commit 835790e
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 189 deletions.
11 changes: 10 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@
configurations.all {
resolutionStrategy {
force("com.google.guava:guava:25.1-jre")
force(Libs.KOTLIN_REFLECT)
force(Dependencies.KOTLIN_REFLECT)
exclude(group = "com.google.guava", module = "guava-jdk5")
}
}

plugins {
kotlin(Plugins.Kotlin.PLUGIN_JVM) version Versions.KOTLIN
}

repositories {
jcenter()
mavenCentral()
}
Original file line number Diff line number Diff line change
@@ -1,101 +1,4 @@
object Versions {

// https://github.com/Guardsquare/proguard
const val PROGUARD = "7.0.0"

// https://github.com/bugsnag/bugsnag-java/releases
const val BUGSNAG = "3.6.1"

// https://github.com/3breadt/dd-plist/releases
const val DD_PLIST = "1.23"

// https://github.com/detekt/detekt
const val DETEKT = "1.11.0"

// https://github.com/bintray/gradle-bintray-plugin/releases
const val BINTRAY = "1.8.5"

// https://github.com/johnrengelman/shadow/releases
const val SHADOW = "6.0.0"

// https://github.com/linkedin/dex-test-parser/releases
const val DEX_TEST_PARSER = "2.2.1"

// match to Tools -> Kotlin -> Configure Kotlin Plugin Updates -> Update Channel: Stable
const val KOTLIN = "1.4.0"

// https://github.com/Kotlin/kotlinx.coroutines/releases
const val KOTLIN_COROUTINES = "1.3.9"

// https://github.com/remkop/picocli/releases
const val PICOCLI = "4.4.0"

// https://search.maven.org/search?q=a:google-api-services-toolresults%20g:com.google.apis
const val GOOGLE_API_TOOLRESULTS = "v1beta3-rev20200803-1.30.10"

// https://github.com/googleapis/google-auth-library-java/releases
// NOTE: https://github.com/googleapis/google-oauth-java-client is End of Life and replaced by google-auth-library-java
// https://github.com/googleapis/google-oauth-java-client/issues/251#issuecomment-504565533
const val GOOGLE_AUTH = "0.18.0"

// https://search.maven.org/search?q=a:google-cloud-nio%20g:com.google.cloud
const val GOOGLE_NIO = "0.114.0-alpha"

// https://search.maven.org/search?q=a:google-cloud-storage%20g:com.google.cloud
const val GOOGLE_STORAGE = "1.96.0"

// https://github.com/google/gson/releases
const val GSON = "2.8.6"

// https://github.com/FasterXML/jackson-core/releases
// https://github.com/FasterXML/jackson-dataformat-xml/releases
const val JACKSON = "2.11.0"

const val JUNIT = "4.13"

// https://github.com/jhy/jsoup/releases
const val JSOUP = "1.13.1"

// https://github.com/ktorio/ktor/releases
const val KTOR = "1.4.0"

// https://github.com/qos-ch/logback/releases
const val LOGBACK = "1.2.3"

// https://github.com/square/okhttp/releases
const val OKHTTP = "4.7.2"

// https://github.com/stefanbirkner/system-rules/releases
const val SYSTEM_RULES = "1.19.0"

// https://github.com/google/truth/releases
const val TRUTH = "1.0"

// https://github.com/FasterXML/woodstox/releases
const val WOODSTOX = "6.2.1"

const val KOTLIN_LOGGING = "1.8.0.1"

// https://github.com/mockk/mockk
const val MOCKK = "1.10.0"

// https://commons.apache.org/proper/commons-text/
const val COMMON_TEXT = "1.8"

// https://github.com/fusesource/jansi/releases
const val JANSI = "1.18"

// https://github.com/ben-manes/gradle-versions-plugin/releases
const val BEN_MANES = "0.28.0"


// ============== flank-scripts ==============
const val KOTLINX_SERIALIZATION = "1.0.0-RC"
const val FUEL = "2.2.3"
const val CLIKT = "2.8.0"
}

object Libs {
object Dependencies {
const val BUGSNAG = "com.bugsnag:bugsnag:${Versions.BUGSNAG}"

const val DD_PLIST = "com.googlecode.plist:dd-plist:${Versions.DD_PLIST}"
Expand Down Expand Up @@ -151,20 +54,14 @@ object Libs {
const val KOTLIN_SERIALIZATION = "org.jetbrains.kotlinx:kotlinx-serialization-core:${Versions.KOTLINX_SERIALIZATION}"

//region flank-scripts
const val PLUGIN_SHADOW_JAR = "com.github.johnrengelman.shadow"
const val CLIKT = "com.github.ajalt:clikt:${Versions.CLIKT}"
const val DETEKT_PLUGIN = "io.gitlab.arturbosch.detekt"
//endregion

object Fuel {
const val CORE = "com.github.kittinunf.fuel:fuel:${Versions.FUEL}"
const val COROUTINES = "com.github.kittinunf.fuel:fuel-coroutines:${Versions.FUEL}"
const val KOTLINX_SERIALIZATION = "com.github.kittinunf.fuel:fuel-kotlinx-serialization:${Versions.FUEL}"
}
//endregion
}

object Kotlin {
const val PLUGIN_JVM = "jvm"
const val PLUGIN_SERIALIZATION = "plugin.serialization"
}

12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/Plugins.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
object Plugins {

const val PLUGIN_SHADOW_JAR = "com.github.johnrengelman.shadow"
const val DETEKT_PLUGIN = "io.gitlab.arturbosch.detekt"
const val JFROG_BINTRAY = "com.jfrog.bintray"
const val MAVEN_PUBLISH = "maven-publish"
const val BEN_MANES_PLUGIN = "com.github.ben-manes.versions"
object Kotlin {
const val PLUGIN_JVM = "jvm"
const val PLUGIN_SERIALIZATION = "plugin.serialization"
}
}
94 changes: 94 additions & 0 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
object Versions {
// https://github.com/bugsnag/bugsnag-java/releases
const val BUGSNAG = "3.6.1"

// https://github.com/3breadt/dd-plist/releases
const val DD_PLIST = "1.23"

// https://github.com/detekt/detekt
const val DETEKT = "1.11.0"

// https://github.com/bintray/gradle-bintray-plugin/releases
const val BINTRAY = "1.8.5"

// https://github.com/johnrengelman/shadow/releases
const val SHADOW = "6.0.0"

// https://github.com/linkedin/dex-test-parser/releases
const val DEX_TEST_PARSER = "2.2.1"

// match to Tools -> Kotlin -> Configure Kotlin Plugin Updates -> Update Channel: Stable
const val KOTLIN = "1.4.0"

// https://github.com/Kotlin/kotlinx.coroutines/releases
const val KOTLIN_COROUTINES = "1.3.9"

// https://github.com/remkop/picocli/releases
const val PICOCLI = "4.4.0"

// https://search.maven.org/search?q=a:google-api-services-toolresults%20g:com.google.apis
const val GOOGLE_API_TOOLRESULTS = "v1beta3-rev20200803-1.30.10"

// https://github.com/googleapis/google-auth-library-java/releases
// NOTE: https://github.com/googleapis/google-oauth-java-client is End of Life and replaced by google-auth-library-java
// https://github.com/googleapis/google-oauth-java-client/issues/251#issuecomment-504565533
const val GOOGLE_AUTH = "0.18.0"

// https://search.maven.org/search?q=a:google-cloud-nio%20g:com.google.cloud
const val GOOGLE_NIO = "0.114.0-alpha"

// https://search.maven.org/search?q=a:google-cloud-storage%20g:com.google.cloud
const val GOOGLE_STORAGE = "1.96.0"

// https://github.com/google/gson/releases
const val GSON = "2.8.6"

// https://github.com/FasterXML/jackson-core/releases
// https://github.com/FasterXML/jackson-dataformat-xml/releases
const val JACKSON = "2.11.0"

const val JUNIT = "4.13"

// https://github.com/jhy/jsoup/releases
const val JSOUP = "1.13.1"

// https://github.com/ktorio/ktor/releases
const val KTOR = "1.4.0"

// https://github.com/qos-ch/logback/releases
const val LOGBACK = "1.2.3"

// https://github.com/square/okhttp/releases
const val OKHTTP = "4.7.2"

// https://github.com/stefanbirkner/system-rules/releases
const val SYSTEM_RULES = "1.19.0"

// https://github.com/google/truth/releases
const val TRUTH = "1.0"

// https://github.com/FasterXML/woodstox/releases
const val WOODSTOX = "6.2.1"

const val KOTLIN_LOGGING = "1.8.0.1"

// https://github.com/mockk/mockk
const val MOCKK = "1.10.0"

// https://commons.apache.org/proper/commons-text/
const val COMMON_TEXT = "1.8"

// https://github.com/fusesource/jansi/releases
const val JANSI = "1.18"

// https://github.com/ben-manes/gradle-versions-plugin/releases
const val BEN_MANES = "0.28.0"

// https://github.com/Guardsquare/proguard
const val PROGUARD = "7.0.0"

// ============== flank-scripts ==============
const val KOTLINX_SERIALIZATION = "1.0.0-RC"
const val FUEL = "2.2.3"
const val CLIKT = "2.8.0"
}
28 changes: 14 additions & 14 deletions flank-scripts/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

plugins {
application
kotlin(Kotlin.PLUGIN_JVM) version Versions.KOTLIN
kotlin(Kotlin.PLUGIN_SERIALIZATION) version Versions.KOTLIN
id(Libs.PLUGIN_SHADOW_JAR) version Versions.SHADOW
id(Libs.DETEKT_PLUGIN) version Versions.DETEKT
kotlin(Plugins.Kotlin.PLUGIN_JVM)
kotlin(Plugins.Kotlin.PLUGIN_SERIALIZATION) version Versions.KOTLIN
id(Plugins.PLUGIN_SHADOW_JAR) version Versions.SHADOW
id(Plugins.DETEKT_PLUGIN) version Versions.DETEKT
}

val artifactID = "flankScripts"
Expand Down Expand Up @@ -52,16 +52,16 @@ tasks["check"].dependsOn(tasks["detekt"])

dependencies {
implementation(kotlin("stdlib", org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION)) // or "stdlib-jdk8"
implementation(Libs.KOTLIN_SERIALIZATION)
implementation(Libs.Fuel.CORE)
implementation(Libs.Fuel.KOTLINX_SERIALIZATION)
implementation(Libs.Fuel.COROUTINES)
implementation(Libs.CLIKT)
implementation(Dependencies.KOTLIN_SERIALIZATION)
implementation(Dependencies.Fuel.CORE)
implementation(Dependencies.Fuel.KOTLINX_SERIALIZATION)
implementation(Dependencies.Fuel.COROUTINES)
implementation(Dependencies.CLIKT)

detektPlugins(Libs.DETEKT_FORMATTING)
detektPlugins(Dependencies.DETEKT_FORMATTING)

testImplementation(Libs.JUNIT)
testImplementation(Libs.MOCKK)
testImplementation(Libs.TRUTH)
testImplementation(Libs.SYSTEM_RULES)
testImplementation(Dependencies.JUNIT)
testImplementation(Dependencies.MOCKK)
testImplementation(Dependencies.TRUTH)
testImplementation(Dependencies.SYSTEM_RULES)
}
10 changes: 4 additions & 6 deletions integration_tests/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import org.jetbrains.kotlin.backend.common.onlyIf

plugins {
java
kotlin("jvm") version Versions.KOTLIN
id("io.gitlab.arturbosch.detekt") version Versions.DETEKT
kotlin(Plugins.Kotlin.PLUGIN_JVM)
id(Plugins.DETEKT_PLUGIN) version Versions.DETEKT
}

group = "org.flank"
Expand Down Expand Up @@ -31,8 +29,8 @@ detekt {

dependencies {
implementation(kotlin("stdlib"))
testImplementation(Libs.JUNIT)
detektPlugins(Libs.DETEKT_FORMATTING)
testImplementation(Dependencies.JUNIT)
detektPlugins(Dependencies.DETEKT_FORMATTING)
}

tasks.test {
Expand Down
2 changes: 1 addition & 1 deletion samples/gradle-export-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
application
kotlin("jvm") version "1.3.72"
kotlin(Plugins.Kotlin.PLUGIN_JVM)
}

group = "ftl.sample"
Expand Down
4 changes: 3 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ include(
":test_runner",
":firebase_apis:test_api",
":flank-scripts",
":integration_tests"
":integration_tests",
"samples:gradle-export-api",
"test_projects:android"
)
Loading

0 comments on commit 835790e

Please sign in to comment.