/*
 * Requirements: lftp on linux agents (apt install lftp)
 */
import java.text.SimpleDateFormat

node('windows && build') {
    def gitResult = null;
    def commitHash = ''

    stage ('Checkout') {
        cleanWs()

        // prepare workspace (git checkout and commit hash retrieval)
        gitResult = checkout scm
        commitHash = gitResult.GIT_COMMIT.take(8)
    }
    
    def solution = $/"%WORKSPACE%\\BoFilTest.sln"/$
    def msbuildExecutable = $/${tool 'System MSBuild 14.0'}/MSBuild.exe/$

    stage ('Compile') {        
        bat(
            label: 'msbuild',
            script: "\"${msbuildExecutable}\" ${solution} /p:Configuration=Release /p:OutDir=target"
        )
    }
    
    if (gitResult.GIT_BRANCH == "release") {
        stage ('Release') {
            echo "Releasing..."
        }        
    }
}
