Skip to content

Commit

Permalink
embed Frank server version info in libFrank.a
Browse files Browse the repository at this point in the history
  • Loading branch information
moredip committed Jan 31, 2013
1 parent e415526 commit 04932b4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
28 changes: 20 additions & 8 deletions Rakefile
@@ -1,3 +1,6 @@
require File.expand_path( '../gem/lib/frank-cucumber/version', __FILE__ )
PRODUCT_VERSION=Frank::Cucumber::VERSION

def discover_latest_ios_sdk_version
latest_iphone_sdk = `xcodebuild -showsdks | grep -o "iphoneos.*$"`.chomp
version_part = latest_iphone_sdk[/iphoneos(.*)/,1]
Expand All @@ -14,20 +17,29 @@ def build_dir
File.expand_path 'build'
end

def build_library(scheme, sdk)
preprocessor_flag = %Q|GCC_PREPROCESSOR_DEFINITIONS='$GCC_PREPROCESSOR_DEFINITIONS FRANK_PRODUCT_VERSION=\"#{PRODUCT_VERSION}\"'|
sh "xcodebuild -workspace Frank.xcworkspace -scheme #{scheme} -configuration Release -sdk #{sdk} BUILD_DIR=\"#{build_dir}\" #{preprocessor_flag} clean build"
end

desc "Build the Mac library"
task :build_mac_lib do
build_library('FrankMac','macosx'+discover_latest_osx_sdk_version)
sh "cp #{build_dir}/Release/*Mac.a dist"
end

def build_ios_library(platform)
build_library('Frank',platform+discover_latest_ios_sdk_version)
end

desc "Build the arm library"
task :build_iphone_lib do
sh "xcodebuild -workspace Frank.xcworkspace -scheme Frank -configuration Release -sdk iphoneos#{discover_latest_ios_sdk_version} BUILD_DIR=\"#{build_dir}\" clean build"
build_ios_library('iphoneos')
end

desc "Build the i386 library"
task :build_simulator_lib do
sh "xcodebuild -workspace Frank.xcworkspace -scheme Frank -configuration Release -sdk iphonesimulator#{discover_latest_ios_sdk_version} BUILD_DIR=\"#{build_dir}\" clean build"
end

desc "Build the Mac library"
task :build_mac_lib do
sh "xcodebuild -workspace Frank.xcworkspace -scheme FrankMac -configuration Release -sdk macosx#{discover_latest_osx_sdk_version} BUILD_DIR=\"#{build_dir}\" clean build"
sh "cp #{build_dir}/Release/*Mac.a dist"
build_ios_library('iphonesimulator')
end

task :combine_libraries do
Expand Down
10 changes: 10 additions & 0 deletions src/FrankServer.m
Expand Up @@ -29,6 +29,15 @@
#import "OSXKeyboardCommand.h"
#endif

#ifndef FRANK_PRODUCT_VERSION
#define FRANK_PRODUCT_VERSION UNKNOWN
#endif

#define xstr(s) str(s)
#define str(s) #s
#define VERSIONED_NAME "Frank iOS Server " xstr(FRANK_PRODUCT_VERSION)
const unsigned char frank_what_string[] = "@(#)" VERSIONED_NAME "\n";

static NSUInteger __defaultPort = FRANK_SERVER_PORT;
@implementation FrankServer

Expand Down Expand Up @@ -85,6 +94,7 @@ - (id) initWithStaticFrankBundleNamed:(NSString *)bundleName
}

- (BOOL) startServer{
NSLog( @"Starting server %s", VERSIONED_NAME );
NSError *error;
if( ![_httpServer start:&error] ) {
NSLog(@"Error starting HTTP Server:");// %@", error);
Expand Down

0 comments on commit 04932b4

Please sign in to comment.