forked from JetBrains/lincheck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
155 lines (136 loc) · 4.32 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
import groovy.util.*
import kotlinx.team.infra.*
import org.gradle.jvm.tasks.Jar
// atomicfu
buildscript {
val atomicfuVersion: String by project
dependencies {
classpath("org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicfuVersion")
}
}
apply(plugin = "kotlinx-atomicfu")
plugins {
java
kotlin("multiplatform")
id("maven-publish")
id("kotlinx.team.infra") version "0.3.0-dev-64"
}
repositories {
mavenCentral()
jcenter()
}
kotlin {
jvm {
withJava()
val main by compilations.getting {
kotlinOptions.jvmTarget = "11"
}
val test by compilations.getting {
kotlinOptions.jvmTarget = "11"
}
}
sourceSets {
val jvmMain by getting {
kotlin.srcDir("src/jvm/main")
val kotlinVersion: String by project
val kotlinxCoroutinesVersion: String by project
val asmVersion: String by project
val reflectionsVersion: String by project
dependencies {
api("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
api("org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion")
api("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinxCoroutinesVersion")
api("org.ow2.asm:asm-commons:$asmVersion")
api("org.ow2.asm:asm-util:$asmVersion")
api("org.reflections:reflections:$reflectionsVersion")
}
}
val jvmTest by getting {
kotlin.srcDir("src/jvm/test")
val junitVersion: String by project
val jctoolsVersion: String by project
val mockkVersion: String by project
dependencies {
implementation("junit:junit:$junitVersion")
implementation("org.jctools:jctools-core:$jctoolsVersion")
implementation("io.mockk:mockk:${mockkVersion}")
}
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
sourceSets.main {
java.srcDirs("src/jvm/main")
}
sourceSets.test {
java.srcDirs("src/jvm/test")
resources {
srcDir("src/jvm/test/resources")
}
}
tasks {
replace("jvmSourcesJar", Jar::class).run {
from(sourceSets["main"].allSource)
}
withType<Test> {
maxParallelForks = 1
jvmArgs(
"--add-opens", "java.base/jdk.internal.misc=ALL-UNNAMED",
"--add-exports", "java.base/jdk.internal.util=ALL-UNNAMED",
"--add-exports", "java.base/sun.security.action=ALL-UNNAMED"
)
}
withType<Jar> {
manifest {
val inceptionYear: String by project
val lastCopyrightYear: String by project
attributes(
"Copyright" to
"Copyright (C) 2015 - 2019 Devexperts, LLC\n " +
"Copyright (C) $inceptionYear - $lastCopyrightYear JetBrains, s.r.o."
)
}
}
}
infra {
teamcity {
val name: String by project
val version: String by project
libraryStagingRepoDescription = "$name $version"
}
publishing {
include(":")
libraryRepoUrl = "https://github.com/Kotlin/kotlinx-lincheck"
sonatype {}
}
}
mavenPublicationsPom {
description.set("Lincheck - Framework for testing concurrent data structures")
val licenceName = "Mozilla Public License Version 2.0"
licenses {
license {
name.set(licenceName)
url.set("https://www.mozilla.org/en-US/MPL/2.0/")
distribution.set("repo")
}
}
withXml {
removeAllLicencesExceptOne(licenceName)
}
}
// kotlinx.team.infra adds Apache License, Version 2.0, remove it manually
fun XmlProvider.removeAllLicencesExceptOne(licenceName: String) {
val licenseList = (asNode()["licenses"] as NodeList)[0] as Node
val licenses = licenseList["license"] as NodeList
licenses.filterIsInstance<Node>().forEach { licence ->
val name = (licence["name"] as NodeList)[0] as Node
val nameValue = (name.value() as NodeList)[0] as String
if (nameValue != licenceName) {
licenseList.remove(licence)
}
}
}