Skip to content

Commit e07adc4

Browse files
committed
Fix setGitHubDetails incorrectly using the repo name as the org name
Also, improve debugging issues related to PomUtils
1 parent 7e1124d commit e07adc4

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/main/groovy/net/minecraftforge/gradleutils/PomUtils.groovy

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,25 @@ final class PomUtils {
8282
}
8383
}
8484

85+
/**
86+
* Reduces boilerplate when setting up GitHub details in a {@link MavenPom}. The organization is assumed to be
87+
* {@literal 'MinecraftForge'}.
88+
*
89+
* @param pom The pom to configure
90+
* @param repo The name of the repository on GitHub
91+
*/
92+
void setGitHubDetails(MavenPom pom, String repo = '') {
93+
this.setGitHubDetails(pom, 'MinecraftForge', repo)
94+
}
95+
8596
/**
8697
* Reduces boilerplate when setting up GitHub details in a {@link MavenPom}.
8798
*
8899
* @param pom The pom to configure
89100
* @param organization The organization or username the GitHub project is under
90101
* @param repo The name of the repository on GitHub
91102
*/
92-
void setGitHubDetails(MavenPom pom, String organization = 'MinecraftForge', String repo = '') {
103+
void setGitHubDetails(MavenPom pom, String organization, String repo) {
93104
// always add this
94105
pom.organization { org ->
95106
org.name.set 'Forge Development LLC'
@@ -98,6 +109,10 @@ final class PomUtils {
98109

99110
var remoteUrl = stripProtocol(this.gitversion.version.info.url)
100111
var url = remoteUrl
112+
if (organization)
113+
println 'org exists'
114+
if (repo)
115+
println 'repo exists'
101116
if (organization && repo) {
102117
url = "github.com/${organization}/${repo}".toString()
103118

@@ -126,13 +141,14 @@ final class PomUtils {
126141
return
127142
}
128143

129-
if (!url.contains("github.com")) {
144+
if (!url.contains('github.com')) {
130145
this.problems.reporter.report(ProblemId.create('github-details-not-github', 'GitHub.com not found in repository URL', GradleUtils.PROBLEM_GROUP)) { spec ->
131146
spec.details("""
132147
The repository URL found or created in 'setGitHubDetails' does not include 'github.com'
133148
This is problematic since all Minecraft Forge projects are hosted on GitHub.""")
134149
.severity(Severity.WARNING)
135150
.stackLocation()
151+
.withException(new IllegalArgumentException("Repository URL: ${url}"))
136152
.solution('Ensure that the repository remote URL is a GitHub repository')
137153
.solution("Alternatively, define the URL using gradleutils.pom.setGitHubDetails(pom, 'MyOrganization', 'MyRepo') (the organization can be omitted if you are using 'MinecraftForge')")
138154
}
@@ -145,6 +161,7 @@ final class PomUtils {
145161
This is problematic if you are attempting to publish this project, especially from GitHub Actions.""")
146162
.severity(Severity.WARNING)
147163
.stackLocation()
164+
.withException(new IllegalArgumentException("Repository URL: ${url}"))
148165
.solution('Ensure that the repository remote URL is a MinecraftForge repository')
149166
.solution("Alternatively, define the URL using gradleutils.pom.setGitHubDetails(pom, 'MyRepo')")
150167
}
@@ -162,7 +179,7 @@ final class PomUtils {
162179
issues.url.set "https://${url}/issues".toString()
163180
}
164181
pom.ciManagement { ci ->
165-
ci.system.set 'GitHub Actions'
182+
ci.system.set 'github'
166183
ci.url.set "https://${url}/actions".toString()
167184
}
168185
}

0 commit comments

Comments
 (0)