Skip to content

Commit 1994d59

Browse files
committed
Update build.gradle
1 parent 94121b8 commit 1994d59

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

build.gradle

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ System.setProperty('grails.docs.clean.html','true')
5555
//System.setProperty('grails.docs.debug.pdf','true')
5656

5757
task fetchGrailsSource {
58+
onlyIf {
59+
println "GRAILS HOME=$explicitGrailsHome"
60+
return !explicitGrailsHome
61+
}
5862
doLast {
5963
ant.mkdir dir: checkOutDir
6064

@@ -67,31 +71,31 @@ task fetchGrailsSource {
6771
def zipFile = "${checkOutDir}/grails-src.zip"
6872

6973
def grailsVersion = System.getenv('TARGET_GRAILS_VERSION')
70-
if(grailsVersion) {
71-
ant.get src: "https://github.com/grails/grails-core/zipball/${githubBranch}", dest: zipFile, verbose: true
72-
// ant.get src: "https://github.com/grails/grails-core/archive/v${grailsVersion}.zip", dest: zipFile, verbose: true
73-
}
74-
else {
74+
if (grailsVersion) {
75+
ant.get src: "https://github.com/grails/grails-core/archive/refs/tags/v${grailsVersion}", dest: zipFile, verbose: true
76+
} else {
7577
ant.get src: "https://github.com/grails/grails-core/zipball/${githubBranch}", dest: zipFile, verbose: true
7678
}
7779

7880
ant.unzip src: zipFile, dest: checkOutDir, {
7981
mapper type: "regexp", from: "(grails-core-\\S*?/)(.*)", to: "grails-src/\\2"
8082
}
8183

82-
ant.replaceregexp(match: '^projectVersion.*$', replace: 'projectVersion=6.0.0-M2', flags: 'g', byline: true) {
83-
fileset(dir: checkOutDir + '/grails-src/', includes: 'gradle.properties')
84-
}
85-
8684
ant.chmod(file:"${checkOutDir}/grails-src/gradlew", perm:700)
8785

8886
println "Grails source code has been downloaded to ${relativePath(grailsHome)}"
8987
}
9088
}
9189

92-
fetchGrailsSource.onlyIf {
93-
println "GRAILS HOME=$explicitGrailsHome"
94-
return !explicitGrailsHome
90+
task editProjectArtificat (type:Exec) {
91+
onlyIf { project.hasProperty("editGrailsVersion") }
92+
dependsOn 'fetchGrailsSource'
93+
executable "bash"
94+
if (explicitGrailsHome) {
95+
args "-i", 'sed -i "s/^projectVersion.*$/projectVersion=6.0.0-M2/" ' + explicitGrailsHome + '/gradle.properties'
96+
} else {
97+
args "-i", 'sed -i "s/^projectVersion.*$/projectVersion=6.0.0-M2/" ' + checkOutDir + "/grails-src/gradle.properties"
98+
}
9599
}
96100

97101
task apiDocs(type: Exec) {

0 commit comments

Comments
 (0)