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

feat: Use TOML for config #67

Merged
merged 15 commits into from
Feb 1, 2024
Merged

feat: Use TOML for config #67

merged 15 commits into from
Feb 1, 2024

Conversation

oskarth
Copy link
Collaborator

@oskarth oskarth commented Jan 31, 2024

This PR starts to introduce a more robust way of configuring relevant build options and environment.

Currently there's a big surface area for options, and we still have some hardcoded leftovers. This means we currently have to do things like this: https://github.com/oskarth/mopro/pull/66/files/8e7d9dafaf0538ab84d739ec8a9f42437772df1a#diff-10095d80195138814b66f1d6f5b769b0763cd537d9ef563a28c6d75444a151d5 which makes things very confusing, especially when we have dealing with multiple circuits.

Big idea

Specify options in a toml file:

# config-example.toml

[build]
device_type = "simulator" # Options: x86_64, simulator, device
build_mode = "release"    # Options: debug, release

[circuit]
dir = "examples/circom/keccak256" # Directory of the circuit
name = "keccak256_256_test"       # Name of the circuit

[dylib]
use_dylib = false        # Options: true, false
name = "keccak256.dylib" # Name of the dylib file, only used if use_dylib is true

Then call this with build scripts like so:

./scripts/build_ios.sh config-example.toml

It is then easy to introduce multiple configs (e.g. for Anon-Aadhaar), to debug etc.

TOML config is also a good way to prepare for Rust API. I made it work for shell scripts too since that's the current base.

TODO before merge

  • Sanity check of initial API (feedback welcome)
  • Get rid of hardcoded stuff in build.rs and use TOML config instead
  • Update Android script
  • Make sure CI passes
  • Update README

@oskarth oskarth requested a review from vivianjeng January 31, 2024 12:48
@oskarth
Copy link
Collaborator Author

oskarth commented Jan 31, 2024

Later on we can also add arrays to build for multiple platforms etc... starting simple though and just replacing existing positional argument and hardcoded stuff.

@oskarth oskarth changed the title Use TOML Config (WIP) feat: Use TOML for config Feb 1, 2024
@oskarth oskarth merged commit d4fc579 into main Feb 1, 2024
2 of 6 checks passed
@oskarth oskarth deleted the feat/toml-config branch March 7, 2024 04:34
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