diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
deleted file mode 100644
index dd58959..0000000
--- a/.github/workflows/build.yml
+++ /dev/null
@@ -1,45 +0,0 @@
-
-name: Build
-run-name: ${{ github.job }} #${{ github.run_number }} on ${{ github.ref }} by @${{ github.actor }}
-
-on:
- push:
- branches:
- - '*'
- pull_request:
- branches:
- - '*'
-
-jobs:
- build:
- runs-on: windows-latest
- timeout-minutes: 5
- steps:
-
- - name: Checkout
- uses: actions/checkout@v4
-
- - name: Install Java11
- uses: actions/setup-java@v4
- with:
- distribution: 'temurin'
- java-version: '11'
-
- - name: Restore Workloads
- run: dotnet workload install ios android
- shell: bash
-
- - name: Restore
- run: dotnet restore
- shell: bash
-
- - name: Build
- run: dotnet build --configuration Release
- shell: bash
-
- - name: Publish Artifact
- uses: actions/upload-artifact@v4
- with:
- name: output
- path: Output
- if-no-files-found: error
diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml
new file mode 100644
index 0000000..f167f12
--- /dev/null
+++ b/.github/workflows/github-actions.yml
@@ -0,0 +1,120 @@
+#
+# https://docs.github.com/en/actions/migrating-to-github-actions/automated-migrations/migrating-from-azure-devops-with-github-actions-importer#environment-variable-mapping
+#
+# bare in mind that variable substitution is not supported in github at all so we cant do stuff like this
+#
+# env:
+# Build_Artifacts_Folderpath: $build_repository_folderpath/Artifacts
+#
+
+name: '🏗 📦 Build, Pack & Deploy Nugets'
+
+env:
+ BUILD_REPOSITORY_FOLDERPATH: ${{ github.workspace }}
+
+ LAERDAL_SOURCE_BRANCH: ${{ github.ref }}
+ LAERDAL_REPOSITORY_PATH: ${{ github.repository }}
+
+ SCL_GITHUB_ACCESS_TOKEN: ${{ secrets.SCL_GITHUB_ACCESS_TOKEN }}
+ SCL_NUGET_ORG_FEED_API_KEY: ${{ secrets.NUGET_ORG_FEED_API_KEY }}
+ SCL_AZURE_ARTIFACTS_API_KEY: ${{ secrets.SCL_AZURE_ARTIFACTS_API_KEY }}
+ SCL_GITHUB_NUGET_FEED_USERNAME: ${{ secrets.SCL_GITHUB_NUGET_FEED_USERNAME }}
+
+on:
+ workflow_call: # so that other workflows can trigger this
+ workflow_dispatch: # allows to run this workflow manually from the actions tab
+
+ push:
+ branches:
+ - '**' # '*' matches zero or more characters but does not match the `/` character '**' matches zero or more of any character
+
+ pull_request:
+ branches:
+ - '**'
+
+
+jobs:
+
+ build:
+
+ runs-on: 'windows-2022'
+ timeout-minutes: 5
+
+ steps:
+
+ - name: '🔽 Checkout'
+ uses: 'actions/checkout@v4'
+ with:
+ fetch-tags: true # https://github.com/actions/checkout/issues/1471#issuecomment-1771231294
+ fetch-depth: 0
+
+ - name: '🛠 Setup Build Environment'
+ shell: 'bash'
+ run: |
+ chmod +x "${{env.BUILD_REPOSITORY_FOLDERPATH}}/Laerdal.Scripts/Laerdal.SetupBuildEnvironment.sh" \
+ && \
+ "${{env.BUILD_REPOSITORY_FOLDERPATH}}/Laerdal.Scripts/Laerdal.SetupBuildEnvironment.sh" \
+ "https://nuget.pkg.github.com/Laerdal/index.json" \
+ "${{ env.SCL_GITHUB_NUGET_FEED_USERNAME }}" \
+ "${{ env.SCL_GITHUB_ACCESS_TOKEN }}" \
+ "${{ env.BUILD_REPOSITORY_FOLDERPATH }}/Artifacts"
+
+ # we need to manually install java11 because it is needed by the latest windows vm-images that run on
+ # msbuild version 17.8.3 that started rolling out around 20 Nov 2023 https://stackoverflow.com/a/77519085/863651
+ - name: '🛠 Set Up JDK 11'
+ uses: 'actions/setup-java@v2'
+ with:
+ java-version: '11'
+ architecture: 'x64'
+ distribution: 'adopt'
+
+ - name: '🏗 📦 Build, Pack & Announce New Release (if appropriate)'
+ shell: 'bash'
+ run: |
+ cd "${{env.BUILD_REPOSITORY_FOLDERPATH}}/Laerdal.Scripts" \
+ && \
+ dotnet \
+ msbuild \
+ "Laerdal.Builder.targets" \
+ \
+ -p:PackageOutputPath="${{ env.BUILD_REPOSITORY_FOLDERPATH }}/Artifacts" \
+ -p:Laerdal_Source_Branch="${{ env.LAERDAL_SOURCE_BRANCH }}" \
+ -p:Laerdal_Repository_Path="${{ env.LAERDAL_REPOSITORY_PATH }}" \
+ -p:Laerdal_Github_Access_Token="${{ env.SCL_GITHUB_ACCESS_TOKEN }}"
+
+ - name: '⬆️ Upload Artifacts' # to share with other workflows https://stackoverflow.com/a/77663335/863651
+ uses: 'actions/upload-artifact@v4'
+ with:
+ name: 'Artifacts'
+ path: '${{env.BUILD_REPOSITORY_FOLDERPATH}}/Artifacts/**/*'
+ if-no-files-found: error
+
+ - name: '🚀 Publish to the Laerdal Nuget Server on Github' # https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-nuget-registry
+ shell: 'bash'
+ if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
+ run: |
+ cd "${{env.BUILD_REPOSITORY_FOLDERPATH}}/Artifacts/" \
+ && \
+ ls . \
+ && \
+ dotnet \
+ nuget \
+ push \
+ --source "https://nuget.pkg.github.com/Laerdal/index.json" \
+ --api-key "${{env.SCL_GITHUB_ACCESS_TOKEN}}" \
+ *nupkg
+
+ - name: '🚀 Publish to the Nuget.org'
+ shell: 'bash'
+ if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
+ run: |
+ cd "${{env.BUILD_REPOSITORY_FOLDERPATH}}/Artifacts/" \
+ && \
+ ls . \
+ && \
+ dotnet \
+ nuget \
+ push \
+ --source "https://api.nuget.org/v3/index.json" \
+ --api-key "${{env.SCL_NUGET_ORG_FEED_API_KEY}}" \
+ *nupkg
diff --git a/Laerdal.Dfu.sln b/Laerdal.Dfu.sln
index ea4518b..fd306ec 100644
--- a/Laerdal.Dfu.sln
+++ b/Laerdal.Dfu.sln
@@ -1,22 +1,28 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.5.002.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Laerdal.Dfu", "Laerdal.Dfu\Laerdal.Dfu.csproj", "{A837B5B9-0B0C-48F6-A342-4060EC71E2C9}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Laerdal.Dfu", "Laerdal.Dfu\Laerdal.Dfu.csproj", "{0A938850-09F9-44A5-825F-84C932074A29}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Misc", "_Misc", "{37EBD209-B465-4483-B6A9-46EAC9FE20EF}"
+ ProjectSection(SolutionItems) = preProject
+ README.md = README.md
+ LICENSE = LICENSE
+ Laerdal.Scripts\Laerdal.Version.sh = Laerdal.Scripts\Laerdal.Version.sh
+ Laerdal.Scripts\Laerdal.Builder.targets = Laerdal.Scripts\Laerdal.Builder.targets
+ Laerdal.Scripts\Laerdal.Changelog.sh = Laerdal.Scripts\Laerdal.Changelog.sh
+ Laerdal.Scripts\Laerdal.CreateNewReleaseInGithub.sh = Laerdal.Scripts\Laerdal.CreateNewReleaseInGithub.sh
+ Laerdal.Scripts\Laerdal.SetupBuildEnvironment.sh = Laerdal.Scripts\Laerdal.SetupBuildEnvironment.sh
+ .github\workflows\github-actions.yml = .github\workflows\github-actions.yml
+ EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {A837B5B9-0B0C-48F6-A342-4060EC71E2C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {A837B5B9-0B0C-48F6-A342-4060EC71E2C9}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {5DFF87D5-25C1-4291-A72E-EAD4129E1981}
+ {0A938850-09F9-44A5-825F-84C932074A29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {0A938850-09F9-44A5-825F-84C932074A29}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {0A938850-09F9-44A5-825F-84C932074A29}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {0A938850-09F9-44A5-825F-84C932074A29}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
diff --git a/Laerdal.Dfu/Laerdal.Dfu.csproj b/Laerdal.Dfu/Laerdal.Dfu.csproj
index 5399c78..b7876b5 100644
--- a/Laerdal.Dfu/Laerdal.Dfu.csproj
+++ b/Laerdal.Dfu/Laerdal.Dfu.csproj
@@ -1,40 +1,37 @@
-
-
- net7.0-ios;net7.0-android
- true
- true
- enable
- 14.2
- 21.0
-
+
+ net7.0-ios;net7.0-android
+ true
+ true
+ enable
-
- Laerdal.Dfu
- Ble;Tools;Dfu;Bluetooth;Nordic;Semiconductor
- Laerdal Medical, Francois Raminosona
- Wrapper around Nordic.Dfu
-
+ 14.2
+ 21.0
+
-
-
- 1
- 27
- $(BUILD_BUILDID)
- $([MSBuild]::Add(8, $(GITHUB_RUN_NUMBER)))
- $([MSBuild]::Add(8, $(CI_PIPELINE_IID)))
- 0
+
+ Laerdal.Dfu
+ Ble;Tools;Dfu;Bluetooth;Nordic;Semiconductor
+ Laerdal Medical, Francois Raminosona
+ Wrapper around Nordic.Dfu
+
- $(Laerdal_Version_Major).$(Laerdal_Version_Minor).$(Laerdal_Version_Build)
-
+
+
+ 1
+ 27
+ 0
-
+ $(Laerdal_Version_Major).$(Laerdal_Version_Minor).$(Laerdal_Version_Build)
+
+
+
-
+
-
+
\ No newline at end of file
diff --git a/Laerdal.Dfu/Laerdal.targets b/Laerdal.Dfu/Laerdal.targets
index 6fb5866..bea5937 100644
--- a/Laerdal.Dfu/Laerdal.targets
+++ b/Laerdal.Dfu/Laerdal.targets
@@ -25,10 +25,10 @@
- $(Laerdal_Package_Name)
+ $(Laerdal_Package_Name)
$(Laerdal_Package_Name)
$(Laerdal_Package_Name)
- $(Laerdal_Package_Name)
+ $(Laerdal_Package_Name)
$(Laerdal_Package_Copyright)
diff --git a/Laerdal.Scripts/Laerdal.Builder.targets b/Laerdal.Scripts/Laerdal.Builder.targets
new file mode 100644
index 0000000..59ebbb0
--- /dev/null
+++ b/Laerdal.Scripts/Laerdal.Builder.targets
@@ -0,0 +1,92 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ %0A
+ Release
+
+ $(BUILD_ARTIFACTSTAGINGDIRECTORY)
+ $([System.IO.Path]::Combine($(MSBuildThisFileDirectory), `..`, `Artifacts/`))
+
+ $(BUILD_SOURCEBRANCH)
+ $(BUILD_REPOSITORY_NAME)
+ True
+
+ $([System.IO.Path]::Combine($(MSBuildThisFileDirectory), `..`, `Laerdal.Dfu`, `Laerdal.Dfu.csproj`))
+
+
+ 1
+ 27
+
+ $(BUILD_BUILDID)
+ $([MSBuild]::Add(8, $(GITHUB_RUN_NUMBER)))
+ $([MSBuild]::Add(8, $(CI_PIPELINE_IID)))
+ 0
+
+ $(Laerdal_Version_Major).$(Laerdal_Version_Minor).$(Laerdal_Version_Build)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);Configuration=$(Configuration)
+ <_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);Laerdal_Version=$(Laerdal_Version_Base)
+ <_Laerdal_Build_Parameters>$(_Laerdal_Build_Parameters);PackageOutputPath=$(PackageOutputPath)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $([System.IO.Path]::Combine($(MSBuildThisFileDirectory), `Laerdal.CreateNewReleaseInGithub.sh`))
+
+ <_Laerdal_Create_Github_Release_Script_Parameters>$(_Laerdal_Create_Github_Release_Script_Parameters) --git-branch '$(Laerdal_Source_Branch)'
+ <_Laerdal_Create_Github_Release_Script_Parameters>$(_Laerdal_Create_Github_Release_Script_Parameters) --tag-version '$(Laerdal_Version_Base)'
+ <_Laerdal_Create_Github_Release_Script_Parameters>$(_Laerdal_Create_Github_Release_Script_Parameters) --access-token '$(Laerdal_Github_Access_Token)'
+ <_Laerdal_Create_Github_Release_Script_Parameters>$(_Laerdal_Create_Github_Release_Script_Parameters) --repository-path '$(Laerdal_Repository_Path)'
+
+
+
+
+
+
+
+
diff --git a/Laerdal.Scripts/Laerdal.Changelog.sh b/Laerdal.Scripts/Laerdal.Changelog.sh
new file mode 100644
index 0000000..49e40ae
--- /dev/null
+++ b/Laerdal.Scripts/Laerdal.Changelog.sh
@@ -0,0 +1,102 @@
+#!/bin/bash
+
+usage(){
+ echo "usage: ./Laerdal.Changelog.sh [-nv | --new-version X.Y.Z] [-o | --output version.txt] [-h | --help]"
+ echo "parameters:"
+ echo " -nv | --new-version [version] New major.minor.patch version (default is 0.0.0)"
+ echo " -o | --output [filename] Name of the output file"
+ echo " -h | --help Prints this message"
+ echo " -v | --verbose Verbose mode"
+}
+
+function log () {
+ if [[ $verbose -eq 1 ]]; then
+ echo "$@"
+ fi
+}
+
+filename="CHANGELOG.md"
+
+while [ "$1" != "" ]; do
+ case $1 in
+ -nv | --new-version ) shift
+ newversion="$1"
+ ;;
+ -o | --output ) shift
+ filename="$1"
+ ;;
+ -h | --help ) usage
+ exit
+ ;;
+ -v | --verbose ) verbose=1
+ ;;
+ * ) echo
+ echo "### Wrong parameter: $1 ###"
+ echo
+ usage
+ exit 1
+ esac
+ shift
+done
+
+
+if [ ! -z "$newversion" ]; then
+ if [[ "$newversion" =~ .*"-".* ]]; then
+ log "New version contains a dash, skipping changelog generation"
+ else
+ currenthash=$(git show --format=%h --no-patch)
+ echo "$currenthash $newversion" > tags.txt
+ log "New version: $newversion"
+ fi
+else
+ echo "" > tags.txt
+fi
+
+# Get all tags on develop and Filter out tags that are not in the format "HASH 1.2.3"
+git tag --format='%(objectname:short) %(refname:short)' --sort=-version:refname --merged | grep -o '[a-z0-9]* [a-z0-9]*[.][a-z0-9]*[.][a-z0-9]*$' >> tags.txt
+
+# Create changelog file
+echo "# CHANGELOG" > "$filename"
+echo "" >> "$filename"
+log "Created changelog file: $filename"
+
+
+# Loop through all tags and create changelog
+lastline=''
+while read line; do
+ if [ -z "$lastline" ]; then
+ lastline=$line
+ else
+ # Split the line into hash and version
+ lasthash=`echo $lastline | cut -d' ' -f1`
+ lastversion=`echo $lastline | cut -d' ' -f2`
+ hash=`echo $line | cut -d' ' -f1`
+
+ echo "## **$lastversion**" >> "$filename"
+ log "Added version: $lastversion"
+ # Get the commit message and author of the tag
+ git log -n 1 --pretty=tformat:"%b" $lasthash >> "$filename"
+
+ echo "" >> "$filename"
+
+ # Get all commits between the current tag and the previous tag
+ git log $hash..$lasthash --pretty=format:"- %s [%cn]" --no-merges >> "$filename"
+
+ echo "" >> "$filename"
+ echo "" >> "$filename"
+
+ # Get the commit message and author of the tag
+ git log -n 1 --pretty=tformat:"> by _%cn_ on _%cd_" --date=format:'%Y-%m-%d %H:%M:%S' $lasthash >> "$filename"
+
+ echo "" >> "$filename"
+ echo "---" >> "$filename"
+ echo "" >> "$filename"
+ lastline=$line
+ fi
+done < tags.txt
+
+rm -r -f tags.txt
+
+log "Done"
+
+exit 0
\ No newline at end of file
diff --git a/Laerdal.Scripts/Laerdal.CreateNewReleaseInGithub.sh b/Laerdal.Scripts/Laerdal.CreateNewReleaseInGithub.sh
new file mode 100644
index 0000000..cf1ce63
--- /dev/null
+++ b/Laerdal.Scripts/Laerdal.CreateNewReleaseInGithub.sh
@@ -0,0 +1,167 @@
+#!/bin/bash
+
+declare VERBOSE=0
+declare TAG_VERSION=""
+
+declare GIT_BRANCH=""
+declare GITHUB_ACCESS_TOKEN=""
+declare GITHUB_REPOSITORY_PATH=""
+
+function parse_arguments() {
+ while [[ $# -gt 0 ]]; do
+ case $1 in
+
+ -v | --log)
+ VERBOSE=1
+ shift
+ ;;
+
+ -r | --repository-path)
+ GITHUB_REPOSITORY_PATH="$2"
+ shift
+ ;;
+
+ -t | --tag-version)
+ TAG_VERSION="$2"
+ shift
+ ;;
+
+ -b | --git-branch)
+ GIT_BRANCH="$2"
+ shift
+ ;;
+
+ -a | --access-token)
+ GITHUB_ACCESS_TOKEN="$2"
+ shift
+ ;;
+
+ *)
+ echo "Unknown option: $1"
+ usage
+ exit 1
+ ;;
+
+ esac
+ shift
+ done
+
+ if [[ -z $GIT_BRANCH ]]; then
+ echo "Missing git-branch."
+ usage
+ exit 1
+ fi
+
+ if [[ -z $GITHUB_REPOSITORY_PATH ]]; then
+ echo "Missing github-repository."
+ usage
+ exit 1
+ fi
+
+ if [[ -z $GITHUB_ACCESS_TOKEN ]]; then
+ echo "Missing github-access-token."
+ usage
+ exit 1
+ fi
+
+ validate_tag_format "$TAG_VERSION"
+}
+
+function validate_tag_format() {
+ local -r tag="$1"
+ local -r pattern='^[0-9]+\.[0-9]+(\.[0-9]+)?$'
+
+ if ! [[ $tag =~ $pattern ]]; then
+ exit_with_error "Tag format is invalid: '$tag'"
+ fi
+}
+
+function usage() {
+ local -r script_name=$(basename "$0")
+
+ echo "Usage: $script_name [--verbose|-v] [--repository-path|-r]= [--git-branch|-b]= [--access-token|-a]= [--tag-version|-t]="
+}
+
+function create_release_on_github() {
+ # https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release
+
+ local eventual_tag_name=""
+ local eventual_singleline_summary=""
+ if [[ $GIT_BRANCH == "refs/heads/main" || $GIT_BRANCH == "refs/heads/master" ]]; then
+ eventual_tag_name="v$TAG_VERSION" # builds targeting main have this simple and straightforward tag name
+ eventual_singleline_summary="Release $eventual_tag_name"
+
+ elif [[ $GIT_BRANCH == "refs/heads/develop" ]]; then # all builds that target develop are beta builds
+ eventual_tag_name="v$TAG_VERSION-beta"
+ eventual_singleline_summary="Beta $eventual_tag_name"
+
+ else # all other builds that dont target main are alpha builds should rarely happen in practice but just in case
+ eventual_tag_name="v$TAG_VERSION-alpha"
+ eventual_singleline_summary="Alpha $eventual_tag_name"
+ fi
+
+ local -r payload=$(
+ cat </dev/null 2>&1 # its vital to do this silently otherwise the
+git fetch origin "$develop_branch:$develop_branch" >/dev/null 2>&1 # output of this entire script will be malformed
+
+if [ "$branch_name" == "$develop_branch" ]; then
+ develop_master_point=`git rev-list $branch_prefix$master_branch --merges --before=\`git show -s --format=%ct $commit\` --first-parent --max-count=1`
+ if [ -z $develop_master_point ]; then # has never been merged
+ develop_master_point=`git merge-base $branch_prefix$master_branch $commit --fork-point`
+ fi
+ log "develop_master_point=$develop_master_point"
+
+elif [ "$branch_name" != "$master_branch" ]; then
+ head_develop_point=`git rev-list $branch_prefix$develop_branch --merges --before=\`git show -s --format=%ct $commit\` --first-parent --max-count=1`
+ if [ -z $head_develop_point ]; then # has never been merged
+ head_develop_point=$(git merge-base $branch_prefix$develop_branch $commit --fork-point)
+ fi
+
+ log "head_develop_point=$head_develop_point"
+ develop_master_point=`git rev-list $branch_prefix$master_branch --merges --before=\`git show -s --format=%ct $head_develop_point\` --first-parent --max-count=1`
+ if [ -z $develop_master_point ]; then # has never been merged
+ develop_master_point=`git merge-base $branch_prefix$master_branch $head_develop_point --fork-point`
+ fi
+ log "develop_master_point=$develop_master_point"
+fi
+
+
+# Minor
+if [ "$minor_override" != "true" ]; then
+ if [ "$branch_name" == "$master_branch" ]; then
+ minor=$( git rev-list "$first_commit..$commit" --count --first-parent --ancestry-path )
+
+ elif [ "$branch_name" == "$develop_branch" ]; then
+ minor=$( git rev-list "$first_commit..$develop_master_point" --count --first-parent --ancestry-path )
+
+ else
+ minor=$( git rev-list "$first_commit..$develop_master_point" --count --first-parent --ancestry-path )
+ fi
+
+else
+ log "Minor version override: $minor"
+fi
+
+# Patch
+if [ "$patch_override" != "true" ]; then
+ if [ "$branch_name" == "$master_branch" ]; then
+ patch=0
+
+ elif [ "$branch_name" == "$develop_branch" ]; then
+ declare -r before=$( git show -s --format=%ct "$develop_master_point" --first-parent --ancestry-path )
+ declare -r not=$( git rev-list "$first_commit..$commit" --before=$before | head -n 750 ) # its vital to trim the number of parameters to around 750 otherwise we will get an error below
+
+ patch=$( \
+ git \
+ rev-list \
+ "$first_commit..$commit" \
+ --count \
+ --first-parent \
+ --ancestry-path \
+ --not $not ) # do not doublequote $not as this will break the script
+
+ else
+ declare -r before=$( git show -s --format=%ct "$develop_master_point" --first-parent --ancestry-path )
+ declare -r not=$( git rev-list "$first_commit..$head_develop_point" --before="$before" | head -n 750 ) # its vital to trim the number of parameters to around 750 otherwise we will get an error below
+
+ patch=$( \
+ git rev-list \
+ "$first_commit..$head_develop_point" \
+ --count \
+ --first-parent \
+ --ancestry-path \
+ --not $not ) # do not doublequote $not as this will break the script
+ fi
+
+else
+ log "Patch version override: $patch"
+fi
+
+# Revision
+if [ "$revision_override" != "true" ]; then
+ if [ "$branch_name" == "$master_branch" ]; then
+ revision=0
+ elif [ "$branch_name" == "$develop_branch" ]; then
+ revision=0
+ else
+ revision=`git rev-list $head_develop_point..$commit --count`
+ fi
+else
+ log "Revision version override: $revision"
+fi
+
+# Version extension
+if [ "$branch_name" == "" ]; then
+ version_extension=
+elif [ "$branch_name" == "$master_branch" ]; then
+ version_extension=
+elif [ "$branch_name" == "$develop_branch" ]; then
+ version_extension=
+else
+ version_extension="-$suffix-$revision.$build_id"
+fi
+
+version_core=$major.$minor.$patch
+version_full=$version_core$version_extension
+version_assembly=$version_core.$revision
+
+
+log "Laerdal_Version_Major:$major"
+log "Laerdal_Version_Minor:$minor"
+log "Laerdal_Version_Patch:$patch"
+log "Laerdal_Version_Suffix:$suffix"
+log "Laerdal_Version_Revision:$revision"
+log "Laerdal_Version_BuildId:$build_id"
+log "Laerdal_Version_Core:$version_core"
+log "Laerdal_Version_Extension:$version_extension"
+log "Laerdal_Version_Full:$version_full"
+log "Laerdal_Version_Assembly:$version_assembly"
+log "Laerdal_Version_BranchName:$branch_name"
+log "Laerdal_Version_ScriptCalled:true"
+
+if [ "$output" != "" ]; then
+ mkdir -p "$(dirname "$output")" && touch "$output" ;
+ echo "Laerdal_Version_Major=$major" > $output
+ echo "Laerdal_Version_Minor=$minor" >> $output
+ echo "Laerdal_Version_Patch=$patch" >> $output
+ echo "Laerdal_Version_Suffix=$suffix" >> $output
+ echo "Laerdal_Version_Revision=$revision" >> $output
+ echo "Laerdal_Version_BuildId=$build_id" >> $output
+ echo "Laerdal_Version_Core=$version_core" >> $output
+ echo "Laerdal_Version_Extension=$version_extension" >> $output
+ echo "Laerdal_Version_Full=$version_full" >> $output
+ echo "Laerdal_Version_Assembly=$version_assembly" >> $output
+ echo "Laerdal_Version_BranchName=$branch_name" >> $output
+fi
+
+echo $version_full
+
+exit 0