87 throw new GradleException("To publish artifacts, set the maven repository user name -PmavenRepositoryUser=<user>")
88 }
89 if (graph.hasTask(publish) && !findProperty('mavenRepositoryPassword')) {
90 throw new GradleException("To publish artifacts, set the maven repository password -PmavenRepositoryPassword=<password>")
91 }
92 }
93 }
94
95 task test {
96 subprojects.findAll() { !it.getTasksByName('test', false).isEmpty() }.each { dependsOn "${it.path}:test" }
97 }
98
99 task clean {
100 subprojects.findAll() { !it.getTasksByName('clean', false).isEmpty() }.each { dependsOn "${it.path}:clean" }
101 }
102
103 reproduce {
104 dockerfile = 'test.dockerfile'
105 }
106
107 task local(type: Copy) {
108 doFirst {
109 delete project.buildDir
110 }
111 def os = System.getProperty('os.name').toLowerCase()
112 def osName = os.startsWith('win') ? 'Windows' :
113 os.startsWith('mac') ? 'Macos' : 'Linux'
114
115 dependsOn ':cli:image' + osName
116 from zipTree(file(project.rootDir.toString() +
117 '/cli/build/distributions/cli' +
118 '-' + project.version + '-' +
119 osName.toLowerCase() + '.zip'))
120 into project.buildDir
121 }
122
123 defaultTasks 'local'
|
87 throw new GradleException("To publish artifacts, set the maven repository user name -PmavenRepositoryUser=<user>")
88 }
89 if (graph.hasTask(publish) && !findProperty('mavenRepositoryPassword')) {
90 throw new GradleException("To publish artifacts, set the maven repository password -PmavenRepositoryPassword=<password>")
91 }
92 }
93 }
94
95 task test {
96 subprojects.findAll() { !it.getTasksByName('test', false).isEmpty() }.each { dependsOn "${it.path}:test" }
97 }
98
99 task clean {
100 subprojects.findAll() { !it.getTasksByName('clean', false).isEmpty() }.each { dependsOn "${it.path}:clean" }
101 }
102
103 reproduce {
104 dockerfile = 'test.dockerfile'
105 }
106
107 def getOS() {
108 def os = System.getProperty('os.name').toLowerCase()
109 if (os.startsWith('linux')) {
110 return 'linux'
111 }
112 if (os.startsWith('mac')) {
113 return 'macos'
114 }
115 if (os.startsWith('win')) {
116 return 'windows'
117 }
118 if (os.startsWith('sunos')) {
119 return 'solaris'
120 }
121 throw new GradleException("Unexpected operating system: " + os)
122 }
123
124 def getCPU() {
125 def cpu = System.getProperty('os.arch').toLowerCase()
126 if (cpu.startsWith('amd64') || cpu.startsWith('x86_64') || cpu.startsWith('x64')) {
127 return 'x64'
128 }
129 if (cpu.startsWith('x86') || cpu.startsWith('i386')) {
130 return 'x86'
131 }
132 if (cpu.startsWith('sparc')) {
133 return 'sparc'
134 }
135 if (cpu.startsWith('ppc')) {
136 return 'ppc'
137 }
138 if (cpu.startsWith('arm')) {
139 return 'arm'
140 }
141 throw new GradleException("Unexpected operating system: " + cpu)
142 }
143
144 task local(type: Copy) {
145 doFirst {
146 delete project.buildDir
147 }
148
149 def os = getOS()
150 def cpu = getCPU()
151
152 if (os in ['linux', 'macos', 'windows'] && cpu == 'x64') {
153 def target = os.substring(0, 1).toUpperCase() + os.substring(1) +
154 cpu.substring(0, 1).toUpperCase() + cpu.substring(1)
155 dependsOn ':cli:image' + target
156 } else {
157 dependsOn ':cli:imageLocal'
158 }
159
160 from zipTree(file(project.rootDir.toString() +
161 '/cli/build/distributions/cli' +
162 '-' + project.version + '-' +
163 os + '-' + cpu + '.zip'))
164 into project.buildDir
165 }
166
167 task offline(type: Copy) {
168 doFirst {
169 delete project.buildDir
170 }
171
172 def os = getOS()
173 def cpu = getCPU()
174
175 dependsOn ':cli:imageLocal'
176 from zipTree(file(project.rootDir.toString() +
177 '/cli/build/distributions/cli' +
178 '-' + project.version + '-' +
179 os + '-' + cpu + '.zip'))
180 into project.buildDir
181 }
182
183 defaultTasks 'local'
|