Skip to content

Commit

Permalink
simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
matthid committed Sep 11, 2018
1 parent fc17d1e commit 4fe3fed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 27 deletions.
25 changes: 5 additions & 20 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -943,21 +943,6 @@ Target.create "FastRelease" (fun _ ->
Target.create "Release_Staging" (fun _ -> ())

open System.IO.Compression
let unzip target (fileName : string) =
use stream = new FileStream(fileName, FileMode.Open)
use zipFile = new ZipArchive(stream)
for zipEntry in zipFile.Entries do
let unzipPath = Path.Combine(target, zipEntry.FullName)
let directoryPath = Path.GetDirectoryName(unzipPath)
if unzipPath.EndsWith "/" then
Directory.CreateDirectory(unzipPath) |> ignore
else
// unzip the file
Directory.ensure directoryPath
let zipStream = zipEntry.Open()
if unzipPath.EndsWith "/" |> not then
use unzippedFileStream = File.Create(unzipPath)
zipStream.CopyTo(unzippedFileStream)

Target.create "PrepareArtifacts" (fun _ ->
if not fromArtifacts then
Expand All @@ -972,23 +957,23 @@ Target.create "PrepareArtifacts" (fun _ ->
files
|> Shell.copy (nugetDncDir </> "Fake.netcore")

unzip nugetDncDir (artifactsDir </> "fake-dotnetcore-packages.zip")
Zip.unzip nugetDncDir (artifactsDir </> "fake-dotnetcore-packages.zip")

if Environment.isWindows then
Directory.ensure chocoReleaseDir
let name = sprintf "%s.%s.nupkg" "fake" chocoVersion
Shell.copyFile (sprintf "%s/%s" chocoReleaseDir name) (artifactsDir </> sprintf "chocolatey-%s" name)
else
unzip "." (artifactsDir </> "chocolatey-requirements.zip")
Zip.unzip "." (artifactsDir </> "chocolatey-requirements.zip")

if buildLegacy then
Directory.ensure nugetLegacyDir
unzip nugetLegacyDir (artifactsDir </> "fake-legacy-packages.zip")
Zip.unzip nugetLegacyDir (artifactsDir </> "fake-legacy-packages.zip")

Directory.ensure "temp/build"
!! (nugetLegacyDir </> "*.nupkg")
|> Seq.iter (fun pack ->
unzip "temp/build" pack
Zip.unzip "temp/build" pack
)
Shell.copyDir "build" "temp/build" (fun _ -> true)

Expand All @@ -1001,7 +986,7 @@ Target.create "PrepareArtifacts" (fun _ ->
let unzipIfExists dir file =
Directory.ensure dir
if File.Exists file then
unzip dir file
Zip.unzip dir file

// File is not available in case we already have build the full docs
unzipIfExists "help" (artifactsDir </> "help-markdown.zip")
Expand Down
8 changes: 1 addition & 7 deletions legacy-build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,7 @@ let legacyAssemblyInfos =
AssemblyInfo.Guid "E18BDD6F-1AF8-42BB-AEB6-31CD1AC7E56D"] @ common ]

let publish f =
// Workaround
let path = Path.GetFullPath f
let name = Path.GetFileName path
let target = Path.Combine("artifacts", name)
let targetDir = Path.GetDirectoryName target
Directory.ensure targetDir
Trace.publish ImportData.BuildArtifact (Path.GetFullPath f)
Trace.publish ImportData.BuildArtifact f

Target.create "_Legacy_BuildSolution" (fun _ ->
MSBuild.runWithDefaults "Build" ["./src/Legacy-FAKE.sln"; "./src/Legacy-FAKE.Deploy.Web.sln"]
Expand Down

0 comments on commit 4fe3fed

Please sign in to comment.