diff --git a/.circleci/config.yml b/.circleci/config.yml index 7e5448bcd..f49bbfc3f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,13 +14,19 @@ jobs: command: script/bootstrap - run: name: Update - command: script/update --clean -t $TARGET_ARCH + command: script/update --clean -t $TARGET_ARCH --use-bundled-sccache + - run: + name: Check sccache stats before build + command: script/sccache -s - run: name: Build shared library command: script/build -t $TARGET_ARCH -c $COMPONENT - run: name: Build FFmpeg command: script/build -t $TARGET_ARCH -c ffmpeg + - run: + name: Check sccache stats after build + command: script/sccache -s - run: name: Create distribution command: script/create-dist -t $TARGET_ARCH -c $COMPONENT @@ -50,7 +56,7 @@ jobs: command: script/bootstrap - run: name: Update - command: script/update --clean -t $TARGET_ARCH + command: script/update --clean -t $TARGET_ARCH --use-bundled-sccache - run: name: Build static library command: script/build -t $TARGET_ARCH -c $COMPONENT @@ -86,7 +92,7 @@ jobs: command: script/bootstrap - run: name: Update - command: script/update --clean -t $TARGET_ARCH + command: script/update --clean -t $TARGET_ARCH --use-bundled-sccache - run: name: Build shared library command: script/build -t $TARGET_ARCH -c $COMPONENT @@ -122,7 +128,7 @@ jobs: command: script/bootstrap - run: name: Update - command: script/update --clean -t $TARGET_ARCH + command: script/update --clean -t $TARGET_ARCH --use-bundled-sccache - run: name: Build static library command: script/build -t $TARGET_ARCH -c $COMPONENT @@ -158,7 +164,7 @@ jobs: command: script/bootstrap - run: name: Update - command: script/update --clean -t $TARGET_ARCH + command: script/update --clean -t $TARGET_ARCH --use-bundled-sccache - run: name: Build mksnapshot command: script/build -t $TARGET_ARCH -c native_mksnapshot @@ -202,7 +208,7 @@ jobs: command: script/bootstrap - run: name: Update - command: script/update --clean -t $TARGET_ARCH + command: script/update --clean -t $TARGET_ARCH --use-bundled-sccache - run: name: Build static library command: script/build -t $TARGET_ARCH -c $COMPONENT @@ -238,7 +244,7 @@ jobs: command: script/bootstrap - run: name: Update - command: script/update --clean -t $TARGET_ARCH + command: script/update --clean -t $TARGET_ARCH --use-bundled-sccache - run: name: Build mksnapshot command: script/build -t $TARGET_ARCH -c native_mksnapshot @@ -282,7 +288,7 @@ jobs: command: script/bootstrap - run: name: Update - command: script/update --clean -t $TARGET_ARCH + command: script/update --clean -t $TARGET_ARCH --use-bundled-sccache - run: name: Build static library command: script/build -t $TARGET_ARCH -c $COMPONENT @@ -318,7 +324,7 @@ jobs: command: script/bootstrap - run: name: Update - command: script/update --clean -t $TARGET_ARCH + command: script/update --clean -t $TARGET_ARCH --use-bundled-sccache - run: name: Build shared library command: script/build -t $TARGET_ARCH -c $COMPONENT @@ -354,7 +360,7 @@ jobs: command: script/bootstrap - run: name: Update - command: script/update --clean -t $TARGET_ARCH + command: script/update --clean -t $TARGET_ARCH --use-bundled-sccache - run: name: Build static library command: script/build -t $TARGET_ARCH -c $COMPONENT diff --git a/appveyor.yml b/appveyor.yml index 916c380e3..138c75bd3 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -17,14 +17,18 @@ build_script: if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) { Write-warning "Skipping PR build for branch"; Exit-AppveyorBuild } else { - script\cibuild.ps1 + script\cibuild.ps1 -useSccache if ($? -ne 'True') { throw "Build failed with exit code $?" } else { "Build succeeded." } } -test: off +test_script: +- ps: >- + Write-Output "sccache stats:" + python script\sccache -s + artifacts: - path: libchromiumcontent.zip name: libchromiumcontent.zip diff --git a/script/cibuild b/script/cibuild index 67d3abd36..12bbe30a2 100755 --- a/script/cibuild +++ b/script/cibuild @@ -18,6 +18,7 @@ S3_CREDENTIALS_FILE = os.path.join(JENKINS_ROOT, 'config', 's3credentials') def main(): args = parse_args() skip_upload = args.skip_upload + use_sccache = args.use_sccache if (not skip_upload and not 'LIBCHROMIUMCONTENT_S3_ACCESS_KEY' in os.environ and @@ -34,23 +35,25 @@ def main(): if 'TARGET_ARCH' in os.environ: args = ['-t', os.environ['TARGET_ARCH']] - return run_ci(args, skip_upload, os.environ['COMPONENT']) + return run_ci(args, skip_upload, use_sccache, os.environ['COMPONENT']) if sys.platform in ['win32', 'cygwin']: - return (run_ci(['-t', 'x64'], skip_upload) or - run_ci(['-t', 'ia32'], skip_upload)) + return (run_ci(['-t', 'x64'], skip_upload, use_sccache) or + run_ci(['-t', 'ia32'], skip_upload, use_sccache)) elif sys.platform == 'linux2': - return (run_ci(['-t', 'x64'], skip_upload) or - run_ci(['-t', 'ia32'], skip_upload) or - run_ci(['-t', 'arm'], skip_upload) or - run_ci(['-t', 'arm64'], skip_upload)) + return (run_ci(['-t', 'x64'], skip_upload, use_sccache) or + run_ci(['-t', 'ia32'], skip_upload, use_sccache) or + run_ci(['-t', 'arm'], skip_upload, use_sccache) or + run_ci(['-t', 'arm64'], skip_upload, use_sccache)) else: - return run_ci([], skip_upload) + return run_ci([], skip_upload, use_sccache) def parse_args(): parser = argparse.ArgumentParser(description='Run CI build') parser.add_argument('-s', '--skip_upload', action='store_true', help='Skip uploading to S3') + parser.add_argument('--use_sccache', action='store_true', + help='Use sccache binary stored in with the libcc repo.') return parser.parse_args() def copy_to_environment(credentials_file): @@ -72,9 +75,12 @@ def os_version(): return platform.platform() -def run_ci(args, skip_upload, component=None): +def run_ci(args, skip_upload, use_sccache, component=None): build_args = [] component_args = [] + update_args = ['--clean'] + args + if use_sccache: + update_args += ['--use-bundled-sccache'] if component is not None: component_args = ['-c', component] build_args += component_args + ['ffmpeg'] @@ -88,7 +94,7 @@ def run_ci(args, skip_upload, component=None): os.environ.update(vs_env) return (run_script('bootstrap') or - run_script('update', ['--clean'] + args) or + run_script('update', update_args) or run_script('build', args + build_args) or run_script('create-dist', args + component_args) or run_script('upload', args, skip_upload)) diff --git a/script/cibuild.ps1 b/script/cibuild.ps1 index 8f0399c18..854042110 100644 --- a/script/cibuild.ps1 +++ b/script/cibuild.ps1 @@ -1,4 +1,4 @@ -param([switch]$skipUpload) +param([switch]$skipUpload, [switch]$useSccache) function Run-Command([scriptblock]$Command, [switch]$Fatal, [switch]$Quiet) { $output = "" try { @@ -33,8 +33,13 @@ function Run-Command([scriptblock]$Command, [switch]$Fatal, [switch]$Quiet) { } Write-Output "" +$CommandLine = "python .\script\cibuild" if ($skipUpload) { - Run-Command -Fatal { python .\script\cibuild --skip_upload } -} else { - Run-Command -Fatal { python .\script\cibuild } + $CommandLine += " --skip_upload" } + +if ($useSccache) { + $CommandLine += " --use_sccache" +} +$CICommand = [ScriptBlock]::Create($CommandLine) +Run-Command -Fatal $CICommand diff --git a/tools/sccache/0.2.6/linux/sccache b/tools/sccache/0.2.6/linux/sccache index a9b4140e5..3ef4d1420 100755 Binary files a/tools/sccache/0.2.6/linux/sccache and b/tools/sccache/0.2.6/linux/sccache differ diff --git a/tools/sccache/0.2.6/mac/sccache b/tools/sccache/0.2.6/mac/sccache index 7da6659a8..4d33993e2 100755 Binary files a/tools/sccache/0.2.6/mac/sccache and b/tools/sccache/0.2.6/mac/sccache differ diff --git a/tools/sccache/0.2.6/windows/sccache.exe b/tools/sccache/0.2.6/windows/sccache.exe index 308a50dfe..021e8c6c8 100755 Binary files a/tools/sccache/0.2.6/windows/sccache.exe and b/tools/sccache/0.2.6/windows/sccache.exe differ diff --git a/vsts.yml b/vsts.yml index 4d4dc16e6..17ff303cf 100644 --- a/vsts.yml +++ b/vsts.yml @@ -47,18 +47,19 @@ phases: - bash: | echo "===Updating for $TARGET_ARCH===" > >(tee -a buildlog.txt) 2> >(tee -a buildlog.txt >&2) - script/update --clean -t $TARGET_ARCH > >(tee -a buildlog.txt) 2> >(tee -a buildlog.txt >&2) + script/update --clean -t $TARGET_ARCH --use-bundled-sccache > >(tee -a buildlog.txt) 2> >(tee -a buildlog.txt >&2) name: Update - bash: | + export SCCACHE_AZURE_BLOB_CONTAINER=$(SCCACHE_BLOB_CONTAINER) + export SCCACHE_AZURE_CONNECTION_STRING=$(SCCACHE_AZURE_CONNECTION) + script/sccache -s > >(tee -a buildlog.txt) 2> >(tee -a buildlog.txt >&2) echo "===Building $COMPONENT for $TARGET_ARCH===" > >(tee -a buildlog.txt) 2> >(tee -a buildlog.txt >&2) script/build -t $TARGET_ARCH -c $COMPONENT > >(tee -a buildlog.txt) 2> >(tee -a buildlog.txt >&2) - name: Build_library - - - bash: | echo "===Building ffmpeg for $TARGET_ARCH===" > >(tee -a buildlog.txt) 2> >(tee -a buildlog.txt >&2) script/build -t $TARGET_ARCH -c ffmpeg > >(tee -a buildlog.txt) 2> >(tee -a buildlog.txt >&2) - name: Build_ffmpeg + script/sccache -s > >(tee -a buildlog.txt) 2> >(tee -a buildlog.txt >&2) + name: Build - bash: | echo "===Create $COMPONENT distribution for $TARGET_ARCH===" > >(tee -a buildlog.txt) 2> >(tee -a buildlog.txt >&2) @@ -98,3 +99,4 @@ phases: fi - task: mspremier.PostBuildCleanup.PostBuildCleanup-task.PostBuildCleanup@3 + condition: always()