FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/csharp/scripts/gen-git-assembly-info.py at main · github/codeql · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10k
Code
Issues
998
Pull requests
467
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
csharp
/
scripts
/
gen-git-assembly-info.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
36 lines (26 loc) · 1.1 KB
Breadcrumbs
codeql
/
csharp
/
scripts
/
gen-git-assembly-info.py
Copy path
File metadata and controls
36 lines (26 loc) · 1.1 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""
Generates an `GitAssemblyInfo.cs` file that specifies the `AssemblyInformationalVersion` attribute.
This attribute is set to the git version string of the repository."""
import
pathlib
import
argparse
def
options
():
p
=
argparse
.
ArgumentParser
(
description
=
"Generate the git assembly info file that contains the git SHA and branch name"
)
p
.
add_argument
(
"output"
,
help
=
"The path to the output file"
)
p
.
add_argument
(
"gitinfo_files"
,
nargs
=
"+"
,
help
=
"The path to the gitinfo files"
)
return
p
.
parse_args
()
opts
=
options
()
gitfiles
=
dict
()
for
file
in
map
(
pathlib
.
Path
,
opts
.
gitinfo_files
):
gitfiles
[
file
.
name
]
=
file
version_string
=
gitfiles
[
"git-ql-describe-all.log"
].
read_text
().
strip
()
if
version_string
==
"no-git"
:
version_string
=
gitfiles
[
"git-describe-all.log"
].
read_text
().
strip
()
version_string
+=
f" (
{
gitfiles
[
'git-ql-rev-parse.log'
].
read_text
().
strip
()
}
)"
output_file
=
pathlib
.
Path
(
opts
.
output
)
output_file_contents
=
f"""
using System.Reflection;
[assembly: AssemblyInformationalVersion("
{
version_string
}
")]
"""
output_file
.
write_text
(
output_file_contents
)
Back
|
FazBrowse Home
|
New Git URL