forked from h0tk3y/better-parse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
140 lines (112 loc) · 4.35 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
import org.apache.tools.ant.taskdefs.condition.Os
group 'com.github.h0tk3y.betterParse'
version '0.4.0-alpha-3'
buildscript {
ext.kotlin_version = '1.3.0'
ext.kotlin_plugin_version = '1.3.0'
repositories {
maven { url 'https://kotlin.bintray.com/kotlin-dev' }
maven { url "https://dl.bintray.com/salomonbrys/gradle-plugins" }
gradlePluginPortal()
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_plugin_version"
classpath "com.github.salomonbrys.gradle.kotlin.js:kotlin-js-gradle-utils:1.0.0"
}
}
apply plugin: 'kotlin-multiplatform'
apply plugin: 'maven'
apply plugin: 'com.github.salomonbrys.gradle.kotlin.js.mpp-tests.node'
kotlin {
targets {
fromPreset(presets.jvm, 'jvm')
fromPreset(presets.js, 'js') {
tasks[compilations.main.compileKotlinTaskName].kotlinOptions.moduleKind = "umd"
kotlinJsNodeTests {
thisTarget(js)
}
}
presets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetPreset).each {
fromPreset(it, it.name)
}
}
sourceSets {
nativeMain {
dependsOn commonMain
}
def defaultNativeSourceSets = kotlin.targets
.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget)
.collect { getByName(it.name + 'Main') }
configure(defaultNativeSourceSets) {
dependsOn nativeMain
}
}
}
repositories {
maven { url 'https://kotlin.bintray.com/kotlin-dev' }
jcenter()
}
dependencies {
commonMainApi "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
jvmMainApi "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
jsMainApi "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
commonTestImplementation "org.jetbrains.kotlin:kotlin-test-common:$kotlin_version"
commonTestImplementation "org.jetbrains.kotlin:kotlin-test-annotations-common:$kotlin_version"
jvmTestImplementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
jsTestImplementation "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version"
}
compileKotlinJvm {
kotlinOptions {
jvmTarget = "1.6"
apiVersion = '1.1' // stay compatible with 1.1 stdlib
}
}
kotlin.sourceSets.all {
languageSettings.useExperimentalAnnotation 'kotlin.ExperimentalMultiplatform'
}
// Code generation
def maxTupleSize = 16
task('codegen').doFirst {
AndCodegenKt.andCodegen(maxTupleSize, kotlin.sourceSets.commonMain.kotlin.srcDirs.first().absolutePath + "/generated/andFunctions.kt")
TupleCodegenKt.tupleCodegen(maxTupleSize, kotlin.sourceSets.commonMain.kotlin.srcDirs.first().absolutePath + "/generated/tuples.kt")
}
kotlin.targets.all {
compilations.all {
tasks[compileKotlinTaskName].dependsOn codegen
}
}
// Publication
apply plugin: 'maven-publish'
def publicationsFromLinux =
kotlin.targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget).names.findAll {
!it.startsWith('mingw') && !it.startsWith('macos') && !it.startsWith('ios')
} + ['kotlinMultiplatform', 'metadata', 'js', 'jvm']
def publicationsFromWindows = ['mingwX64']
def publicationsFromMacos =
kotlin.targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget).names.findAll {
it.startsWith('macos') || it.startsWith('ios')
}
def publicationsFromThisPlatform =
Os.isFamily(Os.FAMILY_UNIX) ? publicationsFromLinux :
Os.isFamily(Os.FAMILY_WINDOWS) ? publicationsFromWindows :
Os.isFamily(Os.FAMILY_MAC) ? publicationsFromMacos : null
tasks.withType(AbstractPublishToMaven).all {
onlyIf { publication.name in publicationsFromThisPlatform }
}
publishing {
repositories {
maven {
name = 'bintray'
def bintrayUsername = 'hotkeytlt'
def bintrayRepoName = 'maven'
def bintrayPackageName = 'better-parse'
url = "https://api.bintray.com/maven/$bintrayUsername/$bintrayRepoName/$bintrayPackageName/;publish=0"
credentials {
username = findProperty('bintray_user')
password = findProperty('bintray_api_key')
}
}
}
}