Skip to content

Commit

Permalink
Merge branch 'release/1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
max-eroshkin committed Mar 20, 2023
2 parents 4a39273 + aea259d commit e76c4b4
Show file tree
Hide file tree
Showing 52 changed files with 1,594 additions and 84 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
push:
branches:
- develop
- 'feature/**'
pull_request:
branches:
- develop
Expand All @@ -30,9 +31,11 @@ jobs:
name: windows-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache .nuke/temp, ~/.nuget/packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
.nuke/temp
Expand All @@ -43,7 +46,7 @@ jobs:
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
ALL_PACKAGES: ${{ secrets.ALL_PACKAGES }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
with:
name: packages
path: artifacts/packages
8 changes: 5 additions & 3 deletions .github/workflows/Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ jobs:
name: windows-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache .nuke/temp, ~/.nuget/packages
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
.nuke/temp
Expand All @@ -40,7 +42,7 @@ jobs:
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
ALL_PACKAGES: ${{ secrets.ALL_PACKAGES }}
- uses: actions/upload-artifact@v1
- uses: actions/upload-artifact@v3
with:
name: packages
path: artifacts/packages
3 changes: 2 additions & 1 deletion DemoApp/DemoApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<TargetFramework>net7.0-windows</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<IncludeNativeLibrariesInSingleFile>true</IncludeNativeLibrariesInSingleFile>
<ApplicationIcon>app.ico</ApplicationIcon>
<IsPackable>false</IsPackable>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion Examples/DemoBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public DemoBuilder()
.UninstallDisplayIcon("ToolsIcon.ico")
.DisableDirPage(YesNo.Yes);

Files.CreateEntry(source: @"bin\*", destDir: InnoConstants.App)
Files.CreateEntry(source: @"bin\*", destDir: InnoConstants.Directories.App)
.Flags(FileFlags.IgnoreVersion | FileFlags.RecurseSubdirs);
Files.CreateEntry(source: "SupportTools.addin", destDir: @"{userappdata}\Autodesk\Revit\Addins\2019");
Files.CreateEntry(source: @"bin\Fonts\GraphikLCG-Medium.ttf", destDir: @"{autofonts}")
Expand Down
2 changes: 1 addition & 1 deletion Examples/Examples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
4 changes: 2 additions & 2 deletions Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static void BuildString()
builder.Setup.Create("BimTools.Support")
.AppVersion("1.2.5.1634640046")
.DefaultDirName(@"{userappdata}\SupportTools");
builder.Files.CreateEntry(@"bin\*", InnoConstants.App)
builder.Files.CreateEntry(@"bin\*", InnoConstants.Directories.App)
.Flags(FileFlags.IgnoreVersion | FileFlags.RecurseSubdirs);
});
//new DemoBuilder();
Expand Down Expand Up @@ -56,7 +56,7 @@ static void BuildFInPlace()
builder.Setup.Create("BimTools.Support")
.AppVersion("1.2.5.1634640046")
.DefaultDirName(@"{userappdata}\SupportTools");
builder.Files.CreateEntry(@"bin\*", InnoConstants.App)
builder.Files.CreateEntry(@"bin\*", InnoConstants.Directories.App)
.Flags(FileFlags.IgnoreVersion | FileFlags.RecurseSubdirs);
},
"inplace.iss");
Expand Down
15 changes: 11 additions & 4 deletions build/Build.Demo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ partial class Build
.Description("Builds an iss script file.")
.Executes(() =>
{
var programFiles = (RelativePath)InnoConstants.ProgramFiles64;
var group = (RelativePath)InnoConstants.Group;
var appDir = (RelativePath)InnoConstants.App;
var programFiles = (RelativePath)InnoConstants.Directories.ProgramFiles64;
var group = (RelativePath)InnoConstants.Shell.Group;
var appDir = (RelativePath)InnoConstants.Directories.App;

BuilderUtils.Build(builder =>
{
Expand All @@ -35,8 +35,15 @@ partial class Build
.DisableProgramGroupPage(YesNo.No);

builder.Files
.CreateEntry(OutputDir / "*", InnoConstants.App)
.CreateEntry(OutputDir / "*", InnoConstants.Directories.App)
.Flags(FileFlags.IgnoreVersion | FileFlags.RecurseSubdirs);

builder.Registry
.CreateEntry(RegistryKeys.HKCU, @"SOFTWARE\Microsoft\Windows\CurrentVersion\InnoSetupDemoApp")
.ValueName("DemoAppData")
.ValueType(ValueTypes.String)
.ValueData("Test Data")
.Flags(RegistryFlags.UninsDeleteKey);

builder.Icons
.CreateEntry(group / "InnoSetup.ScriptBuilder Demo", appDir / "DemoApp.exe");
Expand Down
17 changes: 3 additions & 14 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,19 @@
using Nuke.Common.ProjectModel;
using Nuke.Common.Tooling;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Utilities.Collections;
using static Nuke.Common.IO.PathConstruction;
using static Nuke.Common.Tools.DotNet.DotNetTasks;

[CheckBuildProjectConfigurations]
[UnsetVisualStudioEnvironmentVariables]
[GitHubActions("CI",
GitHubActionsImage.WindowsLatest,
OnPushBranches = new[] { DevelopBranch },
FetchDepth = 0,
OnPushBranches = new[] { DevelopBranch, "feature/**" },
OnPullRequestBranches = new[] { DevelopBranch, "feature/**" },
InvokedTargets = new[] { nameof(Test), nameof(IPublish.Publish) },
ImportSecrets = new[] { "NUGET_API_KEY", "ALL_PACKAGES" })]
[GitHubActions("Publish",
GitHubActionsImage.WindowsLatest,
FetchDepth = 0,
OnPushBranches = new[] { MasterBranch, "release/**" },
InvokedTargets = new[] { nameof(Test), nameof(IPublish.Publish) },
ImportSecrets = new[] { "NUGET_API_KEY", "ALL_PACKAGES" })]
Expand All @@ -40,16 +39,6 @@ partial class Build : NukeBuild, IPublish
readonly AbsolutePath OutputDir = TemporaryDirectory / "output";
readonly AbsolutePath IssPath = TemporaryDirectory / "setup.iss";

[UsedImplicitly]
Target Clean => _ => _
.Before<IRestore>()
.Executes(() =>
{
GlobDirectories(Solution.Directory, "**/bin", "**/obj")
.Where(x => !IsDescendantPath(BuildProjectDirectory, x))
.ForEach(FileSystemTasks.DeleteDirectory);
});

[UsedImplicitly]
public Target Test => _ => _
.Before<IRestore>()
Expand Down
14 changes: 5 additions & 9 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,19 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<RootNamespace></RootNamespace>
<NoWarn>CS0649;CS0169</NoWarn>
<LangVersion>8</LangVersion>
<LangVersion>10</LangVersion>
<IsPackable>false</IsPackable>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BimLab.Nuke" Version="2022.2.0" />
<PackageReference Include="BimLab.Nuke.Nuget" Version="2022.3.0" />
<PackageReference Include="NuGet.CommandLine" Version="5.9.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Tools.InnoSetup" Version="6.2.1" IncludeAssets="All" />
<PackageReference Include="BimLab.Nuke" Version="2023.1.0-dev02" />
<PackageReference Include="Tools.InnoSetup" Version="6.2.2" IncludeAssets="All" />
<PackageReference Include="NuGet.CommandLine" Version="6.4.0"/>
</ItemGroup>

<ItemGroup>
Expand Down
72 changes: 59 additions & 13 deletions source/BuilderTests/BuilderTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
namespace BuilderTests
{
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using FluentAssertions;
using InnoSetup.ScriptBuilder;
Expand All @@ -21,13 +23,28 @@ public void NamingConsistency()

foreach (var property in builderProperties)
{
var sectionBuilder = property.GetValue(builder);
var nameProperty = sectionBuilder.GetType().GetProperty("SectionName");
var sectionBuilder = property.GetValue(builder)!;
var nameProperty = sectionBuilder.GetType().GetProperty("SectionName")
?? throw new InvalidCastException(
$"Builder {sectionBuilder.GetType()} mast have SectionName");
var name = nameProperty.GetValue(sectionBuilder);
name.Should().Be(property.Name);
}
}

[Fact]
public void DoubleSectionCreationMustThrowIvalidOperation()
{
Action creation = () =>
BuilderUtils.CreateBuilder(c =>
{
c.Setup.Create("Hello!");
c.Setup.Create("Good bye!");
});

creation.Should().Throw<IssBuilderException>();
}

[Fact]
public void ModelAllPropertiesNullable()
{
Expand All @@ -44,18 +61,15 @@ public void ModelAllPropertiesNullable()
}

[Fact]
public void WriteFile()
public void WriteFile1()
{
const string issFilename = "test_build.iss";
if (File.Exists(issFilename))
File.Delete(issFilename);

BuilderUtils.Build(
c =>
{
c.Directives
.Define("MyAppName", "My Program")
.Include(@"c:\dir\file.iss")
.Include("<file.iss>")
.FreeText(";comments")
.Undef("var1");

c.Setup.Create("BimTools.Support")
.AppVersion("1.2.5.1634640046")
.DefaultDirName(@"{userappdata}\Autodesk\Revit\Addins\2019\SupportTools")
Expand All @@ -65,7 +79,7 @@ public void WriteFile()
.UninstallDisplayIcon("trayIcon.ico")
.DisableDirPage(YesNo.Yes);

c.Files.CreateEntry(source: @"bin\*", destDir: InnoConstants.App)
c.Files.CreateEntry(source: @"bin\*", destDir: InnoConstants.Directories.App)
.Flags(FileFlags.IgnoreVersion | FileFlags.RecurseSubdirs);
c.Files.CreateEntry(source: "SupportTools.addin",
destDir: @"{userappdata}\Autodesk\Revit\Addins\2019");
Expand All @@ -81,7 +95,39 @@ public void WriteFile()
.AddPermission(Sids.Users, Permissions.Modify)
.Flags(FileFlags.OnlyIfDestFileExists | FileFlags.UninsNeverUninstall);
},
"test_build.iss");
issFilename);

var fi = new FileInfo(issFilename);
fi.Exists.Should().BeTrue();
fi.Length.Should().BeGreaterThan(0);
}

[Fact]
public void WriteFile2()
{
const string issFilename = "test_build.iss";
if (File.Exists(issFilename))
File.Delete(issFilename);

BuilderUtils.Build<TestBuilder>(issFilename);

var fi = new FileInfo(issFilename);
fi.Exists.Should().BeTrue();
fi.Length.Should().BeGreaterThan(0);
}

[Fact]
public void WriteFile3()
{
const string issFilename = "test_build.iss";
if (File.Exists(issFilename))
File.Delete(issFilename);

BuilderUtils.Build(typeof(TestBuilder), issFilename);

var fi = new FileInfo(issFilename);
fi.Exists.Should().BeTrue();
fi.Length.Should().BeGreaterThan(0);
}

[Fact]
Expand All @@ -101,7 +147,7 @@ public void TestBuilderContainsAllAvailableSections()
.GetProperties(BindingFlags.Public | BindingFlags.Instance)
.Where(x => x.PropertyType.Name.EndsWith("Builder"))
.ToList();

var iss = new TestBuilder().ToString();
var testBuilderSections = TestUtils.GetSections(iss).ToList();

Expand Down
12 changes: 6 additions & 6 deletions source/BuilderTests/BuilderTests.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="FluentAssertions" Version="6.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.2.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Loading

0 comments on commit e76c4b4

Please sign in to comment.