Skip to content

Commit

Permalink
Update to Build.cs (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoch authored and maartenba committed Aug 8, 2017
1 parent 69bd636 commit d4ea33e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
9 changes: 2 additions & 7 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
[CmdletBinding()]
Param(
[switch]$NoInit,
[string]$Target,
[ValidateSet("Release", "Debug")]
[string]$Configuration,
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose")]
[string]$Verbosity,
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
[string[]]$ScriptArgs
[string[]]$BuildArguments
)

Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { $host.SetShouldExit(1) }
Expand Down Expand Up @@ -51,4 +46,4 @@ ExecSafe { & $MSBuildFile $BuildProjectFile }
# EXECUTE BUILD
###########################################################################

ExecSafe { & $BuildExeFile "-Target=$Target" "-Configuration=$Configuration" "-Verbosity=$Verbosity" $ScriptArgs }
ExecSafe { & $BuildExeFile $BuildArguments }
11 changes: 3 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#!/usr/bin/env bash

SCRIPT_ARGUMENTS=()
BUILD_ARGUMENTS=()
for i in "$@"; do
case $1 in
-n|--noinit) NOINIT=1; shift;;
-t|--target) TARGET="$2"; shift ;;
-c|--configuration) CONFIGURATION="$2"; shift ;;
-v|--verbosity) VERBOSITY="$2"; shift ;;
--) shift; SCRIPT_ARGUMENTS+=("$@"); break ;;
*) SCRIPT_ARGUMENTS+=("$1") ;;
*) BUILD_ARGUMENTS+=("$1") ;;
esac
shift
done
Expand Down Expand Up @@ -46,5 +42,4 @@ msbuild $BUILD_PROJECT_FILE
# EXECUTE BUILD
###########################################################################

mono $BUILD_EXE_FILE --verbosity=$VERBOSITY --configuration=$CONFIGURATION --target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"

mono $BUILD_EXE_FILE ${BUILD_ARGUMENTS[@]}
6 changes: 2 additions & 4 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ class Build : NukeBuild
{
[GitVersion] readonly GitVersion GitVersion;

public override string Configuration => IsServerBuild ? "Release" : Argument("configuration");

public string PackageVersionSuffix => GitVersion.BranchName.Replace("/", "-") + "-" + DateTime.UtcNow.ToString("yyyyMMddhhmm");

public static int Main() => Execute<Build>(x => x.Pack);

Target Initialize => _ => _
.Executes(() =>
{
Environment.SetEnvironmentVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1");
SetVariable("DOTNET_CLI_TELEMETRY_OPTOUT", "1");
});

Target Clean => _ => _
Expand Down Expand Up @@ -54,7 +52,7 @@ class Build : NukeBuild

Target Pack => _ => _
.DependsOn(Test)
.Requires(() => GitVersion != null)
.Requires(() => GitVersion)
.Executes(() =>
{
EnsureExistingDirectory(ArtifactsDirectory);
Expand Down

0 comments on commit d4ea33e

Please sign in to comment.