Add support for specifying version filter restrictions on %-expanded manifest packages. This enables e.g. separating out Emscripten version <= 1.37.22 to keep using Java 7 that they originally shipped with, but migrate 1.37.23 to use Java 8 which is now needed to keep Closure working. Add packages for Java 8.

This commit is contained in:
Jukka Jylänki 2017-11-13 16:48:26 +02:00
Родитель 00e8d9df95
Коммит a21b2f2ef5
2 изменённых файлов: 149 добавлений и 16 удалений

55
emsdk
Просмотреть файл

@ -1459,11 +1459,14 @@ def find_used_python():
return t
return None
def is_version_at_least(ver, target):
ver = ver.split('.')
target = target.split('.')
# Performs a ver >= target comparison
def is_version_equal_or_newer(ver, target):
ver = ver.replace('-', '.').replace('_', '.').split('.')
target = target.replace('-', '.').replace('_', '.').split('.')
while len(ver) < len(target):
ver += ['0']
while len(target) < len(ver):
target += ['0']
for i in range(len(ver)):
if int(ver[i]) < int(target[i]):
return False
@ -1471,9 +1474,29 @@ def is_version_at_least(ver, target):
return True
return True
# Tests ver < target
def is_version_strictly_older_than(ver, target):
return not is_version_equal_or_newer(ver, target)
# Tests ver <= target
def is_version_equal_or_older(ver, target):
return is_version_equal_or_newer(target, ver)
# Tests ver > target
def is_version_strictly_newer_than(ver, target):
return not is_version_strictly_older_than(target, ver)
# Performs a ver == target comparison
def is_version_equal(ver, target):
return is_version_equal_or_newer(ver, target) and is_version_equal_or_newer(target, ver)
# Performs a ver != target comparison
def is_version_not_equal(ver, target):
return not is_version_equal_or_newer(ver, target) or not is_version_equal_or_newer(target, ver)
def version_compare(x, y):
a = 1 if is_version_at_least(x, y) else 0
b = 1 if is_version_at_least(y, x) else 0
a = 1 if is_version_equal_or_newer(x, y) else 0
b = 1 if is_version_equal_or_newer(y, x) else 0
return a - b
# A sort function that is compatible with both Python 2 and Python 3 using a custom comparison function.
@ -1506,7 +1529,7 @@ def fetch_emscripten_tags():
for t in tags.split('\n'):
try:
t = t[t.index('refs/tags/') + len('refs/tags/'):].strip()
if is_version_at_least(t, '1.28.2'):
if is_version_equal_or_newer(t, '1.28.2'):
all_tags += [t]
except:
pass
@ -1673,6 +1696,21 @@ def load_sdk_manifest():
if not tool: return False
return True
def cmp_version(ver, cmp_operand, reference):
if cmp_operand == '<=': return is_version_equal_or_older(ver, reference)
if cmp_operand == '<': return is_version_strictly_older_than(ver, reference)
if cmp_operand == '>=': return is_version_equal_or_newer(ver, reference)
if cmp_operand == '>': return is_version_strictly_newer_than(ver, reference)
if cmp_operand == '==': return is_version_equal(ver, reference)
if cmp_operand == '!=': return is_version_not_equal(ver, reference)
raise Exception('Invalid cmp_operand "' + cmp_operand + '"!')
def passes_filters(param, ver, filters):
for v in filters:
if v[0] == param and not cmp_version(ver, v[1], v[2]):
return False
return True
# A 'category parameter' is a %foo%-encoded identifier that specifies
# a class of tools instead of just one tool, e.g. %tag% or %nightly..%
def expand_category_param(param, category_list, t, is_sdk):
@ -1687,6 +1725,11 @@ def load_sdk_manifest():
t2.is_old = i < len(category_list) - 2
if hasattr(t2, 'uses'):
t2.uses = list(map((lambda x: x.replace(param, ver)), t2.uses))
# Filter out expanded tools by version requirements, such as ["tag", "<=", "1.37.22"]
if hasattr(t, 'version_filter') and not passes_filters(param, ver, t.version_filter):
continue
if is_sdk:
if dependencies_exist(t2):
sdks.append(t2)

Просмотреть файл

@ -414,6 +414,24 @@
"activated_env": "JAVA_HOME=%installation_dir%",
"activated_cfg": "JAVA='%installation_dir%/bin/java%.exe%'"
},
{
"id": "java",
"version": "8.152",
"bitness": 32,
"windows_url": "portable_jre_8_update_152_32bit.zip",
"activated_path": "%installation_dir%/bin",
"activated_env": "JAVA_HOME=%installation_dir%",
"activated_cfg": "JAVA='%installation_dir%/bin/java%.exe%'"
},
{
"id": "java",
"version": "8.152",
"bitness": 64,
"windows_url": "portable_jre_8_update_152_64bit.zip",
"activated_path": "%installation_dir%/bin",
"activated_env": "JAVA_HOME=%installation_dir%",
"activated_cfg": "JAVA='%installation_dir%/bin/java%.exe%'"
},
{
"id": "spidermonkey",
"version": "27.0.1",
@ -911,13 +929,13 @@
{
"version": "incoming",
"bitness": 32,
"uses": ["clang-incoming-32bit", "node-4.1.1-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-incoming-32bit"],
"uses": ["clang-incoming-32bit", "node-4.1.1-32bit", "python-2.7.5.3-32bit", "java-8.152-32bit", "emscripten-incoming-32bit"],
"os": "win"
},
{
"version": "incoming",
"bitness": 64,
"uses": ["clang-incoming-64bit", "node-4.1.1-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-incoming-64bit"],
"uses": ["clang-incoming-64bit", "node-4.1.1-64bit", "python-2.7.5.3-64bit", "java-8.152-64bit", "emscripten-incoming-64bit"],
"os": "win"
},
{
@ -941,13 +959,13 @@
{
"version": "master",
"bitness": 32,
"uses": ["clang-master-32bit", "node-4.1.1-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-master-32bit"],
"uses": ["clang-master-32bit", "node-4.1.1-32bit", "python-2.7.5.3-32bit", "java-8.152-32bit", "emscripten-master-32bit"],
"os": "win"
},
{
"version": "master",
"bitness": 64,
"uses": ["clang-master-64bit", "node-4.1.1-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-master-64bit"],
"uses": ["clang-master-64bit", "node-4.1.1-64bit", "python-2.7.5.3-64bit", "java-8.152-64bit", "emscripten-master-64bit"],
"os": "win"
},
{
@ -972,13 +990,37 @@
"version": "tag-%tag%",
"bitness": 32,
"uses": ["clang-tag-e%tag%-32bit", "node-4.1.1-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-tag-%tag%-32bit"],
"os": "win"
"os": "win",
"version_filter": [
["%tag%", "<=", "1.37.22"]
]
},
{
"version": "tag-%tag%",
"bitness": 64,
"uses": ["clang-tag-e%tag%-64bit", "node-4.1.1-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-tag-%tag%-64bit"],
"os": "win"
"os": "win",
"version_filter": [
["%tag%", "<=", "1.37.22"]
]
},
{
"version": "tag-%tag%",
"bitness": 32,
"uses": ["clang-tag-e%tag%-32bit", "node-4.1.1-32bit", "python-2.7.5.3-32bit", "java-8.152-32bit", "emscripten-tag-%tag%-32bit"],
"os": "win",
"version_filter": [
["%tag%", ">", "1.37.22"]
]
},
{
"version": "tag-%tag%",
"bitness": 64,
"uses": ["clang-tag-e%tag%-64bit", "node-4.1.1-64bit", "python-2.7.5.3-64bit", "java-8.152-64bit", "emscripten-tag-%tag%-64bit"],
"os": "win",
"version_filter": [
["%tag%", ">", "1.37.22"]
]
},
{
"version": "tag-%tag%",
@ -996,13 +1038,37 @@
"version": "nightly-%nightly-llvm-32bit%",
"bitness": 32,
"uses": ["clang-nightly-e%nightly-llvm-32bit%-32bit", "node-4.1.1-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-nightly-%nightly-llvm-32bit%"],
"os": "win"
"os": "win",
"version_filter": [
["%nightly-llvm-32bit%", "<=", "1.37.22-2017_11_05"]
]
},
{
"version": "nightly-%nightly-llvm-64bit%",
"bitness": 64,
"uses": ["clang-nightly-e%nightly-llvm-64bit%-64bit", "node-4.1.1-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-nightly-%nightly-llvm-64bit%"],
"os": "win"
"os": "win",
"version_filter": [
["%nightly-llvm-64bit%", "<=", "1.37.22-2017_11_05"]
]
},
{
"version": "nightly-%nightly-llvm-32bit%",
"bitness": 32,
"uses": ["clang-nightly-e%nightly-llvm-32bit%-32bit", "node-4.1.1-32bit", "python-2.7.5.3-32bit", "java-8.152-32bit", "emscripten-nightly-%nightly-llvm-32bit%"],
"os": "win",
"version_filter": [
["%nightly-llvm-32bit%", ">", "1.37.22-2017_11_05"]
]
},
{
"version": "nightly-%nightly-llvm-64bit%",
"bitness": 64,
"uses": ["clang-nightly-e%nightly-llvm-64bit%-64bit", "node-4.1.1-64bit", "python-2.7.5.3-64bit", "java-8.152-64bit", "emscripten-nightly-%nightly-llvm-64bit%"],
"os": "win",
"version_filter": [
["%nightly-llvm-64bit%", ">", "1.37.22-2017_11_05"]
]
},
{
"version": "nightly-%nightly-llvm-32bit%",
@ -1321,13 +1387,37 @@
"version": "%precompiled_tag32%",
"bitness": 32,
"uses": ["clang-e%precompiled_tag32%-32bit", "node-4.1.1-32bit", "python-2.7.5.3-32bit", "java-7.45-32bit", "emscripten-%precompiled_tag32%"],
"os": "win"
"os": "win",
"version_filter": [
["%precompiled_tag32%", "<=", "1.37.22"]
]
},
{
"version": "%precompiled_tag64%",
"bitness": 64,
"uses": ["clang-e%precompiled_tag64%-64bit", "node-4.1.1-64bit", "python-2.7.5.3-64bit", "java-7.45-64bit", "emscripten-%precompiled_tag64%"],
"os": "win"
"os": "win",
"version_filter": [
["%precompiled_tag64%", "<=", "1.37.22"]
]
},
{
"version": "%precompiled_tag32%",
"bitness": 32,
"uses": ["clang-e%precompiled_tag32%-32bit", "node-4.1.1-32bit", "python-2.7.5.3-32bit", "java-8.152-32bit", "emscripten-%precompiled_tag32%"],
"os": "win",
"version_filter": [
["%precompiled_tag32%", ">", "1.37.22"]
]
},
{
"version": "%precompiled_tag64%",
"bitness": 64,
"uses": ["clang-e%precompiled_tag64%-64bit", "node-4.1.1-64bit", "python-2.7.5.3-64bit", "java-8.152-64bit", "emscripten-%precompiled_tag64%"],
"os": "win",
"version_filter": [
["%precompiled_tag64%", ">", "1.37.22"]
]
},
{
"version": "%precompiled_tag32%",