{"id":33261785,"url":"https://github.com/xie-dongping/sml_rules","last_synced_at":"2025-11-21T22:01:06.934Z","repository":{"id":166978044,"uuid":"642514475","full_name":"xie-dongping/sml_rules","owner":"xie-dongping","description":"Bazel SML rules provide the necessary rules to build and test SML (Standard ML) applications using Bazel.","archived":false,"fork":false,"pushed_at":"2023-05-20T01:43:33.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-15T01:38:22.145Z","etag":null,"topics":["bazel","bazel-rules","build-tool","purely-functional-data-structures","standard-ml","starlark"],"latest_commit_sha":null,"homepage":"","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xie-dongping.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-18T18:37:43.000Z","updated_at":"2024-05-30T06:29:04.058Z","dependencies_parsed_at":"2023-07-02T13:15:41.695Z","dependency_job_id":null,"html_url":"https://github.com/xie-dongping/sml_rules","commit_stats":null,"previous_names":["xie-dongping/sml_rules"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/xie-dongping/sml_rules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xie-dongping%2Fsml_rules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xie-dongping%2Fsml_rules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xie-dongping%2Fsml_rules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xie-dongping%2Fsml_rules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xie-dongping","download_url":"https://codeload.github.com/xie-dongping/sml_rules/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xie-dongping%2Fsml_rules/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285697828,"owners_count":27216628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-21T02:00:06.175Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","bazel-rules","build-tool","purely-functional-data-structures","standard-ml","starlark"],"created_at":"2025-11-17T04:00:32.049Z","updated_at":"2025-11-21T22:01:06.923Z","avatar_url":"https://github.com/xie-dongping.png","language":"Starlark","funding_links":[],"categories":["Third-party libraries"],"sub_categories":[],"readme":"Bazel SML Rules\n===============\n\n[Bazel](https://bazel.build/) SML rules provide the necessary rules to build and test SML (Standard ML) applications using Bazel.\n\n## Introduction\n\nBazel SML rules are a set of rules for the Bazel build system that allow you to compile and test SML (Standard ML) code. The `sml` files are concatenated together and built by the [MLton compiler](https://github.com/MLton/mlton).\n\nCurrently, the rules include `sml_library`, `sml_cc_src`, `sml_binary`, and `sml_test`:\n\n* `sml_library`: This rule takes a list of `.sml` files as input and produces an SML library as output. The library can be used as a dependency in other rules.\n* `sml_cc_src`: This rule transpiles SML code into C code using the MLton compiler.\n* `sml_binary`: This rule creates a binary executable from SML code. It is a thin wrapper of `cc_binary` combined with `sml_cc_src`.\n* `sml_test`: This rule is used for running tests written in SML. It is a thin wrapper of `cc_binary` combined with `sml_cc_src`.\n\nPlease refer to the source code for exact implementation.\n\n## Limitations\n\nThese rules are currently designed to work with the MLton compiler using its C code generation. The `sml` files are concatenated according to the dependencies defined in the build process, but I haven't tested it in large projects, so your mileage may vary.\n\n`MLton` may generate multiple C files from the Standard ML source code. The current default value is set at `20`, as `bazel` requires a static build graph. If it is not enough, error would be thrown and the user has to increase the limit by setting the `max_files` attribute of the rules.\n\nThese rules are built and tested for x64 Linux (my own computer). They may not work correctly on other operating systems or architectures.\n\nError handling and messaging may not be fully refined yet. Use at your own risk.\n\n## Disclaimer\n\nThis package is currently in an alpha stage and its usage is at the user's own risk.\n\nPlease note that I am developing this project for my own personal needs and for fun. Therefore, I cannot guarantee any specific features or provide any support beyond what I find personally useful. Please do not expect any additional contributions or updates from me.\n\n## Usage\n\nTo use these rules (provided that bazel/[bazelisk](https://github.com/bazelbuild/bazelisk/releases) is installed), include the following in your WORKSPACE file:\n\n```python\nload(\"@bazel_tools//tools/build_defs/repo:git.bzl\", \"git_repository\")\n\ngit_repository(\n    name = \"sml_rules\",\n    remote = \"https://github.com/xie-dongping/sml_rules.git\",\n    branch = \"main\", # don't specify the `branch`, use `commit` to ensure hermetic build\n    # commit = \"sha_hash\", # please use the `commit` field to pin a certain commit\n)\n\nload(\"@sml_rules//:rules.bzl\", \"sml_repository\")\nsml_repository()\n```\n\nAfter downloading the rules, you may load and use the rules.\n\n```python\n\nload(\"@sml_rules//:sml_rules.bzl\", \"sml_library\", \"sml_binary\", \"sml_test\")\n\nsml_library(\n    name = \"mylib\",\n    srcs = [\"mylib.sml\"],\n)\n\nsml_binary(\n    name = \"mybinary\",\n    srcs = [\"main.sml\"],\n    deps = [\":mylib\"],\n)\n\nsml_test(\n    name = \"mytest\",\n    srcs = [\"mylib.test.sml\"],\n    deps = [\":mylib\"],\n)\n```\n\nThen you may test your code with `bazel test ...` (to test all available test targets) or `bazel test //:mytest`.\n\n\nAn example is also available in `examples` folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxie-dongping%2Fsml_rules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxie-dongping%2Fsml_rules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxie-dongping%2Fsml_rules/lists"}