forked from Kotlin/kotlinx.team.infra
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpublish.gradle
47 lines (41 loc) · 1.15 KB
/
publish.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
project.version = project.hasProperty('releaseVersion') ? project.property('releaseVersion') : project.version
task sourceJar(type: Jar) {
classifier 'sources'
from sourceSets.main.allJava.sourceDirectories
}
publishing {
repositories {
maven {
name = 'build'
url = "$rootProject.buildDir/maven"
}
maven {
name = 'space'
url "https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/maven"
credentials {
username = project.findProperty("space.user")
password = project.findProperty("space.token")
}
}
}
publications.all {
it.artifact tasks.sourceJar
}
}
afterEvaluate {
clean {
publishing.repositories.all { repository ->
if (repository.name == 'build') {
delete += repository.url
}
}
}
task('publishToBuildRepository') { publish ->
group = 'publishing'
tasks.withType(PublishToMavenRepository) { task ->
if (task.repository.name == 'build') {
publish.dependsOn(task)
}
}
}
}