forked from TheCoder4eu/BootsFaces-OSP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
108 lines (100 loc) · 5.25 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* Copyright 2014-2024 Riccardo Massera (TheCoder4.Eu)
*
* This file is part of BootsFaces.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//This is the main Project file where all Configurations are handled
Properties props = new Properties()
props.load(new FileInputStream("${projectDir}/build.properties"))
ext.BootsFacesVersion = props['VERSION']
ext.BootsFacesReleaseStatus = props['RELEASE-STATUS'] //SNAPSHOT or RCn or betaN or empty for RELEASE
//pom Version will follow the same pattern of the Gradle Version
def pomVersion = BootsFacesVersion//+'-SNAPSHOT'
if(BootsFacesReleaseStatus==null||BootsFacesReleaseStatus=='') { pomVersion=BootsFacesVersion }
else if(BootsFacesReleaseStatus.startsWith("RC")||BootsFacesReleaseStatus.startsWith("beta")||BootsFacesReleaseStatus.startsWith("SNAP")) {
pomVersion=BootsFacesVersion+'-'+BootsFacesReleaseStatus
}
ext.pomVersion=pomVersion
//Bootstrap
ext.BootstrapVersion = props['bootstrap.version']
//PatternFly
ext.PatternFlyVersion = props['patternfly.version']
ext.themes= props['bootswatch.theme'].replaceAll("\\s","").tokenize(',')
ext.BootswatchFullVersion = props['bootstrap.version']+props['bootswatch.subversion']
//ext.BootswatchFolder = "${projectDir}"+'/Bootswatch/bootswatch-'+BootswatchFullVersion.replace('+','-')
if(System.getProperty("BSF-THEME", "") != "") {
ext.themes= System.getProperty("BSF-THEME", "").replaceAll("\\s","").tokenize(',')
ext.allThemes= System.getProperty("BSF-THEME", "").replaceAll("\\s","").tokenize(',')
} else {
ext.themes= props['bootswatch.theme'].replaceAll("\\s","").tokenize(',')
ext.allThemes= ('default,'+props['bootswatch.theme']).replaceAll("\\s","").tokenize(',')
// Temporarily disable Patternfly Theme inclusion.
//ext.allThemes= ('default,patternfly,'+props['bootswatch.theme']).replaceAll("\\s","").tokenize(',')
println 'Themes('+themes.size+'):'+props['bootswatch.theme']
}
//jQuery options
ext.jqversion = props['jquery.version']
//Java options
ext.buildJava8 = ( ( props['java8']!=null) && props['java8'].toUpperCase().contains("YES") )
ext.buildJava11 = ( ( props['java11']!=null) && props['java11'].toUpperCase().contains("YES") )
ext.buildJava17 = ( ( props['java17']!=null) && props['java17'].toUpperCase().contains("YES") )
// Javac Compilation properties
ext.buildOptsJava=["-g"]
ext.buildOptsJava8=["-g"]
ext.buildOptsJava11=["-g"]
ext.buildOptsJava17=["-g"]
if( props['java8opts']!=null) { ext.buildOptsJava8 = props['java8opts'].replaceAll("\\s","").tokenize(',') }
if( props['java11opts']!=null) { ext.buildOptsJava11 = props['java11opts'].replaceAll("\\s","").tokenize(',') }
if( props['java17opts']!=null) { ext.buildOptsJava17 = props['java17opts'].replaceAll("\\s","").tokenize(',') }
ext.useBootClasspath= ( ( props['enableBootClasspath']!=null) && props['enableBootClasspath'].toUpperCase().contains("YES") )
// Set the Artifact group ID
group = 'net.bootsfaces'
version = BootsFacesVersion
task showConfig {
description = 'Prints out the Build configuration.'
doLast {
println "Main Configurations:"
println "--------------------"
println "BootsFacesVersion="+BootsFacesVersion
println "BootsFacesReleaseStatus="+BootsFacesReleaseStatus
println "pomVersion="+pomVersion
println "--------------------"
println "BootstrapVersion="+BootstrapVersion
println "BootswatchFullVersion="+BootswatchFullVersion
println "PatternFlyVersion="+PatternFlyVersion
println "allThemes="+allThemes
println "jqversion="+jqversion
println "--------Java--------"
println "buildJava11:"+buildJava11
println "buildJava17:"+buildJava17
println "buildOptsJava="+buildOptsJava
println "useBootClasspath="+useBootClasspath
println "--------------------"
}
}
showConfig.doFirst {
String configClassFile='src/main/java/net/bootsfaces/C.java'
String configClass = new File( configClassFile ).getText( 'UTF-8' )
configClass=(configClass =~ /BSFVERSION\s*\=\s*\"[v0-9\.]*\"/).replaceFirst('BSFVERSION="'+BootsFacesVersion+'"')
configClass=(configClass =~ /BSFRELEASE_STATUS\s*\=\s*\"\w*\"/).replaceFirst('BSFRELEASE_STATUS="'+BootsFacesReleaseStatus+'"')
//println configClass
new File( configClassFile ).write( configClass, 'UTF-8' )
//Patches version in pom file.
String projectPomText = new File( 'pom.xml' ).getText( 'UTF-8' )
projectPomText=(projectPomText =~ /<version>[^<]+<\/version>/).replaceFirst('<version>'+pomVersion+'</version>')
new File( 'pom.xml' ).write( projectPomText, 'UTF-8' )
}
//By default build also the default( plain Bootstrap without Themes ) Jar for Java 8 only
defaultTasks 'showConfig', ':javaBuild:defaultJar',':javaBuild:buildJava11Jar', ':javaBuild:buildJava17Jar' //':java8:defaultJar', ':java11:defaultJar', ':java17:defaultJar' //Java 17 LTS