/** * Returns a new or cached instance of a PBXBuildFile for a file that is not part of a variant * group. */ public PBXBuildFile getStandalone(FileReference file) { for (PBXBuildFile cached : Mapping.of(standaloneBuildFiles, file).asSet()) { return cached; } PBXBuildFile buildFile = new PBXBuildFile(pbxReferences.get(file)); mainGroupReferences.add(pbxReferences.get(file)); standaloneBuildFiles.put(file, buildFile); return buildFile; }
/** * Returns a new or cached PBXFileReference for the given file. The name of the reference depends * on whether the file is in a localized (*.lproj) directory. If it is localized, then the name of * the reference is the name of the language (the text before ".lproj"). Otherwise, the name is * the same as the file name (e.g. Localizable.strings). This is confusing, but it is how Xcode * creates PBXFileReferences. */ private PBXFileReference fileReference(Path path) { Optional<String> language = Resources.languageOfLprojDir(path); String name = language.isPresent() ? language.get() : path.getFileName().toString(); return pbxReferences.get(FileReference.of(name, path.toString(), SourceTree.GROUP)); }