@@ -62,17 +62,17 @@ public void cleanFileSystem() throws Exception {
62
62
Path workerSh = workspaceDir .getRelative ("worker.sh" );
63
63
FileSystemUtils .writeContentAsLatin1 (workerSh , "#!/bin/bash" );
64
64
65
- WorkerExecRoot workerExecRoot =
66
- new WorkerExecRoot (
67
- execRoot ,
68
- new SandboxInputs (
69
- ImmutableMap .of (PathFragment . create ( "worker.sh" ), workerSh ),
70
- ImmutableSet . of (),
71
- ImmutableMap . of ()),
72
- SandboxOutputs . create (
73
- ImmutableSet .of (PathFragment .create ("very/output.txt " )), ImmutableSet . of ()),
74
- ImmutableSet . of ( PathFragment . create ( "worker.sh" )) );
75
- workerExecRoot .createFileSystem ();
65
+ SandboxInputs inputs =
66
+ new SandboxInputs (
67
+ ImmutableMap . of ( PathFragment . create ( "worker.sh" ), workerSh ) ,
68
+ ImmutableSet . of (),
69
+ ImmutableMap .of ());
70
+ SandboxOutputs outputs =
71
+ SandboxOutputs . create (
72
+ ImmutableSet . of ( PathFragment . create ("very/output.txt" )), ImmutableSet . of ());
73
+ ImmutableSet < PathFragment > workerFiles = ImmutableSet .of (PathFragment .create ("worker.sh " ));
74
+ WorkerExecRoot workerExecRoot = new WorkerExecRoot ( execRoot );
75
+ workerExecRoot .createFileSystem (workerFiles , inputs , outputs );
76
76
77
77
// Pretend to do some work inside the execRoot.
78
78
execRoot .getRelative ("tempdir" ).createDirectory ();
@@ -82,7 +82,7 @@ public void cleanFileSystem() throws Exception {
82
82
FileSystemUtils .writeContentAsLatin1 (workerSh , "#!/bin/sh" );
83
83
84
84
// Reuse the same execRoot.
85
- workerExecRoot .createFileSystem ();
85
+ workerExecRoot .createFileSystem (workerFiles , inputs , outputs );
86
86
87
87
assertThat (execRoot .getRelative ("worker.sh" ).exists ()).isTrue ();
88
88
assertThat (
@@ -102,21 +102,20 @@ public void createsAndCleansInputSymlinks() throws Exception {
102
102
FileSystemUtils .ensureSymbolicLink (execRoot .getRelative ("dir/input_symlink_2" ), "unchanged" );
103
103
FileSystemUtils .ensureSymbolicLink (execRoot .getRelative ("dir/input_symlink_3" ), "whatever" );
104
104
105
- WorkerExecRoot workerExecRoot =
106
- new WorkerExecRoot (
107
- execRoot ,
108
- new SandboxInputs (
109
- ImmutableMap .of (),
110
- ImmutableSet .of (),
111
- ImmutableMap .of (
112
- PathFragment .create ("dir/input_symlink_1" ), PathFragment .create ("new_content" ),
113
- PathFragment .create ("dir/input_symlink_2" ), PathFragment .create ("unchanged" ))),
114
- SandboxOutputs .create (ImmutableSet .of (), ImmutableSet .of ()),
115
- ImmutableSet .of ());
105
+ SandboxInputs inputs =
106
+ new SandboxInputs (
107
+ ImmutableMap .of (),
108
+ ImmutableSet .of (),
109
+ ImmutableMap .of (
110
+ PathFragment .create ("dir/input_symlink_1" ), PathFragment .create ("new_content" ),
111
+ PathFragment .create ("dir/input_symlink_2" ), PathFragment .create ("unchanged" )));
112
+ SandboxOutputs outputs = SandboxOutputs .create (ImmutableSet .of (), ImmutableSet .of ());
113
+ ImmutableSet <PathFragment > workerFiles = ImmutableSet .of ();
114
+ WorkerExecRoot workerExecRoot = new WorkerExecRoot (execRoot );
116
115
117
116
// This should update the `input_symlink_{1,2,3}` according to `SandboxInputs`, i.e., update the
118
117
// first/second (alternatively leave the second unchanged) and delete the third.
119
- workerExecRoot .createFileSystem ();
118
+ workerExecRoot .createFileSystem (workerFiles , inputs , outputs );
120
119
121
120
assertThat (execRoot .getRelative ("dir/input_symlink_1" ).readSymbolicLink ())
122
121
.isEqualTo (PathFragment .create ("new_content" ));
@@ -127,23 +126,23 @@ public void createsAndCleansInputSymlinks() throws Exception {
127
126
128
127
@ Test
129
128
public void createsOutputDirs () throws Exception {
130
- WorkerExecRoot workerExecRoot =
131
- new WorkerExecRoot (
132
- execRoot ,
133
- new SandboxInputs ( ImmutableMap . of (), ImmutableSet . of (), ImmutableMap . of ()),
134
- SandboxOutputs . create (
135
- ImmutableSet . of (
136
- PathFragment .create ("dir/foo/bar_kt.jar " ),
137
- PathFragment .create ("dir/foo/bar_kt.jdeps" ),
138
- PathFragment . create ( "dir/foo/bar_kt-sources.jar" )),
139
- ImmutableSet . of (
140
- PathFragment .create ("dir/foo/_kotlinc/bar_kt_jvm/bar_kt_sourcegenfiles " ),
141
- PathFragment .create ("dir/foo/_kotlinc/bar_kt_jvm/bar_kt_classes " ),
142
- PathFragment .create ("dir/foo/_kotlinc/bar_kt_jvm/bar_kt_temp" ),
143
- PathFragment . create ( "dir/foo/_kotlinc/bar_kt_jvm/bar_kt_generated_classes" ))),
144
- ImmutableSet . of () );
145
-
146
- workerExecRoot .createFileSystem ();
129
+ SandboxInputs inputs =
130
+ new SandboxInputs ( ImmutableMap . of (), ImmutableSet . of (), ImmutableMap . of ());
131
+ SandboxOutputs outputs =
132
+ SandboxOutputs . create (
133
+ ImmutableSet . of (
134
+ PathFragment . create ( "dir/foo/bar_kt.jar" ),
135
+ PathFragment .create ("dir/foo/bar_kt.jdeps " ),
136
+ PathFragment .create ("dir/foo/bar_kt-sources.jar" ) ),
137
+ ImmutableSet . of (
138
+ PathFragment . create ( "dir/foo/_kotlinc/bar_kt_jvm/bar_kt_sourcegenfiles" ),
139
+ PathFragment .create ("dir/foo/_kotlinc/bar_kt_jvm/bar_kt_classes " ),
140
+ PathFragment .create ("dir/foo/_kotlinc/bar_kt_jvm/bar_kt_temp " ),
141
+ PathFragment .create ("dir/foo/_kotlinc/bar_kt_jvm/bar_kt_generated_classes" )));
142
+ ImmutableSet < PathFragment > workerFiles = ImmutableSet . of ();
143
+ WorkerExecRoot workerExecRoot = new WorkerExecRoot ( execRoot );
144
+
145
+ workerExecRoot .createFileSystem (workerFiles , inputs , outputs );
147
146
148
147
assertThat (execRoot .getRelative ("dir/foo/_kotlinc/bar_kt_jvm/bar_kt_sourcegenfiles" ).exists ())
149
148
.isTrue ();
@@ -170,16 +169,15 @@ public void workspaceFilesAreNotDeleted() throws Exception {
170
169
FileSystemUtils .ensureSymbolicLink (execRoot .getRelative ("needed_file" ), neededWorkspaceFile );
171
170
FileSystemUtils .ensureSymbolicLink (execRoot .getRelative ("other_file" ), otherWorkspaceFile );
172
171
173
- WorkerExecRoot workerExecRoot =
174
- new WorkerExecRoot (
175
- execRoot ,
176
- new SandboxInputs (
177
- ImmutableMap .of (PathFragment .create ("needed_file" ), neededWorkspaceFile ),
178
- ImmutableSet .of (),
179
- ImmutableMap .of ()),
180
- SandboxOutputs .create (ImmutableSet .of (), ImmutableSet .of ()),
181
- ImmutableSet .of ());
182
- workerExecRoot .createFileSystem ();
172
+ SandboxInputs inputs =
173
+ new SandboxInputs (
174
+ ImmutableMap .of (PathFragment .create ("needed_file" ), neededWorkspaceFile ),
175
+ ImmutableSet .of (),
176
+ ImmutableMap .of ());
177
+ SandboxOutputs outputs = SandboxOutputs .create (ImmutableSet .of (), ImmutableSet .of ());
178
+ ImmutableSet <PathFragment > workerFiles = ImmutableSet .of ();
179
+ WorkerExecRoot workerExecRoot = new WorkerExecRoot (execRoot );
180
+ workerExecRoot .createFileSystem (workerFiles , inputs , outputs );
183
181
184
182
assertThat (execRoot .getRelative ("needed_file" ).readSymbolicLink ())
185
183
.isEqualTo (neededWorkspaceFile .asFragment ());
@@ -199,17 +197,15 @@ public void recreatesEmptyFiles() throws Exception {
199
197
200
198
HashMap <PathFragment , Path > inputs = new HashMap <>();
201
199
inputs .put (PathFragment .create ("some_file" ), null );
202
- WorkerExecRoot workerExecRoot =
203
- new WorkerExecRoot (
204
- execRoot ,
205
- new SandboxInputs (inputs , ImmutableSet .of (), ImmutableMap .of ()),
206
- SandboxOutputs .create (ImmutableSet .of (), ImmutableSet .of ()),
207
- ImmutableSet .of ());
200
+ SandboxInputs sandboxInputs = new SandboxInputs (inputs , ImmutableSet .of (), ImmutableMap .of ());
201
+ SandboxOutputs outputs = SandboxOutputs .create (ImmutableSet .of (), ImmutableSet .of ());
202
+ ImmutableSet <PathFragment > workerFiles = ImmutableSet .of ();
203
+ WorkerExecRoot workerExecRoot = new WorkerExecRoot (execRoot );
208
204
209
205
// This is interesting, because the filepath is a key in `SandboxInputs`, but its value is
210
206
// `null`, which means "create an empty file". So after `createFileSystem` the file should be
211
207
// empty.
212
- workerExecRoot .createFileSystem ();
208
+ workerExecRoot .createFileSystem (workerFiles , sandboxInputs , outputs );
213
209
214
210
assertThat (
215
211
FileSystemUtils .readContent (
0 commit comments