@@ -32,6 +32,16 @@ def get_template_files
3232 end
3333end
3434
35+ def call_xctool command
36+ reporter = "-reporter pretty"
37+
38+ if ENV [ "CIRCLE_CI" ]
39+ reporter = "-reporter plain -reporter junit:test_results.xml"
40+ end
41+
42+ sh "xctool #{ reporter } #{ command } "
43+ end
44+
3545def get_artifact_name
3646 return @artifact_name if @artifact_name
3747 branch = `git rev-parse --abbrev-ref HEAD` . chomp
@@ -92,7 +102,9 @@ file "Generated/Version.txt" => "Generated" do |task|
92102 version_info [ "version" ] = DEFAULT_SB_VERSION
93103 version_info [ "revision" ] = ENV [ "REVISION" ] || `git rev-parse --short=10 HEAD` . chomp
94104
95- File . open ( "Generated/Version.txt" , "w" ) << JSON . pretty_generate ( version_info )
105+ f = File . open ( "Generated/Version.txt" , "w" )
106+ f . write JSON . pretty_generate ( version_info )
107+ f . close
96108end
97109
98110file "Generated/cocos2d_version.txt" => 'SpriteBuilder/libs/cocos2d-iphone/VERSION' do |task |
@@ -115,28 +127,28 @@ namespace :build do
115127 end
116128
117129 task :tests => [ :generated , :build_requirements ] do
118- sh "xctool -configuration Testing build-tests"
130+ call_xctool " -configuration Testing build-tests"
119131 end
120132end
121133
122134task :default => "build:generated"
123135
124136desc "Run SpriteBuilder unit tests"
125137task :test => [ "build:tests" , :build_requirements ] do
126- sh "xctool -configuration Testing run-tests"
138+ call_xctool " -configuration Testing run-tests"
127139end
128140
129141namespace :package do
130142 desc "Create SpriteBuilder.app + zip app and symbols"
131143 task :app do
132- sh "xctool TARGET_BUILD_DIR=#{ BUILD_DIR } CONFIGURATION_BUILD_DIR=#{ BUILD_DIR } VERSION=#{ DEFAULT_SB_VERSION } -configuration Release build"
144+ call_xctool " TARGET_BUILD_DIR=#{ BUILD_DIR } CONFIGURATION_BUILD_DIR=#{ BUILD_DIR } VERSION=#{ DEFAULT_SB_VERSION } -configuration Release build"
133145 app , symbols = "NONE"
134146
135147 built_files = `find . -name SpriteBuilder.app` . chomp . split "\n "
136148
137149 app = built_files . max { |a , b | File . mtime ( a ) <=> File . mtime ( b ) }
138150 symbols = "#{ app } .dSYM"
139- versioned_app_name = "#{ DEFAULT_PRODUCT_NAME } -#{ ENV [ "VERSION" ] } .app"
151+ versioned_app_name = "#{ DEFAULT_PRODUCT_NAME } -#{ DEFAULT_SB_VERSION } .app"
140152
141153 unless File . exists? app and File . exists? symbols
142154 fail "Built products don't exist at #{ app } and #{ symbols } "
@@ -152,7 +164,7 @@ namespace :package do
152164
153165 desc "Create SpriteBuilder.xcarchive and zip"
154166 task :archive do
155- sh "xctool TARGET_BUILD_DIR=#{ BUILD_DIR } VERSION='#{ DEFAULT_SB_VERSION } ' -configuration Release archive -archivePath #{ BUILD_DIR } /SpriteBuilder"
167+ call_xctool " TARGET_BUILD_DIR=#{ BUILD_DIR } VERSION='#{ DEFAULT_SB_VERSION } ' -configuration Release archive -archivePath #{ BUILD_DIR } /SpriteBuilder"
156168
157169 Dir . chdir BUILD_DIR do
158170 sh "zip -r SpriteBuilder.xcarchive.zip SpriteBuilder.xcarchive"
@@ -163,10 +175,10 @@ end
163175desc "Build SpriteBuilder distribution"
164176task :package => [ :clobber , BUILD_DIR , :build_requirements ] do
165177
166- #force generation of a new Version.txt with commandline value
178+ #force generation of a new Version.txt
167179 Rake ::Task [ "build:generated" ] . invoke
168-
169180 Rake ::Task [ "package:app" ] . invoke
181+
170182 Rake ::Task [ "clean" ] . invoke
171183 Rake ::Task [ "package:archive" ] . invoke
172184
0 commit comments