-
Notifications
You must be signed in to change notification settings - Fork 4
/
build.gradle.kts
207 lines (183 loc) · 6.03 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
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
import com.android.build.api.dsl.CommonExtension
import com.android.build.gradle.AppPlugin
import com.android.build.gradle.LibraryExtension
import com.android.build.gradle.LibraryPlugin
import com.android.build.gradle.internal.dsl.BaseAppModuleExtension
import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
import org.jetbrains.dokka.gradle.AbstractDokkaTask
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension
import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
buildscript {
repositories {
gradlePluginPortal()
mavenCentral()
google()
}
dependencies {
classpath(libs.kotlin.gradle.plugin)
classpath(libs.kotlin.allopen)
classpath(libs.android.gradle.plugin)
classpath(libs.cklib.gradle.plugin)
classpath(libs.dokka.gradle.plugin)
classpath(libs.mavenPublish.gradle.plugin)
classpath(libs.benchmark.gradle.plugin)
}
}
allprojects {
group = "com.diglol.crypto"
version = "0.3.0-SNAPSHOT"
repositories {
mavenCentral()
google()
}
}
subprojects {
fun CommonExtension<*, *, *, *, *>.applyAndroid() {
lint {
textReport = true
textOutput = file("stdout")
lintConfig = rootProject.file("lint.xml")
checkDependencies = true
checkTestSources = false
explainIssues = false
checkReleaseBuilds = true
}
compileSdk = 33
defaultConfig {
minSdk = 21
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}
plugins.withType<LibraryPlugin>().configureEach {
extensions.configure<LibraryExtension> { applyAndroid() }
}
plugins.withType<AppPlugin>().configureEach {
extensions.configure<BaseAppModuleExtension> {
applyAndroid()
defaultConfig.targetSdk = 33
}
}
tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
freeCompilerArgs.addAll("-Xjvm-default=all")
}
}
tasks.withType(Test::class).configureEach {
testLogging {
if (System.getenv("CI") == "true") {
events = setOf(TestLogEvent.FAILED, TestLogEvent.SKIPPED, TestLogEvent.PASSED)
}
exceptionFormat = TestExceptionFormat.FULL
}
}
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
normalization {
runtimeClasspath {
metaInf {
ignoreAttribute("Bnd-LastModified")
}
}
}
}
apply(plugin = "org.jetbrains.dokka")
tasks.withType<DokkaMultiModuleTask> {
outputDirectory.set(rootProject.file("build/dokka/html"))
failOnWarning.set(true)
}
// TODO remove if https://youtrack.jetbrains.com/issue/KT-55701 provides a better
rootProject.plugins.withType(YarnPlugin::class.java) {
rootProject.the<YarnRootExtension>().yarnLockMismatchReport =
YarnLockMismatchReport.WARNING // NONE | FAIL
rootProject.the<YarnRootExtension>().reportNewYarnLock = false // true
rootProject.the<YarnRootExtension>().yarnLockAutoReplace = false // true
}
// TODO Remove when it's fixed https://github.com/antelle/argon2-browser/issues/81
rootProject.plugins.withType(NodeJsRootPlugin::class.java) {
rootProject.the<NodeJsRootExtension>().nodeVersion = "18.0.0"
}
allprojects {
tasks.withType<DokkaTaskPartial>().configureEach {
if (project.name == "crypto") {
return@configureEach
}
dokkaSourceSets.configureEach {
reportUndocumented.set(false)
skipDeprecated.set(true)
jdkVersion.set(8)
noAndroidSdkLink.set(true)
perPackageOption {
matchingRegex.set("diglol\\.crypto\\.internal\\.*")
suppress.set(true)
}
}
}
// Workaround for https://github.com/Kotlin/dokka/issues/2977.
// We disable the C Interop IDE metadata task when generating documentation using Dokka.
tasks.withType<AbstractDokkaTask> {
@Suppress("UNCHECKED_CAST")
val taskClass =
Class.forName("org.jetbrains.kotlin.gradle.targets.native.internal.CInteropMetadataDependencyTransformationTask") as Class<Task>
parent?.subprojects?.forEach {
dependsOn(it.tasks.withType(taskClass))
}
}
plugins.withId("com.vanniktech.maven.publish.base") {
configure<PublishingExtension> {
repositories {
maven {
name = "testMaven"
url = file("${rootProject.buildDir}/testMaven").toURI()
}
}
}
configure<MavenPublishBaseExtension> {
publishToMavenCentral(SonatypeHost.S01)
signAllPublications()
pom {
description.set("Diglol Crypto for Kotlin Multiplatform.")
name.set(project.name)
url.set("https://github.com/diglol/crypto/")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("diglol")
name.set("Diglol")
url.set("https://github.com/diglol/")
}
}
scm {
url.set("https://github.com/diglol/crypto/")
connection.set("scm:git:https://github.com/diglol/crypto.git")
developerConnection.set("scm:git:ssh://git@github.com/diglol/crypto.git")
}
}
}
}
}