This repository has been archived by the owner on Feb 16, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle
153 lines (132 loc) · 6.32 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
plugins {
id "mpern.sap.commerce.build" version "1.2.0"
id "mpern.sap.commerce.ccv1.package" version "1.2.0"
}
//to avoid FQN in your task definitions, import the custom task classes
import mpern.sap.commerce.build.tasks.HybrisAntTask
import mpern.sap.commerce.build.tasks.SupportPortalDownload
def platformFiles = 'hybris-platform'
repositories {
//let's add the folder 'platformFiles' to the repositories of this build
//(this is where the download tasks below will save the files)
flatDir {
dirs platformFiles
}
//for DB drivers
jcenter()
}
version = "1.0.0-SNAPSHOT"
def hybrisVersion = "1808.2"
hybris {
version = hybrisVersion
}
CCV1 {
//let's define en extra 'qa' environment
environments = ['dev', 'qa', 'stag', 'prod']
datahub = true
datahubWar = file("my-custom-datahub.war")
}
dependencies {
//db drivers defined here are automatically downloaded and configured during bootstrapPlatform
dbDriver "mysql:mysql-connector-java:5.1.47"
//if you want to unpack additional artifacts during bootstrapPlatform, defined them here
hybrisPlatform "de.hybris.platform:hybris-commerce-datahub:${hybrisVersion}@zip"
// hybrisPlatform "de.hybris.platform:hybris-commerce-telco:${hybrisVersion}@zip"
}
//Example for downloading the zips from the support portal
//The SupportPortalDownload tasks below download the files in the same folder that is configured for
//dependency resolution (variable platformFiles), so the bootstrapPlatform task
//can use them to unpack the platform
//The plugin makes sure to execute any SupportPortalDownload task before the
//bootstrapPlatform task, to avoid dependency resolution errors.
task downloadCommerce(type: SupportPortalDownload) {
description "Download hybrisplatform zip file from SAP Support Portal"
//URL to support portal file (as stated in wiki.hybris.com)
supportPortalUrl = "https://launchpad.support.sap.com/#/softwarecenter/template/products/%20_APP=00200682500000001943&_EVENT=DISPHIER&HEADER=Y&FUNCTIONBAR=N&EVENT=TREE&NE=NAVIGATE&ENR=73555000100200008593&V=MAINT&TA=ACTUAL&PAGE=SEARCH/HYBRIS%20COMMERCE%201808"
//S/I/D User, credentials are defined in gradle.properties
username = supportUser
password = supportPassword
//download target
targetFile = file("$platformFiles/hybris-commerce-suite-${hybrisVersion}.zip")
//expected md5 hash (Available in support portal, Related Info -> Content Info)
md5Hash = "2095d017c941bfa82c5eae7cca60eec3"
}
task downloadDatahub(type: SupportPortalDownload) {
description "Download datahub zip file from SAP Support Portal"
supportPortalUrl = "https://launchpad.support.sap.com/#/softwarecenter/template/products/%20_APP=00200682500000001943&_EVENT=DISPHIER&HEADER=Y&FUNCTIONBAR=N&EVENT=TREE&NE=NAVIGATE&ENR=73555000100200008592&V=MAINT&TA=ACTUAL&PAGE=SEARCH/HYBRIS%20DATAHUB%201808"
username = supportUser
password = supportPassword
targetFile = file("$platformFiles/hybris-commerce-datahub-${hybrisVersion}.zip")
md5Hash = "b9a990c4d62df449fe58350388ad6a19"
}
// task downloadTelco(type: SupportPortalDownload) {
// description "Download Telco & Media Accelerator zip file from SAP Support Portal"
// supportPortalUrl = "https://launchpad.support.sap.com/#/softwarecenter/template/products/_APP=00200682500000001943&_EVENT=DISPHIER&HEADER=Y&FUNCTIONBAR=N&EVENT=TREE&NE=NAVIGATE&ENR=73555000100200007422&V=MAINT"
// username = supportUser
// password = supportPassword
// targetFile = file("$platformFiles/hybris-commerce-telco-${hybrisVersion}.zip")
// md5Hash = "f08f6164ed00b86fc0dd686c9eee4f71"
// }
//Examaple for a local setup:
//treat the hybris/config folder (mostly) like an external dependency
//1. load environment specific configs from hybris.optional.config.dir
task configureOptionalConfigDir {
dependsOn "bootstrapPlatform", "createDefaultConfig"
def localProperties = file('hybris/config/local.properties')
onlyIf {
!localProperties.text.contains("hybris.optional.config.dir")
}
doLast {
localProperties << """
#GENERATED by gradle
hybris.optional.config.dir=${project.file('config/own-config')}
#GENERATED
""".stripIndent()
}
}
//2. only keep modified files in git, and copy them over the out-of-the-box config
task copyCustomConfig(type: Copy) {
group "Setup"
description "Copy modified files over the standard hybris config folder"
dependsOn "bootstrapPlatform", "createDefaultConfig"
from file("config/config-customization/")
into file("hybris/config/")
}
//little helper task to generate a new developer config
task createBootstrapDevConfig(type: WriteProperties) {
def developerProperties = file("config/own-config/99-local.properties")
onlyIf {
!developerProperties.exists()
}
outputFile developerProperties
comment "Generated developer properties, feel free to change"
property "db.url", "jdbc:mysql://localhost:3306/${project.name}?useConfigs=maxPerformance&characterEncoding=utf8&useSSL=false"
property "db.driver", "com.mysql.jdbc.Driver"
property "db.username", "<CHANGE_ME>"
property "db.password", "<CHANGE_ME>"
}
task setupDev {
group "Setup"
description "Create a new Developer Setup from scratch"
dependsOn "copyCustomConfig", "configureOptionalConfigDir", "createBootstrapDevConfig"
}
//the plugin also provides a custom task type to run hybris ant targets
//here an example to run unit tests
task unitTests(type: HybrisAntTask) {
args("unittests")
antProperty("testclasses.extensions", "training")
//do NOT start hybris for unit tests, works for 6.4+
//check https://jira.hybris.com/browse/ECP-1200
antProperty("testclasses.suppress.junit.tenant", "true")
//we can also call other ant targets by prefexing the target name with `y`
//because the plugin defines a task rule (check the output of 'gradle tasks')
dependsOn tasks.getByPath("ybuild")
}
//you can also call any other hybris ant target on the command line with `./gradlew y<target>`
// example of a custom task to run the complete hybris build and generate the
// CCv1 package at the end
task rebuildAndPackage {
group "Distribution"
description "Rebuild platform and create a new hybris cloud services package"
dependsOn "yclean", "ybuild", "yproduction", "buildCCV1Package"
}