Merge pull request #11103 from electron/full-version-string

fix: Provide full and correct version in `process.version`
This commit is contained in:
Charles Kerr 2017-11-14 19:18:03 -06:00 committed by GitHub
commit 3a1106d026
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 15 deletions

View file

@ -8,11 +8,10 @@
#define ATOM_MAJOR_VERSION 1
#define ATOM_MINOR_VERSION 8
#define ATOM_PATCH_VERSION 2
#define ATOM_PRE_RELEASE_VERSION -beta.2
#define ATOM_VERSION_IS_RELEASE 1
#ifndef ATOM_TAG
# define ATOM_TAG ""
#ifndef ATOM_PRE_RELEASE_VERSION
# define ATOM_PRE_RELEASE_VERSION ""
#endif
#ifndef ATOM_STRINGIFY
@ -20,17 +19,10 @@
#define ATOM_STRINGIFY_HELPER(n) #n
#endif
#if ATOM_VERSION_IS_RELEASE
# define ATOM_VERSION_STRING ATOM_STRINGIFY(ATOM_MAJOR_VERSION) "." \
ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." \
ATOM_STRINGIFY(ATOM_PATCH_VERSION) \
ATOM_TAG
#else
# define ATOM_VERSION_STRING ATOM_STRINGIFY(ATOM_MAJOR_VERSION) "." \
ATOM_STRINGIFY(ATOM_MINOR_VERSION) "." \
ATOM_STRINGIFY(ATOM_PATCH_VERSION) \
ATOM_TAG "-pre"
#endif
ATOM_STRINGIFY(ATOM_PRE_RELEASE_VERSION)
#define ATOM_VERSION "v" ATOM_VERSION_STRING

View file

@ -85,7 +85,7 @@ def main():
with scoped_cwd(SOURCE_ROOT):
update_electron_gyp(version, suffix)
update_win_rc(version, versions)
update_version_h(versions)
update_version_h(versions, suffix)
update_info_plist(version)
update_package_json(version, suffix)
tag_version(version, suffix)
@ -138,7 +138,7 @@ def update_win_rc(version, versions):
f.write(''.join(lines))
def update_version_h(versions):
def update_version_h(versions, suffix):
version_h = os.path.join('atom', 'common', 'atom_version.h')
with open(version_h, 'r') as f:
lines = f.readlines()
@ -150,6 +150,11 @@ def update_version_h(versions):
lines[i + 1] = '#define ATOM_MINOR_VERSION {0}\n'.format(versions[1])
lines[i + 2] = '#define ATOM_PATCH_VERSION {0}\n'.format(versions[2])
if (suffix):
lines[i + 3] = '#define ATOM_PRE_RELEASE_VERSION {0}\n'.format(suffix)
else:
lines[i + 3] = '// #define ATOM_PRE_RELEASE_VERSION\n'
with open(version_h, 'w') as f:
f.write(''.join(lines))
return

View file

@ -336,7 +336,7 @@ describe('node feature', () => {
})
it('includes the electron version in process.versions', () => {
assert(/^\d+\.\d+\.\d+$/.test(process.versions.electron))
assert(/^\d+\.\d+\.\d+(\S*)?$/.test(process.versions.electron))
})
it('includes the chrome version in process.versions', () => {