Delete unused scripts Linux (#1220)

This commit is contained in:
Bart Louwers
2023-06-08 11:04:45 +02:00
committed by GitHub
parent 3260d32bb0
commit 69805ad563
14 changed files with 0 additions and 533 deletions

View File

@@ -1,11 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
JOB=$1
if [ ! -z "${AWS_ACCESS_KEY_ID}" ] && [ ! -z "${AWS_SECRET_ACCESS_KEY}" ] ; then
aws s3 cp --recursive --acl public-read --exclude "*" --include "*/actual.png" test/fixtures \
s3://mapbox/mapbox-gl-native/render-tests/$JOB
fi

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [ "${TRAVIS_PULL_REQUEST_BRANCH:-${TRAVIS_BRANCH}}" = "main" ] && [ "${BUILDTYPE}" = "Release" ]; then
CLOUDWATCH=true platform/linux/scripts/metrics.sh
else
echo "Not logging binary size for branch or Debug build"
fi

View File

@@ -1,11 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
# Generate stripped version
ARCH=$(uname -m)
RENDER=build/linux-${ARCH}/Release/mbgl-render
strip -s -x "${RENDER}" -o "${RENDER}-stripped"
scripts/check_binary_size.js "${RENDER}-stripped" "Linux"

View File

@@ -1,37 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
# Treats all characters as bytes, removes Unicode awareness from (broken?) macOS sed.
export LC_ALL=C
if [ `uname -s` = 'Darwin' ]; then
# BSD sed accepts a file extension.
SED="sed -i''"
else
# GNU sed does not.
SED="sed -i"
fi
# Gather list of files
FILES=$(git ls-files "*.hpp" "*.cpp" "*.h" "*.mm" "*.m" "*.c" "*.java" "*.xml" "*.ejs" "*.gradle" |
sed '/^platform\/android\/MapboxGLAndroidSDK\/src\/main\/java\/com\/almeros\// d;/^src\/clipper\// d;/^platform\/ios\/uitest\/OCMock/d')
# Adds trailing newlines to files.
echo "Checking for missing trailing newlines..."
echo "${FILES}" | tr '\n' '\0' | xargs -0 ${SED} -e '$a\'
# Removes trailing whitespace.
echo "Checking for trailing whitespace..."
echo "${FILES}" | tr '\n' '\0' | xargs -0 ${SED} 's/ *$// '
# Add space after // comments. Does not replace // within double quotes.
# Part of the regex is from http://stackoverflow.com/a/11503678
echo "Checking for missing spaces after comments..."
echo "${FILES}" | tr '\n' '\0' | xargs -0 perl -p -i -e 's/(?<!(:|\/))\/\/(?=[^ \/\n])(?=(?:[^"]*"[^"]*")*[^"]*\Z)/\/\/ /g'
git diff --exit-code -- ${FILES} || {
echo "Some files were modified during code style checking."
exit 1
}

View File

@@ -1,78 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
if [ -z ${WITH_COVERAGE} ] ; then
echo "WITH_COVERAGE environment variable is not set, aborting."
exit 1
fi
SOURCE_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../"; pwd)
function usage() {
echo "Error: LCOV and genhtml are required for generating coverage reports."
if [ `uname -s` = 'Linux' ]; then
echo "On Debian-based distros, you can install them via 'apt-get install lcov'"
elif [ `uname -s` = 'Darwin' ]; then
echo "On macOS, you can install them via 'brew install lcov'"
fi
exit 1
}
command -v lcov >/dev/null 2>&1 || usage
command -v genhtml >/dev/null 2>&1 || usage
# Build unit tests
make test
# Zero coverage counters
lcov \
--quiet \
--zerocounters \
--directory "${SOURCE_DIR}" \
--output-file "${SOURCE_DIR}/coverage.info" \
>/dev/null 2>&1
# Run all unit tests
make run-test
# Collect coverage data and save it into coverage.info
echo "Collecting coverage data..."
lcov \
--quiet \
--capture \
--no-external \
--directory "${SOURCE_DIR}" \
--output-file "${SOURCE_DIR}/coverage.info" \
>/dev/null 2>&1
# Remove coverage data for unwanted files from a tracefile
lcov \
--quiet \
--remove "${SOURCE_DIR}/coverage.info" \
"${SOURCE_DIR}/vendor/*" \
"${SOURCE_DIR}/mason/*" \
"${SOURCE_DIR}/test/*" \
"/usr/include/*" \
--output-file "${SOURCE_DIR}/total_coverage.info" \
>/dev/null 2>&1
# Generate HTML report based on total_coverage.info
echo "Generating HTML report..."
genhtml \
--quiet \
--show-details \
--keep-descriptions \
--function-coverage \
--no-branch-coverage \
--title "Mapbox GL Native" \
--num-spaces 4 \
--sort \
--demangle-cpp \
--prefix $(pwd -P) \
--output-directory "${SOURCE_DIR}/coverage" \
"${SOURCE_DIR}/total_coverage.info" \
>/dev/null 2>&1
echo "Coverage report is now available in ${SOURCE_DIR}/coverage/index.html"

View File

@@ -1,35 +0,0 @@
#!/usr/bin/env node
// Output some `export` commands with a few extra environment variables. They'll be evaluated
// into the build environment and available for use in later steps.
const github = require('@octokit/rest')();
const {execSync} = require('child_process');
const pr = process.env['CIRCLE_PULL_REQUEST'];
if (pr) {
const number = +pr.match(/\/(\d+)\/?$/)[1];
return github.pullRequests.get({
owner: 'mapbox',
repo: 'mapbox-gl-native',
number
}).then(({data}) => {
const base = data.base.ref;
const head = process.env['CIRCLE_SHA1'];
const mergeBase = execSync(`git merge-base origin/${base} ${head}`).toString().trim();
console.log(`export CIRCLE_TARGET_BRANCH=${base}`);
console.log(`export CIRCLE_MERGE_BASE=${mergeBase}`);
});
} else {
const head = process.env['CIRCLE_SHA1'];
for (const sha of execSync(`git rev-list --max-count=500 ${head}`).toString().trim().split('\n')) {
const base = execSync(`git branch -r --contains ${sha} origin/main origin/release-*`).toString().split('\n')[0].trim().replace(/^origin\//, '');
if (base) {
const mergeBase = execSync(`git merge-base origin/${base} ${head}`).toString().trim();
console.log(`export CIRCLE_TARGET_BRANCH=${base}`);
console.log(`export CIRCLE_MERGE_BASE=${mergeBase}`);
break;
}
}
}

View File

@@ -1,39 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
set -u
# Logs metrics on memory usage to CloudWatch
GTEST_OUTPUT=$1
DIMENSIONS=$2
if [ -z "${DIMENSIONS}" ]; then
echo "* No dimensions specified for memory benchmarks"
exit 1
fi
function reportAttributeValue {
ATTR_NAME=$1
ATTR_UNITS=$2
ATTR_VALUE=$(cat $GTEST_OUTPUT | grep -o "$ATTR_NAME=\"[^\"]*" | sed "s/$ATTR_NAME=\"//")
if [ ${CLOUDWATCH:-} ]; then
echo "* Reporting $ATTR_NAME = $ATTR_VALUE $ATTR_UNITS for '${DIMENSIONS}'"
aws --region us-east-1 cloudwatch put-metric-data \
--namespace "Mapbox/GL" \
--metric-name "$ATTR_NAME" \
--unit "$ATTR_UNITS" \
--value ${ATTR_VALUE} \
--dimensions "${DIMENSIONS}"
else
echo "* Measured $ATTR_NAME = $ATTR_VALUE $ATTR_UNITS for '${DIMENSIONS}'"
fi
}
if [ -f "${GTEST_OUTPUT}" ]; then
reportAttributeValue vectorFootprint Bytes
reportAttributeValue rasterFootprint Bytes
else
echo "* File '${GTEST_OUTPUT}' does not exist"
fi

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env bash
cmake -P cmake/mason.cmake "$@"

View File

@@ -1,13 +0,0 @@
#!/usr/bin/env node
const nitpick = require('.');
const child_process = require('child_process');
// Make sure that the maplibre-gl-js submodule pin is up to date
const head = child_process.execSync('git -C maplibre-gl-js rev-parse HEAD').toString().trim();
const revs = child_process.execSync(`git -C maplibre-gl-js branch -a --contains ${head}`).toString().split('\n');
if (revs.indexOf(' remotes/origin/main') >= 0) {
nitpick.ok(`maplibre-gl-js submodule pin is merged to main`);
} else {
nitpick.fail(`maplibre-gl-js submodule is pinned to ${head}, which isn't merged to main`);
}

View File

@@ -1,147 +0,0 @@
#!/usr/bin/env node
const assert = require('assert');
const jwt = require('jsonwebtoken');
const github = require('@octokit/rest')();
const zlib = require('zlib');
const AWS = require('aws-sdk');
const SIZE_CHECK_APP_ID = 14028;
const SIZE_CHECK_APP_INSTALLATION_ID = 229425;
// Error handling
process.on('unhandledRejection', error => {
console.log(error);
process.exit(1)
});
// Github authorization
const pk = process.env['SIZE_CHECK_APP_PRIVATE_KEY'];
if (!pk) {
console.log('Fork PR; not publishing size.');
process.exit(0);
}
const key = Buffer.from(pk, 'base64').toString('binary');
const payload = {
exp: Math.floor(Date.now() / 1000) + 60,
iat: Math.floor(Date.now() / 1000),
iss: SIZE_CHECK_APP_ID
};
const token = jwt.sign(payload, key, {algorithm: 'RS256'});
github.authenticate({type: 'app', token});
// Metrics: Github statistics
let openIssuesTotal = 0;
let openIssuesTotalFromNonMembers = 0;
let openIssuesTotalCore = 0;
let openIssuesTotalAndroid = 0;
let openIssuesTotalIOS = 0;
let openIssuesTotalGLJSParity = 0;
let openPullRequestsTotal = 0;
let openPullRequestsTotalFromNonMembers = 0;
let openPullRequestsSinceLastMonth = 0;
let openPullRequestsSinceLastMonthFromNonMembers = 0;
function collectMetricsFromIssues(issues) {
const oneMonthAgo = function() { let date = new Date(); date.setMonth(date.getMonth() - 1); return date; }();
// Metrics
issues.data.forEach(function (issue) {
const issueCreatedAt = new Date(issue.created_at);
const isMapboxAuthor = issue.author_association === "MEMBER";
if (issue.pull_request) {
openPullRequestsTotal++;
if (!isMapboxAuthor) {
openPullRequestsTotalFromNonMembers++;
}
if (issueCreatedAt >= oneMonthAgo) {
openPullRequestsSinceLastMonth++;
if (!isMapboxAuthor) {
openPullRequestsSinceLastMonthFromNonMembers++;
}
}
} else {
openIssuesTotal++;
if (!isMapboxAuthor) {
openIssuesTotalFromNonMembers++;
}
issue.labels.forEach(function (label) {
switch (label.name) {
case "Core":
openIssuesTotalCore++;
break;
case "Android":
openIssuesTotalAndroid++;
break;
case "iOS":
openIssuesTotalIOS++;
break;
case "GL JS parity":
openIssuesTotalGLJSParity++;
break;
default:
break;
}
});
}
});
}
function publishMetrics() {
let metrics = {
'created_at': new Date().toISOString().substring(0, 10),
'open_issues_total': openIssuesTotal,
'open_issues_total_from_non_members': openIssuesTotalFromNonMembers,
'open_issues_total_core': openIssuesTotalCore,
'open_issues_total_android': openIssuesTotalAndroid,
'open_issues_total_ios': openIssuesTotalIOS,
'open_issues_total_gl_js_parity': openIssuesTotalGLJSParity,
'open_pull_requests_total': openPullRequestsTotal,
'open_pull_requests_total_from_non_members': openPullRequestsTotalFromNonMembers,
'open_pull_requests_since_last_month': openPullRequestsSinceLastMonth,
'open_pull_requests_since_last_month_from_non_members': openPullRequestsSinceLastMonthFromNonMembers
};
var promise = new AWS.S3({region: 'us-east-1'}).putObject({
Body: zlib.gzipSync(JSON.stringify(metrics)),
Bucket: 'mapbox-loading-dock',
Key: `raw/mobile_staging.github_stats/${metrics['created_at']}/METRIC.json.gz`,
CacheControl: 'max-age=300',
ContentEncoding: 'gzip',
ContentType: 'application/json'
}).promise();
return Promise.all([promise]).then(data => {
return console.log("Successfully uploaded Github Stats metrics to S3");
}).catch(err => {
console.log("Error uploading Github Stats metrics to S3 " + err.message);
return err;
});
}
function recursiveListForRepo(query) {
assert(query);
query.then(result => {
collectMetricsFromIssues(result);
if (github.hasNextPage(result)) {
recursiveListForRepo(github.getNextPage(result));
} else {
publishMetrics();
}
}).catch(error => {
console.log("Error fetching the repository issues list: " + err.message);
});
}
github.apps.createInstallationToken({ installation_id: SIZE_CHECK_APP_INSTALLATION_ID })
.then(({data}) => {
github.authenticate({ type: 'token', token: data.token });
})
.then(() => {
recursiveListForRepo(github.issues.listForRepo({ owner: 'mapbox', repo: 'mapbox-gl-native', state: 'open', per_page: 100 }));
});

View File

@@ -1,77 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
function usage {
echo "Usage: $0 <args> [target]"
echo ""
echo " -c, --clean-target Removes all files in the target directory instead of overwriting them"
echo " -s, --skip [name] Skips vendoring the given dependency"
exit 1
}
CLEAN_TARGET=false
ARGS=()
while [[ $# -gt 0 ]] ; do case "$1" in
-c|--clean-target) CLEAN_TARGET=true ; shift ;;
-s|--skip) shift ; DEP="$1" ; shift ; declare SKIP_$DEP=true ;;
*) ARGS+=("$1") ; shift ;;
esac ; done
set -- "${ARGS[@]}"
if [ -z "$1" ]; then usage ; fi
TARGET="$1"
if [ "$CLEAN_TARGET" = true ] ; then
echo ">> Cleaning target directory..."
rm -rf "$TARGET"
fi
echo ">> Creating target directory..."
mkdir -p "$TARGET"
TARGET=$(cd "`pwd`/$TARGET"; pwd)
echo ">> Creating file lists..."
cat cmake/core-files.txt cmake/filesource-files.txt > "$TARGET/files.txt"
mkdir -p "$TARGET/platform/android"
cat platform/android/*-files.txt > "$TARGET/platform/android/files.txt"
echo ">> Copying source files..."
rsync -rR $(git ls-files \
"include" \
"src" \
"platform/default" \
"platform/android/mbgl" \
"platform/android/src" \
"platform/linux/src" \
"platform/android/MapboxGLAndroidSDK/src/main" \
) "$TARGET"
echo ">> Copying vendored files..."
rsync -rR $(git ls-files \
"vendor/icu" \
"vendor/nunicode" \
"vendor/sqlite" \
) "$TARGET"
echo ">> Copying Mason dependencies..."
cmake -P scripts/standalone.cmake 2>&1 | while read DEPENDENCY ; do
DEPENDENCY=($DEPENDENCY)
if [ "[Mason]" = "${DEPENDENCY[0]}" ]; then
echo "${DEPENDENCY[@]}"
continue
fi
SKIP=SKIP_${DEPENDENCY[0]}
if [ "${!SKIP:-false}" = true ]; then continue ; fi
DESTINATION="$TARGET/vendor/${DEPENDENCY[0]}"
mkdir -p "$DESTINATION"
echo " - ${DEPENDENCY[0]}"
cp -r "${DEPENDENCY[1]}/" "$DESTINATION"
rm "$DESTINATION/mason.ini"
(cd "${DEPENDENCY[1]}" && find include -type f -name "*.hpp" -o -name "*.h") > "$DESTINATION/files.txt"
echo "${DEPENDENCY[2]}" > "$DESTINATION/version.txt"
done

View File

@@ -1,36 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
function step { >&2 echo -e "\033[1m\033[36m* $@\033[0m"; }
function finish { >&2 echo -en "\033[0m"; }
trap finish EXIT
SDK_FLAVOR=${SDK_FLAVOR:-"maps"}
step "Triggering automated site and documentation generation for ${SDK_FLAVOR} SDK ${VERSION_TAG}"
# No branch specified, so default branch will be used
request_body="{
\"request\": {
\"message\": \"[${SDK_FLAVOR}] ${VERSION_TAG} automated site and documentation generation\",
\"config\": {
\"merge_mode\": \"deep_merge\",
\"env\": {
\"SDK_FLAVOR\": \"${SDK_FLAVOR}\",
\"RELEASE_TAG\": \"${VERSION_TAG}\"
}
}
}
}"
step "Making request…"
# Request URL set to docs-sandbox while testing
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token ${TRAVISCI_API_TOKEN}" \
-d "${request_body}" \
https://api.travis-ci.com/repo/mapbox%2F${DOCS_REPO}/requests

View File

@@ -1,18 +0,0 @@
#!/usr/bin/env bash
set -e
set -o pipefail
VALGRIND_PREFIX=$(scripts/mason.sh PREFIX valgrind VERSION 3.12.0)
PARAMS="\
--leak-check=full \
--show-leak-kinds=definite \
--errors-for-leak-kinds=definite \
--error-exitcode=1 \
--gen-suppressions=all \
--suppressions=scripts/valgrind.sup"
export VALGRIND_LIB=${VALGRIND_PREFIX}/lib/valgrind
${VALGRIND_PREFIX}/bin/valgrind $PARAMS $@

View File

@@ -1,18 +0,0 @@
{
Valgrind x Mesa
Memcheck:Cond
...
obj:*/swrast_dri.*
obj:*/swrast_dri.*
obj:*/swrast_dri.*
...
}
{
Valgrind x Mesa
Memcheck:Value8
...
obj:*/swrast_dri.*
obj:*/swrast_dri.*
obj:*/swrast_dri.*
...
}