Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues #1686

Merged
merged 6 commits into from
Sep 26, 2017
22 changes: 13 additions & 9 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -836,14 +836,18 @@ Target.Create "DotnetCoreCreateDebianPackage" (fun _ ->
let nuget_exe = Directory.GetCurrentDirectory() </> "packages" </> "build" </> "NuGet.CommandLine" </> "tools" </> "NuGet.exe"
let apikey = Environment.environVarOrDefault "nugetkey" ""
let nugetsource = Environment.environVarOrDefault "nugetsource" "https://www.nuget.org/api/v2/package"
let nugetPush nugetpackage =
if not <| System.String.IsNullOrEmpty apikey then
Process.ExecProcess (fun info ->
info.FileName <- nuget_exe
info.Arguments <- sprintf "push %s %s -Source %s" (Process.toParam nugetpackage) (Process.toParam apikey) (Process.toParam nugetsource))
(System.TimeSpan.FromMinutes 10.)
|> (fun r -> if r <> 0 then failwithf "failed to push package %s" nugetpackage)
else Trace.traceFAKE "could not push '%s', because api key was not set" nugetpackage
let rec nugetPush tries nugetpackage =
try
if not <| System.String.IsNullOrEmpty apikey then
Process.ExecProcess (fun info ->
info.FileName <- nuget_exe
info.Arguments <- sprintf "push %s %s -Source %s" (Process.toParam nugetpackage) (Process.toParam apikey) (Process.toParam nugetsource))
(System.TimeSpan.FromMinutes 10.)
|> (fun r -> if r <> 0 then failwithf "failed to push package %s" nugetpackage)
else Trace.traceFAKE "could not push '%s', because api key was not set" nugetpackage
with exn when tries > 1 ->
Trace.traceFAKE "Error while pushing NuGet package: %s" exn.Message
nugetPush (tries - 1) nugetpackage

Target.Create "DotnetCorePushNuGet" (fun _ ->
// dotnet pack
Expand All @@ -853,7 +857,7 @@ Target.Create "DotnetCorePushNuGet" (fun _ ->
let projName = Path.GetFileName(Path.GetDirectoryName proj)
!! (sprintf "nuget/dotnetcore/%s.*.nupkg" projName)
-- (sprintf "nuget/dotnetcore/%s.*.symbols.nupkg" projName)
|> Seq.iter nugetPush)
|> Seq.iter (nugetPush 4))
)

Target.Create "PublishNuget" (fun _ ->
Expand Down
3 changes: 1 addition & 2 deletions help/markdown/fake-commandline.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ Display CLI help.
For this short sample we assume you have the latest version of FAKE installed and available in PATH (see [the getting started guide](gettingstarted.html)). Now consider the following small FAKE script:

(* -- Fake Dependencies paket-inline
source https://nuget.org/api/v2
source ../../../nuget/dotnetcore
source https://api.nuget.org/v3/index.json

nuget Fake.Core.Target prerelease
nuget FSharp.Core prerelease
Expand Down
2 changes: 1 addition & 1 deletion help/markdown/fake-fake5-custom-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ One example would be:

[lang=fsharp]
(* -- Fake Dependencies paket-inline
source https://nuget.org/api/v2
source https://api.nuget.org/v3/index.json

nuget Fake.Core.Target prerelease
nuget MyTaskNuGetPackage
Expand Down
4 changes: 2 additions & 2 deletions help/markdown/fake-fake5-modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Create a new file `paket.dependencies` and add the following content
```
// [ FAKE GROUP ]
group NetcoreBuild
source https://nuget.org/api/v2
source https://api.nuget.org/v3/index.json

nuget Fake.Core.Target prerelease
```
Expand Down Expand Up @@ -84,7 +84,7 @@ To write your build dependencies in-line you can put the following at the top of

[lang=fsharp]
(* -- Fake Dependencies paket-inline
source https://nuget.org/api/v2
source https://api.nuget.org/v3/index.json

nuget Fake.Core.Target prerelease
-- Fake Dependencies -- *)
Expand Down
2 changes: 1 addition & 1 deletion src/app/Fake.Core.Environment/Environment.fs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ module Environment =
| _ -> defaultValue

/// Retrieves the environment variable with the given name or returns the false if no value was set
let environVarVarAsBool varName = environVarAsBoolOrDefault varName false
let environVarAsBool varName = environVarAsBoolOrDefault varName false

/// Retrieves the environment variable or None
let environVarOrNone name =
Expand Down
10 changes: 4 additions & 6 deletions src/app/Fake.DotNet.NuGet/NuGet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -335,9 +335,8 @@ let rec private publish parameters =
info.Arguments <- args) parameters.TimeOut
finally setEnableProcessTracing tracing
if result <> 0 then failwithf "Error during NuGet push. %s %s" parameters.ToolPath args
with exn ->
if parameters.PublishTrials > 0 then publish { parameters with PublishTrials = parameters.PublishTrials - 1 }
else raise exn
with exn when parameters.PublishTrials > 0 ->
publish { parameters with PublishTrials = parameters.PublishTrials - 1 }

/// push package to symbol server (and try again if something fails)
let rec private publishSymbols parameters =
Expand All @@ -358,9 +357,8 @@ let rec private publishSymbols parameters =
info.Arguments <- args) parameters.TimeOut
finally setEnableProcessTracing tracing
if result <> 0 then failwithf "Error during NuGet symbol push. %s %s" parameters.ToolPath args
with exn ->
if parameters.PublishTrials > 0 then publish { parameters with PublishTrials = parameters.PublishTrials - 1 }
else raise exn
with exn when parameters.PublishTrials > 0->
publish { parameters with PublishTrials = parameters.PublishTrials - 1 }

/// Creates a new NuGet package based on the given .nuspec or project file.
/// The .nuspec / projectfile is passed as-is (no templating is performed)
Expand Down
2 changes: 1 addition & 1 deletion src/app/Fake.IO.FileSystem/FileUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ module Shell =
let pwd = Directory.GetCurrentDirectory

/// The stack of directories operated on by pushd and popd
let dirStack = new System.Collections.Generic.Stack<string>()
let private dirStack = new System.Collections.Generic.Stack<string>()

/// Store the current directory in the directory stack before changing to a new one
let pushd path =
Expand Down
50 changes: 34 additions & 16 deletions src/app/FakeLib/AssemblyInfoFile.fs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/// Contains tasks to generate AssemblyInfo files for C# and F#.
/// There is also a tutorial about the [AssemblyInfo tasks](../assemblyinfo.html) available.
[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use Fake.DotNet.AssemblyInfoFile instead")>]
module Fake.AssemblyInfoFile

open System
open System.IO
open System.Text.RegularExpressions

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use Fake.DotNet.AssemblyInfoFile instead")>]
// Helper active pattern for project types
let (|Fsproj|Csproj|Vbproj|Shproj|) (projFileName:string) =
match projFileName with
Expand Down Expand Up @@ -51,7 +51,7 @@ let private NormalizeVersion version =
if m.Captures.Count > 0 then m.Captures.[0].Value
else version

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use Fake.DotNet.AssemblyInfoFileConfig instead")>]
/// Represents options for configuring the emission of AssemblyInfo
type AssemblyInfoFileConfig
( // If true, a module (for F#) or static class (for C#), which contains the assembly version, will be generated
Expand All @@ -71,7 +71,7 @@ type AssemblyInfoFileConfig
| None -> false
static member Default = AssemblyInfoFileConfig(true)

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.___' instead")>]
/// Represents AssemblyInfo attributes
type Attribute(name, value, inNamespace, staticPropName, staticPropType, staticPropValue) =
member this.Name = name
Expand All @@ -93,66 +93,84 @@ type Attribute(name, value, inNamespace, staticPropName, staticPropType, staticP
static member BoolAttribute(name, value, inNamespace) = Attribute(name, sprintf "%b" value, inNamespace, typeof<bool>.FullName)

/// Creates an attribute which holds the company information
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.Company' instead")>]
static member Company(value) = Attribute.StringAttribute("AssemblyCompany", value, "System.Reflection")

/// Creates an attribute which holds the product name
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.Product' instead")>]
static member Product(value) = Attribute.StringAttribute("AssemblyProduct", value, "System.Reflection")

/// Creates an attribute which holds the copyright information
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.Copyright' instead")>]
static member Copyright(value) = Attribute.StringAttribute("AssemblyCopyright", value, "System.Reflection")

/// Creates an attribute which holds the product title
static member Title(value) = Attribute.StringAttribute("AssemblyTitle", value, "System.Reflection")

/// Creates an attribute which holds the product description
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.Description' instead")>]
static member Description(value) = Attribute.StringAttribute("AssemblyDescription", value, "System.Reflection")

/// Creates an attribute which holds the assembly culture information
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.Culture' instead")>]
static member Culture(value) = Attribute.StringAttribute("AssemblyCulture", value, "System.Reflection")

/// Creates an attribute which holds the assembly configuration
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.Configuration' instead")>]
static member Configuration(value) = Attribute.StringAttribute("AssemblyConfiguration", value, "System.Reflection")

/// Creates an attribute which holds the trademark
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.Trademark' instead")>]
static member Trademark(value) = Attribute.StringAttribute("AssemblyTrademark", value, "System.Reflection")

/// Creates an attribute which holds the assembly version
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.Version' instead")>]
static member Version(value) =
Attribute.StringAttribute("AssemblyVersion", NormalizeVersion value, "System.Reflection")

/// Creates an attribute which holds the assembly key file
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.KeyFile' instead")>]
static member KeyFile(value) = Attribute.StringAttribute("AssemblyKeyFile", value, "System.Reflection")

/// Creates an attribute which holds the assembly key name
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.KeyName' instead")>]
static member KeyName(value) = Attribute.StringAttribute("AssemblyKeyName", value, "System.Reflection")

/// Creates an attribute which holds the "InternalVisibleTo" data
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.InternalsVisibleTo' instead")>]
static member InternalsVisibleTo(value) =
Attribute.StringAttribute("InternalsVisibleTo", value, "System.Runtime.CompilerServices")

/// Creates an attribute which holds the assembly file version
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.FileVersion' instead")>]
static member FileVersion(value) =
Attribute.StringAttribute("AssemblyFileVersion", NormalizeVersion value, "System.Reflection")

/// Creates an attribute which holds an assembly information version
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.InformationalVersion' instead")>]
static member InformationalVersion(value) =
Attribute.StringAttribute("AssemblyInformationalVersion", value, "System.Reflection")

/// Creates an attribute which holds the Guid
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.Guid' instead")>]
static member Guid(value) = Attribute.StringAttribute("Guid", value, "System.Runtime.InteropServices")

/// Creates an attribute which specifies if the assembly is visible via COM
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.ComVisible' instead")>]
static member ComVisible(?value) =
Attribute.BoolAttribute("ComVisible", defaultArg value false, "System.Runtime.InteropServices")

/// Creates an attribute which specifies if the assembly is CLS compliant
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.CLSCompliant' instead")>]
static member CLSCompliant(?value) = Attribute.BoolAttribute("CLSCompliant", defaultArg value false, "System")

/// Creates an attribute which specifies if the assembly uses delayed signing
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.DelaySign' instead")>]
static member DelaySign(value) =
Attribute.BoolAttribute("AssemblyDelaySign", defaultArg value false, "System.Reflection")

/// Create an attribute which specifies metadata about the assembly
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfo.Metadata' instead")>]
static member Metadata(name,value) =
Attribute.StringAttribute("AssemblyMetadata", sprintf "%s\",\"%s" name value, "System.Reflection", sprintf "AssemblyMetadata_%s" (name.Replace(" ", "_")), sprintf "\"%s\"" value)

Expand Down Expand Up @@ -193,7 +211,7 @@ let private getSortedAndNumberedAttributes (attrs: seq<Attribute>) =
(name, attr.StaticPropertyType, attr.StaticPropertyValue))


[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.CreateCSharpWithConfig' instead")>]
/// Creates a C# AssemblyInfo file with the given attributes and configuration.
/// The generated AssemblyInfo file contains an AssemblyVersionInformation class which can be used to retrieve the current version no. from inside of an assembly.
let CreateCSharpAssemblyInfoWithConfig outputFileName attributes (config : AssemblyInfoFileConfig) =
Expand Down Expand Up @@ -241,7 +259,7 @@ let CreateCSharpAssemblyInfoWithConfig outputFileName attributes (config : Assem
attributeLines @ sourceLines
|> writeToFile outputFileName

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.CreateFSharpWithConfig' instead")>]
/// Creates a F# AssemblyInfo file with the given attributes and configuration.
/// The generated AssemblyInfo file contains an AssemblyVersionInformation class which can be used to retrieve the current version no. from inside of an assembly.
let CreateFSharpAssemblyInfoWithConfig outputFileName attributes (config : AssemblyInfoFileConfig) =
Expand Down Expand Up @@ -272,7 +290,7 @@ let CreateFSharpAssemblyInfoWithConfig outputFileName attributes (config : Assem

sourceLines |> writeToFile outputFileName

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.CreateVisualBasicWithConfig' instead")>]
/// Creates a VB AssemblyInfo file with the given attributes and configuration.
/// The generated AssemblyInfo file contains an AssemblyVersionInformation class which can be used to retrieve the current version no. from inside of an assembly.
let CreateVisualBasicAssemblyInfoWithConfig outputFileName attributes (config : AssemblyInfoFileConfig) =
Expand All @@ -299,7 +317,7 @@ let CreateVisualBasicAssemblyInfoWithConfig outputFileName attributes (config :
attributeLines @ sourceLines
|> writeToFile outputFileName

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.CreateCppCliWithConfig' instead")>]
/// Creates a C++/CLI AssemblyInfo file with the given attributes and configuration.
/// Does not generate an AssemblyVersionInformation class.
let CreateCppCliAssemblyInfoWithConfig outputFileName attributes (config : AssemblyInfoFileConfig) =
Expand All @@ -318,25 +336,25 @@ let CreateCppCliAssemblyInfoWithConfig outputFileName attributes (config : Assem
attributeLines
|> writeToFile outputFileName

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.CreateCSharp' instead")>]
/// Creates a C# AssemblyInfo file with the given attributes.
/// The generated AssemblyInfo file contains an AssemblyVersionInformation class which can be used to retrieve the current version no. from inside of an assembly.
let CreateCSharpAssemblyInfo outputFileName attributes =
CreateCSharpAssemblyInfoWithConfig outputFileName attributes AssemblyInfoFileConfig.Default

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.CreateFSharp' instead")>]
/// Creates a F# AssemblyInfo file with the given attributes.
/// The generated AssemblyInfo file contains an AssemblyVersionInformation class which can be used to retrieve the current version no. from inside of an assembly.
let CreateFSharpAssemblyInfo outputFileName attributes =
CreateFSharpAssemblyInfoWithConfig outputFileName attributes AssemblyInfoFileConfig.Default

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.CreateVisualBasic' instead")>]
/// Creates a VB AssemblyInfo file with the given attributes.
/// The generated AssemblyInfo file contains an AssemblyVersionInformation class which can be used to retrieve the current version no. from inside of an assembly.
let CreateVisualBasicAssemblyInfo outputFileName attributes =
CreateVisualBasicAssemblyInfoWithConfig outputFileName attributes AssemblyInfoFileConfig.Default

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.CreateCppCli' instead")>]
/// Creates a C++/CLI AssemblyInfo file with the given attributes.
let CreateCppCliAssemblyInfo outputFileName attributes =
CreateCppCliAssemblyInfoWithConfig outputFileName attributes AssemblyInfoFileConfig.Default
Expand All @@ -347,7 +365,7 @@ let private removeAtEnd (textToRemove:string) (text:string) =
else
text

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.GetAttributes' instead")>]
/// Read attributes from an AssemblyInfo file and return as a sequence of Attribute.
/// ## Parameters
/// - `assemblyInfoFile` - The file to read attributes from. Language C#, F#, VB or C++ is determined from the extension.
Expand All @@ -374,15 +392,15 @@ let GetAttributes assemblyInfoFile =
Attribute(m.Groups.["name"].Value |> removeAtEnd "Attribute", v.Trim([|'"'|]), "", t)
)

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.GetAttribute' instead")>]
/// Read a single attribute from an AssemblyInfo file.
/// ## Parameters
/// - `attrName` - Name of the attribute without "Attribute" at the end.
/// - `assemblyInfoFile` - The file to read from. Language C#, F#, VB or C++ is determined from the extension.
let GetAttribute attrName assemblyInfoFile =
assemblyInfoFile |> GetAttributes |> Seq.tryFind (fun a -> a.Name = attrName)

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.GetAttributeValue' instead")>]
/// Read the value of a single attribute from an AssemblyInfo file. Note that string values are returned with surrounding "".
/// ## Parameters
/// - `attrName` - Name of the attribute without "Attribute" at the end.
Expand Down Expand Up @@ -411,7 +429,7 @@ let private updateAttr regexFactory additionalRegexOptions text (attribute:Attri
else
failwithf "Attribute '%s' not found" attribute.Name

[<System.Obsolete("Use Fake.DotNet.AssemblyInfoFile instead")>]
[<System.Obsolete("FAKE0001 Use 'open Fake.DotNet' and 'AssemblyInfoFile.UpdateAttributes' instead")>]
/// Update a set of attributes in an AssemblyInfo file. Fails if any attribute is not found.
/// ## Parameters
/// - `assemblyInfoFile` - The file to update. Language C#, F#, VB or C++ is determined from the extension.
Expand Down
Loading