Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

Commit

Permalink
Version Protobuild at 1.17.400, and update help format (Protobuild#261)
Browse files Browse the repository at this point in the history
  • Loading branch information
hach-que authored Dec 21, 2017
1 parent b204aca commit a9245eb
Show file tree
Hide file tree
Showing 60 changed files with 1,094 additions and 55 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@ Protobuild.FunctionalTests/TestData/SafeResolveDefaultsWithoutFeatureSet/Package
Protobuild.FunctionalTests/TestData/ModuleInfoGetsUpgraded/xunit/
.vs/
Protobuild.FunctionalTests/TestData/NuGet3PackageContentFallback/RestSharp/

/Protobuild.Internal/ProtobuildVersion.cs
21 changes: 21 additions & 0 deletions Build/AdditionalProjectTransforms.xslt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<xsl:if test="$root/Input/Generation/ProjectName = 'Protobuild.Internal'">
<Target Name="GenerateProtobuildVersion" BeforeTargets="BeforeBuild">
<Exec>
<xsl:attribute name="WorkingDirectory">
<xsl:value-of select="$root/Input/Generation/RootPath" />
<xsl:value-of select="$project/@Path" />
</xsl:attribute>
<xsl:attribute name="Command">
<xsl:if test="$root/Input/Generation/HostPlatform = 'Linux'">
<xsl:text>bash ../Build/GenerateVersion.sh</xsl:text>
</xsl:if>
<xsl:if test="$root/Input/Generation/HostPlatform = 'MacOS'">
<xsl:text>bash ../Build/GenerateVersion.sh</xsl:text>
</xsl:if>
<xsl:if test="$root/Input/Generation/HostPlatform = 'Windows'">
<xsl:text>powershell -ExecutionPolicy Bypass ..\Build\GenerateVersion.ps1</xsl:text>
</xsl:if>
</xsl:attribute>
</Exec>
</Target>
</xsl:if>
32 changes: 32 additions & 0 deletions Build/GenerateVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
param()

[xml]$ModuleDocument = Get-Content -Path $PSScriptRoot\Module.xml

$SemanticVersion = $ModuleDocument.Module.SemanticVersion
$BuildDate = Get-Date -Date ((Get-Date).ToUniversalTime()) -UFormat "+%Y-%m-%d %H:%M:%S"
$BuildDate = "$BuildDate UTC"
$BuildCommit = $(git rev-parse HEAD)
$JenkinsGitBranch = $env:GIT_BRANCH
if ($JenkinsGitBranch -ne "" -and $JenkinsGitBranch -ne $null) {
$BuildCommit = "$BuildCommit; $JenkinsGitBranch"
}
$BuildIsDirty = "false"
if ( ((git status --porcelain) | Out-String) -ne "" ) {
$BuildIsDirty = "true"
}

Write-Output @"
namespace Protobuild
{
public static class ProtobuildVersion
{
public const string SemanticVersion = "$SemanticVersion";
public const string BuildDate = "$BuildDate";
public const string BuildCommit = "$BuildCommit";
public const bool BuiltWithPendingChanges = $BuildIsDirty;
}
}
"@.Trim() | Out-File -Encoding ASCII ProtobuildVersion.cs
43 changes: 43 additions & 0 deletions Build/GenerateVersion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Read the semantic version out of ModuleInfo.xml .... :O
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
rdom () { local IFS=\> ; read -d \< E C ;}
SEMANTIC_VERSION=$(while rdom; do
if [[ $E = "SemanticVersion" ]]; then
echo $C
exit
fi
done < $SCRIPT_DIR/Module.xml)

# Get build date
BUILD_DATE=`date -u '+%Y-%m-%d %H:%M:%S'`
BUILD_DATE="$BUILD_DATE UTC"

# Get current commit
BUILD_COMMIT=`git rev-parse HEAD`
if [ "$GIT_BRANCH" != "" ]; then
BUILD_COMMIT="$BUILD_COMMIT; $GIT_BRANCH"
fi

# Determine if there are pending changes (dirty working directory)
BUILD_IS_DIRTY="false"
if [ "$(git status --porcelain)" != "" ]; then
BUILD_IS_DIRTY="true"
fi

cat >ProtobuildVersion.cs <<EOF
namespace Protobuild
{
public static class ProtobuildVersion
{
public const string SemanticVersion = "$SEMANTIC_VERSION";
public const string BuildDate = "$BUILD_DATE";
public const string BuildCommit = "$BUILD_COMMIT";
public const bool BuiltWithPendingChanges = $BUILD_IS_DIRTY;
}
}
EOF
1 change: 1 addition & 0 deletions Build/Module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<Module>
<Name>Protobuild</Name>
<Authors>.NET Foundation</Authors>
<SemanticVersion>1.17.400</SemanticVersion>
<Description>Protobuild is a cross-platform project generator for C#.</Description>
<ProjectUrl>https://protobuild.org/</ProjectUrl>
<LicenseUrl>https://opensource.org/licenses/MIT</LicenseUrl>
Expand Down
1 change: 1 addition & 0 deletions Build/Projects/Protobuild.Internal.definition
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
<Compile Include="ProjectReader\DefinitionSynchroniser.cs" />
<Compile Include="ProjectReader\XmlElementUtility.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ProtobuildVersion.cs" />
<Compile Include="RedirectableConsole.cs" />
<Compile Include="RetryableWebClient.cs" />
<Compile Include="SafeToDictionaryExtension.cs" />
Expand Down
15 changes: 15 additions & 0 deletions Protobuild.Internal/CommandLine/AddPackageCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ public int Execute(Execution execution)
return 0;
}

public string GetShortCategory()
{
return "Package management";
}

public string GetShortDescription()
{
return "add a package to the module without downloading or installing it";
}

public string GetDescription()
{
return @"
Expand All @@ -71,6 +81,11 @@ public int GetArgCount()
return 1;
}

public string[] GetShortArgNames()
{
return new[] { "package" };
}

public string[] GetArgNames()
{
return new[] { "package_url" };
Expand Down
15 changes: 15 additions & 0 deletions Protobuild.Internal/CommandLine/AutomatedBuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ public int Execute(Execution execution)
return _automatedBuildController.Execute(execution.WorkingDirectory, scriptPath);
}

public string GetShortCategory()
{
return "Build automation";
}

public string GetShortDescription()
{
return "execute the script using Protobuild's automated build scripting language (default automated.build)";
}

public string GetDescription()
{
return @"
Expand All @@ -48,6 +58,11 @@ public int GetArgCount()
return 1;
}

public string[] GetShortArgNames()
{
return GetArgNames();
}

public string[] GetArgNames()
{
return new[] {"script_path?"};
Expand Down
15 changes: 15 additions & 0 deletions Protobuild.Internal/CommandLine/BuildCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,16 @@ where File.Exists(msbuild)
return 0;
}

public string GetShortCategory()
{
return "Build automation";
}

public string GetShortDescription()
{
return "builds the module (does not generate it first)";
}

public string GetDescription()
{
return @"
Expand All @@ -341,6 +351,11 @@ public int GetArgCount()
return 1;
}

public string[] GetShortArgNames()
{
return GetArgNames();
}

public string[] GetArgNames()
{
return new[] { "platform?" };
Expand Down
15 changes: 15 additions & 0 deletions Protobuild.Internal/CommandLine/BuildProcessArchCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ public int Execute(Execution execution)
throw new NotSupportedException();
}

public string GetShortCategory()
{
return "Build automation";
}

public string GetShortDescription()
{
return "set the architecture of MSBuild to use (x86, x64 or Default)";
}

public string GetDescription()
{
return @"
Expand All @@ -38,6 +48,11 @@ public int GetArgCount()
return 1;
}

public string[] GetShortArgNames()
{
return GetArgNames();
}

public string[] GetArgNames()
{
return new[] { "arch" };
Expand Down
15 changes: 15 additions & 0 deletions Protobuild.Internal/CommandLine/BuildPropertyCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ public int Execute(Execution execution)
throw new NotSupportedException();
}

public string GetShortCategory()
{
return "Build automation";
}

public string GetShortDescription()
{
return "add or set a build property";
}

public string GetDescription()
{
return @"
Expand All @@ -32,6 +42,11 @@ public int GetArgCount()
return 2;
}

public string[] GetShortArgNames()
{
return GetArgNames();
}

public string[] GetArgNames()
{
return new[] { "name", "value?" };
Expand Down
15 changes: 15 additions & 0 deletions Protobuild.Internal/CommandLine/BuildTargetCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ public int Execute(Execution execution)
throw new NotSupportedException();
}

public string GetShortCategory()
{
return "Build automation";
}

public string GetShortDescription()
{
return "set the build target (defaults to Build)";
}

public string GetDescription()
{
return @"
Expand All @@ -32,6 +42,11 @@ public int GetArgCount()
return 1;
}

public string[] GetShortArgNames()
{
return new[] { "target" };
}

public string[] GetArgNames()
{
return new[] { "build_target" };
Expand Down
15 changes: 15 additions & 0 deletions Protobuild.Internal/CommandLine/CleanCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ public int Execute(Execution execution)
return 1;
}

public string GetShortCategory()
{
return "Project generation";
}

public string GetShortDescription()
{
return "remove all generated solution and project files";
}

public string GetDescription()
{
return @"
Expand All @@ -61,6 +71,11 @@ public int GetArgCount()
return 1;
}

public string[] GetShortArgNames()
{
return GetArgNames();
}

public string[] GetArgNames()
{
return new[] { "platform?" };
Expand Down
15 changes: 15 additions & 0 deletions Protobuild.Internal/CommandLine/DebugProjectGenerationCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ public int Execute(Execution execution)
throw new NotSupportedException();
}

public string GetShortCategory()
{
return "Internal use";
}

public string GetShortDescription()
{
return "emit generated intermediate files for debugging";
}

public string GetDescription()
{
return @"
Expand All @@ -27,6 +37,11 @@ public int GetArgCount()
return 0;
}

public string[] GetShortArgNames()
{
return GetArgNames();
}

public string[] GetArgNames()
{
return new string[0];
Expand Down
15 changes: 15 additions & 0 deletions Protobuild.Internal/CommandLine/DebugServiceResolutionCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ public int Execute(Execution execution)
throw new NotSupportedException();
}

public string GetShortCategory()
{
return "Internal use";
}

public string GetShortDescription()
{
return "enable verbose output for service resolution";
}

public string GetDescription()
{
return @"
Expand All @@ -27,6 +37,11 @@ public int GetArgCount()
return 0;
}

public string[] GetShortArgNames()
{
return GetArgNames();
}

public string[] GetArgNames()
{
return new string[0];
Expand Down
Loading

0 comments on commit a9245eb

Please sign in to comment.