99
99
import com .google .devtools .build .lib .remote .common .RemotePathResolver ;
100
100
import com .google .devtools .build .lib .remote .merkletree .MerkleTree ;
101
101
import com .google .devtools .build .lib .remote .options .RemoteOptions ;
102
- import com .google .devtools .build .lib .remote .options .RemoteOutputsMode ;
103
102
import com .google .devtools .build .lib .remote .util .DigestUtil ;
104
103
import com .google .devtools .build .lib .remote .util .TempPathGenerator ;
105
104
import com .google .devtools .build .lib .remote .util .TracingMetadataUtils ;
@@ -1136,13 +1135,7 @@ public InMemoryOutput downloadOutputs(RemoteAction action, RemoteActionResult re
1136
1135
1137
1136
ImmutableList .Builder <ListenableFuture <FileMetadata >> downloadsBuilder =
1138
1137
ImmutableList .builder ();
1139
- RemoteOutputsMode remoteOutputsMode = remoteOptions .remoteOutputsMode ;
1140
- boolean downloadOutputs =
1141
- remoteOutputsMode .downloadAllOutputs ()
1142
- ||
1143
- // In case the action failed, download all outputs. It might be helpful for debugging
1144
- // and there is no point in injecting output metadata of a failed action.
1145
- result .getExitCode () != 0 ;
1138
+ boolean downloadOutputs = shouldDownloadOutputsFor (result , metadata );
1146
1139
1147
1140
// Download into temporary paths, then move everything at the end.
1148
1141
// This avoids holding the output lock while downloading, which would prevent the local branch
@@ -1162,12 +1155,10 @@ public InMemoryOutput downloadOutputs(RemoteAction action, RemoteActionResult re
1162
1155
checkState (
1163
1156
result .getExitCode () == 0 ,
1164
1157
"injecting remote metadata is only supported for successful actions (exit code 0)." );
1165
-
1166
- if (!metadata .symlinks ().isEmpty ()) {
1167
- throw new IOException (
1168
- "Symlinks in action outputs are not yet supported by "
1169
- + "--experimental_remote_download_outputs=minimal" );
1170
- }
1158
+ checkState (
1159
+ metadata .symlinks .isEmpty (),
1160
+ "Symlinks in action outputs are not yet supported by"
1161
+ + " --remote_download_outputs=minimal" );
1171
1162
}
1172
1163
1173
1164
FileOutErr tmpOutErr = outErr .childOutErr ();
@@ -1300,6 +1291,29 @@ public InMemoryOutput downloadOutputs(RemoteAction action, RemoteActionResult re
1300
1291
return null ;
1301
1292
}
1302
1293
1294
+ private boolean shouldDownloadOutputsFor (
1295
+ RemoteActionResult result , ActionResultMetadata metadata ) {
1296
+ if (remoteOptions .remoteOutputsMode .downloadAllOutputs ()) {
1297
+ return true ;
1298
+ }
1299
+ // In case the action failed, download all outputs. It might be helpful for debugging and there
1300
+ // is no point in injecting output metadata of a failed action.
1301
+ if (result .getExitCode () != 0 ) {
1302
+ return true ;
1303
+ }
1304
+ // Symlinks in actions output are not yet supported with BwoB.
1305
+ if (!metadata .symlinks ().isEmpty ()) {
1306
+ report (
1307
+ Event .warn (
1308
+ String .format (
1309
+ "Symlinks in action outputs are not yet supported by --remote_download_minimal,"
1310
+ + " falling back to downloading all action outputs due to output symlink %s" ,
1311
+ Iterables .getOnlyElement (metadata .symlinks ()).path ())));
1312
+ return true ;
1313
+ }
1314
+ return false ;
1315
+ }
1316
+
1303
1317
private ImmutableList <ListenableFuture <FileMetadata >> buildFilesToDownload (
1304
1318
RemoteActionExecutionContext context ,
1305
1319
ProgressStatusListener progressStatusListener ,
0 commit comments