-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
140 lines (114 loc) · 4.16 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
project.group = "org.lilie.services.eliot"
project.ext.artefactId = "eliot-tice-dbmigration-all"
project.version = "2.0.3-SNAPSHOT"
project.ext.versionSchemaEliot = "2.8.2-A1"
// classifierSchemaEliot =
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'maven'
repositories {
//mavenLocal()
maven {
url "http://repository-ticetime.forge.cloudbees.com"
artifactUrls "http://repository-ticetime.forge.cloudbees.com/release"
}
maven {
url "http://repository-ticetime.forge.cloudbees.com/snapshot/"
}
mavenCentral()
}
configurations {
liquibase.extendsFrom compile
deploiementArtefact
}
dependencies {
compile group: 'org.liquibase', name: 'liquibase-core', version: '2.0.2'
compile group: 'postgresql', name: 'postgresql', version: '9.1-901.jdbc4'
compile group: 'org.lilie.services.eliot', name:'eliot-securite-dbmigration', version:"${versionSchemaEliot}"
compile group: 'org.lilie.services.eliot', name:'eliot-demon-commons', version:"${versionSchemaEliot}"
compile group: 'org.lilie.services.eliot', name:'eliot-scolarite-dbmigration', version:"${versionSchemaEliot}"
compile group:'org.lilie.services.eliot', name:'eliot-tice-dbmigration', version:"${version}"
//deploiementArtefact 'org.apache.maven.wagon:wagon-http:1.0-beta-2'
deploiementArtefact "org.apache.maven.wagon:wagon-webdav:1.0-beta-2"
}
/**
* Deploiement artefact
*/
/**
* La config du repository est au format des parametres attendus par Grails
* pour ne pas avoir à dupliquer les informations de connexion au repositoty
*/
project.ext {
userHome = System.properties['user.home']
repositoryConfigFile = "${userHome}/.grails/settings.groovy"
repositoryReleases = "ticetimereleases"
repositorySnapshots = "ticetimesnapshot"
}
/**
* Configuration de la tache upload archives
*/
uploadArchives {
if (!project.hasProperty('environment')) {
project.ext.environment = 'development'
}
project.ext.configRepository = new ConfigSlurper(project.environment).parse(
new File(repositoryConfigFile).toURL())
repositories.mavenDeployer {
configuration = configurations.deploiementArtefact
def reposName = repositoryReleases
if (version.endsWith("SNAPSHOT")) {
reposName = repositorySnapshots
}
repository(url: configRepository.grails.project.repos."${reposName}".url) {
authentication(
userName: configRepository.grails.project.repos."${reposName}".username,
password: configRepository.grails.project.repos."${reposName}".password
)
}
}
}
// Lancement liquibase
project.ext.dataSourceConfigFile = "${projectDir}/DataSource.groovy"
/**
* Configuration de la tache update
* Pour lancer en mode dev : gradle update
* Pour lancer en mode test : gradle update -Penvironment=test
*/
task update(dependsOn: build) {
if (!project.hasProperty('environment')) {
project.ext.environment = 'development'
}
project.ext.configDataSource = new ConfigSlurper(project.environment).parse(new File(dataSourceConfigFile).toURL())
displayConfig(configDataSource)
ant.path(id: 'classpath') {
ant.pathelement(path: configurations.liquibase.asPath)
ant.pathelement(location: "${project.buildDir}/libs/${project.name}-${version}.jar")
}
ant.taskdef(resource: 'liquibasetasks.properties', classpathref: 'classpath')
}
/**
* Action de la tâche update
*/
update << {
println configurations.liquibase.asPath
ant.updateDatabase(
changeLogFile: "${project.configDataSource.liquibase.changelogfile}",
driver: "${project.configDataSource.dataSource.driverClassName}",
url: "${project.configDataSource.dataSource.url}",
username: "${project.configDataSource.dataSource.username}",
password: "${project.configDataSource.dataSource.password}",
promptOnNonLocalDatabase: "false",
dropFirst: "false",
classpathref: 'classpath')
}
// methode utilitaire
def displayConfig(config) {
println """
--- Config DataSource ---
Environnement : ${environment}
liquibase.changelogfile : ${config.liquibase.changelogfile}
dataSource.driverClassName: ${config.dataSource.driverClassName}
dataSource.url: ${config.dataSource.url}
---
"""
}