Commit 470f7973 authored by Fawzi Mohamed's avatar Fawzi Mohamed

ios: simulator support for Xcode 5.1

update iossim to be based on version 1.9.0, so that we can support
the new Xcode 5.1. Keep the old version around and use it
with older Xcode.
All the logic has been moved into iossim which does an exec of the
older binary if needed (so that creator itself remains untouched)

Task-number: QTCREATORBUG-11714
Change-Id: I4ad9f922f22367c8371b3be68eae5b6dfdf4df5c
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent e8d4349c
TEMPLATE = subdirs
mac {
SUBDIRS += iossim
SUBDIRS += \
iossim \
iossim_1_8_2
}
CONFIG += console
QT += core
QT += gui
QT -= core
QT -= gui
QT -= test
CONFIG -= app_bundle
......@@ -25,14 +26,11 @@ iPhoneSimulatorRemoteClientDirectLinking {
LIBS += \
-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks \
-F/Applications/Xcode.app/Contents/OtherFrameworks
QMAKE_LFLAGS += -Wl,-rpath,/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks \
-Wl,-rpath,/Applications/Xcode.app/Contents/OtherFrameworks \
LIBS += \
-framework iPhoneSimulatorRemoteClient
QMAKE_RPATHDIR += /Applications/Xcode5-DP5.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks \
/Applications/Xcode.app/Contents/OtherFrameworks
/System/Library/PrivateFrameworks \
-framework DTViPhoneSimulatorRemoteClient
QMAKE_RPATHDIR += /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks \
/Applications/Xcode.app/Contents/OtherFrameworks \
/System/Library/PrivateFrameworks
}
TEMPLATE = app
......@@ -52,6 +50,7 @@ HEADERS += \
nsprintf.h \
nsstringexpandpath.h \
version.h \
iphonesimulatorremoteclient/iphonesimulatorremoteclient.h
dvtiphonesimulatorremoteclient/dvtiphonesimulatorremoteclient.h
OTHER_FILES = LICENSE
OTHER_FILES = IOSSIM_LICENSE \
Info.plist
......@@ -6,7 +6,7 @@
*/
#import <Foundation/Foundation.h>
#import "iphonesimulatorremoteclient/iphonesimulatorremoteclient.h"
#import <dvtiphonesimulatorremoteclient/dvtiphonesimulatorremoteclient.h>
#import "version.h"
@interface iPhoneSimulator : NSObject <DTiPhoneSimulatorSessionDelegate> {
......@@ -14,8 +14,7 @@
DTiPhoneSimulatorSystemRoot *sdkRoot;
NSFileHandle *stdoutFileHandle;
NSFileHandle *stderrFileHandle;
DTiPhoneSimulatorSession *session;
NSTimer *pidCheckingTimer;
DTiPhoneSimulatorSession *mySession;
BOOL startOnly;
BOOL exitOnStartup;
BOOL shouldWaitDebugger;
......@@ -34,8 +33,7 @@
- (void)createStdioFIFO:(NSFileHandle **)fileHandle ofType:(NSString *)type atPath:(NSString **)path;
- (void)removeStdioFIFO:(NSFileHandle *)fileHandle atPath:(NSString *)path;
- (void)stop;
- (void)checkPid:(NSTimer *)timer;
- (void)doExit:(int)errorCode;
- (void)changeDeviceType:(NSString *)family retina:(BOOL)retina isTallDevice:(BOOL)isTallDevice;
- (NSString*)changeDeviceType:(NSString *)family retina:(BOOL)retina isTallDevice:(BOOL)isTallDevice;
@end
......@@ -5,69 +5,25 @@
* See the IOSSIM_LICENSE file in this directory for the license on the source code in this file.
*/
/* derived from https://github.com/phonegap/ios-sim */
#import <AppKit/AppKit.h>
#import "iphonesimulator.h"
#include <QLibrary>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <QApplication>
#else
#include <QGuiApplication>
#endif
#include <QString>
#include <QStringList>
#import <Foundation/NSFileManager.h>
/* to do:
* - try to stop inferior when killed (or communicate with creator to allow killing the inferior)
* - remove unneeded functionality and streamline a bit
*/
#import "iphonesimulator.h"
/*
* Runs the iPhoneSimulator backed by a main runloop.
*/
int main (int argc, char *argv[]) {
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QApplication a(argc, argv);
#else
QGuiApplication a(argc, argv);
#endif
//NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
QString xcodePath = QLatin1String("/Applications/Xcode.app/Contents/Developer/");
for (int i = 0; i + 1 < argc; ++i) {
if (strcmp(argv[i], "--developer-path") == 0)
xcodePath = QCoreApplication::arguments().at(i+1);
}
if (!xcodePath.endsWith(QLatin1Char('/')))
xcodePath.append(QLatin1Char('/'));
/* manual loading of the private deps */
QStringList deps = QStringList()
<< QLatin1String("/System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols")
<< QLatin1String("/System/Library/PrivateFrameworks/CoreSymbolication.framework/CoreSymbolication")
<< (xcodePath + QLatin1String("../OtherFrameworks/DevToolsFoundation.framework/DevToolsFoundation"));
foreach (const QString &libPath, deps) {
QLibrary *lib = new QLibrary(libPath);
//lib->setLoadHints(QLibrary::ExportExternalSymbolsHint);
if (!lib->load())
printf("<msg>error loading %s</msg>", libPath.toUtf8().constData());
}
QLibrary *libIPhoneSimulatorRemoteClient = new QLibrary(xcodePath
+ QLatin1String("Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework/iPhoneSimulatorRemoteClient"));
//libIPhoneSimulatorRemoteClient->setLoadHints(QLibrary::ResolveAllSymbolsHint|QLibrary::ExportExternalSymbolsHint);
if (!libIPhoneSimulatorRemoteClient->load())
printf("<msg>error loading iPhoneSimulatorRemoteClient</msg>");
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
iPhoneSimulator *sim = [[iPhoneSimulator alloc] init];
/* Execute command line handler */
[sim runWithArgc: argc argv: argv];
/* Run the loop to handle added input sources, if any */
[[NSRunLoop mainRunLoop] run];
int res = a.exec();
exit(res);
// [pool release];
[pool release];
return 0;
}
......@@ -24,7 +24,7 @@ int nsfprintf (FILE *stream, NSString *format, ...) {
va_start(ap, format);
{
retval = nsvfprintf(stream, format, ap);
}
}
va_end(ap);
return retval;
......@@ -37,7 +37,7 @@ int nsprintf (NSString *format, ...) {
va_start(ap, format);
{
retval = nsvfprintf(stdout, format, ap);
}
}
va_end(ap);
return retval;
......
/*
* See the IOSSIM_LICENSE file in this directory for the license on the source code in this file.
* See the LICENSE file for the license on the source code in this file.
*/
#import "nsstringexpandpath.h"
......
#define IOS_SIM_VERSION "1.8.2m"
#define IOS_SIM_VERSION "1.9.0"
Author: Landon Fuller <landonf@plausiblelabs.com>
Copyright (c) 2008-2011 Plausible Labs Cooperative, Inc.
All rights reserved.
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
Modifications made by the following entities are licensed as above:
- Jeff Haynie, Appcelerator, Inc.
- https://github.com/hborders
- http://pivotallabs.com/users/scoward/blog
- Eloy Duran, Fingertips <eloy@fngtps.com>
- Fawzi Mohamed, digia <fawzi.mohamed@digia.com>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>@TYPEINFO@</string>
<key>CFBundleExecutable</key>
<string>@EXECUTABLE@</string>
<key>CFBundleIdentifier</key>
<string>org.qt-project.qt-creator.iosTool</string>
<key>LSUIElement</key>
<string>1</string>
</dict>
</plist>
import qbs 1.0
import QtcTool
QtcTool {
name: "iossim"
condition: qbs.targetOS.contains("osx")
Depends { name: "Qt"; submodules: ["widgets"] }
Depends { name: "app_version_header" }
files: [
"main.mm",
"nsprintf.mm",
"nsstringexpandpath.mm",
"iphonesimulator.mm",
"iphonesimulator.h",
"nsprintf.h",
"nsstringexpandpath.h",
"version.h",
"iphonesimulatorremoteclient/iphonesimulatorremoteclient.h"
]
cpp.linkerFlags: base.concat(["-sectcreate", "__TEXT", "__info_plist", path + "/Info.plist",
"-fobjc-link-runtime"])
cpp.frameworks: base.concat(["Foundation", "CoreServices", "ApplicationServices", "IOKit",
"AppKit"])
cpp.frameworkPaths: base.concat("/System/Library/PrivateFrameworks")
toolInstallDir: project.ide_libexec_path + "/ios"
}
CONFIG += console
QT += core
QT += gui
CONFIG -= app_bundle
include(../../../../qtcreator.pri)
# Prevent from popping up in the dock when launched.
# We embed the Info.plist file, so the application doesn't need to
# be a bundle.
QMAKE_LFLAGS += -sectcreate __TEXT __info_plist \"$$PWD/Info.plist\" \
-fobjc-link-runtime
LIBS += \
-framework Foundation \
-framework CoreServices \
-framework ApplicationServices \
-framework CoreFoundation \
-F/System/Library/PrivateFrameworks \
-framework IOKit -framework AppKit
iPhoneSimulatorRemoteClientDirectLinking {
LIBS += \
-F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks \
-F/Applications/Xcode.app/Contents/OtherFrameworks
LIBS += \
-framework iPhoneSimulatorRemoteClient
QMAKE_RPATHDIR += /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks \
/Applications/Xcode.app/Contents/OtherFrameworks
/System/Library/PrivateFrameworks \
}
TEMPLATE = app
# put into a subdir, so we can deploy a separate qt.conf for it
DESTDIR = $$IDE_LIBEXEC_PATH/ios
include(../../../rpath.pri)
OBJECTIVE_SOURCES += \
main.mm \
nsprintf.mm \
nsstringexpandPath.mm \
iphonesimulator.mm
HEADERS += \
iphonesimulator.h \
nsprintf.h \
nsstringexpandpath.h \
version.h \
iphonesimulatorremoteclient/iphonesimulatorremoteclient.h
OTHER_FILES = IOSSIM_LICENSE \
Info.plist
/* Author: Landon Fuller <landonf@plausiblelabs.com>
* Copyright (c) 2008-2011 Plausible Labs Cooperative, Inc.
* All rights reserved.
*
* See the IOSSIM_LICENSE file in this directory for the license on the source code in this file.
*/
#import <Foundation/Foundation.h>
#import "iphonesimulatorremoteclient/iphonesimulatorremoteclient.h"
#import "version.h"
@interface iPhoneSimulator : NSObject <DTiPhoneSimulatorSessionDelegate> {
@private
DTiPhoneSimulatorSystemRoot *sdkRoot;
NSFileHandle *stdoutFileHandle;
NSFileHandle *stderrFileHandle;
DTiPhoneSimulatorSession *session;
NSTimer *pidCheckingTimer;
BOOL startOnly;
BOOL exitOnStartup;
BOOL shouldWaitDebugger;
BOOL shouldStartDebugger;
BOOL useGDB;
BOOL verbose;
BOOL alreadyPrintedData;
BOOL retinaDevice;
BOOL tallDevice;
}
- (id)init;
- (void)dealloc;
- (void)runWithArgc:(int)argc argv:(char **)argv;
- (void)createStdioFIFO:(NSFileHandle **)fileHandle ofType:(NSString *)type atPath:(NSString **)path;
- (void)removeStdioFIFO:(NSFileHandle *)fileHandle atPath:(NSString *)path;
- (void)stop;
- (void)checkPid:(NSTimer *)timer;
- (void)doExit:(int)errorCode;
- (void)changeDeviceType:(NSString *)family retina:(BOOL)retina isTallDevice:(BOOL)isTallDevice;
@end
This diff is collapsed.
/* Author: Landon Fuller <landonf@plausiblelabs.com>
* Copyright (c) 2008-2011 Plausible Labs Cooperative, Inc.
* All rights reserved.
*
* See the IOSSIM_LICENSE file in this directory for the license on the source code in this file.
*/
/* derived from https://github.com/phonegap/ios-sim */
#import <AppKit/AppKit.h>
#import "iphonesimulator.h"
#include <QLibrary>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#include <QApplication>
#else
#include <QGuiApplication>
#endif
#include <QString>
#include <QStringList>
/* to do:
* - try to stop inferior when killed (or communicate with creator to allow killing the inferior)
* - remove unneeded functionality and streamline a bit
*/
/*
* Runs the iPhoneSimulator backed by a main runloop.
*/
int main (int argc, char *argv[]) {
int qtargc = 1;
char *qtarg = 0;
if (argc)
qtarg = argv[0];
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
QApplication a(qtargc, &qtarg);
#else
QGuiApplication a(qtargc, &qtarg);
#endif
//NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
QString xcodePath = QLatin1String("/Applications/Xcode.app/Contents/Developer/");
for (int i = 0; i + 1 < argc; ++i) {
if (strcmp(argv[i], "--developer-path") == 0)
xcodePath = QString::fromLocal8Bit(argv[i + 1]);
}
if (!xcodePath.endsWith(QLatin1Char('/')))
xcodePath.append(QLatin1Char('/'));
/* manual loading of the private deps */
QStringList deps = QStringList()
<< QLatin1String("/System/Library/PrivateFrameworks/DebugSymbols.framework/Versions/A/DebugSymbols")
<< QLatin1String("/System/Library/PrivateFrameworks/CoreSymbolication.framework/CoreSymbolication")
<< (xcodePath + QLatin1String("../OtherFrameworks/DevToolsFoundation.framework/DevToolsFoundation"));
foreach (const QString &libPath, deps) {
QLibrary *lib = new QLibrary(libPath);
//lib->setLoadHints(QLibrary::ExportExternalSymbolsHint);
if (!lib->load())
printf("<msg>error loading %s</msg>", libPath.toUtf8().constData());
}
QLibrary *libIPhoneSimulatorRemoteClient = new QLibrary(xcodePath
+ QLatin1String("Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework/iPhoneSimulatorRemoteClient"));
//libIPhoneSimulatorRemoteClient->setLoadHints(QLibrary::ResolveAllSymbolsHint|QLibrary::ExportExternalSymbolsHint);
if (!libIPhoneSimulatorRemoteClient->load())
printf("<msg>error loading iPhoneSimulatorRemoteClient</msg>");
iPhoneSimulator *sim = [[iPhoneSimulator alloc] init];
/* Execute command line handler */
[sim runWithArgc: argc argv: argv];
/* Run the loop to handle added input sources, if any */
int res = a.exec();
exit(res);
// [pool release];
return 0;
}
/*
* See the IOSSIM_LICENSE file in this directory for the license on the source code in this file.
*/
int nsvfprintf (FILE *stream, NSString *format, va_list args);
int nsfprintf (FILE *stream, NSString *format, ...);
int nsprintf (NSString *format, ...);
/*
* NSLog() clone, but writes to arbitrary output stream
*
* See the IOSSIM_LICENSE file in this directory for the license on the source code in this file.
*/
#import <Foundation/Foundation.h>
#import <stdio.h>
int nsvfprintf (FILE *stream, NSString *format, va_list args) {
int retval;
NSString *str = (NSString *) CFStringCreateWithFormatAndArguments(NULL, NULL, (CFStringRef) format, args);
retval = fprintf(stream, "%s\n", [str UTF8String]);
[str release];
return retval;
}
int nsfprintf (FILE *stream, NSString *format, ...) {
va_list ap;
int retval;
va_start(ap, format);
{
retval = nsvfprintf(stream, format, ap);
}
va_end(ap);
return retval;
}
int nsprintf (NSString *format, ...) {
va_list ap;
int retval;
va_start(ap, format);
{
retval = nsvfprintf(stdout, format, ap);
}
va_end(ap);
return retval;
}
/*
* See the IOSSIM_LICENSE file in this directory for the license on the source code in this file.
*/
#import <Foundation/Foundation.h>
@interface NSString (ExpandPath)
- (NSString *)expandPath;
@end
/*
* See the IOSSIM_LICENSE file in this directory for the license on the source code in this file.
*/
#import "nsstringexpandpath.h"
@implementation NSString (ExpandPath)
- (NSString *)expandPath {
if ([self isAbsolutePath]) {
return [self stringByStandardizingPath];
} else {
NSString *cwd = [[NSFileManager defaultManager] currentDirectoryPath];
return [[cwd stringByAppendingPathComponent:self] stringByStandardizingPath];
}
}
@end
#define IOS_SIM_VERSION "1.8.2m"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment