Skip to content

Cherrypick metadata generator #439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 27, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ If you have installed Chocolatey, you can complete these steps to set up JDK, Ap
* For iOS development
* [Latest Xcode][12]
* [Xcode command-line tools][12]
* (Optional for working with third-party libraries) [64-bit Mono][Mono] installed via Homebrew
* For Android development
* [JDK 7][JDK 7] or a later stable official release
* [Apache Ant 1.8][Apache Ant 1.8] or a later stable official release
Expand Down Expand Up @@ -530,4 +529,3 @@ This software is licensed under the Apache 2.0 license, quoted <a href="LICENSE"
[Apache Ant 1.8]: http://ant.apache.org/bindownload.cgi
[Android SDK 19]: http://developer.android.com/sdk/index.html
[Genymotion]: https://www.genymotion.com/#!/
[Mono]: http://www.mono-project.com
1 change: 0 additions & 1 deletion docs/man_pages/lib-management/library-add.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ Before adding a framework, verify that your project meets the following requirem

Before adding an iOS framework, verify that your system and the framework meets the following requirements.

* You have installed Mono using Homebrew.
* You have Xcode 6 and the iOS 8.0 SDK installed.
* The framework is a Cocoa Touch Framework with all build architectures enabled.
* If the framework relies on other third-party frameworks, make sure to add these frameworks manually as well.
Expand Down
34 changes: 0 additions & 34 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ class IOSProjectService implements IPlatformProjectService {
this.$fs.ensureDirectoryExists(targetPath).wait();
shell.cp("-R", libraryPath, targetPath);

this.generateFrameworkMetadata(platformData.projectRoot, targetPath, frameworkName, umbrellaHeader).wait();

var pbxProjPath = path.join(platformData.projectRoot, this.$projectData.projectName + ".xcodeproj", "project.pbxproj");
var project = new xcode.project(pbxProjPath);
project.parseSync();
Expand Down Expand Up @@ -257,38 +255,6 @@ class IOSProjectService implements IPlatformProjectService {
}).future<string>()();
}

private generateFrameworkMetadata(projectRoot: string, frameworkDir: string, frameworkName: string, umbrellaHeader: string): IFuture<void> {
return (() => {
if (!this.$fs.exists("/usr/local/lib/libmonoboehm-2.0.1.dylib").wait()) {
this.$errors.failWithoutHelp("NativeScript needs Mono 3.10 or newer installed in /usr/local");
}

var yamlOut = path.join(frameworkDir, "Metadata");
this.$fs.createDirectory(yamlOut).wait();

var tempHeader = path.join(yamlOut, "Metadata.h");
this.$fs.writeFile(tempHeader, util.format("#import <%s/%s>", frameworkName, umbrellaHeader)).wait();

this.$logger.info("Generating metadata for %s.framework. This can take a minute.", frameworkName);
var sdkPath = this.$childProcess.exec("xcrun -sdk iphoneos --show-sdk-path").wait().trim();
// MetadataGenerator P/Invokes libclang.dylib, so we need to instruct the Mach-O loader where to find it.
// Without this Mono will fail with a DllNotFoundException.
// Once the MetadataGenerator is rewritten in C++ and starts linking Clang statically, this will become superfluous.
var generatorExecOptions = {
env: {
DYLD_FALLBACK_LIBRARY_PATH: this.$childProcess.exec("xcode-select -p").wait().trim() + "/Toolchains/XcodeDefault.xctoolchain/usr/lib"
}
};
this.$childProcess.exec(util.format('%s/Metadata/MetadataGenerator -s %s -u %s -o %s -cflags="-F%s"', projectRoot, sdkPath, tempHeader, yamlOut, frameworkDir), generatorExecOptions).wait();

var metadataFileName = frameworkName + ".yaml";
this.$fs.copyFile(path.join(yamlOut, "Metadata-armv7", metadataFileName), path.join(projectRoot, "Metadata", "Metadata-armv7", metadataFileName)).wait();
this.$fs.copyFile(path.join(yamlOut, "Metadata-arm64", metadataFileName), path.join(projectRoot, "Metadata", "Metadata-arm64", metadataFileName)).wait();

this.$fs.deleteDirectory(yamlOut).wait();
}).future<void>()();
}

private replaceFileContent(file: string): IFuture<void> {
return (() => {
var fileContent = this.$fs.readText(file).wait();
Expand Down