From c462ea554d156840ed5fa3cd7370b91c41c699cb Mon Sep 17 00:00:00 2001 From: "Achim D. Brucker" Date: Sun, 6 Aug 2017 17:59:09 +0100 Subject: [PATCH] Basic import of FSharp.ProjectScaffold setup. --- .gitattributes | 26 ++ .gitignore | 102 ++++- LogicalHacking.ExtensionDsLab.sln | 60 +++ RELEASE_NOTES.md | 1 + build.cmd | 18 + build.fsx | 373 ++++++++++++++++++ build.sh | 77 ++++ configure.sh | 23 -- docsrc/content/index.fsx | 49 +++ docsrc/content/tutorial.fsx | 19 + docsrc/files/img/logo-template.pdn | Bin 0 -> 15052 bytes docsrc/files/img/logo.png | Bin 0 -> 1581 bytes docsrc/tools/generate.fsx | 145 +++++++ docsrc/tools/templates/template.cshtml | 58 +++ paket.dependencies | 27 +- src/LogicalHacking.ExtensionDsLab/App.config | 10 + .../AssemblyInfo.fs | 19 + src/LogicalHacking.ExtensionDsLab/Library.fs | 16 + .../LogicalHacking.ExtensionDsLab.fsproj | 78 ++++ src/LogicalHacking.ExtensionDsLab/Script.fsx | 8 + .../paket.references | 1 + .../paket.template | 25 ++ .../App.config | 10 + ...LogicalHacking.ExtensionDsLab.Tests.fsproj | 99 +++++ .../Tests.fs | 10 + .../paket.references | 4 + 26 files changed, 1224 insertions(+), 34 deletions(-) create mode 100644 .gitattributes create mode 100644 LogicalHacking.ExtensionDsLab.sln create mode 100644 RELEASE_NOTES.md create mode 100644 build.cmd create mode 100644 build.fsx create mode 100755 build.sh delete mode 100755 configure.sh create mode 100644 docsrc/content/index.fsx create mode 100644 docsrc/content/tutorial.fsx create mode 100644 docsrc/files/img/logo-template.pdn create mode 100644 docsrc/files/img/logo.png create mode 100644 docsrc/tools/generate.fsx create mode 100644 docsrc/tools/templates/template.cshtml create mode 100644 src/LogicalHacking.ExtensionDsLab/App.config create mode 100644 src/LogicalHacking.ExtensionDsLab/AssemblyInfo.fs create mode 100644 src/LogicalHacking.ExtensionDsLab/Library.fs create mode 100644 src/LogicalHacking.ExtensionDsLab/LogicalHacking.ExtensionDsLab.fsproj create mode 100644 src/LogicalHacking.ExtensionDsLab/Script.fsx create mode 100644 src/LogicalHacking.ExtensionDsLab/paket.references create mode 100644 src/LogicalHacking.ExtensionDsLab/paket.template create mode 100644 tests/LogicalHacking.ExtensionDsLab.Tests/App.config create mode 100644 tests/LogicalHacking.ExtensionDsLab.Tests/LogicalHacking.ExtensionDsLab.Tests.fsproj create mode 100644 tests/LogicalHacking.ExtensionDsLab.Tests/Tests.fs create mode 100644 tests/LogicalHacking.ExtensionDsLab.Tests/paket.references diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7ff73f4 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,26 @@ +# Auto detect text files +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp text=auto eol=lf +*.vb diff=csharp text=auto eol=lf +*.fs diff=csharp text=auto eol=lf +*.fsi diff=csharp text=auto eol=lf +*.fsx diff=csharp text=auto eol=lf +*.sln text eol=crlf merge=union +*.csproj merge=union +*.vbproj merge=union +*.fsproj merge=union +*.dbproj merge=union + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore index 3489367..163c359 100644 --- a/.gitignore +++ b/.gitignore @@ -14,10 +14,23 @@ TestResults *.user *.sln.docstates +# Xamarin Studio / monodevelop user-specific +*.userprefs +*.dll.mdb +*.exe.mdb + # Build results [Dd]ebug/ [Rr]elease/ x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + *_i.c *_p.c *.ilk @@ -33,10 +46,14 @@ x64/ *.tli *.tlh *.tmp +*.tmp_proj *.log *.vspscc *.vssscc .builds +*.pidb +*.log +*.scc # Visual C++ cache files ipch/ @@ -44,24 +61,35 @@ ipch/ *.ncb *.opensdf *.sdf +*.cachefile # Visual Studio profiler *.psess *.vsp *.vspx +# Other Visual Studio data +.vs/ + # Guidance Automation Toolkit *.gpState # ReSharper is a .NET coding add-in -_ReSharper* +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover # NCrunch *.ncrunch* .*crunch*.local.xml # Installshield output folder -[Ee]xpress +[Ee]xpress/ # DocProject is a documentation generator add-in DocProject/buildhelp/ @@ -74,14 +102,15 @@ DocProject/Help/Html2 DocProject/Help/html # Click-Once directory -publish +publish/ # Publish Web Output *.Publish.xml # NuGet Packages Directory packages - +# Enable nuget.exe in the .nuget folder (though normally executables are not tracked) +!.nuget/NuGet.exe # Packet lock file paket.lock .paket/paket.exe @@ -93,24 +122,83 @@ csx # Windows Store app package directory AppPackages/ +# VSCode +.vscode/ + # Others [Bb]in [Oo]bj -sql +sql/ TestResults [Tt]est[Rr]esult* *.Cache -ClientBin +ClientBin/ [Ss]tyle[Cc]op.* ~$* +*~ *.dbmdl -Generated_Code #added for RIA/Silverlight projects +*.[Pp]ublish.xml +*.pfx +*.publishsettings +# RIA/Silverlight projects +Generated_Code/ # Backup & report files from converting an old project file to a newer # Visual Studio version. Backup files are not needed, because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML +UpgradeLog*.htm # Default archive directory archive +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + + +#LightSwitch generated files +GeneratedArtifacts/ +_Pvt_Extensions/ +ModelManifest.xml + +# ========================= +# Windows detritus +# ========================= + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac desktop service store files +.DS_Store + +# =================================================== +# Exclude F# project specific directories and files +# =================================================== + +# NuGet Packages Directory +packages/ + +# Test results produced by build +TestResults.xml + +# Nuget outputs +nuget/*.nupkg +release.cmd +release.sh +docs +localpackages/ +paket-files +*.orig +.paket/paket.exe +docsrc/content/license.md +docsrc/content/release-notes.md +.fake +docsrc/tools/FSharp.Formatting.svclog diff --git a/LogicalHacking.ExtensionDsLab.sln b/LogicalHacking.ExtensionDsLab.sln new file mode 100644 index 0000000..7c3a88e --- /dev/null +++ b/LogicalHacking.ExtensionDsLab.sln @@ -0,0 +1,60 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".paket", ".paket", "{63297B98-5CED-492C-A5B7-A5B4F73CF142}" + ProjectSection(SolutionItems) = preProject + paket.dependencies = paket.dependencies + paket.lock = paket.lock + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "LogicalHacking.ExtensionDsLab", "src\LogicalHacking.ExtensionDsLab\LogicalHacking.ExtensionDsLab.fsproj", "{8A2EBFC4-14CE-4D77-81DE-1FD7372C3382}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "project", "project", "{BF60BC93-E09B-4E5F-9D85-95A519479D54}" + ProjectSection(SolutionItems) = preProject + build.fsx = build.fsx + README.md = README.md + RELEASE_NOTES.md = RELEASE_NOTES.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{83F16175-43B1-4C90-A1EE-8E351C33435D}" + ProjectSection(SolutionItems) = preProject + docsrc\tools\generate.fsx = docsrc\tools\generate.fsx + docsrc\tools\templates\template.cshtml = docsrc\tools\templates\template.cshtml + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "content", "content", "{8E6D5255-776D-4B61-85F9-73C37AA1FB9A}" + ProjectSection(SolutionItems) = preProject + docsrc\content\index.fsx = docsrc\content\index.fsx + docsrc\content\tutorial.fsx = docsrc\content\tutorial.fsx + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{ED8079DD-2B06-4030-9F0F-DC548F98E1C4}" +EndProject +Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "LogicalHacking.ExtensionDsLab.Tests", "tests\LogicalHacking.ExtensionDsLab.Tests\LogicalHacking.ExtensionDsLab.Tests.fsproj", "{661253B3-4C4D-4EBD-87E4-F1C6F010347F}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8A2EBFC4-14CE-4D77-81DE-1FD7372C3382}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8A2EBFC4-14CE-4D77-81DE-1FD7372C3382}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8A2EBFC4-14CE-4D77-81DE-1FD7372C3382}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8A2EBFC4-14CE-4D77-81DE-1FD7372C3382}.Release|Any CPU.Build.0 = Release|Any CPU + {661253B3-4C4D-4EBD-87E4-F1C6F010347F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {661253B3-4C4D-4EBD-87E4-F1C6F010347F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {661253B3-4C4D-4EBD-87E4-F1C6F010347F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {661253B3-4C4D-4EBD-87E4-F1C6F010347F}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {83F16175-43B1-4C90-A1EE-8E351C33435D} = {A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1} + {8E6D5255-776D-4B61-85F9-73C37AA1FB9A} = {A6A6AF7D-D6E3-442D-9B1E-58CC91879BE1} + {661253B3-4C4D-4EBD-87E4-F1C6F010347F} = {ED8079DD-2B06-4030-9F0F-DC548F98E1C4} + EndGlobalSection +EndGlobal diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md new file mode 100644 index 0000000..20e91cc --- /dev/null +++ b/RELEASE_NOTES.md @@ -0,0 +1 @@ +#### 0.0.0 diff --git a/build.cmd b/build.cmd new file mode 100644 index 0000000..09b44ff --- /dev/null +++ b/build.cmd @@ -0,0 +1,18 @@ +@echo off +cls + +.paket\paket.bootstrapper.exe +if errorlevel 1 ( + exit /b %errorlevel% +) + +.paket\paket.exe restore +if errorlevel 1 ( + exit /b %errorlevel% +) + +IF NOT EXIST build.fsx ( + .paket\paket.exe update + packages\build\FAKE\tools\FAKE.exe init.fsx +) +packages\build\FAKE\tools\FAKE.exe build.fsx %* diff --git a/build.fsx b/build.fsx new file mode 100644 index 0000000..e6bd840 --- /dev/null +++ b/build.fsx @@ -0,0 +1,373 @@ +// -------------------------------------------------------------------------------------- +// FAKE build script +// -------------------------------------------------------------------------------------- + +#r @"packages/build/FAKE/tools/FakeLib.dll" +open Fake +open Fake.Git +open Fake.AssemblyInfoFile +open Fake.ReleaseNotesHelper +open Fake.UserInputHelper + +open System +open System.IO +open System.Diagnostics + +// -------------------------------------------------------------------------------------- +// START TODO: Provide project-specific details below +// -------------------------------------------------------------------------------------- + +// Information about the project are used +// - for version and project name in generated AssemblyInfo file +// - by the generated NuGet package +// - to run tests and to publish documentation on GitHub gh-pages +// - for documentation, you also need to edit info in "docsrc/tools/generate.fsx" + +// The name of the project +// (used by attributes in AssemblyInfo, name of a NuGet package and directory in 'src') +let project = "LogicalHacking.ExtensionDsLab" + +// Short summary of the project +// (used as description in AssemblyInfo and as a short summary for NuGet package) +let summary = "A data science framework for analyzing Chrome browser extensions." + +// Longer description of the project +// (used as a description for NuGet package; line breaks are automatically cleaned up) +let description = "A data science framework for analyzing Chrome browser extensions." + +// List of author names (for NuGet package) +let authors = [ "Achim D. Brucker" ] + +// Tags for your project (for NuGet package) +let tags = "ChromeExtension DataScience BrowserSecurity" + +// File system information +let solutionFile = "LogicalHacking.ExtensionDsLab.sln" + +// Default target configuration +let configuration = "Release" + +// Pattern specifying assemblies to be tested using NUnit +let testAssemblies = "tests/**/bin" configuration "*Tests*.dll" + +// Git configuration (used for publishing documentation in gh-pages branch) +// The profile where the project is posted +let gitOwner = "BrowserSecurity" +let gitHome = sprintf "%s/%s" "https://git.logicalhacking.com" gitOwner + +// The name of the project on GitHub +let gitName = "ExtensionDsLab" + +// The url for the raw files hosted +let gitRaw = environVarOrDefault "gitRaw" "https://git.logicalhacking.com/BrowserSecurity" + +// -------------------------------------------------------------------------------------- +// END TODO: The rest of the file includes standard build steps +// -------------------------------------------------------------------------------------- + +// Read additional information from the release notes document +let release = LoadReleaseNotes "RELEASE_NOTES.md" + +// Helper active pattern for project types +let (|Fsproj|Csproj|Vbproj|Shproj|) (projFileName:string) = + match projFileName with + | f when f.EndsWith("fsproj") -> Fsproj + | f when f.EndsWith("csproj") -> Csproj + | f when f.EndsWith("vbproj") -> Vbproj + | f when f.EndsWith("shproj") -> Shproj + | _ -> failwith (sprintf "Project file %s not supported. Unknown project type." projFileName) + +// Generate assembly info files with the right version & up-to-date information +Target "AssemblyInfo" (fun _ -> + let getAssemblyInfoAttributes projectName = + [ Attribute.Title (projectName) + Attribute.Product project + Attribute.Description summary + Attribute.Version release.AssemblyVersion + Attribute.FileVersion release.AssemblyVersion + Attribute.Configuration configuration ] + + let getProjectDetails projectPath = + let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath) + ( projectPath, + projectName, + System.IO.Path.GetDirectoryName(projectPath), + (getAssemblyInfoAttributes projectName) + ) + + !! "src/**/*.??proj" + |> Seq.map getProjectDetails + |> Seq.iter (fun (projFileName, projectName, folderName, attributes) -> + match projFileName with + | Fsproj -> CreateFSharpAssemblyInfo (folderName "AssemblyInfo.fs") attributes + | Csproj -> CreateCSharpAssemblyInfo ((folderName "Properties") "AssemblyInfo.cs") attributes + | Vbproj -> CreateVisualBasicAssemblyInfo ((folderName "My Project") "AssemblyInfo.vb") attributes + | Shproj -> () + ) +) + +// Copies binaries from default VS location to expected bin folder +// But keeps a subdirectory structure for each project in the +// src folder to support multiple project outputs +Target "CopyBinaries" (fun _ -> + !! "src/**/*.??proj" + -- "src/**/*.shproj" + |> Seq.map (fun f -> ((System.IO.Path.GetDirectoryName f) "bin" configuration, "bin" (System.IO.Path.GetFileNameWithoutExtension f))) + |> Seq.iter (fun (fromDir, toDir) -> CopyDir toDir fromDir (fun _ -> true)) +) + +// -------------------------------------------------------------------------------------- +// Clean build results + +let vsProjProps = +#if MONO + [ ("DefineConstants","MONO"); ("Configuration", configuration) ] +#else + [ ("Configuration", configuration); ("Platform", "Any CPU") ] +#endif + +Target "Clean" (fun _ -> + !! solutionFile |> MSBuildReleaseExt "" vsProjProps "Clean" |> ignore + CleanDirs ["bin"; "temp"; "docs"] +) + +// -------------------------------------------------------------------------------------- +// Build library & test project + +Target "Build" (fun _ -> + !! solutionFile + |> MSBuildReleaseExt "" vsProjProps "Rebuild" + |> ignore +) + +// -------------------------------------------------------------------------------------- +// Run the unit tests using test runner + +Target "RunTests" (fun _ -> + !! testAssemblies + |> NUnit (fun p -> + { p with + DisableShadowCopy = true + TimeOut = TimeSpan.FromMinutes 20. + OutputFile = "TestResults.xml" }) +) + + +// -------------------------------------------------------------------------------------- +// Build a NuGet package + +Target "NuGet" (fun _ -> + Paket.Pack(fun p -> + { p with + OutputPath = "bin" + Version = release.NugetVersion + ReleaseNotes = toLines release.Notes}) +) + +Target "PublishNuget" (fun _ -> + Paket.Push(fun p -> + { p with + PublishUrl = "https://www.nuget.org" + WorkingDir = "bin" }) +) + + +// -------------------------------------------------------------------------------------- +// Generate the documentation + + +let fakePath = "packages" "build" "FAKE" "tools" "FAKE.exe" +let fakeStartInfo script workingDirectory args fsiargs environmentVars = + (fun (info: ProcessStartInfo) -> + info.FileName <- System.IO.Path.GetFullPath fakePath + info.Arguments <- sprintf "%s --fsiargs -d:FAKE %s \"%s\"" args fsiargs script + info.WorkingDirectory <- workingDirectory + let setVar k v = + info.EnvironmentVariables.[k] <- v + for (k, v) in environmentVars do + setVar k v + setVar "MSBuild" msBuildExe + setVar "GIT" Git.CommandHelper.gitPath + setVar "FSI" fsiPath) + +/// Run the given buildscript with FAKE.exe +let executeFAKEWithOutput workingDirectory script fsiargs envArgs = + let exitCode = + ExecProcessWithLambdas + (fakeStartInfo script workingDirectory "" fsiargs envArgs) + TimeSpan.MaxValue false ignore ignore + System.Threading.Thread.Sleep 1000 + exitCode + +// Documentation +let buildDocumentationTarget fsiargs target = + trace (sprintf "Building documentation (%s), this could take some time, please wait..." target) + let exit = executeFAKEWithOutput "docsrc/tools" "generate.fsx" fsiargs ["target", target] + if exit <> 0 then + failwith "generating reference documentation failed" + () + +Target "GenerateReferenceDocs" (fun _ -> + buildDocumentationTarget "-d:RELEASE -d:REFERENCE" "Default" +) + +let generateHelp' fail debug = + let args = + if debug then "--define:HELP" + else "--define:RELEASE --define:HELP" + try + buildDocumentationTarget args "Default" + traceImportant "Help generated" + with + | e when not fail -> + traceImportant "generating help documentation failed" + +let generateHelp fail = + generateHelp' fail false + +Target "GenerateHelp" (fun _ -> + DeleteFile "docsrc/content/release-notes.md" + CopyFile "docsrc/content/" "RELEASE_NOTES.md" + Rename "docsrc/content/release-notes.md" "docsrc/content/RELEASE_NOTES.md" + + DeleteFile "docsrc/content/license.md" + CopyFile "docsrc/content/" "LICENSE" + Rename "docsrc/content/license.md" "docsrc/content/LICENSE" + + generateHelp true +) + +Target "GenerateHelpDebug" (fun _ -> + DeleteFile "docsrc/content/release-notes.md" + CopyFile "docsrc/content/" "RELEASE_NOTES.md" + Rename "docsrc/content/release-notes.md" "docsrc/content/RELEASE_NOTES.md" + + DeleteFile "docsrc/content/license.md" + CopyFile "docsrc/content/" "LICENSE" + Rename "docsrc/content/license.md" "docsrc/content/LICENSE" + + generateHelp' true true +) + +Target "KeepRunning" (fun _ -> + use watcher = !! "docsrc/content/**/*.*" |> WatchChanges (fun changes -> + generateHelp' true true + ) + + traceImportant "Waiting for help edits. Press any key to stop." + + System.Console.ReadKey() |> ignore + + watcher.Dispose() +) + +Target "GenerateDocs" DoNothing + +let createIndexFsx lang = + let content = """(*** hide ***) +// This block of code is omitted in the generated HTML documentation. Use +// it to define helpers that you do not want to show in the documentation. +#I "../../../bin" + +(** +F# Project Scaffold ({0}) +========================= +*) +""" + let targetDir = "docsrc/content" lang + let targetFile = targetDir "index.fsx" + ensureDirectory targetDir + System.IO.File.WriteAllText(targetFile, System.String.Format(content, lang)) + +Target "AddLangDocs" (fun _ -> + let args = System.Environment.GetCommandLineArgs() + if args.Length < 4 then + failwith "Language not specified." + + args.[3..] + |> Seq.iter (fun lang -> + if lang.Length <> 2 && lang.Length <> 3 then + failwithf "Language must be 2 or 3 characters (ex. 'de', 'fr', 'ja', 'gsw', etc.): %s" lang + + let templateFileName = "template.cshtml" + let templateDir = "docsrc/tools/templates" + let langTemplateDir = templateDir lang + let langTemplateFileName = langTemplateDir templateFileName + + if System.IO.File.Exists(langTemplateFileName) then + failwithf "Documents for specified language '%s' have already been added." lang + + ensureDirectory langTemplateDir + Copy langTemplateDir [ templateDir templateFileName ] + + createIndexFsx lang) +) + +// -------------------------------------------------------------------------------------- +// Release Scripts + +#load "paket-files/build/fsharp/FAKE/modules/Octokit/Octokit.fsx" +open Octokit + +Target "Release" (fun _ -> + let user = + match getBuildParam "github-user" with + | s when not (String.IsNullOrWhiteSpace s) -> s + | _ -> getUserInput "Username: " + let pw = + match getBuildParam "github-pw" with + | s when not (String.IsNullOrWhiteSpace s) -> s + | _ -> getUserPassword "Password: " + let remote = + Git.CommandHelper.getGitResult "" "remote -v" + |> Seq.filter (fun (s: string) -> s.EndsWith("(push)")) + |> Seq.tryFind (fun (s: string) -> s.Contains(gitOwner + "/" + gitName)) + |> function None -> gitHome + "/" + gitName | Some (s: string) -> s.Split().[0] + + StageAll "" + Git.Commit.Commit "" (sprintf "Bump version to %s" release.NugetVersion) + Branches.pushBranch "" remote (Information.getBranchName "") + + Branches.tag "" release.NugetVersion + Branches.pushTag "" remote release.NugetVersion + + // release on github + createClient user pw + |> createDraft gitOwner gitName release.NugetVersion (release.SemVer.PreRelease <> None) release.Notes + // TODO: |> uploadFile "PATH_TO_FILE" + |> releaseDraft + |> Async.RunSynchronously +) + +Target "BuildPackage" DoNothing + +// -------------------------------------------------------------------------------------- +// Run all targets by default. Invoke 'build ' to override + +Target "All" DoNothing + +"AssemblyInfo" + ==> "Build" + ==> "CopyBinaries" + ==> "RunTests" + ==> "GenerateReferenceDocs" + ==> "GenerateDocs" + ==> "NuGet" + ==> "BuildPackage" + ==> "All" + +"GenerateHelp" + ==> "GenerateReferenceDocs" + ==> "GenerateDocs" + +"GenerateHelpDebug" + ==> "KeepRunning" + +"Clean" + ==> "Release" + +"BuildPackage" + ==> "PublishNuget" + ==> "Release" + +RunTargetOrDefault "All" diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..c5de482 --- /dev/null +++ b/build.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash + +set -eu + +cd "$(dirname "$0")" + +PAKET_BOOTSTRAPPER_EXE=.paket/paket.bootstrapper.exe +PAKET_EXE=.paket/paket.exe +FAKE_EXE=packages/build/FAKE/tools/FAKE.exe + +FSIARGS="" +FSIARGS2="" +OS=${OS:-"unknown"} +if [ "$OS" != "Windows_NT" ] +then + # Can't use FSIARGS="--fsiargs -d:MONO" in zsh, so split it up + # (Can't use arrays since dash can't handle them) + FSIARGS="--fsiargs" + FSIARGS2="-d:MONO" +fi + +run() { + if [ "$OS" != "Windows_NT" ] + then + mono "$@" + else + "$@" + fi +} + +yesno() { + # NOTE: Defaults to NO + read -p "$1 [y/N] " ynresult + case "$ynresult" in + [yY]*) true ;; + *) false ;; + esac +} + +set +e +run $PAKET_BOOTSTRAPPER_EXE +bootstrapper_exitcode=$? +set -e + +if [ "$OS" != "Windows_NT" ] && + [ $bootstrapper_exitcode -ne 0 ] && + [ $(certmgr -list -c Trust | grep X.509 | wc -l) -le 1 ] && + [ $(certmgr -list -c -m Trust | grep X.509 | wc -l) -le 1 ] +then + echo "Your Mono installation has no trusted SSL root certificates set up." + echo "This may result in the Paket bootstrapper failing to download Paket" + echo "because Github's SSL certificate can't be verified. One way to fix" + echo "this issue would be to download the list of SSL root certificates" + echo "from the Mozilla project by running the following command:" + echo "" + echo " mozroots --import --sync" + echo "" + echo "This will import over 100 SSL root certificates into your Mono" + echo "certificate repository." + echo "" + if yesno "Run 'mozroots --import --sync' now?" + then + mozroots --import --sync + else + echo "Attempting to continue without running mozroots. This might fail." + fi + # Re-run bootstrapper whether or not the user ran mozroots, because maybe + # they fixed the problem in a separate terminal window. + run $PAKET_BOOTSTRAPPER_EXE +fi + +run $PAKET_EXE restore + +[ ! -e build.fsx ] && run $PAKET_EXE update +[ ! -e build.fsx ] && run $FAKE_EXE init.fsx +run $FAKE_EXE "$@" $FSIARGS $FSIARGS2 build.fsx + diff --git a/configure.sh b/configure.sh deleted file mode 100755 index 38eae6c..0000000 --- a/configure.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -if test "$OS" = "Windows_NT" -then - MONO="" -else - MONO="mono" -fi - -$MONO .paket/paket.bootstrapper.exe -exit_code=$? -if [ $exit_code -ne 0 ]; then - exit $exit_code -fi -if [ -e "paket.lock" ] -then - $MONO .paket/paket.exe restore -else - $MONO .paket/paket.exe install -fi -exit_code=$? -if [ $exit_code -ne 0 ]; then - exit $exit_code -fi diff --git a/docsrc/content/index.fsx b/docsrc/content/index.fsx new file mode 100644 index 0000000..daa40f5 --- /dev/null +++ b/docsrc/content/index.fsx @@ -0,0 +1,49 @@ +(*** hide ***) +// This block of code is omitted in the generated HTML documentation. Use +// it to define helpers that you do not want to show in the documentation. +#I "../../bin" + +(** +LogicalHacking.ExtensionDsLab +====================== + +Documentation + +
+
+
+
+ The LogicalHacking.ExtensionDsLab library can be installed from NuGet: +
PM> Install-Package LogicalHacking.ExtensionDsLab
+
+
+
+
+ +Example +------- + +This example demonstrates using a function defined in this sample library. + +*) +#r "LogicalHacking.ExtensionDsLab.dll" +open LogicalHacking.ExtensionDsLab + +printfn "hello = %i" <| Library.hello 0 + +(** +Some more info + +Samples & documentation +----------------------- + +The library comes with comprehensible documentation. +It can include tutorials automatically generated from `*.fsx` files in [the content folder][content]. +The API reference is automatically generated from Markdown comments in the library implementation. + + * [Tutorial](tutorial.html) contains a further explanation of this sample library. + + * [API Reference](reference/index.html) contains automatically generated documentation for all types, modules + and functions in the library. This includes additional brief samples on using most of the + functions. + diff --git a/docsrc/content/tutorial.fsx b/docsrc/content/tutorial.fsx new file mode 100644 index 0000000..d0054c8 --- /dev/null +++ b/docsrc/content/tutorial.fsx @@ -0,0 +1,19 @@ +(*** hide ***) +// This block of code is omitted in the generated HTML documentation. Use +// it to define helpers that you do not want to show in the documentation. +#I "../../bin" + +(** +Introducing your project +======================== + +Say more + +*) +#r "LogicalHacking.ExtensionDsLab.dll" +open LogicalHacking.ExtensionDsLab + +Library.hello 0 +(** +Some more info +*) diff --git a/docsrc/files/img/logo-template.pdn b/docsrc/files/img/logo-template.pdn new file mode 100644 index 0000000000000000000000000000000000000000..52606f5701c62c79bca692489b4d19150329a5e3 GIT binary patch literal 15052 zcmd^l3A7Vcw)VZs*bWGaASfUx_Uj<2%!$I)RHc$sWvoiYH( z$r7Civr>vs-mv-H;J*5Sx`76r#yC(909tL|hCx(Ol=9hzK~k!ijrS?!n8AHn0`vvS zfXl(;t;*%aLn%1KC{LbRVM8EmRJlV^*kz=Z2dg#W#RC9h6+}H{#A+`BIV_|Bl|Gep zxnz!Fq1sE7f>SZ7tWXd=O4VeuQi&4pP(A>?Iy@8r31^Bn#WW~i(GYe$sm@iRnncOz zKua-;T~|yicQ2L!LD)(K;AoN!K$I_lRuIU>5KbEtP}`_X)!=jyrUXUABPK(kqBFw~ zN$Fxlyc7!-H5oxr3(AL{9LPH0G=>GDObA6p%ms5eV#jd=h9u=@4|5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3ltK!lZn_djRYWna>8 z#?r5+rb(LHBR4zM`_i5sFHf8XqAhNOPUmWA)%w5!9Bey1LMxAW2--E#M5pE*DI z;+)Pcj5Yhrg~=D^b#8uPRB~V2Wv9j1ntq2zYWKhQod|zrnF*hp-1E}4jU$WQ9=!H> zuX*POy*Byfm5aJwY${)wCS2L|RlN6+AHz>&e;l&$k1>BgvN1IVzxykvv-bzttMeul zBaip{O8udFjA8#1=#n^rMjFX!1 z`BA8+E%oN)PaE5;JU!dEV!>p4|MQ*qjJ-bhqtQK5iE|>>b7+7FeJ@%a; zw@hfW^1H?*p9hw9&Mt0a=<#Jcm+-0mrrnhp+uvBe@cv_W@7#QGojB;Z^!|-Q{ZF?w z2zwuG@%9`LeOzI0&i-q2ZyUIv(C_|6sb$e^UAt!HRC@1vt?eIs{L8L!#uW0D{kijB z?%kpvWbW5JJ@s4X1m$WZUM~8kT)9ZAR)qruU5Kdztqq z+r1aQoXTze PmMh&#w`1pP#_E3ov+rLx literal 0 HcmV?d00001 diff --git a/docsrc/files/img/logo.png b/docsrc/files/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..8a2b81b9eb60b9bd48e50daed8ab02a46ee4992f GIT binary patch literal 1581 zcmXw3dr%W+5Wl3S(FfL4WtA!Y%7hEfB!WB|b8zRyCiVIVTx zNzPm!kts^~A#+bmdOVOCle8;y)vowVJNH%WRc?h-Y9RnDXcF+bn z*li~;306aP%Y%y_0u+mAh&qS~58j$LH~q#G z(!AI7P7v@a;K4anPh1DRbFD{?CC`k4tH9`WpLUy8FJIZ&Ii50G%=g!EI`_@yHw=Ec z=jKi23khOhIw@uVsAYKr)=cunp1k<@G3BZAvlAk{wfW3t?TVfRh!}mVDil!J0WWlD z3%}LeE(WSh7j%QSNvLtZ*W;c&roXfii2sXub+u%OU|XU6CK6!I2&}+Z!O@)L}$~ZX;#W(qagHT z71H?4SU^yr9j8p=&f*U4Zmu~(<4}3Q;KhMCgk57OH1o0=vDbDeJlhOG@UYRlcj+!l zR&kXeG(uh~Dg6&&i4w;(*$!rzE7IKcSk_Fcs{m23@{D*jhIsVppUhHARrKQ8LG?u4 zBN}BZGVz8uIDpY5SyqBT1w7x8>wYC08jB2q```#kF{@YG6v&H^H%LlYy`>Lm6d!~= zwvWFNr!zcrtVJc)x(<`~S%g(V^^`H3H-vys4vLDLzqg6~&tQRa|$R z*ku3G;X1JCE!AJi>b+b~bDZw6)-bzsN%$Mo<7GMX4DNP3ZJGzWN+Ev!2aC;4_T+%$ zO5<9xc7at4lw5qc=hm2AI>c`C+NDdVQ31~@o&`(4jfL2awpVp;-xQ5cP|s2$A$C3V zMAwipYc*(j1|)}^U}J6}h-^9xa^P53gAXH*EXSG*^dYYk z3FpKeKWJt&mSHllRRb)R9CL6@hh~O%{5`-~ce$*}_97@*b9fu}#3XxVg~|?omiifh+Hsmj>=l_z6AzHj%P zh9}7VaJVZ*w+<*dGr}Yk37JWCJiXKDFk<0meCm1n1*b!Zh2hMsABR7*2lEj%fRFdH zVWE_cr~s-Bsw)*rRP*%zFHtiJ&C|ofM4a4m VXWV0Pq6A; +// otherwise, use the current 'output' directory. +#if RELEASE +let root = website +#else +let root = "file://" + (__SOURCE_DIRECTORY__ @@ "../../docs") +#endif + +// Paths with template/source/output locations +let bin = __SOURCE_DIRECTORY__ @@ "../../bin" +let content = __SOURCE_DIRECTORY__ @@ "../content" +let output = __SOURCE_DIRECTORY__ @@ "../../docs" +let files = __SOURCE_DIRECTORY__ @@ "../files" +let templates = __SOURCE_DIRECTORY__ @@ "templates" +let formatting = __SOURCE_DIRECTORY__ @@ "../../packages/build/FSharp.Formatting/" +let docTemplate = "docpage.cshtml" + +// Where to look for *.csproj templates (in this order) +let layoutRootsAll = new System.Collections.Generic.Dictionary() +layoutRootsAll.Add("en",[ templates; formatting @@ "templates" + formatting @@ "templates/reference" ]) +subDirectories (directoryInfo templates) +|> Seq.iter (fun d -> + let name = d.Name + if name.Length = 2 || name.Length = 3 then + layoutRootsAll.Add( + name, [templates @@ name + formatting @@ "templates" + formatting @@ "templates/reference" ])) + +// Copy static files and CSS + JS from F# Formatting +let copyFiles () = + CopyRecursive files output true |> Log "Copying file: " + ensureDirectory (output @@ "content") + CopyRecursive (formatting @@ "styles") (output @@ "content") true + |> Log "Copying styles and scripts: " + +let binaries = + let manuallyAdded = + referenceBinaries + |> List.map (fun b -> bin @@ b) + + let conventionBased = + directoryInfo bin + |> subDirectories + |> Array.map (fun d -> d.FullName @@ (sprintf "%s.dll" d.Name)) + |> List.ofArray + + conventionBased @ manuallyAdded + +let libDirs = + let conventionBasedbinDirs = + directoryInfo bin + |> subDirectories + |> Array.map (fun d -> d.FullName) + |> List.ofArray + + conventionBasedbinDirs @ [bin] + +// Build API reference from XML comments +let buildReference () = + CleanDir (output @@ "reference") + MetadataFormat.Generate + ( binaries, output @@ "reference", layoutRootsAll.["en"], + parameters = ("root", root)::info, + sourceRepo = githubLink @@ "tree/master", + sourceFolder = __SOURCE_DIRECTORY__ @@ ".." @@ "..", + publicOnly = true,libDirs = libDirs ) + +// Build documentation from `fsx` and `md` files in `docs/content` +let buildDocumentation () = + + // First, process files which are placed in the content root directory. + + Literate.ProcessDirectory + ( content, docTemplate, output, replacements = ("root", root)::info, + layoutRoots = layoutRootsAll.["en"], + generateAnchors = true, + processRecursive = false) + + // And then process files which are placed in the sub directories + // (some sub directories might be for specific language). + + let subdirs = Directory.EnumerateDirectories(content, "*", SearchOption.TopDirectoryOnly) + for dir in subdirs do + let dirname = (new DirectoryInfo(dir)).Name + let layoutRoots = + // Check whether this directory name is for specific language + let key = layoutRootsAll.Keys + |> Seq.tryFind (fun i -> i = dirname) + match key with + | Some lang -> layoutRootsAll.[lang] + | None -> layoutRootsAll.["en"] // "en" is the default language + + Literate.ProcessDirectory + ( dir, docTemplate, output @@ dirname, replacements = ("root", root)::info, + layoutRoots = layoutRoots, + generateAnchors = true ) + +// Generate +copyFiles() +#if HELP +buildDocumentation() +#endif +#if REFERENCE +buildReference() +#endif diff --git a/docsrc/tools/templates/template.cshtml b/docsrc/tools/templates/template.cshtml new file mode 100644 index 0000000..1ae4a1b --- /dev/null +++ b/docsrc/tools/templates/template.cshtml @@ -0,0 +1,58 @@ + + + + + @Title + + + + + + + + + + + + + + + +
+ +
+
+
+ @RenderBody() +
+
+ F# Project + +
+
+
+ Fork me on GitHub + + diff --git a/paket.dependencies b/paket.dependencies index fa8ba73..3bb8065 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -1,6 +1,25 @@ -framework: >= net40 +framework: >= net45 source https://nuget.org/api/v2 -nuget FsLab -nuget System.Data.Sqlite -nuget SQLProvider +# The setting below means your libraries will assume a minimum target of .NET 4.5 + F# 4.0. +# +# To increase the minimum assumed .NET Framework, change the TargetFrameworkVersion in the .fsproj project files. +# +# To increase the minimum assumed F# version to F# 4.1, change to +# nuget FSharp.Core ~> 4.1.0 redirects: force + +nuget FSharp.Core ~> 4.0.0.1 redirects: force + +group Build + source https://nuget.org/api/v2 + + nuget FAKE + nuget FSharp.Formatting + + github fsharp/FAKE modules/Octokit/Octokit.fsx + +group Test + source https://nuget.org/api/v2 + + nuget NUnit ~> 2 + nuget NUnit.Runners ~> 2 diff --git a/src/LogicalHacking.ExtensionDsLab/App.config b/src/LogicalHacking.ExtensionDsLab/App.config new file mode 100644 index 0000000..7c7a547 --- /dev/null +++ b/src/LogicalHacking.ExtensionDsLab/App.config @@ -0,0 +1,10 @@ + + + + + + True + + + + diff --git a/src/LogicalHacking.ExtensionDsLab/AssemblyInfo.fs b/src/LogicalHacking.ExtensionDsLab/AssemblyInfo.fs new file mode 100644 index 0000000..80e8873 --- /dev/null +++ b/src/LogicalHacking.ExtensionDsLab/AssemblyInfo.fs @@ -0,0 +1,19 @@ +// Auto-Generated by FAKE; do not edit +namespace System +open System.Reflection + +[] +[] +[] +[] +[] +[] +do () + +module internal AssemblyVersionInformation = + let [] AssemblyTitle = "LogicalHacking.ExtensionDsLab" + let [] AssemblyProduct = "LogicalHacking.ExtensionDsLab" + let [] AssemblyDescription = "A data science framework for analyzing Chrome browser extensions." + let [] AssemblyVersion = "1.0.1" + let [] AssemblyFileVersion = "1.0.1" + let [] AssemblyConfiguration = "Release" diff --git a/src/LogicalHacking.ExtensionDsLab/Library.fs b/src/LogicalHacking.ExtensionDsLab/Library.fs new file mode 100644 index 0000000..e7dd909 --- /dev/null +++ b/src/LogicalHacking.ExtensionDsLab/Library.fs @@ -0,0 +1,16 @@ +namespace LogicalHacking.ExtensionDsLab + +/// Documentation for my library +/// +/// ## Example +/// +/// let h = Library.hello 1 +/// printfn "%d" h +/// +module Library = + + /// Returns 42 + /// + /// ## Parameters + /// - `num` - whatever + let hello num = 42 diff --git a/src/LogicalHacking.ExtensionDsLab/LogicalHacking.ExtensionDsLab.fsproj b/src/LogicalHacking.ExtensionDsLab/LogicalHacking.ExtensionDsLab.fsproj new file mode 100644 index 0000000..0cee806 --- /dev/null +++ b/src/LogicalHacking.ExtensionDsLab/LogicalHacking.ExtensionDsLab.fsproj @@ -0,0 +1,78 @@ + + + + + Debug + AnyCPU + 2.0 + 8a2ebfc4-14ce-4d77-81de-1fd7372c3382 + Library + LogicalHacking.ExtensionDsLab + LogicalHacking.ExtensionDsLab + v4.5 + LogicalHacking.ExtensionDsLab + + .\bin\$(Configuration)\$(AssemblyName).xml + true + + + true + full + false + false + .\bin\Debug + DEBUG;TRACE + 3 + --warnon:1182 + + + pdbonly + true + true + .\bin\Release + TRACE + 3 + --warnon:1182 + + + 11 + + + + + $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets + + + + + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets + + + + + + + + + + + + + + + + + + + + + + + ..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll + True + True + + + + + diff --git a/src/LogicalHacking.ExtensionDsLab/Script.fsx b/src/LogicalHacking.ExtensionDsLab/Script.fsx new file mode 100644 index 0000000..b1d021b --- /dev/null +++ b/src/LogicalHacking.ExtensionDsLab/Script.fsx @@ -0,0 +1,8 @@ +// Learn more about F# at http://fsharp.org. See the 'F# Tutorial' project +// for more guidance on F# programming. + +#load "Library.fs" +open LogicalHacking.ExtensionDsLab + +let num = Library.hello 42 +printfn "%i" num diff --git a/src/LogicalHacking.ExtensionDsLab/paket.references b/src/LogicalHacking.ExtensionDsLab/paket.references new file mode 100644 index 0000000..640cf91 --- /dev/null +++ b/src/LogicalHacking.ExtensionDsLab/paket.references @@ -0,0 +1 @@ +FSharp.Core \ No newline at end of file diff --git a/src/LogicalHacking.ExtensionDsLab/paket.template b/src/LogicalHacking.ExtensionDsLab/paket.template new file mode 100644 index 0000000..5f0ba48 --- /dev/null +++ b/src/LogicalHacking.ExtensionDsLab/paket.template @@ -0,0 +1,25 @@ +type project +title + LogicalHacking.ExtensionDsLab +owners + Achim D. Brucker +authors + Achim D. Brucker +projectUrl + https://git.logicalhacking.com/BrowserSecurity/ExtensionDsLab +iconUrl + https://git.logicalhacking.com/BrowserSecurity/ExtensionDsLab/master/docs/files/img/logo.png +licenseUrl + https://git.logicalhacking.com/BrowserSecurity/ExtensionDsLab/raw/master/LICENSE +requireLicenseAcceptance + false +copyright + Copyright 2015 +tags + ChromeExtension DataScience BrowserSecurity +summary + A data science framework for analyzing Chrome browser extensions. +description + A data science framework for analyzing Chrome browser extensions. + + diff --git a/tests/LogicalHacking.ExtensionDsLab.Tests/App.config b/tests/LogicalHacking.ExtensionDsLab.Tests/App.config new file mode 100644 index 0000000..7c7a547 --- /dev/null +++ b/tests/LogicalHacking.ExtensionDsLab.Tests/App.config @@ -0,0 +1,10 @@ + + + + + + True + + + + diff --git a/tests/LogicalHacking.ExtensionDsLab.Tests/LogicalHacking.ExtensionDsLab.Tests.fsproj b/tests/LogicalHacking.ExtensionDsLab.Tests/LogicalHacking.ExtensionDsLab.Tests.fsproj new file mode 100644 index 0000000..229cfa9 --- /dev/null +++ b/tests/LogicalHacking.ExtensionDsLab.Tests/LogicalHacking.ExtensionDsLab.Tests.fsproj @@ -0,0 +1,99 @@ + + + + + Debug + AnyCPU + 2.0 + 661253b3-4c4d-4ebd-87e4-f1c6f010347f + Library + LogicalHacking.ExtensionDsLab.Tests + LogicalHacking.ExtensionDsLab.Tests + v4.5 + LogicalHacking.ExtensionDsLab.Tests + + ..\..\ + true + + + true + full + false + false + bin\Debug\ + DEBUG;TRACE + 3 + Project + + + + + + + pdbonly + true + true + bin\Release\ + TRACE + 3 + + + 11 + + + + + $(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets + + + + + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\FSharp\Microsoft.FSharp.Targets + + + + + + + + + + + + + + + + + + + LogicalHacking.ExtensionDsLab + {8a2ebfc4-14ce-4d77-81de-1fd7372c3382} + True + + + + + + + ..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll + True + True + + + + + + + ..\..\packages\test\NUnit\lib\nunit.framework.dll + True + True + + + diff --git a/tests/LogicalHacking.ExtensionDsLab.Tests/Tests.fs b/tests/LogicalHacking.ExtensionDsLab.Tests/Tests.fs new file mode 100644 index 0000000..a68798b --- /dev/null +++ b/tests/LogicalHacking.ExtensionDsLab.Tests/Tests.fs @@ -0,0 +1,10 @@ +module LogicalHacking.ExtensionDsLab.Tests + +open LogicalHacking.ExtensionDsLab +open NUnit.Framework + +[] +let ``hello returns 42`` () = + let result = Library.hello 42 + printfn "%i" result + Assert.AreEqual(42,result) diff --git a/tests/LogicalHacking.ExtensionDsLab.Tests/paket.references b/tests/LogicalHacking.ExtensionDsLab.Tests/paket.references new file mode 100644 index 0000000..cdeac42 --- /dev/null +++ b/tests/LogicalHacking.ExtensionDsLab.Tests/paket.references @@ -0,0 +1,4 @@ +FSharp.Core +group Test +NUnit +NUnit.Runners \ No newline at end of file