Do not require Source Link info for VMR smoke tests (#16241)
This commit is contained in:
parent
1400493fc0
commit
4918bfbd81
1 changed files with 37 additions and 34 deletions
|
@ -114,46 +114,49 @@ while :; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
GIT_DIR="$SCRIPT_ROOT/.git"
|
# For build purposes, we need to make sure we have all the SourceLink information
|
||||||
if [ -f "$GIT_DIR/index" ]; then # We check for index because if outside of git, we create config and HEAD manually
|
if [ "$alternateTarget" != "true" ]; then
|
||||||
if [ -n "$sourceRepository" ] || [ -n "$sourceVersion" ] || [ -n "$releaseManifest" ]; then
|
GIT_DIR="$SCRIPT_ROOT/.git"
|
||||||
echo "ERROR: Source Link arguments cannot be used in a git repository"
|
if [ -f "$GIT_DIR/index" ]; then # We check for index because if outside of git, we create config and HEAD manually
|
||||||
exit 1
|
if [ -n "$sourceRepository" ] || [ -n "$sourceVersion" ] || [ -n "$releaseManifest" ]; then
|
||||||
fi
|
echo "ERROR: Source Link arguments cannot be used in a git repository"
|
||||||
else
|
|
||||||
if [ -z "$releaseManifest" ]; then
|
|
||||||
if [ -z "$sourceRepository" ] || [ -z "$sourceVersion" ]; then
|
|
||||||
echo "ERROR: $SCRIPT_ROOT is not a git repository, either --release-manifest or --source-repository and --source-version must be specified"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ -n "$sourceRepository" ] || [ -n "$sourceVersion" ]; then
|
if [ -z "$releaseManifest" ]; then
|
||||||
echo "ERROR: --release-manifest cannot be specified together with --source-repository and --source-version"
|
if [ -z "$sourceRepository" ] || [ -z "$sourceVersion" ]; then
|
||||||
exit 1
|
echo "ERROR: $SCRIPT_ROOT is not a git repository, either --release-manifest or --source-repository and --source-version must be specified"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ -n "$sourceRepository" ] || [ -n "$sourceVersion" ]; then
|
||||||
|
echo "ERROR: --release-manifest cannot be specified together with --source-repository and --source-version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
get_property() {
|
||||||
|
local json_file_path="$1"
|
||||||
|
local property_name="$2"
|
||||||
|
grep -oP '(?<="'$property_name'": ")[^"]*' "$json_file_path"
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceRepository=$(get_property "$releaseManifest" sourceRepository) \
|
||||||
|
|| (echo "ERROR: Failed to find sourceRepository in $releaseManifest" && exit 1)
|
||||||
|
sourceVersion=$(get_property "$releaseManifest" sourceVersion) \
|
||||||
|
|| (echo "ERROR: Failed to find sourceVersion in $releaseManifest" && exit 1)
|
||||||
|
|
||||||
|
if [ -z "$sourceRepository" ] || [ -z "$sourceVersion" ]; then
|
||||||
|
echo "ERROR: sourceRepository and sourceVersion must be specified in $releaseManifest"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
get_property() {
|
# We need to add "fake" .git/ files when not building from a git repository
|
||||||
local json_file_path="$1"
|
mkdir -p "$GIT_DIR"
|
||||||
local property_name="$2"
|
echo '[remote "origin"]' > "$GIT_DIR/config"
|
||||||
grep -oP '(?<="'$property_name'": ")[^"]*' "$json_file_path"
|
echo "url=\"$sourceRepository\"" >> "$GIT_DIR/config"
|
||||||
}
|
echo "$sourceVersion" > "$GIT_DIR/HEAD"
|
||||||
|
|
||||||
sourceRepository=$(get_property "$releaseManifest" sourceRepository) \
|
|
||||||
|| (echo "ERROR: Failed to find sourceRepository in $releaseManifest" && exit 1)
|
|
||||||
sourceVersion=$(get_property "$releaseManifest" sourceVersion) \
|
|
||||||
|| (echo "ERROR: Failed to find sourceVersion in $releaseManifest" && exit 1)
|
|
||||||
|
|
||||||
if [ -z "$sourceRepository" ] || [ -z "$sourceVersion" ]; then
|
|
||||||
echo "ERROR: sourceRepository and sourceVersion must be specified in $releaseManifest"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We need to add "fake" .git/ files when not building from a git repository
|
|
||||||
mkdir -p "$GIT_DIR"
|
|
||||||
echo '[remote "origin"]' > "$GIT_DIR/config"
|
|
||||||
echo "url=\"$sourceRepository\"" >> "$GIT_DIR/config"
|
|
||||||
echo "$sourceVersion" > "$GIT_DIR/HEAD"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$CUSTOM_PACKAGES_DIR" != "" ]; then
|
if [ "$CUSTOM_PACKAGES_DIR" != "" ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue