Skip to content

Strip Go bindings, keep lib-only cronet build pipeline#1

Merged
Itsusinn merged 4 commits into
mirrorfrom
lib-only
Jun 9, 2026
Merged

Strip Go bindings, keep lib-only cronet build pipeline#1
Itsusinn merged 4 commits into
mirrorfrom
lib-only

Conversation

@Itsusinn

@Itsusinn Itsusinn commented Jun 9, 2026

Copy link
Copy Markdown
Member

What

Reduce the repo to a C library build pipeline only — produce
libcronet.{a,so,dll} + headers, with no Go bindings.

Why

Downstream only needs the compiled cronet static/dynamic libraries; the Go
binding layer and its tests/tooling were unrelated weight.

Changes

Removed (~120 files):

  • All root *.go cronet bindings (engine / buffer / naive_* / url_request_* /
    net_error …, incl. include_cgo.go)
  • internal/cronet/ (purego dynamic-loading bindings)
  • test/ (Go integration tests, separate module)
  • .golangci.yml
  • Binding-related build subcommands: sync, extract-lib, publish,
    generate-net-errors

Kept — the build pipeline:

  • cmd/build-naive: build / package / download-toolchain / env
    (only depends on spf13/cobra)
  • naiveproxy/ submodule (Chromium src + get-clang.sh + gn/ninja)

Reworked:

  • package now only copies .a/.so/.dll to lib/<target>/ + headers to
    include/, and dumps link_flags.txt (system libs/frameworks needed to link
    the static lib). All cgo/purego/submodule Go glue generation removed; --local
    flag dropped.
  • go.mod trimmed to spf13/cobra only.
  • Makefile / README.md updated for the lib-only layout.
  • CI (naive-build.yml): dropped all Go test / integration-test / module-publish
    steps; triggers on lib-only; release-libs collects .so/.a/.dll and
    publishes the latest release.

Notes for reviewer

  • Could not run go build / go mod tidy locally (no Go toolchain on the dev
    machine); CI exercises go run ./cmd/build-naive on every platform.
  • go.sum is currently a harmless superset (still has hashes for removed
    deps); a go mod tidy will prune it.
  • Usage unchanged: go run ./cmd/build-naive build && ... package (or make).

🤖 Generated with Claude Code

Itsusinn and others added 4 commits June 9, 2026 13:05
Remove all Go binding code (root *.go, internal/cronet, test/) and the
binding-related build subcommands (sync, extract-lib, publish,
generate-net-errors). Keep only the C library build pipeline:

- cmd/build-naive: build / package / download-toolchain / env
- package now just copies .a/.so/.dll + headers and dumps link_flags.txt
  (no more cgo/purego/submodule glue generation)
- go.mod trimmed to spf13/cobra only
- Makefile/README updated for lib-only layout
- CI: drop Go test/integration/publish steps; trigger on lib-only;
  release-libs publishes libs on lib-only push too

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Drop the Go dependency entirely: building the cronet libraries no longer
requires a Go toolchain.

- scripts/build-naive.sh: faithful bash port of the former cmd/build-naive
  (target resolution, gn args, openwrt/musl + sysroot/clang mappings,
  get-clang driving, ninja targets, link-flag extraction, env). bash 3.2
  compatible (macOS runners ship 3.2).
- justfile: recipes (build/compile/package/apple/download-toolchain/env)
  driving the script; just is the orchestration entry point.
- Remove cmd/, go.mod, go.sum.
- CI: replace setup-go with taiki-e/install-action (just); call
  `just compile` / `just package`; cache key now hashes build-naive.sh.
- README updated for the just/bash workflow.

Pure logic (resolution, naming, sysroot/clang, env, gn args, link-flag
parsing) verified locally against the previous Go behavior; gn/ninja
execution and just-on-runners validated by CI.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Port the bash orchestrator to scripts/build-naive.rs, a std-only cargo
script run via `cargo -Zscript`. just remains the entry point.

Why: the bash version failed on Windows because spawning gn.exe from MSYS
bash path-mangled the gn arguments, and `command -v sccache` returned a
POSIX path. The Rust binary is native (windows-msvc) and spawns gn.exe via
std::process::Command, so — like the original Go tool — there is no MSYS
mangling and cc_wrapper gets a real C:\ path.

- scripts/build-naive.rs: faithful port (target resolution, gn args,
  openwrt/musl + sysroot/clang mappings, get-clang, ninja targets,
  link-flag extraction, env). Adds a `print-config` debug subcommand.
- justfile: recipes call `cargo +nightly -Zscript`; bash shell on all
  platforms (the cmd.exe shell mangled quotes; bash does not, and never
  touches the gn args since the script spawns gn natively).
- CI: add dtolnay/rust-toolchain@nightly; cache key hashes build-naive.rs;
  drop the now-unneeded `shell: bash` on the Windows build/package steps.
- Remove scripts/build-naive.sh; README updated.

Verified locally against the prior behavior: clean compile, and identical
gn args / env output / config for linux (incl. mips no-pie+execstack),
android, ios/tvos, darwin, windows, and musl targets.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
On GitHub's Windows runners a bare `bash` resolves to
C:\Windows\System32\bash.exe (WSL), which has no distro installed, so
get-clang.sh failed instantly with "Windows Subsystem for Linux has no
installed distributions". Resolve Git's bash explicitly instead.

All non-Windows jobs (linux, linux-musl, darwin/iOS/tvOS) already passed
on the cargo-script port; this was the only Windows-specific failure.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Itsusinn
Itsusinn merged commit 3be6ce9 into mirror Jun 9, 2026
58 checks passed
@Itsusinn
Itsusinn deleted the lib-only branch June 9, 2026 07:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant