Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prerequisites for Artifactory & Jenkins migration/upgrade #5293

Merged
merged 2 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,13 +4,25 @@
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?

Check warning on line 25 in templates/build.gradle

View check run for this annotation

Terasology Jenkins.io / Open Tasks Scanner

TODO

NORMAL: MYSTERY: As of November 7th 2011 virtual-repo-live could no longer be relied on for latest snapshots - Pro feature?
// We've been using it that way for *years* and nothing likewise changed in the area for years as well. This seems to work ....
maven {
name = "Terasology snapshot locals"
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
Loading