Browse Source

Preparation to use docker images for CI.
Move '.build-options' and '.env-file' into 'script' dir. As the 'script' dir get symlink-ed during scaffolding task, the downstream project would automatically able to reference these two files.

Yao Wei Tjong 姚伟忠 7 years ago
parent
commit
dda252dfa6
4 changed files with 130 additions and 7 deletions
  1. 6 5
      Rakefile
  2. 0 0
      script/.build-options
  3. 122 0
      script/.env-file
  4. 2 2
      script/dockerized.sh

+ 6 - 5
Rakefile

@@ -53,8 +53,8 @@ task :cmake do
   script = 'cmake_generic'
   platform = 'native'
   build_options = ''
-  # TODO: Need to find a way to automatically populate the array with all the Urho3D supported build options, at the moment it only contains those being used in CI
-  ['URHO3D_64BIT', 'URHO3D_LIB_TYPE', 'URHO3D_ANGELSCRIPT', 'URHO3D_LUAJIT', 'URHO3D_LUAJIT_AMALG', 'URHO3D_STATIC_RUNTIME', 'URHO3D_PCH', 'URHO3D_LINT', 'URHO3D_BINDINGS', 'URHO3D_OPENGL', 'URHO3D_D3D11', 'URHO3D_TESTING', 'URHO3D_TEST_TIMEOUT', 'URHO3D_UPDATE_SOURCE_TREE', 'URHO3D_SAMPLES', 'URHO3D_TOOLS', 'URHO3D_DEPLOYMENT_TARGET', 'URHO3D_USE_LIB64_RPM', 'CMAKE_BUILD_TYPE', 'CMAKE_OSX_DEPLOYMENT_TARGET', 'IOS', 'IPHONEOS_DEPLOYMENT_TARGET', 'TVOS', 'APPLETVOS_DEPLOYMENT_TARGET', 'WIN32', 'MINGW', 'DIRECTX_INC_SEARCH_PATHS', 'DIRECTX_LIB_SEARCH_PATHS', 'ANDROID', 'ANDROID_ABI', 'ANDROID_NATIVE_API_LEVEL', 'ANDROID_TOOLCHAIN_NAME', 'RPI', 'RPI_ABI', 'ARM', 'ARM_ABI_FLAGS', 'WEB', 'EMSCRIPTEN_SHARE_DATA', 'EMSCRIPTEN_WASM', 'EMSCRIPTEN_EMRUN_BROWSER', 'EMSCRIPTEN_AUTO_SHELL'].each { |var|
+  File.readlines('script/.build-options').each { |var|
+    var.chomp!
     ARGV << "#{var}=\"#{ENV[var]}\"" if ENV[var] && !ARGV.find { |arg| /#{var}=/ =~ arg }
   }
   ARGV.each { |option|
@@ -342,6 +342,8 @@ task :ci do
   # Show CMake version
   system 'cmake --version' or abort 'Failed to find CMake'
   puts; $stdout.flush
+  # Ensure '.build-options' and '.env-file' are up-to-date
+  system %Q(perl -ne 'undef $/; print $1 if /(Build Option.*?(?=\n\n))/s' Docs/GettingStarted.dox |tail -n +3 |cut -d'|' -f2 |tr -d [:blank:] >script/.build-options && cat script/.build-options <(perl -ne 'while (/(\w+)=\w+/g) {print "$1\n"}' .travis.yml) |sort |uniq |grep -v ^PATH$ >script/.env-file)
   # Using out-of-source build tree when using Travis-CI; 'build_tree' environment variable is already set when on AppVeyor
   ENV['build_tree'] = '../Build' unless ENV['APPVEYOR']
   # Always use a same build configuration per build job to keep ccache's cache size small; default to RELEASE unless specifically defined
@@ -349,7 +351,7 @@ task :ci do
   # Currently we don't have the infra to test run all the platforms; also skip when doing packaging build due to time constraint
   ENV['URHO3D_TESTING'] = '1' if (((ENV['LINUX'] && !ENV['URHO3D_64BIT']) || (ENV['OSX'] && !ENV['IOS'] && !ENV['TVOS']) || ENV['APPVEYOR']) && !ENV['PACKAGE_UPLOAD']) || ENV['WEB']
   # When not explicitly specified then use generic generator
-  generator = ENV['XCODE'] ? 'xcode' : (ENV['APPVEYOR'] && !ENV['MINGW'] ? 'vs2017' : '')
+  generator = ENV['XCODE'] ? 'xcode' : (ENV['APPVEYOR'] ? (ENV['MINGW'] ? 'mingw' : 'vs2017') : '')
   # LuaJIT on MinGW build is not possible on Travis-CI with Ubuntu 14.04 LTS still as its GCC cross-compiler does not have native exception handling
   # LuaJIT on Web platform is not possible
   jit = (ENV['WIN32'] && ENV['TRAVIS']) || ENV['WEB'] ? '' : 'JIT=1 URHO3D_LUAJIT_AMALG='
@@ -532,8 +534,7 @@ task :ci_site_update do
     puts "Updating source tree...\n\n"
     # Supply GIT credentials to push source tree changes to urho3d/Urho3D.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'
-    system %Q(perl -ne 'undef $/; print $1 if /(Build Option.*?(?=\n\n))/s' Docs/GettingStarted.dox |tail -n +3 |cut -d'|' -f2 |tr -d [:blank:] >.env-file)
-    system "git add .env-file Source && git commit -qm 'Travis CI: source tree update at #{Time.now.utc}.' >/dev/null 2>&1"   # Use extra quiet mode as there could be no changes at all
+    system "git add script Source && git commit -qm 'Travis CI: source tree update at #{Time.now.utc}.' >/dev/null 2>&1"   # Use extra quiet mode as there could be no changes at all
     if /2008-([0-9]{4}) the Urho3D project/.match(File.read('Rakefile'))[1].to_i != Time.now.year
       # Automatically bump copyright when crossing a new year and give instruction to clear the cache if so since the cache is of no use anyway because of massive changes
       system "git add #{bump_copyright_year.join ' '} && if git commit -qm 'Travis CI: bump copyright to #{Time.now.year}.\n[cache clear]'; then git push origin HEAD:#{ENV['TRAVIS_BRANCH']} -q >/dev/null 2>&1 && echo Bumped copyright - Happy New Year!; fi" or abort "Failed to push copyright update for #{ENV['TRAVIS_BRANCH']}"

+ 0 - 0
.env-file → script/.build-options


+ 122 - 0
script/.env-file

@@ -0,0 +1,122 @@
+ANDROID
+ANDROID_CCACHE
+ANDROID_TMP
+APPLETVOS_DEPLOYMENT_TARGET
+APPVEYOR_REPO_COMMIT
+ARCH
+ARM
+ARM_ABI_FLAGS
+ARM_PREFIX
+ARM_SYSROOT
+BINARYEN
+BRANCH
+build
+ccache
+CCACHE_COMPRESS
+CCACHE_MAXSIZE
+CCACHE_SLOPPINESS
+cmake
+CMAKE_BUILD_TYPE
+CMAKE_INSTALL_PREFIX
+CMAKE_OSX_DEPLOYMENT_TARGET
+CMAKE_PREFIX_PATH
+COMMIT_MESSAGE
+DIRECT3D_DLL_REDIST_SEARCH_PATHS
+DIRECTX_INC_SEARCH_PATHS
+DIRECTX_LIB_SEARCH_PATHS
+DISPLAY
+EMSCRIPTEN_ALLOW_MEMORY_GROWTH
+EMSCRIPTEN_AUTO_SHELL
+EMSCRIPTEN_EMRUN_BROWSER
+EMSCRIPTEN_ROOT_PATH
+EMSCRIPTEN_SHARE_DATA
+EMSCRIPTEN_SYSROOT
+EMSCRIPTEN_TOTAL_MEMORY
+EMSCRIPTEN_WASM
+EXTRA_PROPS
+format
+HOT
+IOS
+IPHONEOS_DEPLOYMENT_TARGET
+LINUX
+LLVM_CLANG_ROOT
+MAKEFILE
+mcpu
+mfpu
+MINGW_PREFIX
+MINGW_SYSROOT
+MINGW_URL
+numjobs
+ORG_GRADLE_PROJECT_ANDROID_ABI
+ORG_GRADLE_PROJECT_URHO3D_LIB_TYPE
+OSX
+PACKAGE_UPLOAD
+PLATFORM
+redundant
+RELEASE_TAG
+RPI
+RPI_ABI
+RPI_PREFIX
+RPI_SYSROOT
+sdk
+SF_DEFAULT
+SITE_UPDATE
+sw
+SYS_IMG
+SYSROOT
+TAG
+TRAVIS_COMMIT
+triplet
+ts
+TVOS
+URHO3D_3DNOW
+URHO3D_64BIT
+URHO3D_ANGELSCRIPT
+URHO3D_D3D11
+URHO3D_DATABASE_ODBC
+URHO3D_DATABASE_SQLITE
+URHO3D_DEPLOYMENT_TARGET
+URHO3D_DOCS
+URHO3D_DOCS_QUIET
+URHO3D_EXTRAS
+URHO3D_FILEWATCHER
+URHO3D_HASH_DEBUG
+URHO3D_HOME
+URHO3D_IK
+URHO3D_LIB_TYPE
+URHO3D_LINT
+URHO3D_LOGGING
+URHO3D_LUA
+URHO3D_LUAJIT
+URHO3D_LUAJIT_AMALG
+URHO3D_LUA_RAW_SCRIPT_LOADER
+URHO3D_MACOSX_BUNDLE
+URHO3D_MINIDUMPS
+URHO3D_MMX
+URHO3D_NAVIGATION
+URHO3D_NETWORK
+URHO3D_OPENGL
+URHO3D_PACKAGING
+URHO3D_PCH
+URHO3D_PHYSICS
+URHO3D_PLAYER
+URHO3D_PROFILING
+URHO3D_SAFE_LUA
+URHO3D_SAMPLES
+URHO3D_SCP_TO_TARGET
+URHO3D_SSE
+URHO3D_STATIC_RUNTIME
+URHO3D_TESTING
+URHO3D_TEST_TIMEOUT
+URHO3D_THREADING
+URHO3D_TOOLS
+URHO3D_UPDATE_SOURCE_TREE
+URHO3D_URHO2D
+URHO3D_USE_LIB64_RPM
+URHO3D_USE_LIB_DEB
+URHO3D_WEBP
+URHO3D_WIN32_CONSOLE
+USE_CCACHE
+WEB
+WIN32
+XCODE

+ 2 - 2
script/dockerized.sh

@@ -31,7 +31,7 @@ BuildEnvironment=${BuildEnvironment/-base}
 if [[ $(docker version -f {{.Client.Version}}) =~ ^([0-9]+)\.0*([0-9]+)\. ]] && (( ${BASH_REMATCH[1]} * 100 + ${BASH_REMATCH[2]} >= 1809 )); then
     docker run -it --rm -h fishtank \
         -e HOST_UID=$(id -u) -e HOST_GID=$(id -g) \
-        --env-file $PROJECT_DIR/.env-file \
+        --env-file $PROJECT_DIR/script/.env-file \
         --mount type=bind,source=$PROJECT_DIR,target=/project_dir \
         --mount source=$(id -u).urho3d_home_dir,target=/home/urho3d \
         --name dockerized$BuildEnvironment \
@@ -40,7 +40,7 @@ else
     # Fallback workaround on older Docker CLI version
     docker run -it --rm -h fishtank \
         -e HOST_UID=$(id -u) -e HOST_GID=$(id -g) \
-        --env-file <(perl -ne 'chomp; print "$_=$ENV{$_}\n" if defined $ENV{$_}' $PROJECT_DIR/.env-file) \
+        --env-file <(perl -ne 'chomp; print "$_=$ENV{$_}\n" if defined $ENV{$_}' $PROJECT_DIR/script/.env-file) \
         --mount type=bind,source=$PROJECT_DIR,target=/project_dir \
         --mount source=$(id -u).urho3d_home_dir,target=/home/urho3d \
         --name dockerized$BuildEnvironment \