Skip to content

Commit 73ff80e

Browse files
docs: fix stale tool names, broken code examples, and layout in README
1 parent 594daad commit 73ff80e

1 file changed

Lines changed: 45 additions & 36 deletions

File tree

README.md

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -511,18 +511,19 @@ The examples above cover specific subsystems, but the library supports **all** A
511511

512512
```bash
513513
# Find the proxy for a known AIDL interface
514-
grep -r 'DescriptorI.*= "android.os.IVibratorService"' android/
514+
grep -r 'DescriptorI.*= "android.hardware.vibrator.IVibrator"' android/
515515
```
516516

517517
3. **Connect and call methods:**
518518

519519
```go
520-
svc, err := sm.GetService(ctx, servicemanager.VibratorService)
520+
svc, err := sm.GetService(ctx, servicemanager.ServiceName(
521+
vibrator.DescriptorIVibrator+"/default"))
521522
if err != nil {
522523
log.Fatal(err)
523524
}
524-
proxy := genOs.NewVibratorServiceProxy(svc)
525-
result, err := proxy.SomeMethod(ctx, args...)
525+
proxy := vibrator.NewVibratorProxy(svc)
526+
caps, err := proxy.GetCapabilities(ctx)
526527
```
527528

528529
4. **For HAL services** (hardware abstraction layers), the service name is the AIDL descriptor plus `/default`:
@@ -1497,10 +1498,11 @@ See the full [bindercli reference](#bindercli) for all subcommands and more exam
14971498

14981499
| | Description |
14991500
| ----------------------------------------------------- | --------------------------------------------------------------------------------- |
1500-
| [`tools/cmd/aidlgen`](tools/cmd/aidlgen/) | AIDL-to-Go compiler: reads search paths + AIDL files, generates Go code |
1501-
| [`tools/cmd/aospgen`](tools/cmd/aospgen/) | Bulk generator: discovers all AIDL files in AOSP submodules, generates everything |
1502-
| [`tools/cmd/gen_e2e_smoke`](tools/cmd/gen_e2e_smoke/) | Generates smoke tests exercising every proxy type in generated packages |
1503-
| [`tools/cmd/genreadme`](tools/cmd/genreadme/) | Regenerates the package table in this README from generated packages |
1501+
| [`tools/cmd/aidl2spec`](tools/cmd/aidl2spec/) | AIDL-to-YAML spec compiler: parses AOSP AIDL files and emits spec files |
1502+
| [`tools/cmd/java2spec`](tools/cmd/java2spec/) | Extracts service maps and parcelable info from Java sources into specs |
1503+
| [`tools/cmd/spec2go`](tools/cmd/spec2go/) | Generates Go proxy code (and smoke tests) from YAML spec files |
1504+
| [`tools/cmd/spec2cli`](tools/cmd/spec2cli/) | Generates bindercli command registry from YAML spec files |
1505+
| [`tools/cmd/spec2readme`](tools/cmd/spec2readme/) | Regenerates the package table in this README from spec files |
15041506

15051507
## bindercli
15061508

@@ -2057,7 +2059,8 @@ func (p *ActivityManagerProxy) GetProcessLimit(ctx context.Context) (int32, erro
20572059
### From Individual AIDL Files
20582060

20592061
```bash
2060-
go run ./tools/cmd/aidlgen -I path/to/search/root -output . file1.aidl file2.aidl
2062+
# Compile AIDL files to Go via bindercli:
2063+
bindercli aidl compile -I path/to/search/root --output gen file1.aidl file2.aidl
20612064
```
20622065

20632066
### From AOSP (Bulk Generation)
@@ -2066,7 +2069,8 @@ With the AOSP submodules in `tools/pkg/3rdparty/`:
20662069

20672070
```bash
20682071
git submodule update --init --depth 1
2069-
go run ./tools/cmd/aospgen -3rdparty tools/pkg/3rdparty -output . -smoke-tests
2072+
go run ./tools/cmd/aidl2spec -3rdparty tools/pkg/3rdparty -output specs/
2073+
go run ./tools/cmd/spec2go -specs specs/ -output . -smoke-tests
20702074
```
20712075

20722076
This discovers all AIDL files across `frameworks-base`, `frameworks-native`, `hardware-interfaces`, and `system-hardware-interfaces`, infers search roots from package declarations, and generates Go proxies for all AOSP services. The current AOSP snapshot produces **5,151 Go files** across **407 packages**.
@@ -2097,7 +2101,7 @@ go test ./tools/pkg/... ./binder/ ./parcel/
20972101

20982102
These test:
20992103

2100-
- **Parser correctness**: Lexing/parsing of all AIDL constructs against [testdata](testdata/) fixtures (interfaces, parcelables, enums, unions, generics, constants, annotations)
2104+
- **Parser correctness**: Lexing/parsing of all AIDL constructs against [testdata](tools/pkg/parser/testdata/) fixtures (interfaces, parcelables, enums, unions, generics, constants, annotations)
21012105
- **Code generation**: Each generator (`GenerateInterface`, `GenerateParcelable`, `GenerateEnum`, `GenerateUnion`) is tested by parsing AIDL input, generating Go, and verifying the output is valid `gofmt`-compliant Go source that contains expected identifiers (descriptors, transaction codes, type names, method signatures)
21022106
- **Import cycle detection**: Verifies the SCC algorithm correctly identifies and breaks cross-package import cycles
21032107
- **Marshal/unmarshal naming**: Maps from AIDL types to parcel read/write expressions
@@ -2119,8 +2123,8 @@ Walks all ~11,000 AIDL files, parses each, generates Go code, and verifies the o
21192123
Auto-generated tests that instantiate every proxy type with a mock binder and call every method with zero-value arguments:
21202124

21212125
```bash
2122-
go run ./tools/gen_e2e_smoke
2123-
go test -tags e2e ./tests/e2e/... # requires /dev/binder OR mock mode
2126+
go run ./tools/cmd/spec2go -specs specs/ -output . -smoke-tests
2127+
go test ./tests/e2e/... # requires /dev/binder OR mock mode
21242128
```
21252129

21262130
### 4. End-to-End Tests on Android
@@ -2290,7 +2294,8 @@ and run commands programmatically:
22902294
```go
22912295
dr, _ := runner.NewDeviceRunner("SERIAL")
22922296
dr.PushBinary(ctx, "build/mybinary", "/data/local/tmp/mybinary")
2293-
output, _ := dr.Run(ctx, "/data/local/tmp/mybinary", "--flag")
2297+
result, _ := dr.Run(ctx, "/data/local/tmp/mybinary", 30*time.Second)
2298+
fmt.Println(result.Output)
22942299
```
22952300

22962301
For remote binder access from a host machine, `interop/gadb/proxy/`
@@ -2299,8 +2304,8 @@ sets up a forwarded session:
22992304
```go
23002305
sess, _ := proxy.NewSession(ctx, "SERIAL")
23012306
defer sess.Close(ctx)
2302-
sm := servicemanager.New(sess.Transport())
2303-
// Use sm as if running on-device
2307+
transport := sess.Transport() // *RemoteTransport
2308+
reply, _ := transport.Transact(ctx, descriptor, code, 0, data)
23042309
```
23052310

23062311
</details>
@@ -2330,27 +2335,28 @@ See the example app at [`examples/gomobile/`](examples/gomobile/).
23302335
.
23312336
├── tools/
23322337
│ ├── cmd/
2333-
│ │ ├── aidlgen/ AIDL-to-Go compiler CLI
2334-
│ │ ├── aospgen/ Bulk AOSP code generator
2335-
│ │ ├── gen_e2e_smoke/ Smoke test generator
2336-
│ │ ├── genbindercli/ bindercli command dispatcher generator
2337-
│ │ ├── genreadme/ README package table generator
2338-
│ │ └── genversions/ Compiled transaction code table generator (fallback tables)
2338+
│ │ ├── aidl2spec/ AIDL-to-YAML spec compiler
2339+
│ │ ├── java2spec/ Java source info extractor (service maps, parcelables)
2340+
│ │ ├── spec2go/ Go proxy code generator from specs
2341+
│ │ ├── spec2cli/ bindercli command registry generator from specs
2342+
│ │ └── spec2readme/ README package table generator from specs
23392343
│ └── pkg/
2340-
│ └── aidlc/ AIDL processing pipeline
2341-
│ ├── parser/ Lexer + recursive-descent AIDL parser
2342-
│ ├── resolver/ Import resolution and type registry
2343-
│ ├── codegen/ Go code generator
2344-
│ │ ├── codegen.go GenerateAll orchestration, validation, import graph
2345-
│ │ ├── interface_gen.go Interface → proxy struct + methods
2346-
│ │ ├── parcelable_gen.go Parcelable → struct + Marshal/Unmarshal
2347-
│ │ ├── enum_gen.go Enum → typed constants
2348-
│ │ ├── marshal.go AIDL type → parcel read/write expressions
2349-
│ │ └── import_graph.go SCC-based import cycle detection
2350-
│ ├── validate/ Semantic validation (types, directions, oneway)
2351-
│ ├── testutil/ Mock binder, reflection-based smoke testing
2352-
│ ├── e2e/ End-to-end tests (requires /dev/binder)
2353-
│ └── 3rdparty/ AOSP submodules (frameworks-base, frameworks-native, ...)
2344+
│ ├── parser/ Lexer + recursive-descent AIDL parser
2345+
│ ├── resolver/ Import resolution and type registry
2346+
│ ├── codegen/ Go code generator
2347+
│ │ ├── codegen.go GenerateAll orchestration, validation, import graph
2348+
│ │ ├── interface_gen.go Interface → proxy struct + methods
2349+
│ │ ├── parcelable_gen.go Parcelable → struct + Marshal/Unmarshal
2350+
│ │ ├── enum_gen.go Enum → typed constants
2351+
│ │ ├── marshal.go AIDL type → parcel read/write expressions
2352+
│ │ └── import_graph.go SCC-based import cycle detection
2353+
│ ├── spec/ YAML spec read/write
2354+
│ ├── javaparser/ Java source parser
2355+
│ ├── parcelspec/ Parcelable spec extraction
2356+
│ ├── servicemap/ Service name mapping
2357+
│ ├── validate/ Semantic validation (types, directions, oneway)
2358+
│ ├── testutil/ Mock binder, reflection-based smoke testing
2359+
│ └── 3rdparty/ AOSP submodules (frameworks-base, frameworks-native, ...)
23542360
├── binder/ Binder IPC abstractions
23552361
│ ├── ibinder.go IBinder interface
23562362
│ ├── proxy_binder.go Client-side proxy: Transact, IsAlive, LinkToDeath
@@ -2367,6 +2373,9 @@ See the example app at [`examples/gomobile/`](examples/gomobile/).
23672373
│ ├── hardware/ HAL interfaces
23682374
│ └── ... 407 packages total
23692375
├── com/ AOSP com.android.* service proxies
2376+
├── interop/ Interoperability helpers
2377+
│ ├── gadb/ Pure-Go ADB integration
2378+
│ └── gomobile/ Android AAR via gomobile
23702379
├── examples/ 106 runnable examples
23712380
└── .github/workflows/ CI configuration
23722381
```

0 commit comments

Comments
 (0)