-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathbuild.gradle
115 lines (102 loc) · 4.54 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
109
110
111
112
113
114
115
/*
* 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.
*/
// Apply the java-library plugin to add support for Java
plugins {
id 'war'
}
// BootsFaces Library Version to use in the Build
ext.BootsFacesVersion = '2.0.1'
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
repositories {
mavenLocal()
mavenCentral()
//maven {
// url "https://oss.sonatype.org/content/repositories/snapshots"
//}
}
dependencies {
// CAUTION:
// Old java plugin configurations compile,testCompile,providedCompile were Deprecated!
// They have been removed and superseded by implementation in Gradle 7.0+.
compileOnly 'jakarta.platform:jakarta.jakartaee-web-api:10.0.0'
implementation "net.bootsfaces:bootsfaces:${BootsFacesVersion}"
implementation group: 'org.primefaces', name: 'primefaces', version: '12.0.0', classifier: 'jakarta'
implementation 'io.nayuki:qrcodegen:1.8.0'
implementation 'org.primefaces.extensions:barcode4j-light:2.3.0'
implementation 'com.googlecode.owasp-java-html-sanitizer:owasp-java-html-sanitizer:20220608.1'
implementation 'com.google.guava:guava:32.0.1-jre'
//compile files("${System.properties['java.home']}/../lib/tools.jar")
}
war.doFirst {
String emptyPage="${webAppDir}/empty.xhtml"
String indexPage="${webAppDir}/index.xhtml"
String contents = new File( emptyPage ).getText( 'UTF-8' )
//Replace the text
contents = contents.replaceAll( 'Title', 'BootsFaces Showcase' )
Date buildDate = new Date()
String hostname= InetAddress.getLocalHost().getHostName()
String currentJvm = org.gradle.internal.jvm.Jvm.current()
String dependencies="";
try {
def compileConfiguration = project.configurations.getByName("runtimeClasspath")
def resolvedConfiguration = compileConfiguration.resolvedConfiguration
def resolvedArtifacts = resolvedConfiguration.resolvedArtifacts
resolvedArtifacts.each { dp ->
dependencies += "${dp.name}<br/>"
}
} catch (Exception e) {
dependencies = "Couldn't resolve the dependencies: $e"
}
String currentOS = System.properties['os.name']+' '+System.properties['os.version']+' '+System.properties['os.arch']
String buildInfo = """\n\
<b:row>
<b:jumbotron>
<b:image library="images" name="bsf_logo.png"/>
<p>Welcome to the BootsFaces Showcase and Documentation</p>
<p><b:navLink value="BootsFaces License" outcome="license" iconAwesome="gavel"/></p>
<b:button iconAwesome="info" pt:data-target="#infomodal" pt:data-toggle="modal" onclick="return false;" size="xs" value="" styleClass="pull-right"/>
</b:jumbotron>
</b:row>
<b:modal id="infomodal" title="Application Build Informations">
<b:panel title="Build Informations" look="info">
Built on $hostname $currentOS<br/>
by Gradle ${project.gradle.gradleVersion}<br/>
Java Version $currentJvm<br/>
sourceCompatibility $sourceCompatibility<br/>
targetCompatibility $targetCompatibility<br/>
BootsFacesVersion $BootsFacesVersion<br/>
Build Date ${buildDate}<br/>
</b:panel>
<b:panel title="Libraries used in the demo" look="info">
$dependencies
</b:panel>\n\
<f:facet name="footer">
<b:button value="close" dismiss="modal" onclick="return false;"/>
</f:facet>
</b:modal>
"""
contents = contents.replaceAll( '</h1>', '</h1>'+buildInfo )
new File( indexPage ).write( contents, 'UTF-8' )
}
war {
archiveFileName = 'BootsFacesWeb.war'
}