Jelajahi Sumber

For Travis - do not split the time when reaching each make's target.
Tighten up to only perform more granular timeup check on the longest build process on Xcode as it may overshoot due to universal binary build.

Yao Wei Tjong 姚伟忠 9 tahun lalu
induk
melakukan
9181173e43
2 mengubah file dengan 22 tambahan dan 16 penghapusan
  1. 12 11
      CMake/Modules/Urho3D-CMake-common.cmake
  2. 10 5
      Rakefile

+ 12 - 11
CMake/Modules/Urho3D-CMake-common.cmake

@@ -1023,19 +1023,20 @@ macro (setup_target)
         unset (TARGET_PROPERTIES)
     endif ()
 
-    # Workaround CMake/Xcode generator bug where it always appends '/build' path element to SYMROOT attribute and as such the items in Products are always rendered as red as if they are not yet built
-    if (XCODE AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
-        file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/build)
-        get_target_property (LOCATION ${TARGET_NAME} LOCATION)
-        string (REGEX REPLACE "^.*\\$\\(CONFIGURATION\\)" $(CONFIGURATION) SYMLINK ${LOCATION})
-        get_filename_component (DIRECTORY ${SYMLINK} PATH)
-        add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
-            COMMAND mkdir -p ${DIRECTORY} && ln -sf $<TARGET_FILE:${TARGET_NAME}> ${DIRECTORY}/$<TARGET_FILE_NAME:${TARGET_NAME}>
-            WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build)
-    endif ()
-    # Workaround to avoid technical error due to Travis CI build time limit
     if (DEFINED ENV{TRAVIS})
+        # Workaround to avoid technical error due to Travis CI build time limit
         add_custom_command (TARGET ${TARGET_NAME} POST_BUILD COMMAND rake ci_timeup WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+    else ()
+        # Workaround CMake/Xcode generator bug where it always appends '/build' path element to SYMROOT attribute and as such the items in Products are always rendered as red in the Xcode IDE as if they are not yet built
+        if (XCODE AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
+            file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/build)
+            get_target_property (LOCATION ${TARGET_NAME} LOCATION)
+            string (REGEX REPLACE "^.*\\$\\(CONFIGURATION\\)" $(CONFIGURATION) SYMLINK ${LOCATION})
+            get_filename_component (DIRECTORY ${SYMLINK} PATH)
+            add_custom_command (TARGET ${TARGET_NAME} POST_BUILD
+                COMMAND mkdir -p ${DIRECTORY} && ln -sf $<TARGET_FILE:${TARGET_NAME}> ${DIRECTORY}/$<TARGET_FILE_NAME:${TARGET_NAME}>
+                WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/build)
+        endif ()
     endif ()
 endmacro ()
 

+ 10 - 5
Rakefile

@@ -350,11 +350,14 @@ task :ci do
     system 'rake ci_push_bindings' or abort
     next
   end
+  # Enable more granular timeup check for Xcode
+  system 'touch enabled_time_check.log' if ENV['XCODE']
   if !system "bash -c 'rake make'"
     abort 'Failed to build Urho3D library' unless File.exists?('already_timeup.log')
     $stderr.puts "Skipped the rest of the CI processes due to insufficient time"
     next
   end
+  File.delete 'enabled_time_check.log' if ENV['XCODE']
   if ENV['URHO3D_TESTING'] && !timeup
     # Multi-config CMake generators use different test target name than single-config ones for no good reason
     test = "rake make target=#{ENV['OS'] || ENV['XCODE'] ? 'RUN_TESTS' : 'test'}"
@@ -643,9 +646,9 @@ task :ci_timer do
 end
 
 # Usage: NOT Intended to be used manually
-desc 'Check if the time is up'
+desc 'Check if the time is up when the time check is enabled'
 task :ci_timeup do
-  abort "Time up!" if timeup true
+  abort "Time up!" if File.exists?('enabled_time_check.log') && timeup(true)
 end
 
 # Always call this function last in the multiple conditional check so that the checkpoint message does not being echoed unnecessarily
@@ -656,9 +659,11 @@ def timeup quiet = false
   end
   current_time = Time.now
   elapsed_time = (current_time - File.atime('start_time.log')) / 60.0
-  lap_time = (current_time - File.atime('split_time.log')) / 60.0
-  system 'touch split_time.log'
-  puts "\n=== elapsed time: #{elapsed_time.to_i} minutes #{((elapsed_time - elapsed_time.to_i) * 60.0).round} seconds, lap time: #{lap_time.to_i} minutes #{((lap_time - lap_time.to_i) * 60.0).round} seconds ===\n\n" unless quiet || File.exists?('already_timeup.log'); $stdout.flush
+  unless quiet
+    lap_time = (current_time - File.atime('split_time.log')) / 60.0
+    system 'touch split_time.log'
+    puts "\n=== elapsed time: #{elapsed_time.to_i} minutes #{((elapsed_time - elapsed_time.to_i) * 60.0).round} seconds, lap time: #{lap_time.to_i} minutes #{((lap_time - lap_time.to_i) * 60.0).round} seconds ===\n\n" unless File.exists?('already_timeup.log'); $stdout.flush
+  end
   return system('touch already_timeup.log') if elapsed_time > 40.0
 end