@@ -881,33 +881,56 @@ jobs:
881881 # -------------------------
882882 prepare_hermes_workspace :
883883 docker :
884- - image : debian:buster
884+ - image : debian:bullseye
885885 environment :
886886 - HERMES_WS_DIR : *hermes_workspace_root
887+ - HERMES_VERSION_FILE : " sdks/.hermesversion"
887888 steps :
888- - checkout
889889 - run :
890890 name : Install dependencies
891891 command : |
892- apt-get update
893- apt-get install -y wget git
892+ apt update
893+ apt install -y wget git
894+ - checkout
894895 - run :
895- name : Set up Hermes workspace
896- command : mkdir -p "$HERMES_WS_DIR/hermes" "$HERMES_WS_DIR/download"
896+ name : Set up Hermes workspace and caching
897+ command : |
898+ mkdir -p "/tmp/hermes" "/tmp/hermes/download" "/tmp/hermes/hermes"
899+
900+ if [ -f "$HERMES_VERSION_FILE" ]; then
901+ cat $HERMES_VERSION_FILE > /tmp/hermes/hermesversion
902+ else
903+ HERMES_TAG_SHA=$(git ls-remote https://github.com/facebook/hermes main | cut -f 1 | tr -d '[:space:]')
904+ echo $HERMES_TAG_SHA > /tmp/hermes/hermesversion
905+ fi
906+ - restore_cache :
907+ key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
897908 - run :
898909 name : Download Hermes tarball
899910 command : |
900- HERMES_VERSION_FILE="sdks/.hermesversion"
901911 HERMES_TARBALL_URL="https://github.com/facebook/hermes/archive/refs/heads/main.tar.gz"
912+ HERMES_TARBALL_PATH="$HERMES_WS_DIR/download/hermes.tar.gz"
913+
902914 if [ -f "$HERMES_VERSION_FILE" ]; then
903915 HERMES_TAG=$(cat $HERMES_VERSION_FILE | tr -d '[:space:]')
904916 HERMES_TARBALL_URL="https://github.com/facebook/hermes/archive/refs/tags/$HERMES_TAG.tar.gz"
905917 echo "Using Hermes version tagged $HERMES_TAG"
906918 else
907919 echo "Using Hermes latest version from trunk"
908920 fi
909- wget --timestamping -O "$HERMES_WS_DIR/download/hermes.tar.gz" "$HERMES_TARBALL_URL"
921+
922+ if [ -f "$HERMES_TARBALL_PATH" ]; then
923+ echo "Skipping download; $HERMES_TARBALL_PATH already present."
924+ else
925+ echo "Downloading Hermes tarball from $HERMES_TARBALL_URL"
926+ wget -O "$HERMES_TARBALL_PATH" "$HERMES_TARBALL_URL"
927+ fi
910928 tar -xzf "$HERMES_WS_DIR/download/hermes.tar.gz" --strip-components=1 -C "$HERMES_WS_DIR/hermes"
929+ - save_cache :
930+ key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
931+ paths :
932+ - /tmp/hermes/download/
933+ - /tmp/hermes/hermes/
911934 - persist_to_workspace :
912935 root : *hermes_workspace_root
913936 paths :
@@ -928,22 +951,30 @@ jobs:
928951 apt install -y git openssh-client cmake build-essential \
929952 libreadline-dev libicu-dev zip python3
930953 - *attach_hermes_workspace
954+ - restore_cache :
955+ key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
931956 - run :
932957 name : Set up workspace
933958 command : |
934959 mkdir -p /tmp/hermes/linux64-bin
935960 - run :
936961 name : Build HermesC for Linux
937962 command : |
938- cd /tmp/hermes
939- cmake -S hermes -B build -DHERMES_STATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release \
940- -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DCMAKE_CXX_FLAGS=-s -DCMAKE_C_FLAGS=-s \
941- -DCMAKE_EXE_LINKER_FLAGS="-Wl,--whole-archive -lpthread -Wl,--no-whole-archive"
942- cmake --build build --target check-hermes -j 4
943- - run :
944- name : Package HermesC for Linux
945- command : |
946- cp /tmp/hermes/build/bin/hermesc /tmp/hermes/linux64-bin/.
963+ if [ -f /tmp/hermes/linux64-bin/hermesc ]; then
964+ echo 'Skipping; Clean "/tmp/hermes/linux64-bin" to rebuild.'
965+ else
966+ cd /tmp/hermes
967+ cmake -S hermes -B build -DHERMES_STATIC_LINK=ON -DCMAKE_BUILD_TYPE=Release \
968+ -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DCMAKE_CXX_FLAGS=-s -DCMAKE_C_FLAGS=-s \
969+ -DCMAKE_EXE_LINKER_FLAGS="-Wl,--whole-archive -lpthread -Wl,--no-whole-archive"
970+ cmake --build build --target check-hermes -j 4
971+ cp /tmp/hermes/build/bin/hermesc /tmp/hermes/linux64-bin/.
972+ fi
973+ - save_cache :
974+ key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
975+ paths :
976+ - /tmp/hermes/linux64-bin/
977+ - /tmp/hermes/hermes/destroot/
947978 - store_artifacts :
948979 path : /tmp/hermes/linux64-bin/
949980 - persist_to_workspace :
@@ -957,6 +988,8 @@ jobs:
957988 - HERMES_WS_DIR : *hermes_workspace_root
958989 steps :
959990 - *attach_hermes_workspace
991+ - restore_cache :
992+ key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
960993 - run :
961994 name : Set up workspace
962995 command : |
@@ -968,13 +1001,20 @@ jobs:
9681001 - run :
9691002 name : Build HermesC for macOS
9701003 command : |
971- cd "$HERMES_WS_DIR/hermes"
972- ./utils/build-mac-framework.sh
973- - run :
974- name : Package HermesC for macOS
975- command : |
976- cd "$HERMES_WS_DIR/hermes"
977- cp build_macosx/bin/hermesc /tmp/hermes/osx-bin/.
1004+ if [ -f /tmp/hermes/osx-bin/hermesc ]; then
1005+ echo 'Skipping; Clean "/tmp/hermes/osx-bin" to rebuild.'
1006+ else
1007+ cd "$HERMES_WS_DIR/hermes"
1008+ ./utils/build-mac-framework.sh
1009+ cp build_macosx/bin/hermesc /tmp/hermes/osx-bin/.
1010+ fi
1011+ - save_cache :
1012+ key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "/tmp/hermes/hermesversion" }}
1013+ paths :
1014+ - /tmp/hermes/osx-bin/
1015+ - /tmp/hermes/hermes/destroot/
1016+ - /tmp/hermes/hermes/build_host_hermesc/
1017+ - /tmp/hermes/hermes/build_macosx/
9781018 - store_artifacts :
9791019 path : /tmp/hermes/osx-bin/
9801020 - persist_to_workspace :
@@ -993,6 +1033,8 @@ jobs:
9931033 - CMAKE_DIR : ' C:\Program Files\CMake\bin'
9941034 steps :
9951035 - *attach_hermes_workspace
1036+ - restore_cache :
1037+ key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "tmp/hermes/hermesversion" }}
9961038 - run :
9971039 name : Set up workspace
9981040 command : |
@@ -1001,53 +1043,57 @@ jobs:
10011043 New-Item -ItemType Directory $Env:HERMES_WS_DIR\deps
10021044 New-Item -ItemType Directory $Env:HERMES_WS_DIR\win64-bin
10031045 New-Item -ItemType SymbolicLink -Target tmp\hermes\hermes -Path $Env:HERMES_WS_DIR -Name hermes
1004- - run :
1005- name : Download ICU
1006- command : |
1007- cd $Env:HERMES_WS_DIR\icu
1008- # If Invoke-WebRequest shows a progress bar, it will fail with
1009- # Win32 internal error "Access is denied" 0x5 occurred [...]
1010- $progressPreference = 'silentlyContinue'
1011- Invoke-WebRequest -Uri "$Env:ICU_URL" -OutFile "icu.zip"
1012- Expand-Archive -Path "icu.zip" -DestinationPath "."
1013- - run :
1014- name : Install dependencies
1015- command : |
1016- choco install --no-progress cmake --version 3.14.7
1017- if (-not $?) { throw "Failed to install CMake" }
1018- choco install --no-progress python3
1019- if (-not $?) { throw "Failed to install Python" }
1020- - run :
1021- name : Assemble Windows runtime dependencies
1022- command : |
1023- cd $Env:HERMES_WS_DIR
1024- Copy-Item -Path "icu\bin64\icu*.dll" -Destination "deps"
1025- # Include MSVC++ 2015 redistributables
1026- Copy-Item -Path "c:\windows\system32\msvcp140.dll" -Destination "deps"
1027- Copy-Item -Path "c:\windows\system32\vcruntime140.dll" -Destination "deps"
1028- Copy-Item -Path "c:\windows\system32\vcruntime140_1.dll" -Destination "deps"
10291046 - run :
10301047 name : Build HermesC for Windows
10311048 command : |
1032- $Env:PATH += ";$Env:CMAKE_DIR;$Env:MSBUILD_DIR"
1033- $Env:ICU_ROOT = "$Env:HERMES_WS_DIR\icu"
1034- cd $Env:HERMES_WS_DIR
1035- cmake -S hermes -B build_release -G 'Visual Studio 16 2019' -Ax64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF
1036- if (-not $?) { throw "Failed to configure Hermes" }
1037- cd build_release
1038- cmake --build . --target hermesc --config Release
1039- if (-not $?) { throw "Failed to build Hermes" }
1040- - run :
1041- name : Package HermesC for Windows
1042- command : |
1043- cd $Env:HERMES_WS_DIR
1044- Copy-Item -Path "build_release\bin\Release\hermesc.exe" -Destination "win64-bin"
1045- # Include Windows runtime dependencies
1046- Copy-Item -Path "deps\*" -Destination "win64-bin"
1049+ if (-not(Test-Path -Path $Env:HERMES_WS_DIR\win64-bin\hermesc.exe)) {
1050+ choco install --no-progress cmake --version 3.14.7
1051+ if (-not $?) { throw "Failed to install CMake" }
1052+ choco install --no-progress python3
1053+ if (-not $?) { throw "Failed to install Python" }
1054+
1055+ cd $Env:HERMES_WS_DIR\icu
1056+ # If Invoke-WebRequest shows a progress bar, it will fail with
1057+ # Win32 internal error "Access is denied" 0x5 occurred [...]
1058+ $progressPreference = 'silentlyContinue'
1059+ Invoke-WebRequest -Uri "$Env:ICU_URL" -OutFile "icu.zip"
1060+ Expand-Archive -Path "icu.zip" -DestinationPath "."
1061+
1062+ cd $Env:HERMES_WS_DIR
1063+ Copy-Item -Path "icu\bin64\icu*.dll" -Destination "deps"
1064+ # Include MSVC++ 2015 redistributables
1065+ Copy-Item -Path "c:\windows\system32\msvcp140.dll" -Destination "deps"
1066+ Copy-Item -Path "c:\windows\system32\vcruntime140.dll" -Destination "deps"
1067+ Copy-Item -Path "c:\windows\system32\vcruntime140_1.dll" -Destination "deps"
1068+
1069+ $Env:PATH += ";$Env:CMAKE_DIR;$Env:MSBUILD_DIR"
1070+ $Env:ICU_ROOT = "$Env:HERMES_WS_DIR\icu"
1071+
1072+ cmake -S hermes -B build_release -G 'Visual Studio 16 2019' -Ax64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=True -DHERMES_ENABLE_WIN10_ICU_FALLBACK=OFF
1073+ if (-not $?) { throw "Failed to configure Hermes" }
1074+ cd build_release
1075+ cmake --build . --target hermesc --config Release
1076+ if (-not $?) { throw "Failed to build Hermes" }
1077+
1078+ cd $Env:HERMES_WS_DIR
1079+ Copy-Item -Path "build_release\bin\Release\hermesc.exe" -Destination "win64-bin"
1080+ # Include Windows runtime dependencies
1081+ Copy-Item -Path "deps\*" -Destination "win64-bin"
1082+ }
1083+ else {
1084+ Write-Host "Skipping; Clean c:\tmp\hermes\win64-bin to rebuild."
1085+ }
1086+ - save_cache :
1087+ key : v1-hermes-{{ .Environment.CIRCLE_JOB }}-{{ checksum "tmp/hermes/hermesversion" }}
1088+ paths :
1089+ - C:\tmp\hermes\win64-bin\
1090+ - C:\tmp\hermes\hermes\icu\
1091+ - C:\tmp\hermes\hermes\deps\
1092+ - C:\tmp\hermes\hermes\build_release\
10471093 - store_artifacts :
1048- path : c :\tmp\hermes\win64-bin\
1094+ path : C :\tmp\hermes\win64-bin\
10491095 - persist_to_workspace :
1050- root : c :\tmp\hermes\
1096+ root : C :\tmp\hermes\
10511097 paths :
10521098 - win64-bin
10531099
0 commit comments