-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
68 lines (55 loc) · 2.15 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
version = '1.0'
ant.mkdir(dir: 'build')
task clean(type: Delete) {
delete 'build'
}
task createSfx << {
ant.exec(
dir: 'SfxRoot',
executable: 'C:\\Program Files (x86)\\7-Zip\\7z.exe',
failonerror: false,
vmlauncher: false,
resultproperty:"cmdExit",
outputproperty:"cmdOut",
errorproperty: "cmdErr"
) {
arg(line: 'a')
arg(line: '-t7z')
arg(line: '..\\build\\Workspace-Setup.7z')
arg(line: '.\\')
}
println "return code: ${ant.project.properties.cmdExit}"
println """stderr:
${ant.project.properties.cmdErr}
################################"""
println """stdout:
${ ant.project.properties.cmdOut}
################################"""
if (ant.project.properties.cmdExit != '0') {
throw new GradleException('Filed to create 7z file.')
}
String copyCommand = 'cmd /C copy /Y /b "C:\\Program Files (x86)\\7-Zip\\7zsd.sfx" + SfxRoot\\config.txt + build\\Workspace-Setup.7z build\\Workspace-Setup.exe'
println copyCommand
String output = copyCommand.execute().text
println output
if (!(new File('build/Workspace-Setup.exe')).exists()) {
throw new GradleException('Filed to create sfx file.')
}
}
task createCookbook(type: Tar){
compression = Compression.GZIP
from 'Chef'
exclude 'node.json'
baseName = 'chef-solo-cookbooks'
extension = 'tar.gz'
destinationDir = new File('build')
}
task publishCookbook(type:Exec, dependsOn: 'createCookbook') {
commandLine 'cmd', '/c', 'mvn deploy:deploy-file -Durl=https://nexus.repo:8443/nexus/content/repositories/thirdparty -DrepositoryId=nexus -Dfile=C:/Projects/workspace-management/build/chef-solo-cookbooks.tar.gz -DgroupId=com.agilex.chef -DartifactId=chef-solo-cookbooks -Dversion=1.0 -Dpackaging=tar.gz'
}
task publishNodeConfig(type:Exec) {
commandLine 'cmd', '/c', 'mvn deploy:deploy-file -Durl=https://nexus.repo:8443/nexus/content/repositories/thirdparty -DrepositoryId=nexus -Dfile=C:/Projects/workspace-management/Chef/node.json -DgroupId=com.agilex.chef -DartifactId=node -Dversion=1.0 -Dpackaging=json'
}
task build(dependsOn: ['createCookbook', 'createSfx']) {}
task publish(dependsOn: ['publishCookbook', 'publishNodeConfig']) {}
task all(dependsOn: ['build', 'publish']) {}