Skip to content

Commit 6b04d25

Browse files
committed
Configure publishing to public Space
1 parent 6901eb9 commit 6b04d25

File tree

4 files changed

+9
-80
lines changed

4 files changed

+9
-80
lines changed

.teamcity/settings.kts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ fun Project.deploy() = build("Deploy") {
7373
buildNumberPattern = "$publishVersion-dev-%build.counter%"
7474
params {
7575
param(versionParameter, "%build.number%")
76-
param("bintray-user", "orangy")
77-
password("bintray-key", "credentialsJSON:9a48193c-d16d-46c7-8751-2fb434b09e07")
76+
param("space-user", "ilya.gorbunov")
77+
password("space-token", "credentialsJSON:413fcda1-dd8f-47ed-a6c2-12c1bc2ea0f0")
7878
}
7979

8080
vcs {
@@ -86,8 +86,8 @@ fun Project.deploy() = build("Deploy") {
8686
name = "Deploy Binaries"
8787
jdkHome = "%env.JDK_18_x64%"
8888
jvmArgs = "-Xmx1g"
89-
tasks = "clean build publishBintrayCreateVersion publish"
90-
gradleParams = "--info --stacktrace -P$versionParameter=%$versionParameter% -PbintrayApiKey=%bintray-key% -PbintrayUser=%bintray-user%"
89+
tasks = "clean build publish"
90+
gradleParams = "--info --stacktrace -P$versionParameter=%$versionParameter% -PspaceUser=%space-user% -PspaceToken=%space-token%"
9191
buildFile = ""
9292
gradleWrapperPath = ""
9393
}

build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import java.nio.file.Paths
44
buildscript {
55
repositories {
66
mavenCentral()
7-
jcenter()
87
}
98
}
109

@@ -14,7 +13,7 @@ plugins {
1413
id 'org.jetbrains.kotlin.jvm' version "1.4.0"
1514
}
1615

17-
// Load `local.properties` file, if it exists. You can put your bintrayUser and bintrayApiKey values there, that file is ignored by git
16+
// Load `local.properties` file, if it exists. You can put your spaceUser and spaceToken values there, that file is ignored by git
1817
if (Files.exists(Paths.get("$project.rootDir/local.properties"))) {
1918
def localProperties = new Properties()
2019
localProperties.load(new FileInputStream("$project.rootDir/local.properties"))

gradle.properties

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,4 @@ kotlin.code.style=official
44
version = 0.3.0
55
group = kotlinx.team
66

7-
# Put link to your OSS repository. Bintray requires this to be filled for free OpenSource tiers.
8-
vcs=https://github.com/Kotlin/kotlinx.team.infra
9-
10-
# Put your Bintray organization name here, e.g. your bintray username.
11-
bintrayOrg=kotlin
12-
13-
# Put your Bintray repository name here, e.g. maven.
14-
bintrayRepository=kotlinx
15-
16-
# Put name of your package here.
17-
bintrayPackage=kotlinx.team.infra
18-
197
kotlin_version=1.4.0
20-
jmhVersion=1.21
21-
22-
# not needed for java only project
23-
kotlin.mpp.enableGranularSourceSetsMetadata=true
24-
kotlin.mpp.enableCompatibilityMetadataVariant=true
25-
26-
# TODO: remove, not needed for space
27-
# Workaround for Bintray treating .sha512 files as artifacts
28-
# https://github.com/gradle/gradle/issues/11412
29-
systemProp.org.gradle.internal.publish.checksums.insecure=true

publish.gradle

Lines changed: 4 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
project.ext.bintrayUser = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : null
2-
project.ext.bintrayApiKey = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : null
31
project.version = project.hasProperty('releaseVersion') ? project.property('releaseVersion') : project.version
42

53
task sourceJar(type: Jar) {
@@ -13,16 +11,12 @@ publishing {
1311
name = 'build'
1412
url = "$rootProject.buildDir/maven"
1513
}
16-
// TODO: setup publishing to space/kotlinx
1714
maven {
18-
name = 'bintray'
19-
def bintrayOrg = project.bintrayOrg
20-
def bintrayRepository = project.bintrayRepository
21-
def bintrayPackage = project.bintrayPackage
22-
url = "https://api.bintray.com/maven/$bintrayOrg/$bintrayRepository/$bintrayPackage/;publish=1"
15+
name = 'space'
16+
url "https://maven.pkg.jetbrains.space/kotlin/p/kotlinx/maven"
2317
credentials {
24-
username = project.ext.bintrayUser
25-
password = project.ext.bintrayApiKey
18+
username = project.findProperty("spaceUser")
19+
password = project.findProperty("spaceToken")
2620
}
2721
}
2822
}
@@ -51,45 +45,3 @@ afterEvaluate {
5145
}
5246
}
5347

54-
task publishBintrayCreateVersion() {
55-
doFirst {
56-
def url = new URL("https://api.bintray.com/packages/${bintrayOrg}/${bintrayRepository}/${bintrayPackage}/versions")
57-
def now = new Date()
58-
def date = now.format("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone('UTC'))
59-
def versionJson = '{"name": "' + project.version + '", "desc": "", "released":"' + date + '"}'
60-
def user = project.bintrayUser
61-
if (user == null)
62-
throw new Exception("Cannot create version. User has not been specified. Provide project property with the name 'bintrayUser'")
63-
64-
def apiKey = project.bintrayApiKey
65-
if (apiKey == null)
66-
throw new Exception("Cannot create version. API key has not been specified. Provide project property with the name 'bintrayApiKey'")
67-
68-
def encodedAuthorization = java.util.Base64.getEncoder().encodeToString((user + ":" + apiKey).getBytes());
69-
70-
logger.lifecycle("Creating version ${project.version} for package ${bintrayPackage} in ${bintrayOrg}/${bintrayRepository} on bintray…")
71-
logger.info("URL: $url")
72-
logger.info("User: $user")
73-
logger.info("Sending: $versionJson")
74-
def connection = (HttpURLConnection) url.openConnection()
75-
connection.with {
76-
doOutput = true
77-
requestMethod = 'POST'
78-
setRequestProperty("Authorization", "Basic $encodedAuthorization");
79-
setRequestProperty("Content-Type", "application/json")
80-
outputStream.withWriter { writer ->
81-
writer << versionJson
82-
}
83-
}
84-
def code = connection.getResponseCode()
85-
if (code >= 400) {
86-
def br = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
87-
def sb = new StringBuilder()
88-
String output
89-
while ((output = br.readLine()) != null) {
90-
sb.append(output)
91-
}
92-
throw new Exception("Cannot create version. HTTP response $code: ${sb.toString()}")
93-
}
94-
}
95-
}

0 commit comments

Comments
 (0)