Skip to content

Commit 0d8d146

Browse files
committed
Remove dependency on pipeline-logging-functions.sh
1 parent 26f9fb1 commit 0d8d146

File tree

4 files changed

+15
-22
lines changed

4 files changed

+15
-22
lines changed

eng/common/native/init-compiler.sh

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,22 @@
44
#
55
# NOTE: some scripts source this file and rely on stdout being empty, make sure to not output anything here!
66

7-
if [ "$#" -lt 3 ]; then
7+
if [ -z "$build_arch" ] || [ -z "$compiler" ]; then
88
echo "Usage..."
9-
echo "init-compiler.sh <script directory> <Architecture> <compiler>"
10-
echo "Specify the script directory."
9+
echo "build_arch=<ARCH> compiler=<NAME> init-compiler.sh"
1110
echo "Specify the target architecture."
1211
echo "Specify the name of compiler (clang or gcc)."
1312
exit 1
1413
fi
1514

16-
nativescriptroot="$1"
17-
build_arch="$2"
18-
compiler="$3"
19-
2015
case "$compiler" in
2116
clang*|-clang*|--clang*)
2217
# clangx.y or clang-x.y
2318
version="$(echo "$compiler" | tr -d '[:alpha:]-=')"
2419
majorVersion="${version%%.*}"
2520
[ -z "${version##*.*}" ] && minorVersion="${version#*.}"
2621

27-
if [ -z "$minorVersion" ] && [ "$majorVersion" -le 6 ]; then
22+
if [ -z "$minorVersion" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -le 6 ]; then
2823
minorVersion=0;
2924
fi
3025
compiler=clang
@@ -41,8 +36,6 @@ esac
4136

4237
cxxCompiler="$compiler++"
4338

44-
. "$nativescriptroot"/../pipeline-logging-functions.sh
45-
4639
# clear the existing CC and CXX from environment
4740
CC=
4841
CXX=
@@ -83,23 +76,23 @@ if [ -z "$CLR_CC" ]; then
8376
if [ -z "$majorVersion" ]; then
8477
if command -v "$compiler" > /dev/null; then
8578
if [ "$(uname)" != "Darwin" ]; then
86-
Write-PipelineTelemetryError -category "Build" -type "warning" "Specific version of $compiler not found, falling back to use the one in PATH."
79+
echo "Warning: Specific version of $compiler not found, falling back to use the one in PATH."
8780
fi
8881
CC="$(command -v "$compiler")"
8982
CXX="$(command -v "$cxxCompiler")"
9083
else
91-
Write-PipelineTelemetryError -category "Build" "No usable version of $compiler found."
84+
echo "No usable version of $compiler found."
9285
exit 1
9386
fi
9487
else
9588
if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ]; then
9689
if [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; then
9790
if command -v "$compiler" > /dev/null; then
98-
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."
91+
echo "Warning: Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH."
9992
CC="$(command -v "$compiler")"
10093
CXX="$(command -v "$cxxCompiler")"
10194
else
102-
Write-PipelineTelemetryError -category "Build" "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH."
95+
echo "Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH."
10396
exit 1
10497
fi
10598
fi
@@ -108,7 +101,7 @@ if [ -z "$CLR_CC" ]; then
108101
else
109102
desired_version="$(check_version_exists "$majorVersion" "$minorVersion")"
110103
if [ "$desired_version" = "-1" ]; then
111-
Write-PipelineTelemetryError -category "Build" "Could not find specific version of $compiler: $majorVersion $minorVersion."
104+
echo "Could not find specific version of $compiler: $majorVersion $minorVersion."
112105
exit 1
113106
fi
114107
fi
@@ -120,20 +113,20 @@ if [ -z "$CLR_CC" ]; then
120113
fi
121114
else
122115
if [ ! -f "$CLR_CC" ]; then
123-
Write-PipelineTelemetryError -category "Build" "CLR_CC is set but path '$CLR_CC' does not exist"
116+
echo "CLR_CC is set but path '$CLR_CC' does not exist"
124117
exit 1
125118
fi
126119
CC="$CLR_CC"
127120
CXX="$CLR_CXX"
128121
fi
129122

130123
if [ -z "$CC" ]; then
131-
Write-PipelineTelemetryError -category "Build" "Unable to find $compiler."
124+
echo "Unable to find $compiler."
132125
exit 1
133126
fi
134127

135128
# Only lld version >= 9 can be considered stable
136-
if [ "$compiler" = "clang" ] && [ "$majorVersion" -ge 9 ]; then
129+
if [ "$compiler" = "clang" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -ge 9 ]; then
137130
if "$CC" -fuse-ld=lld -Wl,--version >/dev/null 2>&1; then
138131
LDFLAGS="-fuse-ld=lld"
139132
fi

eng/native/gen-buildsys.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ compiler="$4"
2424

2525
if [[ "$compiler" != "default" ]]; then
2626
nativescriptroot="$( cd -P "$scriptroot/../common/native" && pwd )"
27-
source "$nativescriptroot/init-compiler.sh" "$nativescriptroot" "$host_arch" "$compiler"
27+
build_arch="$host_arch" compiler="$compiler" . "$nativescriptroot/init-compiler.sh"
2828

2929
CCC_CC="$CC"
3030
CCC_CXX="$CXX"

src/libraries/System.Runtime.InteropServices/tests/TestAssets/NativeExports/NativeExports.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
<NativeCompiler Condition="'$(NativeCompiler)' == ''">clang</NativeCompiler>
3030
</PropertyGroup>
3131

32-
<Exec Command="bash -c 'source &quot;$(RepositoryEngineeringDir)/common/native/init-compiler.sh&quot; &quot;$(RepositoryEngineeringDir)/common/native&quot; $(TargetArchitecture) $(NativeCompiler) &amp;&amp; echo $CC' 2>/dev/null"
32+
<Exec Command="sh -c 'build_arch=&quot;$(TargetArchitecture)&quot; compiler=&quot;$(NativeCompiler)&quot; . &quot;$(RepositoryEngineeringDir)/common/native/init-compiler.sh&quot; &amp;&amp; echo $CC' 2>/dev/null"
3333
EchoOff="true"
3434
ConsoleToMsBuild="true"
3535
StandardOutputImportance="Low">
3636
<Output TaskParameter="ConsoleOutput" PropertyName="DnneCompilerCommand" />
3737
</Exec>
3838

39-
<Exec Command="bash -c 'source &quot;$(RepositoryEngineeringDir)/common/native/init-compiler.sh&quot; &quot;$(RepositoryEngineeringDir)/common/native&quot; $(TargetArchitecture) $(NativeCompiler) &amp;&amp; echo $LDFLAGS' 2>/dev/null"
39+
<Exec Command="sh -c 'build_arch=&quot;$(TargetArchitecture)&quot; compiler=&quot;$(NativeCompiler)&quot; . &quot;$(RepositoryEngineeringDir)/common/native/init-compiler.sh&quot; &amp;&amp; echo $LDFLAGS' 2>/dev/null"
4040
EchoOff="true"
4141
ConsoleToMsBuild="true"
4242
StandardOutputImportance="Low">

src/mono/mono.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@
513513
<PropertyGroup>
514514
<EMSDK_PATH>$([MSBuild]::EnsureTrailingSlash('$(EMSDK_PATH)'))</EMSDK_PATH>
515515
<_MonoCMakeConfigureCommand>cmake @(_MonoCMakeArgs, ' ') $(MonoCMakeExtraArgs) &quot;$(MonoProjectRoot.TrimEnd('\/'))&quot;</_MonoCMakeConfigureCommand>
516-
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' != 'false' and '$(HostOS)' != 'windows'">bash -c 'source $(RepositoryEngineeringCommonDir)native/init-compiler.sh &quot;$(RepositoryEngineeringCommonDir)native&quot; &quot;$(_CompilerTargetArch)&quot; &quot;$(MonoCCompiler)&quot; &amp;&amp; @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)'</_MonoCMakeConfigureCommand>
516+
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' != 'false' and '$(HostOS)' != 'windows'">sh -c 'build_arch=&quot;$(_CompilerTargetArch)&quot; compiler=&quot;$(MonoCCompiler)&quot; . &quot;$(RepositoryEngineeringCommonDir)native/init-compiler.sh&quot; &amp;&amp; @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)'</_MonoCMakeConfigureCommand>
517517
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' != 'false' and '$(HostOS)' == 'windows'">call &quot;$(RepositoryEngineeringDir)native\init-vs-env.cmd&quot; $(_CompilerTargetArch) &amp;&amp; cd /D &quot;$(MonoObjDir)&quot; &amp;&amp; @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)</_MonoCMakeConfigureCommand>
518518
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' != 'true' and '$(_MonoRunInitCompiler)' == 'false'">$(_MonoCCOption) $(_MonoCXXOption) @(_MonoBuildEnv, ' ') $(_MonoCMakeConfigureCommand)</_MonoCMakeConfigureCommand>
519519
<_MonoCMakeConfigureCommand Condition="'$(TargetsBrowser)' == 'true' and '$(HostOS)' != 'windows'">bash -c 'source $(EMSDK_PATH)/emsdk_env.sh 2>&amp;1 &amp;&amp; emcmake $(_MonoCMakeConfigureCommand)'</_MonoCMakeConfigureCommand>

0 commit comments

Comments
 (0)