Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1621,12 +1621,21 @@ async def run_build(job_id: str, build_id: str, task: str, signing: dict, app_co
|
|
| 1621 |
raise
|
| 1622 |
except Exception as e:
|
| 1623 |
log(f"Compat check note: {e}")
|
| 1624 |
-
# JDK auto-select (era coverage: 11 legacy / 17 default / 21 modern)
|
|
|
|
|
|
|
|
|
|
| 1625 |
jdk_home = None
|
| 1626 |
try:
|
| 1627 |
want_jdk = 17
|
| 1628 |
reason = "default"
|
| 1629 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1630 |
want_jdk, reason = 21, f"AGP {agp_major}.x"
|
| 1631 |
elif agp_major == 8:
|
| 1632 |
want_jdk, reason = 17, f"AGP {agp_major}.x"
|
|
@@ -1639,9 +1648,8 @@ async def run_build(job_id: str, build_id: str, task: str, signing: dict, app_co
|
|
| 1639 |
elif gradle_major == 7:
|
| 1640 |
want_jdk, reason = 11, f"Gradle {gradle_major}.x"
|
| 1641 |
else:
|
| 1642 |
-
|
| 1643 |
-
|
| 1644 |
-
want_jdk, reason = 21, f"Capacitor {ch}.x"
|
| 1645 |
cand = f"/opt/java{want_jdk}"
|
| 1646 |
if want_jdk != 17:
|
| 1647 |
if Path(cand).exists():
|
|
|
|
| 1621 |
raise
|
| 1622 |
except Exception as e:
|
| 1623 |
log(f"Compat check note: {e}")
|
| 1624 |
+
# JDK auto-select (era coverage: 11 legacy / 17 default / 21 modern).
|
| 1625 |
+
# Capacitor 8's own android library targets Java 21 bytecode, so any
|
| 1626 |
+
# Cap8 project must compile on JDK 21 even though its AGP is 8.x
|
| 1627 |
+
# (AGP rule alone would pick 17 and fail with "invalid source release: 21").
|
| 1628 |
jdk_home = None
|
| 1629 |
try:
|
| 1630 |
want_jdk = 17
|
| 1631 |
reason = "default"
|
| 1632 |
+
try:
|
| 1633 |
+
cap_ch = _detect_cap_major(search_root)
|
| 1634 |
+
except Exception:
|
| 1635 |
+
cap_ch = 0
|
| 1636 |
+
if cap_ch and cap_ch >= 8:
|
| 1637 |
+
want_jdk, reason = 21, f"Capacitor {cap_ch}.x"
|
| 1638 |
+
elif agp_major and agp_major >= 9:
|
| 1639 |
want_jdk, reason = 21, f"AGP {agp_major}.x"
|
| 1640 |
elif agp_major == 8:
|
| 1641 |
want_jdk, reason = 17, f"AGP {agp_major}.x"
|
|
|
|
| 1648 |
elif gradle_major == 7:
|
| 1649 |
want_jdk, reason = 11, f"Gradle {gradle_major}.x"
|
| 1650 |
else:
|
| 1651 |
+
if cap_ch and cap_ch >= 7:
|
| 1652 |
+
want_jdk, reason = 21, f"Capacitor {cap_ch}.x"
|
|
|
|
| 1653 |
cand = f"/opt/java{want_jdk}"
|
| 1654 |
if want_jdk != 17:
|
| 1655 |
if Path(cand).exists():
|