| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. | 1 // Copyright 2017 The LUCI Authors. |
| 2 // | 2 // |
| 3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
| 5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
| 6 // | 6 // |
| 7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 // | 8 // |
| 9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
| 10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 ut.checker.AddItem(isolFile.item(), true, func(item *Item, ps *isolatedc
lient.PushState) { | 190 ut.checker.AddItem(isolFile.item(), true, func(item *Item, ps *isolatedc
lient.PushState) { |
| 191 if ps == nil { | 191 if ps == nil { |
| 192 return | 192 return |
| 193 } | 193 } |
| 194 log.Printf("QUEUED %q for upload", item.RelPath) | 194 log.Printf("QUEUED %q for upload", item.RelPath) |
| 195 ut.uploader.UploadBytes(item.RelPath, isolFile.contents(), ps, f
unc() { | 195 ut.uploader.UploadBytes(item.RelPath, isolFile.contents(), ps, f
unc() { |
| 196 log.Printf("UPLOADED %q", item.RelPath) | 196 log.Printf("UPLOADED %q", item.RelPath) |
| 197 }) | 197 }) |
| 198 }) | 198 }) |
| 199 | 199 |
| 200 // Make sure that all pending items have been checked. | |
| 201 if err := ut.checker.Close(); err != nil { | |
| 202 return IsolatedSummary{}, err | |
| 203 } | |
| 204 | |
| 205 // Make sure that all the uploads have completed successfully. | |
| 206 if err := ut.uploader.Close(); err != nil { | |
| 207 return IsolatedSummary{}, err | |
| 208 } | |
| 209 | |
| 210 // Write the isolated file... | 200 // Write the isolated file... |
| 211 if err := isolFile.writeJSONFile(ut.lOS); err != nil { | 201 if err := isolFile.writeJSONFile(ut.lOS); err != nil { |
| 212 return IsolatedSummary{}, err | 202 return IsolatedSummary{}, err |
| 213 } | 203 } |
| 214 | 204 |
| 215 return IsolatedSummary{ | 205 return IsolatedSummary{ |
| 216 Name: isolFile.name(), | 206 Name: isolFile.name(), |
| 217 Digest: isolFile.item().Digest, | 207 Digest: isolFile.item().Digest, |
| 218 }, nil | 208 }, nil |
| 219 } | 209 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 253 } |
| 264 | 254 |
| 265 // name returns the base name of the isolated file, extension stripped. | 255 // name returns the base name of the isolated file, extension stripped. |
| 266 func (ij *isolatedFile) name() string { | 256 func (ij *isolatedFile) name() string { |
| 267 name := filepath.Base(ij.path) | 257 name := filepath.Base(ij.path) |
| 268 if i := strings.LastIndex(name, "."); i != -1 { | 258 if i := strings.LastIndex(name, "."); i != -1 { |
| 269 name = name[:i] | 259 name = name[:i] |
| 270 } | 260 } |
| 271 return name | 261 return name |
| 272 } | 262 } |
| OLD | NEW |