-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
109 lines (85 loc) · 2.74 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
plugins {
id 'java'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.3.61'
}
ext {
mavenUsername = project.findProperty("maven.username")
mavenPassword = project.findProperty("maven.password")
}
group 'com.shinonometn'
version '3.0'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
testCompile 'junit:junit:4.13.2'
}
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
task sourceJar(type: Jar) {
from sourceSets.main.allSource
}
def decideRepositorySet() {
def releaseRepositories = [
'github': [
release : "https://maven.pkg.github.com/shinonometn/maven-public",
snapshot: "https://maven.pkg.github.com/shinonometn/maven-public",
],
'shinonometn': [
release : "https://nexus.shinonometn.com/repository/maven-releases/",
snapshot: "https://nexus.shinonometn.com/repository/maven-snapshots/",
]
]
def publishEnvironment = project.findProperty("publish.environment") ?: "shinonometn"
println "Repository Set: ${publishEnvironment}"
def release = project.findProperty("maven.repo.public.release") ?: releaseRepositories[publishEnvironment]['release']
def snapshot = project.findProperty("maven.repo.public.snapshot") ?: releaseRepositories[publishEnvironment]['snapshot']
println "Release Repo : ${release ?: '(unset)'}"
println "Snapshot Repo : ${snapshot ?: '(unset)'}"
ext {
mavenRepoRelease = release
mavenRepoSnapshot = snapshot
}
}
def previewUsername(String username) {
if(username == null) {
println "Maven User : (unset)"
return
}
println "Maven User : ${username.substring(0, 3)}************"
}
publishing {
decideRepositorySet()
previewUsername(mavenUsername)
def releasesRepoUrl = "$mavenRepoRelease"
def snapshotsRepoUrl = "$mavenRepoSnapshot"
def destination = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
println "Version : ${version}"
println "Publish to : ${destination}"
repositories {
maven {
url = destination
credentials {
username "$mavenUsername"
password "$mavenPassword"
}
}
}
publications {
maven(MavenPublication) {
artifactId = "cue-parser-kt"
from components.kotlin
// Reference : https://kb.novaordis.com/index.php/Gradle_Maven_Publish_Plugin
artifact sourceJar {
classifier "sources"
}
}
}
}