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 {
5
5
library(' yaml' , ' org.yaml' , ' snakeyaml' ). version(' 2.4' )
6
6
7
7
// Git Version
8
- library(' gitver' , ' net.minecraftforge' , ' git-version' ). version(' 0.2.9 ' )
8
+ library(' gitver' , ' net.minecraftforge' , ' git-version' ). version(' 0.2.12 ' )
9
9
10
10
// TODO - Deprecated git utilities, remove in 3.0
11
11
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 {
45
45
GenerateActionsWorkflow () {
46
46
this . description = ' Generates the GitHub Actions workflow file for the project, respecting declared subprojects in Git Version.'
47
47
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" } )
49
49
50
+ this . projectName. convention this . providers. provider { this . project. name }
50
51
this . branch. convention this . providers. provider { this . project. extensions. getByType(GitVersionExtension ). version. info. branch }
51
52
this . localPath. convention this . providers. provider { this . project. extensions. getByType(GitVersionExtension ). version. projectPath }
52
53
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 {
57
58
@OutputFile
58
59
abstract RegularFileProperty getOutputFile ()
59
60
61
+ @Input
62
+ abstract Property<String > getProjectName ()
63
+
60
64
@Input
61
65
@Optional
62
66
abstract Property<String > getBranch ()
@@ -98,7 +102,7 @@ abstract class GenerateActionsWorkflow extends DefaultTask {
98
102
if (localPath) with. put(' subproject' , localPath)
99
103
100
104
Map<String , ?> yaml = [
101
- ' name' : ' Build' ,
105
+ ' name' : " Build ${ this.projectName.get() } " ,
102
106
' on' : [' push' : push],
103
107
' permissions' : [' contents' : ' read' ],
104
108
' jobs' : [
Original file line number Diff line number Diff line change @@ -358,19 +358,18 @@ class GradleUtils {
358
358
}
359
359
360
360
// 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
362
367
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 ' '
371
370
372
371
// Grab its string representation and process.
373
- var originUrlString = originUrl . toString()
372
+ var originUrlString = originUrls . first() . toString()
374
373
// Determine the protocol
375
374
if (originUrlString. lastIndexOf(' :' ) > ' https://' . length()) {
376
375
// If ssh then check for authentication data.
You can’t perform that action at this time.
0 commit comments