|
@@ -68,7 +68,7 @@ task :cmake do
|
|
|
case option
|
|
case option
|
|
|
when 'cmake', 'generic'
|
|
when 'cmake', 'generic'
|
|
|
# do nothing
|
|
# do nothing
|
|
|
- when 'clean', 'codeblocks', 'eclipse', 'ninja', 'vs2008', 'vs2010', 'vs2012', 'vs2013', 'vs2015', 'xcode'
|
|
|
|
|
|
|
+ when 'clean', 'codeblocks', 'codelite', 'eclipse', 'ninja', 'vs2008', 'vs2010', 'vs2012', 'vs2013', 'vs2015', 'xcode'
|
|
|
script = "cmake_#{option}" unless script == 'cmake_clean'
|
|
script = "cmake_#{option}" unless script == 'cmake_clean'
|
|
|
when 'android', 'web', 'ios', 'mingw', 'rpi'
|
|
when 'android', 'web', 'ios', 'mingw', 'rpi'
|
|
|
platform = option
|
|
platform = option
|
|
@@ -104,7 +104,7 @@ task :make do
|
|
|
ARGV.each { |option|
|
|
ARGV.each { |option|
|
|
|
task option.to_sym do ; end; Rake::Task[option].clear # No-op hack
|
|
task option.to_sym do ; end; Rake::Task[option].clear # No-op hack
|
|
|
case option
|
|
case option
|
|
|
- when 'codeblocks', 'eclipse', 'generic', 'make', 'ninja', 'vs2008', 'vs2010', 'vs2012', 'vs2013', 'vs2015', 'xcode'
|
|
|
|
|
|
|
+ when 'codeblocks', 'codelite', 'eclipse', 'generic', 'make', 'ninja', 'vs2008', 'vs2010', 'vs2012', 'vs2013', 'vs2015', 'xcode'
|
|
|
# do nothing
|
|
# do nothing
|
|
|
when 'android', 'web', 'ios', 'mingw', 'rpi'
|
|
when 'android', 'web', 'ios', 'mingw', 'rpi'
|
|
|
platform = option
|
|
platform = option
|
|
@@ -240,7 +240,7 @@ task :ci do
|
|
|
system "bash -c 'git fetch --unshallow'" or abort 'Failed to unshallow cloned repository'
|
|
system "bash -c 'git fetch --unshallow'" or abort 'Failed to unshallow cloned repository'
|
|
|
end
|
|
end
|
|
|
# Show CMake version
|
|
# Show CMake version
|
|
|
- system "bash -c 'echo && cmake --version && echo'" or abort 'Could not find CMake'
|
|
|
|
|
|
|
+ system "bash -c 'echo && cmake --version && echo'" or abort 'Failed to find CMake'
|
|
|
# Using out-of-source build tree when using Travis-CI; 'build_tree' environment variable is already set when on AppVeyor
|
|
# 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']
|
|
ENV['build_tree'] = '../Build' unless ENV['APPVEYOR']
|
|
|
# Always use a same build configuration to keep ccache's cache size small; single-config generator needs the option when configuring, while multi-config when building
|
|
# Always use a same build configuration to keep ccache's cache size small; single-config generator needs the option when configuring, while multi-config when building
|
|
@@ -399,9 +399,9 @@ end
|
|
|
# Usage: NOT intended to be used manually
|
|
# Usage: NOT intended to be used manually
|
|
|
desc 'Create all CI mirror branches'
|
|
desc 'Create all CI mirror branches'
|
|
|
task :ci_create_mirrors do
|
|
task :ci_create_mirrors do
|
|
|
- # Skip if there are more commits since this one
|
|
|
|
|
- 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'
|
|
|
|
|
|
|
+ # Skip if there are more commits since this one unless the CI mirror branch is mandatory
|
|
|
|
|
+ clean = `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 checkout -qf $TRAVIS_COMMIT && 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' or abort 'Failed to re-checkout commit'
|
|
|
# Limit the scanning to only master branch and limit the frequency of scanning
|
|
# Limit the scanning to only master branch and limit the frequency of scanning
|
|
|
scan = ENV['TRAVIS_BRANCH'] == 'master' && ((/\[ccache clear\]/ !~ ENV['COMMIT_MESSAGE'] && `ccache -s |grep 'cache miss'`.split.last.to_i >= ENV['COVERITY_SCAN_THRESHOLD'].to_i) || /\[ci scan\]/ =~ ENV['COMMIT_MESSAGE']) && /\[ci only:.*?\]/ !~ ENV['COMMIT_MESSAGE']
|
|
scan = ENV['TRAVIS_BRANCH'] == 'master' && ((/\[ccache clear\]/ !~ ENV['COMMIT_MESSAGE'] && `ccache -s |grep 'cache miss'`.split.last.to_i >= ENV['COVERITY_SCAN_THRESHOLD'].to_i) || /\[ci scan\]/ =~ ENV['COMMIT_MESSAGE']) && /\[ci only:.*?\]/ !~ ENV['COMMIT_MESSAGE']
|
|
|
# Check if it is time to generate annotation
|
|
# Check if it is time to generate annotation
|
|
@@ -423,7 +423,7 @@ task :ci_create_mirrors do
|
|
|
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'] = get_root_commit_and_recipients().last unless notifications['email']['recipients']
|
|
notifications['email']['recipients'] = get_root_commit_and_recipients().last unless notifications['email']['recipients']
|
|
|
- stream.drop(1).each { |doc| branch = doc.delete('branch'); ci = branch['name']; ci_branch = ENV['RELEASE_TAG'] || (ENV['TRAVIS_BRANCH'] == 'master' && ENV['TRAVIS_PULL_REQUEST'] == 'false') ? ci : (ENV['TRAVIS_PULL_REQUEST'] == 'false' ? "#{ENV['TRAVIS_BRANCH']}-#{ci}" : "PR ##{ENV['TRAVIS_PULL_REQUEST']}-#{ci}"); unless (ci_only && ci_only.map { |i| /#{i}/ =~ ci }.any?) || (!ci_only && (branch['active'] || (scan && /Scan/ =~ ci) || (annotate && /Annotate/ =~ ci))); system "if git fetch origin #{ci_branch}:#{ci_branch} 2>/dev/null; then git push -qf origin --delete #{ci_branch}; fi"; next; end; lastjob = doc['matrix'] && doc['matrix']['include'] ? doc['matrix']['include'].length : (doc['env']['matrix'] ? doc['env']['matrix'].length : 1); doc['after_script'] = [*doc['after_script']] << (lastjob == 1 ? '%s' : "if [ ${TRAVIS_JOB_NUMBER##*.} == #{lastjob} ]; then %s; fi") % 'rake ci_delete_mirror'; doc['notifications'] = notifications unless doc['notifications']; File.open('.travis.yml.doc', 'w') { |file| file.write doc.to_yaml }; system "git checkout -B #{ci_branch} && rm .appveyor.yml .travis.yml && mv .travis.yml.doc .travis.yml && git add -A . && git commit -qm \"#{escaped_commit_message}\" && git push -qf -u origin #{ci_branch} >/dev/null 2>&1 && git checkout -q -" or abort "Failed to create #{ci_branch} mirror branch" }
|
|
|
|
|
|
|
+ stream.drop(1).each { |doc| branch = doc.delete('branch'); ci = branch['name']; ci_branch = ENV['RELEASE_TAG'] || (ENV['TRAVIS_BRANCH'] == 'master' && ENV['TRAVIS_PULL_REQUEST'] == 'false') ? ci : (ENV['TRAVIS_PULL_REQUEST'] == 'false' ? "#{ENV['TRAVIS_BRANCH']}-#{ci}" : "PR ##{ENV['TRAVIS_PULL_REQUEST']}-#{ci}"); unless (clean || branch['mandatory']) && ((ci_only && ci_only.map { |i| /#{i}/ =~ ci }.any?) || (!ci_only && (branch['active'] || (scan && /Scan/ =~ ci) || (annotate && /Annotate/ =~ ci)))); system "if git fetch origin #{ci_branch}:#{ci_branch} 2>/dev/null; then git push -qf origin --delete #{ci_branch}; fi"; puts "Skipped creating #{ci_branch} mirror branch due to moving HEAD"; next; end; lastjob = doc['matrix'] && doc['matrix']['include'] ? doc['matrix']['include'].length : (doc['env']['matrix'] ? doc['env']['matrix'].length : 1); doc['after_script'] = [*doc['after_script']] << (lastjob == 1 ? '%s' : "if [ ${TRAVIS_JOB_NUMBER##*.} == #{lastjob} ]; then %s; fi") % 'rake ci_delete_mirror'; doc['notifications'] = notifications unless doc['notifications']; File.open('.travis.yml.doc', 'w') { |file| file.write doc.to_yaml }; system "git checkout -B #{ci_branch} && rm .appveyor.yml .travis.yml && mv .travis.yml.doc .travis.yml && git add -A . && git commit -qm \"#{escaped_commit_message}\" && git push -qf -u origin #{ci_branch} >/dev/null 2>&1 && git checkout -q -" or abort "Failed to create #{ci_branch} mirror branch" }
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
# Usage: NOT intended to be used manually
|
|
# Usage: NOT intended to be used manually
|
|
@@ -455,11 +455,12 @@ task :ci_package_upload do
|
|
|
ENV['SITE_UPDATE'] = nil
|
|
ENV['SITE_UPDATE'] = nil
|
|
|
end
|
|
end
|
|
|
elsif !File.exists?("#{ENV['build_tree']}/Docs/html/index.html")
|
|
elsif !File.exists?("#{ENV['build_tree']}/Docs/html/index.html")
|
|
|
- puts "Generating documentation..."
|
|
|
|
|
|
|
+ puts "Generating documentation...\n\n"; $stdout.flush
|
|
|
# Ignore the exit status from 'make doc' on Windows host system only due to Doxygen may not return exit status correctly on Windows
|
|
# Ignore the exit status from 'make doc' on Windows host system only due to Doxygen may not return exit status correctly on Windows
|
|
|
system "bash -c 'rake make target=doc >/dev/null'" or ENV['OS'] or abort 'Failed to generate documentation'
|
|
system "bash -c 'rake make target=doc >/dev/null'" or ENV['OS'] or abort 'Failed to generate documentation'
|
|
|
end
|
|
end
|
|
|
# Make the package
|
|
# Make the package
|
|
|
|
|
+ puts "Packaging artifacts...\n\n"; $stdout.flush
|
|
|
if ENV['IOS']
|
|
if ENV['IOS']
|
|
|
# There is a bug in CMake/CPack that causes the 'package' target failed to build for IOS platform, workaround by calling cpack directly; CMake 3.4 runs the target successfully, however, the result tarball is incomplete (somehow it misses packaging the library itself, another bug?)
|
|
# There is a bug in CMake/CPack that causes the 'package' target failed to build for IOS platform, workaround by calling cpack directly; CMake 3.4 runs the target successfully, however, the result tarball is incomplete (somehow it misses packaging the library itself, another bug?)
|
|
|
system 'cd ../Build && cpack -G TGZ 2>/dev/null' or abort 'Failed to make binary package'
|
|
system 'cd ../Build && cpack -G TGZ 2>/dev/null' or abort 'Failed to make binary package'
|
|
@@ -472,7 +473,8 @@ task :ci_package_upload do
|
|
|
end
|
|
end
|
|
|
if ENV['URHO3D_USE_LIB64_RPM']
|
|
if ENV['URHO3D_USE_LIB64_RPM']
|
|
|
system 'rake cmake' or abort 'Failed to reconfigure to generate 64-bit RPM package'
|
|
system 'rake cmake' or abort 'Failed to reconfigure to generate 64-bit RPM package'
|
|
|
- end
|
|
|
|
|
|
|
+ system "rm #{ENV['build_tree']}/Urho3D-*" or abort 'Failed to remove previously generated artifacts' # This task can be invoked more than one time
|
|
|
|
|
+ end
|
|
|
system "bash -c '#{!ENV['OS'] && (ENV['URHO3D_64BIT'] || ENV['RPI']) ? 'setarch i686' : ''} rake make target=package'" or abort 'Failed to make binary package'
|
|
system "bash -c '#{!ENV['OS'] && (ENV['URHO3D_64BIT'] || ENV['RPI']) ? 'setarch i686' : ''} rake make target=package'" or abort 'Failed to make binary package'
|
|
|
end
|
|
end
|
|
|
# Determine the upload location
|
|
# Determine the upload location
|
|
@@ -517,7 +519,7 @@ EOF'" or abort 'Failed to create release directory remotely'
|
|
|
File.open('.site_updated', 'w') {}
|
|
File.open('.site_updated', 'w') {}
|
|
|
end
|
|
end
|
|
|
# Upload the binary package
|
|
# Upload the binary package
|
|
|
- system "bash -c 'scp #{ENV['build_tree']}/Urho3D-* [email protected]:#{upload_dir} && rm #{ENV['build_tree']}/Urho3D-*'" or abort 'Failed to upload binary package'
|
|
|
|
|
|
|
+ system "bash -c 'scp #{ENV['build_tree']}/Urho3D-* [email protected]:#{upload_dir}'" or abort 'Failed to upload binary package'
|
|
|
if ENV['RELEASE_TAG'] && ENV['SF_DEFAULT']
|
|
if ENV['RELEASE_TAG'] && ENV['SF_DEFAULT']
|
|
|
# Mark the corresponding binary package as default download for each Windows/Mac/Linux host systems
|
|
# Mark the corresponding binary package as default download for each Windows/Mac/Linux host systems
|
|
|
system "bash -c \"curl -H 'Accept: application/json' -X PUT -d 'default=%s' -d \"api_key=$SF_API\" https://sourceforge.net/projects/%s/files/%s/#{ENV['RELEASE_TAG']}/Urho3D-#{ENV['RELEASE_TAG']}-%s\"" % ENV['SF_DEFAULT'].split(':').insert(1, repo.split('/')).flatten or abort 'Failed to set binary tarball/zip as default download'
|
|
system "bash -c \"curl -H 'Accept: application/json' -X PUT -d 'default=%s' -d \"api_key=$SF_API\" https://sourceforge.net/projects/%s/files/%s/#{ENV['RELEASE_TAG']}/Urho3D-#{ENV['RELEASE_TAG']}-%s\"" % ENV['SF_DEFAULT'].split(':').insert(1, repo.split('/')).flatten or abort 'Failed to set binary tarball/zip as default download'
|
|
@@ -738,7 +740,7 @@ end
|
|
|
|
|
|
|
|
def setup_digital_keys
|
|
def setup_digital_keys
|
|
|
system "bash -c 'mkdir -p ~/.ssh && chmod 700 ~/.ssh'" or abort 'Failed to create ~/.ssh directory'
|
|
system "bash -c 'mkdir -p ~/.ssh && chmod 700 ~/.ssh'" or abort 'Failed to create ~/.ssh directory'
|
|
|
- system "bash -c 'ssh-keyscan frs.sourceforge.net >>~/.ssh/known_hosts 2>/dev/null'" or abort 'Failed to append frs.sourceforge.net server public key to known_hosts'
|
|
|
|
|
|
|
+ system "bash -c 'ssh-keyscan frs.sourceforge.net >>~/.ssh/known_hosts >/dev/null 2>&1'" or abort 'Failed to append frs.sourceforge.net server public key to known_hosts'
|
|
|
# Workaround travis encryption key size limitation. Rather than using the solution in their FAQ (using AES to encrypt/decrypt the file and check in the encrypted file into repo), our solution is more pragmatic. The private key below is incomplete. Only the missing portion is encrypted. Much less secure than the original 2048-bit RSA has to offer but good enough for our case.
|
|
# Workaround travis encryption key size limitation. Rather than using the solution in their FAQ (using AES to encrypt/decrypt the file and check in the encrypted file into repo), our solution is more pragmatic. The private key below is incomplete. Only the missing portion is encrypted. Much less secure than the original 2048-bit RSA has to offer but good enough for our case.
|
|
|
system "bash -c 'cat <<EOF >~/.ssh/id_rsa
|
|
system "bash -c 'cat <<EOF >~/.ssh/id_rsa
|
|
|
-----BEGIN RSA PRIVATE KEY-----
|
|
-----BEGIN RSA PRIVATE KEY-----
|