From da92ad3a5af11ef9f3650d1538ac25cc8e82978c Mon Sep 17 00:00:00 2001 From: Tim te Beek Date: Thu, 9 Jan 2025 14:26:32 +0100 Subject: [PATCH] Update GitHub URLs depending on license --- src/main/kotlin/org/openrewrite/RecipeOrigin.kt | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/kotlin/org/openrewrite/RecipeOrigin.kt b/src/main/kotlin/org/openrewrite/RecipeOrigin.kt index caf892a..9fced9e 100755 --- a/src/main/kotlin/org/openrewrite/RecipeOrigin.kt +++ b/src/main/kotlin/org/openrewrite/RecipeOrigin.kt @@ -42,6 +42,8 @@ class RecipeOrigin( fun githubUrl(): String { return if (isFromCoreLibrary()) { "https://github.com/openrewrite/rewrite" + } else if (getLicense(this) == License.Proprietary) { + "https://github.com/moderneinc/$artifactId" } else { "https://github.com/openrewrite/$artifactId" } @@ -56,7 +58,7 @@ class RecipeOrigin( val baseUrl = if (isFromCoreLibrary()) { "https://github.com/openrewrite/rewrite/blob/main/$artifactId/src/main" } else { - "https://github.com/openrewrite/$artifactId/blob/main/src/main" + githubUrl() + "/blob/main/src/main" } // YAML recipes will have a source that ends with META-INF/rewrite/something.yml @@ -68,12 +70,7 @@ class RecipeOrigin( } } - fun issueTrackerUrl() = - if (isFromCoreLibrary()) { - "https://github.com/openrewrite/rewrite/issues" - } else { - "https://github.com/openrewrite/$artifactId/issues" - } + fun issueTrackerUrl() = githubUrl() + "/issues" companion object { private val parsePattern = Pattern.compile("([^:]+):([^:]+):([^:]+):(.+)")