-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
97 lines (80 loc) · 2.25 KB
/
build.gradle
File metadata and controls
97 lines (80 loc) · 2.25 KB
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
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.6.0'
id 'maven-publish'
}
group 'com.reevajs'
version '1.0.0'
def RELEASE = false
repositories {
mavenCentral()
}
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.6.0'
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.1'
}
compileKotlin {
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += ['-opt-in=kotlin.RequiresOptIn']
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs += ['-opt-in=kotlin.RequiresOptIn']
}
}
jar {
from sourceSets.main.output
}
task jarWithSources(type: Jar) {
classifier('sources')
from sourceSets.main.allSource
}
def getGitHash() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
def publishingUsername = null
def publishingPassword = null
if (project.hasProperty("IS_CI")) {
publishingUsername = System.getenv("REPOSILITE_USER")
publishingPassword = System.getenv("REPOSILITE_PASSWORD")
} else if (project.hasProperty("reposilite_user")) {
publishingUsername = project.property("reposilite_user")
publishingPassword = project.property("reposilite_password")
}
if (publishingUsername != null && publishingPassword != null) {
publishing {
publications {
maven(MavenPublication) {
groupId = project.group
artifactId = project.name
if (RELEASE) {
version = project.version
} else {
version = getGitHash() + "-SNAPSHOT"
}
artifact jarWithSources
from components.kotlin
}
}
repositories {
maven {
name 'reposilite'
url = 'https://repo.mattco.me/' + (RELEASE ? 'releases' : 'snapshots')
credentials {
username = publishingUsername
password = publishingPassword
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}