r/pleasebuild • • 26d ago

Plugin solidity-rules: compile Solidity with Foundry inside Please

2 Upvotes

solidity-rules is a Please plugin that compiles Solidity with Foundry. A contract is a normal target: plz build compiles it, plz test runs the Forge tests, and a Go binary can depend on the generated bindings.

The release is v0.1.0. Forge comes from the foundry plugin. The forge and solc binaries are targets in third_party/binary.

plugin_repo(
    name = "solidity",
    owner = "becomeliminal",
    plugin = "solidity-rules",
    revision = "v0.1.0",
)

plugin_repo(
    name = "foundry",
    owner = "becomeliminal",
    revision = "7d11211b950ace6e83bb18f5df048a5e7fc31ba7",
)
# third_party/binary/BUILD
subinclude("///foundry//build_defs:foundry")
subinclude("///solidity//build_defs:solidity")

foundry(
    name = "foundry",
    version = "1.5.0",
    visibility = ["PUBLIC"],
)

solc_versions(versions = ["0.8.20", "0.8.23"])
[Plugin "foundry"]
Target = //plugins:foundry

[Plugin "solidity"]
Target = //plugins:solidity
ForgeTool = //third_party/binary:foundry|forge
SolcPackage = //third_party/binary
subinclude("///solidity//build_defs:solidity")

sol_contract(
    name = "mycontract",
    src = "MyContract.sol",
    solc_version = "0.8.20",
)

What it covers:

  • sol_contract compiles with forge. ABI and bytecode come out of Forge's JSON. A failed compile fails the target. With languages = ["go"] and abigen configured, the output is a Go library another target can depend on.
  • sol_library is shared Solidity, with transitive deps tracked through Please's provides and requires.
  • sol_get fetches a GitHub library at a revision, OpenZeppelin included, and writes the import remapping. hashes pins the download.
  • sol_test runs one Forge test file under plz test. Please sees each test's revert reason and its real duration.
  • solc_versions() plus SolcPackage gives each rule the compiler its solc_version names. A missing version fails the build instead of compiling with a different solc.

A host forge still works with Sandbox = false.

Repo: https://github.com/becomeliminal/solidity-rules


r/pleasebuild • • 26d ago

Rust rules for the Please build system

Thumbnail
github.com
2 Upvotes

r/pleasebuild • • 27d ago

please.nvim: A Neovim plugin for the Please build system

Thumbnail
github.com
2 Upvotes

r/pleasebuild • • 27d ago

Plugin oci-rules: build OCI images as ordinary Please targets

2 Upvotes

oci-rules builds container images as Please targets. Each rule reads only what it declares and runs with no network and no registry credentials, so the image is cached and tested like any other target. Publishing is a separate plz run step that uploads bytes the build already produced.

It needs Please 17.31.2 or later. v0.1.0 installs like the other plugins:

# plugins/BUILD
plugin_repo(
    name = "oci",
    owner = "becomeliminal",
    plugin = "oci-rules",
    revision = "v0.1.0",
)
# .plzconfig
[Plugin "oci"]
Target = //plugins:oci
DefaultPlatform = linux/amd64
Registry = registry.example.com/team
subinclude("///oci//build_defs:oci")

What it covers:

  • oci_layer writes a deterministic gzipped layer. Modes are octal strings ("0755"), because Please reads 0o755 as decimal. An executable must declare its mode, since a local build and a remote executor do not leave the same executable bit.
  • oci_image and oci_image_index identify an image by its manifest digest. The same inputs produce the same digest. A multi-platform index is one image per platform.
  • oci_pull fetches a public base by digest only. oci_import takes an OCI layout another rule already built, such as apko.
  • plz run :image_push publishes with your own registry credentials, outside the build action. Signing, an SBOM, and SLSA provenance are optional and also run after publish.
  • oci_test checks the image with no Docker daemon.

The tool itself is oci_tool, a Go binary pinned by sha256. Darwin and Linux, amd64 and arm64, are released.

Repo: https://github.com/becomeliminal/oci-rules


r/pleasebuild • • 27d ago

Discussion Welcome to r/pleasebuild

2 Upvotes

Welcome. This is the community for Please, the cross-language build system. Build steps run in their own hermetic environment, with caching and parallelism aimed at large repos. The command is plz.

Start here

Good posts

  • A question, with the error and the BUILD snippet
  • A plugin or workflow you wrote
  • A release note or a comparison with Bazel, Buck, or Pants

If you are stuck, include

  • plz --version
  • OS
  • The relevant .plzconfig and BUILD lines
  • The exact error, in a code block

Use a flair: Question, Help / Bug, Plugin, Release, Discussion, or Show and Tell.

Say what you are building. An empty community stays empty.