Skip to content

Commit 9780933

Browse files
committed
Fix addRemoteDetails not actually doing shit
1 parent f8fc9ef commit 9780933

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,18 @@ import javax.inject.Inject
5050
// - Project or Gradle contains an extension named 'gitversion'
5151
// - Applying Git Version to Settings will add the extension to settings and gradle
5252
// - The extension contains method '#getUrl()' or property 'url'
53+
def url
5354
try {
54-
this.target.extensions.getByName('gitversion').url
55+
url = this.target.extensions.getByName('gitversion').url
5556
} catch (UnknownDomainObjectException e) {
5657
try {
57-
this.target.gradle.extensions.getByName('gitversion').url
58+
url = this.target.gradle.extensions.getByName('gitversion').url
5859
} catch (Exception suppressed) {
5960
throw e.tap { addSuppressed(suppressed) }
6061
}
6162
}
63+
64+
this.addRemoteDetails(pom, url)
6265
} catch (Exception e) {
6366
throw this.problems.pomUtilsGitVersionMissing(e)
6467
}

src/main/groovy/net/minecraftforge/gradleutils/PomUtilsInternal.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.gradle.api.reflect.TypeOf;
1313
import org.jetbrains.annotations.MustBeInvokedByOverriders;
1414

15+
import java.io.Serial;
1516
import java.util.HashMap;
1617
import java.util.Map;
1718

@@ -40,14 +41,14 @@ static Map<String, Action<? super MavenPomDeveloper>> makeDevelopers() {
4041
return makeDevelopers(Map.of(
4142
"LexManos", makeDev("LexManos", "Lex Manos"),
4243
"Paint_Ninja", makeDev("Paint_Ninja"),
43-
"SizableShrimp", makeDev("SizableShrimp"),
44-
"cpw", makeDev("cpw"),
4544
"Jonathing", makeDev("Jonathing", "[email protected]", "https://jonathing.me", "America/New_York")
4645
));
4746
}
4847

4948
private static Map<String, Action<? super MavenPomDeveloper>> makeDevelopers(Map<String, Action<? super MavenPomDeveloper>> defaults) {
5049
return new HashMap<>(defaults) {
50+
private static final @Serial long serialVersionUID = -9033218614762684158L;
51+
5152
@Override
5253
public Action<? super MavenPomDeveloper> get(Object key) {
5354
this.ensure((String) key);
@@ -69,6 +70,7 @@ private static Action<? super MavenPomDeveloper> makeDev(String id, String name)
6970
return developer -> {
7071
developer.getId().set(id);
7172
developer.getName().set(name);
73+
developer.getRoles().add("developer");
7274
};
7375
}
7476

@@ -83,6 +85,7 @@ private static Action<? super MavenPomDeveloper> makeDev(String id, String name,
8385
developer.getEmail().set(email);
8486
developer.getUrl().set(url);
8587
developer.getTimezone().set(timezone);
88+
developer.getRoles().add("developer");
8689
};
8790
}
8891

@@ -93,19 +96,19 @@ default void addRemoteDetails(MavenPom pom, String url) {
9396
throw new IllegalArgumentException();
9497

9598
var strippedUrl = stripProtocol(url);
96-
var fullURL = "https://" + url;
99+
var fullURL = "https://" + strippedUrl;
97100
pom.getUrl().set(fullURL);
98101
pom.scm(scm -> {
99102
scm.getUrl().set(fullURL);
100103
scm.getConnection().set("scm:git:git://%s.git".formatted(strippedUrl));
101-
scm.getDeveloperConnection().set("scm:git:git@%s.git".formatted(strippedUrl));
104+
scm.getDeveloperConnection().set("scm:git:git@%s.git".formatted(strippedUrl.replaceFirst("/", ":")));
102105
});
103106

104107
// the rest is GitHub-exclusive information
105108
if (!strippedUrl.contains("github.com")) return;
106109

107110
pom.issueManagement(issues -> {
108-
issues.getSystem().set(url.split("\\.", 2)[0]);
111+
issues.getSystem().set("github");
109112
issues.getUrl().set(fullURL + "/issues");
110113
});
111114
pom.ciManagement(ci -> {

0 commit comments

Comments
 (0)