File tree Expand file tree Collapse file tree 3 files changed +16
-13
lines changed
src/main/groovy/net/minecraftforge/gradleutils Expand file tree Collapse file tree 3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ dependencyResolutionManagement {
55 library(' yaml' , ' org.yaml' , ' snakeyaml' ). version(' 2.4' )
66
77 // Git Version
8- library(' gitver' , ' net.minecraftforge' , ' git-version' ). version(' 0.2.9 ' )
8+ library(' gitver' , ' net.minecraftforge' , ' git-version' ). version(' 0.2.12 ' )
99
1010 // TODO - Deprecated git utilities, remove in 3.0
1111 library(' jgit' , ' org.eclipse.jgit' , ' org.eclipse.jgit' ). version(' 7.2.0.202503040940-r' )
Original file line number Diff line number Diff line change @@ -45,8 +45,9 @@ abstract class GenerateActionsWorkflow extends DefaultTask {
4545 GenerateActionsWorkflow () {
4646 this . description = ' Generates the GitHub Actions workflow file for the project, respecting declared subprojects in Git Version.'
4747
48- this . outputFile. convention this . project. rootProject. layout. projectDirectory. file(" build_${ this.project.name} .yaml" )
48+ this . outputFile. convention this . project. rootProject. layout. projectDirectory. file(this . providers . provider { " build_${ this.project.name} .yaml" } )
4949
50+ this . projectName. convention this . providers. provider { this . project. name }
5051 this . branch. convention this . providers. provider { this . project. extensions. getByType(GitVersionExtension ). version. info. branch }
5152 this . localPath. convention this . providers. provider { this . project. extensions. getByType(GitVersionExtension ). version. projectPath }
5253 this . paths. convention this . providers. provider { this . project. extensions. getByType(GitVersionExtension ). version. subprojectPaths. collect { " !${ it} /**" . toString() } }
@@ -57,6 +58,9 @@ abstract class GenerateActionsWorkflow extends DefaultTask {
5758 @OutputFile
5859 abstract RegularFileProperty getOutputFile ()
5960
61+ @Input
62+ abstract Property<String > getProjectName ()
63+
6064 @Input
6165 @Optional
6266 abstract Property<String > getBranch ()
@@ -98,7 +102,7 @@ abstract class GenerateActionsWorkflow extends DefaultTask {
98102 if (localPath) with. put(' subproject' , localPath)
99103
100104 Map<String , ?> yaml = [
101- ' name' : ' Build' ,
105+ ' name' : " Build ${ this.projectName.get() } " ,
102106 ' on' : [' push' : push],
103107 ' permissions' : [' contents' : ' read' ],
104108 ' jobs' : [
Original file line number Diff line number Diff line change @@ -358,19 +358,18 @@ class GradleUtils {
358358 }
359359
360360 // Get the origin remote.
361- var originRemote = remotes. find { remote -> remote. name == ' origin' }
361+ var originRemote =
362+ remotes. find { // First try finding the remote that has MinecraftForge
363+ remote -> remote.URIs . find { it. toString(). contains(' MinecraftForge/' ) }
364+ } ?: remotes. find { // Ok, just get the origin then
365+ remote -> remote. name == ' origin'
366+ } ?: remotes. first() // No origin? Get whatever we can get our hands on
362367
363- // We do not have an origin named remote
364- if (originRemote == null ) return ' '
365-
366- // Get the origin push url.
367- var originUrl = originRemote. getURIs(). first()
368-
369- // We do not have a origin url
370- if (originUrl == null ) return ' '
368+ var originUrls = originRemote. getURIs()
369+ if (originUrls. empty) return ' '
371370
372371 // Grab its string representation and process.
373- var originUrlString = originUrl . toString()
372+ var originUrlString = originUrls . first() . toString()
374373 // Determine the protocol
375374 if (originUrlString. lastIndexOf(' :' ) > ' https://' . length()) {
376375 // If ssh then check for authentication data.
You can’t perform that action at this time.
0 commit comments