Merge remote-tracking branch 'dotnet/master' into RemoveNetcoreappNetfxBuildScripts

This commit is contained in:
Santiago Fernandez Madero 2020-01-23 10:30:39 -08:00
commit 66148892f1
97 changed files with 1459 additions and 5583 deletions

View File

@ -95,7 +95,7 @@ namespace System.Collections.Generic
private void InsertNodeBefore(LinkedListNode<T> node, LinkedListNode<T> newNode)
{
...
...
}
...
@ -124,10 +124,10 @@ namespace System.Collections.Generics
_parent = parent;
_value = value;
}
public T Value
{
get { return _value; }
get { return _value; }
}
}

View File

@ -1,5 +1,4 @@
# Crossgen2 Driven Compilation structure enhancements
-----
Adding version bubbles and complex compilation rules to compilation in crossgen2 for .NET 5.
@ -7,9 +6,10 @@ This document describes the concept of a version bubble, how to specify them to
## Behavior of code that shares a version bubble
1. Inlining is only permitted within a version bubble unless the method is marked with System.Runtime.Versioning.NonVersionableAttribute. If the inlinee is marked as NonVersionable, it may ALWAYS be inlined into the method being compiled.
1. Inlining is only permitted within a version bubble unless the method is marked with `System.Runtime.Versioning.NonVersionableAttribute`. If the inlinee is marked as NonVersionable, it may ALWAYS be inlined into the method being compiled.
2. Generic instantiations may only be ahead of time compiled into the application if the definition of the generic is defined within the version bubble as well as the instantiation arguments to the generic. As an exception to the requirement for the instantiation arguments to be defined within the bubble, the shared generic type `System.__Canon` will always be considered to be part of the version bubble. Also, the list of very well known types (object, string, int, uint, short, ushort, byte, sbyte, long, ulong, float, double, IntPtr, and UIntPtr) are also considered to be part of the version bubble as long as the generic is not constrained on an interface or class. For Example
```
```csharp
class MyGeneric<T> {}
class ConstrainedGeneric<T> where T : IEquatable<T> {}
...
@ -21,11 +21,13 @@ class ConstrainedGeneric<T> where T : IEquatable<T> {}
## Behavior of code that shares a compilation group
A compilation group is a set of assemblies that are compiled together. Typically in the customer case, this is a set of assemblies that is compiled in a similar timescale. In general, all assemblies compiled at once are considered to be part of the same version bubble, but in the case of the the core libraries and ASP.NET this isn't actually true. Both of these layers include assemblies which support replacement by either higher layers (in the case of the WinForms/WPF frameworks) or by the application (in the case of ASP.NET)
A compilation group is a set of assemblies that are compiled together. Typically in the customer case, this is a set of assemblies that is compiled in a similar timescale. In general, all assemblies compiled at once are considered to be part of the same version bubble, but in the case of the core libraries and ASP.NET this isn't actually true. Both of these layers include assemblies which support replacement by either higher layers (in the case of the WinForms/WPF frameworks) or by the application (in the case of ASP.NET).
## Specifying a version bubble in a project file
The end user developer will specify which version bubble an application is using with a notation such as the following in the project file of application.
```
```xml
<PropertyGroup>
<CompilationVersionBubble>XXX</CompilationVersionBubble>
</PropertyGroup>
@ -37,7 +39,7 @@ The default value of the CompilationVersionBubble flag would be dependent on how
## Specifying the version bubble on the crossgen2 command line
There are 3 sets of files to pass to crossgen2.
There are 3 sets of files to pass to crossgen2:
1. The set of files that are referenceable by the compilation. These are specified via the --reference switch.
2. The set of files that comprise the set of assemblies being compiled at once. These are specified via the --input-file-path switch. (The first assembly specified in this list describes module actually to be compiled and output. When we add support for composite R2R images, we will produce a single module file from all of these input assemblies at once.)
@ -45,19 +47,21 @@ There are 3 sets of files to pass to crossgen2.
## Choice of what code to compile
###Principles
### Principles
1. Ahead of time generated code exists to improve startup, and for some scenarios will be retained for the lifetime of the process.
2. Our default scenario relies on on tiered compilation rejit for best performance.
3. Too much pregenerated code will negatively affect applications. Startup is the critical detail for most pregeneration scenarios, and for those, there is a blend of time to pull the file to the CPU (from disk, over the network, etc.) and to compile functions. Striking the right blend has been discovered to be critical.
###Proposed approach
### Proposed approach
Note, this approach is probably more complete than we will finish in one release, but encompasses a large set of future vision in this space.
For non-generic code this is straightforward. Either compile all the non-generic code in the binary, or compile only that which is specified via a profile guided optimization step. This choice shall be driven by a per "input assembly" switch as in the presence of a composite R2R image we likely will want to have different policy for different assemblies, as has proven valuable in the past. Until proven otherwise, per assembly specification of this behavior shall be considered to be sufficient.
We shall set a guideline for how much generic code to generate, and the amount of generic code to generate shall be gated as a multiplier of the amount of non-generic code generated.
For generic code we also need a per assembly switch to adjust between various behaviors, but the proposal is as follows.
For generic code we also need a per assembly switch to adjust between various behaviors, but the proposal is as follows:
1. We compile the non-generic code aggressively and we compile generic code specified via a profile guide aggressively. These compilations will ignore any generics size limitations.
2. We compile the generic code directly referenced by the above logic. These compilations will be gated on fitting within the generics compilation budget.
@ -68,7 +72,8 @@ For generic code we also need a per assembly switch to adjust between various be
- Precompilation of statically discoverable cross-module instantiations for self-contained and docker scenarios if CompilationVersionBubble >= Application. Here, statically discoverable instantiations can be loaded from the typespecs and methodspecs in the metadata of the input files that comprise the version bubble tied to the assembly being compiled
## Reducing generics duplication
With the advent of a version bubble larger than a single binary and the ability to generate generics, comes the problem of managing the multiple copies of generic code that might be generated.
With the advent of a version bubble larger than a single binary and the ability to generate generics, comes the problem of managing the multiple copies of generic code that might be generated.
The traditional NGEN model was to greedily generate generic code everywhere and assume it wouldn't get out of hand. As generics have become more used and applications have become more broken down into many assemblies, this model has become less workable, and thus this model attempts to prevent such overgeneration.
@ -87,13 +92,16 @@ I propose to reduce the generics duplication problem to allow duplication betwee
The second approach is to split compilation up into assembly level units, run the heuristics per assembly, generate the completely local generics in the individual assemblies, and then nominate a final mop up assembly that consumes a series of data files produced by the individual assembly compilations and holds all of the stuff that didn't make sense in the individual assemblies. In my opinion this second approach would be better for debug builds, but the first approach is strictly better for release builds, and really shouldn't be terribly slow.
# Proposal
Address the reducing generics duplication concern by implementing composite R2R files instead of attempting to build a multifile approach, where each layer is expected to know the exact layer above, or be fully R2R with respect to all layers above. Loading of R2R images built with version bubble dependence will lazily verify that version rules are not violated, and produce a FailFast if version bubble usage rules are used incorrectly. For customers which produce customized versions of the underlying frameworks, if any differences are present they will likely be forced to provide their own targeting packs to use the fully AOT layered scenarios.
## Expected Benefits of this design
## Expected benefits of this design
1. Allow for best performance standalone applications. (Primarily targeting the hyperscale scenario. Benefits for regular UI standalone applications would also likely be present, but not significant enough to drive this effort.)
2. Support a layered Docker image model for high performance smaller applications. This is driven by the presence of a generics budget that is application wide (to allow customers to control distribution size of applications, as well as the ability to capture a really good set of precompiled generics to optimize startup time. The biggest precompiled wins here are the ability to AOT compile portions of CoreLib into these applications such as appropriate parts of the task infrastructure, as well as collections.)
3. Allows use of proven technology (profile guided optimization) to drive generics compilation for high value customers, while also provided an opportunity for innovation in heuristics.
## Issues to resolve with this proposal
1. This proposal needs to be squared with our servicing policies and ensure that we aren't affecting preventing promised servicing capabilities.
- In particular, there has been a concept in the past about making self contained applications serviceable through a machine wide policy key. We would need to design what our plans are here.
- In particular, there has been a concept in the past about making self contained applications serviceable through a machine wide policy key. We would need to design what our plans are here.

479
eng/native/build-commons.sh Executable file
View File

@ -0,0 +1,479 @@
#!/usr/bin/env bash
initTargetDistroRid()
{
source "$__RepoRootDir/eng/native/init-distro-rid.sh"
local passedRootfsDir=""
# Only pass ROOTFS_DIR if cross is specified.
if [[ "$__CrossBuild" == 1 ]]; then
passedRootfsDir="$ROOTFS_DIR"
fi
initDistroRidGlobal "$__BuildOS" "$__BuildArch" "$__PortableBuild" "$passedRootfsDir"
}
isMSBuildOnNETCoreSupported()
{
__IsMSBuildOnNETCoreSupported="$__msbuildonunsupportedplatform"
if [[ "$__IsMSBuildOnNETCoreSupported" == 1 ]]; then
return
fi
if [[ "$__SkipManaged" == 1 ]]; then
__IsMSBuildOnNETCoreSupported=0
return
fi
if [[ ( "$__HostOS" == "Linux" ) && ( "$__HostArch" == "x64" || "$__HostArch" == "arm" || "$__HostArch" == "arm64" ) ]]; then
__IsMSBuildOnNETCoreSupported=1
elif [[ "$__HostArch" == "x64" && ( "$__HostOS" == "OSX" || "$__HostOS" == "FreeBSD" ) ]]; then
__IsMSBuildOnNETCoreSupported=1
fi
}
setup_dirs()
{
echo Setting up directories for build
mkdir -p "$__RootBinDir"
mkdir -p "$__BinDir"
mkdir -p "$__IntermediatesDir"
}
# Check the system to ensure the right prereqs are in place
check_prereqs()
{
echo "Checking prerequisites..."
# Check presence of CMake on the path
command -v cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }
function version { echo "$@" | awk -F. '{ printf("%d%02d%02d\n", $1,$2,$3); }'; }
local cmake_version="$(cmake --version | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")"
if [[ "$(version "$cmake_version")" -lt "$(version 3.14.2)" ]]; then
echo "Please install CMake 3.14.2 or newer from http://www.cmake.org/download/ or https://apt.kitware.com and ensure it is on your path."; exit 1;
fi
if [[ "$__UseNinja" == 1 ]]; then
command -v ninja 2>/dev/null || command -v ninja-build 2>/dev/null || { echo "Unable to locate ninja!"; exit 1; }
fi
}
build_native()
{
platformArch="$1"
cmakeDir="$2"
tryrunDir="$3"
intermediatesDir="$4"
message="$5"
# All set to commence the build
echo "Commencing build of \"$message\" for $__BuildOS.$__BuildArch.$__BuildType in $intermediatesDir"
if [[ "$__UseNinja" == 1 ]]; then
generator="ninja"
buildTool="$(command -v ninja || command -v ninja-build)"
else
buildTool="make"
fi
if [[ "$__SkipConfigure" == 0 ]]; then
# if msbuild is not supported, then set __SkipGenerateVersion to 1
if [[ "$__IsMSBuildOnNETCoreSupported" == 0 ]]; then __SkipGenerateVersion=1; fi
# Drop version.c file
__versionSourceFile="$intermediatesDir/version.c"
if [[ "$__SkipGenerateVersion" == 0 ]]; then
"$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary "$__ArcadeScriptArgs" "$__RepoRootDir"/eng/empty.csproj \
/p:NativeVersionFile="$__versionSourceFile" \
/t:GenerateNativeVersionFile /restore \
$__CommonMSBuildArgs $__UnprocessedBuildArgs
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to generate native version file."
exit "$exit_code"
fi
else
# Generate the dummy version.c, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
__versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
if [[ -e "$__versionSourceFile" ]]; then
read existingVersionSourceLine < "$__versionSourceFile"
fi
if [[ "$__versionSourceLine" != "$existingVersionSourceLine" ]]; then
echo "$__versionSourceLine" > "$__versionSourceFile"
fi
fi
if [[ "$__StaticAnalyzer" == 1 ]]; then
scan_build=scan-build
fi
engNativeDir="$__RepoRootDir/eng/native"
__CMakeArgs="-DCLR_ENG_NATIVE_DIR=\"$engNativeDir\" $__CMakeArgs"
nextCommand="\"$engNativeDir/gen-buildsys.sh\" \"$cmakeDir\" \"$tryrunDir\" \"$intermediatesDir\" $platformArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType \"$generator\" $scan_build $__CMakeArgs"
echo "Invoking $nextCommand"
eval $nextCommand
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to generate \"$message\" build project!"
exit "$exit_code"
fi
fi
# Check that the makefiles were created.
if [[ ! -f "$intermediatesDir/CMakeCache.txt" ]]; then
echo "${__ErrMsgPrefix}Unable to find generated build files for \"$message\" project!"
exit 1
fi
# Build
if [[ "$__ConfigureOnly" == 1 ]]; then
echo "Finish configuration & skipping \"$message\" build."
return
fi
if [[ "$__StaticAnalyzer" == 1 ]]; then
pushd "$intermediatesDir"
buildTool="$SCAN_BUILD_COMMAND -o $__BinDir/scan-build-log $buildTool"
echo "Executing $buildTool install -j $__NumProc"
"$buildTool" install -j "$__NumProc"
popd
else
echo "Executing cmake --build \"$intermediatesDir\" --target install -j $__NumProc"
cmake --build "$intermediatesDir" --target install -j "$__NumProc"
fi
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to build \"$message\"."
exit "$exit_code"
fi
}
usage()
{
echo "Usage: $0 <options>"
echo ""
echo "Common Options:"
echo ""
echo "BuildArch can be: -arm, -armel, -arm64, -armel, x64, x86, -wasm"
echo "BuildType can be: -debug, -checked, -release"
echo "-bindir: output directory (defaults to $__ProjectRoot/artifacts)"
echo "-ci: indicates if this is a CI build."
echo "-clang: optional argument to build using clang in PATH (default)."
echo "-clangx.y: optional argument to build using clang version x.y."
echo "-cmakeargs: user-settable additional arguments passed to CMake."
echo "-configureonly: do not perform any builds; just configure the build."
echo "-cross: optional argument to signify cross compilation,"
echo " will use ROOTFS_DIR environment variable if set."
echo "-gcc: optional argument to build using gcc in PATH."
echo "-gccx.y: optional argument to build using gcc version x.y."
echo "-msbuildonunsupportedplatform: build managed binaries even if distro is not officially supported."
echo "-ninja: target ninja instead of GNU make"
echo "-numproc: set the number of build processes."
echo "-portablebuild: pass -portablebuild=false to force a non-portable build."
echo "-skipconfigure: skip build configuration."
echo "-skipgenerateversion: disable version generation even if MSBuild is supported."
echo "-stripsymbols: skip native image generation."
echo "-verbose: optional argument to enable verbose build output."
echo ""
echo "Additional Options:"
echo ""
for i in "${!usage_list[@]}"; do
echo "${usage_list[${i}]}"
done
echo ""
exit 1
}
# Use uname to determine what the CPU is.
CPUName=$(uname -p)
# Some Linux platforms report unknown for platform, but the arch for machine.
if [[ "$CPUName" == "unknown" ]]; then
CPUName=$(uname -m)
fi
case "$CPUName" in
aarch64)
__BuildArch=arm64
__HostArch=arm64
;;
amd64)
__BuildArch=x64
__HostArch=x64
;;
armv7l)
echo "Unsupported CPU $CPUName detected, build might not succeed!"
__BuildArch=arm
__HostArch=arm
;;
i686)
echo "Unsupported CPU $CPUName detected, build might not succeed!"
__BuildArch=x86
__HostArch=x86
;;
x86_64)
__BuildArch=x64
__HostArch=x64
;;
*)
echo "Unknown CPU $CPUName detected, configuring as if for x64"
__BuildArch=x64
__HostArch=x64
;;
esac
# Use uname to determine what the OS is.
OSName=$(uname -s)
case "$OSName" in
Darwin)
__BuildOS=OSX
__HostOS=OSX
;;
FreeBSD)
__BuildOS=FreeBSD
__HostOS=FreeBSD
;;
Linux)
__BuildOS=Linux
__HostOS=Linux
;;
NetBSD)
__BuildOS=NetBSD
__HostOS=NetBSD
;;
OpenBSD)
__BuildOS=OpenBSD
__HostOS=OpenBSD
;;
SunOS)
__BuildOS=SunOS
__HostOS=SunOS
;;
*)
echo "Unsupported OS $OSName detected, configuring as if for Linux"
__BuildOS=Linux
__HostOS=Linux
;;
esac
__msbuildonunsupportedplatform=0
while :; do
if [[ "$#" -le 0 ]]; then
break
fi
lowerI="$(echo "$1" | awk '{print tolower($0)}')"
case "$lowerI" in
-\?|-h|--help)
usage
exit 1
;;
arm|-arm)
__BuildArch=arm
;;
arm64|-arm64)
__BuildArch=arm64
;;
armel|-armel)
__BuildArch=armel
;;
bindir|-bindir)
if [[ -n "$2" ]]; then
__RootBinDir="$2"
if [[ ! -d "$__RootBinDir" ]]; then
mkdir "$__RootBinDir"
fi
__RootBinParent=$(dirname "$__RootBinDir")
__RootBinName="${__RootBinDir##*/}"
__RootBinDir="$(cd "$__RootBinParent" &>/dev/null && printf %s/%s "$PWD" "$__RootBinName")"
shift
else
echo "ERROR: 'bindir' requires a non-empty option argument"
exit 1
fi
;;
checked|-checked)
__BuildType=Checked
;;
ci|-ci)
__ArcadeScriptArgs="--ci"
__ErrMsgPrefix="##vso[task.logissue type=error]"
;;
clang*|-clang*)
__Compiler=clang
# clangx.y or clang-x.y
version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
parts=(${version//./ })
__CompilerMajorVersion="${parts[0]}"
__CompilerMinorVersion="${parts[1]}"
if [[ -z "$__CompilerMinorVersion" && "$__CompilerMajorVersion" -le 6 ]]; then
__CompilerMinorVersion=0;
fi
;;
cmakeargs|-cmakeargs)
if [[ -n "$2" ]]; then
__CMakeArgs="$2 $__CMakeArgs"
shift
else
echo "ERROR: 'cmakeargs' requires a non-empty option argument"
exit 1
fi
;;
configureonly|-configureonly)
__ConfigureOnly=1
__SkipMSCorLib=1
__SkipNuget=1
;;
cross|-cross)
__CrossBuild=1
;;
debug|-debug)
__BuildType=Debug
;;
gcc*|-gcc*)
__Compiler=gcc
# gccx.y or gcc-x.y
version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
parts=(${version//./ })
__CompilerMajorVersion="${parts[0]}"
__CompilerMinorVersion="${parts[1]}"
;;
msbuildonunsupportedplatform|-msbuildonunsupportedplatform)
__msbuildonunsupportedplatform=1
;;
ninja|-ninja)
__UseNinja=1
;;
numproc|-numproc)
if [[ -n "$2" ]]; then
__NumProc="$2"
shift
else
echo "ERROR: 'numproc' requires a non-empty option argument"
exit 1
fi
;;
portablebuild=false|-portablebuild=false)
__PortableBuild=0
;;
release|-release)
__BuildType=Release
;;
skipconfigure|-skipconfigure)
__SkipConfigure=1
;;
skipgenerateversion|-skipgenerateversion)
__SkipGenerateVersion=1
;;
stripsymbols|-stripsymbols)
__CMakeArgs="-DSTRIP_SYMBOLS=true $__CMakeArgs"
;;
verbose|-verbose)
__VerboseBuild=1
;;
x86|-x86)
__BuildArch=x86
;;
x64|-x64)
__BuildArch=x64
;;
wasm|-wasm)
__BuildArch=wasm
;;
*)
handle_arguments "$1" "$2"
if [[ "$__ShiftArgs" == 1 ]]; then
shift
__ShiftArgs=0
fi
;;
esac
shift
done
# Get the number of processors available to the scheduler
# Other techniques such as `nproc` only get the number of
# processors available to a single process.
platform=$(uname)
if [[ "$platform" == "FreeBSD" ]]; then
__NumProc=$(sysctl hw.ncpu | awk '{ print $2+1 }')
elif [[ "$platform" == "NetBSD" ]]; then
__NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
elif [[ "$platform" == "Darwin" ]]; then
__NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
else
__NumProc=$(nproc --all)
fi
__CommonMSBuildArgs="/p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__BuildOS=$__BuildOS /nodeReuse:false $__OfficialBuildIdArg $__SignTypeArg $__SkipRestoreArg"
# Configure environment if we are doing a verbose build
if [[ "$__VerboseBuild" == 1 ]]; then
export VERBOSE=1
__CommonMSBuildArgs="$__CommonMSBuildArgs /v:detailed"
fi
if [[ "$__PortableBuild" == 0 ]]; then
__CommonMSBuildArgs="$__CommonMSBuildArgs /p:PortableBuild=false"
fi
# Configure environment if we are doing a cross compile.
if [[ "$__CrossBuild" == 1 ]]; then
export CROSSCOMPILE=1
if [[ ! -n "$ROOTFS_DIR" ]]; then
export ROOTFS_DIR="$__RepoRootDir/.tools/rootfs/$__BuildArch"
fi
fi
# init the target distro name
initTargetDistroRid
# Init if MSBuild for .NET Core is supported for this platform
isMSBuildOnNETCoreSupported

View File

@ -0,0 +1,182 @@
include(CheckPIESupported)
# All code we build should be compiled as position independent
check_pie_supported(OUTPUT_VARIABLE PIE_SUPPORT_OUTPUT LANGUAGES CXX)
if(NOT MSVC AND NOT CMAKE_CXX_LINK_PIE_SUPPORTED)
message(WARNING "PIE is not supported at link time: ${PIE_SUPPORT_OUTPUT}.\n"
"PIE link options will not be passed to linker.")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#----------------------------------------
# Detect and set platform variable names
# - for non-windows build platform & architecture is detected using inbuilt CMAKE variables and cross target component configure
# - for windows we use the passed in parameter to CMAKE to determine build arch
#----------------------------------------
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CLR_CMAKE_HOST_UNIX 1)
if(CLR_CROSS_COMPONENTS_BUILD)
# CMAKE_HOST_SYSTEM_PROCESSOR returns the value of `uname -p` on host.
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm" OR CLR_CMAKE_TARGET_ARCH STREQUAL "armel")
if(CMAKE_CROSSCOMPILING)
set(CLR_CMAKE_HOST_UNIX_X86 1)
else()
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
endif()
else()
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
endif()
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL i686)
set(CLR_CMAKE_HOST_UNIX_X86 1)
else()
clr_unknown_arch()
endif()
else()
# CMAKE_SYSTEM_PROCESSOR returns the value of `uname -p` on target.
# For the AMD/Intel 64bit architecture two different strings are common.
# Linux and Darwin identify it as "x86_64" while FreeBSD and netbsd uses the
# "amd64" string. Accept either of the two here.
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
set(CLR_CMAKE_HOST_UNIX_ARM 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
set(CLR_CMAKE_HOST_UNIX_ARM 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(CLR_CMAKE_HOST_UNIX_ARM64 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
set(CLR_CMAKE_HOST_UNIX_X86 1)
else()
clr_unknown_arch()
endif()
endif()
set(CLR_CMAKE_HOST_LINUX 1)
# Detect Linux ID
set(LINUX_ID_FILE "/etc/os-release")
if(CMAKE_CROSSCOMPILING)
set(LINUX_ID_FILE "${CMAKE_SYSROOT}${LINUX_ID_FILE}")
endif()
execute_process(
COMMAND bash -c "source ${LINUX_ID_FILE} && echo \$ID"
OUTPUT_VARIABLE CLR_CMAKE_LINUX_ID
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(DEFINED CLR_CMAKE_LINUX_ID)
if(CLR_CMAKE_LINUX_ID STREQUAL tizen)
set(CLR_CMAKE_TARGET_TIZEN_LINUX 1)
elseif(CLR_CMAKE_LINUX_ID STREQUAL alpine)
set(CLR_CMAKE_HOST_ALPINE_LINUX 1)
endif()
endif(DEFINED CLR_CMAKE_LINUX_ID)
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CLR_CMAKE_HOST_DARWIN 1)
set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_C_COMPILER} <FLAGS> <DEFINES> <INCLUDES> -o <OBJECT> -c <SOURCE>")
endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CLR_CMAKE_HOST_FREEBSD 1)
endif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
if(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CLR_CMAKE_HOST_OPENBSD 1)
endif(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
if(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CLR_CMAKE_HOST_NETBSD 1)
endif(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
if(CMAKE_SYSTEM_NAME STREQUAL SunOS)
set(CLR_CMAKE_HOST_UNIX 1)
EXECUTE_PROCESS(
COMMAND isainfo -n
OUTPUT_VARIABLE SUNOS_NATIVE_INSTRUCTION_SET
)
if(SUNOS_NATIVE_INSTRUCTION_SET MATCHES "amd64")
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CMAKE_SYSTEM_PROCESSOR "amd64")
else()
clr_unknown_arch()
endif()
set(CLR_CMAKE_HOST_SUNOS 1)
endif(CMAKE_SYSTEM_NAME STREQUAL SunOS)
#--------------------------------------------
# This repo builds two set of binaries
# 1. binaries which execute on target arch machine
# - for such binaries host architecture & target architecture are same
# - eg. coreclr.dll
# 2. binaries which execute on host machine but target another architecture
# - host architecture is different from target architecture
# - eg. crossgen.exe - runs on x64 machine and generates nis targeting arm64
# - for complete list of such binaries refer to file crosscomponents.cmake
#-------------------------------------------------------------
# Set HOST architecture variables
if(CLR_CMAKE_HOST_UNIX_ARM)
set(CLR_CMAKE_HOST_ARCH_ARM 1)
set(CLR_CMAKE_HOST_ARCH "arm")
elseif(CLR_CMAKE_HOST_UNIX_ARM64)
set(CLR_CMAKE_HOST_ARCH_ARM64 1)
set(CLR_CMAKE_HOST_ARCH "arm64")
elseif(CLR_CMAKE_HOST_UNIX_AMD64)
set(CLR_CMAKE_HOST_ARCH_AMD64 1)
set(CLR_CMAKE_HOST_ARCH "x64")
elseif(CLR_CMAKE_HOST_UNIX_X86)
set(CLR_CMAKE_HOST_ARCH_I386 1)
set(CLR_CMAKE_HOST_ARCH "x86")
elseif(WIN32)
# CLR_CMAKE_HOST_ARCH is passed in as param to cmake
if (CLR_CMAKE_HOST_ARCH STREQUAL x64)
set(CLR_CMAKE_HOST_ARCH_AMD64 1)
elseif(CLR_CMAKE_HOST_ARCH STREQUAL x86)
set(CLR_CMAKE_HOST_ARCH_I386 1)
elseif(CLR_CMAKE_HOST_ARCH STREQUAL arm)
set(CLR_CMAKE_HOST_ARCH_ARM 1)
elseif(CLR_CMAKE_HOST_ARCH STREQUAL arm64)
set(CLR_CMAKE_HOST_ARCH_ARM64 1)
else()
clr_unknown_arch()
endif()
endif()
# Set TARGET architecture variables
# Target arch will be a cmake param (optional) for both windows as well as non-windows build
# if target arch is not specified then host & target are same
if(NOT DEFINED CLR_CMAKE_TARGET_ARCH OR CLR_CMAKE_TARGET_ARCH STREQUAL "" )
set(CLR_CMAKE_TARGET_ARCH ${CLR_CMAKE_HOST_ARCH})
endif()
# Set target architecture variables
if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
set(CLR_CMAKE_TARGET_ARCH_AMD64 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
set(CLR_CMAKE_TARGET_ARCH_I386 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
set(CLR_CMAKE_TARGET_ARCH_ARM64 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm)
set(CLR_CMAKE_TARGET_ARCH_ARM 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armel)
set(CLR_CMAKE_TARGET_ARCH_ARM 1)
set(ARM_SOFTFP 1)
else()
clr_unknown_arch()
endif()
# check if host & target arch combination are valid
if(NOT(CLR_CMAKE_TARGET_ARCH STREQUAL CLR_CMAKE_HOST_ARCH))
if(NOT((CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM64) OR (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM)))
message(FATAL_ERROR "Invalid host and target arch combination")
endif()
endif()

View File

@ -3,26 +3,14 @@
# This file invokes cmake and generates the build system for Clang.
#
source="${BASH_SOURCE[0]}"
scriptroot="$( cd -P "$( dirname "$0" )" && pwd )"
# resolve $SOURCE until the file is no longer a symlink
while [[ -h $source ]]; do
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
source="$(readlink "$source")"
# if $source was a relative symlink, we need to resolve it relative to the path where the
# symlink file was located
[[ $source != /* ]] && source="$scriptroot/$source"
done
scriptroot="$( cd -P "$( dirname "$source" )" && pwd )"
if [ $# -lt 4 ]
then
if [[ "$#" -lt 4 ]]; then
echo "Usage..."
echo "gen-buildsys.sh <path to top level CMakeLists.txt> <path to intermediate directory> <path to tryrun.cmake directory> <Architecture> <compiler> <compiler major version> <compiler minor version> [build flavor] [ninja] [scan-build] [cmakeargs]"
echo "gen-buildsys.sh <path to top level CMakeLists.txt> <path to tryrun.cmake directory> <path to intermediate directory> <Architecture> <compiler> <compiler major version> <compiler minor version> [build flavor] [ninja] [scan-build] [cmakeargs]"
echo "Specify the path to the top level CMake file."
echo "Specify the path to the directory with tryrun.cmake file."
echo "Specify the path that the build system files are generated in."
echo "Specify the path to the directory with tryrun.cmake file."
echo "Specify the target architecture."
echo "Specify the name of compiler (clang or gcc)."
echo "Specify the major version of compiler."
@ -41,7 +29,7 @@ cxxCompiler="$compiler++"
majorVersion="$6"
minorVersion="$7"
if [ "$compiler" = "gcc" ]; then cxxCompiler="g++"; fi
if [[ "$compiler" == "gcc" ]]; then cxxCompiler="g++"; fi
check_version_exists() {
desired_version=-1
@ -58,38 +46,38 @@ check_version_exists() {
echo "$desired_version"
}
if [ -z "$CLR_CC" ]; then
if [[ -z "$CLR_CC" ]]; then
# Set default versions
if [ -z "$majorVersion" ]; then
if [[ -z "$majorVersion" ]]; then
# note: gcc (all versions) and clang versions higher than 6 do not have minor version in file name, if it is zero.
if [ "$compiler" = "clang" ]; then versions=( 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
elif [ "$compiler" = "gcc" ]; then versions=( 9 8 7 6 5 4.9 ); fi
if [[ "$compiler" == "clang" ]]; then versions=( 9 8 7 6.0 5.0 4.0 3.9 3.8 3.7 3.6 3.5 )
elif [[ "$compiler" == "gcc" ]]; then versions=( 9 8 7 6 5 4.9 ); fi
for version in "${versions[@]}"; do
parts=(${version//./ })
desired_version="$(check_version_exists "${parts[0]}" "${parts[1]}")"
if [ "$desired_version" != "-1" ]; then majorVersion="${parts[0]}"; break; fi
if [[ "$desired_version" != "-1" ]]; then majorVersion="${parts[0]}"; break; fi
done
if [ -z "$majorVersion" ]; then
if [[ -z "$majorVersion" ]]; then
if command -v "$compiler" > /dev/null; then
if [ "$(uname)" != "Darwin" ]; then
if [[ "$(uname)" != "Darwin" ]]; then
echo "WARN: Specific version of $compiler not found, falling back to use the one in PATH."
fi
export CC="$(command -v "$compiler")"
export CXX="$(command -v "$cxxCompiler")"
CC="$(command -v "$compiler")"
CXX="$(command -v "$cxxCompiler")"
else
echo "ERROR: No usable version of $compiler found."
exit 1
fi
else
if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ]; then
if [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; then
if [[ "$compiler" == "clang" && "$majorVersion" -lt 5 ]]; then
if [[ "$build_arch" == "arm" || "$build_arch" == "armel" ]]; then
if command -v "$compiler" > /dev/null; then
echo "WARN: Found clang version $majorVersion which is not supported on arm/armel architectures, falling back to use clang from PATH."
export CC="$(command -v "$compiler")"
export CXX="$(command -v "$cxxCompiler")"
CC="$(command -v "$compiler")"
CXX="$(command -v "$cxxCompiler")"
else
echo "ERROR: Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH."
exit 1
@ -99,34 +87,36 @@ if [ -z "$CLR_CC" ]; then
fi
else
desired_version="$(check_version_exists "$majorVersion" "$minorVersion")"
if [ "$desired_version" = "-1" ]; then
if [[ "$desired_version" == "-1" ]]; then
echo "ERROR: Could not find specific version of $compiler: $majorVersion $minorVersion."
exit 1
fi
fi
if [ -z "$CC" ]; then
export CC="$(command -v "$compiler$desired_version")"
export CXX="$(command -v "$cxxCompiler$desired_version")"
if [ -z "$CXX" ]; then export CXX="$(command -v "$cxxCompiler")"; fi
if [[ -z "$CC" ]]; then
CC="$(command -v "$compiler$desired_version")"
CXX="$(command -v "$cxxCompiler$desired_version")"
if [[ -z "$CXX" ]]; then CXX="$(command -v "$cxxCompiler")"; fi
fi
else
if [ ! -f "$CLR_CC" ]; then
if [[ ! -f "$CLR_CC" ]]; then
echo "ERROR: CLR_CC is set but path '$CLR_CC' does not exist"
exit 1
fi
export CC="$CLR_CC"
export CXX="$CLR_CXX"
CC="$CLR_CC"
CXX="$CLR_CXX"
fi
if [ -z "$CC" ]; then
if [[ -z "$CC" ]]; then
echo "ERROR: Unable to find $compiler."
exit 1
fi
export CCC_CC="$CC"
export CCC_CXX="$CXX"
export SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version")"
CCC_CC="$CC"
CCC_CXX="$CXX"
SCAN_BUILD_COMMAND="$(command -v "scan-build$desired_version")"
export CC CCC_CC CXX CCC_CXX SCAN_BUILD_COMMAND
buildtype=DEBUG
code_coverage=OFF
@ -136,11 +126,11 @@ generator="Unix Makefiles"
__UnprocessedCMakeArgs=""
for i in "${@:8}"; do
upperI="$(echo $i | awk '{print toupper($0)}')"
case $upperI in
upperI="$(echo "$i" | awk '{print toupper($0)}')"
case "$upperI" in
# Possible build types are DEBUG, CHECKED, RELEASE, RELWITHDEBINFO.
DEBUG | CHECKED | RELEASE | RELWITHDEBINFO)
buildtype=$upperI
buildtype="$upperI"
;;
NINJA)
generator=Ninja
@ -154,26 +144,29 @@ for i in "${@:8}"; do
esac
done
OS=`uname`
cmake_extra_defines=
if [ "$CROSSCOMPILE" == "1" ]; then
if [[ "$CROSSCOMPILE" == "1" ]]; then
if ! [[ -n "$ROOTFS_DIR" ]]; then
echo "ROOTFS_DIR not set for crosscompile"
exit 1
fi
export TARGET_BUILD_ARCH=$build_arch
cmake_extra_defines="$cmake_extra_defines -C $tryrun_dir/tryrun.cmake"
TARGET_BUILD_ARCH="$build_arch"
export TARGET_BUILD_ARCH
if [[ -n "$tryrun_dir" ]]; then
cmake_extra_defines="$cmake_extra_defines -C $tryrun_dir/tryrun.cmake"
fi
cmake_extra_defines="$cmake_extra_defines -DCMAKE_TOOLCHAIN_FILE=$scriptroot/../common/cross/toolchain.cmake"
fi
if [ "$build_arch" == "armel" ]; then
if [[ "$build_arch" == "armel" ]]; then
cmake_extra_defines="$cmake_extra_defines -DARM_SOFTFP=1"
fi
cmake_command=$(command -v cmake)
if [[ "$scan_build" == "ON" && "$SCAN_BUILD_COMMAND" != "" ]]; then
if [[ "$scan_build" == "ON" && -n "$SCAN_BUILD_COMMAND" ]]; then
cmake_command="$SCAN_BUILD_COMMAND $cmake_command"
fi

View File

View File

@ -90,7 +90,7 @@ jobs:
# alpine coreclr cmake errors on newer builds
${{ if eq(parameters.runtimeFlavor, 'mono') }}:
image: alpine-3.9-WithNode-0fc54a3-20200121145958
${{ if ne(parameters.runtimeFlavor, 'mono') }}:
${{ if eq(parameters.runtimeFlavor, 'coreclr') }}:
image: alpine-3.9-WithNode-0fc54a3-20190918214015
registry: mcr
jobParameters:

View File

@ -50,12 +50,11 @@ jobs:
- name: ROOTFS_DIR
value: ${{ parameters.jobParameters.crossrootfsDir }}
- ${{ if ne(parameters.jobParameters.runtimeFlavor, '') }}:
- name: runtimeFlavorName
${{ if eq(parameters.jobParameters.runtimeFlavor, 'mono') }}:
value: Mono
${{ if eq(parameters.jobParameters.runtimeFlavor, 'coreclr') }}:
value: CoreCLR
- name: runtimeFlavorName
${{ if eq(parameters.jobParameters.runtimeFlavor, 'mono') }}:
value: Mono
${{ if eq(parameters.jobParameters.runtimeFlavor, 'coreclr') }}:
value: CoreCLR
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}

View File

@ -183,6 +183,8 @@ jobs:
# lowercase for RID format. (Detection normally converts, but we're preventing it.)
- name: OutputRidArg
value: /p:OutputRid=linux-musl-${{ parameters.archType }}
- name: _PortableBuild
value: true
- name: BuildArguments
value: >-

View File

@ -3,6 +3,7 @@ parameters:
osGroup: ''
archType: ''
osSubgroup: ''
crossrootfsDir: ''
framework: ''
isOfficialBuild: false
isOfficialAllConfigurations: false
@ -51,6 +52,9 @@ jobs:
- ${{ if ne(parameters.testScope, '') }}:
- _testScopeArg: -testscope ${{ parameters.testScope }}
- ${{ if eq(parameters.osGroup, 'Linux') }}:
- _crossBuildPropertyArg: /p:CrossBuild=${{ ne(parameters.crossrootfsDir, '') }}
- ${{ if and(eq(parameters.osGroup, 'Linux'), eq(parameters.osSubGroup, '_musl')) }}:
- _runtimeOSArg: /p:RuntimeOS=linux-musl
@ -102,7 +106,7 @@ jobs:
- ${{ if eq(parameters.isOfficialBuild, 'true') }}:
- _stripSymbolsArg: -stripSymbols
- _buildArguments: -configuration ${{ parameters.buildConfig }} -ci -arch ${{ parameters.archType }} $(_finalFrameworkArg) $(_stripSymbolsArg) $(_testScopeArg) $(_warnAsErrorArg) $(_runtimeOSArg) $(_msbuildCommonParameters) $(_runtimeArtifactsPathArg)
- _buildArguments: -configuration ${{ parameters.buildConfig }} -ci -arch ${{ parameters.archType }} $(_finalFrameworkArg) $(_stripSymbolsArg) $(_testScopeArg) $(_warnAsErrorArg) $(_runtimeOSArg) $(_msbuildCommonParameters) $(_runtimeArtifactsPathArg) $(_crossBuildPropertyArg)
- ${{ parameters.variables }}
dependsOn:

View File

@ -3,6 +3,7 @@ parameters:
osGroup: ''
osSubgroup: ''
archType: ''
crossrootfsDir: ''
framework: ''
isOfficialBuild: false
isOfficialAllConfigurations: false
@ -31,6 +32,7 @@ jobs:
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
archType: ${{ parameters.archType }}
crossrootfsDir: ${{ parameters.crossrootfsDir }}
framework: ${{ parameters.framework }}
isOfficialBuild: ${{ parameters.isOfficialBuild }}
isOfficialAllConfigurations: ${{ parameters.isOfficialAllConfigurations }}
@ -81,7 +83,7 @@ jobs:
- ${{ if eq(parameters.osGroup, 'OSX') }}:
- script: |
brew install pkgconfig icu4c openssl autoconf automake libtool pkg-config python3
brew install pkgconfig icu4c openssl
brew link --force icu4c
ln -s /usr/local/opt/openssl/lib/pkgconfig/libcrypto.pc /usr/local/lib/pkgconfig/
ln -s /usr/local/opt/openssl/lib/pkgconfig/libssl.pc /usr/local/lib/pkgconfig/

View File

@ -6,7 +6,6 @@ parameters:
platform: ''
container: ''
timeoutInMinutes: ''
stagedBuild: false
variables: {}
pool: ''
condition: true
@ -16,13 +15,11 @@ jobs:
- template: xplat-pipeline-job.yml
parameters:
buildConfig: ${{ parameters.buildConfig }}
_BuildConfig: ${{ parameters.buildConfig }}
archType: ${{ parameters.archType }}
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
helixType: 'build/product/'
enableMicrobuild: true
stagedBuild: ${{ parameters.stagedBuild }}
pool: ${{ parameters.pool }}
condition: ${{ parameters.condition }}

View File

@ -7,7 +7,6 @@ parameters:
helixType: '(unspecified)'
container: ''
crossrootfsDir: ''
stagedBuild: false
strategy: ''
pool: ''
@ -31,8 +30,7 @@ jobs:
container: ${{ parameters.container }}
condition: ${{ parameters.condition }}
dependsOn:
- ${{ if ne(parameters.stagedBuild, true) }}:
- checkout
- checkout
- ${{ if ne(parameters.dependsOn, '') }}:
- ${{ parameters.dependsOn }}

View File

@ -7,7 +7,6 @@ parameters:
helixType: '(unspecified)'
container: ''
liveLibrariesBuildConfig: ''
stagedBuild: false
strategy: ''
pool: ''
@ -32,7 +31,6 @@ jobs:
name: ${{ parameters.name }}
helixType: ${{ parameters.helixType }}
container: ${{ parameters.container }}
stagedBuild: ${{ parameters.stagedBuild }}
strategy: ${{ parameters.strategy }}
pool: ${{ parameters.pool }}

View File

@ -198,7 +198,7 @@ jobs:
#
# Build Mono debug
# Only when Mono is changed
# Only when libraries or mono changed
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@ -219,11 +219,13 @@ jobs:
jobParameters:
condition: >-
or(
eq(dependencies.checkout.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true),
eq(variables['isFullMatrix'], true))
#
# Build Mono release
# Only when libraries or mono changed
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@ -241,6 +243,12 @@ jobs:
# - Windows_NT_x86
# - Windows_NT_arm
# - Windows_NT_arm64
jobParameters:
condition: >-
or(
eq(dependencies.checkout.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true),
eq(variables['isFullMatrix'], true))
#
# Build libraries using live CoreLib
@ -484,6 +492,7 @@ jobs:
#
# Libraries Release Test Execution against a release mono runtime.
# Only when libraries or mono changed
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
@ -502,6 +511,11 @@ jobs:
liveRuntimeBuildConfig: release
dependsOnTestBuildConfiguration: ${{ variables.debugOnPrReleaseOnRolling }}
dependsOnTestArchitecture: x64
condition: >-
or(
eq(dependencies.checkout.outputs['SetPathVars_libraries.containsChange'], true),
eq(dependencies.checkout.outputs['SetPathVars_mono.containsChange'], true),
eq(variables['isFullMatrix'], true))
#
# Libraries Release Test Execution against a release coreclr runtime

View File

@ -6,7 +6,7 @@ cmake_policy(SET CMP0042 NEW)
project(CoreCLR)
# Include cmake functions
include(functions.cmake)
include(${CLR_ENG_NATIVE_DIR}/functions.cmake)
if (WIN32)
message(STATUS "VS_PLATFORM_TOOLSET is ${CMAKE_VS_PLATFORM_TOOLSET}")

View File

@ -1,293 +1,14 @@
#!/usr/bin/env bash
initTargetDistroRid()
{
source "${__ProjectDir}/init-distro-rid.sh"
usage_list+=("-coverage: optional argument to enable code coverage build (currently supported only for Linux and OSX).")
usage_list+=("-skipmanaged: do not build managed components.")
usage_list+=("-skipnative: do not build native components.")
local passedRootfsDir=""
# Only pass ROOTFS_DIR if cross is specified.
if [ "$__CrossBuild" = 1 ]; then
passedRootfsDir="${ROOTFS_DIR}"
fi
initDistroRidGlobal "$__BuildOS" "$__BuildArch" "$__PortableBuild" "$passedRootfsDir"
}
isMSBuildOnNETCoreSupported()
{
__isMSBuildOnNETCoreSupported="$__msbuildonunsupportedplatform"
if [ "$__isMSBuildOnNETCoreSupported" = 1 ]; then
return
fi
if [ "$__SkipManaged" = 1 ]; then
__isMSBuildOnNETCoreSupported=0
return
fi
if [ "$__HostOS" = "Linux" ] && { [ "$__HostArch" = "x64" ] || [ "$__HostArch" = "arm" ] || [ "$__HostArch" = "arm64" ]; }; then
__isMSBuildOnNETCoreSupported=1
elif [ "$__HostArch" = "x64" ] && { [ "$__HostOS" = "OSX" ] || [ "$__HostOS" = "FreeBSD" ]; }; then
__isMSBuildOnNETCoreSupported=1
fi
}
usage()
{
echo "Usage: $0 <options>"
echo ""
echo "Common Options:"
echo ""
echo "BuildArch can be: -x64, -x86, -arm, -armel, -arm64"
echo "BuildType can be: -debug, -checked, -release"
echo "-bindir - output directory (defaults to $__ProjectRoot/artifacts)"
echo "-clang - optional argument to build using clang in PATH (default)."
echo "-clangx.y - optional argument to build using clang version x.y."
echo "-cmakeargs - user-settable additional arguments passed to CMake."
echo "-configureonly - do not perform any builds; just configure the build."
echo "-coverage - optional argument to enable code coverage build (currently supported only for Linux and OSX)."
echo "-cross - optional argument to signify cross compilation,"
echo " - will use ROOTFS_DIR environment variable if set."
echo "-gcc - optional argument to build using gcc in PATH."
echo "-gccx.y - optional argument to build using gcc version x.y."
echo "-msbuildonunsupportedplatform - build managed binaries even if distro is not officially supported."
echo "-ninja - target ninja instead of GNU make"
echo "-numproc - set the number of build processes."
echo "-portablebuild - pass -portablebuild=false to force a non-portable build."
echo "-skipconfigure - skip build configuration."
echo "-skipmanaged - do not build managed components."
echo "-skipnative - do not build native components."
echo "-skipgenerateversion - disable version generation even if MSBuild is supported."
echo "-verbose - optional argument to enable verbose build output."
echo ""
echo "Additional Options:"
echo ""
for i in "${!usage_list[@]}"; do
echo "${usage_list[${i}]}"
done
echo ""
exit 1
}
# Use uname to determine what the CPU is.
CPUName=$(uname -p)
# Some Linux platforms report unknown for platform, but the arch for machine.
if [ "$CPUName" = "unknown" ]; then
CPUName=$(uname -m)
fi
case "$CPUName" in
aarch64)
__BuildArch=arm64
__HostArch=arm64
;;
amd64)
__BuildArch=x64
__HostArch=x64
;;
armv7l)
echo "Unsupported CPU $CPUName detected, build might not succeed!"
__BuildArch=arm
__HostArch=arm
;;
i686)
echo "Unsupported CPU $CPUName detected, build might not succeed!"
__BuildArch=x86
__HostArch=x86
;;
x86_64)
__BuildArch=x64
__HostArch=x64
;;
*)
echo "Unknown CPU $CPUName detected, configuring as if for x64"
__BuildArch=x64
__HostArch=x64
;;
esac
# Use uname to determine what the OS is.
OSName=$(uname -s)
case "$OSName" in
Darwin)
__BuildOS=OSX
__HostOS=OSX
;;
FreeBSD)
__BuildOS=FreeBSD
__HostOS=FreeBSD
;;
Linux)
__BuildOS=Linux
__HostOS=Linux
;;
NetBSD)
__BuildOS=NetBSD
__HostOS=NetBSD
;;
OpenBSD)
__BuildOS=OpenBSD
__HostOS=OpenBSD
;;
SunOS)
__BuildOS=SunOS
__HostOS=SunOS
;;
*)
echo "Unsupported OS $OSName detected, configuring as if for Linux"
__BuildOS=Linux
__HostOS=Linux
;;
esac
while :; do
if [ "$#" -le 0 ]; then
break
fi
lowerI="$(echo "$1" | awk '{print tolower($0)}')"
case "$lowerI" in
-\?|-h|--help)
usage
exit 1
;;
arm|-arm)
__BuildArch=arm
;;
arm64|-arm64)
__BuildArch=arm64
;;
armel|-armel)
__BuildArch=armel
;;
bindir|-bindir)
if [ -n "$2" ]; then
__RootBinDir="$2"
if [ ! -d "$__RootBinDir" ]; then
mkdir "$__RootBinDir"
fi
__RootBinParent=$(dirname "$__RootBinDir")
__RootBinName="${__RootBinDir##*/}"
__RootBinDir="$(cd "$__RootBinParent" &>/dev/null && printf %s/%s "$PWD" "$__RootBinName")"
shift
else
echo "ERROR: 'bindir' requires a non-empty option argument"
exit 1
fi
;;
checked|-checked)
__BuildType=Checked
;;
ci|-ci)
__ArcadeScriptArgs="--ci"
__ErrMsgPrefix="##vso[task.logissue type=error]"
;;
clang*|-clang*)
__Compiler=clang
# clangx.y or clang-x.y
version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
parts=(${version//./ })
__CompilerMajorVersion="${parts[0]}"
__CompilerMinorVersion="${parts[1]}"
if [ -z "$__CompilerMinorVersion" ] && [ "$__CompilerMajorVersion" -le 6 ]; then
__CompilerMinorVersion=0;
fi
;;
cmakeargs|-cmakeargs)
if [ -n "$2" ]; then
__cmakeargs="$__cmakeargs $2"
shift
else
echo "ERROR: 'cmakeargs' requires a non-empty option argument"
exit 1
fi
;;
configureonly|-configureonly)
__ConfigureOnly=1
__SkipMSCorLib=1
__SkipNuget=1
;;
handle_arguments() {
case "$1" in
coverage|-coverage)
__CodeCoverage=Coverage
;;
cross|-cross)
__CrossBuild=1
;;
debug|-debug)
__BuildType=Debug
;;
gcc*|-gcc*)
__Compiler=gcc
# gccx.y or gcc-x.y
version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
parts=(${version//./ })
__CompilerMajorVersion="${parts[0]}"
__CompilerMinorVersion="${parts[1]}"
;;
msbuildonunsupportedplatform|-msbuildonunsupportedplatform)
__msbuildonunsupportedplatform=1
;;
ninja|-ninja)
__UseNinja=1
;;
numproc|-numproc)
if [ -n "$2" ]; then
__NumProc="$2"
shift
else
echo "ERROR: 'numproc' requires a non-empty option argument"
exit 1
fi
;;
portablebuild=false|-portablebuild=false)
__PortableBuild=0
;;
rebuild|-rebuild)
__RebuildTests=1
;;
release|-release)
__BuildType=Release
;;
skipconfigure|-skipconfigure)
__SkipConfigure=1
;;
skipgenerateversion|-skipgenerateversion)
__SkipGenerateVersion=1
__CodeCoverage=1
;;
skipmanaged|-skipmanaged)
@ -301,44 +22,10 @@ while :; do
__CopyNativeProjectsAfterCombinedTestBuild=false
;;
verbose|-verbose)
__VerboseBuild=1
;;
x86|-x86)
__BuildArch=x86
;;
x64|-x64)
__BuildArch=x64
;;
*)
handle_arguments "$1"
handle_arguments_local "$1"
;;
esac
}
shift
done
# Get the number of processors available to the scheduler
# Other techniques such as `nproc` only get the number of
# processors available to a single process.
platform=$(uname)
if [ "$platform" = "FreeBSD" ]; then
__NumProc=$(sysctl hw.ncpu | awk '{ print $2+1 }')
elif [ "$platform" = "NetBSD" ]; then
__NumProc=$(($(getconf NPROCESSORS_ONLN)+1))
elif [ "$platform" = "Darwin" ]; then
__NumProc=$(($(getconf _NPROCESSORS_ONLN)+1))
else
__NumProc=$(nproc --all)
fi
__CommonMSBuildArgs="/p:__BuildArch=$__BuildArch /p:__BuildType=$__BuildType /p:__BuildOS=$__BuildOS /nodeReuse:false $__OfficialBuildIdArg $__SignTypeArg $__SkipRestoreArg"
# Configure environment if we are doing a verbose build
if [ "$__VerboseBuild" = 1 ]; then
export VERBOSE=1
__CommonMSBuildArgs="$__CommonMSBuildArgs /v:detailed"
fi
source "$__RepoRootDir"/eng/native/build-commons.sh

View File

@ -12,12 +12,12 @@ usage()
initDistroRid()
{
source ${__ProjectRoot}/init-distro-rid.sh
source $__RepoRootDir/eng/native/init-distro-rid.sh
local passedRootfsDir=""
# Only pass ROOTFS_DIR if __DoCrossArchBuild is specified.
if (( ${__CrossBuild} == 1 )); then
if (( __CrossBuild == 1 )); then
passedRootfsDir=${ROOTFS_DIR}
fi

View File

@ -2,7 +2,7 @@
build_test_wrappers()
{
if [ $__BuildTestWrappers -ne -0 ]; then
if [[ "$__BuildTestWrappers" -ne -0 ]]; then
echo "${__MsgPrefix}Creating test wrappers..."
export __Exclude="${__ProjectDir}/tests/issues.targets"
@ -10,12 +10,12 @@ build_test_wrappers()
buildVerbosity="Summary"
if [ $__VerboseBuild == 1 ]; then
if [[ "$__VerboseBuild" == 1 ]]; then
buildVerbosity="Diag"
fi
# Set up directories and file names
__BuildLogRootName=$subDirectoryName
__BuildLogRootName="$subDirectoryName"
__BuildLog="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.log"
__BuildWrn="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.wrn"
__BuildErr="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.err"
@ -27,9 +27,10 @@ build_test_wrappers()
nextCommand="\"${__DotNetCli}\" msbuild \"${__ProjectDir}/tests/src/runtest.proj\" /nodereuse:false /p:BuildWrappers=true /p:TargetsWindows=false $__Logging /p:__BuildOS=$__BuildOS /p:__BuildType=$__BuildType /p:__BuildArch=$__BuildArch"
eval $nextCommand
if [ $? -ne 0 ]; then
local exitCode="$?"
if [[ "$exitCode" -ne 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Error: XUnit wrapper build failed. Refer to the build log files for details (above)"
exit 1
exit "$exitCode"
else
echo "XUnit Wrappers have been built."
echo { "\"build_os\"": "\"${__BuildOS}\"", "\"build_arch\"": "\"${__BuildArch}\"", "\"build_type\"": "\"${__BuildType}\"" } > "${__TestWorkingDir}/build_info.json"
@ -42,20 +43,20 @@ generate_layout()
{
echo "${__MsgPrefix}Creating test overlay..."
__TestDir=$__ProjectDir/tests
__ProjectFilesDir=$__TestDir
__TestBinDir=$__TestWorkingDir
__TestDir="$__ProjectDir"/tests
__ProjectFilesDir="$__TestDir"
__TestBinDir="$__TestWorkingDir"
if [ $__RebuildTests -ne 0 ]; then
if [ -d "${__TestBinDir}" ]; then
if [[ "$__RebuildTests" -ne 0 ]]; then
if [[ -d "${__TestBinDir}" ]]; then
echo "Removing tests build dir: ${__TestBinDir}"
rm -rf $__TestBinDir
rm -rf "$__TestBinDir"
fi
fi
__CMakeBinDir="${__TestBinDir}"
if [ -z "$__TestIntermediateDir" ]; then
if [[ -z "$__TestIntermediateDir" ]]; then
__TestIntermediateDir="tests/obj/${__BuildOS}.${__BuildArch}.${__BuildType}"
fi
@ -64,17 +65,17 @@ generate_layout()
echo "__BuildType: ${__BuildType}"
echo "__TestIntermediateDir: ${__TestIntermediateDir}"
if [ ! -f "$__TestBinDir" ]; then
if [[ ! -f "$__TestBinDir" ]]; then
echo "Creating TestBinDir: ${__TestBinDir}"
mkdir -p $__TestBinDir
mkdir -p "$__TestBinDir"
fi
if [ ! -f "$__LogsDir" ]; then
if [[ ! -f "$__LogsDir" ]]; then
echo "Creating LogsDir: ${__LogsDir}"
mkdir -p $__LogsDir
mkdir -p "$__LogsDir"
fi
if [ ! -f "$__MsbuildDebugLogsDir" ]; then
if [[ ! -f "$__MsbuildDebugLogsDir" ]]; then
echo "Creating MsbuildDebugLogsDir: ${__MsbuildDebugLogsDir}"
mkdir -p $__MsbuildDebugLogsDir
mkdir -p "$__MsbuildDebugLogsDir"
fi
# Set up the directory for MSBuild debug logs.
@ -90,51 +91,53 @@ generate_layout()
build_MSBuild_projects "Restore_Packages" "${__ProjectDir}/tests/build.proj" "Restore product binaries (build tests)" "/t:BatchRestorePackages"
if [ -n "$__UpdateInvalidPackagesArg" ]; then
if [[ -n "$__UpdateInvalidPackagesArg" ]]; then
__up="/t:UpdateInvalidPackageVersions"
fi
echo "${__MsgPrefix}Creating test overlay..."
if [ -z "$xUnitTestBinBase" ]; then
xUnitTestBinBase=$__TestWorkingDir
if [[ -z "$xUnitTestBinBase" ]]; then
xUnitTestBinBase="$__TestWorkingDir"
fi
export CORE_ROOT=$xUnitTestBinBase/Tests/Core_Root
export CORE_ROOT="$xUnitTestBinBase"/Tests/Core_Root
if [ -d "${CORE_ROOT}" ]; then
rm -rf $CORE_ROOT
if [[ -d "${CORE_ROOT}" ]]; then
rm -rf "$CORE_ROOT"
fi
mkdir -p $CORE_ROOT
mkdir -p "$CORE_ROOT"
build_MSBuild_projects "Tests_Overlay_Managed" "${__ProjectDir}/tests/src/runtest.proj" "Creating test overlay" "/t:CreateTestOverlay"
chmod +x $__BinDir/corerun
chmod +x $__CrossgenExe
chmod +x "$__BinDir"/corerun
chmod +x "$__CrossgenExe"
# Make sure to copy over the pulled down packages
cp -r $__BinDir/* $CORE_ROOT/ > /dev/null
cp -r "$__BinDir"/* "$CORE_ROOT/" > /dev/null
if [ "$__BuildOS" != "OSX" ]; then
if [[ "$__BuildOS" != "OSX" ]]; then
nextCommand="\"$__TestDir/setup-stress-dependencies.sh\" --arch=$__BuildArch --outputDir=$CORE_ROOT"
echo "Resolve runtime dependences via $nextCommand"
eval $nextCommand
if [ $? != 0 ]; then
local exitCode="$?"
if [[ "$exitCode" != 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Error: setup-stress-dependencies failed."
exit 1
exit "$exitCode"
fi
fi
# Precompile framework assemblies with crossgen if required
if [[ $__DoCrossgen != 0 || $__DoCrossgen2 != 0 ]]; then
if [[ "$__DoCrossgen" != 0 || "$__DoCrossgen2" != 0 ]]; then
precompile_coreroot_fx
fi
}
precompile_coreroot_fx()
{
local overlayDir=$CORE_ROOT
local overlayDir="$CORE_ROOT"
local compilerName=Crossgen
# Read the exclusion file for this platform
@ -142,24 +145,24 @@ precompile_coreroot_fx()
skipCrossGenFiles+=('System.Runtime.WindowsRuntime.dll')
# Temporary output folder for Crossgen2-compiled assemblies
local outputDir=${overlayDir}/out
local outputDir="$overlayDir"/out
# Delete previously crossgened assemblies
rm ${overlayDir}/*.ni.dll
rm "$overlayDir"/*.ni.dll
# Collect reference assemblies for Crossgen2
local crossgen2References=""
if [[ $__DoCrossgen2 != 0 ]]; then
if [[ "$__DoCrossgen2" != 0 ]]; then
compilerName=Crossgen2
mkdir ${outputDir}
mkdir "$outputDir"
skipCrossGenFiles+=('Microsoft.CodeAnalysis.CSharp.dll')
skipCrossGenFiles+=('Microsoft.CodeAnalysis.dll')
skipCrossGenFiles+=('Microsoft.CodeAnalysis.VisualBasic.dll')
for reference in ${overlayDir}/*.dll; do
for reference in "$overlayDir"/*.dll; do
crossgen2References+=" -r:${reference}"
done
fi
@ -170,49 +173,49 @@ precompile_coreroot_fx()
local failedToPrecompile=0
declare -a failedAssemblies
filesToPrecompile=$(find -L $overlayDir -maxdepth 1 -iname Microsoft.\*.dll -o -iname System.\*.dll -type f)
filesToPrecompile=$(find -L "$overlayDir" -maxdepth 1 -iname Microsoft.\*.dll -o -iname System.\*.dll -type f)
for fileToPrecompile in ${filesToPrecompile}; do
local filename=${fileToPrecompile}
local filename="$fileToPrecompile"
if is_skip_crossgen_test "$(basename $filename)"; then
continue
fi
echo Precompiling $filename
echo Precompiling "$filename"
if [[ $__DoCrossgen != 0 ]]; then
$__CrossgenExe /Platform_Assemblies_Paths $overlayDir $filename 1> $filename.stdout 2>$filename.stderr
if [[ "$__DoCrossgen" != 0 ]]; then
"$__CrossgenExe" /Platform_Assemblies_Paths "$overlayDir" "$filename" 1> "$filename".stdout 2> "$filename".stderr
fi
if [[ $__DoCrossgen2 != 0 ]]; then
${overlayDir}/crossgen2/crossgen2 ${crossgen2References} -O --inputbubble --out ${outputDir}/$(basename $filename) $filename 1>$filename.stdout 2>$filename.stderr
if [[ "$__DoCrossgen2" != 0 ]]; then
"$overlayDir"/crossgen2/crossgen2 "$crossgen2References" -O --inputbubble --out "$outputDir"/"$(basename $filename)" "$filename" 1> "$filename".stdout 2> "$filename".stderr
fi
local exitCode=$?
if [[ $exitCode != 0 ]]; then
if grep -q -e '0x80131018' $filename.stderr; then
local exitCode="$?"
if [[ "$exitCode" != 0 ]]; then
if grep -q -e '0x80131018' "$filename".stderr; then
printf "\n\t$filename is not a managed assembly.\n\n"
else
echo Unable to precompile $filename, exit code is $exitCode.
cat $filename.stdout
cat $filename.stderr
echo Unable to precompile "$filename", exit code is "$exitCode".
cat "$filename".stdout
cat "$filename".stderr
failedAssemblies+=($(basename -- "$filename"))
failedToPrecompile=$((failedToPrecompile+1))
fi
else
rm $filename.{stdout,stderr}
rm "$filename".{stdout,stderr}
fi
totalPrecompiled=$((totalPrecompiled+1))
echo Processed: $totalPrecompiled, failed $failedToPrecompile
echo "Processed: $totalPrecompiled, failed $failedToPrecompile"
done
if [[ $__DoCrossgen2 != 0 ]]; then
if [[ "$__DoCrossgen2" != 0 ]]; then
# Copy the Crossgen-compiled assemblies back to CORE_ROOT
mv -f ${outputDir}/* ${overlayDir}/
rm -r ${outputDir}
mv -f "$outputDir"/* "$overlayDir"/
rm -r "$outputDir"
fi
if [[ $failedToPrecompile != 0 ]]; then
if [[ "$failedToPrecompile" != 0 ]]; then
echo Failed assemblies:
for assembly in "${failedAssemblies[@]}"; do
echo " $assembly"
@ -226,7 +229,7 @@ declare -a skipCrossGenFiles
function is_skip_crossgen_test {
for skip in "${skipCrossGenFiles[@]}"; do
if [ "$1" == "$skip" ]; then
if [[ "$1" == "$skip" ]]; then
return 0
fi
done
@ -237,34 +240,34 @@ build_Tests()
{
echo "${__MsgPrefix}Building Tests..."
__TestDir=$__ProjectDir/tests
__ProjectFilesDir=$__TestDir
__TestBinDir=$__TestWorkingDir
__TestDir="$__ProjectDir"/tests
__ProjectFilesDir="$__TestDir"
__TestBinDir="$__TestWorkingDir"
if [ -f "${__TestWorkingDir}/build_info.json" ]; then
if [[ -f "${__TestWorkingDir}/build_info.json" ]]; then
rm "${__TestWorkingDir}/build_info.json"
fi
if [ $__RebuildTests -ne 0 ]; then
if [ -d "${__TestBinDir}" ]; then
if [[ "$__RebuildTests" -ne 0 ]]; then
if [[ -d "$__TestBinDir" ]]; then
echo "Removing tests build dir: ${__TestBinDir}"
rm -rf $__TestBinDir
rm -rf "$__TestBinDir"
fi
fi
export __CMakeBinDir="${__TestBinDir}"
if [ ! -d "${__TestIntermediatesDir}" ]; then
mkdir -p ${__TestIntermediatesDir}
export __CMakeBinDir="$__TestBinDir"
if [[ ! -d "$__TestIntermediatesDir" ]]; then
mkdir -p "$__TestIntermediatesDir"
fi
__NativeTestIntermediatesDir="${__TestIntermediatesDir}/Native"
if [ ! -d "${__NativeTestIntermediatesDir}" ]; then
mkdir -p ${__NativeTestIntermediatesDir}
if [[ ! -d "${__NativeTestIntermediatesDir}" ]]; then
mkdir -p "${__NativeTestIntermediatesDir}"
fi
__ManagedTestIntermediatesDir="${__TestIntermediatesDir}/Managed"
if [ ! -d "${__ManagedTestIntermediatesDir}" ]; then
mkdir -p ${__ManagedTestIntermediatesDir}
if [[ ! -d "${__ManagedTestIntermediatesDir}" ]]; then
mkdir -p "${__ManagedTestIntermediatesDir}"
fi
echo "__BuildOS: ${__BuildOS}"
@ -274,17 +277,17 @@ build_Tests()
echo "__NativeTestIntermediatesDir: ${__NativeTestIntermediatesDir}"
echo "__ManagedTestIntermediatesDir: ${__ManagedTestIntermediatesDir}"
if [ ! -f "$__TestBinDir" ]; then
if [[ ! -f "$__TestBinDir" ]]; then
echo "Creating TestBinDir: ${__TestBinDir}"
mkdir -p $__TestBinDir
mkdir -p "$__TestBinDir"
fi
if [ ! -f "$__LogsDir" ]; then
if [[ ! -f "$__LogsDir" ]]; then
echo "Creating LogsDir: ${__LogsDir}"
mkdir -p $__LogsDir
mkdir -p "$__LogsDir"
fi
if [ ! -f "$__MsbuildDebugLogsDir" ]; then
if [[ ! -f "$__MsbuildDebugLogsDir" ]]; then
echo "Creating MsbuildDebugLogsDir: ${__MsbuildDebugLogsDir}"
mkdir -p $__MsbuildDebugLogsDir
mkdir -p "$__MsbuildDebugLogsDir"
fi
# Set up the directory for MSBuild debug logs.
@ -298,30 +301,30 @@ build_Tests()
# ===
# =========================================================================================
if [ ${__SkipRestorePackages} != 1 ]; then
if [[ "${__SkipRestorePackages}" != 1 ]]; then
build_MSBuild_projects "Restore_Product" "${__ProjectDir}/tests/build.proj" "Restore product binaries (build tests)" "/t:BatchRestorePackages"
if [ $? -ne 0 ]; then
if [[ "$?" -ne 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Error: package restoration failed. Refer to the build log files for details (above)"
exit 1
fi
fi
if [ $__SkipNative != 1 ]; then
build_native_projects "$__BuildArch" "${__NativeTestIntermediatesDir}"
if [[ "$__SkipNative" != 1 ]]; then
build_native "$__BuildArch" "$__TestDir" "$__ProjectRoot" "$__NativeTestIntermediatesDir" "CoreCLR test component"
if [ $? -ne 0 ]; then
if [[ "$?" -ne 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Error: native test build failed. Refer to the build log files for details (above)"
exit 1
fi
fi
if [ $__SkipManaged != 1 ]; then
if [[ "$__SkipManaged" != 1 ]]; then
echo "Starting the Managed Tests Build..."
build_MSBuild_projects "Tests_Managed" "$__ProjectDir/tests/build.proj" "Managed tests build (build tests)" "$__up"
if [ $? -ne 0 ]; then
if [[ "$?" -ne 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Error: managed test build failed. Refer to the build log files for details (above)"
exit 1
else
@ -329,7 +332,7 @@ build_Tests()
build_MSBuild_projects "Check_Test_Build" "${__ProjectDir}/tests/src/runtest.proj" "Check Test Build" "/t:CheckTestBuild"
if [ $? -ne 0 ]; then
if [[ "$?" -ne 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Error: Check Test Build failed."
exit 1
fi
@ -340,38 +343,38 @@ build_Tests()
build_test_wrappers
fi
if [ $__CopyNativeTestBinaries == 1 ]; then
if [[ "$__CopyNativeTestBinaries" == 1 ]]; then
echo "Copying native test binaries to output..."
build_MSBuild_projects "Tests_Managed" "$__ProjectDir/tests/build.proj" "Managed tests build (build tests)" "/t:CopyAllNativeProjectReferenceBinaries"
if [ $? -ne 0 ]; then
if [[ "$?" -ne 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Error: copying native test binaries failed. Refer to the build log files for details (above)"
exit 1
fi
fi
if [ -n "$__UpdateInvalidPackagesArg" ]; then
if [[ -n "$__UpdateInvalidPackagesArg" ]]; then
__up="/t:UpdateInvalidPackageVersions"
fi
if [ $__SkipGenerateLayout != 1 ]; then
if [[ "$__SkipGenerateLayout" != 1 ]]; then
generate_layout
fi
}
build_MSBuild_projects()
{
subDirectoryName=$1
subDirectoryName="$1"
shift
projectName=$1
projectName="$1"
shift
stepName="$1"
shift
extraBuildParameters=("$@")
# Set up directories and file names
__BuildLogRootName=$subDirectoryName
__BuildLogRootName="$subDirectoryName"
__BuildLog="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.log"
__BuildWrn="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.wrn"
__BuildErr="$__LogsDir/${__BuildLogRootName}.${__BuildOS}.${__BuildArch}.${__BuildType}.err"
@ -387,7 +390,7 @@ build_MSBuild_projects()
__AppendToLog=false
if [ -n "$__priority1" ]; then
if [[ -n "$__priority1" ]]; then
export __NumberOfTestGroups=10
fi
@ -397,7 +400,7 @@ build_MSBuild_projects()
__msbuildWrn="\"/flp1:WarningsOnly;LogFile=${__BuildWrn};Append=${__AppendToLog}\""
__msbuildErr="\"/flp2:ErrorsOnly;LogFile=${__BuildErr};Append=${__AppendToLog}\""
export __TestGroupToBuild=$testGroupToBuild
export __TestGroupToBuild="$testGroupToBuild"
# Generate build command
buildArgs=("$projectName")
@ -417,7 +420,7 @@ build_MSBuild_projects()
eval $nextCommand
# Make sure everything is OK
if [ $? -ne 0 ]; then
if [[ "$?" -ne 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Failed to build $stepName. See the build logs:"
echo " $__BuildLog"
echo " $__BuildWrn"
@ -449,7 +452,7 @@ build_MSBuild_projects()
eval $nextCommand
# Make sure everything is OK
if [ $? -ne 0 ]; then
if [[ "$?" -ne 0 ]]; then
echo "${__ErrMsgPrefix}${__MsgPrefix}Failed to build $stepName. See the build logs:"
echo " $__BuildLog"
echo " $__BuildWrn"
@ -459,107 +462,22 @@ build_MSBuild_projects()
fi
}
build_native_projects()
{
platformArch="$1"
intermediatesForBuild="$2"
extraCmakeArguments=""
message="native tests assets"
# All set to commence the build
echo "Commencing build of $message for $__BuildOS.$__BuildArch.$__BuildType in $intermediatesForBuild"
generator=""
if [ $__UseNinja == 1 ]; then
generator="ninja"
if ! buildTool=$(command -v ninja || command -v ninja-build); then
echo "Unable to locate ninja!" 1>&2
exit 1
fi
fi
if [ $__SkipConfigure == 0 ]; then
# if msbuild is not supported, then set __SkipGenerateVersion to 1
if [ $__isMSBuildOnNETCoreSupported == 0 ]; then __SkipGenerateVersion=1; fi
# Drop version.c file
__versionSourceFile="$intermediatesForBuild/version.c"
if [ $__SkipGenerateVersion == 0 ]; then
pwd
$__RepoRootDir/eng/common/msbuild.sh $__RepoRootDir/eng/empty.csproj \
/p:NativeVersionFile=$__versionSourceFile \
/t:GenerateNativeVersionFile /restore \
$__CommonMSBuildArgs $__UnprocessedBuildArgs
if [ $? -ne 0 ]; then
echo "${__ErrMsgPrefix}Failed to generate native version file."
exit $?
fi
else
# Generate the dummy version.c, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
__versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
if [ -e $__versionSourceFile ]; then
read existingVersionSourceLine < $__versionSourceFile
fi
if [ "$__versionSourceLine" != "$existingVersionSourceLine" ]; then
echo $__versionSourceLine > $__versionSourceFile
fi
fi
if [[ -n "$__CodeCoverage" ]]; then
extraCmakeArguments="$extraCmakeArguments -DCLR_CMAKE_ENABLE_CODE_COVERAGE=1"
fi
engNativeDir="$__RepoRootDir/eng/native"
__cmakeargs="$__cmakeargs -DCLR_ENG_NATIVE_DIR=\"$engNativeDir\""
nextCommand="\"$engNativeDir/gen-buildsys.sh\" \"$__TestDir\" \"$__ProjectRoot\" \"$intermediatesForBuild\" $platformArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType $generator $extraCmakeArguments $__cmakeargs"
echo "Invoking $nextCommand"
eval $nextCommand
if [ $? != 0 ]; then
echo "${__ErrMsgPrefix}Failed to generate $message build project!"
exit 1
fi
fi
if [ ! -f "$intermediatesForBuild/CMakeCache.txt" ]; then
echo "${__ErrMsgPrefix}Unable to find generated build files for $message project!"
exit 1
fi
# Build
if [ $__ConfigureOnly == 1 ]; then
echo "Finish configuration & skipping $message build."
return
fi
echo "Executing cmake --build \"$intermediatesForBuild\" --target install -j $__NumProc"
cmake --build "$intermediatesForBuild" --target install -j $__NumProc
local exit_code=$?
if [ $exit_code != 0 ]; then
echo "${__ErrMsgPrefix}Failed to build $message."
exit $exit_code
fi
echo "Native tests build success!"
}
usage_list=("-buildtestwrappersonly - only build the test wrappers.")
usage_list=("-buildtestwrappersonly: only build the test wrappers.")
usage_list+=("-copynativeonly: Only copy the native test binaries to the managed output. Do not build the native or managed tests.")
usage_list+=("-crossgen - Precompiles the framework managed assemblies in coreroot.")
usage_list+=("-generatelayoutonly - only pull down dependencies and build coreroot.")
usage_list+=("-priority1 - include priority=1 tests in the build.")
usage_list+=("-runtests - run tests after building them.")
usage_list+=("-crossgen: Precompiles the framework managed assemblies in coreroot.")
usage_list+=("-generatelayoutonly: only pull down dependencies and build coreroot.")
usage_list+=("-priority1: include priority=1 tests in the build.")
usage_list+=("-rebuild: if tests have already been built - rebuild them.")
usage_list+=("-runtests: run tests after building them.")
usage_list+=("-skipgeneratelayout: Do not generate the Core_Root layout.")
usage_list+=("-skiprestorepackages - skip package restore.")
usage_list+=("-skiprestorepackages: skip package restore.")
# Obtain the location of the bash script to figure out where the root of the repo is.
__ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
__RepoRootDir=${__ProjectRoot}/../..
__ProjectRoot="$(cd "$(dirname "$0")"; pwd -P)"
__RepoRootDir="$(cd "$__ProjectRoot"/../..; pwd -P)"
handle_arguments() {
case $1 in
handle_arguments_local() {
case "$1" in
buildtestwrappersonly|-buildtestwrappersonly)
__BuildTestWrappersOnly=1
;;
@ -592,6 +510,10 @@ handle_arguments() {
__UnprocessedBuildArgs+=("/p:CLRTestPriorityToBuild=1")
;;
rebuild|-rebuild)
__RebuildTests=1
;;
runtests|-runtests)
__RunTests=1
;;
@ -633,6 +555,7 @@ __DoCrossgen2=0
__DotNetCli="$__RepoRootDir/dotnet.sh"
__GenerateLayoutOnly=
__GenerateTestHostOnly=
__IsMSBuildOnNETCoreSupported=0
__MSBCleanBuildArgs=
__NativeTestIntermediatesDir=
__PortableBuild=1
@ -651,14 +574,13 @@ __UnprocessedBuildArgs=
__LocalCoreFXConfig=${__BuildType}
__UseNinja=0
__VerboseBuild=0
__cmakeargs=""
__msbuildonunsupportedplatform=0
__CMakeArgs=""
__priority1=
CORE_ROOT=
source "$__ProjectRoot"/_build-commons.sh
if [ "${__BuildArch}" != "${__HostArch}" ]; then
if [[ "${__BuildArch}" != "${__HostArch}" ]]; then
__CrossBuild=1
fi
@ -673,53 +595,37 @@ __TestDir="$__ProjectDir/tests"
__TestWorkingDir="$__RootBinDir/tests/coreclr/$__BuildOS.$__BuildArch.$__BuildType"
__IntermediatesDir="$__RootBinDir/obj/coreclr/$__BuildOS.$__BuildArch.$__BuildType"
__TestIntermediatesDir="$__RootBinDir/tests/coreclr/obj/$__BuildOS.$__BuildArch.$__BuildType"
__isMSBuildOnNETCoreSupported=0
__CrossComponentBinDir="$__BinDir"
__CrossCompIntermediatesDir="$__IntermediatesDir/crossgen"
__CrossArch="$__HostArch"
if [ $__CrossBuild == 1 ]; then
if [[ "$__CrossBuild" == 1 ]]; then
__CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
fi
__CrossgenCoreLibLog="$__LogsDir/CrossgenCoreLib_$__BuildOS.$BuildArch.$__BuildType.log"
__CrossgenExe="$__CrossComponentBinDir/crossgen"
isMSBuildOnNETCoreSupported
# CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to it.
# This is needed by CLI to function.
if [ -z "$HOME" ]; then
if [ ! -d "$__ProjectDir/temp_home" ]; then
if [[ -z "$HOME" ]]; then
if [[ ! -d "$__ProjectDir/temp_home" ]]; then
mkdir temp_home
fi
export HOME=$__ProjectDir/temp_home
HOME="$__ProjectDir"/temp_home
export HOME
echo "HOME not defined; setting it to $HOME"
fi
# Configure environment if we are doing a cross compile.
if [ $__CrossBuild == 1 ]; then
export CROSSCOMPILE=1
if ! [[ -n "$ROOTFS_DIR" ]]; then
export ROOTFS_DIR="$__RepoRootDir/.tools/rootfs/$__BuildArch"
fi
fi
# init the target distro name
initTargetDistroRid
if [ $__PortableBuild == 0 ]; then
__CommonMSBuildArgs="$__CommonMSBuildArgs /p:PortableBuild=false"
fi
if [[ (-z "$__GenerateLayoutOnly") && (-z "$__GenerateTestHostOnly") && (-z "$__BuildTestWrappersOnly") ]]; then
build_Tests
elif [ ! -z "$__BuildTestWrappersOnly" ]; then
elif [[ ! -z "$__BuildTestWrappersOnly" ]]; then
build_test_wrappers
else
generate_layout
fi
if [ $? -ne 0 ]; then
if [[ "$?" -ne 0 ]]; then
echo "Failed to build tests"
exit 1
fi
@ -727,9 +633,9 @@ fi
echo "${__MsgPrefix}Test build successful."
echo "${__MsgPrefix}Test binaries are available at ${__TestBinDir}"
__testNativeBinDir=$__IntermediatesDir/tests
__testNativeBinDir="$__IntermediatesDir"/tests
if [ $__RunTests -ne 0 ]; then
if [[ "$__RunTests" -ne 0 ]]; then
echo "Run Tests..."

View File

@ -23,11 +23,6 @@ if defined VS160COMNTOOLS (
set __VSVersion=vs2017
)
:: Work around Jenkins CI + msbuild problem: Jenkins sometimes creates very large environment
:: variables, and msbuild can't handle environment blocks with such large variables. So clear
:: out the variables that might be too large.
set ghprbCommentBody=
:: Note that the msbuild project files (specifically, dir.proj) will use the following variables, if set:
:: __BuildArch -- default: x64
:: __BuildType -- default: Debug

View File

@ -1,12 +1,7 @@
#!/usr/bin/env bash
# Work around Jenkins CI + msbuild problem: Jenkins sometimes creates very large environment
# variables, and msbuild can't handle environment blocks with such large variables. So clear
# out the variables that might be too large.
export ghprbCommentBody=
# resolve python-version to use
if [ "$PYTHON" == "" ] ; then
if [[ -z "$PYTHON" ]]; then
if ! PYTHON=$(command -v python3 || command -v python2 || command -v python || command -v py)
then
echo "Unable to locate build-dependency python!" 1>&2
@ -15,7 +10,7 @@ if [ "$PYTHON" == "" ] ; then
fi
# validate python-dependency
# useful in case of explicitly set option.
if ! command -v $PYTHON > /dev/null
if ! command -v "$PYTHON" > /dev/null
then
echo "Unable to locate build-dependency python ($PYTHON)!" 1>&2
exit 1
@ -38,78 +33,56 @@ usage_list+=("-skipnuget: skip NuGet package generation.")
usage_list+=("-skiprestore: specify the official build ID to be used by this build.")
usage_list+=("-skiprestoreoptdata: build CoreLib as PartialNGen.")
usage_list+=("-staticanalyzer: skip native image generation.")
usage_list+=("-stripSymbols: skip native image generation.")
setup_dirs()
setup_dirs_local()
{
echo Setting up directories for build
setup_dirs
mkdir -p "$__RootBinDir"
mkdir -p "$__BinDir"
mkdir -p "$__LogsDir"
mkdir -p "$__MsbuildDebugLogsDir"
mkdir -p "$__IntermediatesDir"
if [ $__CrossBuild == 1 ]; then
if [[ "$__CrossBuild" == 1 ]]; then
mkdir -p "$__CrossComponentBinDir"
fi
}
# Check the system to ensure the right prereqs are in place
check_prereqs()
{
echo "Checking prerequisites..."
# Check presence of CMake on the path
hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }
function version { echo "$@" | awk -F. '{ printf("%d%02d%02d\n", $1,$2,$3); }'; }
local cmake_version=$(cmake --version | grep -Eo "[0-9]+\.[0-9]+\.[0-9]+")
if [[ $(version $cmake_version) -lt $(version 3.14.0) ]]; then
echo "Please install CMake 3.14 or newer from http://www.cmake.org/download/ or https://apt.kitware.com and ensure it is on your path."; exit 1;
fi
}
restore_optdata()
{
local OptDataProjectFilePath="$__ProjectRoot/src/.nuget/optdata/optdata.csproj"
if [[ ( $__SkipRestoreOptData == 0 ) && ( $__isMSBuildOnNETCoreSupported == 1 ) ]]; then
if [[ "$__SkipRestoreOptData" == 0 && "$__IsMSBuildOnNETCoreSupported" == 1 ]]; then
echo "Restoring the OptimizationData package"
"$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs \
$OptDataProjectFilePath /t:Restore /m \
$__CommonMSBuildArgs $__UnprocessedBuildArgs
local exit_code=$?
if [ $exit_code != 0 ]; then
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to restore the optimization data package."
exit $exit_code
exit "$exit_code"
fi
fi
if [ $__isMSBuildOnNETCoreSupported == 1 ]; then
if [[ "$__IsMSBuildOnNETCoreSupported" == 1 ]]; then
# Parse the optdata package versions out of msbuild so that we can pass them on to CMake
local PgoDataPackagePathOutputFile="${__IntermediatesDir}/optdatapath.txt"
local IbcDataPackagePathOutputFile="${__IntermediatesDir}/ibcoptdatapath.txt"
# Writes into ${PgoDataPackagePathOutputFile}
"$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs $OptDataProjectFilePath /t:DumpPgoDataPackagePath ${__CommonMSBuildArgs} /p:PgoDataPackagePathOutputFile=${PgoDataPackagePathOutputFile} 2>&1 > /dev/null
local exit_code=$?
if [ $exit_code != 0 ] || [ ! -f "${PgoDataPackagePathOutputFile}" ]; then
"$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs $OptDataProjectFilePath /t:DumpPgoDataPackagePath ${__CommonMSBuildArgs} /p:PgoDataPackagePathOutputFile=${PgoDataPackagePathOutputFile} > /dev/null 2>&1
local exit_code="$?"
if [[ "$exit_code" != 0 || ! -f "${PgoDataPackagePathOutputFile}" ]]; then
echo "${__ErrMsgPrefix}Failed to get PGO data package path."
exit $exit_code
exit "$exit_code"
fi
__PgoOptDataPath=$(<"${PgoDataPackagePathOutputFile}")
# Writes into ${IbcDataPackagePathOutputFile}
"$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs $OptDataProjectFilePath /t:DumpIbcDataPackagePath ${__CommonMSBuildArgs} /p:IbcDataPackagePathOutputFile=${IbcDataPackagePathOutputFile} 2>&1 > /dev/null
local exit_code=$?
if [ $exit_code != 0 ] || [ ! -f "${IbcDataPackagePathOutputFile}" ]; then
"$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs $OptDataProjectFilePath /t:DumpIbcDataPackagePath ${__CommonMSBuildArgs} /p:IbcDataPackagePathOutputFile=${IbcDataPackagePathOutputFile} > /dev/null 2>&1
local exit_code="$?"
if [[ "$exit_code" != 0 || ! -f "${IbcDataPackagePathOutputFile}" ]]; then
echo "${__ErrMsgPrefix}Failed to get IBC data package path."
exit $exit_code
exit "$exit_code"
fi
__IbcOptDataPath=$(<"${IbcDataPackagePathOutputFile}")
@ -118,134 +91,25 @@ restore_optdata()
generate_event_logging_sources()
{
__OutputEventingDir=$1
__OutputEventingDir="$1"
__PythonWarningFlags="-Wall"
if [[ $__IgnoreWarnings == 0 ]]; then
if [[ "$__IgnoreWarnings" == 0 ]]; then
__PythonWarningFlags="$__PythonWarningFlags -Werror"
fi
echo "Laying out dynamically generated EventSource classes"
$PYTHON -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genRuntimeEventSources.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__OutputEventingDir"
"$PYTHON" -B $__PythonWarningFlags "$__ProjectRoot/src/scripts/genRuntimeEventSources.py" --man "$__ProjectRoot/src/vm/ClrEtwAll.man" --intermediate "$__OutputEventingDir"
}
generate_event_logging()
{
# Event Logging Infrastructure
if [[ $__SkipMSCorLib == 0 ]]; then
if [[ "$__SkipMSCorLib" == 0 ]]; then
generate_event_logging_sources "$__ArtifactsIntermediatesDir/Eventing/$__BuildArch/$__BuildType"
fi
}
build_native()
{
skipCondition=$1
platformArch="$2"
intermediatesForBuild="$3"
extraCmakeArguments="$4"
message="$5"
if [ $skipCondition == 1 ]; then
echo "Skipping $message build."
return
fi
# All set to commence the build
echo "Commencing build of $message for $__BuildOS.$__BuildArch.$__BuildType in $intermediatesForBuild"
generator=""
buildTool="make"
if [ $__UseNinja == 1 ]; then
generator="ninja"
if ! buildTool=$(command -v ninja || command -v ninja-build); then
echo "Unable to locate ninja!" 1>&2
exit 1
fi
fi
if [ $__SkipConfigure == 0 ]; then
# if msbuild is not supported, then set __SkipGenerateVersion to 1
if [ $__isMSBuildOnNETCoreSupported == 0 ]; then __SkipGenerateVersion=1; fi
# Drop version.c file
__versionSourceFile="$intermediatesForBuild/version.c"
if [ $__SkipGenerateVersion == 0 ]; then
pwd
"$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs $__RepoRootDir/eng/empty.csproj \
/p:NativeVersionFile=$__versionSourceFile \
/t:GenerateNativeVersionFile /restore \
$__CommonMSBuildArgs $__UnprocessedBuildArgs
local exit_code=$?
if [ $exit_code != 0 ]; then
echo "${__ErrMsgPrefix}Failed to generate native version file."
exit $exit_code
fi
else
# Generate the dummy version.c, but only if it didn't exist to make sure we don't trigger unnecessary rebuild
__versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
if [ -e $__versionSourceFile ]; then
read existingVersionSourceLine < $__versionSourceFile
fi
if [ "$__versionSourceLine" != "$existingVersionSourceLine" ]; then
echo $__versionSourceLine > $__versionSourceFile
fi
fi
# Regenerate the CMake solution
if [ "$__StaticAnalyzer" = 1 ]; then
scan_build=scan-build
fi
if [[ -n "$__CodeCoverage" ]]; then
extraCmakeArguments="$extraCmakeArguments -DCLR_CMAKE_ENABLE_CODE_COVERAGE=1"
fi
engNativeDir="$__RepoRootDir/eng/native"
__cmakeargs="$__cmakeargs -DCLR_ENG_NATIVE_DIR=\"$engNativeDir\""
nextCommand="\"$engNativeDir/gen-buildsys.sh\" \"$__ProjectRoot\" \"$__ProjectRoot\" \"$intermediatesForBuild\" $platformArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType $generator $scan_build $extraCmakeArguments $__cmakeargs"
echo "Invoking $nextCommand"
eval $nextCommand
if [ $? != 0 ]; then
echo "${__ErrMsgPrefix}Failed to generate $message build project!"
exit 1
fi
fi
if [ ! -f "$intermediatesForBuild/CMakeCache.txt" ]; then
echo "${__ErrMsgPrefix}Unable to find generated build files for $message project!"
exit 1
fi
# Build
if [ $__ConfigureOnly == 1 ]; then
echo "Finish configuration & skipping $message build."
return
fi
# Check that the makefiles were created.
if [ $__StaticAnalyzer == 1 ]; then
pushd "$intermediatesForBuild"
buildTool="$SCAN_BUILD_COMMAND -o $__BinDir/scan-build-log $buildTool"
echo "Executing $buildTool install -j $__NumProc"
$buildTool install -j $__NumProc
popd
else
echo "Executing cmake --build \"$intermediatesForBuild\" --target install -j $__NumProc"
cmake --build "$intermediatesForBuild" --target install -j $__NumProc
fi
local exit_code=$?
if [ $exit_code != 0 ]; then
echo "${__ErrMsgPrefix}Failed to build $message."
exit $exit_code
fi
}
build_cross_architecture_components()
{
local intermediatesForBuild="$__IntermediatesDir/Host$__CrossArch/crossgen"
@ -270,8 +134,8 @@ build_cross_architecture_components()
export __CMakeBinDir="$crossArchBinDir"
export CROSSCOMPILE=0
__ExtraCmakeArgs="-DCLR_CMAKE_TARGET_ARCH=$__BuildArch -DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize -DCLR_CROSS_COMPONENTS_BUILD=1"
build_native $__SkipCrossArchBuild "$__CrossArch" "$intermediatesForBuild" "$__ExtraCmakeArgs" "cross-architecture components"
__CMakeArgs="-DCLR_CMAKE_TARGET_ARCH=$__BuildArch -DCLR_CROSS_COMPONENTS_BUILD=1 $__CMakeArgs"
build_native "$__CrossArch" "$__ProjectRoot" "$__ProjectRoot" "$intermediatesForBuild" "cross-architecture components"
export CROSSCOMPILE=1
}
@ -281,42 +145,42 @@ build_CoreLib_ni()
local __CrossGenExec=$1
local __CoreLibILDir=$2
if [ $__PartialNgen == 1 ]; then
if [[ "$__PartialNgen" == 1 ]]; then
export COMPlus_PartialNGen=1
fi
if [ -e $__CrossGenCoreLibLog ]; then
rm $__CrossGenCoreLibLog
if [[ -e "$__CrossGenCoreLibLog" ]]; then
rm "$__CrossGenCoreLibLog"
fi
echo "Generating native image of System.Private.CoreLib.dll for $__BuildOS.$__BuildArch.$__BuildType. Logging to \"$__CrossGenCoreLibLog\"."
echo "$__CrossGenExec /Platform_Assemblies_Paths $__CoreLibILDir $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__CoreLibILDir/System.Private.CoreLib.dll"
$__CrossGenExec /nologo /Platform_Assemblies_Paths $__CoreLibILDir $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__CoreLibILDir/System.Private.CoreLib.dll >> $__CrossGenCoreLibLog 2>&1
local exit_code=$?
if [ $exit_code != 0 ]; then
"$__CrossGenExec" /nologo /Platform_Assemblies_Paths $__CoreLibILDir $__IbcTuning /out $__BinDir/System.Private.CoreLib.dll $__CoreLibILDir/System.Private.CoreLib.dll >> $__CrossGenCoreLibLog 2>&1
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to generate native image for System.Private.CoreLib. Refer to $__CrossGenCoreLibLog"
exit $exit_code
exit "$exit_code"
fi
if [ "$__BuildOS" == "Linux" ]; then
if [[ "$__BuildOS" == "Linux" ]]; then
echo "Generating symbol file for System.Private.CoreLib.dll"
echo "$__CrossGenExec /Platform_Assemblies_Paths $__BinDir /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.dll"
$__CrossGenExec /nologo /Platform_Assemblies_Paths $__BinDir /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.dll >> $__CrossGenCoreLibLog 2>&1
local exit_code=$?
if [ $exit_code != 0 ]; then
"$__CrossGenExec" /nologo /Platform_Assemblies_Paths $__BinDir /CreatePerfMap $__BinDir $__BinDir/System.Private.CoreLib.dll >> $__CrossGenCoreLibLog 2>&1
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to generate symbol file for System.Private.CoreLib. Refer to $__CrossGenCoreLibLog"
exit $exit_code
exit "$exit_code"
fi
fi
}
build_CoreLib()
{
if [ $__isMSBuildOnNETCoreSupported == 0 ]; then
if [[ "$__IsMSBuildOnNETCoreSupported" == 0 ]]; then
echo "System.Private.CoreLib.dll build unsupported."
return
fi
if [ $__SkipMSCorLib == 1 ]; then
if [[ "$__SkipMSCorLib" == 1 ]]; then
echo "Skipping building System.Private.CoreLib."
return
fi
@ -325,7 +189,7 @@ build_CoreLib()
# Invoke MSBuild
__ExtraBuildArgs=""
if [[ "$__IbcTuning" == "" ]]; then
if [[ -z "$__IbcTuning" ]]; then
__ExtraBuildArgs="$__ExtraBuildArgs /p:OptimizationDataDir=\"$__IbcOptDataPath/data\""
__ExtraBuildArgs="$__ExtraBuildArgs /p:EnableProfileGuidedOptimization=true"
fi
@ -341,10 +205,10 @@ build_CoreLib()
/p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir \
$__CommonMSBuildArgs $__ExtraBuildArgs $__UnprocessedBuildArgs
local exit_code=$?
if [ $exit_code != 0 ]; then
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to restore managed components."
exit $exit_code
exit "$exit_code"
fi
"$__RepoRootDir/eng/common/msbuild.sh" /clp:nosummary $__ArcadeScriptArgs \
@ -354,23 +218,23 @@ build_CoreLib()
/p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir \
$__CommonMSBuildArgs $__ExtraBuildArgs $__UnprocessedBuildArgs
local exit_code=$?
if [ $exit_code != 0 ]; then
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to build managed components."
exit $exit_code
exit "$exit_code"
fi
if [[ "$__BuildManagedTools" -eq "1" ]]; then
echo "Publishing crossgen2 for $__DistroRid"
"$__RepoRootDir/dotnet.sh" publish --self-contained -r $__DistroRid -c $__BuildType -o "$__BinDir/crossgen2" "$__ProjectRoot/src/tools/crossgen2/crossgen2/crossgen2.csproj" /nologo /p:BuildArch=$__BuildArch
local exit_code=$?
if [ $exit_code != 0 ]; then
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to build crossgen2."
exit $exit_code
exit "$exit_code"
fi
if [ "$__HostOS" == "OSX" ]; then
if [[ "$__HostOS" == "OSX" ]]; then
cp "$__BinDir/libclrjit.dylib" "$__BinDir/crossgen2/libclrjitilc.dylib"
cp "$__BinDir/libjitinterface.dylib" "$__BinDir/crossgen2/libjitinterface.dylib"
else
@ -379,45 +243,45 @@ build_CoreLib()
fi
fi
local __CoreLibILDir=$__BinDir/IL
local __CoreLibILDir="$__BinDir"/IL
if [ $__SkipCrossgen == 1 ]; then
if [[ "$__SkipCrossgen" == 1 ]]; then
echo "Skipping generating native image"
if [ $__CrossBuild == 1 ]; then
if [[ "$__CrossBuild" == 1 ]]; then
# Crossgen not performed, so treat the IL version as the final version
cp $__CoreLibILDir/System.Private.CoreLib.dll $__BinDir/System.Private.CoreLib.dll
cp "$__CoreLibILDir"/System.Private.CoreLib.dll "$__BinDir"/System.Private.CoreLib.dll
fi
return
fi
# The cross build generates a crossgen with the target architecture.
if [ $__CrossBuild == 0 ]; then
if [ $__SkipCoreCLR == 1 ]; then
if [[ "$__CrossBuild" == 0 ]]; then
if [[ "$__SkipCoreCLR" == 1 ]]; then
return
fi
# The architecture of host pc must be same architecture with target.
if [[ ( "$__HostArch" == "$__BuildArch" ) ]]; then
build_CoreLib_ni "$__BinDir/crossgen" $__CoreLibILDir
if [[ "$__HostArch" == "$__BuildArch" ]]; then
build_CoreLib_ni "$__BinDir/crossgen" "$__CoreLibILDir"
elif [[ ( "$__HostArch" == "x64" ) && ( "$__BuildArch" == "x86" ) ]]; then
build_CoreLib_ni "$__BinDir/crossgen" $__CoreLibILDir
build_CoreLib_ni "$__BinDir/crossgen" "$__CoreLibILDir"
elif [[ ( "$__HostArch" == "arm64" ) && ( "$__BuildArch" == "arm" ) ]]; then
build_CoreLib_ni "$__BinDir/crossgen" $__CoreLibILDir
build_CoreLib_ni "$__BinDir/crossgen" "$__CoreLibILDir"
else
exit 1
fi
else
if [[ ( "$__CrossArch" == "x86" ) && ( "$__BuildArch" == "arm" ) ]]; then
build_CoreLib_ni "$__CrossComponentBinDir/crossgen" $__CoreLibILDir
build_CoreLib_ni "$__CrossComponentBinDir/crossgen" "$__CoreLibILDir"
elif [[ ( "$__CrossArch" == "x64" ) && ( "$__BuildArch" == "arm" ) ]]; then
build_CoreLib_ni "$__CrossComponentBinDir/crossgen" $__CoreLibILDir
build_CoreLib_ni "$__CrossComponentBinDir/crossgen" "$__CoreLibILDir"
elif [[ ( "$__HostArch" == "x64" ) && ( "$__BuildArch" == "arm64" ) ]]; then
build_CoreLib_ni "$__CrossComponentBinDir/crossgen" $__CoreLibILDir
build_CoreLib_ni "$__CrossComponentBinDir/crossgen" "$__CoreLibILDir"
else
# Crossgen not performed, so treat the IL version as the final version
cp $__CoreLibILDir/System.Private.CoreLib.dll $__BinDir/System.Private.CoreLib.dll
cp "$__CoreLibILDir"/System.Private.CoreLib.dll "$__BinDir"/System.Private.CoreLib.dll
fi
fi
}
@ -425,37 +289,37 @@ build_CoreLib()
generate_NugetPackages()
{
# We can only generate nuget package if we also support building mscorlib as part of this build.
if [ $__isMSBuildOnNETCoreSupported == 0 ]; then
if [[ "$__IsMSBuildOnNETCoreSupported" == 0 ]]; then
echo "Nuget package generation unsupported."
return
fi
# Since we can build mscorlib for this OS, did we build the native components as well?
if [[ $__SkipCoreCLR == 1 && $__CrossgenOnly == 0 ]]; then
if [[ "$__SkipCoreCLR" == 1 && "$__CrossgenOnly" == 0 ]]; then
echo "Unable to generate nuget packages since native components were not built."
return
fi
echo "Generating nuget packages for "$__BuildOS
echo "DistroRid is "$__DistroRid
echo "ROOTFS_DIR is "$ROOTFS_DIR
echo "Generating nuget packages for $__BuildOS"
echo "DistroRid is $__DistroRid"
echo "ROOTFS_DIR is $ROOTFS_DIR"
# Build the packages
# Package build uses the Arcade system and scripts, relying on it to restore required toolsets as part of build
$__RepoRootDir/eng/common/build.sh -r -b -projects $__SourceDir/.nuget/packages.builds \
-verbosity minimal -bl:$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.binlog \
"$__RepoRootDir"/eng/common/build.sh -r -b -projects "$__SourceDir"/.nuget/packages.builds \
-verbosity minimal -bl:"$__LogsDir/Nuget_$__BuildOS__$__BuildArch__$__BuildType.binlog" \
/p:PortableBuild=true \
/p:__IntermediatesDir=$__IntermediatesDir /p:__RootBinDir=$__RootBinDir /p:__DoCrossArchBuild=$__CrossBuild \
/p:"__IntermediatesDir=$__IntermediatesDir" /p:"__RootBinDir=$__RootBinDir" /p:"__DoCrossArchBuild=$__CrossBuild" \
$__CommonMSBuildArgs $__UnprocessedBuildArgs
local exit_code=$?
if [ $exit_code != 0 ]; then
local exit_code="$?"
if [[ "$exit_code" != 0 ]]; then
echo "${__ErrMsgPrefix}Failed to generate Nuget packages."
exit $exit_code
exit "$exit_code"
fi
}
handle_arguments() {
case $1 in
handle_arguments_local() {
case "$1" in
crossgenonly|-crossgenonly)
__SkipMSCorLib=1
__SkipCoreCLR=1
@ -472,7 +336,7 @@ handle_arguments() {
ignorewarnings|-ignorewarnings)
__IgnoreWarnings=1
__cmakeargs="$__cmakeargs -DCLR_CMAKE_WARNINGS_ARE_ERRORS=OFF"
__CMakeArgs="-DCLR_CMAKE_WARNINGS_ARE_ERRORS=OFF $__CMakeArgs"
;;
nopgooptimize|-nopgooptimize)
@ -526,12 +390,8 @@ handle_arguments() {
__StaticAnalyzer=1
;;
stripsymbols|-stripsymbols)
__cmakeargs="$__cmakeargs -DSTRIP_SYMBOLS=true"
;;
*)
__UnprocessedBuildArgs+=("$1")
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
;;
esac
}
@ -545,15 +405,13 @@ echo "Commencing CoreCLR Repo build"
#
# Set the default arguments for build
# Obtain the location of the bash script to figure out where the root of the subrepo is.
__ProjectRoot="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Some paths are relative to the main repo root
__RepoRootDir="${__ProjectRoot}/../.."
# Obtain the location of the bash script to figure out where the root of the repo is.
__ProjectRoot="$(cd "$(dirname "$0")"; pwd -P)"
__RepoRootDir="$(cd "$__ProjectRoot"/../..; pwd -P)"
__BuildArch=
__BuildType=Debug
__CodeCoverage=
__CodeCoverage=0
__IgnoreWarnings=0
# Set the various build properties here so that CMake and MSBuild can pick them up
@ -568,6 +426,7 @@ __CrossgenOnly=0
__DistroRid=""
__IbcOptDataPath=""
__IbcTuning=""
__IsMSBuildOnNETCoreSupported=0
__MSBCleanBuildArgs=
__OfficialBuildIdArg=""
__PartialNgen=0
@ -595,12 +454,11 @@ __UnprocessedBuildArgs=
__UseNinja=0
__VerboseBuild=0
__ValidateCrossArg=1
__cmakeargs=""
__msbuildonunsupportedplatform=0
__CMakeArgs=""
source "$__ProjectRoot"/_build-commons.sh
if [ "${__BuildArch}" != "${__HostArch}" ]; then
if [[ "${__BuildArch}" != "${__HostArch}" ]]; then
__CrossBuild=1
fi
@ -613,40 +471,21 @@ __BinDir="$__RootBinDir/bin/coreclr/$__BuildOS.$__BuildArch.$__BuildType"
__PackagesBinDir="$__BinDir/.nuget"
export __IntermediatesDir="$__RootBinDir/obj/coreclr/$__BuildOS.$__BuildArch.$__BuildType"
export __ArtifactsIntermediatesDir="$__RepoRootDir/artifacts/obj/coreclr"
__isMSBuildOnNETCoreSupported=0
__CrossComponentBinDir="$__BinDir"
__CrossArch="$__HostArch"
if [ $__CrossBuild == 1 ]; then
if [[ "$__CrossBuild" == 1 ]]; then
__CrossComponentBinDir="$__CrossComponentBinDir/$__CrossArch"
fi
__CrossGenCoreLibLog="$__LogsDir/CrossgenCoreLib_$__BuildOS.$__BuildArch.$__BuildType.log"
# Configure environment if we are doing a cross compile.
if [ $__CrossBuild == 1 ]; then
export CROSSCOMPILE=1
if ! [[ -n "$ROOTFS_DIR" ]]; then
export ROOTFS_DIR="$__RepoRootDir/.tools/rootfs/$__BuildArch"
fi
fi
# init the target distro name
initTargetDistroRid
if [ $__PortableBuild == 0 ]; then
__CommonMSBuildArgs="$__CommonMSBuildArgs /p:PortableBuild=false"
fi
# Init if MSBuild for .NET Core is supported for this platform
isMSBuildOnNETCoreSupported
# CI_SPECIFIC - On CI machines, $HOME may not be set. In such a case, create a subfolder and set the variable to set.
# This is needed by CLI to function.
if [ -z "$HOME" ]; then
if [ ! -d "$__ProjectDir/temp_home" ]; then
if [[ -z "$HOME" ]]; then
if [[ ! -d "$__ProjectDir/temp_home" ]]; then
mkdir temp_home
fi
export HOME=$__ProjectDir/temp_home
export HOME="$__ProjectDir"/temp_home
echo "HOME not defined; setting it to $HOME"
fi
@ -655,7 +494,7 @@ fi
export __CMakeBinDir="$__BinDir"
# Make the directories necessary for build if they don't exist
setup_dirs
setup_dirs_local
# Set up the directory for MSBuild debug logs.
export MSBUILDDEBUGPATH="${__MsbuildDebugLogsDir}"
@ -670,13 +509,21 @@ restore_optdata
generate_event_logging
# Build the coreclr (native) components.
__ExtraCmakeArgs="-DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize"
__CMakeArgs="-DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize $__CMakeArgs"
build_native $__SkipCoreCLR "$__BuildArch" "$__IntermediatesDir" "$__ExtraCmakeArgs" "CoreCLR component"
if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then
__CMakeArgs="-DCLR_CMAKE_ENABLE_CODE_COVERAGE=1 $__CMakeArgs"
fi
if [[ "$__SkipCoreCLR" == 1 ]]; then
echo "Skipping CoreCLR component build."
else
build_native "$__BuildArch" "$__ProjectRoot" "$__ProjectRoot" "$__IntermediatesDir" "CoreCLR component"
fi
# Build cross-architecture components
if [ $__SkipCrossArchNative != 1 ]; then
if [[ $__CrossBuild == 1 ]]; then
if [[ "$__SkipCrossArchNative" != 1 ]]; then
if [[ "$__CrossBuild" == 1 ]]; then
build_cross_architecture_components
fi
fi
@ -685,12 +532,12 @@ fi
build_CoreLib
if [ $__CrossgenOnly == 1 ]; then
if [[ "$__CrossgenOnly" == 1 ]]; then
build_CoreLib_ni "$__BinDir/crossgen"
fi
# Generate nuget packages
if [ $__SkipNuget != 1 ]; then
if [[ "$__SkipNuget" != 1 ]]; then
generate_NugetPackages
fi

View File

@ -8,194 +8,12 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
cmake_policy(SET CMP0083 NEW)
include(CheckPIESupported)
include(CheckCXXCompilerFlag)
# All code we build should be compiled as position independent
check_pie_supported(OUTPUT_VARIABLE PIE_SUPPORT_OUTPUT LANGUAGES CXX)
if(NOT MSVC AND NOT CMAKE_CXX_LINK_PIE_SUPPORTED)
message(WARNING "PIE is not supported at link time: ${PIE_SUPPORT_OUTPUT}.\n"
"PIE link options will not be passed to linker.")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
#----------------------------------------
# Detect and set platform variable names
# - for non-windows build platform & architecture is detected using inbuilt CMAKE variables and cross target component configure
# - for windows we use the passed in parameter to CMAKE to determine build arch
#----------------------------------------
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CLR_CMAKE_HOST_UNIX 1)
if(CLR_CROSS_COMPONENTS_BUILD)
# CMAKE_HOST_SYSTEM_PROCESSOR returns the value of `uname -p` on host.
if(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL amd64)
if(CLR_CMAKE_TARGET_ARCH STREQUAL "arm" OR CLR_CMAKE_TARGET_ARCH STREQUAL "armel")
if(CMAKE_CROSSCOMPILING)
set(CLR_CMAKE_HOST_UNIX_X86 1)
else()
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
endif()
else()
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
endif()
elseif(CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL i686)
set(CLR_CMAKE_HOST_UNIX_X86 1)
else()
clr_unknown_arch()
endif()
else()
# CMAKE_SYSTEM_PROCESSOR returns the value of `uname -p` on target.
# For the AMD/Intel 64bit architecture two different strings are common.
# Linux and Darwin identify it as "x86_64" while FreeBSD and netbsd uses the
# "amd64" string. Accept either of the two here.
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 OR CMAKE_SYSTEM_PROCESSOR STREQUAL amd64)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL armv7l)
set(CLR_CMAKE_HOST_UNIX_ARM 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm)
set(CLR_CMAKE_HOST_UNIX_ARM 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL aarch64)
set(CLR_CMAKE_HOST_UNIX_ARM64 1)
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL i686)
set(CLR_CMAKE_HOST_UNIX_X86 1)
else()
clr_unknown_arch()
endif()
endif()
set(CLR_CMAKE_HOST_LINUX 1)
# Detect Linux ID
set(LINUX_ID_FILE "/etc/os-release")
if(CMAKE_CROSSCOMPILING)
set(LINUX_ID_FILE "${CMAKE_SYSROOT}${LINUX_ID_FILE}")
endif()
execute_process(
COMMAND bash -c "source ${LINUX_ID_FILE} && echo \$ID"
OUTPUT_VARIABLE CLR_CMAKE_LINUX_ID
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(DEFINED CLR_CMAKE_LINUX_ID)
if(CLR_CMAKE_LINUX_ID STREQUAL tizen)
set(CLR_CMAKE_TARGET_TIZEN_LINUX 1)
elseif(CLR_CMAKE_LINUX_ID STREQUAL alpine)
set(CLR_CMAKE_HOST_ALPINE_LINUX 1)
endif()
endif(DEFINED CLR_CMAKE_LINUX_ID)
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CLR_CMAKE_HOST_DARWIN 1)
set(CMAKE_ASM_COMPILE_OBJECT "${CMAKE_C_COMPILER} <FLAGS> <DEFINES> <INCLUDES> -o <OBJECT> -c <SOURCE>")
endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CLR_CMAKE_HOST_FREEBSD 1)
endif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
if(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CLR_CMAKE_HOST_OPENBSD 1)
endif(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
if(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
set(CLR_CMAKE_HOST_UNIX 1)
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CLR_CMAKE_HOST_NETBSD 1)
endif(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
if(CMAKE_SYSTEM_NAME STREQUAL SunOS)
set(CLR_CMAKE_HOST_UNIX 1)
EXECUTE_PROCESS(
COMMAND isainfo -n
OUTPUT_VARIABLE SUNOS_NATIVE_INSTRUCTION_SET
)
if(SUNOS_NATIVE_INSTRUCTION_SET MATCHES "amd64")
set(CLR_CMAKE_HOST_UNIX_AMD64 1)
set(CMAKE_SYSTEM_PROCESSOR "amd64")
else()
clr_unknown_arch()
endif()
set(CLR_CMAKE_HOST_SUNOS 1)
endif(CMAKE_SYSTEM_NAME STREQUAL SunOS)
include(${CLR_ENG_NATIVE_DIR}/configureplatform.cmake)
# "configureoptimization.cmake" must be included after CLR_CMAKE_HOST_UNIX has been set.
include(${CMAKE_CURRENT_LIST_DIR}/configureoptimization.cmake)
#--------------------------------------------
# This repo builds two set of binaries
# 1. binaries which execute on target arch machine
# - for such binaries host architecture & target architecture are same
# - eg. coreclr.dll
# 2. binaries which execute on host machine but target another architecture
# - host architecture is different from target architecture
# - eg. crossgen.exe - runs on x64 machine and generates nis targeting arm64
# - for complete list of such binaries refer to file crosscomponents.cmake
#-------------------------------------------------------------
# Set HOST architecture variables
if(CLR_CMAKE_HOST_UNIX_ARM)
set(CLR_CMAKE_HOST_ARCH_ARM 1)
set(CLR_CMAKE_HOST_ARCH "arm")
elseif(CLR_CMAKE_HOST_UNIX_ARM64)
set(CLR_CMAKE_HOST_ARCH_ARM64 1)
set(CLR_CMAKE_HOST_ARCH "arm64")
elseif(CLR_CMAKE_HOST_UNIX_AMD64)
set(CLR_CMAKE_HOST_ARCH_AMD64 1)
set(CLR_CMAKE_HOST_ARCH "x64")
elseif(CLR_CMAKE_HOST_UNIX_X86)
set(CLR_CMAKE_HOST_ARCH_I386 1)
set(CLR_CMAKE_HOST_ARCH "x86")
elseif(WIN32)
# CLR_CMAKE_HOST_ARCH is passed in as param to cmake
if (CLR_CMAKE_HOST_ARCH STREQUAL x64)
set(CLR_CMAKE_HOST_ARCH_AMD64 1)
elseif(CLR_CMAKE_HOST_ARCH STREQUAL x86)
set(CLR_CMAKE_HOST_ARCH_I386 1)
elseif(CLR_CMAKE_HOST_ARCH STREQUAL arm)
set(CLR_CMAKE_HOST_ARCH_ARM 1)
elseif(CLR_CMAKE_HOST_ARCH STREQUAL arm64)
set(CLR_CMAKE_HOST_ARCH_ARM64 1)
else()
clr_unknown_arch()
endif()
endif()
# Set TARGET architecture variables
# Target arch will be a cmake param (optional) for both windows as well as non-windows build
# if target arch is not specified then host & target are same
if(NOT DEFINED CLR_CMAKE_TARGET_ARCH OR CLR_CMAKE_TARGET_ARCH STREQUAL "" )
set(CLR_CMAKE_TARGET_ARCH ${CLR_CMAKE_HOST_ARCH})
endif()
# Set target architecture variables
if (CLR_CMAKE_TARGET_ARCH STREQUAL x64)
set(CLR_CMAKE_TARGET_ARCH_AMD64 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL x86)
set(CLR_CMAKE_TARGET_ARCH_I386 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm64)
set(CLR_CMAKE_TARGET_ARCH_ARM64 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL arm)
set(CLR_CMAKE_TARGET_ARCH_ARM 1)
elseif(CLR_CMAKE_TARGET_ARCH STREQUAL armel)
set(CLR_CMAKE_TARGET_ARCH_ARM 1)
set(ARM_SOFTFP 1)
else()
clr_unknown_arch()
endif()
# check if host & target arch combination are valid
if(NOT(CLR_CMAKE_TARGET_ARCH STREQUAL CLR_CMAKE_HOST_ARCH))
if(NOT((CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM64) OR (CLR_CMAKE_HOST_ARCH_I386 AND CLR_CMAKE_TARGET_ARCH_ARM) OR (CLR_CMAKE_HOST_ARCH_AMD64 AND CLR_CMAKE_TARGET_ARCH_ARM)))
message(FATAL_ERROR "Invalid host and target arch combination")
endif()
endif()
#-----------------------------------------------------
# Initialize Cmake compiler flags and other variables
#-----------------------------------------------------

View File

@ -67,6 +67,7 @@
<!-- Workaround for https://github.com/mono/linker/issues/378 -->
<type fullname="System.Runtime.InteropServices.IDispatch" />
<type fullname="Internal.Runtime.InteropServices.IClassFactory2" />
<type fullname="Windows.Foundation.Diagnostics.TracingStatusChangedEventArgs" />
<type fullname="System.Threading.ThreadPoolBoundHandle">
<!-- Workaround to keep .interfaceimpl even though this type
is not instantiated on unix:

View File

@ -43,330 +43,13 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#include "mscorrc.common.rc"
#define MDARC_PINVOKE_SIGNATURE_MISMATCH_MSG \
L"A call to PInvoke function '%1$s' has unbalanced the stack. This is likely because the managed PInvoke "\
L"signature does not match the unmanaged target signature. Check that the calling convention and " \
L"parameters of the PInvoke signature match the target unmanaged signature."
#define MDARC_PINVOKE_LOG_MSG \
L"The first PInvoke call to export '%1$s' in module '%2$s' has been made."
#define MDARC_LOAD_FROM_CONTEXT_MSG \
L"The assembly named '%1$s' was loaded from '%2$s' using the LoadFrom context. The use of this " \
L"context can result in unexpected behavior for serialization, casting and dependency resolution. " \
L"In almost all cases, it is recommended that the LoadFrom context be avoided. This can be done " \
L"by installing assemblies in the Global Assembly Cache or in the ApplicationBase directory and " \
L"using Assembly.Load when explicitly loading assemblies."
#define MDARC_BINDING_FAILURE_CODEBASE_ONLY_MSG \
L"The assembly loaded from code base '%1$s' failed to load in the '%2$s' binding context of the " \
L"AppDomain with ID %3$d. The cause of the failure was: %4$s"
#define MDARC_BINDING_FAILURE_DISPLAYNAME_ONLY_MSG \
L"The assembly with display name '%1$s' failed to load in the '%2$s' binding context of the " \
L"AppDomain with ID %3$d. The cause of the failure was: %4$s"
#define MDARC_BINDING_FAILURE_MSG \
L"The assembly with display name '%1$s' loaded from code base '%2$s' failed to load " \
L"in the '%3$s' binding context of the AppDomain with ID %4$d. The cause of the failure was: %5$s"
#define MDARC_INVALID_CONFIG_FILE_MSG \
L"The '%1$s' configuration file is invalid."
#define MDARC_CALLBACK_ON_COLLECTED_DELEGATE_MSG \
L"A callback was made on a garbage collected delegate of type '%1$s'. This may cause application " \
L"crashes, corruption and data loss. " \
L"When passing delegates to unmanaged code, they must be kept alive by the " \
L"managed application until it is guaranteed that they will never be called."
#define MDARC_INVALID_APT_STATE_CHANGE_SET_MSG \
L"An attempt was made to change the apartment state of the thread to %1$s, " \
L"but it has already been set to %2$s. When creating a new thread the apartment state should" \
L"be set before the thread is started. For the main thread of the application, the apartment" \
L"state can be set by specifying either [STAThreadAttribute] or [MTAThreadAttribute] on the" \
L"main method of the application. " \
L"If the application really needs to attempt to set the apartment state on a running thread, " \
L"Thread.TrySetApartmentState should be used and the return value should be consulted to determine " \
L"if the operation was successful. Note that Thread.TrySetApartmentState will not fire the " \
L"InvalidApartmentStateChange MDA."
#define MDARC_INVALID_APT_STATE_CHANGE_NOTSET_MSG \
L"The current thread used to have an apartment state of %1$s, but the application has CoUnitialized " \
L"this thread and it is now %2$s. This may cause calls on RuntimeCallableWrappers " \
L"representing some COM components to fail and may also cause COM component that are " \
L"not multi-threaded to be accessed from multiple threads at the same time which can cause " \
L"corruption or data loss."
#define MDARC_JIT_ATTACH_MSG \
L"%1$s Managed Debugging Assistant"
#define MDARC_LOADER_LOCK_MSG \
L"Attempting managed execution inside OS Loader lock. Do not " \
L"attempt to run managed code inside a DllMain or image initialization function since doing " \
L"so can cause the application to hang."
#define MDARC_LOADER_LOCK_DLL_MSG \
L"DLL '%1$s' is attempting managed execution inside OS Loader lock. Do not " \
L"attempt to run managed code inside a DllMain or image initialization function since doing " \
L"so can cause the application to hang."
#define MDARC_REENTRANCY_MSG \
L"Attempting to call into managed code without transitioning out first. Do not " \
L"attempt to run managed code inside low-level native extensibility points, such as the vectored " \
L"exception handler, since doing so can cause corruption and data loss."
#define MDARC_REPORT_AV_ON_COM_RELEASE_MSG \
L"An exception was caught but handled while releasing a COM interface pointer " \
L"through Marshal.Release, Marshal.ReleaseComObject or implicitly after the corresponding " \
L"RuntimeCallableWrapper was garbage collected. This is the result of a user " \
L"refcount error or other problem with a COM object's Release. Make sure " \
L"refcounts are managed properly. While these types of exceptions are caught by the CLR, " \
L"they can still lead to corruption and data loss so if possible the issue causing the exception " \
L"should be addressed"
#define MDARC_REPORT_AV_ON_COM_RELEASE_WITH_VTABLE_MSG \
L"An exception was caught but handled while releasing a COM interface pointer " \
L"through Marshal.Release or Marshal.ReleaseComObject or implicitly after the corresponding " \
L"RuntimeCallableWrapper was garbage collected. This is the result of a user " \
L"refcount error or other problem with a COM object's Release. Make sure " \
L"refcounts are managed properly. The COM interface pointer's original vtable " \
L"pointer was 0x%1$x. While these types of exceptions are caught by the CLR, " \
L"they can still lead to corruption and data loss so if possible the issue causing the exception " \
L"should be addressed"
#define MDARC_INVALID_VARIANT_MSG \
L"An invalid VARIANT was detected during a conversion from an unmanaged VARIANT " \
L"to a managed object. Passing invalid VARIANTs to the CLR can cause unexpected exceptions, " \
L"corruption or data loss."
#define MDARC_FAILED_QI_MSG \
L"The call to QI for interface '%1$s' with IID '%2$s' failed with HRESULT 0x%3$s (%4$s). " \
L"One likely reason this failed is that the object does not have a proxy/stub dll properly registered."
#define MDARC_DISCONNECTED_CONTEXT_1_MSG \
L"Transition into COM context 0x%1$x for this RuntimeCallableWrapper failed with the following error: " \
L"%2$s. " \
L"This is typically because the COM context 0x%1$x where this RuntimeCallableWrapper was created " \
L"has been disconnected or it is busy doing something else and cannot process the context transition. " \
L"No proxy will be used to service the request on the COM component and calls will be made to the " \
L"COM component directly. This may cause corruption or data loss. " \
L"To avoid this problem, please ensure that all COM contexts/apartments/threads stay alive and are " \
L"available for context transition, until the application is completely done with the " \
L"RuntimeCallableWrappers that represents COM components that live inside them."
#define MDARC_DISCONNECTED_CONTEXT_2_MSG \
L"Transition into COM context 0x%1$x for this RuntimeCallableWrapper failed with the following error: " \
L"%2$s. " \
L"This is typically because the COM context 0x%1$x where this RuntimeCallableWrapper was created " \
L"has been disconnected or it is busy doing something else. " \
L"Releasing the interfaces from the current COM context (COM context 0x%3$x). " \
L"This may cause corruption or data loss. " \
L"To avoid this problem, please ensure that all COM contexts/apartments/threads stay alive and are " \
L"available for context transition, until the application is completely done with the " \
L"RuntimeCallableWrappers that represents COM components that live inside them."
#define MDARC_NOTMARSHALABLE_MSG \
L"A non marshalable COM component is being used from a different apartment/context then the " \
L"one where it first entered the CLR. Since the component is non marshalable, it will be called directly " \
L"from the current apartment/context. This may cause corruption or data loss if the component does " \
L"not support being accessed from multiple threads at once. This is most likely caused by a faulty " \
L"IMarshal implementation on the part of the COM component."
#define MDARC_INVALID_IUNKNOWN_MSG \
L"An invalid IUnknown* was detected during a conversion from a COM component " \
L"to a managed object. Passing invalid IUnknown pointers to the CLR can cause unexpected " \
L"exceptions, corruption or data loss."
#define MDARC_CONTEXT_SWITCH_DEADLOCK_MSG \
L"The CLR has been unable to transition from COM context 0x%1$x to COM context 0x%2$x for 60 seconds. " \
L"The thread that owns the destination context/apartment is most likely either doing a non pumping wait " \
L"or processing a very long running operation without pumping Windows messages. " \
L"This situation generally has a negative performance impact and may even lead to " \
L"the application becoming non responsive or memory usage accumulating continually over time. " \
L"To avoid this problem, all single threaded apartment (STA) threads should use pumping wait " \
L"primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations."
#define MDARC_RCW_CLEANUP_RACE_MSG \
L"An attempt has been made to free an RCW that is in use. The RCW is in use on the active thread or " \
L"another thread. Attempting to free an in-use RCW can cause corruption or data loss."
#define MDARC_MARSHALING_METHOD_MSG \
L"Marshaling parameter with index %1$i and name '%2$s' from '%3$s' to '%4$s'"
#define MDARC_MARSHALING_FIELD_MSG \
L"Marshaling field '%1$s' from '%2$s' to '%3$s'"
#define MDARC_INVALID_FUNCTION_PTR_IN_DELEGATE_MSG \
L"Invalid function pointer 0x%1$x was passed into the runtime to be converted to a delegate. " \
L"Passing in invalid function pointers to be converted to delegates can cause crashes, " \
L"corruption or data loss. "
#define MDARC_DIRTY_CAST_AND_CALL_ON_INTERFACE_MSG \
L"The native component calling into the CLR through this ComCallWrapper has performed an " \
L"illegal cast on this IUnknown or IDispatch pointer. The caller neglected to call QueryInterface " \
L"for the correct interface before making this call."
#define MDARC_VTABLE_CALL_ON_AUTODISP_MEMBER_MSG \
L"An early bound call (vtable call) was made on the following member of an auto " \
L"dispatch class interface: '%1$s'. Early bound calls on members of auto dispatch " \
L"class interfaces are not allowed. Please consider using an explicit interface " \
L"as the default interface for the type. If a class interface must be " \
L"called early bound, change it to auto dual. This can be accomplished " \
L"by marking the class with the following attribute, located in the " \
L"System.Runtime.InteropServices namespace: " \
L"[ClassInterface(ClassInterfaceType.AutoDual)] " \
#define MDARC_INVALID_CER_CALL_MSG \
L"Method '%1$s', while executing within a constrained execution region, makes a call " \
L"at IL offset 0x%2$04X to '%3$s', which does not have a sufficiently strong reliability " \
L"contract and might cause non-deterministic results."
#define MDARC_VIRTUAL_CER_CALL_MSG \
L"Method '%1$s', while executing within a constrained execution region, makes a call " \
L"at IL offset 0x%2$04X to '%3$s', which is virtual and cannot be prepared automatically " \
L"at compile time. The caller must ensure this method is prepared explicitly at " \
L"runtime before entering the constrained execution region."
#define MDARC_OPENGENERIC_CER_CALL_MSG \
L"Method '%1$s', which contains at least one constrained execution region, cannot be " \
L"prepared automatically since it has one or more unbound generic type parameters. " \
L"The caller must ensure this method is prepared explicitly at runtime prior to " \
L"execution."
#define MDARC_ILLEGAL_PCR_MSG \
L"Method '%1$s' calls RuntimeHelpers.PrepareConstrainedRegions() at IL offset 0x%2$04X. " \
L"This is invalid since it does not coincide with the beginning of a try clause."
#define MDARC_MARSHALCLEANUPERROR_THREADCULTURE_MSG \
L"The CLR marshaler encountered an error while attempting to restore the thread culture after a call " \
L"from unmanaged to managed where an LCID was used to specify the culture for the call. This will " \
L"cause the thread's culture to remain set to the one associated with the LCID. The cause of the failure was: %1$s"
#define MDARC_MARSHALCLEANUPERROR_SAFEHANDLEPROP_MSG \
L"The CLR marshaler encountered an error while attempting to associate a SafeHandle with an unmanaged resource. " \
L"This may cause the unmanaged resource to be leaked. The cause of the failure was: %1$s"
#define MDARC_MARSHALCLEANUPERROR_CUSTOMCLEANUP_MSG \
L"An exception was thrown from the CleanupNativeData method of a custom marshaler of type '%1$s'. " \
L"This may cause an unmanaged data leak and should be corrected if possible. The cause of the failure was: %1$s"
#define MDARC_SAFEHANDLE_CRITICAL_FAILURE_MSG \
L"A SafeHandle or CriticalHandle of type '%1$s' failed to properly release the handle " \
L"with value 0x%2$p. This usually indicates that the handle was released incorrectly " \
L"via another means (such as extracting the handle using DangerousGetHandle and " \
L"closing it directly or building another SafeHandle around it.)"
#define MDARC_DLLMAIN_RETURNS_FALSE_MSG \
L"Function DllMain, called with reason DLL_PROCESS_ATTACH, returned FALSE. DLL initialization failed. " \
L"To ignore the DllMain return, set Registry value " \
L"HKEY_LOCAL_MACHINE\\Software\\Microsoft\\.NETFramework\\IgnoreDllMainReturn to 1"
#define MDARC_INVALID_MEMBER_DECLARATION_MSG \
L"The following error occurred while determining how to marshal the parameters of member '%1$s' of type '%2$s': " \
L"%3$s This is most likely due to an incompatible MarshalAs attribute on one of the parameters. "
#define MDARC_EXCEPTION_SWALLOWED_COM_TO_CLR_MSG \
L"A COM client has called managed method '%1$s' on type '%2$s'. This method does not have an HRESULT return type and " \
L"an exception was thrown that was not handled. The exception contains the following message: %3$s. " \
L"This exception will be caught and zero will be returned to the COM caller if the method's return " \
L"type is not void."
#define MDARC_ASYNCHRONOUS_THREADABORT_MSG \
L"User code running on thread %1$i has attempted to abort thread %2$i. This may result in a corrupt state " \
L"or resource leaks if the thread being aborted was in the middle of an operation that modifies global "\
L"state or uses native resources. Aborting threads other than the currently running thread is strongly "\
L"discouraged."
#define MDARC_DANGEROUS_THREADINGAPI_MSG \
L"User code has attempted to call the following API: '%1$s'. This may result in a deadlock in the process."
#define MDARC_NON_COMVISIBLE_BASE_CLASS_CLASSITF_MSG \
L"A QueryInterface call was made requesting the class interface of COM visible managed class '%1$s'. " \
L"However since this class derives from non COM visible class '%2$s', the QueryInterface call will fail. " \
L"This is done to prevent the non COM visible base class from being constrained by the COM versioning " \
L"rules."
#define MDARC_NON_COMVISIBLE_BASE_CLASS_IDISPATCH_MSG \
L"A QueryInterface call was made requesting the default IDispatch interface of COM visible managed " \
L"class '%1$s'. However since this class does not have an explicit default interface and derives from non "\
L"COM visible class '%2$s', the QueryInterface call will fail. This is done to prevent the non COM " \
L"visible base class from being constrained by the COM versioning rules."
#define MDARC_FATAL_EXECUTION_ENGINE_ERROR_MSG \
L"The runtime has encountered a fatal error. The address of the error was at 0x%1$08x, on thread 0x%2$x. "\
L"The error code is 0x%3$08x. This error may be a bug in the CLR or in the unsafe " \
L"or non-verifiable portions of user code. Common sources of this bug include user marshaling errors " \
L"for COM-interop or PInvoke, which may corrupt the stack." \
#define MDARC_INVALID_OVERLAPPED_TO_PINVOKE_MSG \
L"An overlapped pointer (0x%1$p) that was not allocated on the GC heap was passed via PInvoke to " \
L"the Win32 function '%2$s' in module '%3$s'. " \
L"If the AppDomain is shut down, this can cause heap corruption when the async I/O completes. " \
L"The best solution is to pass a NativeOverlapped structure retrieved from a call to " \
L"System.Threading.Overlapped.Pack(). If the AppDomain exits, the CLR will keep this structure " \
L"alive and pinned until the I/O completes."
#define MDARC_INVALID_OVERLAPPED_FREE_MSG \
L"An overlapped pointer (0x%1$p) may have been freed before the I/O operation completed. " \
L"Freeing an overlapped pointer before the I/O operation completes will cause GC heap corruption " \
L"when the I/O does complete. " \
L"Note that this MDA may not represent an error if the overlapped operation did not start successfully"
#define MDARC_DEBUGGER_FIBER_MODE_NOT_SUPPORTED_MSG \
L"A thread has entered fiber mode and therefore debugging must be stopped."
STRINGTABLE DISCARDABLE
BEGIN
MDARC_PINVOKE_SIGNATURE_MISMATCH MDARC_PINVOKE_SIGNATURE_MISMATCH_MSG
MDARC_LOAD_FROM_CONTEXT MDARC_LOAD_FROM_CONTEXT_MSG
MDARC_BINDING_FAILURE MDARC_BINDING_FAILURE_MSG
MDARC_INVALID_CONFIG_FILE MDARC_INVALID_CONFIG_FILE_MSG
MDARC_CALLBACK_ON_COLLECTED_DELEGATE MDARC_CALLBACK_ON_COLLECTED_DELEGATE_MSG
MDARC_INVALID_APT_STATE_CHANGE_SET MDARC_INVALID_APT_STATE_CHANGE_SET_MSG
MDARC_INVALID_APT_STATE_CHANGE_NOTSET MDARC_INVALID_APT_STATE_CHANGE_NOTSET_MSG
MDARC_LOADER_LOCK MDARC_LOADER_LOCK_MSG
MDARC_LOADER_LOCK_DLL MDARC_LOADER_LOCK_DLL_MSG
MDARC_JIT_ATTACH MDARC_JIT_ATTACH_MSG
MDARC_REENTRANCY MDARC_REENTRANCY_MSG
MDARC_ASYNCHRONOUS_THREADABORT MDARC_ASYNCHRONOUS_THREADABORT_MSG
MDARC_DANGEROUS_THREADINGAPI MDARC_DANGEROUS_THREADINGAPI_MSG
MDARC_REPORT_AV_ON_COM_RELEASE MDARC_REPORT_AV_ON_COM_RELEASE_MSG
MDARC_REPORT_AV_ON_COM_RELEASE_WITH_VTABLE MDARC_REPORT_AV_ON_COM_RELEASE_WITH_VTABLE_MSG
MDARC_INVALID_VARIANT MDARC_INVALID_VARIANT_MSG
MDARC_FAILED_QI MDARC_FAILED_QI_MSG
MDARC_DISCONNECTED_CONTEXT_1 MDARC_DISCONNECTED_CONTEXT_1_MSG
MDARC_DISCONNECTED_CONTEXT_2 MDARC_DISCONNECTED_CONTEXT_2_MSG
MDARC_NOTMARSHALABLE MDARC_NOTMARSHALABLE_MSG
MDARC_MARSHALCLEANUPERROR_THREADCULTURE MDARC_MARSHALCLEANUPERROR_THREADCULTURE_MSG
MDARC_MARSHALCLEANUPERROR_SAFEHANDLEPROP MDARC_MARSHALCLEANUPERROR_SAFEHANDLEPROP_MSG
MDARC_MARSHALCLEANUPERROR_CUSTOMCLEANUP MDARC_MARSHALCLEANUPERROR_CUSTOMCLEANUP_MSG
MDARC_INVALID_IUNKNOWN MDARC_INVALID_IUNKNOWN_MSG
MDARC_CONTEXT_SWITCH_DEADLOCK MDARC_CONTEXT_SWITCH_DEADLOCK_MSG
MDARC_RCW_CLEANUP_RACE MDARC_RCW_CLEANUP_RACE_MSG
MDARC_INVALID_FUNCTION_PTR_IN_DELEGATE MDARC_INVALID_FUNCTION_PTR_IN_DELEGATE_MSG
MDARC_DIRTY_CAST_AND_CALL_ON_INTERFACE MDARC_DIRTY_CAST_AND_CALL_ON_INTERFACE_MSG
MDARC_VTABLE_CALL_ON_AUTODISP_MEMBER MDARC_VTABLE_CALL_ON_AUTODISP_MEMBER_MSG
MDARC_INVALID_CER_CALL MDARC_INVALID_CER_CALL_MSG
MDARC_VIRTUAL_CER_CALL MDARC_VIRTUAL_CER_CALL_MSG
MDARC_OPENGENERIC_CER_CALL MDARC_OPENGENERIC_CER_CALL_MSG
MDARC_ILLEGAL_PCR MDARC_ILLEGAL_PCR_MSG
MDARC_SAFEHANDLE_CRITICAL_FAILURE MDARC_SAFEHANDLE_CRITICAL_FAILURE_MSG
MDARC_DLLMAIN_RETURNS_FALSE MDARC_DLLMAIN_RETURNS_FALSE_MSG
MDARC_INVALID_MEMBER_DECLARATION MDARC_INVALID_MEMBER_DECLARATION_MSG
MDARC_EXCEPTION_SWALLOWED_COM_TO_CLR MDARC_EXCEPTION_SWALLOWED_COM_TO_CLR_MSG
MDARC_NON_COMVISIBLE_BASE_CLASS_CLASSITF MDARC_NON_COMVISIBLE_BASE_CLASS_CLASSITF_MSG
MDARC_NON_COMVISIBLE_BASE_CLASS_IDISPATCH MDARC_NON_COMVISIBLE_BASE_CLASS_IDISPATCH_MSG
MDARC_PINVOKE_LOG MDARC_PINVOKE_LOG_MSG
MDARC_FATAL_EXECUTION_ENGINE_ERROR MDARC_FATAL_EXECUTION_ENGINE_ERROR_MSG
MDARC_INVALID_OVERLAPPED_TO_PINVOKE MDARC_INVALID_OVERLAPPED_TO_PINVOKE_MSG
MDARC_INVALID_OVERLAPPED_FREE MDARC_INVALID_OVERLAPPED_FREE_MSG
MDARC_DEBUGGER_FIBER_MODE_NOT_SUPPORTED MDARC_DEBUGGER_FIBER_MODE_NOT_SUPPORTED_MSG
MDARC_BINDING_FAILURE_CODEBASE_ONLY MDARC_BINDING_FAILURE_CODEBASE_ONLY_MSG
MDARC_BINDING_FAILURE_DISPLAYNAME_ONLY MDARC_BINDING_FAILURE_DISPLAYNAME_ONLY_MSG
MDARC_MARSHALING_METHOD MDARC_MARSHALING_METHOD_MSG
MDARC_MARSHALING_FIELD MDARC_MARSHALING_FIELD_MSG
MDARC_MARSHALING_RETURN_VALUE_NAME "return value"
MDARC_MARSHALING_UNKNOWN_PARAM_NAME "unknown"
END
STRINGTABLE DISCARDABLE
@ -528,8 +211,6 @@ BEGIN
IDS_EE_NOTNDIRECT "Not a PInvoke method."
IDS_EE_ERRORTITLE "Error"
IDS_EE_ERRORMESSAGETEMPLATE "Error 0x%08x.\n\n%s."
IDS_EE_TWO_LOADED_MSCOREE_TITLE "MSCOREE.DLL load error."
IDS_EE_TWO_LOADED_MSCOREE_MSG "Two different copies of MSCORWKS.DLL have been loaded.\n\nFirst copy:\n%s\n\nSecond copy:\n%s\n\nThis is typically caused by having a registered MSCOREE.DLL that is different\nfrom the one that is statically linked with the application."
IDS_EE_RETHROW_NOT_ALLOWED "No exception available to rethrow."
IDS_EE_INVALID_OLE_VARIANT "Specified OLE variant is invalid."
IDS_EE_TO_MANY_ARGUMENTS_IN_MAIN "Signature for the entry point has too many arguments."
@ -622,8 +303,6 @@ BEGIN
IDS_EE_BADMARSHAL_CRITICALHANDLENATIVETOCOM "CriticalHandles cannot be marshaled from unmanaged to managed."
IDS_EE_BADMARSHAL_ABSTRACTOUTCRITICALHANDLE "Ref and out CriticalHandle parameters cannot be abstract."
IDS_EE_BADMARSHAL_ABSTRACTRETCRITICALHANDLE "Returned CriticalHandles cannot be abstract."
IDS_EE_BADMARSHAL_NOTMARSHALABLE "The type definition of this field has layout information but has an invalid managed/unmanaged type combination or is unmarshalable."
IDS_EE_BADMARSHAL_BADMETADATA "Invalid marshaling metadata."
IDS_EE_BADMARSHAL_CUSTOMMARSHALER "Custom marshalers are only allowed on classes, strings, arrays, and boxed value types."
IDS_EE_BADMARSHAL_GENERICS_RESTRICTION "Non-blittable generic types cannot be marshaled."
IDS_EE_BADMARSHAL_STRING_OUT "Cannot marshal a string by-value with the [Out] attribute."
@ -632,16 +311,13 @@ BEGIN
IDS_EE_BADMARSHALPARAM_NO_LPTSTR "Invalid managed/unmanaged type combination (Strings cannot be paired with LPTStr for parameters and return types of methods in interfaces exposed to COM)."
IDS_EE_BADMARSHALFIELD_NOCUSTOMMARSH "Custom marshalers cannot be used on fields of structures."
IDS_EE_BADMARSHALFIELD_FIXEDARRAY_NOSIZE "Fixed sized array fields inside structures must have the MarshalAs SizeConst field set to the size of the array."
IDS_EE_BADMARSHALFIELD_FIXEDARRAY_ZEROSIZE "Fixed sized array fields cannot have a SizeConst of zero."
IDS_EE_BADMARSHALFIELD_LAYOUTCLASS "Invalid managed/unmanaged type combination (Classes with layout fields must be paired with Struct or Interface)."
IDS_EE_BADMARSHALFIELD_NOSTRINGBUILDER "Struct or class fields cannot be of type StringBuilder. The same effect can usually be achieved by using a String field and preinitializing it to a string with length matching the length of the appropriate buffer."
IDS_EE_BADMARSHALFIELD_ZEROLENGTHFIXEDSTRING "The length for ByValTStr strings cannot be zero."
#ifdef FEATURE_COMINTEROP
IDS_EE_BADMARSHALFIELD_NULL_HSTRING "Null strings may not be marshaled in Windows Runtime fields."
IDS_EE_BADMARSHALARRAY_NULL_HSTRING "Null strings may not be marshaled in Windows Runtime arrays. Null string was encountered at index %1."
IDS_EE_BADMARSHAL_NULLABLE_RESTRICTION "Given Windows.Foundation.IReference can not be converted to System.Nullable type. Type arguments can't be empty, string or non-value types. "
#endif // FEATURE_COMINTEROP
// For ManagedToNativeComInteropStubAttribute
@ -672,10 +348,6 @@ BEGIN
IDS_EE_INTEROP_CODE_SIZE_COMMENT "Code size"
IDS_EE_ADUNLOAD_IN_FINALIZER "AppDomain cannot be unloaded during object finalization."
IDS_EE_ADUNLOAD_DEFAULT "The default domain cannot be unloaded."
IDS_EE_ADUNLOAD_CANT_UNWIND_THREAD "AppDomain cannot be unloaded because the thread '%1' cannot be unwound out of it."
IDS_CLASSLOAD_TYPEWRONGNUMGENERICARGS "The generic type '%1' was used with the wrong number of generic arguments in assembly '%2'."
IDS_CLASSLOAD_INVALIDINSTANTIATION "The generic type '%1' was used with an invalid instantiation in assembly '%2'."
IDS_CLASSLOAD_VARIANCE_IN_METHOD_ARG "Could not load type '%1' from assembly '%2' because a covariant or contravariant type parameter was used illegally in the signature for an argument in method '%3'."
@ -762,7 +434,6 @@ BEGIN
IDS_INVALID_REDIM "Illegal attempt to replace or redimension a fixed or locked SafeArray."
IDS_INVALID_PINVOKE_CALLCONV "Invalid unmanaged calling convention: must be one of stdcall, cdecl, or thiscall."
IDS_NOLAYOUT_IN_EMBEDDED_VALUECLASS "Type could not be marshaled because an embedded valuetype has no layout information."
IDS_CLASSLOAD_NSTRUCT_EXPLICIT_OFFSET "Could not load type '%1' from assembly '%2' because field '%3' was not given an explicit offset."
IDS_WRONGSIZEARRAY_IN_NSTRUCT "Type could not be marshaled because the length of an embedded array instance does not match the declared length in the layout."
@ -793,11 +464,9 @@ BEGIN
// Errors associated with parsing security custom attributes at compile time.
CORSECATTR_E_BAD_ACTION "Security custom attribute has invalid SecurityAction."
IDS_EE_COPY_OUTOFRANGE "Requested range extends past the end of the array."
IDS_EE_NOCUSTOMMARSHALER "A call to GetInstance() for custom marshaler '%1' returned null, which is not allowed."
IDS_EE_SIZECONTROLOUTOFRANGE "Array size control parameter index is out of range."
IDS_EE_SIZECONTROLBADTYPE "Array size control parameter type not supported."
IDS_EE_DUPLICATE_DECLSEC "Multiple permission sets specified with the same SecurityAction."
IDS_EE_SAFEARRAYSZARRAYMISMATCH "SafeArray cannot be marshaled to this array type because it has either nonzero lower bounds or more than one dimension."
IDS_EE_WINRT_LOADFAILURE "Could not find Windows Runtime type '%1'."
@ -848,8 +517,6 @@ BEGIN
IDS_EE_ARRAY_DIMENSIONS_EXCEEDED "Array dimensions exceeded supported range."
IDS_EE_PROFILING_FAILURE "Profiling failure"
IDS_EE_THREAD_NOTSTARTED "Thread has not been started."
IDS_EE_STRING_TOOLONG "Marshaler restriction: Excessively long string."
@ -867,12 +534,9 @@ BEGIN
IDS_EE_THREAD_BAD_STATE "Thread in invalid state."
IDS_EE_THREAD_ABORT_WHILE_SUSPEND "Thread is suspended; attempting to abort."
IDS_EE_NOVARIANTRETURN "PInvoke restriction: cannot return variants."
IDS_EE_THREAD_DEADLOCK_VICTIM "The current thread has been chosen as a deadlock victim."
IDS_EE_PATH_TOO_LONG "The path is too long after being fully qualified. Make sure the full path is less than 260 characters and the directory name is less than 248 characters."
IDS_EE_INVALID_SAFEARRAY "Specified SAFEARRAY is invalid."
IDS_EE_METHOD_NOT_FOUND_ON_EV_PROV "Method '%1' of COM event interface '%2' is not present on event provider '%3'."
IDS_EE_BAD_COMEVENTITF_CLASS "Methods on COM event interfaces must take a single delegate derived class as a parameter and have a void return type."
@ -889,11 +553,8 @@ BEGIN
IDS_EE_SAFEHANDLECLOSED "Safe handle has been closed"
IDS_EE_SAFEHANDLECANNOTSETHANDLE "Safe handle's handle field can only be set if the safe handle is not closed and has a ref count of 1."
IDS_EE_SH_FIELD_INVALID_OPERATION "Structures containing SafeHandle fields are not allowed in this operation."
IDS_EE_CANNOT_CREATE_SAFEHANDLE_FIELD "SafeHandle fields cannot be created from an unmanaged handle."
IDS_EE_SH_IN_VARIANT_NOT_SUPPORTED "SafeHandle derived types cannot be stored in Variants."
IDS_EE_CANNOT_CREATE_CRITICALHANDLE_FIELD "CriticalHandle fields cannot be created from an unmanaged handle."
IDS_EE_CH_IN_VARIANT_NOT_SUPPORTED "CriticalHandle derived types cannot be stored in Variants."
IDS_EE_VAR_WRAP_IN_VAR_NOT_SUPPORTED "VariantWrappers cannot be stored in Variants."
@ -963,8 +624,6 @@ END
STRINGTABLE DISCARDABLE
BEGIN
IDS_COMPLUS_ERROR "CLR error: %lx.\n The program will now terminate."
IDS_FATAL_ERROR "Fatal error"
IDS_ERROR "Error"
IDS_DEBUG_UNHANDLEDEXCEPTION_IPC "INTERNAL ERROR:\n\nUnhandled exception in Debugger::HandleIPCEvent.\n\nEvent ID=0x%x.\n\nException code=0x%08x, Eip=0x%08x.\n\nProcess ID=0x%x (%d), Thread ID=0x%x (%d).\n\n"
@ -1103,15 +762,8 @@ BEGIN
IDS_E_PROF_INIT_CALLBACK_FAILED "Loading profiler failed. The profiler COM object was instantiated, but the profiler failed during its initialization callback. Profiler CLSID: '%s'. HRESULT: 0x%x."
IDS_PROF_SUPPLEMENTARY_INFO "Process ID (decimal): %d. Message ID: [0x%x]."
IDS_PROF_LOAD_COMPLETE "The profiler was loaded successfully. Profiler CLSID: '%s'."
IDS_E_PROF_ATTACH_INIT "There was a failure initializing profiling API attach infrastructure. This process will not allow a profiler to attach. HRESULT: 0x%x."
IDS_E_PROF_ATTACHTHREAD_INIT "Loading profiler failed. Failed creating interprocess communication infrastructure. HRESULT: 0x%x."
IDS_E_PROF_CONNECT_TO_TRIGGER "Loading profiler failed. Unable to connect to the process that is trying to request the attach. HRESULT: 0x%x."
IDS_E_PROF_NO_ATTACH_REQ "Loading profiler failed. The inter-process communication mechanism was initialized, but an attach request was not received. HRESULT: 0x%x."
IDS_E_PROF_PIPE_RCV "Loading profiler failed. Failed trying to receive from out of process a request to attach a profiler. HRESULT: 0x%x."
IDS_E_PROF_NOT_ATTACHABLE "Loading profiler failed. The profiler COM object was instantiated, but the profiler does not support attaching to a live process. The profiler must be loaded at application startup by using a launcher program included with the profiler (if any) or by setting the COR_ENABLE_PROFILING and COR_PROFILER environment variables before launching the application to be profiled. Profiler CLSID: '%s'"
IDS_E_PROF_UNHANDLED_EXCEPTION_ON_LOAD "Loading profiler failed. There was an unhandled exception while trying to instantiate the profiler COM object. Please ensure the CLSID is associated with a valid profiler designed to work with this version of the runtime. Profiler CLSID: '%s'."
IDS_E_PROF_INVALID_MSG "Loading profiler failed. Received an improperly formatted attach request."
IDS_E_PROF_PROFILER_ALREADY_ACTIVE "Loading profiler failed. A profiler is already loaded, so the request to attach another profiler was denied."
IDS_PROF_ATTACH_REQUEST_RECEIVED "The CLR received a request to attach a profiler. Profiler CLSID: '%s'."
IDS_PROF_DETACH_INITIATED "The profiler currently in use has requested to be detached from the process. The CLR has disabled communication with the profiler and will unload the profiler when it is safe to do so."
IDS_PROF_DETACH_COMPLETE "The CLR has fully detached and unloaded the profiler."

View File

@ -25,57 +25,7 @@
// Resource strings for MDA descriptions.
//-----------------------------------------------------------------------------
#define MDARC_PINVOKE_SIGNATURE_MISMATCH 0x1901
#define MDARC_INVALID_CONFIG_FILE 0x1902
#define MDARC_CALLBACK_ON_COLLECTED_DELEGATE 0x1903
#define MDARC_INVALID_APT_STATE_CHANGE_SET 0x1904
#define MDARC_INVALID_APT_STATE_CHANGE_NOTSET 0x1905
#define MDARC_LOADER_LOCK 0x1906
#define MDARC_REPORT_AV_ON_COM_RELEASE 0x1907
#define MDARC_INVALID_VARIANT 0x1908
#define MDARC_FAILED_QI 0x1909
#define MDARC_DISCONNECTED_CONTEXT_1 0x190A
#define MDARC_DISCONNECTED_CONTEXT_2 0x190B
#define MDARC_NOTMARSHALABLE 0x190C
#define MDARC_INVALID_IUNKNOWN 0x190D
#define MDARC_MARSHALING_METHOD 0x190E
#define MDARC_INVALID_FUNCTION_PTR_IN_DELEGATE 0x190F
#define MDARC_VTABLE_CALL_ON_AUTODISP_MEMBER 0x1910
#define MDARC_INVALID_CER_CALL 0x1911
#define MDARC_VIRTUAL_CER_CALL 0x1912
#define MDARC_OPENGENERIC_CER_CALL 0x1913
#define MDARC_ILLEGAL_PCR 0x1914
#define MDARC_MARSHALCLEANUPERROR_THREADCULTURE 0x1915
#define MDARC_MARSHALCLEANUPERROR_SAFEHANDLEPROP 0x1917
#define MDARC_MARSHALCLEANUPERROR_CUSTOMCLEANUP 0x1918
#define MDARC_SAFEHANDLE_CRITICAL_FAILURE 0x1919
#define MDARC_DLLMAIN_RETURNS_FALSE 0x191A
#define MDARC_DOCUMENTATION 0x191E
#define MDARC_ASYNCHRONOUS_THREADABORT 0x191F
#define MDARC_LOAD_FROM_CONTEXT 0x1920
#define MDARC_CONTEXT_SWITCH_DEADLOCK 0x1921
#define MDARC_RCW_CLEANUP_RACE 0x1923
#define MDARC_INVALID_MEMBER_DECLARATION 0x1925
#define MDARC_EXCEPTION_SWALLOWED_COM_TO_CLR 0x1926
#define MDARC_REENTRANCY 0x1928
#define MDARC_NON_COMVISIBLE_BASE_CLASS_CLASSITF 0x1929
#define MDARC_NON_COMVISIBLE_BASE_CLASS_IDISPATCH 0x192A
#define MDARC_BINDING_FAILURE 0x192B
#define MDARC_REPORT_AV_ON_COM_RELEASE_WITH_VTABLE 0x192D
#define MDARC_PINVOKE_LOG 0x192E
#define MDARC_FATAL_EXECUTION_ENGINE_ERROR 0x192F
#define MDARC_DANGEROUS_THREADINGAPI 0x1930
#define MDARC_INVALID_OVERLAPPED_TO_PINVOKE 0x1931
#define MDARC_INVALID_OVERLAPPED_FREE 0x1932
#define MDARC_DIRTY_CAST_AND_CALL_ON_INTERFACE 0x1933
#define MDARC_DEBUGGER_FIBER_MODE_NOT_SUPPORTED 0x1934
#define MDARC_BINDING_FAILURE_CODEBASE_ONLY 0x1935
#define MDARC_BINDING_FAILURE_DISPLAYNAME_ONLY 0x1936
#define MDARC_MARSHALING_FIELD 0x1937
#define MDARC_MARSHALING_RETURN_VALUE_NAME 0x1938
#define MDARC_MARSHALING_UNKNOWN_PARAM_NAME 0x1939
#define MDARC_LOADER_LOCK_DLL 0x193A
#define MDARC_JIT_ATTACH 0x193B
#define IDS_RTL 0x01F5
@ -99,13 +49,9 @@
#define IDS_EE_COM_UNSUPPORTED_TYPE 0x1713
#define IDS_EE_NOTNDIRECT 0x1719
#define IDS_EE_TWO_LOADED_MSCOREE_TITLE 0x171a
#define IDS_EE_TWO_LOADED_MSCOREE_MSG 0x171b
#define IDS_EE_RETHROW_NOT_ALLOWED 0x171d
#define IDS_EE_INVALID_OLE_VARIANT 0x171e
#define IDS_EE_ADUNLOAD_DEFAULT 0x171f
#define IDS_EE_FILE_NOT_FOUND 0x80070002
#define IDS_EE_PATH_TOO_LONG 0x8007006F
#define IDS_EE_PROC_NOT_FOUND 0x8007007F
@ -125,15 +71,12 @@
#define IDS_EE_BADMARSHALFIELD_STRING 0x1727
#define IDS_EE_BADMARSHALFIELD_NOCUSTOMMARSH 0x1728
#define IDS_EE_BADMARSHALFIELD_FIXEDARRAY_NOSIZE 0x1729
#define IDS_EE_BADMARSHALFIELD_FIXEDARRAY_ZEROSIZE 0x172a
#define IDS_EE_BADMARSHALFIELD_LAYOUTCLASS 0x172b
#define IDS_EE_BADMARSHALFIELD_ARRAY 0x172c
#define IDS_EE_BADMARSHALPARAM_NO_LPTSTR 0x172d
#define IDS_EE_BADMARSHAL_NOTMARSHALABLE 0x1730
#define IDS_EE_SAFEARRAYTYPEMISMATCH 0x1738
#define IDS_EE_SAFEARRAYRANKMISMATCH 0x1739
#define IDS_EE_BADMARSHAL_GENERIC 0x173a
@ -173,8 +116,6 @@
#define IDS_EE_BADMARSHAL_HANDLEREFRESTRICTION 0x1766
#define IDS_EE_ADUNLOAD_NOT_ALLOWED 0x1767
#define IDS_EE_ADUNLOAD_IN_FINALIZER 0x1768
#define IDS_EE_ADUNLOAD_CANT_UNWIND_THREAD 0x1769
#define IDS_CANNOT_MARSHAL 0x1770
#define IDS_CANNOT_MARSHAL_RECURSIVE_DEF 0x1771
@ -228,8 +169,6 @@
#define IDS_CLASSLOAD_MI_MISSING_SIG_DECL 0x17a7
#define IDS_CLASSLOAD_TOOMANYGENERICARGS 0x17ab
#define IDS_COMPLUS_ERROR 0x17ae
#define IDS_FATAL_ERROR 0x17af
#define IDS_ERROR 0x17b0
#define IDS_DEBUG_SERVICE_CAPTION 0x17b4
#define IDS_DEBUG_USERBREAKPOINT 0x17b6
@ -245,7 +184,6 @@
#define IDS_INVALID_REDIM 0x17c3
#define IDS_INVALID_PINVOKE_CALLCONV 0x17c4
#define IDS_NOLAYOUT_IN_EMBEDDED_VALUECLASS 0x17c5
#define IDS_CLASSLOAD_NSTRUCT_EXPLICIT_OFFSET 0x17c7
#define IDS_EE_BADPINVOKEFIELD_NOTMARSHALABLE 0x17c9
#define IDS_WRONGSIZEARRAY_IN_NSTRUCT 0x17ca
@ -267,12 +205,9 @@
#define IDS_EE_CANNOTCAST 0x17e0
#define IDS_EE_NOTISOMORPHIC 0x17e1
#define IDS_EE_COPY_OUTOFRANGE 0x17e3
#define IDS_EE_NOCUSTOMMARSHALER 0x17e7
#define IDS_EE_SIZECONTROLOUTOFRANGE 0x17e8
#define IDS_EE_SIZECONTROLBADTYPE 0x17e9
#define IDS_EE_DUPLICATE_DECLSEC 0x17ea
#define IDS_EE_SAFEARRAYSZARRAYMISMATCH 0x17eb
#define IDS_EE_INVALID_VT_FOR_CUSTOM_MARHALER 0x17ec
#define IDS_EE_BAD_COMEXTENDS_CLASS 0x17ed
@ -313,7 +248,6 @@
#define IDS_EE_THREADSTART_STATE 0x1a12
#define IDS_EE_THREAD_DEADLOCK_VICTIM 0x1a14
#define IDS_EE_THREAD_CANNOT_GET 0x1a15
#define IDS_EE_THREAD_DEAD_PRIORITY 0x1a19
#define IDS_EE_THREAD_DEAD_STATE 0x1a1a
@ -322,8 +256,6 @@
#define IDS_EE_NOVARIANTRETURN 0x1a1d
#define IDS_EE_INVALID_SAFEARRAY 0x1a23
#define IDS_EE_METHOD_NOT_FOUND_ON_EV_PROV 0x1a24
#define IDS_EE_BAD_COMEVENTITF_CLASS 0x1a25
@ -344,7 +276,6 @@
#define IDS_EE_MARSHAL_UNMAPPABLE_CHAR 0x1a37
#define IDS_EE_BADMARSHAL_BADMETADATA 0x1a39
#define IDS_EE_BADMARSHAL_SAFEHANDLENATIVETOCOM 0x1a3a
#define IDS_EE_BADMARSHAL_ABSTRACTOUTSAFEHANDLE 0x1a3b
#define IDS_EE_BADMARSHAL_RETURNSHCOMTONATIVE 0x1a3c
@ -352,8 +283,6 @@
#define IDS_EE_SAFEHANDLECLOSED 0x1a3f
#define IDS_EE_SAFEHANDLECANNOTSETHANDLE 0x1a40
#define IDS_EE_SH_FIELD_INVALID_OPERATION 0x1a41
#define IDS_EE_CANNOT_CREATE_SAFEHANDLE_FIELD 0x1a42
#define IDS_EE_BADMARSHAL_ABSTRACTRETSAFEHANDLE 0x1a44
#define IDS_EE_SH_IN_VARIANT_NOT_SUPPORTED 0x1a47
@ -377,8 +306,6 @@
#define IDS_EE_BADMARSHAL_RETURNCHCOMTONATIVE 0x1a64
#define IDS_EE_BADMARSHAL_CRITICALHANDLE 0x1a65
#define IDS_EE_CANNOT_CREATE_CRITICALHANDLE_FIELD 0x1a69
#define IDS_EE_BADMARSHAL_ABSTRACTRETCRITICALHANDLE 0x1a6a
#define IDS_EE_CH_IN_VARIANT_NOT_SUPPORTED 0x1a6b
@ -437,7 +364,6 @@
#define IDS_EE_THREAD_INTERRUPTED 0x1aa5
#define IDS_EE_OUT_OF_MEMORY 0x1aa6
#define IDS_EE_PROFILING_FAILURE 0x1aa8
#define IDS_EE_ATTEMPT_TO_CREATE_GENERIC_CCW 0x1aa9
#define IDS_EE_ATTEMPT_TO_CREATE_NON_ABSTRACT_CCW 0x1aaa
#define IDS_EE_COMIMPORT_METHOD_NO_INTERFACE 0x1aab
@ -625,15 +551,8 @@
#define IDS_PROF_SUPPLEMENTARY_INFO 0x2506
#define IDS_PROF_LOAD_COMPLETE 0x2507
#define IDS_E_PROF_BAD_PATH 0x2508
#define IDS_E_PROF_ATTACH_INIT 0x2509
#define IDS_E_PROF_ATTACHTHREAD_INIT 0x250A
#define IDS_E_PROF_CONNECT_TO_TRIGGER 0x250B
#define IDS_E_PROF_NO_ATTACH_REQ 0x250C
#define IDS_E_PROF_PIPE_RCV 0x250D
#define IDS_E_PROF_NOT_ATTACHABLE 0x250E
#define IDS_E_PROF_UNHANDLED_EXCEPTION_ON_LOAD 0x250F
#define IDS_E_PROF_INVALID_MSG 0x2510
#define IDS_E_PROF_PROFILER_ALREADY_ACTIVE 0x2511
#define IDS_PROF_ATTACH_REQUEST_RECEIVED 0x2512
#define IDS_PROF_DETACH_INITIATED 0x2513
#define IDS_PROF_DETACH_COMPLETE 0x2514
@ -653,7 +572,6 @@
#define IDS_EE_LINK_FOR_DEBUGGING_MESSAGES 0x2601
#ifdef FEATURE_COMINTEROP
#define IDS_EE_BADMARSHALFIELD_NULL_HSTRING 0x2605
#define IDS_EE_BADMARSHAL_WINRT_MARSHAL_AS 0x2606
#define IDS_EE_BADMARSHALARRAY_NULL_HSTRING 0x2607
#define IDS_EE_BADMARSHAL_WINRT_ILLEGAL_TYPE 0x2608

View File

@ -2825,8 +2825,6 @@ BOOL gc_heap::bgc_thread_running;
CLRCriticalSection gc_heap::bgc_threads_timeout_cs;
GCEvent gc_heap::gc_lh_block_event;
#endif //BACKGROUND_GC
#ifdef MARK_LIST
@ -16542,8 +16540,6 @@ void gc_heap::init_background_gc ()
background_saved_lowest_address,
background_saved_highest_address));
}
gc_lh_block_event.Reset();
}
#endif //BACKGROUND_GC
@ -28352,36 +28348,18 @@ cleanup:
BOOL gc_heap::create_bgc_thread_support()
{
BOOL ret = FALSE;
uint8_t** parr;
if (!gc_lh_block_event.CreateManualEventNoThrow(FALSE))
{
goto cleanup;
}
//needs to have room for enough smallest objects fitting on a page
parr = new (nothrow) uint8_t*[1 + OS_PAGE_SIZE / MIN_OBJECT_SIZE];
if (!parr)
{
goto cleanup;
return FALSE;
}
make_c_mark_list (parr);
ret = TRUE;
cleanup:
if (!ret)
{
if (gc_lh_block_event.IsValid())
{
gc_lh_block_event.CloseEvent();
}
}
return ret;
return TRUE;
}
int gc_heap::check_for_ephemeral_alloc()
@ -28466,7 +28444,6 @@ void gc_heap::kill_gc_thread()
// In the secodn stage, we have the Loader lock and only one thread is
// alive. Hence we do not need to kill gc thread.
background_gc_done_event.CloseEvent();
gc_lh_block_event.CloseEvent();
bgc_start_event.CloseEvent();
bgc_threads_timeout_cs.Destroy();
bgc_thread = 0;
@ -34152,10 +34129,6 @@ void gc_heap::background_sweep()
//block concurrent allocation for large objects
dprintf (3, ("lh state: planning"));
if (gc_lh_block_event.IsValid())
{
gc_lh_block_event.Reset();
}
for (int i = 0; i <= (max_generation + 1); i++)
{
@ -34519,11 +34492,6 @@ void gc_heap::background_sweep()
disable_preemptive (true);
if (gc_lh_block_event.IsValid())
{
gc_lh_block_event.Set();
}
add_saved_spinlock_info (true, me_release, mt_bgc_loh_sweep);
leave_spin_lock (&more_space_lock_loh);

View File

@ -397,17 +397,6 @@ uint32_t gc_heap::background_gc_wait (alloc_wait_reason awr, int time_out_ms)
return dwRet;
}
// Wait for background gc to finish sweeping large objects
void gc_heap::background_gc_wait_lh (alloc_wait_reason awr)
{
dprintf(2, ("Waiting end of background large sweep"));
assert (gc_lh_block_event.IsValid());
fire_alloc_wait_event_begin (awr);
user_thread_wait (&gc_lh_block_event, FALSE);
fire_alloc_wait_event_end (awr);
dprintf(2, ("Waiting end of background large sweep is done"));
}
#endif //BACKGROUND_GC

View File

@ -3113,8 +3113,6 @@ protected:
PER_HEAP_ISOLATED
void fire_alloc_wait_event_end (alloc_wait_reason awr);
PER_HEAP
void background_gc_wait_lh (alloc_wait_reason awr = awr_ignored);
PER_HEAP
uint32_t background_gc_wait (alloc_wait_reason awr = awr_ignored, int time_out_ms = INFINITE);
PER_HEAP_ISOLATED
void start_c_gc();
@ -3665,9 +3663,6 @@ protected:
PER_HEAP_ISOLATED
GCEvent ee_proceed_event;
PER_HEAP
GCEvent gc_lh_block_event;
PER_HEAP_ISOLATED
bool gc_can_use_concurrent;

View File

@ -198,7 +198,7 @@ enum GeneralProfilingDataFlags
enum BlobType
{
/* IMPORTANT: Keep the first four enums together in the same order and at
the very begining of this enum. See MetaModelPub.h for the order */
the very beginning of this enum. See MetaModelPub.h for the order */
MetadataStringPool = 0,
MetadataGuidPool = 1,
MetadataBlobPool = 2,
@ -208,7 +208,7 @@ enum BlobType
LastMetadataPool = 3,
// SectionFormat only supports tokens, which have to already exist in the module.
// For instantiated paramterized types, there may be no corresponding token
// For instantiated parameterized types, there may be no corresponding token
// in the module, if a dependent module caused the type to be instantiated.
// For such instantiated types, we save a blob/signature to identify the type.
//
@ -452,9 +452,9 @@ struct CORBBTPROF_METHOD_HEADER_V1
struct CORBBTPROF_METHOD_HEADER
{
DWORD size; // Size to skip to get to the next CORBBTPROF_METHOD_HEADER
DWORD cDetail; // the count of CORBBTPROF_METHOD_DETAIL_HEADER records that folow this record
DWORD cDetail; // the count of CORBBTPROF_METHOD_DETAIL_HEADER records that follow this record
CORBBTPROF_METHOD_INFO method; // Basic block execution counts for a method
// ... followed by 'cDetail' occurances of CORBBTPROF_METHOD_DETAIL_HEADER
// ... followed by 'cDetail' occurrences of CORBBTPROF_METHOD_DETAIL_HEADER
size_t Size()
{

View File

@ -51,19 +51,19 @@ token validation.
First of all class contruction comes in two flavors precise and 'beforeFieldInit'. In C# you get the former
if you declare an explicit class constructor method and the later if you declaratively initialize static
fields. Precise class construction guarentees that the .cctor is run precisely before the first access to any
method or field of the class. 'beforeFieldInit' semantics guarentees only that the .cctor will be run some
time before the first static field access (note that calling methods (static or insance) or accessing
fields. Precise class construction guarantees that the .cctor is run precisely before the first access to any
method or field of the class. 'beforeFieldInit' semantics guarantees only that the .cctor will be run some
time before the first static field access (note that calling methods (static or instance) or accessing
instance fields does not cause .cctors to be run).
Next you need to know that there are two kinds of code generation that can happen in the JIT: appdomain
neutral and appdomain specialized. The difference between these two kinds of code is how statics are handled.
For appdomain specific code, the address of a particular static variable is embeded in the code. This makes
For appdomain specific code, the address of a particular static variable is embedded in the code. This makes
it usable only for one appdomain (since every appdomain gets a own copy of its statics). Appdomain neutral
code calls a helper that looks up static variables off of a thread local variable. Thus the same code can be
used by mulitple appdomains in the same process.
used by multiple appdomains in the same process.
Generics also introduce a similar issue. Code for generic classes might be specialised for a particular set
Generics also introduce a similar issue. Code for generic classes might be specialized for a particular set
of type arguments, or it could use helpers to access data that depends on type parameters and thus be shared
across several instantiations of the generic type.
@ -116,13 +116,13 @@ inserting any required runtime check or simply not inlining the function.
#StaticFields
The first 4 options are mutially exclusive
The first 4 options are mutually exclusive
* CORINFO_FLG_HELPER If the field has this set, then the JIT must call getFieldHelper and call the
returned helper with the object ref (for an instance field) and a fieldDesc. Note that this should be
able to handle ANY field so to get a JIT up quickly, it has the option of using helper calls for all
field access (and skip the complexity below). Note that for statics it is assumed that you will
alwasy ask for the ADDRESSS helper and to the fetch in the JIT.
always ask for the ADDRESS helper and to the fetch in the JIT.
* CORINFO_FLG_SHARED_HELPER This is currently only used for static fields. If this bit is set it means
that the field is feched by a helper call that takes a module identifier (see getModuleDomainID) and
@ -156,7 +156,7 @@ by addr = (*addr+sizeof(OBJECTREF))
Instance fields
* CORINFO_FLG_HELPER This is used if the class is MarshalByRef, which means that the object might be a
proxyt to the real object in some other appdomain or process. If the field has this set, then the JIT
proxy to the real object in some other appdomain or process. If the field has this set, then the JIT
must call getFieldHelper and call the returned helper with the object ref. If the helper returned is
helpers that are for structures the args are as follows
@ -172,7 +172,7 @@ fieldDesc and value
CORINFO_FLG_EnC This is to support adding new field for edit and continue. This field also indicates that
a helper is needed to access this field. However this helper is always CORINFO_HELP_GETFIELDADDR, and
this helper always takes the object and field handle and returns the address of the field. It is the
JIT's responcibility to do the fetch or set.
JIT's responsibility to do the fetch or set.
-------------------------------------------------------------------------------
@ -261,7 +261,7 @@ enum SystemVClassificationType : unsigned __int8
// This is the classification counterpart for that element type. It is used to detect
// the special TypedReference type and specialize its classification.
// This type is represented as a struct with two fields. The classification needs to do
// special handling of it since the source/methadata type of the fieds is IntPtr.
// special handling of it since the source/methadata type of the fields is IntPtr.
// The VM changes the first to ByRef. The second is left as IntPtr (TYP_I_IMPL really). The classification needs to match this and
// special handling is warranted (similar thing is done in the getGCLayout function for this type).
SystemVClassificationTypeTypedReference = 8,
@ -566,7 +566,7 @@ enum CorInfoHelpFunc
/* Profiling enter/leave probe addresses */
CORINFO_HELP_PROF_FCN_ENTER, // record the entry to a method (caller)
CORINFO_HELP_PROF_FCN_LEAVE, // record the completion of current method (caller)
CORINFO_HELP_PROF_FCN_TAILCALL, // record the completionof current method through tailcall (caller)
CORINFO_HELP_PROF_FCN_TAILCALL, // record the completion of current method through tailcall (caller)
/* Miscellaneous */
@ -726,7 +726,7 @@ enum CorInfoType
enum CorInfoTypeWithMod
{
CORINFO_TYPE_MASK = 0x3F, // lower 6 bits are type mask
CORINFO_TYPE_MOD_PINNED = 0x40, // can be applied to CLASS, or BYREF to indiate pinned
CORINFO_TYPE_MOD_PINNED = 0x40, // can be applied to CLASS, or BYREF to indicate pinned
};
inline CorInfoType strip(CorInfoTypeWithMod val) {
@ -1528,7 +1528,7 @@ struct CORINFO_HELPER_DESC
// thisTransform and constraint calls
// ----------------------------------
//
// For evertyhing besides "constrained." calls "thisTransform" is set to
// For everything besides "constrained." calls "thisTransform" is set to
// CORINFO_NO_THIS_TRANSFORM.
//
// For "constrained." calls the EE attempts to resolve the call at compile
@ -3202,7 +3202,7 @@ public:
) = 0;
// (static fields only) given that 'field' refers to thread local store,
// return the ID (TLS index), which is used to find the begining of the
// return the ID (TLS index), which is used to find the beginning of the
// TLS data area for the particular DLL 'field' is associated with.
virtual DWORD getFieldThreadLocalStoreID (
CORINFO_FIELD_HANDLE field,

View File

@ -1719,7 +1719,7 @@ void CodeGen::genEmitGSCookieCheck(bool pushReg)
// Make sure that the return register is reported as live GC-ref so that any GC that kicks in while
// executing GS cookie check will not collect the object pointed to by REG_INTRET (R0).
if (!pushReg && (compiler->info.compRetType == TYP_REF))
if (!pushReg && (compiler->info.compRetNativeType == TYP_REF))
gcInfo.gcRegGCrefSetCur |= RBM_INTRET;
// We need two temporary registers, to load the GS cookie values and compare them. We can't use
@ -2253,6 +2253,7 @@ void CodeGen::genGenerateCode(void** codePtr, ULONG* nativeSizeOfCode)
{
if (JitConfig.JitForceFallback() || compiler->compStressCompile(Compiler::STRESS_GENERIC_VARN, 5))
{
JITDUMP("\n\n*** forcing no-way fallback -- current jit request will be abandoned ***\n\n");
NO_WAY_NOASSERT("Stress failure");
}
}
@ -2289,8 +2290,8 @@ void CodeGen::genGenerateCode(void** codePtr, ULONG* nativeSizeOfCode)
codeSize =
GetEmitter()->emitEndCodeGen(compiler, trackedStackPtrsContig, GetInterruptible(), IsFullPtrRegMapRequired(),
(compiler->info.compRetType == TYP_REF), compiler->compHndBBtabCount, &prologSize,
&epilogSize, codePtr, &coldCodePtr, &consPtr);
(compiler->info.compRetNativeType == TYP_REF), compiler->compHndBBtabCount,
&prologSize, &epilogSize, codePtr, &coldCodePtr, &consPtr);
compiler->EndPhase(PHASE_EMIT_CODE);
@ -6713,6 +6714,8 @@ void CodeGen::genReserveEpilog(BasicBlock* block)
default:
break;
}
JITDUMP("Extending return value GC liveness to epilog\n");
}
}
@ -11143,9 +11146,9 @@ void CodeGen::genReturn(GenTree* treeNode)
regCount = retTypeDesc.GetReturnRegCount();
}
if (varTypeIsGC(compiler->info.compRetType))
if (varTypeIsGC(compiler->info.compRetNativeType))
{
gcInfo.gcMarkRegPtrVal(REG_INTRET, compiler->info.compRetType);
gcInfo.gcMarkRegPtrVal(REG_INTRET, compiler->info.compRetNativeType);
}
else if (compiler->compMethodReturnsMultiRegRetType())
{
@ -11160,7 +11163,7 @@ void CodeGen::genReturn(GenTree* treeNode)
genProfilingLeaveCallback(CORINFO_HELP_PROF_FCN_LEAVE);
if (varTypeIsGC(compiler->info.compRetType))
if (varTypeIsGC(compiler->info.compRetNativeType))
{
gcInfo.gcMarkRegSetNpt(genRegMask(REG_INTRET));
}

View File

@ -104,7 +104,7 @@ fi
# Use uname to determine what the OS is.
OSName=$(uname -s)
case $OSName in
case "$OSName" in
Linux)
__BuildOS=Linux
__HostOS=Linux
@ -144,8 +144,8 @@ esac
isPortable=0
source "${scriptDir}"/../init-distro-rid.sh
initDistroRidGlobal ${__BuildOS} x64 ${isPortable}
source "${scriptDir}"/../../../eng/native/init-distro-rid.sh
initDistroRidGlobal "$__BuildOS" x64 "$isPortable"
# Hack, replace the rid to ubuntu.14.04 which has a valid non-portable
# package.
@ -153,22 +153,22 @@ initDistroRidGlobal ${__BuildOS} x64 ${isPortable}
# The CoreDisTools package is currently manually packaged and we only have
# 14.04 and 16.04 packages. Use the oldest package which will work on newer
# platforms.
if [[ ${__BuildOS} == "Linux" ]]; then
if [[ ${__BuildArch} == "x64" ]]; then
if [ "$__BuildOS" = "Linux" ]; then
if [ "$__BuildArch" = "x64" ]; then
__DistroRid=ubuntu.14.04-x64
elif [[ ${__BuildArch} == "x86" ]]; then
elif [ "$__BuildArch" = "x86" ]; then
__DistroRid=ubuntu.14.04-x86
fi
fi
# Query runtime Id
rid=${__DistroRid}
rid="$__DistroRid"
echo "Rid to be used: ${rid}"
if [ -z "$rid" ]; then
exit_with_error 1 "Failed to query runtime Id"
fi
fi
# Download the package
echo Downloading CoreDisTools package

View File

@ -2,6 +2,9 @@ cmake_minimum_required(VERSION 3.14.2)
project(corehost)
include(${CLR_ENG_NATIVE_DIR}/functions.cmake)
include(${CLR_ENG_NATIVE_DIR}/configuretools.cmake)
include(${CLR_ENG_NATIVE_DIR}/configureplatform.cmake)
include(../settings.cmake)
include(../functions.cmake)
add_subdirectory(cli)

View File

@ -16,11 +16,11 @@ set __VSString=%__VSString:"=%
set __ExtraCmakeParams=
:: Set the target architecture to a format cmake understands. ANYCPU defaults to x64
set __RIDArch=%3
if /i "%3" == "x64" (set cm_BaseRid=win7&&set cm_Arch=AMD64&&set __ExtraCmakeParams=%__ExtraCmakeParams% -A x64)
if /i "%3" == "x86" (set cm_BaseRid=win7&&set cm_Arch=I386&&set __ExtraCmakeParams=%__ExtraCmakeParams% -A Win32)
if /i "%3" == "arm" (set cm_BaseRid=win8&&set cm_Arch=ARM&&set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM)
if /i "%3" == "arm64" (set cm_BaseRid=win10&&set cm_Arch=ARM64&&set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM64)
set __Arch=%3
if /i "%__Arch%" == "x64" (set cm_BaseRid=win7&&set __ExtraCmakeParams=%__ExtraCmakeParams% -A x64)
if /i "%__Arch%" == "x86" (set cm_BaseRid=win7&&set __ExtraCmakeParams=%__ExtraCmakeParams% -A Win32)
if /i "%__Arch%" == "arm" (set cm_BaseRid=win8&&set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM)
if /i "%__Arch%" == "arm64" (set cm_BaseRid=win10&&set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM64)
set __LatestCommit=%4
set __HostVersion=%5
@ -30,7 +30,7 @@ set __HostPolicyVersion=%8
:: Form the base RID to be used if we are doing a portable build
if /i "%9" == "1" (set cm_BaseRid=win)
set cm_BaseRid=%cm_BaseRid%-%__RIDArch%
set cm_BaseRid=%cm_BaseRid%-%__Arch%
echo "Computed RID for native build is %cm_BaseRid%"
if defined CMakePath goto DoGen
@ -41,8 +41,12 @@ for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& .\Win
popd
:DoGen
echo "%CMakePath%" %__sourceDir% "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLI_CMAKE_HOST_VER=%__HostVersion%" "-DCLI_CMAKE_COMMON_HOST_VER=%__AppHostVersion%" "-DCLI_CMAKE_HOST_FXR_VER=%__HostFxrVersion%" "-DCLI_CMAKE_HOST_POLICY_VER=%__HostPolicyVersion%" "-DCLI_CMAKE_PKG_RID=%cm_BaseRid%" "-DCLI_CMAKE_COMMIT_HASH=%__LatestCommit%" "-DCLI_CMAKE_PLATFORM_ARCH_%cm_Arch%=1" "-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLI_CMAKE_RESOURCE_DIR=%__ResourcesDir%" -G "Visual Studio %__VSString%" %__ExtraCmakeParams%
"%CMakePath%" %__sourceDir% "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLI_CMAKE_HOST_VER=%__HostVersion%" "-DCLI_CMAKE_COMMON_HOST_VER=%__AppHostVersion%" "-DCLI_CMAKE_HOST_FXR_VER=%__HostFxrVersion%" "-DCLI_CMAKE_HOST_POLICY_VER=%__HostPolicyVersion%" "-DCLI_CMAKE_PKG_RID=%cm_BaseRid%" "-DCLI_CMAKE_COMMIT_HASH=%__LatestCommit%" "-DCLI_CMAKE_PLATFORM_ARCH_%cm_Arch%=1" "-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLI_CMAKE_RESOURCE_DIR=%__ResourcesDir%" -G "Visual Studio %__VSString%" %__ExtraCmakeParams%
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_SYSTEM_VERSION=10.0" "-DCLI_CMAKE_HOST_VER=%__HostVersion%" "-DCLI_CMAKE_COMMON_HOST_VER=%__AppHostVersion%" "-DCLI_CMAKE_HOST_FXR_VER=%__HostFxrVersion%"
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCLI_CMAKE_HOST_POLICY_VER=%__HostPolicyVersion%" "-DCLI_CMAKE_PKG_RID=%cm_BaseRid%" "-DCLI_CMAKE_COMMIT_HASH=%__LatestCommit%" "-DCLR_CMAKE_HOST_ARCH=%__Arch%"
set __ExtraCmakeParams=%__ExtraCmakeParams% "-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLI_CMAKE_RESOURCE_DIR=%__ResourcesDir%" "-DCLR_ENG_NATIVE_DIR="%__sourceDir%\..\..\..\eng\native"
echo "%CMakePath%" %__sourceDir% -G "Visual Studio %__VSString%" %__ExtraCmakeParams%
"%CMakePath%" %__sourceDir% -G "Visual Studio %__VSString%" %__ExtraCmakeParams%
endlocal
GOTO :DONE

View File

@ -27,11 +27,10 @@
<PropertyGroup>
<CMakeBuildDir>$(IntermediateOutputRootPath)corehost\cmake\</CMakeBuildDir>
<BuildArgs>--configuration $(ConfigurationGroup) --arch $(TargetArchitecture) --apphostver $(AppHostVersion) --hostver $(HostVersion) --fxrver $(HostResolverVersion) --policyver $(HostPolicyVersion) --commithash $(LatestCommit)</BuildArgs>
<BuildArgs Condition="'$(PortableBuild)' == 'true'">$(BuildArgs) -portable</BuildArgs>
<BuildArgs Condition="'$(CrossBuild)' == 'true'">$(BuildArgs) --cross</BuildArgs>
<BuildArgs Condition="'$(StripSymbols)' == 'true'">$(BuildArgs) --stripsymbols</BuildArgs>
<BuildArgs>$(BuildArgs) --rootdir $(RepoRoot)</BuildArgs>
<BuildArgs>$(ConfigurationGroup) $(TargetArchitecture) -apphostver "$(AppHostVersion)" -hostver "$(HostVersion)" -fxrver "$(HostResolverVersion)" -policyver "$(HostPolicyVersion)" -commithash "$(LatestCommit)"</BuildArgs>
<BuildArgs Condition="'$(PortableBuild)' != 'true'">$(BuildArgs) -portablebuild=false</BuildArgs>
<BuildArgs Condition="'$(CrossBuild)' == 'true'">$(BuildArgs) -cross</BuildArgs>
<BuildArgs Condition="'$(StripSymbols)' == 'true'">$(BuildArgs) -stripsymbols</BuildArgs>
</PropertyGroup>
<!--

View File

@ -1,282 +1,102 @@
#!/usr/bin/env bash
init_rid_plat()
{
# Detect Distro
if [ $__CrossBuild == 1 ]; then
if [ -z $ROOTFS_DIR ]; then
echo "ROOTFS_DIR is not defined."
exit -1
else
if [ -e $ROOTFS_DIR/etc/os-release ]; then
source $ROOTFS_DIR/etc/os-release
__rid_plat="$ID.$VERSION_ID"
if [[ "$ID" == "alpine" ]]; then
__rid_plat="linux-musl"
fi
fi
echo "__rid_plat is $__rid_plat"
fi
else
__rid_plat=""
if [ -e /etc/os-release ]; then
source /etc/os-release
if [[ "$ID" == "rhel" ]]; then
# remove the last version number
VERSION_ID=${VERSION_ID%.*}
fi
__rid_plat="$ID${VERSION_ID:+.$VERSION_ID}"
if [[ "$ID" == "alpine" ]]; then
__rid_plat="linux-musl"
fi
fi
fi
if [ "$(uname -s)" == "Darwin" ]; then
__rid_plat=osx.10.12
fi
if [ "$(uname -s)" == "FreeBSD" ]; then
major_ver=`uname -U | cut -b1-2`
__rid_plat=freebsd.$major_ver
fi
if [ $__linkPortable == 1 ]; then
if [ "$(uname -s)" == "Darwin" ]; then
__rid_plat="osx"
elif [ "$(uname -s)" == "FreeBSD" ]; then
__rid_plat="freebsd"
else
__rid_plat="linux"
fi
fi
}
usage()
{
echo "Usage: $0 --rootdir <path> --configuration <configuration> --arch <Architecture> --hostver <Dotnet exe version> --apphostver <app host exe version> --fxrver <HostFxr library version> --policyver <HostPolicy library version> --commithash <Git commit hash> [--xcompiler <Cross C++ Compiler>]"
echo ""
echo "Options:"
echo " --rootdir <path> Path to the root of the repository. Required."
echo " --configuration <configuration> Build configuration (Debug, Release)"
echo " --arch <Architecture> Target Architecture (x64, x86, arm, arm64, armel)"
echo " --hostver <Dotnet host version> Version of the dotnet executable"
echo " --apphostver <app host version> Version of the apphost executable"
echo " --fxrver <HostFxr version> Version of the hostfxr library"
echo " --policyver <HostPolicy version> Version of the hostpolicy library"
echo " --commithash <Git commit hash> Current commit hash of the repo at build time"
echo " -portable Optional argument to build portable platform packages."
echo " --cross Optional argument to signify cross compilation,"
echo " and use ROOTFS_DIR environment variable to find rootfs."
echo " --stripsymbols Optional argument to strip native symbols during the build"
exit 1
}
usage_list=("-hostver <Dotnet host version>: Version of the dotnet executable.")
usage_list+=("-apphostver <app host version>: Version of the apphost executable.")
usage_list+=("-fxrver <HostFxr version>: Version of the hostfxr library.")
usage_list+=("-policyver <HostPolicy version>: Version of the hostpolicy library.")
usage_list+=("-commithash <Git commit hash>: Current commit hash of the repo at build time.")
set -e
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
__build_arch=
__scriptpath="$(cd "$(dirname "$0")"; pwd -P)"
__RepoRootDir="$(cd "$__scriptpath"/../../..; pwd -P)"
__BuildArch=x64
__BuildOS=Linux
__BuildType=Debug
__CMakeArgs=""
__Compiler=clang
__CompilerMajorVersion=
__CompilerMinorVersion=
__CrossBuild=0
__IsMSBuildOnNETCoreSupported=0
__PortableBuild=1
__RootBinDir="$__RepoRootDir/artifacts"
__SkipConfigure=0
__SkipGenerateVersion=0
__StaticLibLink=0
__UnprocessedBuildArgs=
__VerboseBuild=false
__host_ver=
__apphost_ver=
__policy_ver=
__fxr_ver=
__CrossBuild=0
__commit_hash=
__portableBuildArgs=
__configuration=Debug
__linkPortable=0
__cmake_defines=
__cmake_bin_prefix=
while [ "$1" != "" ]; do
lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
-h|--help)
usage
exit 1
handle_arguments() {
case "$1" in
hostver|-hostver)
__host_ver="$2"
__ShiftArgs=1
;;
--arch)
shift
__build_arch=$1
apphostver|-apphostver)
__apphost_ver="$2"
__ShiftArgs=1
;;
--configuration)
shift
__configuration=$1
fxrver|-fxrver)
__fxr_ver="$2"
__ShiftArgs=1
;;
--hostver)
shift
__host_ver=$1
policyver|-policyver)
__policy_ver="$2"
__ShiftArgs=1
;;
--apphostver)
shift
__apphost_ver=$1
commithash|-commithash)
__commit_hash="$2"
__ShiftArgs=1
;;
--fxrver)
shift
__fxr_ver=$1
;;
--policyver)
shift
__policy_ver=$1
;;
--commithash)
shift
__commit_hash=$1
;;
-portable)
__portableBuildArgs="-DCLI_CMAKE_PORTABLE_BUILD=1"
__linkPortable=1
;;
--cross)
__CrossBuild=1
;;
--stripsymbols)
__cmake_defines="${__cmake_defines} -DSTRIP_SYMBOLS=true"
;;
--rootdir)
shift
RootRepo=$1
;;
*)
echo "Unknown argument to build.sh $1"; usage; exit 1
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
esac
shift
done
}
if [ "$RootRepo" == "" ]; then
usage
source "$__RepoRootDir"/eng/native/build-commons.sh
# Set dependent variables
__LogsDir="$__RootBinDir/log"
__MsbuildDebugLogsDir="$__LogsDir/MsbuildDebugLogs"
# Set the remaining variables based upon the determined build configuration
__DistroRidLower="$(echo $__DistroRid | tr '[:upper:]' '[:lower:]')"
__BinDir="$__RootBinDir/bin/$__DistroRidLower.$__BuildType"
__IntermediatesDir="$__RootBinDir/obj/$__DistroRidLower.$__BuildType"
export __BinDir __IntermediatesDir
__CMakeArgs="-DCLI_CMAKE_HOST_VER=\"$__host_ver\" -DCLI_CMAKE_COMMON_HOST_VER=\"$__apphost_ver\" -DCLI_CMAKE_HOST_FXR_VER=\"$__fxr_ver\""
__CMakeArgs="-DCLI_CMAKE_HOST_POLICY_VER=\"$__policy_ver\" -DCLI_CMAKE_PKG_RID=\"$__DistroRid\" -DCLI_CMAKE_COMMIT_HASH=\"$__commit_hash\" $__CMakeArgs"
if [[ "$__PortableBuild" == 1 ]]; then
__CMakeArgs="-DCLI_CMAKE_PORTABLE_BUILD=1 $__CMakeArgs"
fi
__bin_dir="$RootRepo/artifacts/bin"
__baseIntermediateOutputPath="$RootRepo/artifacts/obj"
__versionSourceFile="$__baseIntermediateOutputPath/_version.c"
# Specify path to be set for CMAKE_INSTALL_PREFIX.
# This is where all built CoreClr libraries will copied to.
__CMakeBinDir="$__BinDir"
export __CMakeBinDir
__cmake_defines="${__cmake_defines} -DCMAKE_BUILD_TYPE=${__configuration} ${__portableBuildArgs}"
# Make the directories necessary for build if they don't exist
setup_dirs
mkdir -p "$__baseIntermediateOutputPath"
# Check prereqs.
check_prereqs
case $__build_arch in
amd64|x64)
__arch_define=-DCLI_CMAKE_PLATFORM_ARCH_AMD64=1
;;
x86)
__arch_define=-DCLI_CMAKE_PLATFORM_ARCH_I386=1
;;
arm|armel)
__arch_define=-DCLI_CMAKE_PLATFORM_ARCH_ARM=1
;;
arm64)
__arch_define=-DCLI_CMAKE_PLATFORM_ARCH_ARM64=1
;;
*)
echo "Unknown architecture $__build_arch"; usage; exit 1
;;
esac
__cmake_defines="${__cmake_defines} ${__arch_define}"
# Configure environment if we are doing a cross compile.
if [ "$__CrossBuild" == 1 ]; then
if ! [[ -n $ROOTFS_DIR ]]; then
export ROOTFS_DIR="$RootRepo/.tools/rootfs/$__build_arch"
fi
fi
# __base_rid is the base RID that corehost is shipped for, effectively, the name of the folder in "runtimes/{__base_rid}/native/" inside the nupkgs.
# __rid_plat is the OS portion of the RID.
__rid_plat=
init_rid_plat
if [ -z $__rid_plat ]; then
echo "Unknown base rid (eg.: osx.10.12, ubuntu.14.04) being targeted"
exit -1
fi
if [ -z $__commit_hash ]; then
echo "Commit hash was not specified"
exit -1
fi
__build_arch_lowcase=$(echo "$__build_arch" | tr '[:upper:]' '[:lower:]')
__base_rid=$__rid_plat-$__build_arch_lowcase
echo "Computed RID for native build is $__base_rid"
__cmake_bin_prefix="$__bin_dir/$__base_rid.$__configuration"
__intermediateOutputPath="$__baseIntermediateOutputPath/$__base_rid.$__configuration/corehost"
export __CrossToolChainTargetRID=$__base_rid
# Set up the environment to be used for building with clang.
if command -v "clang-3.5" > /dev/null 2>&1; then
export CC="$(command -v clang-3.5)"
export CXX="$(command -v clang++-3.5)"
elif command -v "clang-3.6" > /dev/null 2>&1; then
export CC="$(command -v clang-3.6)"
export CXX="$(command -v clang++-3.6)"
elif command -v "clang-3.9" > /dev/null 2>&1; then
export CC="$(command -v clang-3.9)"
export CXX="$(command -v clang++-3.9)"
elif command -v "clang-5.0" > /dev/null 2>&1; then
export CC="$(command -v clang-5.0)"
export CXX="$(command -v clang++-5.0)"
elif command -v "clang-9" > /dev/null 2>&1; then
export CC="$(command -v clang-9)"
export CXX="$(command -v clang++-9)"
elif command -v clang > /dev/null 2>&1; then
export CC="$(command -v clang)"
export CXX="$(command -v clang++)"
else
echo "Unable to find Clang Compiler"
echo "Install clang-3.5 or clang3.6 or clang3.9 or clang5.0 or clang9"
exit 1
fi
if [ ! -f $__versionSourceFile ]; then
__versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
echo $__versionSourceLine > $__versionSourceFile
fi
__cmake_defines="${__cmake_defines} -DVERSION_FILE_PATH=${__versionSourceFile}"
mkdir -p $__intermediateOutputPath
pushd $__intermediateOutputPath
echo "Building Corehost from $DIR to $(pwd)"
set -x # turn on trace
if [ $__CrossBuild == 1 ]; then
# clang-3.9 or clang-9 are default compilers for cross compilation
if [[ "$__build_arch" != "arm" && "$__build_arch" != "armel" ]]; then
if command -v "clang-3.9" > /dev/null 2>&1; then
export CC="$(command -v clang-3.9)"
export CXX="$(command -v clang++-3.9)"
elif command -v "clang-9" > /dev/null 2>&1; then
export CC="$(command -v clang-9)"
export CXX="$(command -v clang++-9)"
fi
elif command -v "clang-4.0" > /dev/null 2>&1; then
export CC="$(command -v clang-4.0)"
export CXX="$(command -v clang++-4.0)"
elif command -v "clang-5.0" > /dev/null 2>&1; then
export CC="$(command -v clang-5.0)"
export CXX="$(command -v clang++-5.0)"
elif command -v "clang-9" > /dev/null 2>&1; then
export CC="$(command -v clang-9)"
export CXX="$(command -v clang++-9)"
else
echo "Unable to find Clang 3.9 or Clang 4.0 or Clang 5.0 or Clang 9 Compiler"
echo "Install clang-3.9 or clang-4.0 or clang-5.0 or clang-9 for cross compilation"
exit 1
fi
export TARGET_BUILD_ARCH=$__build_arch_lowcase
export __DistroRid=$__rid_plat
cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_HOST_VER=$__host_ver -DCLI_CMAKE_COMMON_HOST_VER=$__apphost_ver -DCLI_CMAKE_HOST_FXR_VER=$__fxr_ver -DCLI_CMAKE_HOST_POLICY_VER=$__policy_ver -DCLI_CMAKE_PKG_RID=$__base_rid -DCLI_CMAKE_COMMIT_HASH=$__commit_hash -DCMAKE_INSTALL_PREFIX=$__cmake_bin_prefix -DCMAKE_TOOLCHAIN_FILE=$RootRepo/eng/common/cross/toolchain.cmake
else
cmake "$DIR" -G "Unix Makefiles" $__cmake_defines -DCLI_CMAKE_HOST_VER=$__host_ver -DCLI_CMAKE_COMMON_HOST_VER=$__apphost_ver -DCLI_CMAKE_HOST_FXR_VER=$__fxr_ver -DCLI_CMAKE_HOST_POLICY_VER=$__policy_ver -DCLI_CMAKE_PKG_RID=$__base_rid -DCLI_CMAKE_COMMIT_HASH=$__commit_hash -DCMAKE_INSTALL_PREFIX=$__cmake_bin_prefix
fi
popd
set +x # turn off trace
cmake --build $__intermediateOutputPath --target install --config $__configuration
# Build the installer native components.
# note the third argument, tryrun_dir is empty for installers
build_native "$__BuildArch" "$__scriptpath" "" "$__IntermediatesDir" "installer component"

View File

@ -2,11 +2,11 @@
# The .NET Foundation licenses this file to you under the MIT license.
# See the LICENSE file in the project root for more information.
project(apphost)
project(apphost)
set(DOTNET_PROJECT_NAME "apphost")
# Add RPATH to the apphost binary that allows using local copies of shared libraries
# dotnet core depends on for special scenarios when system wide installation of such
# dotnet core depends on for special scenarios when system wide installation of such
# dependencies is not possible for some reason.
# This cannot be enabled for MacOS (Darwin) since its RPATH works in a different way,
# doesn't apply to libraries loaded via dlopen and most importantly, it is not transitive.
@ -56,12 +56,12 @@ add_definitions(-DFEATURE_APPHOST=1)
# Disable manifest generation into the file .exe on Windows
if(WIN32)
set_property(TARGET ${PROJECT_NAME} PROPERTY
LINK_FLAGS "/MANIFEST:NO"
)
set_property(TARGET ${PROJECT_NAME} PROPERTY
LINK_FLAGS "/MANIFEST:NO"
)
endif()
# Specify non-default Windows libs to be used for Arm/Arm64 builds
if (WIN32 AND (CLI_CMAKE_PLATFORM_ARCH_ARM OR CLI_CMAKE_PLATFORM_ARCH_ARM64))
if (WIN32 AND (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64))
target_link_libraries(apphost Advapi32.lib shell32.lib)
endif()

View File

@ -39,7 +39,7 @@ if (WIN32)
set(WINLIBS wintrust.lib)
# Specify non-default Windows libs to be used for Arm/Arm64 builds
if (CLI_CMAKE_PLATFORM_ARCH_ARM OR CLI_CMAKE_PLATFORM_ARCH_ARM64)
if (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64)
list(APPEND WINLIBS Advapi32.lib Ole32.lib OleAut32.lib)
endif()

View File

@ -68,7 +68,7 @@ function(set_common_libs TargetType)
endif()
# Specify the import library to link against for Arm32 build since the default set is minimal
if (CLI_CMAKE_PLATFORM_ARCH_ARM)
if (CLR_CMAKE_HOST_ARCH_ARM)
if (WIN32)
target_link_libraries(${DOTNET_PROJECT_NAME} shell32.lib)
else()

View File

@ -36,12 +36,12 @@ add_definitions(-DFEATURE_LIBHOST=1)
convert_to_absolute_path(SOURCES ${SOURCES})
convert_to_absolute_path(ASM_HELPERS_SOURCES ${ASM_HELPERS_SOURCES})
if (WIN32 AND (CLI_CMAKE_PLATFORM_ARCH_ARM OR CLI_CMAKE_PLATFORM_ARCH_ARM64))
if (WIN32 AND (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64))
preprocess_compile_asm(ASM_FILES ${ASM_HELPERS_SOURCES} OUTPUT_OBJECTS ASM_HELPERS_OBJECTS)
list(APPEND ASM_HELPERS_SOURCES ${ASM_HELPERS_OBJECTS})
endif ()
if (WIN32 AND CLI_CMAKE_PLATFORM_ARCH_I386)
if (WIN32 AND CLR_CMAKE_HOST_ARCH_I386)
set_source_files_properties(${ASM_HELPERS_SOURCES} PROPERTIES COMPILE_FLAGS "/safeseh")
endif ()
@ -50,9 +50,9 @@ list(APPEND SOURCES ${ASM_HELPERS_SOURCES})
include(../lib.cmake)
# Specify non-default Windows libs to be used for Arm/Arm64 builds
if (WIN32 AND (CLI_CMAKE_PLATFORM_ARCH_ARM OR CLI_CMAKE_PLATFORM_ARCH_ARM64))
if (WIN32 AND (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64))
target_link_libraries(ijwhost Advapi32.lib Ole32.lib)
endif()
install(TARGETS ijwhost DESTINATION corehost)
install_symbols (ijwhost corehost)
install_symbols (ijwhost corehost)

View File

@ -50,6 +50,6 @@ include(../testexe.cmake)
target_link_libraries(${DOTNET_PROJECT_NAME} nethost)
# Specify non-default Windows libs to be used for Arm/Arm64 builds
if (WIN32 AND (CLI_CMAKE_PLATFORM_ARCH_ARM OR CLI_CMAKE_PLATFORM_ARCH_ARM64))
if (WIN32 AND (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64))
target_link_libraries(${DOTNET_PROJECT_NAME} Advapi32.lib Ole32.lib OleAut32.lib)
endif()

View File

@ -39,6 +39,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries (${EXE_NAME} "dl")
endif()
if((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND CLI_CMAKE_PLATFORM_ARCH_ARM)
if((${CMAKE_SYSTEM_NAME} MATCHES "Linux") AND CLR_CMAKE_HOST_ARCH_ARM)
target_link_libraries (${EXE_NAME} "atomic")
endif()

View File

@ -29,11 +29,11 @@ include(../lib.cmake)
add_definitions(-DFEATURE_LIBHOST=1)
# Specify non-default Windows libs to be used for Arm/Arm64 builds
if (WIN32 AND (CLI_CMAKE_PLATFORM_ARCH_ARM OR CLI_CMAKE_PLATFORM_ARCH_ARM64))
if (WIN32 AND (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64))
target_link_libraries(winrthost Advapi32.lib Ole32.lib OleAut32.lib)
endif()
target_link_libraries(winrthost RuntimeObject.lib)
install(TARGETS winrthost DESTINATION corehost)
install_symbols(winrthost corehost)
install_symbols(winrthost corehost)

View File

@ -45,11 +45,11 @@ function(get_include_directories IncludeDirectories)
get_directory_property(dirs INCLUDE_DIRECTORIES)
foreach(dir IN LISTS dirs)
if (CLR_CMAKE_PLATFORM_ARCH_ARM AND WIN32)
if (CLR_CMAKE_HOST_ARCH_ARM AND WIN32)
list(APPEND INC_DIRECTORIES /I${dir})
else()
list(APPEND INC_DIRECTORIES -I${dir})
endif(CLR_CMAKE_PLATFORM_ARCH_ARM AND WIN32)
endif(CLR_CMAKE_HOST_ARCH_ARM AND WIN32)
endforeach()
set(${IncludeDirectories} ${INC_DIRECTORIES} PARENT_SCOPE)
@ -127,12 +127,12 @@ endfunction()
function(get_include_directories_asm IncludeDirectories)
get_directory_property(dirs INCLUDE_DIRECTORIES)
if (CLI_CMAKE_PLATFORM_ARCH_ARM AND WIN32)
if (CLR_CMAKE_HOST_ARCH_ARM AND WIN32)
list(APPEND INC_DIRECTORIES "-I ")
endif()
foreach(dir IN LISTS dirs)
if (CLI_CMAKE_PLATFORM_ARCH_ARM AND WIN32)
if (CLR_CMAKE_HOST_ARCH_ARM AND WIN32)
list(APPEND INC_DIRECTORIES ${dir};)
else()
list(APPEND INC_DIRECTORIES -I${dir})

View File

@ -4,48 +4,6 @@
set (CMAKE_CXX_STANDARD 11)
include(CheckPIESupported)
# All code we build should be compiled as position independent
check_pie_supported(OUTPUT_VARIABLE PIE_SUPPORT_OUTPUT LANGUAGES CXX)
if(NOT MSVC AND NOT CMAKE_CXX_LINK_PIE_SUPPORTED)
message(WARNING "PIE is not supported at link time: ${PIE_SUPPORT_OUTPUT}.\n"
"PIE link options will not be passed to linker.")
endif()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(CLR_CMAKE_PLATFORM_UNIX 1)
message("System name Linux")
endif(CMAKE_SYSTEM_NAME STREQUAL Linux)
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(CLR_CMAKE_PLATFORM_UNIX 1)
message("System name Darwin")
endif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
set(CLR_CMAKE_PLATFORM_UNIX 1)
add_definitions(-D_BSD_SOURCE) # required for getline
message("System name FreeBSD")
endif(CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
if(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
set(CLR_CMAKE_PLATFORM_UNIX 1)
message("System name OpenBSD")
endif(CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
if(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
set(CLR_CMAKE_PLATFORM_UNIX 1)
message("System name NetBSD")
endif(CMAKE_SYSTEM_NAME STREQUAL NetBSD)
if(CMAKE_SYSTEM_NAME STREQUAL SunOS)
set(CLR_CMAKE_PLATFORM_UNIX 1)
message("System name SunOS")
endif(CMAKE_SYSTEM_NAME STREQUAL SunOS)
if (NOT WIN32)
# Try to locate the paxctl tool. Failure to find it is not fatal,
# but the generated executables won't work on a system where PAX is set
@ -81,7 +39,7 @@ if (NOT WIN32)
endif ()
function(strip_symbols targetName outputFilename)
if(CLR_CMAKE_PLATFORM_UNIX)
if(CLR_CMAKE_HOST_UNIX)
if(STRIP_SYMBOLS)
# On the older version of cmake (2.8.12) used on Ubuntu 14.04 the TARGET_FILE
@ -120,7 +78,7 @@ function(strip_symbols targetName outputFilename)
set(${outputFilename} ${strip_destination_file} PARENT_SCOPE)
endif(STRIP_SYMBOLS)
endif(CLR_CMAKE_PLATFORM_UNIX)
endif(CLR_CMAKE_HOST_UNIX)
endfunction()
function(install_symbols targetName destination_path)
@ -242,24 +200,24 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_definitions(-D__LINUX__)
endif()
if(CLI_CMAKE_PLATFORM_ARCH_I386)
if(CLR_CMAKE_HOST_ARCH_I386)
add_definitions(-D_TARGET_X86_=1)
set(ARCH_SPECIFIC_FOLDER_NAME "i386")
elseif(CLI_CMAKE_PLATFORM_ARCH_AMD64)
elseif(CLR_CMAKE_HOST_ARCH_AMD64)
add_definitions(-D_TARGET_AMD64_=1)
set(ARCH_SPECIFIC_FOLDER_NAME "AMD64")
elseif(CLI_CMAKE_PLATFORM_ARCH_ARM)
elseif(CLR_CMAKE_HOST_ARCH_ARM)
add_definitions(-D_TARGET_ARM_=1)
set(ARCH_SPECIFIC_FOLDER_NAME "arm")
elseif(CLI_CMAKE_PLATFORM_ARCH_ARM64)
add_definitions(-D_TARGET_ARM64_=1)
elseif(CLR_CMAKE_HOST_ARCH_ARM64)
add_definitions(-D_TARGET_ARM64_=1)
set(ARCH_SPECIFIC_FOLDER_NAME "arm64")
else()
message(FATAL_ERROR "Unknown target architecture")
endif()
# Specify the Windows SDK to be used for Arm builds
if (WIN32 AND (CLI_CMAKE_PLATFORM_ARCH_ARM OR CLI_CMAKE_PLATFORM_ARCH_ARM64))
if (WIN32 AND (CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64))
if(NOT DEFINED CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION OR CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION STREQUAL "" )
message(FATAL_ERROR "Windows SDK is required for the Arm32 or Arm64 build.")
else()
@ -268,7 +226,7 @@ if (WIN32 AND (CLI_CMAKE_PLATFORM_ARCH_ARM OR CLI_CMAKE_PLATFORM_ARCH_ARM64))
endif ()
if (WIN32)
if(CLI_CMAKE_PLATFORM_ARCH_ARM)
if(CLR_CMAKE_HOST_ARCH_ARM)
# Explicitly specify the assembler to be used for Arm32 compile
file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm\\armasm.exe" CMAKE_ASM_COMPILER)
@ -278,7 +236,7 @@ if (WIN32)
# Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly
# use ml[64].exe as the assembler.
enable_language(ASM)
elseif(CLI_CMAKE_PLATFORM_ARCH_ARM64)
elseif(CLR_CMAKE_HOST_ARCH_ARM64)
# Explicitly specify the assembler to be used for Arm64 compile
file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm64\\armasm64.exe" CMAKE_ASM_COMPILER)

View File

@ -22,7 +22,7 @@ set(CMAKE_INSTALL_PREFIX $ENV{__CMakeBinDir})
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/../../_version.c")
set(VERSION_FILE_PATH "${CMAKE_BINARY_DIR}/version.c")
# We mark the function which needs exporting with DLLEXPORT
add_compile_options(-fvisibility=hidden)

View File

@ -127,6 +127,11 @@ may help to copy its "DIA SDK" folder into "%VSINSTALLDIR%" manually, then try a
exit /b 1
:GenVSSolution
:: generate version file
powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -File "%__repoRoot%\eng\common\msbuild.ps1" /clp:nosummary %__ArcadeScriptArgs%^
%__repoRoot%\eng\empty.csproj /p:NativeVersionFile="%__artifactsDir%\obj\_version.h"^
/t:GenerateNativeVersionFile /restore
:: Regenerate the VS solution
pushd "%__IntermediatesDir%"

View File

@ -2,13 +2,10 @@
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />
<!-- Target that builds all the native binaries in the Native folder -->
<Target Name="Build" DependsOnTargets="GenerateNativeVersionFile;BuildNativeUnix;BuildNativeWindows" />
<Target Name="Build" DependsOnTargets="BuildNativeUnix;BuildNativeWindows" />
<PropertyGroup>
<!-- Hardcode version paths in a global location. -->
<NativeVersionFile Condition="'$(OS)' == 'Windows_NT'">$(ArtifactsObjDir)_version.h</NativeVersionFile>
<NativeVersionFile Condition="'$(OS)' != 'Windows_NT'">$(ArtifactsObjDir)_version.c</NativeVersionFile>
<_BuildNativeArgs>$(ArchGroup) $(ConfigurationGroup) $(OSGroup) outconfig $(Configuration)</_BuildNativeArgs>
<_BuildNativeArgs>$(ArchGroup) $(ConfigurationGroup) outconfig $(Configuration)</_BuildNativeArgs>
</PropertyGroup>
<Target Name="BuildNativeUnix"
@ -19,17 +16,17 @@
MSBuildNodeCount should a good approximation for how many procs to use for native build, if we find that doesn't work
then we should consider calling Environment.ProcessorCount
-->
<_ProcessorCountArg> --numproc $(MSBuildNodeCount)</_ProcessorCountArg>
<_StripSymbolsArg Condition="'$(BuildNativeStripSymbols)' == 'true' and '$(OSGroup)' != 'WebAssembly'"> stripsymbols</_StripSymbolsArg>
<_PortableBuildArg Condition="'$(PortableBuild)' == 'true'"> -portable</_PortableBuildArg>
<_ProcessorCountArg> -numproc $(MSBuildNodeCount)</_ProcessorCountArg>
<_StripSymbolsArg Condition="'$(BuildNativeStripSymbols)' == 'true' and '$(OSGroup)' != 'WebAssembly'"> -stripsymbols</_StripSymbolsArg>
<_PortableBuildArg Condition="'$(PortableBuild)' != 'true'"> -portablebuild=false</_PortableBuildArg>
<_CrossBuildArg Condition="'$(CrossBuild)' == 'true'"> -cross</_CrossBuildArg>
<!--
BuildNativeCompiler is a pass-through argument, to pass an argument to build-native.sh. It is intended to be
used to force a specific compiler toolset.
-->
<_BuildNativeCompilerArg Condition="'$(BuildNativeCompiler)' != ''"> $(BuildNativeCompiler)</_BuildNativeCompilerArg>
<_BuildNativeUnixArgs>$(_BuildNativeArgs)$(_ProcessCountArg)$(_StripSymbolsArg)$(_PortableBuildArg)$(_BuildNativeCompilerArg)</_BuildNativeUnixArgs>
<_BuildNativeUnixArgs>$(_BuildNativeArgs)$(_ProcessCountArg)$(_StripSymbolsArg)$(_PortableBuildArg)$(_CrossBuildArg)$(_BuildNativeCompilerArg)</_BuildNativeUnixArgs>
</PropertyGroup>
<Message Text="$(MSBuildProjectDirectory)/build-native.sh $(_BuildNativeUnixArgs)" Importance="High"/>
@ -41,10 +38,6 @@
<Target Name="BuildNativeWindows"
Condition="'$(OS)' == 'Windows_NT' and '$(TargetsNetFx)' != 'true'">
<PropertyGroup>
<_BuildNativeWindowsArgs>$(_BuildNativeArgs)</_BuildNativeWindowsArgs>
</PropertyGroup>
<!-- Run script that invokes Cmake to create VS files, and then calls msbuild to compile them -->
<Message Text="&quot;$(MSBuildProjectDirectory)\build-native.cmd&quot; $(_BuildNativeArgs)" Importance="High"/>
<Exec Command="&quot;$(MSBuildProjectDirectory)\build-native.cmd&quot; $(_BuildNativeArgs)" />

View File

@ -1,398 +1,87 @@
#!/usr/bin/env bash
usage()
{
echo "Our parameters changed! The parameters: buildArch, buildType, buildOS, numProc"
echo "are passed by the Run Command Tool."
echo "If you plan to only run this script, be sure to pass those parameters."
echo "For more information type build-native.sh -? at the root of the repo."
echo
echo "Usage: $0 [runParameters][-verbose] [-clangx.y] [-gccx.y] [-cross] [-staticLibLink] [-cmakeargs] [-makeargs]"
echo "runParameters: buildArch, buildType, buildOS, -numProc <numproc value>"
echo "BuildArch can be: -x64, -x86, -arm, -armel, -arm64"
echo "BuildType can be: -debug, -checked, -release"
echo "-verbose - optional argument to enable verbose build output."
echo "-clangx.y - optional argument to build using clang version x.y."
echo "-gccx.y - optional argument to build using gcc version x.y."
echo "-cross - optional argument to signify cross compilation,"
echo " - will use ROOTFS_DIR environment variable if set."
echo "-staticLibLink - Optional argument to statically link any native library."
echo "-portable - Optional argument to build native libraries portable over GLIBC based Linux distros."
echo "-stripSymbols - Optional argument to strip native symbols during the build."
echo "-skipgenerateversion - Pass this in to skip getting a version on the build output."
echo "-cmakeargs - user-settable additional arguments passed to CMake."
exit 1
}
usage_list=("-outconfig: Configuration, typically a quadruplet such as 'netcoreapp5.0-Linux-Release-x64', used to name output directory.")
usage_list+=("-staticLibLink: Optional argument to statically link any native library.")
__scriptpath=$(cd "$(dirname "$0")"; pwd -P)
__nativeroot=$__scriptpath/Unix
__rootRepo=$(cd "$__scriptpath/../../.."; pwd -P)
__artifactsDir="$__rootRepo/artifacts"
__scriptpath="$(cd "$(dirname "$0")"; pwd -P)"
__nativeroot="$__scriptpath"/Unix
__RepoRootDir="$(cd "$__scriptpath"/../../..; pwd -P)"
__artifactsDir="$__RepoRootDir/artifacts"
initHostDistroRid()
{
__HostDistroRid=""
if [ "$__HostOS" == "Linux" ]; then
if [ -e /etc/os-release ]; then
source /etc/os-release
if [[ $ID == "alpine" ]]; then
# remove the last version digit
VERSION_ID=${VERSION_ID%.*}
fi
__HostDistroRid="$ID.$VERSION_ID-$__HostArch"
fi
elif [ "$__HostOS" == "OSX" ]; then
_osx_version=`sw_vers -productVersion | cut -f1-2 -d'.'`
__HostDistroRid="osx.$_osx_version-x64"
elif [ "$__HostOS" == "FreeBSD" ]; then
__freebsd_version=`sysctl -n kern.osrelease | cut -f1 -d'-'`
__HostDistroRid="freebsd.$__freebsd_version-x64"
fi
handle_arguments() {
if [ "$__HostDistroRid" == "" ]; then
echo "WARNING: Can not determine runtime id for current distro."
fi
}
initTargetDistroRid()
{
if [ $__CrossBuild == 1 ]; then
if [ "$__BuildOS" == "Linux" ]; then
if [ ! -e $ROOTFS_DIR/etc/os-release ]; then
echo "WARNING: Can not determine runtime id for current distro."
export __DistroRid=""
else
source $ROOTFS_DIR/etc/os-release
export __DistroRid="$ID.$VERSION_ID-$__BuildArch"
fi
fi
else
export __DistroRid="$__HostDistroRid"
fi
}
setup_dirs()
{
echo Setting up directories for build
mkdir -p "$__BinDir"
mkdir -p "$__IntermediatesDir"
}
# Check the system to ensure the right pre-reqs are in place
check_native_prereqs()
{
echo "Checking pre-requisites..."
# Check presence of CMake on the path
hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }
}
prepare_native_build()
{
# Specify path to be set for CMAKE_INSTALL_PREFIX.
# This is where all built CoreClr libraries will copied to.
export __CMakeBinDir="$__BinDir"
# Configure environment if we are doing a verbose build
if [ $__VerboseBuild == 1 ]; then
export VERBOSE=1
fi
# Generate version.c if specified, else have an empty one.
__versionSourceFile=$__artifactsDir/obj/_version.c
if [ ! -e "${__versionSourceFile}" ]; then
__versionSourceLine="static char sccsid[] __attribute__((used)) = \"@(#)No version information produced\";"
echo "${__versionSourceLine}" > ${__versionSourceFile}
fi
}
build_native()
{
# All set to commence the build
echo "Commencing build of corefx native components for $__BuildOS.$__BuildArch.$__BuildType"
cd "$__IntermediatesDir"
if [ "$__BuildArch" == "wasm" ]; then
if [ "$EMSDK_PATH" == "" ]; then
echo "Error: Should set EMSDK_PATH environment variable pointing to emsdk root."
exit 1
fi
source $EMSDK_PATH/emsdk_env.sh
fi
# Regenerate the CMake solution
engNativeDir="$__rootRepo/eng/native"
__CMakeExtraArgs="$__CMakeExtraArgs -DCLR_ENG_NATIVE_DIR=\"$engNativeDir\""
nextCommand="\"$engNativeDir/gen-buildsys.sh\" \"$__nativeroot\" \"$__nativeroot\" \"$__IntermediatesDir\" $__BuildArch $__Compiler \"$__CompilerMajorVersion\" \"$__CompilerMinorVersion\" $__BuildType $__CMakeArgs $__CMakeExtraArgs"
echo "Invoking $nextCommand"
eval "$nextCommand"
if [ $? != 0 ]; then
echo "Failed to generate $message build project!"
exit 1
fi
# Check that the makefiles were created.
if [ ! -f "$__IntermediatesDir/CMakeCache.txt" ]; then
echo "Unable to find generated build files for native component project!"
exit 1
fi
# Build
echo "Executing make install -j $__NumProc $__MakeExtraArgs"
make install -j $__NumProc $__MakeExtraArgs
if [ $? != 0 ]; then
echo "Failed to build corefx native components."
exit 1
fi
}
# Set the various build properties here so that CMake and MSBuild can pick them up
__CMakeExtraArgs=""
__MakeExtraArgs=""
__BuildArch=x64
__BuildType=Debug
__CMakeArgs=DEBUG
__BuildOS=Linux
__NumProc=1
__UnprocessedBuildArgs=
__CrossBuild=0
__ServerGC=0
__VerboseBuild=false
__Compiler=clang
__CompilerMajorVersion=
__CompilerMinorVersion=
__StaticLibLink=0
__PortableBuild=0
CPUName=$(uname -m)
if [ "$CPUName" == "i686" ]; then
__BuildArch=x86
fi
# Use uname to determine what the OS is.
OSName=$(uname -s)
case $OSName in
Linux)
__BuildOS=Linux
__HostOS=Linux
;;
Darwin)
__BuildOS=OSX
__HostOS=OSX
;;
FreeBSD)
__BuildOS=FreeBSD
__HostOS=FreeBSD
;;
OpenBSD)
__BuildOS=OpenBSD
__HostOS=OpenBSD
;;
NetBSD)
__BuildOS=NetBSD
__HostOS=NetBSD
;;
SunOS)
__BuildOS=SunOS
__HostOS=SunOS
;;
*)
echo "Unsupported OS $OSName detected, configuring as if for Linux"
__BuildOS=Linux
__HostOS=Linux
;;
esac
while :; do
if [ $# -le 0 ]; then
break
fi
lowerI="$(echo $1 | awk '{print tolower($0)}')"
case $lowerI in
-\?|-h|--help)
usage
exit 1
;;
x86|-x86)
__BuildArch=x86
;;
x64|-x64)
__BuildArch=x64
;;
arm|-arm)
__BuildArch=arm
;;
armel|-armel)
__BuildArch=armel
;;
arm64|-arm64)
__BuildArch=arm64
;;
wasm|-wasm)
__BuildArch=wasm
;;
debug|-debug)
__BuildType=Debug
;;
release|-release)
__BuildType=Release
__CMakeArgs=RELEASE
;;
case "$1" in
outconfig|-outconfig)
__outConfig=$2
shift
;;
freebsd|FreeBSD|-freebsd|-FreeBSD)
__BuildOS=FreeBSD
;;
linux|-linux)
__BuildOS=Linux
;;
netbsd|-netbsd)
__BuildOS=NetBSD
;;
osx|-osx)
__BuildOS=OSX
;;
stripsymbols|-stripsymbols)
__CMakeExtraArgs="$__CMakeExtraArgs -DSTRIP_SYMBOLS=true"
;;
numproc|-numproc|--numproc)
shift
__NumProc=$1
;;
verbose|-verbose)
__VerboseBuild=1
__outConfig="$2"
__ShiftArgs=1
;;
staticliblink|-staticliblink)
__StaticLibLink=1
;;
portable|-portable)
# Portable native components are only supported on Linux
if [ "$__HostOS" == "Linux" ]; then
__PortableBuild=1
fi
;;
clang*|-clang*|--clang*)
__Compiler=clang
# clangx.y or clang-x.y
version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
parts=(${version//./ })
__CompilerMajorVersion="${parts[0]}"
__CompilerMinorVersion="${parts[1]}"
if [ -z "$__CompilerMinorVersion" ] && [ "$__CompilerMajorVersion" -le 6 ]; then
__CompilerMinorVersion=0;
fi
;;
gcc*|-gcc*)
__Compiler=gcc
# gccx.y or gcc-x.y
version="$(echo "$lowerI" | tr -d '[:alpha:]-=')"
parts=(${version//./ })
__CompilerMajorVersion="${parts[0]}"
__CompilerMinorVersion="${parts[1]}"
;;
cross|-cross)
__CrossBuild=1
;;
cmakeargs|-cmakeargs)
if [ -n "$2" ]; then
__CMakeExtraArgs="$__CMakeExtraArgs $2"
shift
else
echo "ERROR: 'cmakeargs' requires a non-empty option argument"
exit 1
fi
;;
makeargs|-makeargs)
if [ -n "$2" ]; then
__MakeExtraArgs="$__MakeExtraArgs $2"
shift
else
echo "ERROR: 'makeargs' requires a non-empty option argument"
exit 1
fi
;;
useservergc|-useservergc)
__ServerGC=1
;;
*)
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
esac
}
shift
done
# Set the various build properties here so that CMake and MSBuild can pick them up
__BuildArch=x64
__BuildOS=Linux
__BuildType=Debug
__CMakeArgs=""
__Compiler=clang
__CompilerMajorVersion=
__CompilerMinorVersion=
__CrossBuild=0
__IsMSBuildOnNETCoreSupported=0
__PortableBuild=1
__RootBinDir="$__RepoRootDir/artifacts"
__SkipConfigure=0
__SkipGenerateVersion=0
__StaticLibLink=0
__UnprocessedBuildArgs=
__VerboseBuild=false
source "$__RepoRootDir"/eng/native/build-commons.sh
# Set cross build
if [ $__BuildArch != wasm ]; then
__CMakeExtraArgs="$__CMakeExtraArgs -DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild"
__CMakeExtraArgs="$__CMakeExtraArgs -DCMAKE_STATIC_LIB_LINK=$__StaticLibLink"
if [[ "$__BuildArch" != wasm ]]; then
__CMakeArgs="-DFEATURE_DISTRO_AGNOSTIC_SSL=$__PortableBuild $__CMakeArgs"
__CMakeArgs="-DCMAKE_STATIC_LIB_LINK=$__StaticLibLink $__CMakeArgs"
case $CPUName in
i686)
if [ $__BuildArch != x86 ]; then
__CrossBuild=1
echo "Set CrossBuild for $__BuildArch build"
fi
;;
x86_64)
if [ $__BuildArch != x64 ]; then
__CrossBuild=1
echo "Set CrossBuild for $__BuildArch build"
fi
;;
esac
if [[ "$__BuildArch" != x86 && "$__BuildArch" != x64 ]]; then
__CrossBuild=1
echo "Set CrossBuild for $__BuildArch build"
fi
else
if [[ -z "$EMSDK_PATH" ]]; then
echo "Error: Should set EMSDK_PATH environment variable pointing to emsdk root."
exit 1
fi
source "$EMSDK_PATH"/emsdk_env.sh
fi
# set default OSX deployment target
if [[ $__BuildOS == OSX ]]; then
__CMakeExtraArgs="$__CMakeExtraArgs -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13"
if [[ "$__BuildOS" == OSX ]]; then
__CMakeArgs="-DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 $__CMakeArgs"
fi
# Set the remaining variables based upon the determined build configuration
__outConfig=${__outConfig:-"$__BuildOS-$__BuildArch-$__BuildType"}
__IntermediatesDir="$__artifactsDir/obj/native/$__outConfig"
__BinDir="$__artifactsDir/bin/native/$__outConfig"
__outConfig="${__outConfig:-"$__BuildOS-$__BuildArch-$__BuildType"}"
__IntermediatesDir="$__RootBinDir/obj/native/$__outConfig"
__BinDir="$__RootBinDir/bin/native/$__outConfig"
# Specify path to be set for CMAKE_INSTALL_PREFIX.
# This is where all built CoreClr libraries will copied to.
__CMakeBinDir="$__BinDir"
export __CMakeBinDir
# Make the directories necessary for build if they don't exist
setup_dirs
# Configure environment if we are doing a cross compile.
if [ "$__CrossBuild" == 1 ]; then
export CROSSCOMPILE=1
if ! [[ -n "$ROOTFS_DIR" ]]; then
export ROOTFS_DIR="$__rootRepo/.tools/rootfs/$__BuildArch"
fi
fi
# Check prereqs.
check_prereqs
# init the host distro name
initHostDistroRid
# init the target distro name
initTargetDistroRid
# Check prereqs.
check_native_prereqs
# Prepare the system
prepare_native_build
# Build the corefx native components.
build_native
# Build the corefx native components.
build_native "$__BuildArch" "$__nativeroot" "$__nativeroot" "$__IntermediatesDir" "native libraries component"

View File

@ -125,6 +125,7 @@ namespace Microsoft.CSharp
break;
case '\u2028':
case '\u2029':
case '\u0085':
AppendEscapedChar(b, value[i]);
break;

View File

@ -1054,7 +1054,8 @@ namespace System.CodeDom.Compiler.Tests
}
[Fact]
public void CharEncoding()
[ActiveIssue("https://github.com/dotnet/runtime/issues/1913", ~TargetFrameworkMonikers.NetFramework)]
public void CharEncodingNetFx()
{
string chars = "\u1234 \u4567 \uABCD \r \n \t \\ \" \' \0 \u2028 \u2029 \u0084 \u0085 \U00010F00";
@ -1070,6 +1071,24 @@ namespace System.CodeDom.Compiler.Tests
"}");
}
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/1913", TargetFrameworkMonikers.NetFramework)]
public void CharEncoding()
{
string chars = "\u1234 \u4567 \uABCD \r \n \t \\ \" \' \0 \u2028 \u2029 \u0084 \u0085 \U00010F00";
var main = new CodeEntryPointMethod();
main.Statements.Add(
new CodeMethodInvokeExpression(
new CodeMethodReferenceExpression(new CodeTypeReferenceExpression(typeof(Console)), "WriteLine"),
new CodeExpression[] { new CodePrimitiveExpression(chars) }));
AssertEqual(main,
"public static void Main() { " +
" System.Console.WriteLine(\"\u1234 \u4567 \uABCD \\r \\n \\t \\\\ \\\" \\' \\0 \\u2028 \\u2029 \u0084 \\u0085 \U00010F00\"); " +
"}");
}
[Fact]
public void DefaultValues()
{
@ -3449,5 +3468,22 @@ namespace System.CodeDom.Compiler.Tests
}
}");
}
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/1913", TargetFrameworkMonikers.NetFramework)]
public void SpecialNewLineCharactersInStringsDoneCorrectly()
{
var cd = new CodeTypeDeclaration("ClassWithStringFields") { IsClass = true };
var field = new CodeMemberField("System.String", "StringWithSpecialNewLines");
field.Attributes = MemberAttributes.Public | MemberAttributes.Static;
field.InitExpression = new CodePrimitiveExpression("\u0085\u2028\u2029");
cd.Members.Add(field);
AssertEqual(cd,
@"public class ClassWithStringFields {
public static string StringWithSpecialNewLines = ""\u0085\u2028\u2029"";
}");
}
}
}

View File

@ -2965,6 +2965,95 @@
"any",
"base"
],
"tizen.5.5.0": [
"tizen.5.5.0",
"tizen.5.0.0",
"tizen.4.0.0",
"tizen",
"linux",
"unix",
"any",
"base"
],
"tizen.5.5.0-armel": [
"tizen.5.5.0-armel",
"tizen.5.5.0",
"tizen.5.0.0-armel",
"tizen.5.0.0",
"tizen.4.0.0-armel",
"tizen.4.0.0",
"tizen-armel",
"tizen",
"linux-armel",
"linux",
"unix-armel",
"unix",
"any",
"base"
],
"tizen.5.5.0-x86": [
"tizen.5.5.0-x86",
"tizen.5.5.0",
"tizen.5.0.0-x86",
"tizen.5.0.0",
"tizen.4.0.0-x86",
"tizen.4.0.0",
"tizen-x86",
"tizen",
"linux-x86",
"linux",
"unix-x86",
"unix",
"any",
"base"
],
"tizen.6.0.0": [
"tizen.6.0.0",
"tizen.5.5.0",
"tizen.5.0.0",
"tizen.4.0.0",
"tizen",
"linux",
"unix",
"any",
"base"
],
"tizen.6.0.0-armel": [
"tizen.6.0.0-armel",
"tizen.6.0.0",
"tizen.5.5.0-armel",
"tizen.5.5.0",
"tizen.5.0.0-armel",
"tizen.5.0.0",
"tizen.4.0.0-armel",
"tizen.4.0.0",
"tizen-armel",
"tizen",
"linux-armel",
"linux",
"unix-armel",
"unix",
"any",
"base"
],
"tizen.6.0.0-x86": [
"tizen.6.0.0-x86",
"tizen.6.0.0",
"tizen.5.5.0-x86",
"tizen.5.5.0",
"tizen.5.0.0-x86",
"tizen.5.0.0",
"tizen.4.0.0-x86",
"tizen.4.0.0",
"tizen-x86",
"tizen",
"linux-x86",
"linux",
"unix-x86",
"unix",
"any",
"base"
],
"ubuntu": [
"ubuntu",
"debian",

View File

@ -1346,6 +1346,40 @@
"tizen.4.0.0-x86"
]
},
"tizen.5.5.0": {
"#import": [
"tizen.5.0.0"
]
},
"tizen.5.5.0-armel": {
"#import": [
"tizen.5.5.0",
"tizen.5.0.0-armel"
]
},
"tizen.5.5.0-x86": {
"#import": [
"tizen.5.5.0",
"tizen.5.0.0-x86"
]
},
"tizen.6.0.0": {
"#import": [
"tizen.5.5.0"
]
},
"tizen.6.0.0-armel": {
"#import": [
"tizen.6.0.0",
"tizen.5.5.0-armel"
]
},
"tizen.6.0.0-x86": {
"#import": [
"tizen.6.0.0",
"tizen.5.5.0-x86"
]
},
"ubuntu": {
"#import": [
"debian"

View File

@ -134,7 +134,7 @@
<RuntimeGroup Include="tizen">
<Parent>linux</Parent>
<Architectures>x86;armel</Architectures>
<Versions>4.0.0;5.0.0</Versions>
<Versions>4.0.0;5.0.0;5.5.0;6.0.0</Versions>
</RuntimeGroup>
<RuntimeGroup Include="ubuntu">

View File

@ -1187,7 +1187,7 @@ static MonoClass*
make_generic_param_class (MonoGenericParam *param)
{
MonoClass *klass, **ptr;
int count, pos, i;
int count, pos, i, min_align;
MonoGenericParamInfo *pinfo = mono_generic_param_info (param);
MonoGenericContainer *container = mono_generic_param_owner (param);
g_assert_checked (container);
@ -1260,13 +1260,12 @@ make_generic_param_class (MonoGenericParam *param)
/* We don't use type_token for VAR since only classes can use it (not arrays, pointer, VARs, etc) */
klass->sizes.generic_param_token = !is_anonymous ? pinfo->token : 0;
/*Init these fields to sane values*/
klass->min_align = 1;
/*
* This makes sure the the value size of this class is equal to the size of the types the gparam is
* constrained to, the JIT depends on this.
*/
klass->instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_stack_size_internal (m_class_get_byval_arg (klass), NULL, TRUE);
klass->instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_size (m_class_get_byval_arg (klass), &min_align);
klass->min_align = min_align;
mono_memory_barrier ();
klass->size_inited = 1;
@ -3905,7 +3904,7 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_
MonoType *klass_byval_arg = m_class_get_byval_arg (klass);
if (klass_byval_arg->type == MONO_TYPE_VAR || klass_byval_arg->type == MONO_TYPE_MVAR)
instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_stack_size_internal (klass_byval_arg, NULL, TRUE);
instance_size = MONO_ABI_SIZEOF (MonoObject) + mono_type_size (klass_byval_arg, &min_align);
else if (klass_byval_arg->type == MONO_TYPE_PTR)
instance_size = MONO_ABI_SIZEOF (MonoObject) + MONO_ABI_SIZEOF (gpointer);

View File

@ -4898,6 +4898,8 @@ debugger_agent_single_step_from_context (MonoContext *ctx)
g_assert (tls);
tls->terminated = FALSE;
/* Have to save/restore the restore_ctx as we can be called recursively during invokes etc. */
memcpy (&orig_restore_state, &tls->restore_state, sizeof (MonoThreadUnwindState));
mono_thread_state_init_from_monoctx (&tls->restore_state, ctx);
@ -4924,6 +4926,11 @@ debugger_agent_breakpoint_from_context (MonoContext *ctx)
tls = (DebuggerTlsData *)mono_native_tls_get_value (debugger_tls_id);
g_assert (tls);
//if a thread was suspended and doesn't have any managed stack, it was considered as terminated,
//but it wasn't really terminated because it can execute managed code again, and stop in a breakpoint so here we set terminated as FALSE
tls->terminated = FALSE;
memcpy (&orig_restore_state, &tls->restore_state, sizeof (MonoThreadUnwindState));
mono_thread_state_init_from_monoctx (&tls->restore_state, ctx);
memcpy (&tls->handler_ctx, ctx, sizeof (MonoContext));

View File

@ -2249,6 +2249,27 @@ public class Tests
return (c.Foo () == "abcd") ? 0 : 1;
}
#endif
class KvpList<T> {
public T[] array = new T[4];
int size = 0;
[MethodImpl(MethodImplOptions.NoInlining)]
public void MyAdd(T item) {
if (size < (uint)array.Length) {
array [size] = item;
size++;
}
}
}
public static int test_0_regress_18455 () {
var p = new KvpList<KeyValuePair<int, KeyValuePair<int,int>>> ();
KeyValuePair<int, KeyValuePair<int,int>> kvp = new KeyValuePair<int, KeyValuePair<int,int>> (3, new KeyValuePair<int,int> (1, 2));
p.MyAdd (kvp);
return p.array [1].Key == 0 ? 0 : 1;
}
}
// #13191

View File

@ -7186,12 +7186,13 @@ interp_get_resume_state (const MonoJitTlsData *jit_tls, gboolean *has_resume_sta
{
g_assert (jit_tls);
ThreadContext *context = (ThreadContext*)jit_tls->interp_context;
g_assert (context);
*has_resume_state = context->has_resume_state;
if (context->has_resume_state) {
*interp_frame = context->handler_frame;
*handler_ip = (gpointer)context->handler_ip;
}
*has_resume_state = context ? context->has_resume_state : FALSE;
if (!*has_resume_state)
return;
*interp_frame = context->handler_frame;
*handler_ip = (gpointer)context->handler_ip;
}
/*

View File

@ -454,6 +454,14 @@ mono_llvm_add_func_attr (LLVMValueRef func, AttrKind kind)
unwrap<Function> (func)->addAttribute (AttributeList::FunctionIndex, convert_attr (kind));
}
void
mono_llvm_add_func_attr_nv (LLVMValueRef func, const char *attr_name, const char *attr_value)
{
AttrBuilder NewAttrs;
NewAttrs.addAttribute (attr_name, attr_value);
unwrap<Function> (func)->addAttributes (AttributeList::FunctionIndex, NewAttrs);
}
void
mono_llvm_add_param_attr (LLVMValueRef param, AttrKind kind)
{

View File

@ -140,6 +140,9 @@ mono_llvm_set_alignment_ret (LLVMValueRef val, int alignment);
void
mono_llvm_add_func_attr (LLVMValueRef func, AttrKind kind);
void
mono_llvm_add_func_attr_nv (LLVMValueRef func, const char *attr_name, const char *attr_value);
void
mono_llvm_add_param_attr (LLVMValueRef param, AttrKind kind);

View File

@ -8559,6 +8559,9 @@ emit_method_inner (EmitContext *ctx)
mono_llvm_add_func_attr (method, LLVM_ATTR_UW_TABLE);
if (cfg->disable_omit_fp)
mono_llvm_add_func_attr_nv (method, "no-frame-pointer-elim", "true");
if (cfg->compile_aot) {
if (is_externally_callable (ctx, cfg->method)) {
LLVMSetLinkage (method, LLVMExternalLinkage);

View File

@ -1,2 +0,0 @@
/csproj.tmpl crlf
/*.pre crlf

View File

@ -1,3 +0,0 @@
*.mdb
order
order.xml

View File

@ -1 +0,0 @@
$(ProjectDir)\..\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Commons.Xml.Relaxng.Rnc\RncParser.jay > $(ProjectDir)\Commons.Xml.Relaxng.Rnc\RncParser.cs

View File

@ -1,9 +0,0 @@
all: genproj.exe prepare.exe
mono --debug genproj.exe
genproj.exe: genproj.cs ../../mcs/tools/gensources/gensources.cs
-rm $@
csc -debug:portable $^ -main:Driver -r:System.dll -r:System.Core.dll -out:$@
prepare.exe: prepare.cs
csc prepare.cs

View File

@ -1 +0,0 @@
$(ProjectDir)\..\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.jay > $(ProjectDir)\Microsoft.Build.Internal\ExpressionParser.cs

View File

@ -1 +0,0 @@
$(ProjectDir)\..\..\jay\jay.exe -c -o $(ProjectDir)\$(Platform)-parser.cs $(ProjectDir)\..\..\mcs\cs-parser.jay &lt; $(ProjectDir)\..\..\jay\skeleton.cs

View File

@ -1,83 +0,0 @@
README Last updated: 2013-01-09
Visual Studio Build Setup for Mono's Managed Code
=================================================
The scripts in this directory are used to create the various .csproj
for each one of the modules in Mono. To avoid accidentally making
changes on the Makefile system that is not reflected on the csproj
system, the .csproj files are generated from the actual Makefile
settings.
This requires a couple of steps:
* Extract the order, compiler and compilation flags for all
managed code in Mono on Linux by using the existing Makefile
system.
* Generate csproj files from the previous step
The idea is to ensure that we do not miss any compilation flag,
define, resource, reference, icon or any other element that might be
necessary to build the Mono class libraries.
* Extracting the Compilation Metadata
The first step is to extract the compilation metadata from the
existing Makefiles. This is done in stages, first a fully
working Mono compilation setup is required, and second the data
is extracted.
The extraction is done like this, from the toplevel Mono
directory run:
make update-csproj
With this input, it is possible to generate an XML file, to do
this do:
make package-inputs
This will generate order.xml, this contains the ordered list in
which directories must be compiled as well as the command line
options used to build it.
* Generate .csproj and .sln files
Run the genproj.exe executable in this directory.
On Windows:
cd msvc/scripts/
/cygdrive/c/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe genproj.csproj
./genproj.exe
On Mac:
cd msvc/scripts/
make genproj.exe
mono genproj.exe
One output of genproj is the solutions for the successive profiles,
like bcl.sln.
The command
./genproj.exe -h
lists a couple of options, notably to limit the scope of
the output solutions for each profiles to System*.dll assemblies
and dependencies.
* Compiling from Visual Studio
Before you try to compile from Visual Studio, you are *strongly*
advised to set the maximum number of parallel project builds
to 1 (Tools -> Options -> Projects and Solutions -> Build and Run)
Due to the iterative building process for some of Mono's
assemblies, there can be clashes writing to /obj/Debug for
some projects
* KNOWN ISSUES
* We do not have an "install" target, perhaps we should generate
this based on something similar to the update-csproj setup
* Audit: every Makefile for "local" changes, as those are not
visible to this tool.

View File

@ -1,6 +0,0 @@
@MONO@ RabbitMQ.Client.Apigen.exe /n:v0_9 "/apiName:AMQP_0_9" $(ProjectDir)..\..\docs\specs\amqp0-9.stripped.xml $(ProjectDir)..\..\docs\specs\net_4_x-api-0-9.cs
@MONO@ RabbitMQ.Client.Apigen.exe /n:v0_8 "/apiName:AMQP_0_8" $(ProjectDir)..\..\docs\specs\amqp0-8.stripped.xml $(ProjectDir)..\..\docs\specs\net_4_x-api-0-8.cs
@MONO@ RabbitMQ.Client.Apigen.exe /n:v0_8qpid "/apiName:AMQP_0_8_QPID" $(ProjectDir)..\..\docs\specs\qpid-amqp.0-8.stripped.xml $(ProjectDir)..\..\docs\specs\net_4_x-api-qpid-0-8.cs

View File

@ -1,2 +0,0 @@
set CULEVELPATH=$([MSBuild]::ValueOrDefault($([MSBuild]::GetDirectoryNameOfFileAbove($(TargetDir), culevel.exe)), "$(TargetDir)"))\culevel.exe
@MONO@ %CULEVELPATH% -o $(ProjectDir)\System.Web\UplevelHelper.cs $(ProjectDir)\UplevelHelperDefinitions.xml

View File

@ -1,12 +0,0 @@
These are the tasks that are pending in the MSVC scripts to fully roll it out:
[ ] Validate that all generated assemblies are identical
[ ] Add support for listing CLEAN_FILES in the `csproj` file
[ ] Adding an "install" target
[ ] On Windows- have a solution that builds both runtime and libraries all in one
[ ] Add the other profiles (mobile, iOS, etc)
[ ] Generate the dependency files
[ ] Eliminate the need for "build-libs.sh/build-libs.bat" at the toplevel with proper MSBuild idioms
[ ] Integrate the "update-solution-files" with each build, so we auto-update the files on commits
[ ] Make it work with MSBuild instead of xbuild
[x] Design a system for listing resources, so we avoid the ".pre" that runs resgen or copy by hand, because this ruins dependencies. Alternatively, have @COPY@ be a "Copy if newer"

View File

@ -1,4 +0,0 @@
"$(MSBuildFrameworkToolsPath)\Ilasm.exe" /dll /noautoinherit /out:"$(TargetPath).il.tmp" "$(ProjectDir)\..\..\class\corlib\System.Runtime.CompilerServices\Unsafe.il"
move "$(TargetPath)" "$(TargetPath).tmp"
"$(ProjectDir)\..\..\build\cil-stringreplacer.exe" --mscorlib-debug --ilreplace="$(TargetPath).il.tmp" "$(TargetPath).tmp"
move "$(TargetPath).tmp" "$(TargetPath)"

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">net_4_x</Platform>
<ProjectGuid>@PROJECTGUID@</ProjectGuid>
<OutputType>@OUTPUTTYPE@</OutputType>
<NoWarn>@DISABLEDWARNINGS@</NoWarn>
<LangVersion>@LANGVERSION@</LangVersion>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">macos</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
@NOSTDLIB@
@METADATAVERSION@
@STARTUPOBJECT@
@NOCONFIG@
@ALLOWUNSAFE@
<AssemblyName>@ASSEMBLYNAME@</AssemblyName>
<TargetFrameworkVersion>v@FX_VERSION@</TargetFrameworkVersion>
@SIGNATURE@
</PropertyGroup>
<PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<!-- @ALL_PROFILE_PROPERTIES@ -->
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<!-- TRACE is set only for Debug configuration, so inherit from platform-specific value -->
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- @BUILT_SOURCES@ -->
<!-- @ALL_SOURCES@ -->
<!-- @COMMON_PROJECT_REFERENCES@ -->
<!-- @ALL_REFERENCES@ -->
<!-- @ALL_RESOURCES@ -->
<PropertyGroup>
<!-- Force the pre-build event to run after references have been resolved. The default
behavior is to run them before resolving references, which can cause things like
culevel.exe to be used before they have been built. -->
<PreBuildEventDependsOn>ResolveReferences</PreBuildEventDependsOn>
</PropertyGroup>
@PREBUILD_POSTBUILD@
</Project>

View File

@ -1,108 +0,0 @@
using System;
using System.IO;
using System.Reflection;
using System.Diagnostics;
using System.Text;
using System.Text.RegularExpressions;
public static class Program {
public static int Main (string[] args) {
var myAssembly = Assembly.GetExecutingAssembly ();
var codeBase = new Uri (myAssembly.CodeBase);
var executablePath = Path.GetFullPath (codeBase.LocalPath);
var executableDirectory = Path.GetDirectoryName (executablePath);
var winsetupDirectory = Path.Combine (executableDirectory, "..");
var winsetupPath = Path.Combine (winsetupDirectory, "winsetup.bat");
var psi = new ProcessStartInfo (winsetupPath) {
WorkingDirectory = winsetupDirectory,
UseShellExecute = false,
ErrorDialog = false,
RedirectStandardOutput = true
};
string monoVersion, monoCorlibVersion;
Process winsetupProcess;
try {
winsetupProcess = Process.Start (psi);
} catch (Exception exc) {
Console.Error.WriteLine ("Failed starting winsetup.bat");
Console.Error.WriteLine (exc);
return 1;
}
using (winsetupProcess) {
var outputBuffer = new StringBuilder ();
winsetupProcess.OutputDataReceived += (s, e) => {
outputBuffer.AppendLine (e.Data);
};
winsetupProcess.BeginOutputReadLine ();
winsetupProcess.WaitForExit ();
var output = outputBuffer.ToString ().Trim ();
if (winsetupProcess.ExitCode != 0) {
Console.Error.WriteLine ("Failed running winsetup.bat");
Console.Write (output);
return winsetupProcess.ExitCode;
} else {
var configDirectory = Path.Combine (executableDirectory, "..", "..");
var configPath = Path.Combine (configDirectory, "config.h");
if (!File.Exists (configPath)) {
Console.Error.WriteLine ($"File not found: {configPath}");
return 1;
}
var configData = File.ReadAllText (configPath);
var m = Regex.Match (configData, @"#define.*VERSION.*""([0-9.]+)""");
if (!m.Success)
return 1;
monoVersion = m.Groups[1].Value;
// HACK: winsetup.bat produces N.N.N instead of N.N.N.N like configure.ac,
// so we add .0's to match the Consts.cs generated by make
while (monoVersion.Split ('.').Length < 4)
monoVersion += ".0";
Console.WriteLine ($"MONO_VERSION={monoVersion}");
m = Regex.Match (configData, @"#define.*MONO_CORLIB_VERSION.*""([^\\s]+)""");
if (!m.Success)
return 1;
monoCorlibVersion = m.Groups[1].Value;
Console.WriteLine ($"MONO_CORLIB_VERSION=\"{monoCorlibVersion}\"");
}
}
var constsDirectory = Path.Combine (executableDirectory, "..", "..", "mcs", "build", "common");
var constsTemplatePath = Path.Combine (constsDirectory, "Consts.cs.in");
if (!Directory.Exists (constsDirectory) || !File.Exists (constsTemplatePath)) {
Console.Error.WriteLine ($"File not found: {constsTemplatePath}");
return 1;
}
var resultPath = Path.GetFullPath (Path.Combine (constsDirectory, "Consts.cs"));
var templateText = File.ReadAllText (constsTemplatePath);
var resultText = templateText.Replace ("@MONO_VERSION@", monoVersion)
.Replace ("@MONO_CORLIB_VERSION@", monoCorlibVersion);
if (File.Exists (resultPath)) {
var existingText = File.ReadAllText (resultPath);
if (existingText.Trim () == resultText.Trim ()) {
Console.WriteLine ($"{resultPath} not changed");
return 0;
}
}
File.WriteAllText (resultPath, resultText);
Console.WriteLine ($"Generated {resultPath} successfully");
return 0;
}
}

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">Any CPU</Platform>
<OutputType>Exe</OutputType>
<AssemblyName>genconsts</AssemblyName>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<OutputPath>.\</OutputPath>
<ProjectGuid>{702AE2C0-71DD-4112-9A06-E4FABCA59986}</ProjectGuid>
<RunPostBuildEvent>Always</RunPostBuildEvent>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>cd $(MSBuildProjectDirectory)
$(TargetPath)</PostBuildEvent>
</PropertyGroup>
<ItemGroup>
<Compile Include="genconsts.cs" />
<Reference Include="System" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +0,0 @@
$(ProjectDir)\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\parser\ILParser.jay > $(ProjectDir)\ILParser.cs

View File

@ -1,2 +0,0 @@
$(ProjectDir)\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\jay\skeleton.cs $(ProjectDir)\cs-parser.jay > $(ProjectDir)\cs-parser.cs

View File

@ -1,2 +0,0 @@
$(ProjectDir)\..\..\jay\jay.exe -ct &lt; $(ProjectDir)\..\..\jay\skeleton.cs $(ProjectDir)\Monodoc.Ecma\EcmaUrlParser.jay > $(ProjectDir)\Monodoc.Ecma\EcmaUrlParser.cs

View File

@ -1,140 +0,0 @@
//
// This is a wrapper used to invoke one of the Mono C#
// compilers with the correct MONO_PATH depending on
// where this command is located.
//
// This allows us to use MSBuild CscToolPath property to
// point to this directory to use our compiler to drive
// the build and set the MONO_PATH as it is expected to
// be for bootstrap
//
// The MONO_PATH and the compiler are chosen based on the
// directory that hosts the command.
//
// The directory specifies a profile, and the format is:
// PROFILES-COMPILER
//
// Will request that the COMPILER compiler is used setting
// MONO_PATH to PROFILES. The PROFILES string can contain
// multiple directories, separated by dashes.
//
// COMPILER is one of:
// basic -> class/lib/basic/mcs.exe
// net_1_1_bootstrap -> class/lib/net_1_1_bootstrap/mcs.exe
// net_1_1 -> class/lib/net_1_1/mcs.exe
// net_2_0_bootstrap -> class/lib/net_2_0_bootstrap/gmcs.exe
// gmcs -> mcs/gmcs.exe
// moonlight_bootstrap -> class/lib/moonlight_bootstrap/smcs.exe
// moonlight_raw -> class/lib/moonlight_raw/smcs.exe
//
// So for example:
// moonlight_bootstrap-net_2_0-moonlight_bootstrap
//
// Will set MONO_PATH to "%MCS_ROOT%\class\lib\moonlight_bootstrap;%MCS_ROOT\class\lib\net_2_0"
// and run the compiler in %MCS_ROOT%\class\lib\moonlight_bootstrap
//
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Diagnostics;
namespace csc
{
class Program
{
static int Main(string[] args)
{
string cmd = Environment.GetCommandLineArgs () [0];
string tool = Path.GetFileName(cmd);
string profile = Path.GetDirectoryName(cmd);
int p = profile.LastIndexOf('\\');
if (p == -1) {
Console.Error.WriteLine("Could not find the profile name from this {0}", profile);
return 1;
}
profile = profile.Substring(p+1);
var root_mono = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(cmd), "..\\..\\.."));
if (!File.Exists(Path.Combine(root_mono, "mono\\mini\\mini.c"))) {
Console.WriteLine("My root is incorrect {0} based on {1}", root_mono, cmd);
Console.WriteLine("Must be in mono/msvc/scripts/PROFILE/COMMAND.exe");
return 1;
}
p = profile.LastIndexOf ('-');
if (p == -1){
Console.Error.WriteLine("The directory holding this executable should be MPATHS-COMPILER, instead it is: {0}", profile);
return 1;
}
var root_mcs = Path.GetFullPath (Path.Combine (root_mono, "..\\mcs"));
var mono_cmd = root_mono + "\\msvc\\Win32_Debug_eglib\\bin\\mono.exe";
string compiler = null;
switch (profile.Substring (p+1)){
case "basic":
compiler = root_mcs + "\\class\\lib\\basic\\mcs.exe";
break;
case "net_1_1_bootstrap":
compiler = root_mcs + "\\class\\lib\\net_1_1_bootstrap\\mcs.exe";
break;
case "net_1_1":
compiler = root_mcs + "\\class\\lib\\net_1_1\\mcs.exe";
break;
case "net_2_0_bootstrap":
compiler = root_mcs + "\\class\\lib\\net_2_0_bootstrap\\gmcs.exe";
break;
case "gmcs":
case "mcs":
compiler = root_mcs + "\\mcs\\gmcs.exe";
break;
case "moonlight_bootstrap":
compiler = root_mcs + "\\class\\lib\\moonlight_bootstrap\\smcs.exe";
break;
case "moonlight_raw":
compiler = root_mcs + "\\class\\lib\\moonlight_raw\\smcs.exe";
break;
default:
Console.WriteLine ("Unknown compiler configuration: {0}", profile.Substring (p+1));
return 1;
}
var paths = profile.Substring (0, p).Split (new char [] { '-' });
StringBuilder sb = new StringBuilder ();
foreach (string dir in paths){
if (sb.Length != 0)
sb.Append (";");
sb.Append (root_mcs + "\\class\\lib\\" + dir);
}
Environment.SetEnvironmentVariable ("MONO_PATH", sb.ToString ());
Console.WriteLine ("Compiler: {0}", compiler);
Console.WriteLine ("MONO_PATH: {0}", sb.ToString ());
var pi = new ProcessStartInfo() {
FileName = mono_cmd,
WindowStyle = ProcessWindowStyle.Hidden,
Arguments = compiler + " " + String.Join (" ", args),
UseShellExecute = false
};
try {
var proc = Process.Start (pi);
proc.WaitForExit ();
return proc.ExitCode;
} catch (System.ComponentModel.Win32Exception){
Console.Error.WriteLine ("Chances are, it did not find {0}", mono_cmd);
throw;
}
}
}
}

View File

@ -1,86 +0,0 @@
//
// C# implementation of a handful of shell steps
// this is used to automate the buidl in Windows
//
using System;
using System.Text;
using System.IO;
class Prepare {
delegate void filt (StreamReader sr, StreamWriter sw);
static void Filter (string inpath, string outpath, filt filter)
{
using (var ins = new StreamReader (inpath)){
using (var outs = new StreamWriter (outpath)){
filter (ins, outs);
}
}
}
static void SystemDataConnectionReplace (string srcdir, string targetdir, string target, string ns, string factory, string conn)
{
var t = File.ReadAllText (Path.Combine (srcdir, "DbConnectionHelper.cs"));
File.WriteAllText (Path.Combine (targetdir, target), t.Replace ("NAMESPACE", ns).Replace ("CONNECTIONFACTORYOBJECTNAME", factory).Replace ("CONNECTIONOBJECTNAME", conn));
}
static void SystemDataParameterReplace (string srcdir, string targetdir, string target, string resns, string ns, string parname)
{
var t = File.ReadAllText (Path.Combine (srcdir, "DbParameterHelper.cs"));
File.WriteAllText (Path.Combine (targetdir, target), t.Replace ("RESNAMESPACE", resns).Replace ("NAMESPACE", ns).Replace ("PARAMETEROBJECTNAME", parname));
}
static void SystemDataParameterCollReplace (string srcdir, string targetdir, string target, string resns, string ns, string parname)
{
var t = File.ReadAllText (Path.Combine (srcdir, "DbParameterCollectionHelper.cs"));
Console.WriteLine ("Creating " + Path.Combine (targetdir, target));
File.WriteAllText (Path.Combine (targetdir, target), t.Replace ("RESNAMESPACE", resns).Replace ("PARAMETERCOLLECTIONOBJECTNAME", parname + "Collection").Replace ("NAMESPACE", ns).Replace ("PARAMETEROBJECTNAME", parname));
}
static void GenerateSystemData (string bdir)
{
var rs = Path.Combine (bdir, "class", "referencesource", "System.Data", "System", "Data", "ProviderBase");
var sd = Path.Combine (bdir, "class", "System.Data");
SystemDataConnectionReplace (rs, sd, "gen_OdbcConnection.cs", "System.Data.Odbc", "OdbcConnectionFactory.SingletonInstance", "OdbcConnection");
SystemDataConnectionReplace (rs, sd, "gen_OleDbConnection.cs", "System.Data.OleDb", "OleDbConnectionFactory.SingletonInstance", "OleDbConnection");
SystemDataConnectionReplace (rs, sd, "gen_SqlConnection.cs", "System.Data.SqlClient", "SqlConnectionFactory.SingletonInstance", "SqlConnection");
SystemDataParameterReplace (rs, sd, "gen_OdbcParameter.cs", "System.Data", "System.Data.Odbc", "OdbcParameter");
SystemDataParameterReplace (rs, sd, "gen_OleDbParameter.cs", "System.Data", "System.Data.OleDb", "OleDbParameter");
SystemDataParameterReplace (rs, sd, "gen_SqlParameter.cs", "System.Data", "System.Data.SqlClient", "SqlParameter");
SystemDataParameterCollReplace (rs, sd, "gen_OdbcParameterCollection.cs", "System.Data", "System.Data.Odbc", "OdbcParameter");
SystemDataParameterCollReplace (rs, sd, "gen_OleDbParameterCollection.cs", "System.Data", "System.Data.OleDb", "OleDbParameter");
SystemDataParameterCollReplace (rs, sd, "gen_SqlParameterCollection.cs", "System.Data", "System.Data.SqlClient", "SqlParameter");
}
static void Main (string [] args)
{
string bdir = args.Length == 0 ? "../../../mcs" : args [0];
if (!Directory.Exists (Path.Combine(bdir, "class"))){
Console.Error.WriteLine ("The directory {0} does not contain class at {1}", Path.GetFullPath (bdir), Environment.CurrentDirectory);
Environment.Exit (1);
}
switch (args [1]){
case "core":
Filter (bdir + "/build/common/Consts.cs.in",
bdir + "/build/common/Consts.cs",
(i, o) => o.Write (i.ReadToEnd ().Replace ("@MONO_VERSION@", "2.5.0")));
GenerateSystemData (bdir);
break;
default:
Console.Error.WriteLine ("Unknonw option to prepare.exe {0}", args [1]);
Environment.Exit (1);
break;
}
}
}

View File

@ -1,10 +0,0 @@
@ECHO OFF
SETLOCAL
SET USE_LLVM=yes
SET FULL_AOT_MODE=asmonly
CALL %~dp0build-full-aot-regression-tests.bat %*
@ECHO ON

View File

@ -1,9 +0,0 @@
@ECHO OFF
SETLOCAL
SET FULL_AOT_MODE=asmonly
CALL %~dp0build-full-aot-regression-tests.bat %*
@ECHO ON

View File

@ -1,10 +0,0 @@
@ECHO OFF
SETLOCAL
SET USE_LLVM=yes
SET FULL_AOT_MODE=dynamic
CALL %~dp0build-full-aot-regression-tests.bat %*
@ECHO ON

View File

@ -1,9 +0,0 @@
@ECHO OFF
SETLOCAL
SET FULL_AOT_MODE=dynamic
CALL %~dp0build-full-aot-regression-tests.bat %*
@ECHO ON

View File

@ -1,10 +0,0 @@
@ECHO OFF
SETLOCAL
SET USE_LLVM=yes
SET FULL_AOT_MODE=static
CALL %~dp0build-full-aot-regression-tests.bat %*
@ECHO ON

View File

@ -1,9 +0,0 @@
@ECHO OFF
SETLOCAL
SET FULL_AOT_MODE=static
CALL %~dp0build-full-aot-regression-tests.bat %*
@ECHO ON

View File

@ -1,261 +0,0 @@
@ECHO OFF
SETLOCAL
SETLOCAL ENABLEDELAYEDEXPANSION
SET TEMP_PATH=%PATH%
SET MONO_RESULT=1
SET BUILD_TARGET=%1
SET CLEAN=%2
IF NOT "" == "%BUILD_TARGET%" (
SET BUILD_TARGET=%BUILD_TARGET:"=%
)
CALL %~dp0setup-env.bat
IF NOT ERRORLEVEL == 0 (
ECHO Failed to setup mono paths.
GOTO ON_ERROR
)
CALL %~dp0setup-toolchain.bat
IF NOT ERRORLEVEL == 0 (
ECHO Failed to setup toolchain.
GOTO ON_ERROR
)
IF NOT EXIST "%MONO_WINAOT_BCL_PATH%" (
ECHO Could not find "%MONO_WINAOT_BCL_PATH%".
GOTO ON_ERROR
)
SET MONO_RUNTIME_TEST_PATH=%MONO_MINI_HOME%
SET MONO_TEST_PATH=%MONO_TEST_BUILD_DIR%
SET FULLAOT_DIR=%MONO_WINAOT_BUILD_DIR%
SET MONO_PATH=%FULLAOT_DIR%
REM When building Full AOT using net_4x BCL Mono SIMD tests are available.
SET MONO_ENABLE_SIMD_TESTS=0
IF /i %MONO_BCL_PATH% == %MONO_WINAOT_BCL_PATH% (
SET MONO_ENABLE_SIMD_TESTS=1
)
REM Debug output options.
REM SET MONO_LOG_LEVEL=debug
REM SET MONO_LOG_MASK=asm,aot
SET MONO_LOG_LEVEL=
SET MONO_LOG_MASK=
SET FULLAOT_BCL_LIBS=^
mscorlib.dll ^
System.Core.dll ^
System.dll ^
System.Numerics.dll ^
System.Numerics.Vectors.dll ^
System.Xml.dll ^
System.Security.dll ^
Mono.Security.dll ^
I18N.dll ^
I18N.West.dll ^
MemoryIntrinsics.dll
IF %MONO_ENABLE_SIMD_TESTS% == 1 (
SET FULLAOT_BCL_LIBS=^
%FULLAOT_BCL_LIBS% ^
System.Configuration.dll ^
Mono.Simd.dll
)
SET FULLAOT_TEST_LIBS=^
TestDriver.dll ^
generics-variant-types.dll
SET FULLAOT_RUNTIME_TESTS=^
basic.exe ^
basic-float.exe ^
basic-long.exe ^
basic-calls.exe ^
objects.exe ^
arrays.exe ^
basic-math.exe ^
exceptions.exe ^
iltests.exe ^
devirtualization.exe ^
generics.exe ^
basic-vectors.exe ^
gshared.exe ^
aot-tests.exe ^
ratests.exe ^
unaligned.exe ^
builtin-types.exe
IF %MONO_ENABLE_SIMD_TESTS% == 1 (
SET FULLAOT_RUNTIME_TESTS=^
%FULLAOT_RUNTIME_TESTS% ^
basic-simd.exe
)
SET FULLAOT_LIBS=
mkdir %FULLAOT_DIR% >nul 2>&1
IF /i "bcl" == "%BUILD_TARGET%" (
SET FULLAOT_LIBS=%FULLAOT_LIBS% %FULLAOT_BCL_LIBS%
)
IF /i "tests" == "%BUILD_TARGET%" (
SET FULLAOT_LIBS=%FULLAOT_LIBS% %FULLAOT_TEST_LIBS% %FULLAOT_RUNTIME_TESTS%
)
IF /i "all" == "%BUILD_TARGET%" (
SET FULLAOT_LIBS=%FULLAOT_LIBS% %FULLAOT_BCL_LIBS% %FULLAOT_TEST_LIBS% %FULLAOT_RUNTIME_TESTS%
)
IF "" == "%FULLAOT_LIBS%" (
IF NOT "" == "%BUILD_TARGET%" (
SET FULLAOT_LIBS=%BUILD_TARGET%
)
)
FOR %%a IN (%FULLAOT_LIBS%) DO (
IF EXIST %MONO_WINAOT_BCL_PATH%\%%a (
IF NOT "" == "%CLEAN%" (
CALL :DELETE_FULLAOT_LIB %FULLAOT_DIR% %%a
) ELSE (
fc.exe /B %MONO_WINAOT_BCL_PATH%\%%a %FULLAOT_DIR%\%%a >nul 2>&1 && (
ECHO %FULLAOT_DIR%\%%a already up to date.
) || (
CALL :DELETE_FULLAOT_LIB %FULLAOT_DIR% %%a
ECHO Copying %MONO_WINAOT_BCL_PATH%\%%a %FULLAOT_DIR%\%%a.
copy %MONO_WINAOT_BCL_PATH%\%%a %FULLAOT_DIR%\%%a >nul 2>&1
)
)
) ELSE (
IF NOT "" == "%CLEAN%" (
CALL :DELETE_FULLAOT_LIB %FULLAOT_DIR% %%a
) ELSE (
SET FOUND_TEST_TARGET_PATH=
CALL :INNER_COPY_LOOP FOUND_TEST_TARGET_PATH %%a
fc.exe /B !FOUND_TEST_TARGET_PATH! %FULLAOT_DIR%\%%a >nul 2>&1 && (
ECHO %FULLAOT_DIR%\%%a already up to date.
) || (
CALL :DELETE_FULLAOT_LIB %FULLAOT_DIR% %%a
ECHO Copying !FOUND_TEST_TARGET_PATH! %FULLAOT_DIR%\%%a.
copy !FOUND_TEST_TARGET_PATH! %FULLAOT_DIR%\%%a >nul 2>&1
)
)
)
)
GOTO BUILD
:INNER_COPY_LOOP
FOR /d %%d IN (%MONO_TEST_PATH%\*) DO (
IF EXIST %%d\%2 (
SET %1=%%d\%2
GOTO RETURN_INNER_COPY_LOOP
)
)
IF EXIST %MONO_RUNTIME_TEST_PATH%\%2 (
SET %1=%MONO_RUNTIME_TEST_PATH%\%2
)
:RETURN_INNER_COPY_LOOP
GOTO :EOF
:DELETE_FULLAOT_LIB
ECHO Deleting "%1\%2.dll".
del "%1\%2.dll" >nul 2>&1
ECHO Deleting "%1\%2.dll.lib".
del "%1\%2.dll.lib" >nul 2>&1
ECHO Deleting "%1\%2.dll.exp".
del "%1\%2.dll.exp" >nul 2>&1
ECHO Deleting "%1\%2.dll.pdb".
del "%1\%2.dll.pdb" >nul 2>&1
ECHO Deleting "%1\%2.obj".
del "%1\%2.obj" >nul 2>&1
ECHO Deleting "%1\%2.s".
del "%1\%2.s" >nul 2>&1
ECHO Deleting "%1\%2-llvm.s".
del "%1\%2.s.bc" >nul 2>&1
ECHO Deleting "%1\%2-llvm.s.bc".
del "%1\%2.s.opt.bc" >nul 2>&1
ECHO Deleting "%1\%2-llvm.s.opt.bc".
del "%1\%2-llvm.s" >nul 2>&1
ECHO Deleting "%1\%2-llvm.obj".
del "%1\%2-llvm.obj" >nul 2>&1
GOTO :EOF
:BUILD
SET FULLAOT_TEMP_DIR=%FULLAOT_DIR%\%%a-build
IF "" == "%FULL_AOT_MODE%" (
SET FULL_AOT_MODE=dynamic
)
IF /i "yes" == "%USE_LLVM%" (
SET LLVM_ARG=llvm
)
IF /i "static" == "%FULL_AOT_MODE%" (
SET MONO_FULL_AOT_COMPILE_ARGS_TEMPLATE=--aot=full,temp-path=%FULLAOT_TEMP_DIR%,print-skipped,static,%LLVM_ARG%,outfile=%FULLAOT_DIR%\%%a.obj,llvm-outfile=%FULLAOT_DIR%\%%a-llvm.obj
)
IF /i "asmonly" == "%FULL_AOT_MODE%" (
SET MONO_FULL_AOT_COMPILE_ARGS_TEMPLATE=--aot=full,temp-path=%FULLAOT_TEMP_DIR%,print-skipped,asmonly,%LLVM_ARG%,outfile=%FULLAOT_DIR%\%%a.s,llvm-outfile=%FULLAOT_DIR%\%%a-llvm.s
)
IF /i "dynamic" == "%FULL_AOT_MODE%" (
SET MONO_FULL_AOT_COMPILE_ARGS_TEMPLATE=--aot=full,temp-path=%FULLAOT_TEMP_DIR%,print-skipped,%LLVM_ARG%,outfile=%FULLAOT_DIR%\%%a.dll
)
IF "" == "%CLEAN%" (
FOR %%a IN (%FULLAOT_LIBS%) DO (
IF NOT EXIST %FULLAOT_DIR%\%%a.obj (
mkdir %FULLAOT_TEMP_DIR% >nul 2>&1
ECHO %MONO_AOT_COMPILER_EXECUTABLE% %MONO_FULL_AOT_COMPILE_ARGS_TEMPLATE% %FULLAOT_DIR%\%%a.
%MONO_AOT_COMPILER_EXECUTABLE% %MONO_FULL_AOT_COMPILE_ARGS_TEMPLATE% %FULLAOT_DIR%\%%a
rmdir /S /Q %FULLAOT_TEMP_DIR%
IF NOT ERRORLEVEL == 0 (
ECHO "Failed Full AOT compile of %FULLAOT_DIR%\%%a".
GOTO ON_ERROR
)
)
)
)
SET MONO_RESULT=0
GOTO ON_EXIT
:ON_ERROR
ECHO Usage: build-full-aot-regression-tests.bat [bcl|tests|all|assembly path] [clean].
SET MONO_RESULT=ERRORLEVEL
GOTO ON_EXIT
:ON_EXIT
SET PATH=%TEMP_PATH%
EXIT /b %MONO_RESULT%
@ECHO ON

View File

@ -1,60 +0,0 @@
REM Look for Clang VS2015 toolchain in VS installation folders.
ECHO Searching for Clang in VS2015 toolchain...
IF "%VCINSTALLDIR%" == "" (
ECHO VCINSTALLDIR environment variable not set.
GOTO ON_ENV_ERROR
)
IF /i NOT "%Platform%" == "X64" (
ECHO Platform environment variable not set to X64.
GOTO ON_ENV_ERROR
)
IF NOT "%VisualStudioVersion%" == "14.0" (
ECHO VisualStudioVersion environment variable not set to 14.0.
GOTO ON_ENV_ERROR
)
SET CLANGC2_TOOLS_BIN_PATH=%VCINSTALLDIR%\ClangC2\bin\amd64\
SET CLANGC2_TOOLS_BIN=%CLANGC2_TOOLS_BIN_PATH%clang.exe
IF NOT EXIST "%CLANGC2_TOOLS_BIN%" (
ECHO Could not find "%CLANGC2_TOOLS_BIN%"
GOTO ON_ERROR
)
ECHO Found "%CLANGC2_TOOLS_BIN%"
ECHO Searching for Linker in VS2015 toolchain...
SET LINK_TOOLS_BIN_PATH=%VCINSTALLDIR%bin\amd64\
SET LINK_TOOLS_BIN=%LINK_TOOLS_BIN_PATH%link.exe
IF NOT EXIST "%LINK_TOOLS_BIN%" (
ECHO Could not find "%LINK_TOOLS_BIN%"
GOTO ON_ERROR
)
ECHO Found "%LINK_TOOLS_BIN%"
SET COMPILER_TOOLS_BIN="%LINK_TOOLS_BIN_PATH%";"%CLANGC2_TOOLS_BIN_PATH%"
SET PATH=%COMPILER_TOOLS_BIN%;%PATH%
SET MONO_RESULT=0
GOTO ON_EXIT
:ON_ENV_ERROR
SET VC_VARS_ALL_FILE=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
ECHO Make sure to run this from a "VS2015 x64 Native Tools Command Prompt" command prompt.
IF EXIST "%VC_VARS_ALL_FILE%" (
ECHO Setup a "VS2015 x64 Native Tools Command Prompt" command prompt by using "%VC_VARS_ALL_FILE%" amd64.
)
:ON_ERROR
SET MONO_RESULT=1
:ON_EXIT
EXIT /b %MONO_RESULT%

View File

@ -1,69 +0,0 @@
REM Look for Clang VS2017 toolchain in VS installation folders.
ECHO Searching for Clang in VS2017 toolchain...
IF "%VCINSTALLDIR%" == "" (
ECHO VCINSTALLDIR environment variable not set.
GOTO ON_ENV_ERROR
)
IF /i NOT "%VSCMD_ARG_TGT_ARCH%" == "x64" (
ECHO VSCMD_ARG_TGT_ARCH environment variable not set to x64.
GOTO ON_ENV_ERROR
)
IF NOT "%VisualStudioVersion%" == "15.0" (
ECHO VisualStudioVersion environment variable not set to 15.0.
GOTO ON_ENV_ERROR
)
SET CLANGC2_VERSION_FILE=%VCINSTALLDIR%Auxiliary/Build/Microsoft.ClangC2Version.default.txt
IF NOT EXIST "%CLANGC2_VERSION_FILE%" (
ECHO Could not find "%CLANGC2_VERSION_FILE%".
GOTO ON_ENV_ERROR
)
SET /p CLANGC2_VERSION=<"%CLANGC2_VERSION_FILE%"
SET CLANGC2_TOOLS_BIN_PATH=%VCINSTALLDIR%Tools\ClangC2\%CLANGC2_VERSION%\bin\HostX64\
SET CLANGC2_TOOLS_BIN=%CLANGC2_TOOLS_BIN_PATH%clang.exe
IF NOT EXIST "%CLANGC2_TOOLS_BIN%" (
ECHO Could not find "%CLANGC2_TOOLS_BIN%".
GOTO ON_ERROR
)
ECHO Found "%CLANGC2_TOOLS_BIN%".
ECHO Searching for Linker in VS2017 toolchain...
SET LINK_TOOLS_BIN_PATH=%VCToolsInstallDir%bin\HostX64\x64\
SET LINK_TOOLS_BIN=%LINK_TOOLS_BIN_PATH%link.exe
IF NOT EXIST "%LINK_TOOLS_BIN%" (
ECHO Could not find "%LINK_TOOLS_BIN%".
GOTO ON_ERROR
)
ECHO Found "%LINK_TOOLS_BIN%".
SET COMPILER_TOOLS_BIN="%LINK_TOOLS_BIN_PATH%";"%CLANGC2_TOOLS_BIN_PATH%"
SET PATH=%COMPILER_TOOLS_BIN%;%PATH%
SET MONO_RESULT=0
GOTO ON_EXIT
:ON_ENV_ERROR
SET VSWHERE_TOOLS_BIN=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
ECHO Make sure to run this from a "x64 Native Tools Command Prompt for VS2017" command prompt.
IF EXIST "%VSWHERE_TOOLS_BIN%" (
FOR /F "tokens=*" %%a IN ('"%VSWHERE_TOOLS_BIN%" -version [15.0^,16.0] -property installationPath') DO (
ECHO Setup a "x64 Native Tools Command Prompt for VS2017" command prompt by using "%%a\VC\Auxiliary\Build\vcvars64.bat".
)
)
:ON_ERROR
SET MONO_RESULT=1
:ON_EXIT
EXIT /b %MONO_RESULT%

View File

@ -1,62 +0,0 @@
REM Look for Clang VS2019 toolchain in VS installation folders.
ECHO Searching for Clang in VS2019 toolchain...
IF "%VCINSTALLDIR%" == "" (
ECHO VCINSTALLDIR environment variable not set.
GOTO ON_ENV_ERROR
)
IF /i NOT "%VSCMD_ARG_TGT_ARCH%" == "x64" (
ECHO VSCMD_ARG_TGT_ARCH environment variable not set to x64.
GOTO ON_ENV_ERROR
)
IF NOT "%VisualStudioVersion%" == "16.0" (
ECHO VisualStudioVersion environment variable not set to 16.0.
GOTO ON_ENV_ERROR
)
SET CLANG_TOOLS_BIN_PATH=%VCINSTALLDIR%Tools\llvm\bin\
SET CLANG_TOOLS_BIN=%CLANG_TOOLS_BIN_PATH%clang.exe
IF NOT EXIST "%CLANG_TOOLS_BIN%" (
ECHO Could not find "%CLANG_TOOLS_BIN%".
GOTO ON_ERROR
)
ECHO Found "%CLANG_TOOLS_BIN%".
ECHO Searching for Linker in VS2019 toolchain...
SET LINK_TOOLS_BIN_PATH=%VCToolsInstallDir%bin\HostX64\x64\
SET LINK_TOOLS_BIN=%LINK_TOOLS_BIN_PATH%link.exe
IF NOT EXIST "%LINK_TOOLS_BIN%" (
ECHO Could not find "%LINK_TOOLS_BIN%".
GOTO ON_ERROR
)
ECHO Found "%LINK_TOOLS_BIN%".
SET COMPILER_TOOLS_BIN="%LINK_TOOLS_BIN_PATH%";"%CLANGC2_TOOLS_BIN_PATH%"
SET PATH=%COMPILER_TOOLS_BIN%;%PATH%
SET MONO_RESULT=0
GOTO ON_EXIT
:ON_ENV_ERROR
SET VSWHERE_TOOLS_BIN=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
ECHO Make sure to run this from a "x64 Native Tools Command Prompt for VS2019" command prompt.
IF EXIST "%VSWHERE_TOOLS_BIN%" (
FOR /F "tokens=*" %%a IN ('"%VSWHERE_TOOLS_BIN%" -version [16.0^,17.0] -prerelease -property installationPath') DO (
ECHO Setup a "x64 Native Tools Command Prompt for VS2019 command prompt by using "%%a\VC\Auxiliary\Build\vcvars64.bat".
)
)
:ON_ERROR
SET MONO_RESULT=1
:ON_EXIT
EXIT /b %MONO_RESULT%

View File

@ -1,92 +0,0 @@
@ECHO OFF
SETLOCAL
SET TEMP_PATH=%PATH%
SET MONO_RESULT=1
CALL %~dp0setup-env.bat
IF NOT ERRORLEVEL == 0 (
ECHO Failed to setup mono paths.
GOTO ON_ERROR
)
CALL %~dp0setup-toolchain.bat
IF NOT ERRORLEVEL == 0 (
ECHO Failed to setup toolchain.
GOTO ON_ERROR
)
SET FULLAOT_DIR=%MONO_WINAOT_BUILD_DIR%
SET MONO_PATH=%FULLAOT_DIR%
REM When building Full AOT using net_4x BCL Mono SIMD tests are available.
SET MONO_ENABLE_SIMD_TESTS=0
IF /i %MONO_BCL_PATH% == %MONO_WINAOT_BCL_PATH% (
SET MONO_ENABLE_SIMD_TESTS=1
)
IF /i "all" == "%1" (
SET RUN_TARGET=%FULLAOT_DIR%\basic.exe ^
%FULLAOT_DIR%\basic-float.exe ^
%FULLAOT_DIR%\basic-long.exe ^
%FULLAOT_DIR%\basic-calls.exe ^
%FULLAOT_DIR%\objects.exe ^
%FULLAOT_DIR%\arrays.exe ^
%FULLAOT_DIR%\basic-math.exe ^
%FULLAOT_DIR%\exceptions.exe ^
%FULLAOT_DIR%\iltests.exe ^
%FULLAOT_DIR%\devirtualization.exe ^
%FULLAOT_DIR%\generics.exe ^
%FULLAOT_DIR%\aot-tests.exe ^
%FULLAOT_DIR%\gshared.exe ^
%FULLAOT_DIR%\basic-vectors.exe ^
%FULLAOT_DIR%\ratests.exe ^
%FULLAOT_DIR%\unaligned.exe ^
%FULLAOT_DIR%\builtin-types.exe
) ELSE (
IF NOT EXIST %1 (
SET RUN_TARGET=%FULLAOT_DIR%\%1
)
)
IF /i "all" == "%1" (
IF %MONO_ENABLE_SIMD_TESTS% == 1 (
SET RUN_TARGET=^
%RUN_TARGET% ^
%FULLAOT_DIR%\basic-simd.exe
)
)
REM Debug output options.
REM SET MONO_LOG_LEVEL=debug
REM SET MONO_LOG_MASK=asm,aot
SET MONO_LOG_LEVEL=
SET MONO_LOG_MASK=
FOR %%a IN (%RUN_TARGET%) DO (
ECHO %MONO_AOT_RUNTIME_EXECUTABLE% --full-aot %%a --exclude "!FULLAOT" --exclude "!FULLAOT-AMD64".
%MONO_AOT_RUNTIME_EXECUTABLE% --full-aot %%a --exclude "!FULLAOT" --exclude "!FULLAOT-AMD64"
IF NOT ERRORLEVEL == 0 (
ECHO Failed Full AOT execute of %%a.
GOTO ON_ERROR
)
)
GOTO ON_EXIT
:ON_ERROR
ECHO Failed Full AOT execute.
SET MONO_RESULT=ERRORLEVEL
GOTO ON_EXIT
:ON_EXIT
SET PATH=%TEMP_PATH%
EXIT /b %MONO_RESULT%
@ECHO ON

View File

@ -1,114 +0,0 @@
@ECHO OFF
SETLOCAL
SETLOCAL ENABLEDELAYEDEXPANSION
SET TEMP_PATH=%PATH%
SET MONO_RESULT=1
CALL %~dp0setup-env.bat
IF NOT ERRORLEVEL == 0 (
ECHO Failed to setup mono paths.
GOTO ON_ERROR
)
CALL %~dp0setup-toolchain.bat
IF NOT ERRORLEVEL == 0 (
ECHO Failed to setup toolchain.
GOTO ON_ERROR
)
IF NOT EXIST "%MONO_BCL_PATH%" (
ECHO Could not find "%MONO_BCL_PATH%".
GOTO ON_ERROR
)
SET MONO_RUNTIME_TEST_PATH=%MONO_MINI_HOME%
SET MONO_TEST_PATH=%MONO_TEST_BUILD_DIR%
SET MONO_PATH=%MONO_BCL_PATH%;%MONO_TEST_PATH%;%MONO_RUNTIME_TEST_PATH%
SET MONO_RUNTIME_REGRESSION_TESTS=basic.exe ^
basic-float.exe ^
basic-long.exe ^
basic-calls.exe ^
objects.exe ^
arrays.exe ^
basic-math.exe ^
exceptions.exe ^
iltests.exe ^
devirtualization.exe ^
generics.exe ^
basic-simd.exe ^
basic-vectors.exe ^
ratests.exe ^
unaligned.exe ^
builtin-types.exe
SET RUN_TARGET=%1
IF /i "all" == "%RUN_TARGET%" (
SET RUN_TARGET=
FOR %%a IN (%MONO_RUNTIME_REGRESSION_TESTS%) DO (
SET FOUND_TEST_TARGET=
CALL :FIND_TEST FOUND_TEST_TARGET %%a
IF NOT "!RUN_TARGET!" == "" (
SET RUN_TARGET=!RUN_TARGET! !FOUND_TEST_TARGET!
) ELSE (
SET RUN_TARGET=!FOUND_TEST_TARGET!
)
)
) ELSE (
SET FOUND_TEST_TARGET=
CALL :FIND_TEST FOUND_TEST_TARGET %RUN_TARGET%
SET RUN_TARGET=!FOUND_TEST_TARGET!
)
GOTO END_FIND_TEST
:FIND_TEST
FOR /d %%d IN (%MONO_TEST_PATH%\*) DO (
IF EXIST %%d\%2 (
SET %1=%%d\%2
GOTO RETURN_FIND_TEST
)
)
IF EXIST %MONO_RUNTIME_TEST_PATH%\%2 (
SET %1=%MONO_RUNTIME_TEST_PATH%\%2
)
:RETURN_FIND_TEST
GOTO :EOF
:END_FIND_TEST
REM Debug output options.
REM SET MONO_LOG_LEVEL=debug
REM SET MONO_LOG_MASK=asm,aot
SET MONO_LOG_LEVEL=
SET MONO_LOG_MASK=
ECHO %MONO_JIT_EXECUTABLE% --regression %RUN_TARGET%.
%MONO_JIT_EXECUTABLE% --regression %RUN_TARGET%
IF NOT ERRORLEVEL == 0 (
ECHO Failed JIT regression execute of %RUN_TARGET%.
GOTO ON_ERROR
)
GOTO ON_EXIT
:ON_ERROR
ECHO Failed JIT regression execute.
SET MONO_RESULT=ERRORLEVEL
GOTO ON_EXIT
:ON_EXIT
SET PATH=%TEMP_PATH%
EXIT /b %MONO_RESULT%
@ECHO ON

View File

@ -1,87 +0,0 @@
@ECHO OFF
SETLOCAL
SET TEMP_PATH=%PATH%
SET MONO_RESULT=1
CALL %~dp0setup-env.bat
IF NOT ERRORLEVEL == 0 (
ECHO Failed to setup mono paths.
GOTO ON_ERROR
)
CALL %~dp0setup-toolchain.bat
IF NOT ERRORLEVEL == 0 (
ECHO Failed to setup toolchain.
GOTO ON_ERROR
)
IF NOT EXIST "%MONO_BCL_PATH%" (
ECHO Could not find "%MONO_BCL_PATH%".
GOTO ON_ERROR
)
SET MONO_RUNTIME_TEST_PATH=%MONO_MINI_HOME%
SET MONO_TEST_PATH=%MONO_TEST_BUILD_DIR%
SET MONO_PATH=%MONO_BCL_PATH%;%MONO_TEST_PATH%;%MONO_RUNTIME_TEST_PATH%
SET RUN_TARGET=%1
IF NOT EXIST %RUN_TARGET% (
CALL :FIND_TEST RUN_TARGET %%1
)
IF NOT EXIST %RUN_TARGET% (
SET RUN_TARGET=%MONO_RUNTIME_TEST_PATH%\%1
)
IF NOT EXIST %RUN_TARGET% (
ECHO Couldn't locate run target, %1.
GOTO ON_ERROR
)
GOTO END_FIND_TEST
:FIND_TEST
FOR /d %%d IN (%MONO_TEST_PATH%\*) DO (
IF EXIST %%d\%2 (
SET %1=%%d\%2
GOTO RETURN_FIND_TEST
)
)
:RETURN_FIND_TEST
GOTO :EOF
:END_FIND_TEST
REM Debug output options.
REM SET MONO_LOG_LEVEL=debug
REM SET MONO_LOG_MASK=asm,aot
SET MONO_LOG_LEVEL=
SET MONO_LOG_MASK=
ECHO %MONO_JIT_EXECUTABLE% %RUN_TARGET%.
%MONO_JIT_EXECUTABLE% %RUN_TARGET%
IF NOT ERRORLEVEL == 0 (
ECHO Failed JIT execute of %RUN_TARGET%.
GOTO ON_ERROR
)
GOTO ON_EXIT
:ON_ERROR
ECHO Failed JIT execute.
SET MONO_RESULT=ERRORLEVEL
GOTO ON_EXIT
:ON_EXIT
SET PATH=%TEMP_PATH%
EXIT /b %MONO_RESULT%
@ECHO ON

View File

@ -1,46 +0,0 @@
SET CURRENT_MONO_HOME=%MONO_HOME%
IF "" == "%CURRENT_MONO_HOME%" (
SET CURRENT_MONO_HOME=%~dp0..\..\..
)
REM Convert to absolute path.
pushd %CURRENT_MONO_HOME%
SET CURRENT_MONO_HOME=%CD%
popd
REM SET MONO_BUILD_CONFIG=Debug
SET MONO_BUILD_CONFIG=Release
REM SET MONO_FULL_AOT_PROFILE=net_4_x
SET MONO_FULL_AOT_PROFILE=winaot
SET MONO_CFG_DIR=%CURRENT_MONO_HOME%\runtime\etc
SET MONO_BCL_HOME=%CURRENT_MONO_HOME%\mcs\class\lib
SET MONO_MINI_HOME=%CURRENT_MONO_HOME%\mono\mini
SET MONO_BUILD_DIR=%CURRENT_MONO_HOME%\msvc\build
SET MONO_AOT_BUILD_DIR=%MONO_BUILD_DIR%\fullaot
SET MONO_DIST_DIR=%CURRENT_MONO_HOME%\msvc\dist
SET MONO_BCL_PATH=%MONO_BCL_HOME%\net_4_x
SET MONO_BCL_FACADE_PATH=%MONO_BCL_PATH%\Facades
SET MONO_WINAOT_BCL_PATH=%MONO_BCL_HOME%\%MONO_FULL_AOT_PROFILE%
SET MONO_WINAOT_BCL_FACADE_PATH=%MONO_WINAOT_BCL_PATH%\Facades
SET MONO_WINAOT_BUILD_DIR=%MONO_AOT_BUILD_DIR%\winaot
SET MONO_TEST_BUILD_DIR=
SET MONO_SAMPLE_BUILD_DIR=
SET MONO_CROSS_COMPILER_HOME=%MONO_BUILD_DIR%\sgen\x64\bin\%MONO_BUILD_CONFIG%
REM Look for Mono repositories.
ECHO Searching for Mono repositories...
IF NOT EXIST "%CURRENT_MONO_HOME%" (
ECHO Could not find "%CURRENT_MONO_HOME%".
EXIT /b 1
)
ECHO Found "%CURRENT_MONO_HOME%".
EXIT /b 0

View File

@ -1,55 +0,0 @@
SET SCRIPT_DIR=%~dp0
REM Look for Mono toolchain.
ECHO Searching for Mono toolchain...
IF NOT EXIST "%MONO_CROSS_COMPILER_HOME%\mono-sgen.exe" (
ECHO Could not find "%MONO_CROSS_COMPILER_HOME%\mono-sgen.exe".
GOTO ON_ERROR
)
ECHO Found "%MONO_CROSS_COMPILER_HOME%\mono-sgen.exe".
SET MONO_AOT_COMPILER_PATH=%MONO_CROSS_COMPILER_HOME%
SET MONO_AOT_COMPILER_EXECUTABLE=%MONO_AOT_COMPILER_PATH%\mono-sgen.exe
SET MONO_AOT_RUNTIME_PATH=%MONO_AOT_COMPILER_PATH%
SET MONO_AOT_RUNTIME_EXECUTABLE=%MONO_AOT_COMPILER_EXECUTABLE%
SET MONO_JIT_EXECUTABLE_PATH=%MONO_AOT_COMPILER_PATH%
SET MONO_JIT_EXECUTABLE=%MONO_AOT_COMPILER_EXECUTABLE%
SET MONO_LLVM_EXECUTABLES=%MONO_DIST_DIR%\llvm\bin
REM Setup toolchain.
IF "%VisualStudioVersion%" == "14.0" (
CALL %SCRIPT_DIR%clang-vs2015-toolchain.bat || (
GOTO ON_ERROR
)
GOTO SETUP_PATH
)
IF "%VisualStudioVersion%" == "15.0" (
CALL %SCRIPT_DIR%clang-vs2017-toolchain.bat || (
GOTO ON_ERROR
)
GOTO SETUP_PATH
)
IF "%VisualStudioVersion%" == "16.0" (
CALL %SCRIPT_DIR%clang-vs2019-toolchain.bat || (
GOTO ON_ERROR
)
GOTO SETUP_PATH
)
ECHO Failed to identify supported Visual Studio toolchain. Environment variable VisualStudioVersion must be set to 14.0 for VS2015, 15.0 for VS2017 or 16.0 for VS2019. Checking supported toolchains for more error diagnostics...
GOTO ON_ERROR
:SETUP_PATH
SET PATH=%MONO_JIT_EXECUTABLE_PATH%;%MONO_AOT_RUNTIME_PATH%;%MONO_AOT_COMPILER_PATH%;%MONO_LLVM_EXECUTABLES%;%PATH%
GOTO ON_EXIT
:ON_ERROR
EXIT /b 1
:ON_EXIT
EXIT /b 0