Deduplicate some build configuration code (dotnet/coreclr#27636)
authorAdeel Mujahid <adeelbm@outlook.com>
Mon, 11 Nov 2019 14:36:16 +0000 (16:36 +0200)
committerJan Vorlicek <janvorli@microsoft.com>
Mon, 11 Nov 2019 14:36:16 +0000 (15:36 +0100)
commit255f3845ca103a5ae370798d6362d1e12e07d9d1
tree02977caf15de439d0e86df6bb3fda3e597edae13
parentbb491848ce0e2eb5680bc8c59067f20474d26363
Deduplicate some build configuration code (dotnet/coreclr#27636)

* Deduplicate some build configuration code
While working on another PR, noticed that currently it requires
updating two places to add a new platform/compiler/architecture
configuration. This PR tries to consolidate the code.

Changes:

* replace `read_array` custom function with a simple `grep -v` call.
* remove `$__PortableLinux` from build-test.sh, as it is unused.
* move argument parsing and few common functions in `build.sh` and
  `build-test.sh` in `_build-commons.sh` and sourced it.
  * combine the long case-esac block and sort cases alphabetically.
    * add missing `hyphen-less|hyphened)` variants.
  * sort `CPUName` and `OSName` list.
  * changed `__CommonMSBuildArgs` from array to string in
    `build-test.sh`, as it is in `build.sh`.
* sort local argument names in build/build-test alphabetically at
  declaration site.
* merge `locate_llvm_exec` and `locate_gcc_exec` into a single
  `locate_toolchain_exec` cmake function.
  * this enables overriding individual llvm tool via `CLR_<TOOLNAME>`
    environment variable, as it was supported by `locate_gcc_exec`
    today.

* Merge dotnet/master to fix/deduplicate-configs

* Merge conflict

* Move __CrossBuild check back to build.sh

Commit migrated from https://github.com/dotnet/coreclr/commit/a15413fd520f7f25273b92d1087b5f7964801dba
src/coreclr/_build-commons.sh [new file with mode: 0755]
src/coreclr/build-test.sh
src/coreclr/build.sh
src/coreclr/configuretools.cmake