12345678910111213141516171819202122232425262728293031323334353637383940 |
- $destnation = "..\3.BasicFunction\Include"
- $toolPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
- $destnation = $toolPath + '\' + $destnation
- $res = &"git" log --pretty=format:"%h" | Select-Object -First 1
- $sha = $res
- $res = &"git" log --pretty=format:"%at" | Select-Object -First 1
- $dt = ([datetime]'1/1/1970Z').AddSeconds([int]$res)
- $res = &"git" log --pretty=format:"%aN" | Select-Object -First 1
- $commitAuthor = $res
- $notClean = &"git" status -s
- if ($notClean)
- {
- $fp = $sha+"d";
- }
- else
- {
- $fp = $sha+"c"
- }
- $commitTime = $dt.ToString("yyyyMMdd HH:mm:ss")
- $compleTime = Get-Date -Format "yyyyMMdd HH:mm:ss"
- $author = &"git" config user.name
- $fileName = $toolPath+"\fp.def"
- Out-File -FilePath $fileName -InputObject ('#define FINGER_PRINT "' + $fp + '"') -Encoding utf8;
- Out-File -FilePath $fileName -InputObject ('#define COMMIT_TIME "' + $commitTime + '"') -Encoding utf8 -Append;
- Out-File -FilePath $fileName -InputObject ('#define COMMIT_AUTHOR "' + $commitAuthor + '"') -Encoding utf8 -Append;
- out-File -FilePath $fileName -InputObject ('#define COMPLIE_TIME "' + $compleTime + '"') -Encoding utf8 -Append;
- out-File -FilePath $fileName -InputObject ('#define COMPLIE_AUTHOR "' + $author + '"') -Encoding utf8 -Append;
- Copy-Item $fileName $destnation
- echo "Fingerprint Generated!"
|