Move EncodingTable and CodePageDataItem to System.Text namespace (#17061)
[platform/upstream/coreclr.git] / build-packages.sh
index 382e24d..838f5bd 100755 (executable)
@@ -3,16 +3,43 @@
 usage()
 {
     echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step."
 usage()
 {
     echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step."
-    echo "Usage: build-packages -BuildArch -BuildType [-portable]"
+    echo "Usage: build-packages -BuildArch -BuildType"
     echo "BuildArch can be x64, x86, arm, arm64 (default is x64)"
     echo "BuildType can be release, checked, debug (default is debug)"
     echo "BuildArch can be x64, x86, arm, arm64 (default is x64)"
     echo "BuildType can be release, checked, debug (default is debug)"
-    echo "-portable - build for Portable Distribution"
     echo
     exit 1
 }
 
     echo
     exit 1
 }
 
+initHostDistroRid()
+{
+    __HostDistroRid=""
+    if [ "$__HostOS" == "Linux" ]; then
+        if [ -e /etc/os-release ]; then
+            source /etc/os-release
+            if [[ $ID == "alpine" || $ID == "rhel" ]]; then
+                # remove the last version digit
+                VERSION_ID=${VERSION_ID%.*}
+            fi
+            __HostDistroRid="$ID.$VERSION_ID-$__Arch"
+        elif [ -e /etc/redhat-release ]; then
+            local redhatRelease=$(</etc/redhat-release)
+            if [[ $redhatRelease == "CentOS release 6."* || $redhatRelease == "Red Hat Enterprise Linux Server release 6."* ]]; then
+               __HostDistroRid="rhel.6-$__Arch"
+            fi
+        fi
+    fi
+    if [ "$__HostOS" == "FreeBSD" ]; then
+        __freebsd_version=`sysctl -n kern.osrelease | cut -f1 -d'.'`
+        __HostDistroRid="freebsd.$__freebsd_version-$__Arch"
+    fi
+
+    if [ "$__HostDistroRid" == "" ]; then
+        echo "WARNING: Cannot determine runtime id for current distro."
+    fi
+}
+
 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-__PortableBuild=0
+__IsPortableBuild=1
 
 # Use uname to determine what the OS is.
 OSName=$(uname -s)
 
 # Use uname to determine what the OS is.
 OSName=$(uname -s)
@@ -71,8 +98,9 @@ while :; do
         __Arch=$(echo $1| cut -d'=' -f 2)
         ;;
 
         __Arch=$(echo $1| cut -d'=' -f 2)
         ;;
 
-        -portableBuild)
-            __PortableBuild=1
+        -portablebuild=false)
+            unprocessedBuildArgs="$unprocessedBuildArgs $1"
+            __IsPortableBuild=0
             ;;
         *)
         unprocessedBuildArgs="$unprocessedBuildArgs $1"
             ;;
         *)
         unprocessedBuildArgs="$unprocessedBuildArgs $1"
@@ -81,17 +109,19 @@ while :; do
 done
 
 # Portable builds target the base RID
 done
 
 # Portable builds target the base RID
-if [ $__PortableBuild == 1 ]; then
+if [ $__IsPortableBuild == 1 ]; then
     if [ "$__BuildOS" == "Linux" ]; then
         export __DistroRid="linux-$__Arch"
     elif [ "$__BuildOS" == "OSX" ]; then
         export __DistroRid="osx-$__Arch"
     fi
 else
     if [ "$__BuildOS" == "Linux" ]; then
         export __DistroRid="linux-$__Arch"
     elif [ "$__BuildOS" == "OSX" ]; then
         export __DistroRid="osx-$__Arch"
     fi
 else
-    export __DistroRid="\${OSRid}-$__Arch"
+    # init the host distro name
+    initHostDistroRid
+    export __DistroRid="$__HostDistroRid"
 fi
 
 fi
 
-$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/packages.builds -DistroRid=$__DistroRid -UseSharedCompilation=false -BuildNugetPackage=false $unprocessedBuildArgs
+$__ProjectRoot/run.sh build-packages -Project=$__ProjectRoot/src/.nuget/packages.builds -DistroRid=$__DistroRid -UseSharedCompilation=false -BuildNugetPackage=false -MsBuildEventLogging="/l:BinClashLogger,Tools/Microsoft.DotNet.Build.Tasks.dll;LogFile=binclash.log" $unprocessedBuildArgs
 if [ $? -ne 0 ]
 then
     echo "ERROR: An error occurred while building packages; See build-packages.log for more details."
 if [ $? -ne 0 ]
 then
     echo "ERROR: An error occurred while building packages; See build-packages.log for more details."