-
Notifications
You must be signed in to change notification settings - Fork 252
/
build.gradle.kts
167 lines (148 loc) · 5.46 KB
/
build.gradle.kts
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
import Dependencies.removeIncompatibleDependencies
import java.net.URL
plugins {
id(Plugins.BuildPlugins.androidLib)
id(Plugins.BuildPlugins.kotlinAndroid)
id(Plugins.BuildPlugins.mavenPublish)
jacoco
id(Plugins.BuildPlugins.dokka).version(Plugins.Versions.dokka)
}
publishArtifact(Releases.Workflow)
createJacocoTestReportTask()
android {
namespace = "com.google.android.fhir.workflow"
compileSdk = Sdk.COMPILE_SDK
defaultConfig {
minSdk = Sdk.MIN_SDK
testInstrumentationRunner = Dependencies.androidJunitRunner
// Need to specify this to prevent junit runner from going deep into our dependencies
testInstrumentationRunnerArguments["package"] = "com.google.android.fhir.workflow"
}
sourceSets {
getByName("androidTest").apply { resources.setSrcDirs(listOf("sampledata")) }
getByName("test").apply { resources.setSrcDirs(listOf("sampledata")) }
}
// Added this for fixing out of memory issue in running test cases
tasks.withType<Test>().configureEach {
maxParallelForks = (Runtime.getRuntime().availableProcessors() - 1).takeIf { it > 0 } ?: 1
setForkEvery(100)
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"))
}
}
packaging {
resources.excludes.addAll(
listOf(
"license.html",
"META-INF/ASL2.0",
"META-INF/ASL-2.0.txt",
"META-INF/DEPENDENCIES",
"META-INF/INDEX.LIST",
"META-INF/LGPL-3.0.txt",
"META-INF/LICENSE",
"META-INF/LICENSE.txt",
"META-INF/license.txt",
"META-INF/license.html",
"META-INF/LICENSE.md",
"META-INF/NOTICE",
"META-INF/NOTICE.txt",
"META-INF/NOTICE.md",
"META-INF/notice.txt",
"META-INF/LGPL-3.0.txt",
"META-INF/sun-jaxb.episode",
"META-INF/*.kotlin_module",
"readme.html",
),
)
}
configureJacocoTestOptions()
kotlin { jvmToolchain(11) }
compileOptions { isCoreLibraryDesugaringEnabled = true }
}
afterEvaluate { configureFirebaseTestLabForLibraries() }
configurations { all { removeIncompatibleDependencies() } }
dependencies {
coreLibraryDesugaring(Dependencies.desugarJdkLibs)
androidTestImplementation(Dependencies.jsonAssert)
androidTestImplementation(Dependencies.xmlUnit)
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.ext.junit.ktx)
androidTestImplementation(libs.androidx.test.runner)
androidTestImplementation(libs.androidx.work.testing)
androidTestImplementation(libs.junit)
androidTestImplementation(libs.logback.android)
androidTestImplementation(libs.truth)
androidTestImplementation(project(":workflow-testing"))
api(Dependencies.HapiFhir.structuresR4) { exclude(module = "junit") }
api(Dependencies.HapiFhir.guavaCaching)
implementation(Dependencies.HapiFhir.guavaCaching)
implementation(Dependencies.androidFhirEngine) { exclude(module = "truth") }
implementation(Dependencies.androidFhirKnowledge)
implementation(Dependencies.timber)
implementation(Dependencies.xerces)
implementation(libs.androidx.core)
implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.coroutines.android)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.opencds.cqf.fhir.cr)
implementation(libs.opencds.cqf.fhir.jackson)
testImplementation(Dependencies.jsonAssert)
testImplementation(Dependencies.robolectric)
testImplementation(Dependencies.xmlUnit)
testImplementation(libs.androidx.room.room)
testImplementation(libs.androidx.room.runtime)
testImplementation(libs.androidx.test.core)
testImplementation(libs.junit)
testImplementation(libs.truth)
testImplementation(project(":workflow-testing"))
testImplementation(project(":knowledge"))
configurations.all {
if (name.contains("test", ignoreCase = true)) {
resolutionStrategy.dependencySubstitution {
// To test the workflow library against the latest Knowledge Manager APIs, substitute the
// dependency on the released Knowledge Manager library with the current build.
substitute(module(Dependencies.androidFhirKnowledge)).using(project(":knowledge"))
}
}
}
constraints {
Dependencies.hapiFhirConstraints().forEach { (libName, constraints) ->
api(libName, constraints)
implementation(libName, constraints)
}
}
}
tasks.dokkaHtml.configure {
outputDirectory.set(
file("../docs/use/api/${Releases.Workflow.artifactId}/${Releases.Workflow.version}"),
)
suppressInheritedMembers.set(true)
dokkaSourceSets {
named("main") {
moduleName.set(Releases.Workflow.name)
moduleVersion.set(Releases.Workflow.version)
includes.from("Module.md")
sourceLink {
localDirectory.set(file("src/main/java"))
remoteUrl.set(
URL("https://github.com/google/android-fhir/tree/master/workflow/src/main/java"),
)
remoteLineSuffix.set("#L")
}
externalDocumentationLink {
url.set(URL("https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/"))
packageListUrl.set(
URL("https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-structures-r4/element-list"),
)
}
externalDocumentationLink {
url.set(URL("https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/"))
packageListUrl.set(URL("https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/element-list"))
}
}
}
}