@@ -62,17 +62,17 @@ public void cleanFileSystem() throws Exception {
6262 Path workerSh = workspaceDir .getRelative ("worker.sh" );
6363 FileSystemUtils .writeContentAsLatin1 (workerSh , "#!/bin/bash" );
6464
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 );
7676
7777 // Pretend to do some work inside the execRoot.
7878 execRoot .getRelative ("tempdir" ).createDirectory ();
@@ -82,7 +82,7 @@ public void cleanFileSystem() throws Exception {
8282 FileSystemUtils .writeContentAsLatin1 (workerSh , "#!/bin/sh" );
8383
8484 // Reuse the same execRoot.
85- workerExecRoot .createFileSystem ();
85+ workerExecRoot .createFileSystem (workerFiles , inputs , outputs );
8686
8787 assertThat (execRoot .getRelative ("worker.sh" ).exists ()).isTrue ();
8888 assertThat (
@@ -102,21 +102,20 @@ public void createsAndCleansInputSymlinks() throws Exception {
102102 FileSystemUtils .ensureSymbolicLink (execRoot .getRelative ("dir/input_symlink_2" ), "unchanged" );
103103 FileSystemUtils .ensureSymbolicLink (execRoot .getRelative ("dir/input_symlink_3" ), "whatever" );
104104
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 );
116115
117116 // This should update the `input_symlink_{1,2,3}` according to `SandboxInputs`, i.e., update the
118117 // first/second (alternatively leave the second unchanged) and delete the third.
119- workerExecRoot .createFileSystem ();
118+ workerExecRoot .createFileSystem (workerFiles , inputs , outputs );
120119
121120 assertThat (execRoot .getRelative ("dir/input_symlink_1" ).readSymbolicLink ())
122121 .isEqualTo (PathFragment .create ("new_content" ));
@@ -127,23 +126,23 @@ public void createsAndCleansInputSymlinks() throws Exception {
127126
128127 @ Test
129128 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 );
147146
148147 assertThat (execRoot .getRelative ("dir/foo/_kotlinc/bar_kt_jvm/bar_kt_sourcegenfiles" ).exists ())
149148 .isTrue ();
@@ -170,16 +169,15 @@ public void workspaceFilesAreNotDeleted() throws Exception {
170169 FileSystemUtils .ensureSymbolicLink (execRoot .getRelative ("needed_file" ), neededWorkspaceFile );
171170 FileSystemUtils .ensureSymbolicLink (execRoot .getRelative ("other_file" ), otherWorkspaceFile );
172171
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 );
183181
184182 assertThat (execRoot .getRelative ("needed_file" ).readSymbolicLink ())
185183 .isEqualTo (neededWorkspaceFile .asFragment ());
@@ -199,17 +197,15 @@ public void recreatesEmptyFiles() throws Exception {
199197
200198 HashMap <PathFragment , Path > inputs = new HashMap <>();
201199 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 );
208204
209205 // This is interesting, because the filepath is a key in `SandboxInputs`, but its value is
210206 // `null`, which means "create an empty file". So after `createFileSystem` the file should be
211207 // empty.
212- workerExecRoot .createFileSystem ();
208+ workerExecRoot .createFileSystem (workerFiles , sandboxInputs , outputs );
213209
214210 assertThat (
215211 FileSystemUtils .readContent (
0 commit comments