From 39efa21273e57e4b33dd72910a9f749c136c5ecd Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Tue, 3 Nov 2026 10:21:37 +0100 Subject: [PATCH 1/4] =?UTF-8?q?=E5=BC=80=E5=8F=91=EF=BC=9A=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=99=A8=E5=92=8C=E5=91=BD=E4=BB=A4=E8=A1=8C=EF=BC=8C?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E3=80=81=E6=B5=8B=E8=AF=95=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E6=A0=B9=E7=9B=AE=E5=BD=95=E7=94=A8=20portBase=20=E6=8D=A2?= =?UTF-8?q?=E4=B8=80=E6=AE=B5=E7=AB=AF=E5=8F=A3=EF=BC=88ModAVDManager#20?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 验证:同机还有日常在用的根目录时,开发根目录写 "portBase": 21000;端口怎么算、取值范围、 adb server 端口的要求,改之前先关实例,AUTO-MAS 还不认 - 契约:脚本要端口从 list / info 的 ports、serial 取,不自己按 20000 + 10 × 编号算 --- docs/develop/manager.md | 6 ++++++ docs/en/develop/manager.md | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/docs/develop/manager.md b/docs/develop/manager.md index a3ba14d..cac71a8 100644 --- a/docs/develop/manager.md +++ b/docs/develop/manager.md @@ -39,6 +39,10 @@ pwsh -NoProfile -File build.ps1 -Test # 先跑 go vet 和 go test - 有一部分测试用 Python 3 运行 AUTO-MAS 的原始逻辑,和 Go 的输出逐字节对照,所以要装 Python 3; - 实测要一个 ModAVD 根目录:Release 包解压,再补全组件; - 实测用新建的实例、私有 adb 端口; +- 开发、测试用的根目录换一段端口:同一台电脑上还有日常在用的根目录(比如 AUTO-MAS 用的那个)时,在开发根目录的 `mas-avd.json` 里写 `"portBase": 21000`,这个根目录的实例就从 21000 起算端口,不和那边同编号的实例抢。要带 [ModAVDManager#20](https://github.com/ModAVD/ModAVDManager/issues/20) 的管理器。 + - 端口:控制台 = `portBase` + 10 × 编号,adb 加 1,gRPC 加 2;编号还是 0–9,不含 5。`portBase` 只能是 20000(缺省),或者 1100–65400 之间 100 的整数倍;同时开两个开发根目录,第二个写 22000。 + - `adbServerPort`、`scriptAdbServerPort` 也要配,不能是 20049、20050,也不能落在 20000 段实例的端口上,否则管理器不开机。 + - 改之前先关掉这个根目录的所有实例。AUTO-MAS 还不认 `portBase`,设了的根目录不要加进 AUTO-MAS。 - 不要对放着重要实例的根目录开实机测试开关(`MODAVD_TEST_LIVE=1`)。 CI 在 PR 上跑格式检查、`go vet`、`go test`、`build.ps1`、隐私扫描和作者检查。 @@ -47,6 +51,8 @@ CI 在 PR 上跑格式检查、`go vet`、`go test`、`build.ps1`、隐私扫描 `--json` 输出的信封、错误码和 `protocol` 版本是 AUTO-MAS 依赖的。加字段可以;改含义、删字段要把 `internal/buildinfo` 里的 `Protocol` 加一,先开 issue。 +脚本要用实例的端口时,从 `list` / `info` 的 `ports`、`serial` 取,不要自己按 20000 + 10 × 编号算:设了 `portBase` 的根目录不在 20000 段上。 + ## 版本 管理器从 v0.1.0 起单独编号、单独发版(v0.1.0 的两个 exe 和 ModAVD 0.36.0 包里的逐字节相同)。ModAVD 整包发版时钉住当时的管理器版本和哈希,整包里的那份跟着整包一起换。管理器不自更新:0.2.0 起的 `modavd update` 更新的是整个 ModAVD 根目录(来源 GitHub 或 Mirror 酱,只在手动运行时联网),单独下载的管理器要手动替换。 diff --git a/docs/en/develop/manager.md b/docs/en/develop/manager.md index 0155721..24c9a5e 100644 --- a/docs/en/develop/manager.md +++ b/docs/en/develop/manager.md @@ -39,6 +39,10 @@ It uses `-trimpath -buildvcs=false` and does not write the version number with ` - Some tests run AUTO-MAS's original logic with Python 3 and compare it with Go's output byte by byte, so Python 3 must be installed; - Testing on a real instance needs a ModAVD root folder: extract the release package, then fetch the Google components; - Use newly created instances and a private adb port for these tests; +- Give root folders for development and testing their own port range: when the same computer also has a root folder in daily use (for example the one AUTO-MAS uses), write `"portBase": 21000` in the `mas-avd.json` of the development root folder. Its instances then count their ports from 21000 and do not fight with the instances of the same number over there. This needs a manager with [ModAVDManager#20](https://github.com/ModAVD/ModAVDManager/issues/20). + - Ports: console = `portBase` + 10 × index, adb is 1 more, gRPC 2 more; the index is still 0–9 without 5. `portBase` can only be 20000 (the default) or a multiple of 100 between 1100 and 65400. With two development root folders open at the same time, write 22000 in the second. + - Also set `adbServerPort` and `scriptAdbServerPort`. They cannot be 20049 or 20050, nor fall on the ports of an instance in the 20000 range; otherwise the manager does not start the instance. + - Shut down every instance of the root folder before you change it. AUTO-MAS does not know `portBase` yet, so do not add a root folder that sets it to AUTO-MAS. - Do not turn on the live-test switch (`MODAVD_TEST_LIVE=1`) against a root folder that holds important instances. CI runs the format check, `go vet`, `go test`, `build.ps1`, the privacy scan and the author check on PRs. @@ -47,6 +51,8 @@ CI runs the format check, `go vet`, `go test`, `build.ps1`, the privacy scan and The envelope of the `--json` output, the error codes and the `protocol` version are what AUTO-MAS depends on. Adding fields is fine. To change a meaning or remove a field, add one to `Protocol` in `internal/buildinfo` and open an issue first. +When a script needs the ports of an instance, take them from `ports` and `serial` in `list` / `info` instead of computing 20000 + 10 × index: a root folder that sets `portBase` is not in the 20000 range. + ## Versioning The manager has been numbered and released separately since v0.1.0 (the two exe files of v0.1.0 are byte-identical to those in the ModAVD 0.36.0 package). When the ModAVD package is released, it pins the manager version and hash at that time, and the copy inside the package changes together with the package. The manager does not update itself: from 0.2.0, `modavd update` updates the whole ModAVD root folder (from GitHub or MirrorChyan, going online only when you run it by hand), and a manager downloaded on its own has to be replaced by hand. From 63df906b309ae8c7245ddad063c7cedd35712a71 Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Tue, 3 Nov 2026 10:22:51 +0100 Subject: [PATCH 2/4] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E4=B8=AA=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E6=A0=B9=E7=9B=AE=E5=BD=95=E7=9A=84=E4=BE=8B=E5=AD=90?= =?UTF-8?q?=E6=94=B9=E6=88=90=2023000=EF=BC=8C=E5=B9=B6=E6=8F=90=E9=86=92?= =?UTF-8?q?=E5=85=88=E7=9C=8B=E7=AB=AF=E5=8F=A3=E6=9C=89=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=A2=AB=E5=8D=A0=EF=BC=88Syncthing=20=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=8D=A0=2022000=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/develop/manager.md | 2 +- docs/en/develop/manager.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/develop/manager.md b/docs/develop/manager.md index cac71a8..80c781e 100644 --- a/docs/develop/manager.md +++ b/docs/develop/manager.md @@ -40,7 +40,7 @@ pwsh -NoProfile -File build.ps1 -Test # 先跑 go vet 和 go test - 实测要一个 ModAVD 根目录:Release 包解压,再补全组件; - 实测用新建的实例、私有 adb 端口; - 开发、测试用的根目录换一段端口:同一台电脑上还有日常在用的根目录(比如 AUTO-MAS 用的那个)时,在开发根目录的 `mas-avd.json` 里写 `"portBase": 21000`,这个根目录的实例就从 21000 起算端口,不和那边同编号的实例抢。要带 [ModAVDManager#20](https://github.com/ModAVD/ModAVDManager/issues/20) 的管理器。 - - 端口:控制台 = `portBase` + 10 × 编号,adb 加 1,gRPC 加 2;编号还是 0–9,不含 5。`portBase` 只能是 20000(缺省),或者 1100–65400 之间 100 的整数倍;同时开两个开发根目录,第二个写 22000。 + - 端口:控制台 = `portBase` + 10 × 编号,adb 加 1,gRPC 加 2;编号还是 0–9,不含 5。`portBase` 只能是 20000(缺省),或者 1100–65400 之间 100 的整数倍;同时开两个开发根目录,第二个换一段,比如 23000。选之前先看一眼这一段有没有别的程序在用(比如 Syncthing 默认占着 22000)。 - `adbServerPort`、`scriptAdbServerPort` 也要配,不能是 20049、20050,也不能落在 20000 段实例的端口上,否则管理器不开机。 - 改之前先关掉这个根目录的所有实例。AUTO-MAS 还不认 `portBase`,设了的根目录不要加进 AUTO-MAS。 - 不要对放着重要实例的根目录开实机测试开关(`MODAVD_TEST_LIVE=1`)。 diff --git a/docs/en/develop/manager.md b/docs/en/develop/manager.md index 24c9a5e..49ac59d 100644 --- a/docs/en/develop/manager.md +++ b/docs/en/develop/manager.md @@ -40,7 +40,7 @@ It uses `-trimpath -buildvcs=false` and does not write the version number with ` - Testing on a real instance needs a ModAVD root folder: extract the release package, then fetch the Google components; - Use newly created instances and a private adb port for these tests; - Give root folders for development and testing their own port range: when the same computer also has a root folder in daily use (for example the one AUTO-MAS uses), write `"portBase": 21000` in the `mas-avd.json` of the development root folder. Its instances then count their ports from 21000 and do not fight with the instances of the same number over there. This needs a manager with [ModAVDManager#20](https://github.com/ModAVD/ModAVDManager/issues/20). - - Ports: console = `portBase` + 10 × index, adb is 1 more, gRPC 2 more; the index is still 0–9 without 5. `portBase` can only be 20000 (the default) or a multiple of 100 between 1100 and 65400. With two development root folders open at the same time, write 22000 in the second. + - Ports: console = `portBase` + 10 × index, adb is 1 more, gRPC 2 more; the index is still 0–9 without 5. `portBase` can only be 20000 (the default) or a multiple of 100 between 1100 and 65400. With two development root folders open at the same time, give the second another range, for example 23000. Before you pick one, check that no other program uses that range (Syncthing, for example, takes 22000 by default). - Also set `adbServerPort` and `scriptAdbServerPort`. They cannot be 20049 or 20050, nor fall on the ports of an instance in the 20000 range; otherwise the manager does not start the instance. - Shut down every instance of the root folder before you change it. AUTO-MAS does not know `portBase` yet, so do not add a root folder that sets it to AUTO-MAS. - Do not turn on the live-test switch (`MODAVD_TEST_LIVE=1`) against a root folder that holds important instances. From 69cdce49ea29f35e6783d0c25ebbac104a7bb160 Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Tue, 3 Nov 2026 17:54:22 +0100 Subject: [PATCH 3/4] =?UTF-8?q?=E5=BC=95=E7=94=A8=E7=9A=84=20issue=20?= =?UTF-8?q?=E6=94=B9=E6=88=90=20ModAVD/ModAVD#75=EF=BC=9Bstatus=20?= =?UTF-8?q?=E4=B9=9F=E5=B8=A6=E7=AB=AF=E5=8F=A3=EF=BC=8Clist=20=E7=9A=84?= =?UTF-8?q?=20port=5Fbase=20=E6=98=AF=E5=AE=9E=E9=99=85=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E7=AB=AF=E5=8F=A3=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/develop/manager.md | 4 ++-- docs/en/develop/manager.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/develop/manager.md b/docs/develop/manager.md index 80c781e..7f16d96 100644 --- a/docs/develop/manager.md +++ b/docs/develop/manager.md @@ -39,7 +39,7 @@ pwsh -NoProfile -File build.ps1 -Test # 先跑 go vet 和 go test - 有一部分测试用 Python 3 运行 AUTO-MAS 的原始逻辑,和 Go 的输出逐字节对照,所以要装 Python 3; - 实测要一个 ModAVD 根目录:Release 包解压,再补全组件; - 实测用新建的实例、私有 adb 端口; -- 开发、测试用的根目录换一段端口:同一台电脑上还有日常在用的根目录(比如 AUTO-MAS 用的那个)时,在开发根目录的 `mas-avd.json` 里写 `"portBase": 21000`,这个根目录的实例就从 21000 起算端口,不和那边同编号的实例抢。要带 [ModAVDManager#20](https://github.com/ModAVD/ModAVDManager/issues/20) 的管理器。 +- 开发、测试用的根目录换一段端口:同一台电脑上还有日常在用的根目录(比如 AUTO-MAS 用的那个)时,在开发根目录的 `mas-avd.json` 里写 `"portBase": 21000`,这个根目录的实例就从 21000 起算端口,不和那边同编号的实例抢。要带 [ModAVD/ModAVD#75](https://github.com/ModAVD/ModAVD/issues/75) 的管理器。 - 端口:控制台 = `portBase` + 10 × 编号,adb 加 1,gRPC 加 2;编号还是 0–9,不含 5。`portBase` 只能是 20000(缺省),或者 1100–65400 之间 100 的整数倍;同时开两个开发根目录,第二个换一段,比如 23000。选之前先看一眼这一段有没有别的程序在用(比如 Syncthing 默认占着 22000)。 - `adbServerPort`、`scriptAdbServerPort` 也要配,不能是 20049、20050,也不能落在 20000 段实例的端口上,否则管理器不开机。 - 改之前先关掉这个根目录的所有实例。AUTO-MAS 还不认 `portBase`,设了的根目录不要加进 AUTO-MAS。 @@ -51,7 +51,7 @@ CI 在 PR 上跑格式检查、`go vet`、`go test`、`build.ps1`、隐私扫描 `--json` 输出的信封、错误码和 `protocol` 版本是 AUTO-MAS 依赖的。加字段可以;改含义、删字段要把 `internal/buildinfo` 里的 `Protocol` 加一,先开 issue。 -脚本要用实例的端口时,从 `list` / `info` 的 `ports`、`serial` 取,不要自己按 20000 + 10 × 编号算:设了 `portBase` 的根目录不在 20000 段上。 +脚本要用实例的端口时,从 `list` / `info` / `status` 的 `ports`、`serial` 取,不要自己按 20000 + 10 × 编号算:设了 `portBase` 的根目录不在 20000 段上。`list` 的 `port_base` 是根目录实际用的端口段,旧版管理器没有这一项(只用 20000 段)。 ## 版本 diff --git a/docs/en/develop/manager.md b/docs/en/develop/manager.md index 49ac59d..7ccd6a9 100644 --- a/docs/en/develop/manager.md +++ b/docs/en/develop/manager.md @@ -39,7 +39,7 @@ It uses `-trimpath -buildvcs=false` and does not write the version number with ` - Some tests run AUTO-MAS's original logic with Python 3 and compare it with Go's output byte by byte, so Python 3 must be installed; - Testing on a real instance needs a ModAVD root folder: extract the release package, then fetch the Google components; - Use newly created instances and a private adb port for these tests; -- Give root folders for development and testing their own port range: when the same computer also has a root folder in daily use (for example the one AUTO-MAS uses), write `"portBase": 21000` in the `mas-avd.json` of the development root folder. Its instances then count their ports from 21000 and do not fight with the instances of the same number over there. This needs a manager with [ModAVDManager#20](https://github.com/ModAVD/ModAVDManager/issues/20). +- Give root folders for development and testing their own port range: when the same computer also has a root folder in daily use (for example the one AUTO-MAS uses), write `"portBase": 21000` in the `mas-avd.json` of the development root folder. Its instances then count their ports from 21000 and do not fight with the instances of the same number over there. This needs a manager with [ModAVD/ModAVD#75](https://github.com/ModAVD/ModAVD/issues/75). - Ports: console = `portBase` + 10 × index, adb is 1 more, gRPC 2 more; the index is still 0–9 without 5. `portBase` can only be 20000 (the default) or a multiple of 100 between 1100 and 65400. With two development root folders open at the same time, give the second another range, for example 23000. Before you pick one, check that no other program uses that range (Syncthing, for example, takes 22000 by default). - Also set `adbServerPort` and `scriptAdbServerPort`. They cannot be 20049 or 20050, nor fall on the ports of an instance in the 20000 range; otherwise the manager does not start the instance. - Shut down every instance of the root folder before you change it. AUTO-MAS does not know `portBase` yet, so do not add a root folder that sets it to AUTO-MAS. @@ -51,7 +51,7 @@ CI runs the format check, `go vet`, `go test`, `build.ps1`, the privacy scan and The envelope of the `--json` output, the error codes and the `protocol` version are what AUTO-MAS depends on. Adding fields is fine. To change a meaning or remove a field, add one to `Protocol` in `internal/buildinfo` and open an issue first. -When a script needs the ports of an instance, take them from `ports` and `serial` in `list` / `info` instead of computing 20000 + 10 × index: a root folder that sets `portBase` is not in the 20000 range. +When a script needs the ports of an instance, take them from `ports` and `serial` in `list` / `info` / `status` instead of computing 20000 + 10 × index: a root folder that sets `portBase` is not in the 20000 range. `port_base` in `list` is the port range the root folder actually uses; older managers do not have it (they only use the 20000 range). ## Versioning From 7b05118bb38289c743128e18f80bec30c3ef09eb Mon Sep 17 00:00:00 2001 From: qiyinxi Date: Tue, 3 Nov 2026 18:57:35 +0100 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B2=A1=E9=85=8D=20server=20=E7=AB=AF?= =?UTF-8?q?=E5=8F=A3=E6=97=B6=EF=BC=8C=E7=AE=A1=E7=90=86=E5=99=A8=E4=B9=9F?= =?UTF-8?q?=E4=B8=8D=E6=96=B0=E5=BB=BA=E3=80=81=E4=B8=8D=E8=B5=B7=E6=88=96?= =?UTF-8?q?=E8=BF=9E=20adb=20server=EF=BC=88ModAVDManager#39=20=E5=AE=A1?= =?UTF-8?q?=E6=9F=A5=E5=90=8E=E8=A1=A5=E7=9A=84=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/develop/manager.md | 2 +- docs/en/develop/manager.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/develop/manager.md b/docs/develop/manager.md index 7f16d96..dffbf2e 100644 --- a/docs/develop/manager.md +++ b/docs/develop/manager.md @@ -41,7 +41,7 @@ pwsh -NoProfile -File build.ps1 -Test # 先跑 go vet 和 go test - 实测用新建的实例、私有 adb 端口; - 开发、测试用的根目录换一段端口:同一台电脑上还有日常在用的根目录(比如 AUTO-MAS 用的那个)时,在开发根目录的 `mas-avd.json` 里写 `"portBase": 21000`,这个根目录的实例就从 21000 起算端口,不和那边同编号的实例抢。要带 [ModAVD/ModAVD#75](https://github.com/ModAVD/ModAVD/issues/75) 的管理器。 - 端口:控制台 = `portBase` + 10 × 编号,adb 加 1,gRPC 加 2;编号还是 0–9,不含 5。`portBase` 只能是 20000(缺省),或者 1100–65400 之间 100 的整数倍;同时开两个开发根目录,第二个换一段,比如 23000。选之前先看一眼这一段有没有别的程序在用(比如 Syncthing 默认占着 22000)。 - - `adbServerPort`、`scriptAdbServerPort` 也要配,不能是 20049、20050,也不能落在 20000 段实例的端口上,否则管理器不开机。 + - `adbServerPort`、`scriptAdbServerPort` 也要配,不能是 20049、20050,也不能落在 20000 段实例的端口上。否则管理器不开机、不新建,也不去起或连 adb server。 - 改之前先关掉这个根目录的所有实例。AUTO-MAS 还不认 `portBase`,设了的根目录不要加进 AUTO-MAS。 - 不要对放着重要实例的根目录开实机测试开关(`MODAVD_TEST_LIVE=1`)。 diff --git a/docs/en/develop/manager.md b/docs/en/develop/manager.md index 7ccd6a9..03acd6f 100644 --- a/docs/en/develop/manager.md +++ b/docs/en/develop/manager.md @@ -41,7 +41,7 @@ It uses `-trimpath -buildvcs=false` and does not write the version number with ` - Use newly created instances and a private adb port for these tests; - Give root folders for development and testing their own port range: when the same computer also has a root folder in daily use (for example the one AUTO-MAS uses), write `"portBase": 21000` in the `mas-avd.json` of the development root folder. Its instances then count their ports from 21000 and do not fight with the instances of the same number over there. This needs a manager with [ModAVD/ModAVD#75](https://github.com/ModAVD/ModAVD/issues/75). - Ports: console = `portBase` + 10 × index, adb is 1 more, gRPC 2 more; the index is still 0–9 without 5. `portBase` can only be 20000 (the default) or a multiple of 100 between 1100 and 65400. With two development root folders open at the same time, give the second another range, for example 23000. Before you pick one, check that no other program uses that range (Syncthing, for example, takes 22000 by default). - - Also set `adbServerPort` and `scriptAdbServerPort`. They cannot be 20049 or 20050, nor fall on the ports of an instance in the 20000 range; otherwise the manager does not start the instance. + - Also set `adbServerPort` and `scriptAdbServerPort`. They cannot be 20049 or 20050, nor fall on the ports of an instance in the 20000 range. Otherwise the manager does not start or create instances, and does not start or connect to an adb server. - Shut down every instance of the root folder before you change it. AUTO-MAS does not know `portBase` yet, so do not add a root folder that sets it to AUTO-MAS. - Do not turn on the live-test switch (`MODAVD_TEST_LIVE=1`) against a root folder that holds important instances.