Skip to content

Commit 5f52431

Browse files
committed
Do not throw if GitHub details cannot be set
1 parent d3a0a7a commit 5f52431

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ final class PomUtils {
9090
* @param repo The name of the repository on GitHub
9191
*/
9292
void setGitHubDetails(MavenPom pom, String organization = 'MinecraftForge', String repo = '') {
93+
// always add this
94+
pom.organization { org ->
95+
org.name.set 'Forge Development LLC'
96+
org.url.set 'https://minecraftforge.net'
97+
}
98+
9399
var remoteUrl = stripProtocol(this.gitversion.version.info.url)
94100
var url = remoteUrl
95101
if (organization && repo) {
@@ -108,17 +114,16 @@ final class PomUtils {
108114
}
109115

110116
if (!url) {
111-
var e = new IllegalStateException('Cannot set GitHub details without a URL')
112-
throw this.problems.reporter.throwing(e, ProblemId.create('github-details-failed', 'Failed to get GitHub URL', GradleUtils.PROBLEM_GROUP)) { spec ->
117+
this.problems.reporter.report(ProblemId.create('github-details-failed', 'Failed to get GitHub URL', GradleUtils.PROBLEM_GROUP)) { spec ->
113118
spec.details("""
114119
The GitHub URL for this repo could not be automatically determined by GitVersion.
115120
This is likely due to the repository not having any remotes, or not having one set.""")
116121
.severity(Severity.ERROR)
117122
.stackLocation()
118-
.withException(e)
119123
.solution('Ensure that you have a remote set for your repository')
120124
.solution("Alternatively, define the URL using gradleutils.pom.setGitHubDetails(pom, 'MyOrganization', 'MyRepo') (the organization can be omitted if you are using 'MinecraftForge')")
121125
}
126+
return
122127
}
123128

124129
if (!url.contains("github.com")) {
@@ -147,10 +152,6 @@ final class PomUtils {
147152

148153
var fullURL = "https://${url}".toString()
149154
pom.url.set fullURL
150-
pom.organization { org ->
151-
org.name.set 'Forge Development LLC'
152-
org.url.set 'https://minecraftforge.net'
153-
}
154155
pom.scm { scm ->
155156
scm.url.set fullURL
156157
scm.connection.set "scm:git:git://${url}.git".toString()

0 commit comments

Comments
 (0)