Search in sources :

Example 11 with RegularInputFile

use of com.google.devtools.j2objc.file.RegularInputFile in project j2objc by google.

the class GenerationTest method preprocessFiles.

protected void preprocessFiles(String... fileNames) {
    GenerationBatch batch = new GenerationBatch(options);
    for (String fileName : fileNames) {
        batch.addSource(new RegularInputFile(tempDir.getPath() + File.separatorChar + fileName, fileName));
    }
    new InputFilePreprocessor(parser).processInputs(batch.getInputs());
}
Also used : RegularInputFile(com.google.devtools.j2objc.file.RegularInputFile) InputFilePreprocessor(com.google.devtools.j2objc.pipeline.InputFilePreprocessor) GenerationBatch(com.google.devtools.j2objc.pipeline.GenerationBatch)

Example 12 with RegularInputFile

use of com.google.devtools.j2objc.file.RegularInputFile in project j2objc by google.

the class TranslationProcessorTest method testDuplicateSourceFileOnSourcepath.

public void testDuplicateSourceFileOnSourcepath() throws IOException {
    options.setBuildClosure(true);
    // Have src/main/java precede tmp dir in source path.
    options.fileUtil().insertSourcePath(0, getTempDir() + "/src/main/java");
    options.fileUtil().appendSourcePath(getTempDir());
    addSourceFile("class Test { Foo f; }", "Test.java");
    addSourceFile("class Foo { void foo1() {} }", "Foo.java");
    addSourceFile("class Foo { void foo2() {} }", "src/main/java/Foo.java");
    GenerationBatch batch = new GenerationBatch(options);
    batch.addSource(new RegularInputFile(getTempDir() + "/Test.java", "Test.java"));
    batch.addSource(new RegularInputFile(getTempDir() + "/src/main/java/Foo.java", "Foo.java"));
    TranslationProcessor processor = new TranslationProcessor(J2ObjC.createParser(options), null);
    processor.processInputs(batch.getInputs());
    processor.processBuildClosureDependencies();
    String translation = getTranslatedFile("Foo.h");
    assertTranslation(translation, "- (void)foo2;");
    assertNotInTranslation(translation, "foo1");
}
Also used : RegularInputFile(com.google.devtools.j2objc.file.RegularInputFile)

Aggregations

RegularInputFile (com.google.devtools.j2objc.file.RegularInputFile)12 File (java.io.File)5 InputFile (com.google.devtools.j2objc.file.InputFile)4 Parser (com.google.devtools.j2objc.util.Parser)3 IOException (java.io.IOException)3 GenerationUnit (com.google.devtools.j2objc.gen.GenerationUnit)2 InputFilePreprocessor (com.google.devtools.j2objc.pipeline.InputFilePreprocessor)2 ParserEnvironment (com.google.devtools.j2objc.util.ParserEnvironment)2 TranslationEnvironment (com.google.devtools.j2objc.util.TranslationEnvironment)2 ZipFile (java.util.zip.ZipFile)2 CompilationUnit (org.eclipse.jdt.core.dom.CompilationUnit)2 JarredInputFile (com.google.devtools.j2objc.file.JarredInputFile)1 GenerationBatch (com.google.devtools.j2objc.pipeline.GenerationBatch)1 ProcessingContext (com.google.devtools.j2objc.pipeline.ProcessingContext)1 TranslationProcessor (com.google.devtools.j2objc.pipeline.TranslationProcessor)1 ProGuardUsageParser (com.google.devtools.j2objc.util.ProGuardUsageParser)1 ArrayList (java.util.ArrayList)1 ZipEntry (java.util.zip.ZipEntry)1 ZipException (java.util.zip.ZipException)1 ASTParser (org.eclipse.jdt.core.dom.ASTParser)1