Initial VS Code 1.19 source merge (#571)

* Initial 1.19 xcopy

* Fix yarn build

* Fix numerous build breaks

* Next batch of build break fixes

* More build break fixes

* Runtime breaks

* Additional post merge fixes

* Fix windows setup file

* Fix test failures.

* Update license header blocks to refer to source eula
This commit is contained in:
Karl Burtram
2018-01-28 23:37:17 -08:00
committed by GitHub
parent 9a1ac20710
commit 251ae01c3e
8009 changed files with 93378 additions and 35634 deletions

View File

@@ -1 +1,2 @@
pat
pat
*.js

View File

@@ -5,6 +5,7 @@
. ./build/tfs/common/common.sh
export ARCH="$1"
export npm_config_arch="$ARCH"
export VSCODE_MIXIN_PASSWORD="$2"
export AZURE_STORAGE_ACCESS_KEY="$3"
export AZURE_STORAGE_ACCESS_KEY_2="$4"
@@ -16,7 +17,7 @@ VSO_PAT="$8"
echo "machine monacotools.visualstudio.com password $VSO_PAT" > ~/.netrc
step "Install dependencies" \
npm install --arch=$ARCH --unsafe-perm
yarn
step "Hygiene" \
npm run gulp -- hygiene
@@ -28,7 +29,7 @@ step "Get Electron" \
npm run gulp -- "electron-$ARCH"
step "Install distro dependencies" \
node build/tfs/common/installDistro.js --arch=$ARCH
node build/tfs/common/installDistro.js
step "Build minified" \
npm run gulp -- "vscode-linux-$ARCH-min"

View File

@@ -0,0 +1,42 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import { DocumentClient } from 'documentdb';
interface Config {
id: string;
frozen: boolean;
}
function createDefaultConfig(quality: string): Config {
return {
id: quality,
frozen: false
};
}
function getConfig(quality: string): Promise<Config> {
const client = new DocumentClient(process.env['AZURE_DOCUMENTDB_ENDPOINT'], { masterKey: process.env['AZURE_DOCUMENTDB_MASTERKEY'] });
const collection = 'dbs/builds/colls/config';
const query = {
query: `SELECT TOP 1 * FROM c WHERE c.id = @quality`,
parameters: [
{ name: '@quality', value: quality }
]
};
return new Promise<Config>((c, e) => {
client.queryDocuments(collection, query).toArray((err, results) => {
if (err && err.code !== 409) { return e(err); }
c(!results || results.length === 0 ? createDefaultConfig(quality) : results[0] as any as Config);
});
});
}
getConfig(process.argv[2])
.then(c => console.log(c.frozen), e => console.error(e));

View File

@@ -0,0 +1,6 @@
{
"name": "PACKAGENAME",
"version": "PACKAGEVERSION",
"repositoryId": "REPOSITORYID",
"sourceUrl": "PACKAGEURL"
}

View File

@@ -12,10 +12,6 @@ step "Build RPM package" \
# step "Build snap package" \
# npm run gulp -- "vscode-linux-$ARCH-build-snap"
(cd $BUILD_SOURCESDIRECTORY/build/tfs/common && \
step "Install build dependencies" \
npm install --unsafe-perm)
# Variables
PLATFORM_LINUX="linux-$ARCH"
PLATFORM_DEB="linux-deb-$ARCH"
@@ -55,36 +51,29 @@ step "Publish RPM package" \
# SNAP_FILENAME="$(ls $REPO/.build/linux/snap/$ARCH/ | grep .snap)"
# SNAP_PATH="$REPO/.build/linux/snap/$ARCH/$SNAP_FILENAME"
IS_FROZEN="$(node build/tfs/linux/frozen-check.js $VSCODE_QUALITY)"
if [ -z "$VSCODE_QUALITY" ]; then
echo "VSCODE_QUALITY is not set, skipping repo package publish"
elif [ "$IS_FROZEN" = "true" ]; then
echo "$VSCODE_QUALITY is frozen, skipping repo package publish"
else
if [ "$BUILD_SOURCEBRANCH" = "master" ] || [ "$BUILD_SOURCEBRANCH" = "refs/heads/master" ]; then
if [[ $BUILD_QUEUEDBY = *"Project Collection Service Accounts"* || $BUILD_QUEUEDBY = *"Microsoft.VisualStudio.Services.TFS"* ]]; then
# Get necessary information
pushd $REPO && COMMIT_HASH=$(git rev-parse HEAD) && popd
PACKAGE_NAME="$(ls $REPO/.build/linux/deb/$DEB_ARCH/deb/ | sed -e 's/_.*//g')"
DEB_URL="https://az764295.vo.msecnd.net/$VSCODE_QUALITY/$COMMIT_HASH/$DEB_FILENAME"
RPM_URL="https://az764295.vo.msecnd.net/$VSCODE_QUALITY/$COMMIT_HASH/$RPM_FILENAME"
PACKAGE_VERSION="$(ls $REPO/.build/linux/deb/$DEB_ARCH/deb/ | sed -e 's/code-[a-z]*_//g' -e 's/\_.*$//g')"
# Write config files needed by API, use eval to force environment variable expansion
DIRNAME=$(dirname $(readlink -f $0))
pushd $DIRNAME
# Submit to apt repo
if [ "$DEB_ARCH" = "amd64" ]; then
eval echo '{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4adf642421134a1a48d1a\", \"username\": \"$LINUX_REPO_USERNAME\", \"password\": \"$LINUX_REPO_PASSWORD\" }' > apt-config.json
eval echo '{ \"name\": \"$PACKAGE_NAME\", \"version\": \"$PACKAGE_VERSION\", \"repositoryId\": \"58a4adf642421134a1a48d1a\", \"sourceUrl\": \"$DEB_URL\" }' > apt-addpkg.json
echo "Submitting apt-addpkg.json:"
cat apt-addpkg.json
step "Publish to repositories" \
./repoapi_client.sh -config apt-config.json -addpkg apt-addpkg.json
./repoapi_client.sh -config apt-config.json -addfile $DEB_PATH
fi
# Submit to yum repo (disabled as it's manual until signing is automated)
# eval echo '{ \"server\": \"azure-apt-cat.cloudapp.net\", \"protocol\": \"https\", \"port\": \"443\", \"repositoryId\": \"58a4ae3542421134a1a48d1b\", \"username\": \"$LINUX_REPO_USERNAME\", \"password\": \"$LINUX_REPO_PASSWORD\" }' > yum-config.json
# eval echo '{ \"name\": \"$PACKAGE_NAME\", \"version\": \"$PACKAGE_VERSION\", \"repositoryId\": \"58a4ae3542421134a1a48d1b\", \"sourceUrl\": \"$RPM_URL\" }' > yum-addpkg.json
# echo "Submitting yum-addpkg.json:"
# cat yum-addpkg.json
# ./repoapi_client.sh -config yum-config.json -addpkg yum-addpkg.json
# ./repoapi_client.sh -config yum-config.json -addfile $RPM_PATH
popd
echo "To check repo publish status run ./repoapi_client.sh -config config.json -check <id>"
fi

View File

@@ -2,9 +2,9 @@
# This is a VERY basic script for Create/Delete operations on repos and packages
#
cmd=$1
urls=urls.txt
defaultPackageFile=new_package.json
defaultRepoFile=new_repo.json
docDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # chrmarti: Changed to script's directory.
packageJsonTemplate=$docDir/new_package.json.template
repoJsonTemplate=$docDir/new_repo.json.template
function Bail
{
@@ -24,14 +24,21 @@ function Usage {
echo "$0 -config FILENAME -listrepos | -listpkgs | -addrepo FILENAME | -addpkg FILENAME |"
echo "-addpkgs FILENAME | -check ID | -delrepo REPOID | -delpkg PKGID"
echo -e "\t-config FILENAME : JSON file containing API server name and creds"
echo -e "\t-listrepos : List repositories"
echo -e "Package Operations:"
echo -e "\t-listpkgs [REGEX] : List packages, optionally filter by REGEX"
echo -e "\t-addrepo FILENAME : Create a new repo using the specified JSON file"
echo -e "\t-addpkg FILENAME : Add package to repo using the specified JSON file"
echo -e "\t-addpkgs FILENAME : Add packages to repo using urls contained in FILENAME"
echo -e "\t-check ID : Check upload operation by ID"
echo -e "\t-delrepo REPOID : Delete the specified repo by ID"
echo -e "\t-delpkg PKGID : Delete the specified package by ID"
echo -e "File Operations:"
echo -e "\t-uploadfile FILENAME: Upload FILENAME (does not publish) "
echo -e "\t-addfile FILENAME : Upload FILENAME AND publish to the repo"
echo -e "\t-listfiles : List uploaded files"
echo -e "\t-delfile FILEID : Delete uploaded file by ID"
echo -e "Repository Operations:"
echo -e "\t-listrepos : List repositories"
echo -e "\t-addrepo FILENAME : Create a new repo using the specified JSON file"
echo -e "\t-delrepo REPOID : Delete the specified repo by ID"
exit 1
}
@@ -84,33 +91,136 @@ function AddRepo
{
repoFile=$1
if [ -z $repoFile ]; then
Bail "Error: Must specify a JSON-formatted file. Reference $defaultRepoFile.template"
Bail "Error: Must specify a JSON-formatted file. Reference $repoJsonTemplate"
fi
if [ ! -f $repoFile ]; then
Bail "Error: Cannot create repo - $repoFile does not exist"
fi
packageUrl=$(grep "url" $repoFile | head -n 1 | awk '{print $2}' | tr -d ',')
echo "Creating new repo on $server [$packageUrl]"
curl -i -k "$baseurl/v1/repositories" --data @./$repoFile -H "Content-Type: application/json"
curl -i -k "$baseurl/v1/repositories" --data @$repoFile -H "Content-Type: application/json"
echo ""
}
# Upload AND publish the file
function AddFile
{
packageFile=$1
# Validity checks are performed by UploadFile
echo "Uploading package to $server [$packageFile]"
response=$(UploadFile $packageFile "true")
id=$(echo $response | jq -r ".id")
# Parse package metadata first to confirm it's a valid deb/rpm
# Needs to be performed in this function so we can use it to publish the package
jsonFile=$(WritePackageInfoToFile $packageFile)
sed -i "s/REPOSITORYID/$repositoryId/g" $jsonFile
# Replace the url field with fileId
sed -i "s/PACKAGEURL/$id/g" $jsonFile
sed -i "s/sourceUrl/fileId/g" $jsonFile
AddPackage $jsonFile
rm -f $jsonFile
echo ""
}
# Upload a file
function UploadFile
{
packageFile=$1
quick=$2
if [ -z $packageFile ]; then
Bail "Error: Must specify the path to a file to upload "
fi
if [ ! -f $packageFile ]; then
Bail "Error: Cannot upload - $packageFile does not exist"
fi
# Additional validation and output if quick mode isn't enabled
# Basically, if this is part of a publish operation, these steps are handled elsewhere
if [ "$quick" != "true" ]; then
# Parse package metadata first to confirm it's a valid deb/rpm
jsonFile=$(WritePackageInfoToFile $packageFile)
rm -f $jsonFile
echo "Uploading package to $server [$packageFile]"
fi
curl -s -k -X POST -F file=@$packageFile "$baseurl/v1/files"
echo ""
}
function ListFiles
{
curl -s -k "$baseurl/v1/files" | jq
}
function DeleteFile
{
fileId=$1
if [ -z "$fileId" ]; then
Bail "Error: Must specify an ID to delete"
fi
curl -s -X DELETE "$baseurl/v1/files/$fileId"
}
# Upload a single package using the specified JSON file
function AddPackage
{
packageFile=$1
if [ -z $packageFile ]; then
Bail "Error: Must specify a JSON-formatted file. Reference $defaultPackageFile.template"
Bail "Error: Must specify a JSON-formatted file. Reference $packageJsonTemplate"
fi
if [ ! -f $packageFile ]; then
Bail "Error: Cannot add package - $packageFile does not exist"
fi
packageUrl=$(grep "sourceUrl" $packageFile | head -n 1 | awk '{print $2}')
echo "Adding package to $server [$packageUrl]"
curl -i -k "$baseurl/v1/packages" --data @./$packageFile -H "Content-Type: application/json"
curl -i -k "$baseurl/v1/packages" --data @$packageFile -H "Content-Type: application/json"
echo ""
}
# Gets the package name and version and writes it to a file
function WritePackageInfoToFile
{
packageFile=$1
tmpOut=$(mktemp)
if [ -z "$packageFile" ]; then
Bail "Error: Must specify path to a deb/rpm package"
elif [ ! -f "$packageFile" ]; then
Bail "Error: Specified file $packageFile does not exist"
fi
if dpkg -I $packageFile > $tmpOut 2> /dev/null; then
>&2 echo "File is deb format"
pkgName=$(grep "^\s*Package:" $tmpOut | awk '{print $2}')
pkgVer=$(grep "^\s*Version:" $tmpOut | awk '{print $2}')
elif rpm -qpi $packageFile > $tmpOut 2> /dev/null; then
>&2 echo "File is rpm format"
pkgName=$(egrep "^Name" $tmpOut | tr -d ':' | awk '{print $2}')
pkgVer=$(egrep "^Version" $tmpOut | tr -d ':' | awk '{print $2}')
else
rm -f $tmpOut
Bail "File is not a valid deb/rpm package $url"
fi
rm -f $tmpOut
if [ -z "$pkgName" ]; then
Bail "Unable to parse package name for $url"
elif [ -z "$pkgVer" ]; then
Bail "Unable to parse package version number for $url"
fi
# Create Package .json file
outJson=$(mktemp)
escapedUrl=$(echo "$url" | sed 's/\//\\\//g' | sed 's/\&/\\\&/g')
cp $packageJsonTemplate $outJson
sed -i "s/PACKAGENAME/$pkgName/g" $outJson
sed -i "s/PACKAGEVERSION/$pkgVer/g" $outJson
# Return path to json file
echo $outJson
}
# Upload a single package by dynamically creating a JSON file using a provided URL
function AddPackageByUrl
{
@@ -119,41 +229,20 @@ function AddPackageByUrl
Bail "Unable to publish package because no URL was specified"
fi
tmpFile=$(mktemp)
tmpOut=$(mktemp)
if ! wget -q "$url" -O $tmpFile; then
rm -f $tmpFile $tmpFile
rm -f $tmpFile
Bail "Unable to download URL $url"
elif dpkg -I $tmpFile > $tmpOut 2> /dev/null; then
echo "File is deb format"
pkgName=$(grep "^\s*Package:" $tmpOut | awk '{print $2}')
pkgVer=$(grep "^\s*Version:" $tmpOut | awk '{print $2}')
elif rpm -qpi $tmpFile > $tmpOut 2> /dev/null; then
echo "File is rpm format"
pkgName=$(egrep "^Name" $tmpOut | tr -d ':' | awk '{print $2}')
pkgVer=$(egrep "^Version" $tmpOut | tr -d ':' | awk '{print $2}')
else
rm -f $tmpFile $tmpOut
Bail "File is not a valid deb/rpm package $url"
fi
rm -f $tmpFile $tmpOut
if [ -z "$pkgName" ]; then
Bail "Unable to parse package name for $url"
elif [ -z "$pkgVer" ]; then
Bail "Unable to parse package version number for $url"
fi
jsonFile=$(WritePackageInfoToFile $tmpFile)
# Create Package .json file
escapedUrl=$(echo "$url" | sed 's/\//\\\//g' | sed 's/\&/\\\&/g')
cp $defaultPackageFile.template $defaultPackageFile
sed -i "s/PACKAGENAME/$pkgName/g" $defaultPackageFile
sed -i "s/PACKAGEVERSION/$pkgVer/g" $defaultPackageFile
sed -i "s/PACKAGEURL/$escapedUrl/g" $defaultPackageFile
sed -i "s/REPOSITORYID/$repositoryId/g" $defaultPackageFile
sed -i "s/PACKAGEURL/$escapedUrl/g" $jsonFile
sed -i "s/REPOSITORYID/$repositoryId/g" $jsonFile
# Perform Upload
AddPackage $defaultPackageFile
AddPackage $jsonFile
# Cleanup
rm -f $defaultPackageFile
rm -f $jsonFile
}
# Upload multiple packages by reading urls line-by-line from the specified file
@@ -180,7 +269,7 @@ function CheckUpload {
if [ -z "$id" ]; then
Bail "Must specify an ID"
fi
curl -k $baseurl/v1/packages/queue/$id
curl -s -k $baseurl/v1/packages/queue/$id | jq
echo ""
}
@@ -232,6 +321,20 @@ while (( "$#" )); do
operation=AddPackages
shift
operand="$1"
elif [[ "$1" == "-addfile" ]]; then
operation=AddFile
shift
operand="$1"
elif [[ "$1" == "-uploadfile" ]]; then
operation=UploadFile
shift
operand="$1"
elif [[ "$1" == "-listfiles" ]]; then
operation=ListFiles
elif [[ "$1" == "-delfile" ]]; then
operation=DeleteFile
shift
operand="$1"
elif [[ "$1" == "-check" ]]; then
operation=CheckUpload
shift