Search in sources :

Example 1 with RelativeFile

use of org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile in project ceylon by eclipse.

the class JavacFileManager method getFileForInput.

public FileObject getFileForInput(Location location, String packageName, String relativeName) throws IOException {
    nullCheck(location);
    // validatePackageName(packageName);
    nullCheck(packageName);
    if (!isRelativeUri(relativeName))
        throw new IllegalArgumentException("Invalid relative name: " + relativeName);
    RelativeFile name = packageName.length() == 0 ? new RelativeFile(relativeName) : new RelativeFile(RelativeDirectory.forPackage(packageName), relativeName);
    return getFileForInput(location, name);
}
Also used : RelativeFile(org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile)

Example 2 with RelativeFile

use of org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile in project ceylon by eclipse.

the class JavacFileManager method getFileForOutput.

public FileObject getFileForOutput(Location location, String packageName, String relativeName, FileObject sibling) throws IOException {
    nullCheck(location);
    // validatePackageName(packageName);
    nullCheck(packageName);
    if (!isRelativeUri(relativeName))
        throw new IllegalArgumentException("Invalid relative name: " + relativeName);
    RelativeFile name = packageName.length() == 0 ? new RelativeFile(relativeName) : new RelativeFile(RelativeDirectory.forPackage(packageName), relativeName);
    return getFileForOutput(location, name, sibling);
}
Also used : RelativeFile(org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile)

Example 3 with RelativeFile

use of org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile in project ceylon by eclipse.

the class ZipFileIndexArchive method getFileObject.

public JavaFileObject getFileObject(RelativeDirectory subdirectory, String file) {
    RelativeFile fullZipFileName = new RelativeFile(subdirectory, file);
    ZipFileIndex.Entry entry = zfIndex.getZipIndexEntry(fullZipFileName);
    JavaFileObject ret = new ZipFileIndexFileObject(fileManager, zfIndex, entry, zfIndex.getZipFile());
    return ret;
}
Also used : JavaFileObject(org.eclipse.ceylon.javax.tools.JavaFileObject) RelativeFile(org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile)

Example 4 with RelativeFile

use of org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile in project ceylon by eclipse.

the class JavacFileManager method getFileForOutput.

protected JavaFileObject getFileForOutput(Location location, RelativeFile fileName, FileObject sibling) throws IOException {
    File dir;
    if (location == CLASS_OUTPUT) {
        if (getClassOutDir() != null) {
            dir = getClassOutDir();
        } else {
            File siblingDir = null;
            if (sibling != null && sibling instanceof RegularFileObject) {
                siblingDir = ((RegularFileObject) sibling).file.getParentFile();
            }
            return new RegularFileObject(this, new File(siblingDir, fileName.basename()));
        }
    } else if (location == SOURCE_OUTPUT) {
        dir = (getSourceOutDir() != null ? getSourceOutDir() : getClassOutDir());
    } else {
        Iterable<? extends File> path = locations.getLocation(location);
        dir = null;
        for (File f : path) {
            dir = f;
            break;
        }
    }
    // null-safe
    File file = fileName.getFile(dir);
    return new RegularFileObject(this, file);
}
Also used : RelativeFile(org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile) ZipFile(java.util.zip.ZipFile) File(java.io.File)

Example 5 with RelativeFile

use of org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile in project ceylon by eclipse.

the class SymbolArchive method getFileObject.

@Override
public JavaFileObject getFileObject(RelativeDirectory subdirectory, String file) {
    RelativeDirectory prefix_subdir = new RelativeDirectory(prefix, subdirectory.path);
    ZipEntry ze = new RelativeFile(prefix_subdir, file).getZipEntry(zfile);
    return new SymbolFileObject(this, file, ze);
}
Also used : RelativeDirectory(org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeDirectory) RelativeFile(org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile) ZipEntry(java.util.zip.ZipEntry)

Aggregations

RelativeFile (org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeFile)5 File (java.io.File)1 ZipEntry (java.util.zip.ZipEntry)1 ZipFile (java.util.zip.ZipFile)1 JavaFileObject (org.eclipse.ceylon.javax.tools.JavaFileObject)1 RelativeDirectory (org.eclipse.ceylon.langtools.tools.javac.file.RelativePath.RelativeDirectory)1