use of com.dd.plist.NSDictionary in project bazel by bazelbuild.
the class XcodeprojGeneration method nonArcCompileSettings.
private static NSDictionary nonArcCompileSettings() {
NSDictionary result = new NSDictionary();
result.put("COMPILER_FLAGS", "-fno-objc-arc");
return result;
}
use of com.dd.plist.NSDictionary in project bazel by bazelbuild.
the class XcodeprojSerializer method serializeObject.
/**
* Serialize a {@link PBXObject} and its recursive descendants into the object dictionary.
*
* @return the GID of the serialized object
*
* @see PBXObject#serializeInto
*/
private String serializeObject(PBXObject obj) {
if (obj.getGlobalID() == null) {
obj.setGlobalID(obj.generateGid(gidGenerator));
LOG.verbose("Set new object GID: %s", obj);
} else {
// Check that the object has already been serialized.
NSObject object = objects.get(obj.getGlobalID());
if (object != null) {
LOG.verbose("Object %s found, returning existing object %s", obj, object);
return obj.getGlobalID();
} else {
LOG.verbose("Object already had GID set: %s", obj);
}
}
// Save the existing object being deserialized.
NSDictionary stack = currentObject;
currentObject = new NSDictionary();
currentObject.put("isa", obj.isa());
obj.serializeInto(this);
objects.put(obj.getGlobalID(), currentObject);
// Restore the existing object being deserialized.
currentObject = stack;
return obj.getGlobalID();
}
use of com.dd.plist.NSDictionary in project bazel by bazelbuild.
the class PBXProject method serializeInto.
@Override
public void serializeInto(XcodeprojSerializer s) {
super.serializeInto(s);
s.addField("mainGroup", mainGroup);
Collections.sort(targets, Ordering.natural().onResultOf(new Function<PBXTarget, String>() {
@Override
public String apply(PBXTarget input) {
return input.getName();
}
}));
s.addField("targets", targets);
s.addField("buildConfigurationList", buildConfigurationList);
s.addField("compatibilityVersion", compatibilityVersion);
NSDictionary d = new NSDictionary();
d.put("LastUpgradeCheck", "0610");
s.addField("attributes", d);
}
use of com.dd.plist.NSDictionary in project bazel by bazelbuild.
the class PlistMerging method from.
/**
* Generates a Plistmerging combining values from sourceFiles and immutableSourceFiles, and
* modifying them based on subsitutions and keysToRemoveIfEmptyString.
*/
public static PlistMerging from(List<Path> sourceFiles, List<Path> immutableSourceFiles, Map<String, String> substitutions, KeysToRemoveIfEmptyString keysToRemoveIfEmptyString, String executableName) throws IOException {
NSDictionary merged = PlistMerging.merge(sourceFiles);
NSDictionary immutableEntries = PlistMerging.merge(immutableSourceFiles);
Set<String> conflictingEntries = Sets.intersection(immutableEntries.keySet(), merged.keySet());
Preconditions.checkArgument(conflictingEntries.isEmpty(), "The following plist entries may not be overridden, but are present in more than one " + "of the input lists: %s", conflictingEntries);
merged.putAll(immutableEntries);
for (Map.Entry<String, NSObject> entry : merged.entrySet()) {
if (entry.getValue().toJavaObject() instanceof String) {
String newValue = substituteEnvironmentVariable(substitutions, (String) entry.getValue().toJavaObject());
merged.put(entry.getKey(), newValue);
}
}
for (String key : keysToRemoveIfEmptyString) {
if (Equaling.of(Mapping.of(merged, key), Optional.<NSObject>of(new NSString("")))) {
merged.remove(key);
}
}
// TODO(bazel-team): warn user if we replace their values.
if (!immutableEntries.isEmpty()) {
Pattern versionPattern = Pattern.compile("[^0-9.]");
if (!merged.containsKey(BUNDLE_VERSION_PLIST_KEY)) {
merged.put(BUNDLE_VERSION_PLIST_KEY, BUNDLE_VERSION_DEFAULT);
} else {
NSObject nsVersion = merged.get(BUNDLE_VERSION_PLIST_KEY);
String version = (String) nsVersion.toJavaObject();
if (version.length() > 18 || versionPattern.matcher(version).find()) {
merged.put(BUNDLE_VERSION_PLIST_KEY, BUNDLE_VERSION_DEFAULT);
}
}
if (!merged.containsKey(BUNDLE_SHORT_VERSION_STRING_PLIST_KEY)) {
merged.put(BUNDLE_SHORT_VERSION_STRING_PLIST_KEY, BUNDLE_SHORT_VERSION_STRING_DEFAULT);
} else {
NSObject nsVersion = merged.get(BUNDLE_SHORT_VERSION_STRING_PLIST_KEY);
String version = (String) nsVersion.toJavaObject();
if (version.length() > 18 || versionPattern.matcher(version).find()) {
merged.put(BUNDLE_SHORT_VERSION_STRING_PLIST_KEY, BUNDLE_SHORT_VERSION_STRING_DEFAULT);
}
}
}
PlistMerging result = new PlistMerging(merged);
if (executableName != null) {
result.setExecutableName(executableName);
}
return result;
}
use of com.dd.plist.NSDictionary in project bazel by bazelbuild.
the class CurrentVersionSetter method trySetCurrentVersion.
private void trySetCurrentVersion(XCVersionGroup group) {
if (group.getSourceTree() != SourceTree.GROUP) {
return;
}
Path groupPath = workspaceRoot.resolve(group.getPath());
Path currentVersionPlist = groupPath.resolve(".xccurrentversion");
if (!Files.isReadable(currentVersionPlist)) {
return;
}
NSDictionary plist;
try {
plist = PlistMerging.readPlistFile(currentVersionPlist);
} catch (IOException e) {
return;
}
NSString currentVersion = (NSString) plist.get("_XCCurrentVersionName");
if (currentVersion == null) {
return;
}
for (PBXFileReference child : group.getChildren()) {
child.setExplicitFileType(Optional.of("wrapper.xcdatamodel"));
if (child.getName().equals(currentVersion.getContent())) {
group.setCurrentVersion(Optional.of(child));
}
}
}
Aggregations