Skip to content

Commit

Permalink
gradle version upgrade / switch to native maven build
Browse files Browse the repository at this point in the history
  • Loading branch information
bade7n committed Nov 13, 2023
1 parent 69d326d commit 39667d8
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 51 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ build
teamcity-plugin.dist.xml
downloads
./teamcity
data
data
.DS_Store
/local-repo
57 changes: 50 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,27 +1,70 @@
import com.github.jk1.license.render.JsonReportRenderer
import java.nio.file.Paths
import java.util.*

plugins {
kotlin("jvm") version "1.5.20"
id("com.github.rodm.teamcity-server") version "1.4.1"
id("com.github.rodm.teamcity-environments") version "1.4.1"
id("com.github.rodm.teamcity-server") version "1.5.2"
id("com.github.rodm.teamcity-environments") version "1.5.2"
id ("com.github.jk1.dependency-license-report") version "1.17"
}

group = "org.jetbrains.teamcity"
val pluginVersion = project.findProperty("PluginVersion") ?: "999999-snapshot-${Date().time}"
version = pluginVersion

val teamcityVersion = "2023.05-SNAPSHOT"
val teamcityVersion by extra { findProperty("teamcityVersion") ?: "2023.11-SNAPSHOT" }

val spacePackagesToken = rootProject.findProperty("spacePackagesToken") as String?
val spacePackagesUsername = rootProject.findProperty("spacePackagesUsername") as String?
val spacePackagesPassword = rootProject.findProperty("spacePackagesPassword") as String?

val canDownloadSpacePackages = spacePackagesToken != null ||
(spacePackagesUsername != null && spacePackagesPassword != null)

if (!canDownloadSpacePackages) {
println("Not running integration tests, can't authorize to Space")
}


extra["teamcityVersion"] = teamcityVersion
extra["downloadsDir"] = project.findProperty("downloads.dir") ?: "${rootDir}/downloads"
extra["canDownloadSpacePackages"] = canDownloadSpacePackages

allprojects {
repositories {
findProperty("TC_LOCAL_REPO")?.toString()?.let {
maven {
url = Paths.get(it).toUri()
}
}
maven(url = "https://cache-redirector.jetbrains.com/maven-central")
maven(url = "https://download.jetbrains.com/teamcity-repository")
maven(url = "https://repo.labs.intellij.net/teamcity")
mavenCentral()

repositories {
maven(url="https://cache-redirector.jetbrains.com/maven-central")
mavenLocal()
if (canDownloadSpacePackages) {
maven(url = "https://packages.jetbrains.team/maven/p/tc/maven") {
if (spacePackagesToken != null) {
credentials(HttpHeaderCredentials::class) {
name = "Authorization"
value = "Bearer $spacePackagesToken"
}
authentication {
create<HttpHeaderAuthentication>("header")
}
} else {
credentials {
username = spacePackagesUsername
password = spacePackagesPassword
}
}
}
}
}
}


dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
Expand All @@ -34,7 +77,7 @@ dependencies {

provided("org.jetbrains.teamcity:server-api:${teamcityVersion}")
provided("org.jetbrains.teamcity:oauth:${teamcityVersion}")
provided("org.jetbrains.teamcity:server-web-api:${teamcityVersion}")
provided("org.jetbrains.teamcity:web-openapi:${teamcityVersion}")
provided("org.jetbrains.teamcity.internal:server:${teamcityVersion}")
provided("org.jetbrains.teamcity.internal:web:${teamcityVersion}")

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
48 changes: 6 additions & 42 deletions integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,14 @@ plugins {
}

val teamcityVersion = rootProject.extra["teamcityVersion"] as String
val spacePackagesToken = rootProject.findProperty("spacePackagesToken") as String?
val spacePackagesUsername = rootProject.findProperty("spacePackagesUsername") as String?
val spacePackagesPassword = rootProject.findProperty("spacePackagesPassword") as String?

val canDownloadSpacePackages = spacePackagesToken != null ||
(spacePackagesUsername != null && spacePackagesPassword != null)

if (!canDownloadSpacePackages) {
println("Not running integration tests, can't authorize to Space")
}

repositories {
mavenCentral()
maven(url = "https://download.jetbrains.com/teamcity-repository")

if (canDownloadSpacePackages) {
maven(url = "https://packages.jetbrains.team/maven/p/tc/maven") {
if (spacePackagesToken != null) {
credentials(HttpHeaderCredentials::class) {
name = "Authorization"
value = "Bearer $spacePackagesToken"
}
authentication {
create<HttpHeaderAuthentication>("header")
}
} else {
credentials {
username = spacePackagesUsername
password = spacePackagesPassword
}
}
}
}
}
val canDownloadSpacePackages = rootProject.extra["canDownloadSpacePackages"] as Boolean

dependencies {
implementation(project(rootProject.path))
implementation(kotlin("stdlib"))

if (canDownloadSpacePackages) {
testImplementation("org.jetbrains.teamcity.internal:integration-tests:$teamcityVersion")
}
testImplementation("org.jetbrains.teamcity.internal:integration-test:$teamcityVersion")
testImplementation("org.jetbrains.teamcity:tests-support:$teamcityVersion")

testImplementation("com.fasterxml.jackson.module:jackson-module-kotlin:2.9.2")
testImplementation("com.github.salomonbrys.kotson:kotson:2.5.0")
Expand All @@ -57,11 +23,9 @@ dependencies {
testImplementation("io.mockk:mockk:1.10.0")
}

if (canDownloadSpacePackages) {
tasks.named<Test>("test") {
useTestNG {
suites("src/test/testng-slack-notifier.xml")
}
tasks.named<Test>("test") {
useTestNG {
suites("src/test/testng-slack-notifier.xml")
}
}

Expand Down

0 comments on commit 39667d8

Please sign in to comment.