-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathversion.py
More file actions
28 lines (24 loc) · 919 Bytes
/
Copy pathversion.py
File metadata and controls
28 lines (24 loc) · 919 Bytes
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
#generate the version information files for all parts of the program
import re
applicationIdPattern=re.compile(r'applicationId "(.+)"')
versionCodePattern=re.compile(r'versionCode (\d+)')
versionNamePattern=re.compile(r'versionName "(.+)"')
with open("androidClient/app/build.gradle") as buildfile:
data=buildfile.read()
version=int(next(versionCodePattern.finditer(data)).group(1))
tag=next(versionNamePattern.finditer(data)).group(1)
repo=next(applicationIdPattern.finditer(data)).group(1)
java=open("androidClient/app/src/main/java/ie/delilahsthings/chessboardnetCommon/VersionInfo.java","w+")
java.write('''package ie.delilahsthings.chessboardnetCommon;
public class VersionInfo
{
public final static int version=%d;
public final static String tag="%s";
}
''' % (version,tag))
java.close()
python=open("httpapi/versionInfo.py","w+")
python.write('''version=%d
tag="%s"
repo="%s"
''' % (version,tag,repo))