Fix non-portable build (#38095)
authorGleb Balykov <g.balykov@samsung.com>
Mon, 22 Jun 2020 12:28:33 +0000 (15:28 +0300)
committerGitHub <noreply@github.com>
Mon, 22 Jun 2020 12:28:33 +0000 (05:28 -0700)
eng/build.sh
src/coreclr/crossgen-corelib.proj
src/coreclr/runtime.proj

index 6fb8f90..97df9cd 100755 (executable)
@@ -73,6 +73,7 @@ usage()
   echo "  --cmakeargs                User-settable additional arguments passed to CMake."
   echo "  --gcc                      Optional argument to build using gcc in PATH (default)."
   echo "  --gccx.y                   Optional argument to build using gcc version x.y."
+  echo "  --portablebuild            Optional argument: set to false to force a non-portable build."
   echo ""
 
   echo "Command line arguments starting with '/p:' are passed through to MSBuild."
@@ -121,9 +122,7 @@ initDistroRid()
     local targetOs="$1"
     local buildArch="$2"
     local isCrossBuild="$3"
-    # For RID calculation purposes, say we are always a portable build
-    # All of our packages that use the distro rid (CoreCLR packages) are portable.
-    local isPortableBuild=1
+    local isPortableBuild="$4"
 
     # Only pass ROOTFS_DIR if __DoCrossArchBuild is specified.
     if (( isCrossBuild == 1 )); then
@@ -141,6 +140,7 @@ arguments=''
 cmakeargs=''
 extraargs=''
 crossBuild=0
+portableBuild=1
 
 source $scriptroot/native/init-os-and-arch.sh
 
@@ -361,6 +361,19 @@ while [[ $# > 0 ]]; do
       shift 1
       ;;
 
+     -portablebuild)
+      if [ -z ${2+x} ]; then
+        echo "No value for portablebuild is supplied. See help (--help) for supported values." 1>&2
+        exit 1
+      fi
+      passedPortable="$(echo "$2" | awk '{print tolower($0)}')"
+      if [ "$passedPortable" = false ]; then
+        portableBuild=0
+        arguments="$arguments /p:PortableBuild=false"
+      fi
+      shift 2
+      ;;
+
       *)
       extraargs="$extraargs $1"
       shift 1
@@ -372,7 +385,7 @@ if [ ${#actInt[@]} -eq 0 ]; then
     arguments="-restore -build $arguments"
 fi
 
-initDistroRid $os $arch $crossBuild
+initDistroRid $os $arch $crossBuild $portableBuild
 
 # URL-encode space (%20) to avoid quoting issues until the msbuild call in /eng/common/tools.sh.
 # In *proj files (XML docs), URL-encoded string are rendered in their decoded form.
index 1027019..bf26cd2 100644 (file)
@@ -7,6 +7,8 @@
       <_CoreClrBuildArg Condition="'$(TargetArchitecture)' != ''" Include="-$(TargetArchitecture)" />
       <_CoreClrBuildArg Include="-$(Configuration.ToLower())" />
       <_CoreClrBuildArg Condition="!$([MSBuild]::IsOsPlatform(Windows))" Include="-os $(TargetOS)" />
+      <_CoreClrBuildArg Condition="'$(CrossBuild)' == 'true'" Include="-cross" />
+      <_CoreClrBuildArg Condition="'$(PortableBuild)' != 'true'" Include="-portablebuild=false" />
     </ItemGroup>
 
     <PropertyGroup>
index a78af66..f0da8c0 100644 (file)
@@ -10,6 +10,7 @@
       <_CoreClrBuildArg Include="$(Compiler)" />
       <_CoreClrBuildArg Condition="'$(ContinuousIntegrationBuild)' == 'true'" Include="-ci" />
       <_CoreClrBuildArg Condition="'$(CrossBuild)' == 'true'" Include="-cross" />
+      <_CoreClrBuildArg Condition="'$(PortableBuild)' != 'true'" Include="-portablebuild=false" />
       <_CoreClrBuildArg Condition="!$([MSBuild]::IsOsPlatform(Windows))" Include="-os $(TargetOS)" />
 
       <_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and