Skip to content

Commit 15dfd49

Browse files
committed
feat: Update to pmd 9.30.1 + download python3 instead of using installed
1 parent d05b2e0 commit 15dfd49

6 files changed

Lines changed: 113 additions & 177 deletions

File tree

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,16 @@ All request/responses are implemented asyncronous.
99
### The Daemon
1010
- Check if the Daemon is currently running with `DaemonHandler.isDaemonRunning()`.
1111
- If not, launch a new instance.
12-
- Create a python env fist `PyInstallation installation = PyInstallationHandler.install(new File(</path/to/install/dir>));`
12+
- Provision a self-contained python interpreter first `PyInstallation installation = PyInstallationHandler.install(new File(</path/to/install/dir>));`
13+
- This downloads a pinned, arch-matched [python-build-standalone](https://github.com/astral-sh/python-build-standalone) interpreter, installs the requirements directly into it, and writes a `.ready` marker.
1314
- You don't need to check for directory existence beforehand, the code is safe to use on every run.
1415
- You should version the pathes using `PyMobileDevice3IPC.PROTOCOL_VERSION`, to avoid version collisions.
1516
- Then launch the daemon with `DaemonHandler.startDaemon(installation);`
1617
- Connect to the Daemon using `PyMobileDevice3IPC ipc = new PyMobileDevice3IPC()`. This object should be closed if not used anymore.
1718

1819

1920
### The IPC
20-
You can now use the `PyMobileDevice3IPC` created. All IPC methods return a `CompletableFuture` and are non-blocking.
21-
The `DebugServer` methods require tunneld to be running. You can check the status with `PyMobileDevice3IPC#isTunneldRunning`.
22-
You can launch tunneld with `PyMobileDevice3IPC#ensureTunneldRunning`, however this will ask for elevated priviliges on macos.
21+
You can now use the `PyMobileDevice3IPC` created. All IPC methods return a `CompletableFuture` and are non-blocking.
2322

2423
## Debugging
2524
If you run into issues, you can:

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ java {
1919

2020
dependencies {
2121
api("org.json:json:20250517")
22-
implementation("org.semver4j:semver4j:6.0.0")
2322
implementation("com.badlogicgames.jnigen:jnigen-commons:3.1.1")
2423
testImplementation(platform("org.junit:junit-bom:5.10.0"))
2524
testImplementation("org.junit.jupiter:junit-jupiter")

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GROUP=org.multi-os-engine
22
POM_ARTIFACT_ID=javapymobiledevice3
3-
VERSION=1.2.1
3+
VERSION=1.3.0
44

55
POM_NAME=JavaPyMobiledevice3
66
POM_DESCRIPTION=An IPC bridge between java and pymobiledevice3

src/main/java/io/github/berstanio/pymobiledevice3/ipc/PyMobileDevice3IPC.java

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public class PyMobileDevice3IPC implements Closeable {
3030

3131
private static final boolean DEBUG = System.getProperty("java.pymobiledevice3.debug") != null;
3232

33-
public static final int PROTOCOL_VERSION = 7;
33+
public static final int PROTOCOL_VERSION = 8;
3434

3535
private final int daemonProtocolVersion;
3636
private final Socket socket;
@@ -320,7 +320,7 @@ public CompletableFuture<Void> autoMountImage(DeviceInfo info) {
320320
}
321321

322322
/**
323-
* Connect to the debugserver on the device. Needs tunneld running.
323+
* Connect to the debugserver on the device. For iOS 17+ the developer disk image must be mounted first via {@link #autoMountImage(DeviceInfo)}.
324324
*
325325
* @param info The device to connect to
326326
* @param port The local port to open. 0 for arbitrary port
@@ -332,10 +332,6 @@ public CompletableFuture<DebugServerConnection> debugServerConnect(DeviceInfo in
332332
object.put("device_id", info.getUniqueDeviceId());
333333
object.put("port", port);
334334
return createRequest(object, (future, jsonObject) -> {
335-
if (jsonObject.getString("state").equals("failed_no_tunneld")) {
336-
future.completeExceptionally(new PyMobileDevice3Error("No tunneld instance for device " + info.getUniqueDeviceId() + " found."));
337-
return;
338-
}
339335
JSONObject result = jsonObject.getJSONObject("result");
340336
future.complete(new DebugServerConnection(info, result.getString("host"), result.getInt("port")));
341337
});
@@ -402,30 +398,6 @@ public CompletableFuture<Void> forceKillDaemon() {
402398
return CompletableFuture.completedFuture(null);
403399
}
404400

405-
/**
406-
* Checks whether the tunneld service is running, needed for debugserver connection
407-
*
408-
* @return whether the tunneld service is running
409-
*/
410-
public CompletableFuture<Boolean> isTunneldRunning() {
411-
JSONObject object = new JSONObject();
412-
object.put("command", "is_tunneld_running");
413-
return createRequest(object, (future, jsonObject) -> {
414-
future.complete(jsonObject.getBoolean("result"));
415-
});
416-
}
417-
418-
/**
419-
* Launches the tunneld service. Will request elevated priviliges on macos.
420-
*/
421-
public CompletableFuture<Void> ensureTunneldRunning() {
422-
JSONObject object = new JSONObject();
423-
object.put("command", "ensure_tunneld_running");
424-
return createRequest(object, (future, jsonObject) -> {
425-
future.complete(null);
426-
});
427-
}
428-
429401
public int getDaemonProtocolVersion() {
430402
return daemonProtocolVersion;
431403
}
@@ -436,8 +408,6 @@ public static void main(String[] args) throws IOException {
436408
DaemonHandler.startDaemon(installation);
437409
}
438410
try (PyMobileDevice3IPC ipc = new PyMobileDevice3IPC()) {
439-
ipc.ensureTunneldRunning().join();
440-
441411
DeviceInfo info = ipc.getDevice(null).join();
442412
DebugServerConnection connection = ipc.debugServerConnect(info, 0).join();
443413

src/main/java/io/github/berstanio/pymobiledevice3/venv/PyInstallation.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
import java.io.File;
44

55
public class PyInstallation {
6-
private final File venv;
6+
private final File pythonHome;
77
private final File pythonExecutable;
88
private final File handler;
99

10-
public PyInstallation(File venv, File pythonExecutable, File handler) {
11-
this.venv = venv;
10+
public PyInstallation(File pythonHome, File pythonExecutable, File handler) {
11+
this.pythonHome = pythonHome;
1212
this.pythonExecutable = pythonExecutable;
1313
this.handler = handler;
1414
}
@@ -21,7 +21,7 @@ public File getPythonExecutable() {
2121
return pythonExecutable;
2222
}
2323

24-
public File getVEnv() {
25-
return venv;
24+
public File getPythonHome() {
25+
return pythonHome;
2626
}
2727
}

0 commit comments

Comments
 (0)