Skip to content

Commit

Permalink
Remove dependency on pipeline-logging-functions.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Oct 21, 2022
1 parent 7d751bb commit 3f961a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
26 changes: 11 additions & 15 deletions eng/common/native/init-compiler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@
#
# NOTE: some scripts source this file and rely on stdout being empty, make sure to not output anything here!

if [ "$#" -lt 3 ]; then
if [ "$#" -lt 2 ]; then
echo "Usage..."
echo "init-compiler.sh <script directory> <Architecture> <compiler>"
echo "Specify the script directory."
echo "init-compiler.sh <Architecture> <compiler>"
echo "Specify the target architecture."
echo "Specify the name of compiler (clang or gcc)."
exit 1
fi

nativescriptroot="$1"
build_arch="$2"
compiler="$3"
build_arch="$1"
compiler="$2"

case "$compiler" in
clang*|-clang*|--clang*)
Expand All @@ -41,8 +39,6 @@ esac

cxxCompiler="$compiler++"

. "$nativescriptroot"/../pipeline-logging-functions.sh

# clear the existing CC and CXX from environment
CC=
CXX=
Expand Down Expand Up @@ -83,23 +79,23 @@ if [ -z "$CLR_CC" ]; then
if [ -z "$majorVersion" ]; then
if command -v "$compiler" > /dev/null; then
if [ "$(uname)" != "Darwin" ]; then
Write-PipelineTelemetryError -category "Build" -type "warning" "Specific version of $compiler not found, falling back to use the one in PATH."
echo "Warning: Specific version of $compiler not found, falling back to use the one in PATH."
fi
CC="$(command -v "$compiler")"
CXX="$(command -v "$cxxCompiler")"
else
Write-PipelineTelemetryError -category "Build" "No usable version of $compiler found."
echo "No usable version of $compiler found."
exit 1
fi
else
if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ]; then
if [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; then
if command -v "$compiler" > /dev/null; then
Write-PipelineTelemetryError -category "Build" -type "warning" "Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH."
echo "Warning: Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH."
CC="$(command -v "$compiler")"
CXX="$(command -v "$cxxCompiler")"
else
Write-PipelineTelemetryError -category "Build" "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH."
echo "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH."
exit 1
fi
fi
Expand All @@ -108,7 +104,7 @@ if [ -z "$CLR_CC" ]; then
else
desired_version="$(check_version_exists "$majorVersion" "$minorVersion")"
if [ "$desired_version" = "-1" ]; then
Write-PipelineTelemetryError -category "Build" "Could not find specific version of $compiler: $majorVersion $minorVersion."
echo "Could not find specific version of $compiler: $majorVersion $minorVersion."
exit 1
fi
fi
Expand All @@ -120,15 +116,15 @@ if [ -z "$CLR_CC" ]; then
fi
else
if [ ! -f "$CLR_CC" ]; then
Write-PipelineTelemetryError -category "Build" "CLR_CC is set but path '$CLR_CC' does not exist"
echo "CLR_CC is set but path '$CLR_CC' does not exist"
exit 1
fi
CC="$CLR_CC"
CXX="$CLR_CXX"
fi

if [ -z "$CC" ]; then
Write-PipelineTelemetryError -category "Build" "Unable to find $compiler."
echo "Unable to find $compiler."
exit 1
fi

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
<PropertyGroup>
<_NativeScriptsDir>$([MSBuild]::NormalizeDirectory('$(RepositoryEngineeringDir)', 'common', 'native'))</_NativeScriptsDir>
<CMakeCompilerSearchScript>
. &quot;$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(_NativeScriptsDir)/init-compiler.sh'))&quot; &quot;$(_NativeScriptsDir)&quot; &quot;$(Platform)&quot; &quot;$(CMakeCompilerToolchain)&quot;
. &quot;$([MSBuild]::MakeRelative('$(MSBuildProjectDirectory)', '$(_NativeScriptsDir)/init-compiler.sh'))&quot; &quot;$(Platform)&quot; &quot;$(CMakeCompilerToolchain)&quot;
</CMakeCompilerSearchScript>
</PropertyGroup>
</Target>
Expand Down

0 comments on commit 3f961a2

Please sign in to comment.