-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix non-determinismi in compiler outputs (#330)
* Fix non-determinismi in compiler outputs ## What? The C# and F# compilers embed absolute paths into their outputs and that causes non-determinism in the builds. By using the `--pathmap` flag we can strip those paths out of the outputs and have some of that sweet sweet determinism.
- Loading branch information
Showing
17 changed files
with
133 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
@echo off | ||
SETLOCAL ENABLEEXTENSIONS | ||
SETLOCAL ENABLEDELAYEDEXPANSION | ||
|
||
:: | ||
: This wrapper script is used because the C#/F# compilers both embed absolute paths | ||
: into their outputs and those paths are not deterministic. The compilers also | ||
: allow overriding these paths using pathmaps. Since the paths can not be known | ||
: at analysis time we need to override them at execution time. | ||
:: | ||
|
||
set DOTNET_EXECUTABLE=%1 | ||
set COMPILER=%2 | ||
for %%F in ("%COMPILER%") do set COMPILER_BASENAME=%%~nxF | ||
|
||
set PATHMAP_FLAG=-pathmap | ||
|
||
:: Needed because unfortunately the F# compiler uses a different flag name | ||
if %COMPILER_BASENAME% == fsc.dll set PATHMAP_FLAG=--pathmap | ||
|
||
set PATHMAP=%PATHMAP_FLAG%:"%cd%=." | ||
|
||
shift | ||
set args=%1 | ||
:loop | ||
shift | ||
if [%1]==[] goto afterloop | ||
set args=%args% %1 | ||
goto loop | ||
:afterloop | ||
|
||
rem Escape \ and * in args before passsing it with double quote | ||
if defined args ( | ||
set args=!args:\=\\\\! | ||
set args=!args:"=\"! | ||
) | ||
|
||
"%DOTNET_EXECUTABLE%" %args% %PATHMAP% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#! /usr/bin/env bash | ||
set -eou pipefail | ||
|
||
# This wrapper script is used because the C#/F# compilers both embed absolute paths | ||
# into their outputs and those paths are not deterministic. The compilers also | ||
# allow overriding these paths using pathmaps. Since the paths can not be known | ||
# at analysis time we need to override them at execution time. | ||
|
||
COMPILER="$2" | ||
PATHMAP_FLAG="-pathmap" | ||
|
||
# Needed because unfortunately the F# compiler uses a different flag name | ||
if [[ $(basename "$COMPILER") == "fsc.dll" ]]; then | ||
PATHMAP_FLAG="--pathmap" | ||
fi | ||
PATHMAP="$PATHMAP_FLAG:$PWD=." | ||
|
||
# shellcheck disable=SC2145 | ||
./"$@" "$PATHMAP" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters