Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: rewrite build tool in Go #2401

Closed
bassosimone opened this issue Jan 25, 2023 · 1 comment
Closed

cli: rewrite build tool in Go #2401

bassosimone opened this issue Jan 25, 2023 · 1 comment
Assignees
Labels
enhancement improving existing code or new feature interrupt ooni/probe-cli ooni/probe-engine priority/high refactoring techdebt This issue describes technical debt

Comments

@bassosimone
Copy link
Contributor

I am not satisfied by how we ensure that we're using the correct flags in ooni/probe-cli#1024. It turns out properly testing shell scripts and Makefile is painful. If the build tool was written in Go, instead, we could ~easily write unit and integration tests to make sure we're using the expected procedure for building. This would allow us to move fast(er).

@bassosimone bassosimone added enhancement improving existing code or new feature priority/high ooni/probe-cli refactoring ooni/probe-engine techdebt This issue describes technical debt labels Jan 25, 2023
@bassosimone bassosimone self-assigned this Jan 25, 2023
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
Recent changes in #1042 made `shellx` better in terms of pretending we're running commands in tests. However, the work done there is not enough for ooni/probe#2401. It turns out I also need a mechanism to incrementally construct commands. So, while keeping unchanged the external `shellx` API used by existing packages, let's try to use a better underlying API that meets these new needs.

While there, re-read Go 1.19 release notes and realize that I want to keep using `x/sys/execabs` everywhere. See the informative comment in the diff below explaining why I want to do that.
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
These functions are syntactic sugar to wrote runtimex.PanicOnError
code more compactly. This change is made possible by generics.

Part of ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
These functions are syntactic sugar to wrote runtimex.PanicOnError
code more compactly. This change is made possible by generics.

Part of ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
A "must" function is a function that either succeeds or panics. We need
this kind of functions when writing programs for which it's acceptable to
panic in case there is an error (i.e., everything but ooniprobe and the
oohelperd daemon).

Part of ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
A "must" function is a function that either succeeds or panics. We need
this kind of functions when writing programs for which it's acceptable to
panic in case there is an error (i.e., everything but ooniprobe and the
oohelperd daemon).

Part of ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
This diff rewrites Darwin build rules in Go. See ooni/probe#2401.
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
This diff rewrites Windows build rules in Go.

See ooni/probe#2401.
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
This diff rewrites Windows build rules in Go.

See ooni/probe#2401.
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
This diff rewrites the generic build rules in Go.

See ooni/probe#2401.
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
This diff rewrites the generic build rules in Go.

See ooni/probe#2401.
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
This diff rewrites Linux build rules in Go.

See ooni/probe#2401.
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 25, 2023
This diff introduces a mechanism to compile and embed tor. We plan on using this functionality on Android and iOS but we have not finished working on updating the build yet. In the meanwhile, here's an interim result. We're committing the code to run unit and integration testing of this new functionality on linux/amd64.

The reference issue is ooni/probe#2365. 

The Go based build was sketched out in ooni/probe#2401.
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
While there, cleanup unneeded scripts now that the build procedure is mostly written in Go.

See ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
It was a bit of annoying two have two structs to represent
build dependencies when just one of them is good enough.

Part of ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
It was a bit of annoying two have two structs to represent
build dependencies when just one of them is good enough.

Part of ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
At the end of the day, there's just a unique kind of build env
that makes sense for both cdeps and android.

While there, write better code for merging global and local
environment and make sure we have unit tests for that.

See ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
At the end of the day, there's just a unique kind of build env
that makes sense for both cdeps and android.

While there, write better code for merging global and local
environment and make sure we have unit tests for that.

See ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
I know this is a bit weird in the Go convention but using
this naming helps me to read the code in this case.

See ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
refactor(buildtool): use naming reminding to bash variables

I know this is a bit weird in the Go convention but using
this naming helps me to read the code in this case.

See ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
This diff continues refactoring how we set environment variables
to approximate what we were doing in bash scripts.

See ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
This diff continues refactoring how we set environment variables to approximate what we were doing in bash in #1024.

See ooni/probe#2401
bassosimone added a commit to ooni/probe-cli that referenced this issue Jan 26, 2023
This diff introduces the necessary changes for building tor and its dependencies using the Go builder. The reference issues are ooni/probe#2401 and ooni/probe#2365. A previous PR that used bash was #1024.

BTW, here's my sarcastic comment about doing this work in Go:

![cc07af6c-f63f-494c-a6df-02c1d12eab79_text](https://user-images.githubusercontent.com/337298/214907109-09a1264a-edc6-4b51-9114-8f405b9a3fb7.gif)

Ah, also: it was wrong of me to use `ANDROID_NDK_HOME` and I should have used `ANDROID_NDK_ROOT`. This pull request is a good moment in time to fix this blunder. While there, zap a README I should have zapped before. We keep them for top-level directories but not for nested directories, in general.
@bassosimone
Copy link
Contributor Author

All done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improving existing code or new feature interrupt ooni/probe-cli ooni/probe-engine priority/high refactoring techdebt This issue describes technical debt
Projects
None yet
Development

No branches or pull requests

1 participant