Skip to content

Fixes build error when path contains space on Linux #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symli
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"

$DIR/run.sh build "$@"
"$DIR/run.sh" build "$@"
16 changes: 8 additions & 8 deletions init-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ __DOTNET_PATH=$__TOOLRUNTIME_DIR/dotnetcli
__DOTNET_CMD=$__DOTNET_PATH/dotnet
if [ -z "$__BUILDTOOLS_SOURCE" ]; then __BUILDTOOLS_SOURCE=https://dotnet.myget.org/F/dotnet-buildtools/api/v3/index.json; fi
export __BUILDTOOLS_USE_CSPROJ=true
__BUILD_TOOLS_PACKAGE_VERSION=$(cat $__scriptpath/BuildToolsVersion.txt | sed 's/\r$//') # remove CR if mounted repo on Windows drive
__DOTNET_TOOLS_VERSION=$(cat $__scriptpath/DotnetCLIVersion.txt | sed 's/\r$//') # remove CR if mounted repo on Windows drive
__ILASM_VERSION=$(cat $__scriptpath/tools-local/ILAsmVersion.txt | sed 's/\r$//') # remove CR if mounted repo on Windows drive
__BUILD_TOOLS_PACKAGE_VERSION=$(cat "$__scriptpath/BuildToolsVersion.txt" | sed 's/\r$//') # remove CR if mounted repo on Windows drive
__DOTNET_TOOLS_VERSION=$(cat "$__scriptpath/DotnetCLIVersion.txt" | sed 's/\r$//') # remove CR if mounted repo on Windows drive
__ILASM_VERSION=$(cat "$__scriptpath/tools-local/ILAsmVersion.txt" | sed 's/\r$//') # remove CR if mounted repo on Windows drive
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can actually just be removed, we don't have this file in this repo. The init-tools script is shared between a few repos, and this line was blindly copied.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the references to ILasmVersion.txt in the build scripts for Windows and Linux: #266

__BUILD_TOOLS_PATH=$__PACKAGES_DIR/microsoft.dotnet.buildtools/$__BUILD_TOOLS_PACKAGE_VERSION/lib
__INIT_TOOLS_RESTORE_PROJECT=$__scriptpath/init-tools.msbuild
__BUILD_TOOLS_SEMAPHORE=$__TOOLRUNTIME_DIR/$__BUILD_TOOLS_PACKAGE_VERSION/init-tools.complete

if [ -e $__BUILD_TOOLS_SEMAPHORE ]; then
if [ -e "$__BUILD_TOOLS_SEMAPHORE" ]; then
echo "Tools are already initialized"
return #return instead of exit because this script is inlined in other scripts which we don't want to exit
fi

if [ -e $__TOOLRUNTIME_DIR ]; then rm -rf -- $__TOOLRUNTIME_DIR; fi
if [ -e "$__TOOLRUNTIME_DIR" ]; then rm -rf -- "$__TOOLRUNTIME_DIR"; fi

if [ -d "$DotNetBuildToolsDir" ]; then
echo "Using tools from '$DotNetBuildToolsDir'."
Expand All @@ -36,7 +36,7 @@ if [ -d "$DotNetBuildToolsDir" ]; then
return #return instead of exit because this script is inlined in other scripts which we don't want to exit
fi

echo "Running: $__scriptpath/init-tools.sh" > $__init_tools_log
echo "Running: $__scriptpath/init-tools.sh" > "$__init_tools_log"

display_error_message()
{
Expand Down Expand Up @@ -65,7 +65,7 @@ execute_with_retry() {
return 0
}

if [ ! -e $__DOTNET_PATH ]; then
if [ ! -e "$__DOTNET_PATH" ]; then
if [ -z "$__DOTNET_PKG" ]; then
if [ "$(uname -m | grep "i[3456]86")" = "i686" ]; then
echo "Warning: build not supported on 32 bit Unix"
Expand Down Expand Up @@ -138,7 +138,7 @@ if [ ! -e $__DOTNET_PATH ]; then
cd $__scriptpath
fi

if [ ! -e $__BUILD_TOOLS_PATH ]; then
if [ ! -e "$__BUILD_TOOLS_PATH" ]; then
echo "Restoring BuildTools version $__BUILD_TOOLS_PACKAGE_VERSION..."
echo "Running: $__DOTNET_CMD restore \"$__INIT_TOOLS_RESTORE_PROJECT\" --no-cache --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE /p:BuildToolsPackageVersion=$__BUILD_TOOLS_PACKAGE_VERSION" >> $__init_tools_log
$__DOTNET_CMD restore "$__INIT_TOOLS_RESTORE_PROJECT" --no-cache --packages $__PACKAGES_DIR --source $__BUILDTOOLS_SOURCE /p:BuildToolsPackageVersion=$__BUILD_TOOLS_PACKAGE_VERSION >> $__init_tools_log
Expand Down
6 changes: 3 additions & 3 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_MULTILEVEL_LOOKUP=0

# Source the init-tools.sh script rather than execute in order to preserve ulimit values in child-processes. https://github.com/dotnet/corefx/issues/19152
. $__scriptpath/init-tools.sh
. "$__scriptpath/init-tools.sh"

__toolRuntime=$__scriptpath/Tools
__dotnet=$__toolRuntime/dotnetcli/dotnet

cd $__scriptpath
$__dotnet $__toolRuntime/run.exe $__scriptpath/config.json "$@"
cd "$__scriptpath"
"$__dotnet" "$__toolRuntime/run.exe" "$__scriptpath/config.json" "$@"
exit $?
4 changes: 2 additions & 2 deletions src/Native/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
<BuildArgs>--configuration $(Configuration) --arch $(TargetArchitecture) $(StripArgs)</BuildArgs>
</PropertyGroup>

<Message Text="$(MSBuildProjectDirectory)\build.sh $(BuildArgs)" Importance="High"/>
<Exec Command="$(MSBuildProjectDirectory)\build.sh $(BuildArgs)" />
<Message Text="$(MSBuildProjectDirectory)/build.sh $(BuildArgs)" Importance="High"/>
<Exec Command="&quot;$(MSBuildProjectDirectory)/build.sh&quot; $(BuildArgs)" />

</Target>

Expand Down