Skip to content

Commit

Permalink
Unify dependencies versions by applying buildSrc (#14)
Browse files Browse the repository at this point in the history
* Making unify dependencies versions feature by applying buildSrc mechanism and Gradle DSL then change all the build.gradle.kts files of all the modules we have to be use the new kotlin class that I made.
Since four classes are made :
1. Dependencies : that contains all the dependencies we will use.
2. MainApp : that contains the common things of the whole app.
3. MainClass : that contains the main classes of each module.
4. Projects : that contains the name of projects/modules we have tell now.
5. Versions : that contains the versions that we will use in Dependencies class.

* Modify Naming of buildSrc files
- Projects file renamed to Modules to be more meaningful.
- MainApp file renamed to Project to be more specific.
  • Loading branch information
ahmedadeltito authored and tarek360 committed Oct 9, 2018
1 parent feec152 commit c770649
Show file tree
Hide file tree
Showing 19 changed files with 222 additions and 74 deletions.
13 changes: 8 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import io.github.tarek360.dependencies.Dependencies
import io.github.tarek360.dependencies.Modules
import io.github.tarek360.dependencies.MainClasses
import org.jetbrains.kotlin.config.KotlinCompilerVersion

plugins {
Expand All @@ -6,14 +9,14 @@ plugins {
}

application {
mainClassName = "io.github.tarek360.app.AppKt"
mainClassName = MainClasses.appKit
}

dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(project(":koshry"))
implementation(project(":rules"))
implementation(project(":test-coverage-rule"))
implementation(kotlin(Dependencies.kotlinJDK))
implementation(project(Modules.koshry))
implementation(project(Modules.rules))
implementation(project(Modules.testCoverageRule))
}

java {
Expand Down
27 changes: 25 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") version "1.2.71"
}

buildscript {
val kotlinVersion = "1.2.60"
repositories {
mavenLocal()
google()
jcenter()
}
dependencies {
classpath(kotlin("gradle-plugin", version = kotlinVersion))
classpath(kotlin("gradle-plugin", version = "1.2.71"))
classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.1")
}
}
Expand All @@ -21,3 +26,21 @@ allprojects {

apply { from("jacoco/jacocoFullReport.gradle") }
apply { from("auto_release.gradle.kts") }

dependencies {
compile(kotlin("stdlib-jdk8"))
}

repositories {
mavenCentral()
}

val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions {
jvmTarget = "1.8"
}

val compileTestKotlin: KotlinCompile by tasks
compileTestKotlin.kotlinOptions {
jvmTarget = "1.8"
}
12 changes: 12 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
plugins {
kotlin("jvm") version "1.2.71"
}

repositories {
mavenCentral()
}

dependencies {
compile(kotlin("stdlib-jdk8"))
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package io.github.tarek360.dependencies

object Dependencies {

var kotlinJDK = "stdlib-jdk8"

var json = "org.json:json:${Versions.json}"

val junit = "junit:junit:${Versions.junit}"

val mockitoCore = "org.mockito:mockito-core:${Versions.mockitoCore}"

val mockitoKotlin = "com.nhaarman.mockitokotlin2:mockito-kotlin:${Versions.mockitoKotlin}"

val okHttp3Mock = "com.squareup.okhttp3:mockwebserver:${Versions.okHttp3}"

val okHttp3 = arrayOf(
"com.squareup.okhttp3:logging-interceptor:${Versions.okHttp3}",
"com.squareup.okhttp3:okhttp:${Versions.okHttp3}")

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package io.github.tarek360.dependencies

object MainClasses {

val appKit = "io.github.tarek360.app.AppKt"

}
25 changes: 25 additions & 0 deletions buildSrc/src/main/java/io/github/tarek360/dependencies/Modules.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package io.github.tarek360.dependencies

object Modules {

val ciDetector = ":ci-detector"

val core = ":core"

val gitDiffParser = ":gitdiff-parser"

val gitDiffProvider = ":gitdiff-provider"

val gitHost = ":githost"

val koshry = ":koshry"

val rules = ":rules"

val rulesCore = ":rules-core"

val rulesTest = ":rules-test"

val testCoverageRule = ":test-coverage-rule"

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.github.tarek360.dependencies

object Project {

val group = "io.github.tarek360"

val version = "0.0.1"

}
19 changes: 19 additions & 0 deletions buildSrc/src/main/java/io/github/tarek360/dependencies/Versions.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package io.github.tarek360.dependencies

object Versions {

val kotlin = "1.2.71"

val jvmTarget = "1.8"

val json = "20160810"

val okHttp3 = "3.11.0"

val junit = "4.12"

val mockitoCore = "2.22.0"

val mockitoKotlin = "2.0.0-RC1"

}
10 changes: 5 additions & 5 deletions ci-detector/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import io.github.tarek360.dependencies.Dependencies
import io.github.tarek360.dependencies.Project
import org.jetbrains.kotlin.config.KotlinCompilerVersion

plugins {
Expand All @@ -15,13 +17,11 @@ repositories {
mavenCentral()
}

group = "io.github.tarek360"
version = "0.0.1"

val okHttpVersion = "3.8.1"
group = Project.group
version = Project.version

dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin(Dependencies.kotlinJDK))
}

java {
Expand Down
10 changes: 6 additions & 4 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import io.github.tarek360.dependencies.Dependencies
import io.github.tarek360.dependencies.Project
import org.jetbrains.kotlin.config.KotlinCompilerVersion

plugins {
Expand All @@ -15,12 +17,12 @@ repositories {
mavenCentral()
}

group = "io.github.tarek360"
version = "0.0.1"
group = Project.group
version = Project.version

dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("junit:junit:4.12")
implementation(kotlin(Dependencies.kotlinJDK))
implementation(Dependencies.junit)
}

java {
Expand Down
15 changes: 9 additions & 6 deletions gitdiff-parser/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import io.github.tarek360.dependencies.Dependencies
import io.github.tarek360.dependencies.Project
import io.github.tarek360.dependencies.Modules
import org.jetbrains.kotlin.config.KotlinCompilerVersion

plugins {
Expand All @@ -15,14 +18,14 @@ repositories {
mavenCentral()
}

group = "io.github.tarek360"
version = "0.0.1"
group = Project.group
version = Project.version

dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(project(":gitdiff-provider"))
testImplementation(project(":core"))
testImplementation("junit:junit:4.12")
implementation(kotlin(Dependencies.kotlinJDK))
implementation(project(Modules.gitDiffProvider))
testImplementation(project(Modules.core))
testImplementation(Dependencies.junit)
}

java {
Expand Down
11 changes: 7 additions & 4 deletions gitdiff-provider/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import io.github.tarek360.dependencies.Dependencies
import io.github.tarek360.dependencies.Project
import io.github.tarek360.dependencies.Modules
import org.jetbrains.kotlin.config.KotlinCompilerVersion

plugins {
Expand All @@ -15,12 +18,12 @@ repositories {
mavenCentral()
}

group = "io.github.tarek360"
version = "0.0.1"
group = Project.group
version = Project.version

dependencies {
implementation(kotlin("stdlib-jdk8"))
api(project(":core"))
implementation(kotlin(Dependencies.kotlinJDK))
api(project(Modules.core))
}

java {
Expand Down
24 changes: 14 additions & 10 deletions githost/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import io.github.tarek360.dependencies.Dependencies
import io.github.tarek360.dependencies.Project
import io.github.tarek360.dependencies.Versions
import io.github.tarek360.dependencies.Modules
import org.jetbrains.kotlin.config.KotlinCompilerVersion

plugins {
Expand All @@ -15,20 +19,20 @@ repositories {
mavenCentral()
}

group = "io.github.tarek360"
version = "0.0.1"

val okHttpVersion = "3.11.0"
group = Project.group
version = Project.version

dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(project(":core"))

implementation("com.squareup.okhttp3:logging-interceptor:$okHttpVersion")
implementation("com.squareup.okhttp3:okhttp:$okHttpVersion")
implementation(kotlin(Dependencies.kotlinJDK))
implementation(project(Modules.core))

Dependencies.okHttp3.forEach {
implementation(it)
}

implementation("org.json:json:20160810")
testImplementation("junit:junit:4.12")
implementation(Dependencies.json)
testImplementation(Dependencies.junit)
}

java {
Expand Down
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Thu Aug 16 23:27:56 ICT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
27 changes: 15 additions & 12 deletions koshry/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import io.github.tarek360.dependencies.Dependencies
import io.github.tarek360.dependencies.Project
import io.github.tarek360.dependencies.Modules
import org.jetbrains.kotlin.config.KotlinCompilerVersion

plugins {
Expand All @@ -15,20 +18,20 @@ repositories {
mavenCentral()
}

group = "io.github.tarek360"
version = "0.0.1"
group = Project.group
version = Project.version

dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(project(":core"))
implementation(project(":rules"))
implementation(project(":gitdiff-parser"))
implementation(project(":githost"))
implementation(project(":ci-detector"))
testImplementation("junit:junit:4.12")
testImplementation("org.mockito:mockito-core:2.22.0")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0-RC1")
testImplementation("com.squareup.okhttp3:mockwebserver:3.11.0")
implementation(kotlin(Dependencies.kotlinJDK))
implementation(project(Modules.core))
implementation(project(Modules.rules))
implementation(project(Modules.gitDiffParser))
implementation(project(Modules.gitHost))
implementation(project(Modules.ciDetector))
testImplementation(Dependencies.junit)
testImplementation(Dependencies.mockitoCore)
testImplementation(Dependencies.mockitoKotlin)
testImplementation(Dependencies.okHttp3Mock)
}

java {
Expand Down
12 changes: 8 additions & 4 deletions rules-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import io.github.tarek360.dependencies.Dependencies
import io.github.tarek360.dependencies.Project
import io.github.tarek360.dependencies.Modules

//import org.jetbrains.kotlin.config.KotlinCompilerVersion

plugins {
Expand All @@ -15,12 +19,12 @@ repositories {
mavenCentral()
}

group = "io.github.tarek360.koshry.rules"
version = "0.0.1"
group = Project.group
version = Project.version

dependencies {
implementation(kotlin("stdlib-jdk8"))
api(project(":gitdiff-parser"))
implementation(kotlin(Dependencies.kotlinJDK))
api(project(Modules.gitDiffParser))
}

java {
Expand Down
Loading

0 comments on commit c770649

Please sign in to comment.