Various fixes for generating portable RID packages (#10409)
authorGaurav Khanna <gkhanna@microsoft.com>
Thu, 23 Mar 2017 06:25:57 +0000 (23:25 -0700)
committerGitHub <noreply@github.com>
Thu, 23 Mar 2017 06:25:57 +0000 (23:25 -0700)
build-packages.sh
build.sh
src/.nuget/dir.props

index 0dd1035..382e24d 100755 (executable)
@@ -3,16 +3,16 @@
 usage()
 {
     echo "Builds the NuGet packages from the binaries that were built in the Build product binaries step."
-    echo "Usage: build-packages -BuildArch -BuildType [portableLinux]"
+    echo "Usage: build-packages -BuildArch -BuildType [-portable]"
     echo "BuildArch can be x64, x86, arm, arm64 (default is x64)"
     echo "BuildType can be release, checked, debug (default is debug)"
-    echo "portableLinux - build for Portable Linux Distribution"
+    echo "-portable - build for Portable Distribution"
     echo
     exit 1
 }
 
 __ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-__PortableLinux=0
+__PortableBuild=0
 
 # Use uname to determine what the OS is.
 OSName=$(uname -s)
@@ -71,13 +71,8 @@ while :; do
         __Arch=$(echo $1| cut -d'=' -f 2)
         ;;
 
-        portableLinux)
-            if [ "$__BuildOS" == "Linux" ]; then
-                __PortableLinux=1
-            else
-                echo "ERROR: portableLinux not supported for non-Linux platforms."
-                exit 1
-            fi
+        -portableBuild)
+            __PortableBuild=1
             ;;
         *)
         unprocessedBuildArgs="$unprocessedBuildArgs $1"
@@ -85,9 +80,13 @@ while :; do
     shift
 done
 
-# Portable builds target the base RID only for Linux based platforms
-if [ $__PortableLinux == 1 ]; then
-    export __DistroRid="linux-$__Arch"
+# Portable builds target the base RID
+if [ $__PortableBuild == 1 ]; then
+    if [ "$__BuildOS" == "Linux" ]; then
+        export __DistroRid="linux-$__Arch"
+    elif [ "$__BuildOS" == "OSX" ]; then
+        export __DistroRid="osx-$__Arch"
+    fi
 else
     export __DistroRid="\${OSRid}-$__Arch"
 fi
index e97fbb0..76ee105 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -84,7 +84,7 @@ initTargetDistroRid()
         export __DistroRid="$__HostDistroRid"
     fi
 
-    # Portable builds target the base RID only for Linux based platforms
+    # Portable builds target the base RID
     if [ $__PortableBuild == 1 ]; then
         if [ "$__BuildOS" == "Linux" ]; then
             export __DistroRid="linux-$__BuildArch"
index 6f9e29c..082242a 100644 (file)
     <When Condition="'$(_runtimeOSFamily)' == 'osx'">
       <PropertyGroup>
         <PackageRID>osx.10.12-$(ArchGroup)</PackageRID>
+        <!-- Set the platform part of the RID if we are doing a portable build -->
+        <PackageRID Condition="'$(PortableBuild)' == '1'">osx-$(ArchGroup)</PackageRID>
       </PropertyGroup>
     </When>
     <When Condition="'$(_runtimeOSFamily)' == 'rhel'">
       <PropertyGroup>
         <PackageRID>rhel.7-$(ArchGroup)</PackageRID>
+        <!-- Set the platform part of the RID if we are doing a portable build -->
+        <PackageRID Condition="'$(PortableBuild)' == '1'">linux-$(ArchGroup)</PackageRID>
       </PropertyGroup>
     </When>
     <Otherwise>
       <PropertyGroup>
         <PackageRID>$(RuntimeOS)-$(ArchGroup)</PackageRID>
+        <!-- Set the platform part of the RID if we are doing a portable build -->
+        <PackageRID Condition="'$(PortableBuild)' == '1'">linux-$(ArchGroup)</PackageRID>
       </PropertyGroup>
     </Otherwise>
   </Choose>