Linux/x86: fix build (#26594)
[platform/upstream/coreclr.git] / init-tools.sh
index cacf9e4..5ac2b44 100755 (executable)
@@ -2,7 +2,7 @@
 
 __scriptpath=$(cd "$(dirname "$0")"; pwd -P)
 __init_tools_log="$__scriptpath/init-tools.log"
-__PACKAGES_DIR="$__scriptpath/packages"
+__PACKAGES_DIR="$__scriptpath/.packages"
 __TOOLRUNTIME_DIR="$__scriptpath/Tools"
 __DOTNET_PATH="$__scriptpath/.dotnet"
 __DOTNET_CMD="$__DOTNET_PATH/dotnet"
@@ -131,11 +131,7 @@ esac
 __PKG_RID=$__PKG_RID-$__PKG_ARCH
 
 if [ ! -e "$__DOTNET_CMD" ]; then
-    source $__scriptpath/eng/configure-toolset.sh
-    source $__scriptpath/eng/common/tools.sh
-
-    InitializeBuildTool
-
+    source $__scriptpath/init-dotnet.sh
     if [ ! -e "$__DOTNET_CMD" ]; then
         echo "ERROR: Ensure arcade dotnet install did not install dotnet at $__DOTNET_CMD"
         exit 1
@@ -157,15 +153,8 @@ if [ -z "${__ILASM_RID-}" ]; then
 fi
 
 echo "Using RID $__ILASM_RID for BuildTools native tools"
-
-export ILASMCOMPILER_VERSION=$__ILASM_VERSION
 export NATIVE_TOOLS_RID=$__ILASM_RID
 
-if [ -n "${DotNetBootstrapCliTarPath-}" ]; then
-    # Assume ilasm is not in nuget yet when bootstrapping...
-    unset ILASMCOMPILER_VERSION
-fi
-
 # Build tools only supported on x64
 if [ "${__PKG_ARCH}" != "x64" ] &&  [ "${__PKG_ARCH}" != "arm" ]; then
     echo "Skipped installing build tools."
@@ -182,6 +171,14 @@ else
         exit 1
     fi
 
+
+    if [ ! -n "${DotNetBootstrapCliTarPath-}" ]; then
+        # Assume ilasm is not in nuget yet when bootstrapping...
+        # ILasm/ILDasm used to be restored by buildtools. The reference there was a netocreapp2.0, which was prior to our support of linux-musl. We initialize it locally as a 3.0 with the new SDK.
+        echo "Running: eval $__DOTNET_CMD build ${__scriptpath}/tests/ilasm-restore/ilasm.depproj --no-cache --packages $__PACKAGES_DIR -r $NATIVE_TOOLS_RID -p:ILAsmPackageVersion=$__ILASM_VERSION  -p:ExpectedILAsmPath=$__TOOLRUNTIME_DIR/ilasm" >> "$__init_tools_log"
+        eval "$__DOTNET_CMD" build "${__scriptpath}/tests/ilasm-restore/ilasm.depproj" --no-cache --packages "$__PACKAGES_DIR" -r "$NATIVE_TOOLS_RID" -p:ILAsmPackageVersion="$__ILASM_VERSION" -p:ExpectedILAsmPath="$__TOOLRUNTIME_DIR/ilasm"
+    fi
+
     echo "Making all .sh files executable under Tools."
     # Executables restored with .NET Core 2.0 do not have executable permission flags. https://github.com/NuGet/Home/issues/4424
     ls "$__scriptpath/Tools/"*.sh | xargs chmod +x