Skip to content

Commit

Permalink
Merge branch 'release-0.18.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
belkiss committed Dec 9, 2021
2 parents d714a2e + 06e094c commit 71a89c8
Show file tree
Hide file tree
Showing 147 changed files with 7,852 additions and 475 deletions.
144 changes: 95 additions & 49 deletions .github/workflows/actions.yml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
!Sharpmake.Application/Sharpmake.Application.csproj
!Sharpmake.Generators/Sharpmake.Generators.csproj
!Sharpmake.Platforms/Sharpmake.CommonPlatforms/Sharpmake.CommonPlatforms.csproj
launchsettings.json

# Samples and FunctionalTests generated projects
samples/*/projects/*
Expand Down
33 changes: 29 additions & 4 deletions CompileSharpmake.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,43 @@ call !VSMSBUILDCMD!
if %errorlevel% NEQ 0 goto error

if "%~1" == "" (
call :BuildSharpmake "%~dp0Sharpmake.sln" "Debug" "Any CPU"
call :BuildSharpmakeDotnet "%~dp0Sharpmake.sln" "Debug" "Any CPU"
) else (
call :BuildSharpmake %1 %2 %3
call :BuildSharpmakeDotnet %1 %2 %3
)

if %errorlevel% EQU 0 goto success

echo Compilation with dotnet failed, falling back to the old way using MSBuild

if "%~1" == "" (
call :BuildSharpmakeMSBuild "%~dp0Sharpmake.sln" "Debug" "Any CPU"
) else (
call :BuildSharpmakeMSBuild %1 %2 %3
)

if %errorlevel% NEQ 0 goto error

goto success

@REM -----------------------------------------------------------------------
:: Build Sharpmake using specified arguments
:BuildSharpmake
:: Build Sharpmake with dotnet using specified arguments
:BuildSharpmakeDotnet
echo Compiling %~1 in "%~2|%~3"...

set DOTNET_BUILD_CMD=dotnet build "%~1" -nologo -v m -c "%~2"
echo %DOTNET_BUILD_CMD%
%DOTNET_BUILD_CMD%
set ERROR_CODE=%errorlevel%
if %ERROR_CODE% NEQ 0 (
echo ERROR: Failed to compile %~1 in "%~2|%~3".
goto end
)
goto success

@REM -----------------------------------------------------------------------
:: Build Sharpmake with MSBuild using specified arguments
:BuildSharpmakeMSBuild
echo Compiling %~1 in "%~2|%~3"...

set MSBUILD_CMD=msbuild -clp:Summary -t:rebuild -restore "%~1" /nologo /verbosity:m /p:Configuration="%~2" /p:Platform="%~3" /maxcpucount /p:CL_MPCount=%NUMBER_OF_PROCESSORS%
Expand Down
48 changes: 48 additions & 0 deletions CompileSharpmake.dotnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env bash
# Script arguments:
# $1: Project/Solution to build
# $2: Target(Normally should be Debug or Release)
# $3: Platform(Normally should be "Any CPU" for sln and AnyCPU for a csproj)
# $4: Framework (Optional, but can specified to only build for one, ex: net472 or net5.0)
# if none are passed, defaults to building Sharpmake.sln in Debug|Any CPU for all frameworks

function BuildSharpmake {
solutionPath=$1
configuration=$2
platform=$3
framework=$4

BUILD_CMD="dotnet build -nologo --verbosity m -p:UseAppHost=true \"$solutionPath\" --configuration \"$configuration\""
echoMessage="Compiling $solutionPath in ${configuration}|${platform}"
if [ -n "$framework" ]; then
BUILD_CMD="$BUILD_CMD --framework \"$framework\""
echoMessage="$echoMessage|${framework}"
fi

echo $echoMessage
echo $BUILD_CMD
eval $BUILD_CMD
if [ $? -ne 0 ]; then
echo ERROR: Failed to compile $solutionPath in "${configuration}|${platform}|".
exit 1
fi
}

# fail immediately if anything goes wrong
set -e

CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

which dotnet > /dev/null
DOTNET_FOUND=$?
if [ $DOTNET_FOUND -ne 0 ]; then
echo "dotnet not found, see https://dotnet.microsoft.com/download"
exit $DOTNET_FOUND
fi

SOLUTION_PATH=${1:-"${CURRENT_DIR}/Sharpmake.sln"}
CONFIGURATION=${2:-"Debug"}
PLATFORM=${3:-"Any CPU"}
FRAMEWORK=$4

BuildSharpmake "$SOLUTION_PATH" "$CONFIGURATION" "$PLATFORM" "$FRAMEWORK"
4 changes: 2 additions & 2 deletions Intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Target : Sharpmake.ITarget
}
```

The idea behind fragments is that they can multiply your number of targets. You can combine the bits of fragment values to describre multiple targets easily:
The idea behind fragments is that they can multiply your number of targets. You can combine the bits of fragment values to describe multiple targets easily:

```csharp
new Target(
Expand Down Expand Up @@ -87,7 +87,7 @@ class MyProject : Project
[Configure]
public void Configure(Configuration conf, Target target)
{
if (target.Optimization == Optimation.Debug)
if (target.Optimization == Optimization.Debug)
conf.Defines.Add("UBI_DEBUG");
...
}
Expand Down
2 changes: 2 additions & 0 deletions Sharpmake.Application/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,13 @@ private static int Main()
{
if (CommandLine.ContainParameter("breakintodebugger"))
{
#if NETFRAMEWORK
if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{
System.Windows.Forms.MessageBox.Show("Debugger requested. Please attach a debugger and press OK");
}
else
#endif
{
Console.WriteLine("Debugger requested. Please attach a debugger and press ENTER to continue");
while (Console.ReadKey(true).Key != ConsoleKey.Enter)
Expand Down
2 changes: 1 addition & 1 deletion Sharpmake.Application/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("0.17.5.0")]
[assembly: AssemblyVersion("0.18.0.0")]
47 changes: 41 additions & 6 deletions Sharpmake.Application/Sharpmake.Application.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Sharpmake.Application</RootNamespace>
<AssemblyName>Sharpmake.Application</AssemblyName>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>net472;net5.0</TargetFrameworks>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>True</AutoGenerateBindingRedirects>
<EnableDefaultItems>false</EnableDefaultItems>
Expand All @@ -17,10 +17,11 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
</PropertyGroup>
<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<Deterministic>false</Deterministic>
<Deterministic>true</Deterministic>
<InvariantGlobalization>true</InvariantGlobalization>
<MSBuildProjectExtensionsPath>..\tmp\projects\Sharpmake.Application</MSBuildProjectExtensionsPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)|$(TargetFramework)'=='Debug|AnyCPU|net472'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
Expand All @@ -35,7 +36,37 @@
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>7</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)|$(TargetFramework)'=='Debug|AnyCPU|net5.0'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\tmp\bin\debug</OutputPath>
<IntermediateOutputPath>..\tmp\obj\debug\sharpmake.application</IntermediateOutputPath>
<BaseIntermediateOutputPath>..\tmp\obj\debug\sharpmake.application</BaseIntermediateOutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>618</WarningsNotAsErrors>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>7</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)|$(TargetFramework)'=='Release|AnyCPU|net472'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>false</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\tmp\bin\release</OutputPath>
<IntermediateOutputPath>..\tmp\obj\release\sharpmake.application</IntermediateOutputPath>
<BaseIntermediateOutputPath>..\tmp\obj\release\sharpmake.application</BaseIntermediateOutputPath>
<DefineConstants>TRACE</DefineConstants>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsNotAsErrors>618</WarningsNotAsErrors>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>7</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)|$(TargetFramework)'=='Release|AnyCPU|net5.0'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>false</DebugSymbols>
<DebugType>pdbonly</DebugType>
Expand All @@ -51,7 +82,7 @@
<LangVersion>7</LangVersion>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net472'">
<Reference Include="System">
<Private>False</Private>
</Reference>
Expand All @@ -65,6 +96,10 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\Sharpmake.Main.sharpmake.cs">
<Link>Resources\Sharpmake.Main.sharpmake.cs</Link>
</None>
<None Include="Sharpmake.Application.sharpmake.cs" />
<None Include="app.config" />
<None Include="app.manifest" />
</ItemGroup>
Expand Down
12 changes: 0 additions & 12 deletions Sharpmake.Application/Sharpmake.Application.nuspec

This file was deleted.

2 changes: 2 additions & 0 deletions Sharpmake.Application/Sharpmake.Application.sharpmake.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public SharpmakeApplicationProject()
{
Name = "Sharpmake.Application";
ApplicationManifest = "app.manifest";

NoneFiles.Add(Path.Combine(Globals.AbsoluteRootPath, "Sharpmake.Main.sharpmake.cs"));
}

public override void ConfigureAll(Configuration conf, Target target)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@

namespace SharpmakeGen.FunctionalTests
{
public static class FunctionalTestArguments
{
public static bool EnableLinkerMultiStamp = false;

[CommandLine.Option("enableLinkerMultiStamp", @"Allow more than one post-build stamper for one executable. Default value: false. ex: /enableLinkerMultiStamp(<true|false>)")]
public static void CommandLineEnableLinkerMultiStamp(bool value)
{
EnableLinkerMultiStamp = value;
}
}

[DebuggerDisplay("\"{Platform}_{DevEnv}\" {Name}")]
public class Target : Sharpmake.ITarget
{
Expand Down Expand Up @@ -490,6 +501,79 @@ public override void ConfigureAll(Configuration conf, Target target)
}
}

[Generate]
public class PostBuildStamper : CommonExeProject
{
public PostBuildStamper()
{
SourceRootPath = @"[project.RootPath]\codebase\PostBuildStampTest";
}
}

[Generate]
public class PostBuildStampTest : CommonExeProject
{
public PostBuildStampTest()
{
}
public override void ConfigureAll(Configuration conf, Target target)
{
base.ConfigureAll(conf, target);

conf.AddPublicDependency<PostBuildStamper>(target);

if (FunctionalTestArguments.EnableLinkerMultiStamp)
{
conf.PostBuildStampExes = new List<Configuration.BuildStepExecutable>
{
new Configuration.BuildStepExecutable(
@"[conf.TargetPath]\PostBuildStamper.exe",
@"",
@"[conf.TargetPath]\[conf.TargetFileName].exe",
@"_Stamp",
useStdOutAsOutput : true),

new Configuration.BuildStepExecutable(
@"[conf.TargetPath]\PostBuildStamper.exe",
@"",
@"[conf.TargetPath]\[conf.TargetFileName].exe",
@"_Message",
useStdOutAsOutput : true)
};
}
else
{
conf.PostBuildStampExe = new Configuration.BuildStepExecutable(
@"[conf.TargetPath]\PostBuildStamper.exe",
@"",
@"[conf.TargetPath]\[conf.TargetFileName].exe",
@"_Stamp_Message",
useStdOutAsOutput: true);
}
}
}

[Generate]
public class SimpleLib : CommonProject
{
public SimpleLib()
{
}
}

[Generate]
public class SimpleExeWithLib : CommonExeProject
{
public SimpleExeWithLib()
{
}
public override void ConfigureAll(Configuration conf, Target target)
{
base.ConfigureAll(conf, target);
conf.AddPublicDependency<SimpleLib>(target);
}
}

[Sharpmake.Generate]
public class FastBuildFunctionalTestSolution : Sharpmake.Solution
{
Expand All @@ -516,7 +600,9 @@ public void ConfigureAll(Configuration conf, Target target)
conf.AddProject<PostBuildCopyDirTest>(target);
conf.AddProject<PostBuildExecuteTest>(target);
conf.AddProject<PostBuildTestExecution>(target);
conf.AddProject<PostBuildStampTest>(target);
conf.AddProject<ExplicitlyOrderedPostBuildTest>(target);
conf.AddProject<SimpleExeWithLib>(target);

if (target.Blob == Blob.FastBuildUnitys)
{
Expand All @@ -536,13 +622,20 @@ public void ConfigureAll(Configuration conf, Target target)
[Sharpmake.Main]
public static void SharpmakeMain(Sharpmake.Arguments arguments)
{
CommandLine.ExecuteOnType(typeof(FunctionalTestArguments));

FileInfo fileInfo = Util.GetCurrentSharpmakeFileInfo();
string sharpmakeRootDirectory = Util.SimplifyPath(Path.Combine(fileInfo.DirectoryName, "..", ".."));

FastBuildSettings.FastBuildMakeCommand = Path.Combine(sharpmakeRootDirectory, @"tools\FastBuild\Windows-x64\FBuild.exe");
FastBuildSettings.FastBuildWait = true;
FastBuildSettings.WriteAllConfigsSection = true;

// This is just to insure that we are able to generate some custom property section when referenced from a Compiler section
FastBuildSettings.AdditionalPropertyGroups.Add("function TestCustomProperties()", new List<string> { "Print('Hello Custom Property')", "Print('Hello Custom Property2')" });
FastBuildSettings.AdditionalCompilerPropertyGroups.Add("Compiler-x64-vs2019", "function TestCustomProperties()");
FastBuildSettings.AdditionalCompilerSettings.Add("Compiler-x64-vs2019", new List<string> { "TestCustomProperties()" });

KitsRootPaths.SetUseKitsRootForDevEnv(DevEnv.vs2019, KitsRootEnum.KitsRoot10, Options.Vc.General.WindowsTargetPlatformVersion.v10_0_19041_0);

Bff.UnityResolver = new Bff.FragmentUnityResolver();
Expand Down
Loading

0 comments on commit 71a89c8

Please sign in to comment.