Skip to content

Commit ad19e32

Browse files
authored
Merge pull request #17 from reduxkotlin/feature/aorobator_kotlin_gradle_dsl
Started migration to Kotlin Gradle DSL
2 parents f2eb045 + a870287 commit ad19e32

File tree

8 files changed

+295
-55
lines changed

8 files changed

+295
-55
lines changed

build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ buildscript {
1515
classpath deps.plugins.android
1616
}
1717
}
18+
19+
plugins {
20+
id("de.fayard.buildSrcVersions") version "0.4.2"
21+
}
22+
1823
apply from: "$rootDir/gradle/dependencies.gradle"
1924

2025
allprojects {

buildSrc/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.gradle/
2+
build/

buildSrc/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
repositories {
2+
jcenter()
3+
}
4+
5+
plugins {
6+
`kotlin-dsl`
7+
}

buildSrc/src/main/kotlin/Libs.kt

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
import kotlin.String
2+
3+
/**
4+
* Generated by https://github.com/jmfayard/buildSrcVersions
5+
*
6+
* Update this file with
7+
* `$ ./gradlew buildSrcVersions`
8+
*/
9+
object Libs {
10+
/**
11+
* http://developer.android.com/tools/extras/support-library.html
12+
*/
13+
const val appcompat: String = "androidx.appcompat:appcompat:" + Versions.appcompat
14+
15+
/**
16+
* https://developer.android.com/testing
17+
*/
18+
const val espresso_core: String = "androidx.test.espresso:espresso-core:" + Versions.espresso_core
19+
20+
/**
21+
* https://developer.android.com/testing
22+
*/
23+
const val androidx_test_runner: String = "androidx.test:runner:" + Versions.androidx_test_runner
24+
25+
/**
26+
* https://github.com/robstoll/atrium
27+
*/
28+
const val atrium_cc_en_gb_robstoll_common: String =
29+
"ch.tutteli.atrium:atrium-cc-en_GB-robstoll-common:" + Versions.ch_tutteli_atrium
30+
31+
/**
32+
* https://github.com/robstoll/atrium
33+
*/
34+
const val atrium_cc_en_gb_robstoll: String = "ch.tutteli.atrium:atrium-cc-en_GB-robstoll:" +
35+
Versions.ch_tutteli_atrium
36+
37+
/**
38+
* https://developer.android.com/studio
39+
*/
40+
const val aapt2: String = "com.android.tools.build:aapt2:" + Versions.aapt2
41+
42+
/**
43+
* https://developer.android.com/studio
44+
*/
45+
const val com_android_tools_build_gradle: String = "com.android.tools.build:gradle:" +
46+
Versions.com_android_tools_build_gradle
47+
48+
/**
49+
* https://developer.android.com/studio
50+
*/
51+
const val lint_gradle: String = "com.android.tools.lint:lint-gradle:" + Versions.lint_gradle
52+
53+
const val de_fayard_buildsrcversions_gradle_plugin: String =
54+
"de.fayard.buildSrcVersions:de.fayard.buildSrcVersions.gradle.plugin:" +
55+
Versions.de_fayard_buildsrcversions_gradle_plugin
56+
57+
/**
58+
* http://mockk.io
59+
*/
60+
const val mockk_common: String = "io.mockk:mockk-common:" + Versions.io_mockk
61+
62+
/**
63+
* http://mockk.io
64+
*/
65+
const val mockk: String = "io.mockk:mockk:" + Versions.io_mockk
66+
67+
/**
68+
* http://junit.org
69+
*/
70+
const val junit: String = "junit:junit:" + Versions.junit
71+
72+
const val dokka_gradle_plugin: String = "org.jetbrains.dokka:dokka-gradle-plugin:" +
73+
Versions.dokka_gradle_plugin
74+
75+
/**
76+
* https://kotlinlang.org/
77+
*/
78+
const val kotlin_android_extensions_runtime: String =
79+
"org.jetbrains.kotlin:kotlin-android-extensions-runtime:" + Versions.org_jetbrains_kotlin
80+
81+
/**
82+
* https://kotlinlang.org/
83+
*/
84+
const val kotlin_android_extensions: String = "org.jetbrains.kotlin:kotlin-android-extensions:" +
85+
Versions.org_jetbrains_kotlin
86+
87+
/**
88+
* https://kotlinlang.org/
89+
*/
90+
const val kotlin_annotation_processing_gradle: String =
91+
"org.jetbrains.kotlin:kotlin-annotation-processing-gradle:" + Versions.org_jetbrains_kotlin
92+
93+
/**
94+
* https://kotlinlang.org/
95+
*/
96+
const val kotlin_gradle_plugin: String = "org.jetbrains.kotlin:kotlin-gradle-plugin:" +
97+
Versions.org_jetbrains_kotlin
98+
99+
/**
100+
* https://kotlinlang.org/
101+
*/
102+
const val kotlin_reflect: String = "org.jetbrains.kotlin:kotlin-reflect:" +
103+
Versions.org_jetbrains_kotlin
104+
105+
/**
106+
* https://kotlinlang.org/
107+
*/
108+
const val kotlin_scripting_compiler_embeddable: String =
109+
"org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:" + Versions.org_jetbrains_kotlin
110+
111+
/**
112+
* https://kotlinlang.org/
113+
*/
114+
const val kotlin_stdlib_common: String = "org.jetbrains.kotlin:kotlin-stdlib-common:" +
115+
Versions.org_jetbrains_kotlin
116+
117+
/**
118+
* https://kotlinlang.org/
119+
*/
120+
const val kotlin_stdlib_jdk8: String = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:" +
121+
Versions.org_jetbrains_kotlin
122+
123+
/**
124+
* https://kotlinlang.org/
125+
*/
126+
const val kotlin_stdlib_js: String = "org.jetbrains.kotlin:kotlin-stdlib-js:" +
127+
Versions.org_jetbrains_kotlin
128+
129+
/**
130+
* https://kotlinlang.org/
131+
*/
132+
const val kotlin_stdlib: String = "org.jetbrains.kotlin:kotlin-stdlib:" +
133+
Versions.org_jetbrains_kotlin
134+
135+
/**
136+
* https://kotlinlang.org/
137+
*/
138+
const val kotlin_test_annotations_common: String =
139+
"org.jetbrains.kotlin:kotlin-test-annotations-common:" + Versions.org_jetbrains_kotlin
140+
141+
/**
142+
* https://kotlinlang.org/
143+
*/
144+
const val kotlin_test_common: String = "org.jetbrains.kotlin:kotlin-test-common:" +
145+
Versions.org_jetbrains_kotlin
146+
147+
/**
148+
* https://kotlinlang.org/
149+
*/
150+
const val kotlin_test_js: String = "org.jetbrains.kotlin:kotlin-test-js:" +
151+
Versions.org_jetbrains_kotlin
152+
153+
/**
154+
* https://kotlinlang.org/
155+
*/
156+
const val kotlin_test_junit: String = "org.jetbrains.kotlin:kotlin-test-junit:" +
157+
Versions.org_jetbrains_kotlin
158+
159+
/**
160+
* https://kotlinlang.org/
161+
*/
162+
const val kotlin_test: String = "org.jetbrains.kotlin:kotlin-test:" +
163+
Versions.org_jetbrains_kotlin
164+
165+
const val spek_dsl_jvm: String = "org.spekframework.spek2:spek-dsl-jvm:" +
166+
Versions.org_spekframework_spek2
167+
168+
const val spek_dsl_metadata: String = "org.spekframework.spek2:spek-dsl-metadata:" +
169+
Versions.org_spekframework_spek2
170+
171+
const val spek_runner_junit5: String = "org.spekframework.spek2:spek-runner-junit5:" +
172+
Versions.org_spekframework_spek2
173+
}

buildSrc/src/main/kotlin/Versions.kt

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import kotlin.String
2+
import org.gradle.plugin.use.PluginDependenciesSpec
3+
import org.gradle.plugin.use.PluginDependencySpec
4+
5+
/**
6+
* Generated by https://github.com/jmfayard/buildSrcVersions
7+
*
8+
* Find which updates are available by running
9+
* `$ ./gradlew buildSrcVersions`
10+
* This will only update the comments.
11+
*
12+
* YOU are responsible for updating manually the dependency version.
13+
*/
14+
object Versions {
15+
const val appcompat: String = "1.1.0-rc01"
16+
17+
const val espresso_core: String = "3.2.0"
18+
19+
const val androidx_test_runner: String = "1.2.0"
20+
21+
const val ch_tutteli_atrium: String = "0.8.0"
22+
23+
const val aapt2: String = "3.5.0-5435860"
24+
25+
const val com_android_tools_build_gradle: String = "3.5.0"
26+
27+
const val lint_gradle: String = "26.5.0"
28+
29+
const val de_fayard_buildsrcversions_gradle_plugin: String = "0.4.2"
30+
31+
const val io_mockk: String = "1.9.3"
32+
33+
const val junit: String = "4.12"
34+
35+
const val dokka_gradle_plugin: String = "0.9.17" // available: "0.9.18"
36+
37+
const val org_jetbrains_kotlin: String = "1.3.50"
38+
39+
const val org_spekframework_spek2: String = "2.1.0-alpha.0.11+d97ef33"
40+
// available: "2.1.0-alpha.0.24+0fdeb6e"
41+
42+
/**
43+
*
44+
* See issue 19: How to update Gradle itself?
45+
* https://github.com/jmfayard/buildSrcVersions/issues/19
46+
*/
47+
const val gradleLatestVersion: String = "5.6.1"
48+
49+
const val gradleCurrentVersion: String = "5.6.1"
50+
}
51+
52+
/**
53+
* See issue #47: how to update buildSrcVersions itself
54+
* https://github.com/jmfayard/buildSrcVersions/issues/47
55+
*/
56+
val PluginDependenciesSpec.buildSrcVersions: PluginDependencySpec
57+
inline get() =
58+
id("de.fayard.buildSrcVersions").version(Versions.de_fayard_buildsrcversions_gradle_plugin)

examples/counter/android/build.gradle

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
plugins {
2+
id("com.android.application")
3+
kotlin("android")
4+
kotlin("android.extensions")
5+
kotlin("kapt")
6+
}
7+
8+
android {
9+
compileSdkVersion(29)
10+
defaultConfig {
11+
applicationId = "org.reduxkotlin.example.counter"
12+
minSdkVersion(26)
13+
targetSdkVersion(29)
14+
versionCode = 1
15+
versionName = "1.0"
16+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
17+
}
18+
compileOptions {
19+
sourceCompatibility = JavaVersion.VERSION_1_8
20+
targetCompatibility = JavaVersion.VERSION_1_8
21+
}
22+
buildTypes {
23+
getByName("release") {
24+
isMinifyEnabled = false
25+
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
26+
}
27+
getByName("debug") {
28+
// MPP libraries don't currently get this resolution automatically
29+
matchingFallbacks = listOf("release")
30+
}
31+
}
32+
packagingOptions {
33+
exclude("META-INF/*.kotlin_module")
34+
}
35+
}
36+
37+
38+
dependencies {
39+
implementation(Libs.kotlin_stdlib_jdk8)
40+
implementation(Libs.appcompat)
41+
42+
implementation(project(":examples:counter:common"))
43+
implementation(project(":lib"))
44+
}

settings.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ pluginManagement {
88
}
99
}
1010

11-
include ':lib', ':examples:counter:common', ':examples:counter:android'
12-
rootProject.name='Redux-Kotlin'
11+
include(
12+
':lib',
13+
':examples:counter:common',
14+
':examples:counter:android'
15+
)
1316

17+
rootProject.name = 'Redux-Kotlin'
1418

15-
rootProject.name = 'test'
1619
enableFeaturePreview('GRADLE_METADATA')
1720
enableFeaturePreview('STABLE_PUBLISHING')
18-

0 commit comments

Comments
 (0)