forked from claeis/ili2fme-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
108 lines (93 loc) · 2.68 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
// In this section you declare where to find the dependencies of your project
repositories {
mavenCentral()
maven {
url "http://jars.interlis.ch"
}
}
Properties properties = new Properties()
File propFile=project.rootProject.file('user.properties')
if(propFile.exists()){
properties.load(propFile.newDataInputStream())
}
def windir = System.getProperty('windir',properties.get('windir',""))
def site_pwd = System.getProperty('site_pwd',properties.get('site_pwd','site_pwd'))
def site_usr = System.getProperty('site_usr',properties.get('site_usr','site_usr'))
def site_url = System.getProperty('site_url',properties.get('site_url','site_url'))
def generatedResources = "$buildDir/generated"
def extractedIli2fmeJar = "$buildDir/ili2fmeJar"
configurations {
ili2fme { transitive = false }
ftpAntTask
scpAntTask
}
dependencies {
ili2fme("ch.interlis:ili2fme:latest.release"){
//artifact {
//useful when some artifact properties unconventional
// name = 'ili2fme' //artifact name different than module name
// extension = 'zip'
// type = 'zip'
// classifier = 'bindist'
//}
}
ftpAntTask "org.apache.ant:ant-commons-net:1.10.7"
//scpAntTask "com.jcraft:jsch:0.1.55"
scpAntTask "org.apache.ant:ant-jsch:1.10.7"
}
task getIli2fmeVersion {
def versionPropsFile = new File("_data/version.json")
outputs.files "$versionPropsFile"
doLast{
def version = configurations.ili2fme.incoming.artifacts[0].id.componentIdentifier.version
def json = groovy.json.JsonOutput.toJson([version: version])
versionPropsFile.write(json)
}
}
task getIli2fmeJar(type: Copy){
from {
zipTree(configurations.ili2fme.singleFile).matching { include '**/ili2fme.jar' }.singleFile
}
into "$extractedIli2fmeJar"
}
task buildSite {
doLast {
def jekyllCmd = ['exec', 'jekyll', 'build']
if(windir==""){
jekyllCmd.add(0,'bundle')
}else{
jekyllCmd.add(0,'bundle.bat')
jekyllCmd.add(0,"/c")
jekyllCmd.add(0,"cmd")
}
exec {
commandLine jekyllCmd
}
}
}
ant.taskdef(name: 'myftp',
classname: 'org.apache.tools.ant.taskdefs.optional.net.FTP',
classpath: configurations.ftpAntTask.asPath)
ant.taskdef(name: 'myscp',
classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp',
classpath: configurations.scpAntTask.asPath)
task uploadSite {
doLast {
ant.myscp(password: site_pwd,
todir: site_usr+'@'+site_url+":/public_html") {
fileset(dir: '_site' ) {
include(name: '**')
}
}
}
}
task uploadFtpSite {
doLast {
ant.myftp(server: site_url, userid: site_usr, password: site_pwd,
remoteDir: "/public_html", passive:"yes", retriesAllowed: 3) {
fileset(dir: '_site' ) {
include(name: '**')
}
}
}
}