summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormikaelpeltier <mikaelpeltier@google.com>2015-01-27 17:19:51 +0100
committermikaelpeltier <mikaelpeltier@google.com>2015-01-29 17:36:45 +0100
commit1dd8e70c1a17879f3d4898545e07aeffaa9c2a95 (patch)
treed20876f43b26f1427567e9f0d66a85372ea9985d
parentfba963263c8a0546018cad64a607ce6379d7e117 (diff)
downloadtoolchain_jack-1dd8e70c1a17879f3d4898545e07aeffaa9c2a95.zip
toolchain_jack-1dd8e70c1a17879f3d4898545e07aeffaa9c2a95.tar.gz
toolchain_jack-1dd8e70c1a17879f3d4898545e07aeffaa9c2a95.tar.bz2
Use MessageDigestFS into JackLibrary
- Update prebuilts with the last digest format. Change-Id: Id064dc0f12777eb31126b05b14e1744f58bfd542
-rw-r--r--jack-tests/prebuilts/core-stubs-mini.jackbin478918 -> 487302 bytes
-rw-r--r--jack-tests/prebuilts/core-stubs-mini.jarbin203891 -> 203869 bytes
-rw-r--r--jack-tests/prebuilts/junit4-lib.jackbin487256 -> 494290 bytes
-rw-r--r--jack-tests/prebuilts/junit4-targetdex-jack.zipbin660285 -> 494290 bytes
-rw-r--r--jack-tests/tests/com/android/jack/experimental/incremental/DependenciesTest009.java14
-rw-r--r--jack-tests/tests/com/android/jack/fileconflict/FileConflictTests.java8
-rw-r--r--jack-tests/tests/com/android/jack/library/LibraryTests.java4
-rw-r--r--jack/prebuilts/core-stubs-mini.jackbin478918 -> 487302 bytes
-rw-r--r--jack/prebuilts/core-stubs-mini.jarbin203891 -> 203869 bytes
-rw-r--r--jack/src/com/android/jack/Options.java18
-rw-r--r--jack/src/com/android/jack/incremental/CommonFilter.java29
-rw-r--r--jack/src/com/android/jack/incremental/IncrementalInputFilter.java7
-rw-r--r--jack/src/com/android/jack/incremental/IncrementalLogWriter.java3
-rw-r--r--jack/src/com/android/jack/library/InputJackLibrary.java7
-rw-r--r--jack/src/com/android/jack/library/InputJackLibraryCodec.java10
-rw-r--r--jack/src/com/android/jack/library/JackLibraryFactory.java22
-rw-r--r--jack/src/com/android/jack/library/OutputJackLibrary.java10
-rw-r--r--jack/src/com/android/jack/library/OutputJackLibraryCodec.java11
-rw-r--r--jack/src/com/android/jack/library/OutputLibrary.java3
-rw-r--r--jack/src/com/android/jack/library/v0000/InputJackLibraryImpl.java24
-rw-r--r--jack/src/com/android/jack/library/v0001/InputJackLibraryImpl.java73
-rw-r--r--jack/src/com/android/jack/library/v0001/OutputJackLibraryImpl.java141
-rw-r--r--jack/tests/com/android/jack/TestTools.java9
23 files changed, 184 insertions, 209 deletions
diff --git a/jack-tests/prebuilts/core-stubs-mini.jack b/jack-tests/prebuilts/core-stubs-mini.jack
index 4d726d0..b00a74a 100644
--- a/jack-tests/prebuilts/core-stubs-mini.jack
+++ b/jack-tests/prebuilts/core-stubs-mini.jack
Binary files differ
diff --git a/jack-tests/prebuilts/core-stubs-mini.jar b/jack-tests/prebuilts/core-stubs-mini.jar
index ac77ca7..d77b31e 100644
--- a/jack-tests/prebuilts/core-stubs-mini.jar
+++ b/jack-tests/prebuilts/core-stubs-mini.jar
Binary files differ
diff --git a/jack-tests/prebuilts/junit4-lib.jack b/jack-tests/prebuilts/junit4-lib.jack
index 3634d23..5672590 100644
--- a/jack-tests/prebuilts/junit4-lib.jack
+++ b/jack-tests/prebuilts/junit4-lib.jack
Binary files differ
diff --git a/jack-tests/prebuilts/junit4-targetdex-jack.zip b/jack-tests/prebuilts/junit4-targetdex-jack.zip
index 4788c03..5672590 100644
--- a/jack-tests/prebuilts/junit4-targetdex-jack.zip
+++ b/jack-tests/prebuilts/junit4-targetdex-jack.zip
Binary files differ
diff --git a/jack-tests/tests/com/android/jack/experimental/incremental/DependenciesTest009.java b/jack-tests/tests/com/android/jack/experimental/incremental/DependenciesTest009.java
index c9d9b1a..f09bb97 100644
--- a/jack-tests/tests/com/android/jack/experimental/incremental/DependenciesTest009.java
+++ b/jack-tests/tests/com/android/jack/experimental/incremental/DependenciesTest009.java
@@ -29,7 +29,7 @@ import com.android.sched.util.file.Directory;
import com.android.sched.util.file.FileOrDirectory.ChangePermission;
import com.android.sched.util.file.FileOrDirectory.Existence;
import com.android.sched.util.file.FileOrDirectory.Permission;
-import com.android.sched.vfs.DirectVFS;
+import com.android.sched.vfs.DirectFS;
import com.android.sched.vfs.InputVFile;
import junit.framework.Assert;
@@ -75,11 +75,11 @@ public class DependenciesTest009 {
ite.incrementalBuildFromFolder();
- DirectVFS directVFS = null;
+ DirectFS directFS = null;
try {
- directVFS = new DirectVFS(new Directory(ite.getCompilerStateFolder().getPath(), null,
- Existence.MUST_EXIST, Permission.READ, ChangePermission.NOCHANGE));
- InputJackLibrary inputJackLibrary = JackLibraryFactory.getInputLibrary(directVFS);
+ directFS = new DirectFS(new Directory(ite.getCompilerStateFolder().getPath(), null,
+ Existence.MUST_EXIST, Permission.READ, ChangePermission.NOCHANGE), Permission.READ);
+ InputJackLibrary inputJackLibrary = JackLibraryFactory.getInputLibrary(directFS);
TypeDependencies typeDependencies = readTypeDependencies(inputJackLibrary);
@@ -96,8 +96,8 @@ public class DependenciesTest009 {
assert dependencies1.equals(dependencies2);
Assert.assertEquals(dependencies1, dependencies2);
} finally {
- if (directVFS != null) {
- directVFS.close();
+ if (directFS != null) {
+ directFS.close();
}
}
}
diff --git a/jack-tests/tests/com/android/jack/fileconflict/FileConflictTests.java b/jack-tests/tests/com/android/jack/fileconflict/FileConflictTests.java
index 9871251..bef3cf7 100644
--- a/jack-tests/tests/com/android/jack/fileconflict/FileConflictTests.java
+++ b/jack-tests/tests/com/android/jack/fileconflict/FileConflictTests.java
@@ -16,6 +16,8 @@
package com.android.jack.fileconflict;
+import com.google.common.io.Files;
+
import com.android.jack.backend.jayce.ImportConflictException;
import com.android.jack.backend.jayce.JayceFileImporter;
import com.android.jack.library.FileType;
@@ -279,12 +281,15 @@ public class FileConflictTests {
String libPropName = JackLibrary.LIBRARY_PROPERTIES_VPATH.getPathAsString('/');
File libProperties = new File(tempJackFolder, libPropName);
+ File digestFile = new File(tempJackFolder, FileType.DEX.getPrefix() + "/digest");
+
// create Jack dirs to import
File jackImport1 = AbstractTestTools.createTempDir();
copyFileToDir(libProperties, libPropName, jackImport1);
copyFileToDir(myClass1, jackFilePath, jackImport1);
copyFileToDir(myClass1Dex, dexFilePath, jackImport1);
+ copyFileToDir(digestFile, FileType.DEX.getPrefix() + "/digest", jackImport1);
// copy Jack file to output dir
copyFileToDir(myClass1, jackFilePath, jackOutput);
@@ -418,10 +423,13 @@ public class FileConflictTests {
String libPropName = JackLibrary.LIBRARY_PROPERTIES_VPATH.getPathAsString('/');
File libProperties = new File(tempJackFolder, libPropName);
+ File digestFile = new File(tempJackFolder, FileType.DEX.getPrefix() + "/digest");
// create Jack dirs to import
File jackImport1 = AbstractTestTools.createTempDir();
File jackImport2 = AbstractTestTools.createTempDir();
+ copyFileToDir(digestFile, FileType.DEX.getPrefix() + "/digest", jackImport1);
+ copyFileToDir(digestFile, FileType.DEX.getPrefix() + "/digest", jackImport2);
copyFileToDir(libProperties, libPropName, jackImport1);
copyFileToDir(myClass1, JACK_FILE_PATH_1, jackImport1);
copyFileToDir(myClass1Dex, DEX_FILE_PATH_1, jackImport1);
diff --git a/jack-tests/tests/com/android/jack/library/LibraryTests.java b/jack-tests/tests/com/android/jack/library/LibraryTests.java
index eddf344..d518a66 100644
--- a/jack-tests/tests/com/android/jack/library/LibraryTests.java
+++ b/jack-tests/tests/com/android/jack/library/LibraryTests.java
@@ -25,6 +25,8 @@ import com.android.sched.util.file.FileOrDirectory.Existence;
import com.android.sched.util.file.InputZipFile;
import com.android.sched.vfs.InputVFS;
import com.android.sched.vfs.InputZipVFS;
+import com.android.sched.vfs.ReadZipFS;
+import com.android.sched.vfs.VFS;
import junit.framework.Assert;
@@ -86,7 +88,7 @@ public class LibraryTests {
true, AbstractTestTools.getTestRootDir("com.android.jack.library.test001.jack"));
RunnableHooks hooks = new RunnableHooks();
- InputVFS vfs = new InputZipVFS(
+ VFS vfs = new ReadZipFS(
new InputZipFile(out.getPath(), hooks, Existence.MUST_EXIST, ChangePermission.NOCHANGE));
try {
InputJackLibrary inputJackLibrary = JackLibraryFactory.getInputLibrary(vfs);
diff --git a/jack/prebuilts/core-stubs-mini.jack b/jack/prebuilts/core-stubs-mini.jack
index 4d726d0..b00a74a 100644
--- a/jack/prebuilts/core-stubs-mini.jack
+++ b/jack/prebuilts/core-stubs-mini.jack
Binary files differ
diff --git a/jack/prebuilts/core-stubs-mini.jar b/jack/prebuilts/core-stubs-mini.jar
index ac77ca7..d77b31e 100644
--- a/jack/prebuilts/core-stubs-mini.jar
+++ b/jack/prebuilts/core-stubs-mini.jar
Binary files differ
diff --git a/jack/src/com/android/jack/Options.java b/jack/src/com/android/jack/Options.java
index bf8b6f3..df9fbbb 100644
--- a/jack/src/com/android/jack/Options.java
+++ b/jack/src/com/android/jack/Options.java
@@ -39,9 +39,9 @@ import com.android.jack.transformations.renamepackage.PackageRenamer;
import com.android.jack.util.filter.AllMethods;
import com.android.jack.util.filter.Filter;
import com.android.sched.util.RunnableHooks;
-import com.android.sched.util.codec.DirectDirInputOutputVDirCodec;
import com.android.sched.util.codec.DirectDirOutputVDirCodec;
-import com.android.sched.util.codec.ZipInputOutputVDirCodec;
+import com.android.sched.util.codec.DirectFSCodec;
+import com.android.sched.util.codec.ZipFSCodec;
import com.android.sched.util.codec.ZipOutputVDirCodec;
import com.android.sched.util.config.Config;
import com.android.sched.util.config.ConfigPrinterFactory;
@@ -65,9 +65,9 @@ import com.android.sched.util.log.LoggerFactory;
import com.android.sched.util.log.TracerFactory;
import com.android.sched.util.log.tracer.StatsTracerFtl;
import com.android.sched.vfs.Container;
-import com.android.sched.vfs.DirectVFS;
-import com.android.sched.vfs.InputOutputVFS;
+import com.android.sched.vfs.DirectFS;
import com.android.sched.vfs.OutputVFS;
+import com.android.sched.vfs.VFS;
import org.kohsuke.args4j.Argument;
import org.kohsuke.args4j.Option;
@@ -148,15 +148,15 @@ public class Options {
.ignoreCase().requiredIf(GENERATE_JACK_LIBRARY.getValue().isTrue());
@Nonnull
- public static final PropertyId<InputOutputVFS> LIBRARY_OUTPUT_ZIP = PropertyId.create(
+ public static final PropertyId<VFS> LIBRARY_OUTPUT_ZIP = PropertyId.create(
"jack.library.output.zip", "Output zip archive for library",
- new ZipInputOutputVDirCodec(Existence.MAY_EXIST)).requiredIf(GENERATE_JACK_LIBRARY.getValue()
+ new ZipFSCodec(Existence.MAY_EXIST)).requiredIf(GENERATE_JACK_LIBRARY.getValue()
.isTrue().and(LIBRARY_OUTPUT_CONTAINER_TYPE.is(Container.ZIP)));
@Nonnull
- public static final PropertyId<InputOutputVFS> LIBRARY_OUTPUT_DIR = PropertyId.create(
+ public static final PropertyId<VFS> LIBRARY_OUTPUT_DIR = PropertyId.create(
"jack.library.output.dir", "Output folder for library",
- new DirectDirInputOutputVDirCodec(Existence.MAY_EXIST)).requiredIf(GENERATE_JACK_LIBRARY
+ new DirectFSCodec(Existence.MAY_EXIST)).requiredIf(GENERATE_JACK_LIBRARY
.getValue().isTrue().and(LIBRARY_OUTPUT_CONTAINER_TYPE.is(Container.DIR)));
@@ -627,7 +627,7 @@ public class Options {
configBuilder.set(GENERATE_JACK_LIBRARY, true);
configBuilder.set(LIBRARY_OUTPUT_CONTAINER_TYPE, Container.DIR);
configBuilder.set(Options.LIBRARY_OUTPUT_DIR,
- new DirectVFS(createTempDirForTypeDexFiles(hooks)));
+ new DirectFS(createTempDirForTypeDexFiles(hooks), Permission.READ | Permission.WRITE));
}
switch (multiDexKind) {
diff --git a/jack/src/com/android/jack/incremental/CommonFilter.java b/jack/src/com/android/jack/incremental/CommonFilter.java
index a22540a..2f76ce8 100644
--- a/jack/src/com/android/jack/incremental/CommonFilter.java
+++ b/jack/src/com/android/jack/incremental/CommonFilter.java
@@ -40,10 +40,9 @@ import com.android.sched.util.file.FileOrDirectory.Permission;
import com.android.sched.util.file.InputZipFile;
import com.android.sched.util.log.LoggerFactory;
import com.android.sched.vfs.Container;
-import com.android.sched.vfs.DirectVFS;
-import com.android.sched.vfs.InputOutputVFS;
-import com.android.sched.vfs.InputVFS;
-import com.android.sched.vfs.InputZipVFS;
+import com.android.sched.vfs.DirectFS;
+import com.android.sched.vfs.ReadZipFS;
+import com.android.sched.vfs.VFS;
import java.io.File;
import java.io.IOException;
@@ -131,19 +130,17 @@ public abstract class CommonFilter {
}
@Nonnull
-
protected OutputJackLibrary getOutputJackLibraryFromVfs() {
- InputOutputVFS outputDir;
+ VFS vfs;
Container containerType = ThreadConfig.get(Options.LIBRARY_OUTPUT_CONTAINER_TYPE);
if (containerType == Container.DIR) {
- outputDir = ThreadConfig.get(Options.LIBRARY_OUTPUT_DIR);
+ vfs = ThreadConfig.get(Options.LIBRARY_OUTPUT_DIR);
} else {
- outputDir = ThreadConfig.get(Options.LIBRARY_OUTPUT_ZIP);
+ vfs = ThreadConfig.get(Options.LIBRARY_OUTPUT_ZIP);
}
- return (JackLibraryFactory.getOutputLibrary(outputDir, Jack.getEmitterId(),
- Jack.getVersionString()));
+ return (JackLibraryFactory.getOutputLibrary(vfs, Jack.getEmitterId(), Jack.getVersionString()));
}
protected List<InputLibrary> getInputLibrariesFromFiles(@Nonnull List<File> files,
@@ -152,7 +149,7 @@ public abstract class CommonFilter {
for (final File jackFile : files) {
try {
- InputVFS vDir = wrapAsVDir(jackFile);
+ VFS vDir = wrapAsVDir(jackFile);
libraries.add(JackLibraryFactory.getInputLibrary(vDir));
} catch (IOException ioException) {
if (strictMode) {
@@ -181,14 +178,14 @@ public abstract class CommonFilter {
}
@Nonnull
- protected InputVFS wrapAsVDir(@Nonnull final File dirOrZip)
+ protected VFS wrapAsVDir(@Nonnull final File dirOrZip)
throws IOException {
- final InputVFS vfs;
+ final VFS vfs;
if (dirOrZip.isDirectory()) {
- vfs = new DirectVFS(new Directory(dirOrZip.getPath(), hooks, Existence.MUST_EXIST,
- Permission.READ, ChangePermission.NOCHANGE));
+ vfs = new DirectFS(new Directory(dirOrZip.getPath(), hooks, Existence.MUST_EXIST,
+ Permission.READ, ChangePermission.NOCHANGE), Permission.READ);
} else { // zip
- vfs = new InputZipVFS(new InputZipFile(dirOrZip.getPath(), hooks, Existence.MUST_EXIST,
+ vfs = new ReadZipFS(new InputZipFile(dirOrZip.getPath(), hooks, Existence.MUST_EXIST,
ChangePermission.NOCHANGE));
}
diff --git a/jack/src/com/android/jack/incremental/IncrementalInputFilter.java b/jack/src/com/android/jack/incremental/IncrementalInputFilter.java
index c21e9f9..632a12b 100644
--- a/jack/src/com/android/jack/incremental/IncrementalInputFilter.java
+++ b/jack/src/com/android/jack/incremental/IncrementalInputFilter.java
@@ -352,8 +352,7 @@ public class IncrementalInputFilter extends CommonFilter implements InputFilter
@CheckForNull
private InputJackLibrary getIncrementalInternalLibrary() {
try {
- return JackLibraryFactory.getInputLibrary(
- ThreadConfig.get(Options.LIBRARY_OUTPUT_DIR));
+ return JackLibraryFactory.getInputLibrary(ThreadConfig.get(Options.LIBRARY_OUTPUT_DIR));
} catch (NotJackLibraryException e) {
// No incremental internal library, it is the first compilation
} catch (LibraryVersionException e) {
@@ -471,7 +470,7 @@ public class IncrementalInputFilter extends CommonFilter implements InputFilter
return getOutputJackLibraryFromVfs();
}
- return (JackLibraryFactory.getOutputLibrary(incrementalInputLibrary, Jack.getEmitterId(),
- Jack.getVersionString()));
+ return (JackLibraryFactory.getOutputLibrary(ThreadConfig.get(Options.LIBRARY_OUTPUT_DIR),
+ Jack.getEmitterId(), Jack.getVersionString()));
}
}
diff --git a/jack/src/com/android/jack/incremental/IncrementalLogWriter.java b/jack/src/com/android/jack/incremental/IncrementalLogWriter.java
index 7535223..a9befe8 100644
--- a/jack/src/com/android/jack/incremental/IncrementalLogWriter.java
+++ b/jack/src/com/android/jack/incremental/IncrementalLogWriter.java
@@ -25,7 +25,6 @@ import com.android.jack.library.FileTypeDoesNotExistException;
import com.android.jack.library.LibraryIOException;
import com.android.jack.library.OutputJackLibrary;
import com.android.sched.util.file.CannotCreateFileException;
-import com.android.sched.util.file.NotFileOrDirectoryException;
import com.android.sched.vfs.VPath;
import java.io.File;
@@ -61,8 +60,6 @@ class IncrementalLogWriter {
library.createFile(FileType.LOG, vpath);
} catch (CannotCreateFileException e1) {
throw new LibraryIOException(library.getLocation(), e1);
- } catch (NotFileOrDirectoryException e1) {
- throw new LibraryIOException(library.getLocation(), e1);
}
}
diff --git a/jack/src/com/android/jack/library/InputJackLibrary.java b/jack/src/com/android/jack/library/InputJackLibrary.java
index 1d28881..e00605c 100644
--- a/jack/src/com/android/jack/library/InputJackLibrary.java
+++ b/jack/src/com/android/jack/library/InputJackLibrary.java
@@ -17,7 +17,6 @@
package com.android.jack.library;
import com.android.jack.Jack;
-import com.android.sched.vfs.InputVFS;
import java.util.Properties;
import java.util.logging.Level;
@@ -31,12 +30,8 @@ import javax.annotation.Nonnull;
*/
public abstract class InputJackLibrary extends CommonJackLibrary implements InputLibrary {
- @Nonnull
- protected final InputVFS baseVFS;
-
- public InputJackLibrary(@Nonnull InputVFS baseVFS, @Nonnull Properties libraryProperties) {
+ public InputJackLibrary(@Nonnull Properties libraryProperties) {
super(libraryProperties);
- this.baseVFS = baseVFS;
}
protected void check() throws LibraryVersionException, LibraryFormatException {
diff --git a/jack/src/com/android/jack/library/InputJackLibraryCodec.java b/jack/src/com/android/jack/library/InputJackLibraryCodec.java
index 59e72d5..04ddfc0 100644
--- a/jack/src/com/android/jack/library/InputJackLibraryCodec.java
+++ b/jack/src/com/android/jack/library/InputJackLibraryCodec.java
@@ -18,11 +18,11 @@ package com.android.jack.library;
import com.android.jack.LibraryException;
import com.android.sched.util.codec.CodecContext;
-import com.android.sched.util.codec.InputVDirCodec;
+import com.android.sched.util.codec.DirectFSCodec;
import com.android.sched.util.codec.ParsingException;
import com.android.sched.util.codec.StringCodec;
import com.android.sched.util.config.ConfigurationError;
-import com.android.sched.vfs.InputVFS;
+import com.android.sched.vfs.VFS;
import java.util.Collections;
import java.util.List;
@@ -35,10 +35,10 @@ import javax.annotation.Nonnull;
*/
public class InputJackLibraryCodec implements StringCodec<InputJackLibrary> {
@Nonnull
- private final InputVDirCodec codec;
+ private final DirectFSCodec codec;
public InputJackLibraryCodec() {
- codec = new InputVDirCodec();
+ codec = new DirectFSCodec();
}
@Override
@@ -55,7 +55,7 @@ public class InputJackLibraryCodec implements StringCodec<InputJackLibrary> {
@CheckForNull
public InputJackLibrary checkString(@Nonnull CodecContext context, @Nonnull String string)
throws ParsingException {
- InputVFS vfs = codec.checkString(context, string);
+ VFS vfs = codec.checkString(context, string);
try {
return JackLibraryFactory.getInputLibrary(vfs);
diff --git a/jack/src/com/android/jack/library/JackLibraryFactory.java b/jack/src/com/android/jack/library/JackLibraryFactory.java
index 126999e..2a32606 100644
--- a/jack/src/com/android/jack/library/JackLibraryFactory.java
+++ b/jack/src/com/android/jack/library/JackLibraryFactory.java
@@ -21,9 +21,10 @@ import com.android.sched.util.config.HasKeyId;
import com.android.sched.util.config.id.BooleanPropertyId;
import com.android.sched.util.config.id.MessageDigestPropertyId;
import com.android.sched.util.log.LoggerFactory;
-import com.android.sched.vfs.InputOutputVFS;
+import com.android.sched.vfs.GenericInputVFS;
import com.android.sched.vfs.InputVFS;
import com.android.sched.vfs.InputVFile;
+import com.android.sched.vfs.VFS;
import java.io.IOException;
import java.lang.reflect.Constructor;
@@ -63,31 +64,26 @@ public abstract class JackLibraryFactory {
}
@Nonnull
- public static InputJackLibrary getInputLibrary(@Nonnull InputVFS vdir)
+ public static InputJackLibrary getInputLibrary(@Nonnull VFS vdir)
throws LibraryVersionException, LibraryFormatException, NotJackLibraryException {
- Properties libraryProperties = loadLibraryProperties(vdir);
- String majorVersion = getMajorVersionAsString(vdir, libraryProperties);
+ GenericInputVFS giVFS = new GenericInputVFS(vdir);
+ Properties libraryProperties = loadLibraryProperties(giVFS);
+ String majorVersion = getMajorVersionAsString(giVFS, libraryProperties);
InputJackLibrary inputJackLibrary = (InputJackLibrary) instantiateConstructorWithParameters(
vdir, "com.android.jack.library.v" + majorVersion + ".InputJackLibraryImpl",
- new Class[] {InputVFS.class, Properties.class}, new Object[] {vdir, libraryProperties},
+ new Class[] {VFS.class, Properties.class}, new Object[] {vdir, libraryProperties},
String.valueOf(majorVersion));
return inputJackLibrary;
}
@Nonnull
- public static OutputJackLibrary getOutputLibrary(@Nonnull InputOutputVFS vfs,
+ public static OutputJackLibrary getOutputLibrary(@Nonnull VFS vfs,
@Nonnull String emitterId, @Nonnull String emitterVersion) {
return new OutputJackLibraryImpl(vfs, emitterId, emitterVersion);
}
- @Nonnull
- public static OutputJackLibrary getOutputLibrary(@Nonnull InputJackLibrary inputLibrary,
- @Nonnull String emitterId, @Nonnull String emitterVersion) {
- return new OutputJackLibraryImpl(inputLibrary, emitterId, emitterVersion);
- }
-
private static String getMajorVersionAsString(@Nonnull InputVFS vdir,
@Nonnull Properties libraryProperties) throws LibraryFormatException {
try {
@@ -117,7 +113,7 @@ public abstract class JackLibraryFactory {
}
@Nonnull
- private static Object instantiateConstructorWithParameters(@Nonnull InputVFS vdir,
+ private static Object instantiateConstructorWithParameters(@Nonnull VFS vdir,
@Nonnull String className, @Nonnull Class<?>[] parameterTypes,
@Nonnull Object[] parameterInstances, @Nonnull String version)
throws LibraryVersionException, LibraryFormatException {
diff --git a/jack/src/com/android/jack/library/OutputJackLibrary.java b/jack/src/com/android/jack/library/OutputJackLibrary.java
index 1205d22..b21cd63 100644
--- a/jack/src/com/android/jack/library/OutputJackLibrary.java
+++ b/jack/src/com/android/jack/library/OutputJackLibrary.java
@@ -16,8 +16,6 @@
package com.android.jack.library;
-import com.android.sched.vfs.InputOutputVFS;
-
import java.util.Properties;
import javax.annotation.Nonnull;
@@ -28,21 +26,15 @@ import javax.annotation.Nonnull;
*/
public abstract class OutputJackLibrary extends CommonJackLibrary implements OutputLibrary {
- @Nonnull
- protected final InputOutputVFS baseVFS;
-
public OutputJackLibrary(@Nonnull InputJackLibrary inputJackLibrary, @Nonnull String emitterId,
@Nonnull String emitterVersion) {
super(inputJackLibrary.libraryProperties);
setEmitter(emitterId, emitterVersion);
- this.baseVFS = (InputOutputVFS) inputJackLibrary.baseVFS;
}
- public OutputJackLibrary(@Nonnull InputOutputVFS baseVFS, @Nonnull String emitterId,
- @Nonnull String emitterVersion) {
+ public OutputJackLibrary(@Nonnull String emitterId, @Nonnull String emitterVersion) {
super(new Properties());
setEmitter(emitterId, emitterVersion);
- this.baseVFS = baseVFS;
}
private void setEmitter(String emitterId, String emitterVersion) {
diff --git a/jack/src/com/android/jack/library/OutputJackLibraryCodec.java b/jack/src/com/android/jack/library/OutputJackLibraryCodec.java
index 4d7c489..2bb0cb5 100644
--- a/jack/src/com/android/jack/library/OutputJackLibraryCodec.java
+++ b/jack/src/com/android/jack/library/OutputJackLibraryCodec.java
@@ -20,10 +20,10 @@ import com.android.jack.Jack;
import com.android.sched.util.codec.CodecContext;
import com.android.sched.util.codec.ParsingException;
import com.android.sched.util.codec.StringCodec;
-import com.android.sched.util.codec.ZipInputOutputVDirCodec;
+import com.android.sched.util.codec.ZipFSCodec;
import com.android.sched.util.config.ConfigurationError;
import com.android.sched.util.file.FileOrDirectory.Existence;
-import com.android.sched.vfs.InputOutputVFS;
+import com.android.sched.vfs.VFS;
import java.util.Collections;
import java.util.List;
@@ -36,10 +36,10 @@ import javax.annotation.Nonnull;
*/
public class OutputJackLibraryCodec implements StringCodec<OutputJackLibrary> {
@Nonnull
- private final ZipInputOutputVDirCodec codec;
+ private final ZipFSCodec codec;
public OutputJackLibraryCodec() {
- codec = new ZipInputOutputVDirCodec(Existence.MAY_EXIST);
+ codec = new ZipFSCodec(Existence.MAY_EXIST);
}
@Override
@@ -56,8 +56,7 @@ public class OutputJackLibraryCodec implements StringCodec<OutputJackLibrary> {
@CheckForNull
public OutputJackLibrary checkString(@Nonnull CodecContext context, @Nonnull String string)
throws ParsingException {
- InputOutputVFS vfs = codec.checkString(context, string);
-
+ VFS vfs = codec.checkString(context, string);
return JackLibraryFactory.getOutputLibrary(vfs, Jack.getEmitterId(), Jack.getVersionString());
}
diff --git a/jack/src/com/android/jack/library/OutputLibrary.java b/jack/src/com/android/jack/library/OutputLibrary.java
index ee250dd..1e54346 100644
--- a/jack/src/com/android/jack/library/OutputLibrary.java
+++ b/jack/src/com/android/jack/library/OutputLibrary.java
@@ -18,7 +18,6 @@ package com.android.jack.library;
import com.android.sched.util.file.CannotCreateFileException;
import com.android.sched.util.file.CannotDeleteFileException;
-import com.android.sched.util.file.NotFileOrDirectoryException;
import com.android.sched.vfs.InputVFile;
import com.android.sched.vfs.OutputVFile;
import com.android.sched.vfs.VPath;
@@ -35,7 +34,7 @@ public interface OutputLibrary extends Library {
public boolean needsSequentialWriting();
public OutputVFile createFile(@Nonnull FileType fileType, @Nonnull VPath typePath)
- throws CannotCreateFileException, NotFileOrDirectoryException;
+ throws CannotCreateFileException;
@Override
@Nonnull
diff --git a/jack/src/com/android/jack/library/v0000/InputJackLibraryImpl.java b/jack/src/com/android/jack/library/v0000/InputJackLibraryImpl.java
index 69d28c9..317faf5 100644
--- a/jack/src/com/android/jack/library/v0000/InputJackLibraryImpl.java
+++ b/jack/src/com/android/jack/library/v0000/InputJackLibraryImpl.java
@@ -32,9 +32,11 @@ import com.android.sched.util.file.NotDirectoryException;
import com.android.sched.util.file.NotFileOrDirectoryException;
import com.android.sched.util.location.Location;
import com.android.sched.util.log.LoggerFactory;
+import com.android.sched.vfs.GenericInputVFS;
import com.android.sched.vfs.InputVDir;
import com.android.sched.vfs.InputVFS;
import com.android.sched.vfs.InputVFile;
+import com.android.sched.vfs.VFS;
import com.android.sched.vfs.VPath;
import java.io.IOException;
@@ -60,6 +62,9 @@ public class InputJackLibraryImpl extends InputJackLibrary {
private final int minorVersion;
@Nonnull
+ protected final InputVFS inputVFS;
+
+ @Nonnull
private final InputLibraryLocation location = new InputLibraryLocation() {
@Override
@Nonnull
@@ -75,14 +80,15 @@ public class InputJackLibraryImpl extends InputJackLibrary {
@Override
protected Location getVFSLocation() {
- return baseVFS.getLocation();
+ return inputVFS.getLocation();
}
};
- public InputJackLibraryImpl(@Nonnull InputVFS libraryVDir,
+ public InputJackLibraryImpl(@Nonnull VFS vfs,
@Nonnull Properties libraryProperties) throws LibraryVersionException,
LibraryFormatException {
- super(libraryVDir, libraryProperties);
+ super(libraryProperties);
+ inputVFS = new GenericInputVFS(vfs);
try {
minorVersion = Integer.parseInt(getProperty(KEY_LIB_MINOR_VERSION));
@@ -105,7 +111,7 @@ public class InputJackLibraryImpl extends InputJackLibrary {
@Override
public void close() throws LibraryIOException {
try {
- baseVFS.close();
+ inputVFS.close();
} catch (IOException e) {
throw new LibraryIOException(getLocation(), e);
}
@@ -118,7 +124,7 @@ public class InputJackLibraryImpl extends InputJackLibrary {
try {
VPath clonedPath = typePath.clone();
clonedPath.addSuffix(fileType.getFileExtension());
- return baseVFS.getRootInputVDir().getInputVFile(clonedPath);
+ return inputVFS.getRootInputVDir().getInputVFile(clonedPath);
} catch (NotFileOrDirectoryException e) {
throw new FileTypeDoesNotExistException(getLocation(), typePath, fileType);
} catch (NoSuchFileException e) {
@@ -131,7 +137,7 @@ public class InputJackLibraryImpl extends InputJackLibrary {
public InputVDir getDir(@Nonnull FileType fileType, @Nonnull VPath typePath)
throws FileTypeDoesNotExistException {
try {
- return baseVFS.getRootInputVDir().getInputVDir(typePath);
+ return inputVFS.getRootInputVDir().getInputVDir(typePath);
} catch (NotDirectoryException e) {
throw new FileTypeDoesNotExistException(getLocation(), typePath, fileType);
} catch (NoSuchFileException e) {
@@ -147,7 +153,7 @@ public class InputJackLibraryImpl extends InputJackLibrary {
}
List<InputVFile> inputVFiles = new ArrayList<InputVFile>();
- fillFiles(baseVFS.getRootInputVDir(), fileType, inputVFiles);
+ fillFiles(inputVFS.getRootInputVDir(), fileType, inputVFiles);
return inputVFiles.iterator();
}
@@ -180,7 +186,7 @@ public class InputJackLibraryImpl extends InputJackLibrary {
public void delete(@Nonnull FileType fileType, @Nonnull VPath typePath)
throws CannotDeleteFileException, FileTypeDoesNotExistException {
try {
- baseVFS.getRootInputVDir().delete(fileType.buildFileVPath(typePath));
+ inputVFS.getRootInputVDir().delete(fileType.buildFileVPath(typePath));
} catch (NotFileOrDirectoryException e) {
throw new FileTypeDoesNotExistException(getLocation(), typePath, fileType);
} catch (NoSuchFileException e) {
@@ -191,7 +197,7 @@ public class InputJackLibraryImpl extends InputJackLibrary {
@Override
@Nonnull
public String getPath() {
- return baseVFS.getPath();
+ return inputVFS.getPath();
}
@Override
diff --git a/jack/src/com/android/jack/library/v0001/InputJackLibraryImpl.java b/jack/src/com/android/jack/library/v0001/InputJackLibraryImpl.java
index 2b71e84..6df3cb0 100644
--- a/jack/src/com/android/jack/library/v0001/InputJackLibraryImpl.java
+++ b/jack/src/com/android/jack/library/v0001/InputJackLibraryImpl.java
@@ -23,21 +23,27 @@ import com.android.jack.library.FileTypeDoesNotExistException;
import com.android.jack.library.InputJackLibrary;
import com.android.jack.library.InputLibrary;
import com.android.jack.library.InputLibraryLocation;
+import com.android.jack.library.JackLibraryFactory;
import com.android.jack.library.LibraryFormatException;
import com.android.jack.library.LibraryIOException;
import com.android.jack.library.LibraryVersionException;
+import com.android.sched.util.config.ThreadConfig;
+import com.android.sched.util.file.CannotCreateFileException;
import com.android.sched.util.file.CannotDeleteFileException;
import com.android.sched.util.file.NoSuchFileException;
import com.android.sched.util.file.NotDirectoryException;
import com.android.sched.util.file.NotFileOrDirectoryException;
import com.android.sched.util.location.Location;
import com.android.sched.util.log.LoggerFactory;
+import com.android.sched.vfs.GenericInputVFS;
import com.android.sched.vfs.InputVDir;
import com.android.sched.vfs.InputVFS;
import com.android.sched.vfs.InputVFile;
-import com.android.sched.vfs.MessageDigestInputVFS;
-import com.android.sched.vfs.PrefixedInputVFS;
+import com.android.sched.vfs.MessageDigestFS;
+import com.android.sched.vfs.PrefixedFS;
+import com.android.sched.vfs.VFS;
import com.android.sched.vfs.VPath;
+import com.android.sched.vfs.WrongVFSFormatException;
import java.io.IOException;
import java.util.ArrayList;
@@ -68,6 +74,9 @@ public class InputJackLibraryImpl extends InputJackLibrary {
private final int minorVersion;
@Nonnull
+ private final VFS vfs;
+
+ @Nonnull
private final InputLibraryLocation location = new InputLibraryLocation() {
@Override
@Nonnull
@@ -83,14 +92,15 @@ public class InputJackLibraryImpl extends InputJackLibrary {
@Override
protected Location getVFSLocation() {
- return baseVFS.getLocation();
+ return vfs.getLocation();
}
};
- public InputJackLibraryImpl(@Nonnull InputVFS baseVFS,
+ public InputJackLibraryImpl(@Nonnull VFS vfs,
@Nonnull Properties libraryProperties) throws LibraryVersionException,
LibraryFormatException {
- super(baseVFS, libraryProperties);
+ super(libraryProperties);
+ this.vfs = vfs;
try {
minorVersion = Integer.parseInt(getProperty(KEY_LIB_MINOR_VERSION));
@@ -148,32 +158,36 @@ public class InputJackLibraryImpl extends InputJackLibrary {
}
List<InputVFile> inputVFiles = new ArrayList<InputVFile>();
- try {
- InputVFS currentSectionVFS = getSectionVFS(fileType);
- fillFiles(currentSectionVFS.getRootInputVDir(), fileType, inputVFiles);
- } catch (NotDirectoryException e) {
- throw new AssertionError(
- getLocation().getDescription() + " is an invalid library: " + e.getMessage());
- } catch (NoSuchFileException e) {
- throw new AssertionError(
- getLocation().getDescription() + " is an invalid library: " + e.getMessage());
- }
+ fillFiles(getSectionVFS(fileType).getRootInputVDir(), fileType, inputVFiles);
return inputVFiles.listIterator();
}
@Nonnull
- private synchronized InputVFS getSectionVFS(@Nonnull FileType fileType)
- throws NotDirectoryException, NoSuchFileException {
- InputVFS currentSectionVFS;
+ private synchronized InputVFS getSectionVFS(@Nonnull FileType fileType) {
+ InputVFS currentSectionVFS;
if (sectionVFS.containsKey(fileType)) {
currentSectionVFS = sectionVFS.get(fileType);
} else {
- InputVFS prefixedInputVFS =
- new PrefixedInputVFS(baseVFS, new VPath(fileType.getPrefix(), '/'));
+ VFS prefixedInputVFS = null;
+ try {
+ prefixedInputVFS = new PrefixedFS(vfs, new VPath(fileType.getPrefix(), '/'));
+ } catch (CannotCreateFileException e) {
+ // If library is well formed this exception can not be triggered
+ throw new AssertionError(e);
+ } catch (NotDirectoryException e) {
+ // If library is well formed this exception can not be triggered
+ throw new AssertionError(e);
+ }
if (fileType == FileType.DEX) {
- currentSectionVFS = new MessageDigestInputVFS(prefixedInputVFS);
+ try {
+ currentSectionVFS = new GenericInputVFS(new MessageDigestFS(prefixedInputVFS,
+ ThreadConfig.get(JackLibraryFactory.MESSAGE_DIGEST_ALGO)));
+ } catch (WrongVFSFormatException e) {
+ // If library is well formed this exception can not be triggered
+ throw new AssertionError(e);
+ }
} else {
- currentSectionVFS = prefixedInputVFS;
+ currentSectionVFS = new GenericInputVFS(prefixedInputVFS);
}
sectionVFS.put(fileType, currentSectionVFS);
}
@@ -186,7 +200,7 @@ public class InputJackLibraryImpl extends InputJackLibrary {
for (InputVFS currentSectionVFS : sectionVFS.values()) {
currentSectionVFS.close();
}
- baseVFS.close();
+ vfs.close();
} catch (IOException e) {
throw new LibraryIOException(getLocation(), e);
}
@@ -233,7 +247,7 @@ public class InputJackLibraryImpl extends InputJackLibrary {
@Override
@Nonnull
public String getPath() {
- return baseVFS.getPath();
+ return vfs.getPath();
}
@Nonnull
@@ -249,15 +263,8 @@ public class InputJackLibraryImpl extends InputJackLibrary {
if (!containsFileType(FileType.DEX)) {
return null;
} else {
- try {
- return ((MessageDigestInputVFS) getSectionVFS(FileType.DEX)).getDigest();
- } catch (NotDirectoryException e) {
- // we already checked that the library contained dex files
- throw new AssertionError(e);
- } catch (NoSuchFileException e) {
- // we already checked that the library contained dex files
- throw new AssertionError(e);
- }
+ return getSectionVFS(FileType.DEX).getDigest();
+
}
}
}
diff --git a/jack/src/com/android/jack/library/v0001/OutputJackLibraryImpl.java b/jack/src/com/android/jack/library/v0001/OutputJackLibraryImpl.java
index 268e96c..ad2dd7f 100644
--- a/jack/src/com/android/jack/library/v0001/OutputJackLibraryImpl.java
+++ b/jack/src/com/android/jack/library/v0001/OutputJackLibraryImpl.java
@@ -20,7 +20,6 @@ import com.google.common.collect.Iterators;
import com.android.jack.library.FileType;
import com.android.jack.library.FileTypeDoesNotExistException;
-import com.android.jack.library.InputJackLibrary;
import com.android.jack.library.JackLibraryFactory;
import com.android.jack.library.LibraryIOException;
import com.android.jack.library.OutputJackLibrary;
@@ -33,15 +32,16 @@ import com.android.sched.util.file.NoSuchFileException;
import com.android.sched.util.file.NotDirectoryException;
import com.android.sched.util.file.NotFileOrDirectoryException;
import com.android.sched.util.location.Location;
+import com.android.sched.vfs.GenericInputOutputVFS;
+import com.android.sched.vfs.GenericOutputVFS;
import com.android.sched.vfs.InputOutputVFS;
-import com.android.sched.vfs.InputVFS;
import com.android.sched.vfs.InputVFile;
-import com.android.sched.vfs.MessageDigestOutputVFS;
-import com.android.sched.vfs.OutputVFS;
+import com.android.sched.vfs.MessageDigestFS;
import com.android.sched.vfs.OutputVFile;
-import com.android.sched.vfs.PrefixedInputVFS;
-import com.android.sched.vfs.PrefixedOutputVFS;
+import com.android.sched.vfs.PrefixedFS;
+import com.android.sched.vfs.VFS;
import com.android.sched.vfs.VPath;
+import com.android.sched.vfs.WrongVFSFormatException;
import java.io.IOException;
import java.io.OutputStream;
@@ -60,13 +60,16 @@ public class OutputJackLibraryImpl extends OutputJackLibrary {
private boolean closed = false;
+ @Nonnull
+ private final VFS vfs;
+
private final boolean generateJacklibDigest =
ThreadConfig.get(JackLibraryFactory.GENERATE_JACKLIB_DIGEST).booleanValue();
@Nonnull
- private final Map<FileType, VFSPair> sectionVFS =
- new EnumMap<FileType, VFSPair>(FileType.class);
+ private final Map<FileType, InputOutputVFS> sectionVFS =
+ new EnumMap<FileType, InputOutputVFS>(FileType.class);
@Nonnull
private final OutputLibraryLocation location = new OutputLibraryLocation() {
@@ -84,34 +87,30 @@ public class OutputJackLibraryImpl extends OutputJackLibrary {
@Override
protected Location getVFSLocation() {
- return baseVFS.getLocation();
+ return vfs.getLocation();
}
};
- public OutputJackLibraryImpl(@Nonnull InputOutputVFS baseVFS, @Nonnull String emitterId,
+ public OutputJackLibraryImpl(@Nonnull VFS vfs, @Nonnull String emitterId,
@Nonnull String emitterVersion) {
- super(baseVFS, emitterId, emitterVersion);
- }
-
- public OutputJackLibraryImpl(@Nonnull InputJackLibrary inputJackLibrary,
- @Nonnull String emitterId, @Nonnull String emitterVersion) {
- super(inputJackLibrary, emitterId, emitterVersion);
+ super(emitterId, emitterVersion);
+ this.vfs = vfs;
}
@Override
@Nonnull
public OutputVFile createFile(@Nonnull FileType fileType, @Nonnull final VPath typePath)
- throws CannotCreateFileException, NotFileOrDirectoryException {
+ throws CannotCreateFileException {
assert !isClosed();
- putProperty(fileType.buildPropertyName(null /*suffix*/), String.valueOf(true));
+ putProperty(fileType.buildPropertyName(null /* suffix */), String.valueOf(true));
addFileType(fileType);
- return getSectionVFS(fileType).getOutputVFS().getRootOutputVDir()
+ return getSectionVFS(fileType).getRootOutputVDir()
.createOutputVFile(buildFileVPath(fileType, typePath));
}
@Override
public boolean needsSequentialWriting() {
- return baseVFS.needsSequentialWriting();
+ return vfs.needsSequentialWriting();
}
@Override
@@ -120,28 +119,31 @@ public class OutputJackLibraryImpl extends OutputJackLibrary {
return location;
}
- @SuppressWarnings("resource")
@Nonnull
- private synchronized VFSPair getSectionVFS(@Nonnull FileType fileType)
- throws NotDirectoryException, CannotCreateFileException {
- VFSPair currentSectionVFS;
+ private synchronized InputOutputVFS getSectionVFS(@Nonnull FileType fileType)
+ throws CannotCreateFileException {
+ InputOutputVFS currentSectionVFS;
if (sectionVFS.containsKey(fileType)) {
currentSectionVFS = sectionVFS.get(fileType);
} else {
VPath prefixPath = new VPath(fileType.getPrefix(), '/');
- OutputVFS outputVFS = new PrefixedOutputVFS(baseVFS, prefixPath);
- InputVFS inputVFS;
+ VFS outputVFS = null;
try {
- inputVFS = new PrefixedInputVFS(baseVFS, prefixPath);
- } catch (NoSuchFileException e) {
- // prefix dir should have been created when instantiating the PrefixedOutputVFS.
+ outputVFS = new PrefixedFS(vfs, prefixPath);
+
+ if (generateJacklibDigest && fileType == FileType.DEX) {
+
+ outputVFS = new MessageDigestFS(outputVFS,
+ ThreadConfig.get(JackLibraryFactory.MESSAGE_DIGEST_ALGO));
+ }
+ } catch (WrongVFSFormatException e) {
+ // if library is well formed and digest exists this exception can not be triggered
+ throw new AssertionError(e);
+ } catch (NotDirectoryException e) {
+ // if library is well formed this exception can not be triggered
throw new AssertionError(e);
}
- if (generateJacklibDigest && fileType == FileType.DEX) {
- outputVFS = new MessageDigestOutputVFS(outputVFS,
- ThreadConfig.get(JackLibraryFactory.MESSAGE_DIGEST_ALGO));
- }
- currentSectionVFS = new VFSPair(inputVFS, outputVFS);
+ currentSectionVFS = new GenericInputOutputVFS(outputVFS);
sectionVFS.put(fileType, currentSectionVFS);
}
return currentSectionVFS;
@@ -151,34 +153,38 @@ public class OutputJackLibraryImpl extends OutputJackLibrary {
public synchronized void close() throws LibraryIOException {
if (!closed) {
OutputStream os = null;
+ GenericOutputVFS goVFS = null;
try {
+ goVFS = new GenericOutputVFS(vfs);
OutputVFile libraryPropertiesOut =
- baseVFS.getRootInputOutputVDir().createOutputVFile(LIBRARY_PROPERTIES_VPATH);
+ goVFS.getRootOutputVDir().createOutputVFile(LIBRARY_PROPERTIES_VPATH);
os = libraryPropertiesOut.openWrite();
libraryProperties.store(os, "Library properties");
+ try {
+ for (InputOutputVFS intputOutputVFS : sectionVFS.values()) {
+ intputOutputVFS.close();
+ }
+ } catch (IOException e) {
+ throw new LibraryIOException(getLocation(), e);
+ }
} catch (CannotCreateFileException e) {
throw new LibraryIOException(getLocation(), e);
} catch (IOException e) {
throw new LibraryIOException(getLocation(), e);
} finally {
- if (os != null) {
- try {
+ try {
+ if (goVFS != null) {
+ goVFS.close();
+ }
+ if (os != null) {
os.close();
- } catch (IOException e) {
- throw new LibraryIOException(getLocation(), e);
}
+ } catch (IOException e) {
+ throw new LibraryIOException(getLocation(), e);
}
}
- try {
- for (VFSPair currentSectionVFS : sectionVFS.values()) {
- currentSectionVFS.getInputVFS().close();
- currentSectionVFS.getOutputVFS().close();
- }
- baseVFS.close();
- } catch (IOException e) {
- throw new LibraryIOException(getLocation(), e);
- }
+
closed = true;
}
}
@@ -202,11 +208,7 @@ public class OutputJackLibraryImpl extends OutputJackLibrary {
List<InputVFile> inputVFiles = new ArrayList<InputVFile>();
try {
- VFSPair currentSectionVFS = getSectionVFS(fileType);
- fillFiles(currentSectionVFS.getInputVFS().getRootInputVDir(), fileType, inputVFiles);
- } catch (NotDirectoryException e) {
- // we already checked that the library contained the file type
- throw new AssertionError(e);
+ fillFiles(getSectionVFS(fileType).getRootInputVDir(), fileType, inputVFiles);
} catch (CannotCreateFileException e) {
// we already checked that the library contained the file type
throw new AssertionError(e);
@@ -219,9 +221,8 @@ public class OutputJackLibraryImpl extends OutputJackLibrary {
public InputVFile getFile(@Nonnull FileType fileType, @Nonnull VPath typePath)
throws FileTypeDoesNotExistException {
try {
- VFSPair currentSectionVFS = getSectionVFS(fileType);
- return currentSectionVFS.getInputVFS().getRootInputVDir().getInputVFile(
- buildFileVPath(fileType, typePath));
+ return getSectionVFS(fileType).getRootInputVDir()
+ .getInputVFile(buildFileVPath(fileType, typePath));
} catch (NotFileOrDirectoryException e) {
throw new FileTypeDoesNotExistException(getLocation(), typePath, fileType);
} catch (NoSuchFileException e) {
@@ -237,8 +238,7 @@ public class OutputJackLibraryImpl extends OutputJackLibrary {
throws CannotDeleteFileException, FileTypeDoesNotExistException {
assert !isClosed();
try {
- VFSPair currentSectionVFS = getSectionVFS(fileType);
- currentSectionVFS.getInputVFS().getRootInputVDir().delete(buildFileVPath(fileType, typePath));
+ getSectionVFS(fileType).getRootInputVDir().delete(buildFileVPath(fileType, typePath));
} catch (NotFileOrDirectoryException e) {
throw new FileTypeDoesNotExistException(getLocation(), typePath, fileType);
} catch (CannotCreateFileException e) {
@@ -251,7 +251,7 @@ public class OutputJackLibraryImpl extends OutputJackLibrary {
@Override
@Nonnull
public String getPath() {
- return baseVFS.getPath();
+ return vfs.getPath();
}
@Nonnull
@@ -264,27 +264,4 @@ public class OutputJackLibraryImpl extends OutputJackLibrary {
private synchronized boolean isClosed() {
return closed;
}
-
- private static class VFSPair {
-
- @Nonnull
- private final InputVFS inputVFS;
- @Nonnull
- private final OutputVFS outputVFS;
-
- public VFSPair(@Nonnull InputVFS inputVFS, @Nonnull OutputVFS outputVFS) {
- this.inputVFS = inputVFS;
- this.outputVFS = outputVFS;
- }
-
- @Nonnull
- public InputVFS getInputVFS() {
- return inputVFS;
- }
-
- @Nonnull
- public OutputVFS getOutputVFS() {
- return outputVFS;
- }
- }
}
diff --git a/jack/tests/com/android/jack/TestTools.java b/jack/tests/com/android/jack/TestTools.java
index 8925dec..ac502d8 100644
--- a/jack/tests/com/android/jack/TestTools.java
+++ b/jack/tests/com/android/jack/TestTools.java
@@ -44,7 +44,7 @@ import com.android.sched.util.file.FileOrDirectory.ChangePermission;
import com.android.sched.util.file.FileOrDirectory.Existence;
import com.android.sched.util.file.FileOrDirectory.Permission;
import com.android.sched.util.file.FileUtils;
-import com.android.sched.vfs.DirectVFS;
+import com.android.sched.vfs.DirectFS;
import junit.framework.Assert;
@@ -452,10 +452,11 @@ public class TestTools {
OutputJackLibrary outputLibrary = null;
try {
- outputLibrary = JackLibraryFactory.getOutputLibrary(new DirectVFS(new Directory(
+ outputLibrary = JackLibraryFactory.getOutputLibrary(new DirectFS(new Directory(
TestTools.createTempDir("unused", "").getPath(), hooks, Existence.MUST_EXIST,
- Permission.WRITE, ChangePermission.NOCHANGE)), Jack.getEmitterId(),
- Jack.getVersionString());
+ Permission.READ | Permission.WRITE, ChangePermission.NOCHANGE),
+ Permission.READ | Permission.WRITE),
+ Jack.getEmitterId(), Jack.getVersionString());
session.setJackOutputLibrary(outputLibrary);
PlanBuilder<JSession> planBuilder = request.getPlanBuilder(JSession.class);