forked from badoo/Reaktive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
210 lines (168 loc) · 5.5 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
buildscript {
ext.reaktive_version = '1.1.4'
ext.reaktive_group_id = 'com.badoo.reaktive'
}
allprojects {
repositories {
google()
jcenter()
}
}
void setupMultiplatformLibrary(Project project) {
project.apply plugin: 'org.jetbrains.kotlin.multiplatform'
project.apply plugin: 'maven-publish'
project.apply plugin: DetektPlugin
project.group = reaktive_group_id
project.version = reaktive_version
project.kotlin {
sourceSets {
commonMain {
dependencies {
implementation Deps.kotlin.stdlib.common
}
}
commonTest {
dependencies {
implementation Deps.kotlin.test.common
implementation Deps.kotlin.test.annotationsCommon
}
}
}
}
}
void setupAllTargetsWithDefaultSourceSets(Map parameters) {
setupAllTargetsWithDefaultSourceSets(
parameters['project'],
parameters.getOrDefault('isLinuxArm32HfpEnabled', true)
)
}
void setupAllTargetsWithDefaultSourceSets(Project project, Boolean isLinuxArm32HfpEnabled = true) {
final target = Target.currentTarget()
if (target.isCommon() || target.isMeta()) {
setupAndroidTarget(project)
setupJvmTarget(project)
setupJsTarget(project)
setupLinuxX64Target(project)
if (isLinuxArm32HfpEnabled) {
setupLinuxArm32HfpTarget(project)
}
project.kotlin {
sourceSets {
jvmJsCommonMain.dependsOn commonMain
jvmJsCommonTest.dependsOn commonTest
jvmNativeCommonMain.dependsOn commonMain
jvmNativeCommonTest.dependsOn commonTest
jvmCommonMain.dependsOn jvmJsCommonMain
jvmCommonMain.dependsOn jvmNativeCommonMain
jvmCommonTest.dependsOn jvmJsCommonTest
jvmCommonTest.dependsOn jvmNativeCommonTest
jvmMain.dependsOn jvmCommonMain
jvmTest.dependsOn jvmCommonTest
androidMain.dependsOn jvmCommonMain
androidTest.dependsOn jvmCommonTest
jsMain.dependsOn jvmJsCommonMain
jsTest.dependsOn jvmJsCommonTest
nativeCommonMain.dependsOn jvmNativeCommonMain
nativeCommonTest.dependsOn jvmNativeCommonTest
linuxCommonMain.dependsOn nativeCommonMain
linuxCommonTest.dependsOn nativeCommonTest
linuxX64Main.dependsOn linuxCommonMain
linuxX64Test.dependsOn linuxCommonTest
if (isLinuxArm32HfpEnabled) {
linuxArm32HfpMain.dependsOn linuxCommonMain
linuxArm32HfpTest.dependsOn linuxCommonTest
}
}
}
}
if (target.isIos() || target.isMeta()) {
setupIosTargets(project)
project.kotlin {
sourceSets {
jvmNativeCommonMain.dependsOn commonMain
jvmNativeCommonTest.dependsOn commonTest
nativeCommonMain.dependsOn jvmNativeCommonMain
nativeCommonTest.dependsOn jvmNativeCommonTest
iosCommonMain.dependsOn nativeCommonMain
iosCommonTest.dependsOn nativeCommonTest
ios32Main.dependsOn iosCommonMain
ios32Test.dependsOn iosCommonTest
ios64Main.dependsOn iosCommonMain
ios64Test.dependsOn iosCommonTest
iosSimMain.dependsOn iosCommonMain
iosSimTest.dependsOn iosCommonTest
}
}
}
}
private void setupAndroidTarget(Project project) {
project.apply plugin: 'com.android.library'
project.android {
buildToolsVersion '28.0.3'
compileSdkVersion 28
defaultConfig {
minSdkVersion 1
}
}
project.kotlin {
targets.fromPreset(presets.android, 'android')
sourceSets {
androidMain {
dependencies {
implementation Deps.kotlin.stdlib
}
}
androidTest {
dependencies {
implementation Deps.kotlin.test.junit
}
}
}
android {
publishLibraryVariants('release', 'debug')
}
}
}
private void setupJvmTarget(Project project) {
project.kotlin {
targets.fromPreset(presets.jvm, 'jvm')
sourceSets {
jvmMain {
dependencies {
implementation Deps.kotlin.stdlib
}
}
jvmTest {
dependencies {
implementation Deps.kotlin.test.junit
}
}
}
}
}
private void setupJsTarget(Project project) {
project.apply plugin: JsPlugin
}
private void setupLinuxX64Target(Project project) {
project.kotlin {
targets {
fromPreset(presets.linuxX64, 'linuxX64')
}
}
}
private void setupLinuxArm32HfpTarget(Project project) {
project.kotlin {
targets {
fromPreset(presets.linuxArm32Hfp, 'linuxArm32Hfp')
}
}
}
private void setupIosTargets(Project project) {
project.apply plugin: IosPlugin
}
import tasks.BuildIosSampleTask
if (Target.currentTarget().isIos()) {
tasks.register('buildIosSample', BuildIosSampleTask) {
dependsOn ':sample-mpp-module:fatDebug', ':sample-mpp-module:fatRelease'
}
}