Skip to content

Commit

Permalink
chore(build): fix Deploy project for Linux and add helper scripts
Browse files Browse the repository at this point in the history
There's a bug/feature in msbuild for Linux which "helpfully" replaces
backslashes with forward slashes while parsing project files. While in
general this is useful for cross-platform compatibility with filenames,
it is a major issue when using regular expressions or, indeed, any
other situation in which a backslash is explicitly required.

See : dotnet/msbuild#3468
  • Loading branch information
mwerle committed Mar 4, 2023
1 parent 402e0fa commit 1d3a095
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Scripts/Deploy.proj
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
foreach(var line in File.ReadLines(Path))
{
var match = re.Match(line);
//Console.WriteLine("Checking line : {0}", line);
if(match.Success)
{
Value = match.Groups[1].Value;
Expand All @@ -181,7 +182,7 @@
<Target Name="getkspversion">
<Error Text="Can not find KSP readme.txt in '$(KSPDIR)'"
Condition="!Exists('$(KSPDIR)\readme.txt')" />
<GrepInFile Path="$(KSPDIR)\readme.txt" Expression="Version\s+(\d+\.\d+(\.\d+)?)\s*">
<GrepInFile Path="$(KSPDIR)\readme.txt" Expression="Version ([0-9]+[^0-9][0-9]+([^0-9][0-9]+)?)$">
<Output PropertyName="KSPVersion" TaskParameter="Value" />
</GrepInFile>
<Message Text="KSP Version is $(KSPVersion)" Importance="High" />
Expand Down
2 changes: 1 addition & 1 deletion Scripts/deploy-debug.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REM Builds and packages the release
REM Builds the Debug binaries and deploys them to your KSP Directory
REM
SETLOCAL EnableDelayedExpansion

Expand Down
12 changes: 12 additions & 0 deletions Scripts/deploy-debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Builds the Debug binaries and deploys them to your KSP Directory

if ! command -v msbuild &>/dev/null
then
echo Could not find 'msbuild' in the path. Please ensure it is installed properly.
exit 1
fi

cd "$(dirname "$0")"
msbuild Deploy.proj /target:Deploy-DEBUG

2 changes: 1 addition & 1 deletion Scripts/deploy.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
REM Builds and packages the release
REM Builds the Release binaries and deploys them to your KSP Directory
REM
SETLOCAL EnableDelayedExpansion

Expand Down
12 changes: 12 additions & 0 deletions Scripts/deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Builds the Release binaries and deploys them to your KSP Directory

if ! command -v msbuild &>/dev/null
then
echo Could not find 'msbuild' in the path. Please ensure it is installed properly.
exit 1
fi

cd "$(dirname "$0")"
msbuild Deploy.proj /target:Deploy

12 changes: 12 additions & 0 deletions Scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
# Builds and packages the release

if ! command -v msbuild &>/dev/null
then
echo Could not find 'msbuild' in the path. Please ensure it is installed properly.
exit 1
fi

cd "$(dirname "$0")"
msbuild Deploy.proj /target:Release

0 comments on commit 1d3a095

Please sign in to comment.