Browse Source

Fix iOS host-tool building for Urho3D_universal target.
For Travis CI - when releasing disregard commit message instruction from the last commit being tagged. This is to ensure all CI jobs are run for releasing the artifacts.
[ci package]

Yao Wei Tjong 姚伟忠 10 years ago
parent
commit
dfab28fed6
4 changed files with 31 additions and 19 deletions
  1. 12 6
      .travis.yml
  2. 13 7
      Rakefile
  3. 3 3
      Source/Tools/CMakeLists.txt
  4. 3 3
      Source/Urho3D/CMakeLists.txt

+ 12 - 6
.travis.yml

@@ -34,6 +34,7 @@ env:
     - USE_CCACHE=1
     - USE_CCACHE=1
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_COMPRESS=1
     - CCACHE_COMPRESS=1
+    - CCACHE_MAXSIZE=100M
 matrix:
 matrix:
   fast_finish: true
   fast_finish: true
   include:
   include:
@@ -115,8 +116,8 @@ before_script:
   - rake ci_setup_cache
   - rake ci_setup_cache
 script:
 script:
   - rake ci
   - rake ci
-  - if [ $SITE_UPDATE ]; then rake ci_site_update; fi
-  - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; if [ $LINUX ] && [ ! "$URHO3D_64BIT" == "0" ]; then rake ci_package_upload URHO3D_USE_LIB64_RPM=1; fi; fi
+  - if [ $SITE_UPDATE ]; then rake ci_site_update || ! [ $RELEASE_TAG ]; fi
+  - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload && if [ $LINUX ] && [ ! "$URHO3D_64BIT" == "0" ]; then rake ci_package_upload URHO3D_USE_LIB64_RPM=1; fi || ! [ $RELEASE_TAG ]; fi
 after_script:
 after_script:
   - rake ci_teardown_cache
   - rake ci_teardown_cache
   - if [ ${TRAVIS_JOB_NUMBER##*.} == 1 ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then rake ci_create_mirrors; fi
   - if [ ${TRAVIS_JOB_NUMBER##*.} == 1 ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then rake ci_create_mirrors; fi
@@ -148,6 +149,7 @@ env:
     - USE_CCACHE=1
     - USE_CCACHE=1
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_COMPRESS=1
     - CCACHE_COMPRESS=1
+    - CCACHE_MAXSIZE=100M
 before_script:
 before_script:
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export TRAVIS_COMMIT=$TRAVIS_COMMIT~
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
   - export COMMIT_MESSAGE=$(git log --format=%B -n 1 $TRAVIS_COMMIT)
@@ -173,6 +175,7 @@ env:
     - PACKAGE_JOB_END=9
     - PACKAGE_JOB_END=9
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_COMPRESS=1
     - CCACHE_COMPRESS=1
+    - CCACHE_MAXSIZE=100M
 matrix:
 matrix:
   fast_finish: true
   fast_finish: true
   include:
   include:
@@ -224,7 +227,7 @@ before_script:
   - rake ci_setup_cache
   - rake ci_setup_cache
 script:
 script:
   - rake ci
   - rake ci
-  - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; fi
+  - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload || ! [ $RELEASE_TAG ]; fi
 after_script: rake ci_teardown_cache
 after_script: rake ci_teardown_cache
 
 
 ---
 ---
@@ -243,6 +246,7 @@ env:
     - USE_CCACHE=1
     - USE_CCACHE=1
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_COMPRESS=1
     - CCACHE_COMPRESS=1
+    - CCACHE_MAXSIZE=100M
 matrix:
 matrix:
   fast_finish: true
   fast_finish: true
   include:
   include:
@@ -264,7 +268,7 @@ before_script:
   - rake ci_setup_cache
   - rake ci_setup_cache
 script:
 script:
   - rake ci
   - rake ci
-  - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; fi
+  - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload || ! [ $RELEASE_TAG ]; fi
 after_script: rake ci_teardown_cache
 after_script: rake ci_teardown_cache
 
 
 ---
 ---
@@ -280,6 +284,7 @@ env:
     - USE_CCACHE=2
     - USE_CCACHE=2
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_COMPRESS=1
     - CCACHE_COMPRESS=1
+    - CCACHE_MAXSIZE=300M
   matrix:
   matrix:
     - MAKEFILE=1    URHO3D_LIB_TYPE=STATIC
     - MAKEFILE=1    URHO3D_LIB_TYPE=STATIC
     - MAKEFILE=1    URHO3D_LIB_TYPE=SHARED
     - MAKEFILE=1    URHO3D_LIB_TYPE=SHARED
@@ -307,7 +312,7 @@ before_script:
   - rake ci_setup_cache
   - rake ci_setup_cache
 script:
 script:
   - rake ci
   - rake ci
-  - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload; fi
+  - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload || ! [ $RELEASE_TAG ]; fi
 after_script: rake ci_teardown_cache
 after_script: rake ci_teardown_cache
 
 
 ---
 ---
@@ -325,6 +330,7 @@ env:
     - USE_CCACHE=2
     - USE_CCACHE=2
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_SLOPPINESS=pch_defines,time_macros
     - CCACHE_COMPRESS=1
     - CCACHE_COMPRESS=1
+    - CCACHE_MAXSIZE=100M
     # TODO: Remove CCACHE_CPP2 env var when Emscripten version has reached beyond 1.31.3
     # TODO: Remove CCACHE_CPP2 env var when Emscripten version has reached beyond 1.31.3
     - CCACHE_CPP2=1
     - CCACHE_CPP2=1
   matrix:
   matrix:
@@ -346,7 +352,7 @@ before_script:
   - rake ci_setup_cache
   - rake ci_setup_cache
 script:
 script:
   - rake ci
   - rake ci
-  - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload && rake ci_emscripten_samples_update; fi
+  - if [ $PACKAGE_UPLOAD ]; then rake ci_package_upload && rake ci_emscripten_samples_update || ! [ $RELEASE_TAG ]; fi
 after_script: rake ci_teardown_cache
 after_script: rake ci_teardown_cache
 
 
 # Below samples are excluded from Emscripten CI build due to build time constraint
 # Below samples are excluded from Emscripten CI build due to build time constraint

+ 13 - 7
Rakefile

@@ -186,8 +186,10 @@ end
 desc 'Configure, build, and test Urho3D project'
 desc 'Configure, build, and test Urho3D project'
 task :ci do
 task :ci do
   # Skip if only performing CI for selected branches and the current branch is not in the list
   # Skip if only performing CI for selected branches and the current branch is not in the list
-  matched = /\[ci only:(.*?)\]/.match(ENV['COMMIT_MESSAGE'])
-  next if matched && !matched[1].split(/[ ,]/).reject!(&:empty?).map { |i| /#{i}/ =~ ENV['TRAVIS_BRANCH'] }.any?
+  unless ENV['RELEASE_TAG']
+    matched = /\[ci only:(.*?)\]/.match(ENV['COMMIT_MESSAGE'])
+    next if matched && !matched[1].split(/[ ,]/).reject!(&:empty?).map { |i| /#{i}/ =~ ENV['TRAVIS_BRANCH'] }.any?
+  end
   # Obtain our custom data, if any
   # Obtain our custom data, if any
   data = YAML::load(File.open(".travis.yml"))['data']
   data = YAML::load(File.open(".travis.yml"))['data']
   data['excluded_sample'].each { |name| ENV["EXCLUDE_SAMPLE_#{name}"] = '1' } if data && data['excluded_sample']
   data['excluded_sample'].each { |name| ENV["EXCLUDE_SAMPLE_#{name}"] = '1' } if data && data['excluded_sample']
@@ -235,7 +237,7 @@ task :ci_setup_cache do
     system "if ! `git clone -q --depth 1 --branch #{ENV['TRAVIS_BRANCH']}#{job_number} https://github.com/#{repo_slug} ~/.ccache 2>/dev/null`; then if ! [ #{base_mirror} ] || ! `git clone -q --depth 1 --branch #{base_mirror}#{job_number} https://github.com/#{repo_slug} ~/.ccache 2>/dev/null`; then git clone -q --depth 1 https://github.com/#{repo_slug} ~/.ccache 2>/dev/null; fi && cd ~/.ccache && git checkout -qf -b #{ENV['TRAVIS_BRANCH']}#{job_number}; fi && find ~/.ccache -type f |xargs touch -r $(which ccache)"
     system "if ! `git clone -q --depth 1 --branch #{ENV['TRAVIS_BRANCH']}#{job_number} https://github.com/#{repo_slug} ~/.ccache 2>/dev/null`; then if ! [ #{base_mirror} ] || ! `git clone -q --depth 1 --branch #{base_mirror}#{job_number} https://github.com/#{repo_slug} ~/.ccache 2>/dev/null`; then git clone -q --depth 1 https://github.com/#{repo_slug} ~/.ccache 2>/dev/null; fi && cd ~/.ccache && git checkout -qf -b #{ENV['TRAVIS_BRANCH']}#{job_number}; fi && find ~/.ccache -type f |xargs touch -r $(which ccache)"
   end
   end
   # Clear ccache on demand
   # Clear ccache on demand
-  system "ccache -z -M 100M #{/\[ccache clear\]/ =~ ENV['COMMIT_MESSAGE'] ? '-C' : ''}"
+  system "ccache -z -M #{ENV['CCACHE_MAXSIZE']} #{/\[ccache clear\]/ =~ ENV['COMMIT_MESSAGE'] ? '-C' : ''}"
 end
 end
 
 
 # Usage: NOT intended to be used manually
 # Usage: NOT intended to be used manually
@@ -311,9 +313,13 @@ task :ci_create_mirrors do
   abort 'Skipped creating mirror branches due to moving HEAD' unless `git fetch -qf origin #{ENV['TRAVIS_PULL_REQUEST'] == 'false' ? ENV['TRAVIS_BRANCH'] : %Q{+refs/pull/#{ENV['TRAVIS_PULL_REQUEST']}/head'}}; git log -1 --pretty=format:'%H' FETCH_HEAD` == ENV['TRAVIS_COMMIT']
   abort 'Skipped creating mirror branches due to moving HEAD' unless `git fetch -qf origin #{ENV['TRAVIS_PULL_REQUEST'] == 'false' ? ENV['TRAVIS_BRANCH'] : %Q{+refs/pull/#{ENV['TRAVIS_PULL_REQUEST']}/head'}}; git log -1 --pretty=format:'%H' FETCH_HEAD` == ENV['TRAVIS_COMMIT']
   system 'git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/$TRAVIS_REPO_SLUG.git'
   system 'git config user.name $GIT_NAME && git config user.email $GIT_EMAIL && git remote set-url --push origin https://[email protected]/$TRAVIS_REPO_SLUG.git'
   scan = ENV['PACKAGE_UPLOAD'] || /\[ci scan\]/ =~ ENV['COMMIT_MESSAGE']  # Limit the frequency of scanning
   scan = ENV['PACKAGE_UPLOAD'] || /\[ci scan\]/ =~ ENV['COMMIT_MESSAGE']  # Limit the frequency of scanning
-  matched = /\[ci only:(.*?)\]/.match(ENV['COMMIT_MESSAGE'])
-  ci_only = matched ? matched[1].split(/[ ,]/).reject!(&:empty?) : nil
-  ci_only.push('Coverity-Scan') if ci_only && scan
+  unless ENV['RELEASE_TAG']
+    matched = /\[ci only:(.*?)\]/.match(ENV['COMMIT_MESSAGE'])
+    ci_only = matched ? matched[1].split(/[ ,]/).reject!(&:empty?) : nil
+    ci_only.push('Coverity-Scan') if ci_only && scan
+  else
+    ci_only = nil
+  end
   stream = YAML::load_stream(File.open('.travis.yml'))
   stream = YAML::load_stream(File.open('.travis.yml'))
   notifications = stream[0]['notifications']
   notifications = stream[0]['notifications']
   notifications['email']['recipients'] = `git show -s --format='%ae %ce' #{ENV['TRAVIS_COMMIT']}`.chomp.split.uniq unless notifications['email']['recipients']
   notifications['email']['recipients'] = `git show -s --format='%ae %ce' #{ENV['TRAVIS_COMMIT']}`.chomp.split.uniq unless notifications['email']['recipients']
@@ -361,7 +367,7 @@ task :ci_package_upload do
       elapsed_time = (Time.now - Time.at(ENV['CI_START_TIME'].to_i)) / 60
       elapsed_time = (Time.now - Time.at(ENV['CI_START_TIME'].to_i)) / 60
       puts "\niOS checkpoint reached, elapsed time: #{elapsed_time}\n\n"
       puts "\niOS checkpoint reached, elapsed time: #{elapsed_time}\n\n"
     end
     end
-    if !ENV['CI_START_TIME'] || elapsed_time < 15 # minutes
+    if !ENV['CI_START_TIME'] || elapsed_time < 25 # minutes
       # Build Mach-O universal binary consisting of iphoneos (universal ARM archs including 'arm64' if 64-bit is enabled) and iphonesimulator (i386 arch and also x86_64 arch if 64-bit is enabled)
       # Build Mach-O universal binary consisting of iphoneos (universal ARM archs including 'arm64' if 64-bit is enabled) and iphonesimulator (i386 arch and also x86_64 arch if 64-bit is enabled)
       system 'echo Rebuild Urho3D library as Mach-O universal binary'
       system 'echo Rebuild Urho3D library as Mach-O universal binary'
       xcode_build(0, '../Build/Urho3D.xcodeproj', 'Urho3D_universal') or abort 'Failed to build Mach-O universal binary'
       xcode_build(0, '../Build/Urho3D.xcodeproj', 'Urho3D_universal') or abort 'Failed to build Mach-O universal binary'

+ 3 - 3
Source/Tools/CMakeLists.txt

@@ -37,12 +37,12 @@ if ((CMAKE_CROSSCOMPILING OR IOS) AND URHO3D_PACKAGING)
     # When cross-compiling, build the host tool as external project
     # When cross-compiling, build the host tool as external project
     include (ExternalProject)
     include (ExternalProject)
     if (IOS)
     if (IOS)
-        # For iOS target, its host is MacOSX; Also workaround a known CMake/Xcode generator bug which prevents it from installing binaries correctly
-        set (OSX_HOST -DCMAKE_OSX_SYSROOT=macosx BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
+        # For iOS target, ensure the host environment is cleared first; Also workaround a known CMake/Xcode generator bug which prevents it from installing binaries correctly
+        set (IOS_FIX CMAKE_COMMAND /usr/bin/env -i PATH=$ENV{PATH} ${CMAKE_COMMAND} BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
     endif ()
     endif ()
     ExternalProject_Add (PackageTool
     ExternalProject_Add (PackageTool
         SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/Tools/PackageTool
         SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/Tools/PackageTool
-        CMAKE_ARGS -DDEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool -DBAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} -DBAKED_CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} ${OSX_HOST})
+        CMAKE_ARGS -DDEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool -DBAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} -DBAKED_CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR} ${IOS_FIX})
     install (PROGRAMS ${CMAKE_BINARY_DIR}/bin/tool/PackageTool DESTINATION ${DEST_RUNTIME_DIR}/tool)
     install (PROGRAMS ${CMAKE_BINARY_DIR}/bin/tool/PackageTool DESTINATION ${DEST_RUNTIME_DIR}/tool)
 endif ()
 endif ()
 
 

+ 3 - 3
Source/Urho3D/CMakeLists.txt

@@ -40,12 +40,12 @@ if (URHO3D_LUA)
         # When cross-compiling, build the host tool as external project
         # When cross-compiling, build the host tool as external project
         include (ExternalProject)
         include (ExternalProject)
         if (IOS)
         if (IOS)
-            # For iOS target, its host is MacOSX; Also workaround a known CMake/Xcode generator bug which prevents it from installing binaries correctly
-            set (OSX_HOST -DCMAKE_OSX_SYSROOT=macosx BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
+            # For iOS target, ensure the host environment is cleared first; Also workaround a known CMake/Xcode generator bug which prevents it from installing binaries correctly
+            set (IOS_FIX CMAKE_COMMAND /usr/bin/env -i PATH=$ENV{PATH} ${CMAKE_COMMAND} BUILD_COMMAND bash -c "sed -i '' 's/EFFECTIVE_PLATFORM_NAME//g' CMakeScripts/install_postBuildPhase.make*")
         endif ()
         endif ()
         ExternalProject_Add (tolua++
         ExternalProject_Add (tolua++
             SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/ThirdParty/toluapp/src/bin
             SOURCE_DIR ${CMAKE_SOURCE_DIR}/Source/ThirdParty/toluapp/src/bin
-            CMAKE_ARGS -DURHO3D_LUAJIT=${URHO3D_LUAJIT} -DDEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool -DBAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} ${OSX_HOST})
+            CMAKE_ARGS -DURHO3D_LUAJIT=${URHO3D_LUAJIT} -DDEST_RUNTIME_DIR=${CMAKE_BINARY_DIR}/bin/tool -DBAKED_CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR} ${IOS_FIX})
     else ()
     else ()
         # Otherwise, build it internally as per normal
         # Otherwise, build it internally as per normal
         add_subdirectory (../ThirdParty/toluapp/src/bin ../ThirdParty/toluapp/src/bin)
         add_subdirectory (../ThirdParty/toluapp/src/bin ../ThirdParty/toluapp/src/bin)