Skip to content

Commit

Permalink
Merge pull request #57 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 1.6.3
  • Loading branch information
ricaun authored Dec 22, 2023
2 parents 3071feb + a3c7320 commit 661f074
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 49 deletions.
3 changes: 3 additions & 0 deletions Build/.nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@
"ProjectNameFolder": {
"type": "boolean"
},
"ProjectRemoveAppendTargetFrameworkFolder": {
"type": "boolean"
},
"ProjectVersionFolder": {
"type": "boolean"
},
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.6.3] / 2023-12-06 - 2023-12-22
### Features
- Add `ProjectRemoveTargetFrameworkFolder` to remove `net` folder in `PackageBuilder`.
- Update `ReleasePackageBuilder` to not create the Inno installation when false.
### Updated
- Update `Autodesk.PackageBuilder` to `1.0.6`
- Update `ricaun.Nuke` to `1.7.3`
### Example
- Update `AppendTargetFrameworkToOutputPath` to `true`.

## [1.6.2] / 2023-11-19
### Updated
- Update `ricaun.Nuke` to `1.7.2`
Expand Down Expand Up @@ -264,6 +274,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- First Release

[vNext]: ../../compare/1.0.0...HEAD
[1.6.3]: ../../compare/1.6.2...1.6.3
[1.6.2]: ../../compare/1.6.1...1.6.2
[1.6.1]: ../../compare/1.6.0...1.6.1
[1.6.0]: ../../compare/1.5.1...1.6.0
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.6.2</Version>
<Version>1.6.3</Version>
</PropertyGroup>
</Project>
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ bool IHazPackageBuilderProject.ReleasePackageBuilder => true;
bool IHazPackageBuilderProject.ReleaseBundle => true;
bool IHazPackageBuilderProject.ProjectNameFolder => true;
bool IHazPackageBuilderProject.ProjectVersionFolder => true;
bool IHazPackageBuilderProject.ProjectRemoveTargetFrameworkFolder => true;
```

### IHazRevitPackageBuilder
Expand Down
3 changes: 2 additions & 1 deletion RevitAddin.PackageBuilder.Example/Revit/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public class App : IExternalApplication
public Result OnStartup(UIControlledApplication application)
{
ribbonPanel = application.CreatePanel(GetRevitVersion());
ribbonPanel.CreatePushButton<Commands.Command>(Properties.Resource.Text);
ribbonPanel.CreatePushButton<Commands.Command>(Properties.Resource.Text)
.SetLargeImage("/UIFrameworkRes;component/ribbon/images/revit.ico");
return Result.Succeeded;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<UseWPF>true</UseWPF>
<LangVersion>Latest</LangVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<Configurations>Debug 2019;2019;Debug 2020;2020;Debug 2021;2021;Debug 2022;2022;2023;2017</Configurations>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ public interface IHazPackageBuilderProject : IHazMainProject, IHazSolution, INuk
[Parameter]
bool ProjectVersionFolder => TryGetValue<bool?>(() => ProjectVersionFolder) ?? true;

/// <summary>
/// Add ProjectRemoveTargetFrameworkFolder on the Contents (default: true)
/// </summary>
[Parameter]
bool ProjectRemoveTargetFrameworkFolder => TryGetValue<bool?>(() => ProjectRemoveTargetFrameworkFolder) ?? true;

/// <summary>
/// GetPackageBuilderProject by the Name
/// </summary>
Expand Down
97 changes: 51 additions & 46 deletions ricaun.Nuke.PackageBuilder/Components/Revit/IRevitPackageBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,67 +72,72 @@ public void CreatePackageBuilder(Project project, bool releasePackageBuilder = f

FileSystemTasks.CopyDirectoryRecursively(InputDirectory, ContentsDirectory);

CreateRevitAddinOnProjectFiles(project, ContentsDirectory);
if (ProjectRemoveTargetFrameworkFolder)
{
AppendTargetFrameworkExtension.RemoveAppendTargetFrameworkDirectory(ContentsDirectory);
}

// CopyInstallationFiles If Exists
CopyInstallationFilesTo(PackageBuilderDirectory);
CreateRevitAddinOnProjectFiles(project, ContentsDirectory);

new RevitContentsBuilder(project, BundleDirectory, MiddleVersions, NewVersions)
.Build(BundleDirectory / "PackageContents.xml");

// Create Iss Files
try
{
Serilog.Log.Information($"IssPackageBuilder: {typeof(T)}");
var issPackageBuilder = new T();
issPackageBuilder
.Initialize(project)
.CreatePackage(PackageBuilderDirectory, IssConfiguration)
.CreateFile(PackageBuilderDirectory);
}
catch (Exception)
if (releasePackageBuilder)
{
Serilog.Log.Error($"Error on IssPackageBuilder: {typeof(T)}");
throw;
}
// CopyInstallationFiles If Exists
CopyInstallationFilesTo(PackageBuilderDirectory);

// Create Iss Files
try
{
Serilog.Log.Information($"IssPackageBuilder: {typeof(T)}");
var issPackageBuilder = new T();
issPackageBuilder
.Initialize(project)
.CreatePackage(PackageBuilderDirectory, IssConfiguration)
.CreateFile(PackageBuilderDirectory);
}
catch (Exception)
{
Serilog.Log.Error($"Error on IssPackageBuilder: {typeof(T)}");
throw;
}

// Deploy File
var outputInno = OutputDirectory;
var packageBuilderDirectory = GetMaxPathFolderOrTempFolder(PackageBuilderDirectory);
var issFiles = Globbing.GlobFiles(packageBuilderDirectory, $"*{projectName}.iss");
// Deploy File
var outputInno = OutputDirectory;
var packageBuilderDirectory = GetMaxPathFolderOrTempFolder(PackageBuilderDirectory);
var issFiles = Globbing.GlobFiles(packageBuilderDirectory, $"*{projectName}.iss");

if (issFiles.IsEmpty())
Serilog.Log.Error($"Not found any .iss file in {packageBuilderDirectory}");
if (issFiles.IsEmpty())
Serilog.Log.Error($"Not found any .iss file in {packageBuilderDirectory}");

issFiles.ForEach(file =>
{
InnoSetupTasks.InnoSetup(config => config
.SetProcessToolPath(NuGetToolPathResolver.GetPackageExecutable("Tools.InnoSetup", "ISCC.exe"))
.SetScriptFile(file)
.SetOutputDir(outputInno));
});
issFiles.ForEach(file =>
{
InnoSetupTasks.InnoSetup(config => config
.SetProcessToolPath(NuGetToolPathResolver.GetPackageExecutable("Tools.InnoSetup", "ISCC.exe"))
.SetScriptFile(file)
.SetOutputDir(outputInno));
});

// Sign outputInno
SignFolder(outputInno);
// Sign outputInno
SignFolder(outputInno);

// Zip exe Files
var exeFiles = Globbing.GlobFiles(outputInno, "**/*.exe");
exeFiles.ForEach(file => ZipExtension.ZipFileCompact(file, projectNameVersion));
// Zip exe Files
var exeFiles = Globbing.GlobFiles(outputInno, "**/*.exe");
exeFiles.ForEach(file => ZipExtension.ZipFileCompact(file, projectNameVersion));

if (exeFiles.IsEmpty())
Serilog.Log.Error($"Not found any .exe file in {outputInno}");
if (exeFiles.IsEmpty())
Serilog.Log.Error($"Not found any .exe file in {outputInno}");

var message = string.Join(" | ", exeFiles.Select(e => e.Name));
ReportSummary(_ => _.AddPair("File", message));
var message = string.Join(" | ", exeFiles.Select(e => e.Name));
ReportSummary(_ => _.AddPair("File", message));

if (outputInno != ReleaseDirectory)
{
Globbing.GlobFiles(outputInno, "**/*.zip")
.ForEach(file => FileSystemTasks.CopyFileToDirectory(file, ReleaseDirectory));
}
if (outputInno != ReleaseDirectory)
{
Globbing.GlobFiles(outputInno, "**/*.zip")
.ForEach(file => FileSystemTasks.CopyFileToDirectory(file, ReleaseDirectory));
}

if (releasePackageBuilder)
{
var folder = Path.GetFileName(PackageBuilderDirectory);
var releaseFileName = CreateReleaseFromDirectory(PackageBuilderDirectory, projectName, projectVersion, $".{folder}.zip");
Serilog.Log.Information($"Release: {releaseFileName}");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Nuke.Common.IO;
using Nuke.Common.Utilities.Collections;

namespace ricaun.Nuke.Extensions
{
/// <summary>
/// AppendTargetFrameworkExtension
/// </summary>
public static class AppendTargetFrameworkExtension
{
/// <summary>
/// RemoveAppendTargetFrameworkDirectory
/// </summary>
/// <param name="contentsDirectory"></param>
public static void RemoveAppendTargetFrameworkDirectory(AbsolutePath contentsDirectory)
{
Globbing.GlobDirectories(contentsDirectory, "**/net*")
.ForEach(targetFrameworkDirectory =>
{
var directoryName = targetFrameworkDirectory.Name;
Serilog.Log.Information($"RemoveAppendTargetFrameworkDirectory: {directoryName} - {targetFrameworkDirectory}");
if (targetFrameworkDirectory.Exists())
{
if (targetFrameworkDirectory.Parent.ContainsFile("*") == false)
{
Serilog.Log.Information($"CopyDirectoryRecursively: {directoryName} to {targetFrameworkDirectory.Parent.Name}");
Serilog.Log.Information($"RemoveTargetFrameworkDirectory: {directoryName} move to {targetFrameworkDirectory.Parent.Name}");
FileSystemTasks.CopyDirectoryRecursively(targetFrameworkDirectory, targetFrameworkDirectory.Parent, DirectoryExistsPolicy.Merge);
targetFrameworkDirectory.DeleteDirectory();
}
}
});
}
}
}

0 comments on commit 661f074

Please sign in to comment.