use of com.dd.plist.NSDictionary in project robovm by robovm.
the class Callbacks method callInstproxyCallback.
static void callInstproxyCallback(String operation, byte[] statusPlistBin, int id) throws Exception {
StatusCallback callback = null;
synchronized (Callbacks.class) {
callback = instProxyStatusCallbacks.get(id);
}
if (callback != null) {
boolean done = false;
try {
NSDictionary dict = (NSDictionary) PropertyListParser.parse(statusPlistBin);
NSObject status = dict.objectForKey("Status");
NSObject percentComplete = dict.objectForKey("PercentComplete");
NSObject error = dict.objectForKey("Error");
if (error != null) {
done = true;
callback.error(error.toString());
} else {
if ("Complete".equals(status.toString())) {
done = true;
callback.success();
} else {
callback.progress(status.toString(), ((NSNumber) percentComplete).intValue());
}
}
} catch (Throwable t) {
t.printStackTrace();
} finally {
if (done) {
synchronized (Callbacks.class) {
instProxyStatusCallbacks.remove(id);
}
}
}
}
}
use of com.dd.plist.NSDictionary in project gradle by gradle.
the class GenerateXcodeProjectFileTask method toXCTestPbxTarget.
private PBXTarget toXCTestPbxTarget(XcodeTarget xcodeTarget) {
PBXShellScriptBuildPhase hackBuildPhase = new PBXShellScriptBuildPhase();
hackBuildPhase.setShellPath("/bin/sh");
hackBuildPhase.setShellScript("# Script to generate specific Swift files Xcode expects when running tests.\n" + "set -eu\n" + "ARCH_ARRAY=($ARCHS)\n" + "SUFFIXES=(swiftdoc swiftmodule h)\n" + "for ARCH in \"${ARCH_ARRAY[@]}\"\n" + "do\n" + " for SUFFIX in \"${SUFFIXES[@]}\"\n" + " do\n" + " touch \"$OBJECT_FILE_DIR_normal/$ARCH/$PRODUCT_NAME.$SUFFIX\"\n" + " done\n" + "done");
PBXSourcesBuildPhase sourcesBuildPhase = new PBXSourcesBuildPhase();
for (File file : xcodeTarget.getSources()) {
PBXFileReference fileReference = pathToFileReference.get(file.getAbsolutePath());
sourcesBuildPhase.getFiles().add(new PBXBuildFile(fileReference));
}
PBXShellScriptBuildPhase gradleBuildPhase = new PBXShellScriptBuildPhase();
gradleBuildPhase.setShellPath("/bin/sh");
gradleBuildPhase.setShellScript("exec \"" + xcodeTarget.getGradleCommand() + "\" " + buildGradleArgs(xcodeTarget) + " < /dev/null");
PBXNativeTarget target = new PBXNativeTarget(xcodeTarget.getName(), xcodeTarget.getProductType());
target.setProductName(xcodeTarget.getProductName());
target.setGlobalID(xcodeTarget.getId());
// Note the order in which the build phase are added is important
target.getBuildPhases().add(hackBuildPhase);
target.getBuildPhases().add(sourcesBuildPhase);
target.getBuildPhases().add(gradleBuildPhase);
File outputFile = xcodeTarget.getDebugOutputFile().get().getAsFile();
target.setProductReference(new PBXFileReference(outputFile.getName(), outputFile.getAbsolutePath(), PBXReference.SourceTree.ABSOLUTE));
NSDictionary debugSettings = target.getBuildConfigurationList().getBuildConfigurationsByName().getUnchecked(BUILD_DEBUG).getBuildSettings();
NSDictionary releaseSettings = target.getBuildConfigurationList().getBuildConfigurationsByName().getUnchecked(BUILD_RELEASE).getBuildSettings();
NSDictionary testRunnerSettings = target.getBuildConfigurationList().getBuildConfigurationsByName().getUnchecked(TEST_DEBUG).getBuildSettings();
if (!xcodeTarget.getCompileModules().isEmpty()) {
debugSettings.put("SWIFT_INCLUDE_PATHS", toSpaceSeparatedList(parentDirs(xcodeTarget.getCompileModules())));
releaseSettings.put("SWIFT_INCLUDE_PATHS", toSpaceSeparatedList(parentDirs(xcodeTarget.getCompileModules())));
testRunnerSettings.put("SWIFT_INCLUDE_PATHS", toSpaceSeparatedList(parentDirs(xcodeTarget.getCompileModules())));
}
testRunnerSettings.put("SWIFT_VERSION", toXcodeSwiftVersion(xcodeTarget.getSwiftSourceCompatibility()));
testRunnerSettings.put("PRODUCT_NAME", target.getProductName());
testRunnerSettings.put("OTHER_LDFLAGS", "-help");
testRunnerSettings.put("OTHER_CFLAGS", "-help");
testRunnerSettings.put("OTHER_SWIFT_FLAGS", "-help");
testRunnerSettings.put("SWIFT_INSTALL_OBJC_HEADER", "NO");
testRunnerSettings.put("SWIFT_OBJC_INTERFACE_HEADER_NAME", "$(PRODUCT_NAME).h");
debugSettings.put("PRODUCT_NAME", target.getProductName());
debugSettings.put("SWIFT_VERSION", toXcodeSwiftVersion(xcodeTarget.getSwiftSourceCompatibility()));
releaseSettings.put("PRODUCT_NAME", target.getProductName());
releaseSettings.put("SWIFT_VERSION", toXcodeSwiftVersion(xcodeTarget.getSwiftSourceCompatibility()));
return target;
}
use of com.dd.plist.NSDictionary in project gradle by gradle.
the class GenerateXcodeProjectFileTask method configure.
@Override
protected void configure(XcodeProjectFile projectFile) {
PBXProject project = new PBXProject(getProject().getPath());
project.getBuildConfigurationList().getBuildConfigurationsByName().getUnchecked(BUILD_DEBUG);
project.getBuildConfigurationList().getBuildConfigurationsByName().getUnchecked(BUILD_RELEASE);
addToGroup(project.getMainGroup(), xcodeProject.getGroups().getSources(), "Sources");
addToGroup(project.getMainGroup(), xcodeProject.getGroups().getHeaders(), "Headers");
addToGroup(project.getMainGroup(), xcodeProject.getGroups().getTests(), "Tests");
addToGroup(project.getMainGroup(), xcodeProject.getGroups().getRoot());
for (XcodeTarget xcodeTarget : xcodeProject.getTargets()) {
project.getTargets().add(toGradlePbxTarget(xcodeTarget));
project.getTargets().add(toIndexPbxTarget(xcodeTarget));
if (xcodeTarget.isUnitTest()) {
// Creates XCTest configuration only if XCTest are present.
project.getBuildConfigurationList().getBuildConfigurationsByName().getUnchecked(TEST_DEBUG);
} else {
File debugOutputFile = xcodeTarget.getDebugOutputFile().get().getAsFile();
PBXFileReference fileReference = new PBXFileReference(debugOutputFile.getName(), debugOutputFile.getAbsolutePath(), PBXReference.SourceTree.ABSOLUTE);
fileReference.setExplicitFileType(Optional.of(xcodeTarget.getOutputFileType()));
project.getMainGroup().getOrCreateChildGroupByName(PRODUCTS_GROUP_NAME).getChildren().add(fileReference);
}
}
XcodeprojSerializer serializer = new XcodeprojSerializer(gidGenerator, project);
final NSDictionary rootObject = serializer.toPlist();
projectFile.transformAction(new Action<NSDictionary>() {
@Override
public void execute(NSDictionary dict) {
dict.clear();
dict.putAll(rootObject);
}
});
}
use of com.dd.plist.NSDictionary in project gradle by gradle.
the class XcodeprojSerializer method toPlist.
/**
* Generate a plist serialization of project bound to this serializer.
*/
public NSDictionary toPlist() {
serializeObject(rootObject);
NSDictionary root = new NSDictionary();
root.put("archiveVersion", "1");
root.put("classes", new NSDictionary());
root.put("objectVersion", "46");
root.put("objects", objects);
root.put("rootObject", rootObject.getGlobalID());
return root;
}
Aggregations