Skip to content

Commit

Permalink
Merge pull request #5293 from Nanoware/mbdev
Browse files Browse the repository at this point in the history
Prerequisites for Artifactory & Jenkins migration/upgrade
  • Loading branch information
Cervator authored Dec 15, 2024
2 parents 974f68c + 2c6339b commit 3d15e47
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ pipeline {
}
post {
always {
// the default resolution when omitting `defaultBranch` is to `master`
// the default resolution when omitting `targetBranch` is to `master`
// this is wrong in our case, so explicitly set `develop` as default
// TODO: does this also work for PRs with different base branch?
discoverGitReferenceBuild(defaultBranch: 'develop')
discoverGitReferenceBuild(targetBranch: 'develop')
recordIssues(skipBlames: true, enabledForFailure: true,
tool: checkStyle(pattern: '**/build/reports/checkstyle/*.xml'),
qualityGates: [
Expand Down
26 changes: 24 additions & 2 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,36 @@ kotlin {
jvmToolchain(17)
}

// Since build-logic is special we have to cheat to test/get the alternativeResolutionRepo
val gradlePropertiesFile = file("../gradle.properties")
val alternativeResolutionRepo = if (gradlePropertiesFile.exists()) {
gradlePropertiesFile.readLines().firstOrNull { line ->
line.startsWith("alternativeResolutionRepo=")
}?.substringAfter("alternativeResolutionRepo=")
} else {
null
}

repositories {
mavenCentral()
google() // gestalt uses an annotation package by Google
gradlePluginPortal()

maven {
name = "Terasology Artifactory"
url = URI("https://artifactory.terasology.io/artifactory/virtual-repo-live")
val repoViaEnv = System.getenv()["RESOLUTION_REPO"]
if (alternativeResolutionRepo != null) {
// If the user supplies an alternative repo via gradle.properties then use that
name = "from alternativeResolutionRepo in gradle.properties"
url = URI(alternativeResolutionRepo)
} else if (repoViaEnv != null && repoViaEnv != "") {
name = "from \$RESOLUTION_REPO"
url = URI(repoViaEnv)
} else {
// Our default is the main virtual repo containing everything except repos for testing Artifactory itself
name = "Terasology Artifactory"
url = URI("https://artifactory.terasology.io/artifactory/virtual-repo-live")
//url = URI("https://artifactory.nanoware.us/artifactory/virtual-repo-live")
}
}

// TODO MYSTERY: As of November 7th 2021 virtual-repo-live could no longer be relied on for latest snapshots - Pro feature?
Expand Down
18 changes: 15 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,22 @@ buildscript {
google()
gradlePluginPortal()

// required to provide runtime dependencies to build-logic.
maven {
// required to provide runtime dependencies to build-logic.
name = "Terasology Artifactory"
url = uri("https://artifactory.terasology.io/artifactory/virtual-repo-live")
val repoViaEnv = System.getenv()["RESOLUTION_REPO"]
if (rootProject.hasProperty("alternativeResolutionRepo")) {
// If the user supplies an alternative repo via gradle.properties then use that
name = "from alternativeResolutionRepo property"
// Fun Gradle/Kotlin-ism: a general import at the top of a class used in a buildscript block won't help
url = java.net.URI(rootProject.properties["alternativeResolutionRepo"] as String)
} else if (repoViaEnv != null && repoViaEnv != "") {
name = "from \$RESOLUTION_REPO"
url = java.net.URI(repoViaEnv)
} else {
// Our default is the main virtual repo containing everything except repos for testing Artifactory itself
name = "Terasology Artifactory"
url = java.net.URI("https://artifactory.terasology.io/artifactory/virtual-repo-live")
}
}

// TODO MYSTERY: As of November 7th 2011 virtual-repo-live could no longer be relied on for latest snapshots - Pro feature?
Expand Down
18 changes: 15 additions & 3 deletions templates/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ buildscript {
repositories {
mavenCentral()
google()

// required to provide runtime dependencies to build-logic.
maven {
// required to provide runtime dependencies to build-logic.
name = "Terasology Artifactory"
url = "https://artifactory.terasology.io/artifactory/virtual-repo-live"
def repoViaEnv = System.getenv()["RESOLUTION_REPO"]
if (rootProject.hasProperty("alternativeResolutionRepo")) {
// If the user supplies an alternative repo via gradle.properties then use that
name = "from alternativeResolutionRepo property"
url = URI(rootProject.properties["alternativeResolutionRepo"] as String)
} else if (repoViaEnv != null && repoViaEnv != "") {
name = "from \$RESOLUTION_REPO"
url = URI(repoViaEnv)
} else {
// Our default is the main virtual repo containing everything except repos for testing Artifactory itself
name = "Terasology Artifactory"
url = URI("https://artifactory.terasology.io/artifactory/virtual-repo-live")
}
}

// TODO MYSTERY: As of November 7th 2011 virtual-repo-live could no longer be relied on for latest snapshots - Pro feature?
Expand Down
15 changes: 13 additions & 2 deletions templates/facades.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,19 @@ repositories {

// MovingBlocks Artifactory instance for libs not readily available elsewhere plus our own libs
maven {
name "Terasology Artifactory"
url "https://artifactory.terasology.io/artifactory/repo"
def repoViaEnv = System.getenv()["RESOLUTION_REPO"]
if (rootProject.hasProperty("alternativeResolutionRepo")) {
// If the user supplies an alternative repo via gradle.properties then use that
name = "from alternativeResolutionRepo property"
url = URI(rootProject.properties["alternativeResolutionRepo"] as String)
} else if (repoViaEnv != null && repoViaEnv != "") {
name = "from \$RESOLUTION_REPO"
url = URI(repoViaEnv)
} else {
// Our default is the main virtual repo containing everything except repos for testing Artifactory itself
name = "Terasology Artifactory"
url = URI("https://artifactory.terasology.io/artifactory/virtual-repo-live")
}
}
}

Expand Down

0 comments on commit 3d15e47

Please sign in to comment.