-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1890 from kblohm/innoSetup
Fake 5 InnoSetup Module
- Loading branch information
Showing
7 changed files
with
190 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Auto-Generated by FAKE; do not edit | ||
namespace System | ||
open System.Reflection | ||
|
||
[<assembly: AssemblyTitleAttribute("FAKE - F# Make Creating installers with InnoSetup")>] | ||
[<assembly: AssemblyProductAttribute("FAKE - F# Make")>] | ||
[<assembly: AssemblyVersionAttribute("5.0.0")>] | ||
[<assembly: AssemblyInformationalVersionAttribute("5.0.0-rc007")>] | ||
[<assembly: AssemblyFileVersionAttribute("5.0.0")>] | ||
do () | ||
|
||
module internal AssemblyVersionInformation = | ||
let [<Literal>] AssemblyTitle = "FAKE - F# Make Creating installers with InnoSetup" | ||
let [<Literal>] AssemblyProduct = "FAKE - F# Make" | ||
let [<Literal>] AssemblyVersion = "5.0.0" | ||
let [<Literal>] AssemblyInformationalVersion = "5.0.0-rc007" | ||
let [<Literal>] AssemblyFileVersion = "5.0.0" |
22 changes: 22 additions & 0 deletions
22
src/app/Fake.Installer.InnoSetup/Fake.Installer.InnoSetup.fsproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" | ||
xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<TargetFrameworks>net46;netstandard1.6;netstandard2.0</TargetFrameworks> | ||
<AssemblyName>Fake.Installer.InnoSetup</AssemblyName> | ||
<OutputType>Library</OutputType> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
<DefineConstants>$(DefineConstants);RELEASE</DefineConstants> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Compile Include="AssemblyInfo.fs" /> | ||
<Compile Include="InnoSetup.fs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\Fake.Core.Process\Fake.Core.Process.fsproj" /> | ||
<ProjectReference Include="..\Fake.Core.String\Fake.Core.String.fsproj" /> | ||
<ProjectReference Include="..\Fake.Core.Trace\Fake.Core.Trace.fsproj" /> | ||
<ProjectReference Include="..\Fake.IO.FileSystem\Fake.IO.FileSystem.fsproj" /> | ||
</ItemGroup> | ||
<Import Project="..\..\..\.paket\Paket.Restore.targets" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
|
||
/// This module contains helper functions to create [Inno Setup](http://www.jrsoftware.org/isinfo.php) installers. | ||
[<RequireQualifiedAccess>] | ||
module Fake.Installer.InnoSetup | ||
|
||
open System | ||
open System.IO | ||
open Fake.Core | ||
open Fake.IO | ||
open Fake.IO.Globbing | ||
open Fake.IO.FileSystemOperators | ||
open System.Text | ||
|
||
let private toolPath = | ||
let innoExe = "ISCC.exe" | ||
let toolPath = Tools.findToolInSubPath innoExe (Directory.GetCurrentDirectory() @@ "tools" @@ "Tools.InnoSetup" @@ "tools") | ||
if File.exists toolPath then toolPath | ||
else | ||
match Process.tryFindFileOnPath innoExe with | ||
| Some inno when File.exists inno -> inno | ||
| _ -> toolPath | ||
|
||
let private timeout = TimeSpan.FromMinutes 5. | ||
|
||
/// Output verbosity | ||
type QuietMode = | ||
| Default /// Default output when compiling | ||
| Quiet /// Quiet compile (print error messages only) | ||
| QuietAndProgress /// Enable quiet compile while still displaying progress | ||
/// InnoSetup build parameters | ||
type InnoSetupParams = | ||
{ | ||
/// The tool path - FAKE tries to find ISCC.exe automatically in any sub folder. | ||
ToolPath : string | ||
|
||
/// Specify the process working directory | ||
WorkingDirectory : string | ||
|
||
/// Specify a timeout for ISCC. Default: 5 min. | ||
Timeout : TimeSpan | ||
|
||
/// Enable or disable output (overrides Output) | ||
EnableOutput : bool option | ||
|
||
/// Output files to specified path (overrides OutputDir) | ||
OutputFolder : string | ||
|
||
/// Overrides OutputBaseFilename with the specified filename | ||
OutputBaseFilename : string | ||
|
||
/// Specifies output mode when compiling | ||
QuietMode : QuietMode | ||
|
||
/// Emulate #define public <name> <value> | ||
Defines : Map<string,string> | ||
|
||
/// Additional parameters | ||
AdditionalParameters : string option | ||
|
||
/// Path to inno-script file | ||
ScriptFile : string | ||
} | ||
|
||
/// InnoSetup default parameters | ||
static member Create()= | ||
{ | ||
ToolPath = toolPath | ||
WorkingDirectory = "" | ||
Timeout = timeout | ||
ScriptFile = "innosetup.iss" | ||
EnableOutput = None | ||
OutputFolder = "" | ||
OutputBaseFilename = "" | ||
QuietMode = Default | ||
Defines = Map.empty | ||
AdditionalParameters = None | ||
} | ||
|
||
let private run toolPath workingDirectory timeout command = | ||
use __ = Trace.traceTask "InnoSetup" command | ||
if 0 <> Process.execSimple ((fun info -> | ||
{ info with | ||
FileName = toolPath | ||
WorkingDirectory = workingDirectory | ||
Arguments = command })) timeout | ||
then failwithf "InnoSetup command %s failed." command | ||
|
||
let private serializeInnoSetupParams p = | ||
let appendDefine (key,value) _ sb = | ||
if String.isNullOrEmpty value then | ||
StringBuilder.append (sprintf "/D%s" key) sb | ||
else | ||
StringBuilder.append (sprintf "/D%s=%s" key value) sb | ||
|
||
StringBuilder() | ||
|> StringBuilder.appendIfSome p.AdditionalParameters id | ||
|> StringBuilder.appendIfSome p.EnableOutput (fun enableOutput -> if enableOutput then "/O+" else "/O-") | ||
|> StringBuilder.appendIfNotNullOrEmpty p.OutputFolder "/O" | ||
|> StringBuilder.appendIfNotNullOrEmpty p.OutputBaseFilename "/F" | ||
|> StringBuilder.appendWithoutQuotes | ||
(match p.QuietMode with | ||
| Quiet -> "/Q" | ||
| QuietAndProgress -> "/Qp" | ||
|_ -> "") | ||
|> StringBuilder.forEach (p.Defines |> Map.toList) appendDefine "" | ||
|> StringBuilder.append p.ScriptFile | ||
|> StringBuilder.toText | ||
|
||
/// Builds the InnoSetup installer. | ||
/// ## Parameters | ||
/// - `setParams` - Function used to manipulate the default build parameters. See `InnoSetupParams.Create()` | ||
/// ## Sample | ||
/// | ||
/// InnoSetup.build (fun p -> | ||
/// { p with | ||
/// OutputFolder = "build" @@ "installer" | ||
/// ScriptFile = "installer" @@ "setup.iss" | ||
/// }) | ||
let build setParams = | ||
let p = InnoSetupParams.Create() |> setParams | ||
p | ||
|> serializeInnoSetupParams | ||
|> run p.ToolPath p.WorkingDirectory p.Timeout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
group netcore | ||
|
||
FSharp.Core | ||
NETStandard.Library |