by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • May 28 19:06
    snekbaev opened #4446
  • May 28 10:43
    Zetanova commented #4434
  • May 28 06:49

    dependabot-preview[bot] on nuget

    Bump Google.Protobuf from 3.12.… (compare)

  • May 28 06:49
    dependabot-preview[bot] labeled #4445
  • May 28 06:49
    dependabot-preview[bot] opened #4445
  • May 28 00:03
    Aaronontheweb commented #4434
  • May 27 23:41
    Zetanova commented #4434
  • May 27 22:57
    Zetanova commented #4434
  • May 27 22:34
    Aaronontheweb commented #4419
  • May 27 15:54
    Ralf1108 commented #4432
  • May 27 14:42
    Ralf1108 commented #4419
  • May 27 09:41
    Zetanova commented #4434
  • May 27 06:38
    dependabot-preview[bot] labeled #141
  • May 27 06:38
    dependabot-preview[bot] opened #141
  • May 27 06:38

    dependabot-preview[bot] on nuget

    Bump AkkaVersion from 1.4.6 to … (compare)

  • May 27 06:33

    dependabot-preview[bot] on nuget

    (compare)

  • May 27 06:33
    dependabot-preview[bot] closed #156
  • May 27 06:33
    dependabot-preview[bot] commented #156
  • May 27 06:33
    dependabot-preview[bot] labeled #157
  • May 27 06:33
    dependabot-preview[bot] opened #157
Bartosz Sypytkowski
@Horusiath
@Aaronontheweb to fix #1399 I'll need some of your assist, I see that there is heavy amount of custom code back there, could you explain it to me?
Aaron Stannard
@Aaronontheweb
@Horusiath this is just for the NuGet push?
Bartosz Sypytkowski
@Horusiath
yes
Aaron Stannard
@Aaronontheweb
ok
//--------------------------------------------------------------------------------
// Pack nuget for all projects
// Publish to nuget.org if nugetkey is specified

let createNugetPackages _ =
    let removeDir dir = 
        let del _ = 
            DeleteDir dir
            not (directoryExists dir)
        runWithRetries del 3 |> ignore

    ensureDirectory nugetDir
    for nuspec in !! "src/**/*.nuspec" do
        printfn "Creating nuget packages for %s" nuspec

        let project = Path.GetFileNameWithoutExtension nuspec 

        let workingDir = workingDir </> project

        CleanDir workingDir

        let projectDir = Path.GetDirectoryName nuspec
        let projectFile = (!! (projectDir @@ project + ".*sproj")) |> Seq.head
        let releaseDir = projectDir @@ @"bin\Release"
        let packages = projectDir @@ "paket.references"
        let packageDependencies = if (fileExists packages) then (Paket.GetDependenciesForReferencesFile packages |> Seq.toList) else []
        let dependencies = packageDependencies @ getAkkaDependency project
        let releaseVersion = getProjectVersion project

        let pack outputDir symbolPackage =
            NuGetHelper.NuGet
                (fun p ->
                    { p with
                        Description = description
                        Authors = authors
                        Copyright = copyright
                        Project =  project
                        Properties = ["Configuration", "Release"]
                        ReleaseNotes = release.Notes |> String.concat "\n"
                        Version = releaseVersion
                        Tags = tags |> String.concat " "
                        OutputPath = outputDir
                        WorkingDir = workingDir
                        SymbolPackage = symbolPackage
                        Dependencies = dependencies })
                nuspec

        // Copy dll, pdb and xml to libdir = workingDir/lib/net45/
        ensureDirectory libDir
        !! (releaseDir @@ project + ".dll")
        ++ (releaseDir @@ project + ".pdb")
        ++ (releaseDir @@ project + ".xml")
        ++ (releaseDir @@ project + ".ExternalAnnotations.xml")
        |> CopyFiles libDir

        // Copy all src-files (.cs and .fs files) to workingDir/src
        let nugetSrcDir = workingDir @@ @"src/"
        // CreateDir nugetSrcDir

        let isCs = hasExt ".cs"
        let isFs = hasExt ".fs"
        let isAssemblyInfo f = (filename f).Contains("AssemblyInfo")
        let isSrc f = (isCs f || isFs f) && not (isAssemblyInfo f) 
        CopyDir nugetSrcDir projectDir isSrc

        //Remove workingDir/src/obj and workingDir/src/bin
        removeDir (nugetSrcDir @@ "obj")
        removeDir (nugetSrcDir @@ "bin")

        // Create both normal nuget package and symbols nuget package. 
        // Uses the files we copied to workingDir and outputs to nugetdir
        pack nugetDir NugetSymbolPackage.Nuspec

let publishNugetPackages _ = 
    let rec publishPackage url accessKey trialsLeft packageFile =
        let tracing = enableProcessTracing
        enableProcessTracing <- false
        let args p =
            match p with
            | (pack, key, "") -> sprintf "push \"%s\" %s" pack key
            | (pack, key, url) -> sprintf "push \"%s\" %s -source %s" pack key url

        tracefn "Pushing %s Attempts left: %d" (FullName packageFile) trialsLeft
        try 
            let result = ExecProcess (fun info -> 
                    info.FileName <- nugetExe
                    info.WorkingDirectory <- (Path.GetDirectoryName (FullName packageFile))
                    info.Arguments <- args (packageFile, accessKey,url)) (System.TimeSpan.FromMinutes 1.0)
            enableProcessTracing <- tracing
            if result <> 0 then failwithf "Error during NuGet symbol push. %s %s" nugetExe (args (packageFile, "key omitted",url))
        with exn -> 
            if (trialsLeft > 0) then (publishPackage url accessKey (trialsLeft-1) packageFile)
            else raise exn
    let shouldPushN
so these are the two methods that are failing
actually, I take that back
it's just publishNuGetPackages
let me double check the build log
yep, that's correct - just publishNuGetPackages
let publishNugetPackages _ = 
    let rec publishPackage url accessKey trialsLeft packageFile =
        let tracing = enableProcessTracing
        enableProcessTracing <- false
        let args p =
            match p with
            | (pack, key, "") -> sprintf "push \"%s\" %s" pack key
            | (pack, key, url) -> sprintf "push \"%s\" %s -source %s" pack key url

        tracefn "Pushing %s Attempts left: %d" (FullName packageFile) trialsLeft
        try 
            let result = ExecProcess (fun info -> 
                    info.FileName <- nugetExe
                    info.WorkingDirectory <- (Path.GetDirectoryName (FullName packageFile))
                    info.Arguments <- args (packageFile, accessKey,url)) (System.TimeSpan.FromMinutes 1.0)
            enableProcessTracing <- tracing
            if result <> 0 then failwithf "Error during NuGet symbol push. %s %s" nugetExe (args (packageFile, "key omitted",url))
        with exn -> 
            if (trialsLeft > 0) then (publishPackage url accessKey (trialsLeft-1) packageFile)
            else raise exn
    let shouldPushNugetPackages = hasBuildParam "nugetkey"
    let shouldPushSymbolsPackages = (hasBuildParam "symbolspublishurl") && (hasBuildParam "symbolskey")

    if (shouldPushNugetPackages || shouldPushSymbolsPackages) then
        printfn "Pushing nuget packages"
        if shouldPushNugetPackages then
            let normalPackages= 
                !! (nugetDir @@ "*.nupkg") 
                -- (nugetDir @@ "*.symbols.nupkg") |> Seq.sortBy(fun x -> x.ToLower())
            for package in normalPackages do
                publishPackage (getBuildParamOrDefault "nugetpublishurl" "") (getBuildParam "nugetkey") 3 package

        if shouldPushSymbolsPackages then
            let symbolPackages= !! (nugetDir @@ "*.symbols.nupkg") |> Seq.sortBy(fun x -> x.ToLower())
            for package in symbolPackages do
                publishPackage (getBuildParam "symbolspublishurl") (getBuildParam "symbolskey") 3 package
just realized that not all of it made it onto the last code snippet
so all this code does is locate all of the *.nupkg and .symbols.nupkg files
and upload them based on the arguments passed into FAKE
i.e. the publishKey and target
which are different for our build server (MyGet) and production (NuGet)
honestly the easiest way to fix this would be to just add back in build.cmd and build.sh the instructions to dynamically download nuget.exe
Aaron Stannard
@Aaronontheweb
because the way this code works is by spawning a process and passing in the commandline args directly
relevant batchfile from DotNetty
@echo off

pushd %~dp0

SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe

IF EXIST %CACHED_NUGET% goto copynuget
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"

:copynuget
IF EXIST .nuget\nuget.exe goto restore
md .nuget
copy %CACHED_NUGET% .nuget\nuget.exe > nul

:restore

.nuget\NuGet.exe update -self

.nuget\NuGet.exe install FAKE -OutputDirectory packages -ExcludeVersion -Version 3.28.8

.nuget\NuGet.exe install xunit.runner.console -ConfigFile .nuget\Nuget.Config -OutputDirectory packages\FAKE -ExcludeVersion -Version 2.0.0

if not exist packages\SourceLink.Fake\tools\SourceLink.fsx ( 
  .nuget\nuget.exe install SourceLink.Fake -OutputDirectory packages -ExcludeVersion
)
rem cls

set encoding=utf-8
packages\FAKE\tools\FAKE.exe build.fsx %*

popd
and BASH equivalent
#!/bin/bash

SCRIPT_PATH="${BASH_SOURCE[0]}";
if ([ -h "${SCRIPT_PATH}" ]) then
  while([ -h "${SCRIPT_PATH}" ]) do SCRIPT_PATH=`readlink "${SCRIPT_PATH}"`; done
fi
pushd . > /dev/null
cd `dirname ${SCRIPT_PATH}` > /dev/null
SCRIPT_PATH=`pwd`;
popd  > /dev/null

if ! [ -f $SCRIPT_PATH/.nuget/nuget.exe ] 
    then
        wget "https://www.nuget.org/nuget.exe" -P $SCRIPT_PATH/.nuget/
fi

mono $SCRIPT_PATH/.nuget/nuget.exe update -self

mono $SCRIPT_PATH/.nuget/nuget.exe install FAKE -OutputDirectory $SCRIPT_PATH/packages -ExcludeVersion -Version 3.28.8

mono $SCRIPT_PATH/.nuget/nuget.exe install xunit.runners -OutputDirectory $SCRIPT_PATH/packages/FAKE -ExcludeVersion -Version 2.0.0

if ! [ -e $SCRIPT_PATH/packages/SourceLink.Fake/tools/SourceLink.fsx ] ; then
    mono $SCRIPT_PATH/.nuget/nuget.exe install SourceLink.Fake -OutputDirectory $SCRIPT_PATH/packages -ExcludeVersion

fi

export encoding=utf-8

mono $SCRIPT_PATH/packages/FAKE/tools/FAKE.exe build.fsx "$@"
that would need to be merged with whatever Paket code is there
use Paket for restore
NuGet for push
Bartosz Sypytkowski
@Horusiath
I'm not 100% sure, but Paket can publish nuget packages and it's self updating
Aaron Stannard
@Aaronontheweb
yeah, but why do we need that?
this code works fine as long as the binary is there
Paket's primary value is on restore
do whatever you need to, but something needs to be fixed in order to get nightlies back
Aaron Stannard
@Aaronontheweb
@Horusiath any thoughts on that?
btw - going to be upgrading the build server to support C# 6, F# 4, and Code Contracts soon
I just have to install a new version of Visual Studio and do some other song and dance
Bartosz Sypytkowski
@Horusiath
+1000 for code contracts
I'll see what I can do
Aaron Stannard
@Aaronontheweb
yeah, I fell in love with them on DotNetty
started using them in NBench, which I'm hoping to have a demo of in our contributors meeting
Bartosz Sypytkowski
@Horusiath
pretty bad, that they should be basically compiler feature ;)
Aaron Stannard
@Aaronontheweb
yeah, I agree with that haha
NBench is something I came up with while I was on vacation - to build a robust history going forward around performance in key areas of Akka.NET, Helios, DotNetty, and our serializers
combines profiling techniques with unit testing
i.e. write a unit test that guarantees that a benchmark never has more than N GC2 collections during each run
Bartosz Sypytkowski
@Horusiath
@Aaronontheweb I'd also focus on that: http://www.privateeye.io/
it's in beta and it's pretty impressive right now - I've talked with greg young, and he wants to keep it free for OSS projects
Aaron Stannard
@Aaronontheweb
cool - what I want is automated performance testing though
i.e. something that screams and fails loudly when a key metric gets fucked up on a PR
Bartosz Sypytkowski
@Horusiath
yeah I know, this is more for profiling
Aaron Stannard
@Aaronontheweb
.NET needs better profiling tools
PerfView has been what I've been using
and it's a bit of a bear to be honest
if you're a Microsoft engineer and have spent a lot of time working with Event Tracing for Windows, PerfView is probably amazing