diff --git a/build/build.sh b/build/build.sh new file mode 100755 index 0000000..1f8f08d --- /dev/null +++ b/build/build.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +### Windows +# to run with Bash: "C:\Program Files\Git\bin\bash.exe" ./build/build_windows.sh +### + +export INSIDER="no" +export VSCODE_LATEST="no" + +while getopts ":il" opt; do + case "$opt" in + i) + export INSIDER="yes" + ;; + l) + export VSCODE_LATEST="yes" + ;; + esac +done + +case "$OSTYPE" in + darwin*) + export OS_NAME="osx" + ;; + msys* | cygwin*) + export OS_NAME="windows" + ;; + *) + export OS_NAME="linux" + ;; +esac + +UNAME_ARCH=$( uname -m ) + +if [[ "${UNAME_ARCH}" == "arm64" ]]; then + export VSCODE_ARCH="arm64" +else + export VSCODE_ARCH="x64" +fi + +echo "OS_NAME: ${OS_NAME}" +echo "VSCODE_ARCH: ${VSCODE_ARCH}" +echo "VSCODE_LATEST: ${VSCODE_LATEST}" +echo "INSIDER: ${INSIDER}" + +rm -rf vscode* VSCode* + +if [[ "${OS_NAME}" == "windows" ]]; then + rm -rf build/windows/msi/releasedir +fi + +. get_repo.sh + +SHOULD_BUILD=yes CI_BUILD=no . build.sh diff --git a/build/build_linux.sh b/build/build_linux.sh deleted file mode 100755 index b799cd2..0000000 --- a/build/build_linux.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -rm -rf VSCode* -rm -rf vscode* - -if [[ "${1}" == "insider" ]]; then - export INSIDER="yes" -fi - -. get_repo.sh - -SHOULD_BUILD=yes CI_BUILD=no OS_NAME=linux VSCODE_ARCH=x64 . build.sh diff --git a/build/build_macos.sh b/build/build_macos.sh deleted file mode 100755 index 9053796..0000000 --- a/build/build_macos.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -rm -rf VSCode* -rm -rf vscode* - -UNAME_ARCH=$( uname -m ) - -if [[ "${UNAME_ARCH}" == "arm64" ]]; then - export VSCODE_ARCH="arm64" -else - export VSCODE_ARCH="x64" -fi - -echo "-- VSCODE_ARCH: ${VSCODE_ARCH}" - -if [[ "${1}" == "insider" ]]; then - export INSIDER="yes" -fi - -. get_repo.sh - -SHOULD_BUILD=yes CI_BUILD=no OS_NAME=osx . build.sh diff --git a/build/build_windows.sh b/build/build_windows.sh deleted file mode 100755 index f8820d0..0000000 --- a/build/build_windows.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# to run with Bash: "C:\Program Files\Git\bin\bash.exe" ./build/build_windows.sh - -rm -rf VSCode* -rm -rf vscode* -rm -rf build/windows/msi/releasedir - -if [[ "${1}" == "insider" ]]; then - export INSIDER="yes" -fi - -. get_repo.sh - -SHOULD_BUILD=yes CI_BUILD=no OS_NAME=windows VSCODE_ARCH=x64 . build.sh diff --git a/get_repo.sh b/get_repo.sh index 8d19993..2790c79 100755 --- a/get_repo.sh +++ b/get_repo.sh @@ -8,18 +8,26 @@ if [[ "${CI_BUILD}" != "no" ]]; then fi if [[ -z "${RELEASE_VERSION}" ]]; then - if [ "${INSIDER}" == "yes" ]; then - UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/insider/lol) + if [[ "${INSIDER}" == "yes" ]]; then + if [[ "${VSCODE_LATEST}" == "yes" ]] || [[ ! -f "insider.json" ]]; then + UPDATE_INFO=$( curl https://update.code.visualstudio.com/api/update/darwin/insider/lol ) + else + export MS_COMMIT=$(jq -r '.commit' insider.json) + export MS_TAG=$(jq -r '.tag' insider.json) + fi else - UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/stable/lol) + UPDATE_INFO=$( curl https://update.code.visualstudio.com/api/update/darwin/stable/lol ) + fi + + if [[ -z "${MS_COMMIT}" ]]; then + export MS_COMMIT=$( echo "${UPDATE_INFO}" | jq -r '.version' ) + export MS_TAG=$( echo "${UPDATE_INFO}" | jq -r '.name' ) fi - export MS_COMMIT=$(echo "${UPDATE_INFO}" | jq -r '.version') - export MS_TAG=$(echo "${UPDATE_INFO}" | jq -r '.name') date=$( date +%Y%j ) - if [ "${INSIDER}" == "yes" ]; then - export RELEASE_VERSION="${MS_TAG/-insider/}.${date: -5}-insider" + if [[ "${INSIDER}" == "yes" ]]; then + export RELEASE_VERSION="${MS_TAG/\-insider/}.${date: -5}-insider" else export RELEASE_VERSION="${MS_TAG}.${date: -5}" fi @@ -43,13 +51,13 @@ git remote add origin https://github.com/Microsoft/vscode.git # figure out latest tag by calling MS update API if [[ -z "${MS_TAG}" ]]; then - if [ "${INSIDER}" == "yes" ]; then - UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/insider/lol) + if [[ "${INSIDER}" == "yes" ]]; then + UPDATE_INFO=$( curl https://update.code.visualstudio.com/api/update/darwin/insider/lol ) else - UPDATE_INFO=$(curl https://update.code.visualstudio.com/api/update/darwin/stable/lol) + UPDATE_INFO=$( curl https://update.code.visualstudio.com/api/update/darwin/stable/lol ) fi - export MS_COMMIT=$(echo "${UPDATE_INFO}" | jq -r '.version') - export MS_TAG=$(echo "${UPDATE_INFO}" | jq -r '.name') + export MS_COMMIT=$( echo "${UPDATE_INFO}" | jq -r '.version' ) + export MS_TAG=$( echo "${UPDATE_INFO}" | jq -r '.name' ) elif [[ -z "${MS_COMMIT}" ]]; then reference=$( git ls-remote --tags | grep -x ".*refs\/tags\/${MS_TAG}" | head -1 ) diff --git a/insider.json b/insider.json new file mode 100644 index 0000000..a0530e2 --- /dev/null +++ b/insider.json @@ -0,0 +1,4 @@ +{ + "tag": "1.71.0", + "commit": "8e42bda5487a953d59fab7792eedd4ca209cabba" +}