< prev index next >

build.gradle

Print this page

 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     if (cpu.startsWith('aarch64')) {
142         return 'aarch64';
143     }
144     throw new GradleException("Unexpected CPU: " + cpu)
145 }
146 
147 task local(type: Copy) {
148     doFirst {
149         delete project.buildDir
150     }



151 
152     def os = getOS()
153     def cpu = getCPU()
154 
155     if (os in ['linux', 'macos', 'windows'] && cpu == 'x64') {
156         def target = os.substring(0, 1).toUpperCase() + os.substring(1) +
157                      cpu.substring(0, 1).toUpperCase() + cpu.substring(1)
158         dependsOn ':cli:image' + target
159     } else {
160         dependsOn ':cli:imageLocal'
161     }
162 
163     from zipTree(file(project.rootDir.toString() +
164                       '/cli/build/distributions/cli' +
165                       '-' + project.version + '-' +
166                       os + '-' + cpu + '.zip'))
167     into project.buildDir
168 }
169 
170 task offline(type: Copy) {
171     doFirst {
172         delete project.buildDir
173     }
174 
175     def os = getOS()
176     def cpu = getCPU()
177 
178     dependsOn ':cli:imageLocal'
179     from zipTree(file(project.rootDir.toString() +
180                       '/cli/build/distributions/cli' +
181                       '-' + project.version + '-' +
182                       os + '-' + cpu + '.zip'))
183     into project.buildDir
184 }
185 
186 defaultTasks 'local'
< prev index next >