{"id":16318614,"url":"https://github.com/vic/mill-buildr","last_synced_at":"2025-04-09T18:43:39.321Z","repository":{"id":66386324,"uuid":"531735998","full_name":"vic/mill-buildr","owner":"vic","description":"An small Mill module that lets you define big project structures as a regular scala project itself.","archived":false,"fork":false,"pushed_at":"2022-09-02T03:08:16.000Z","size":14,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-15T11:26:59.650Z","etag":null,"topics":["mill","mill-module","scala"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-09-02T01:05:01.000Z","updated_at":"2023-02-10T11:14:14.000Z","dependencies_parsed_at":"2023-12-06T06:00:19.647Z","dependency_job_id":null,"html_url":"https://github.com/vic/mill-buildr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vic%2Fmill-buildr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vic%2Fmill-buildr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vic%2Fmill-buildr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vic%2Fmill-buildr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vic","download_url":"https://codeload.github.com/vic/mill-buildr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248090525,"owners_count":21046107,"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","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":["mill","mill-module","scala"],"created_at":"2024-10-10T22:24:06.898Z","updated_at":"2025-04-09T18:43:39.301Z","avatar_url":"https://github.com/vic.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Mill](https://github.com/com-lihaoyi/mill) buildr module.\n\nAn [small mill module](https://github.com/vic/mill-buildr/blob/main/BuildrModule.sc) that lets you define \nbig project structures as a regular scala project itself.\n\nForget about large `build.sc` files or magic-importing lots of different `.sc` files, \nand use a normal `.scala` project you and your favorite IDE can understand and navigate easily.\n\n## Build History\n\n[![Build history](https://buildstats.info/github/chart/vic/mill-buildr?branch=main)](https://github.com/vic/mill-buildr/actions)\n\n## Motivation\n\nSplitting large `build.sc` files into different re-usable modules should be easy, and IDE navigation and code-completion should just work\nas with any other regular scala project.\n\n\n\u003cdetails\u003e\n\n\n\nOne of the cool things about Mill is that its build definitions are loaded from ammonite-magic-infused `build.sc` file.\n\nHowever when projects innevitably grow big you might find the need to split that huge `build.sc` of yours into smaller `.sc` files.\n\nPerhaps some `.sc` files for shared settings (eg, versions/ivyDeps/mvnRepos, scalac-options, common tasks, reusable mill-modules) \nand maybe others for the many components that make your big project (eg, models, daos, service-ifaces, web-server, etc).\n\n\nHowever some IDEs/editors have difficulties finding code references between `.sc` files and not providing code-completion can\nhurt developer experience specially for those who still need the IDE to help with completions and moving around files.\n\n\nThis tiny project was a hack we found thanks to ammonite magic imports that allowed us to split the build definition into a\nscala project on its own right. So that anyone who knows a little of scala can edit the project definition comfortably from their IDE.\n\n\n\u003c/details\u003e\n\n## Usage\n\nAll you need from this repo is a single file: `BuildrModule.sc`. \nYou can either [`download it`](https://raw.githubusercontent.com/vic/mill-buildr/main/BuildrModule.sc) alongside your\n`build.sc` file. \nOr choose to import it directly from github - if doing so, please ensure to reference it on a particular commit -.\n\nThen, define a `buildr` project where all your project modules will live as `.scala` files.\nAnd finally load the `buildr` runtime so you can define top-level objects in mill.\n\n\nThe following is annotated example, you might remove all comments once you are up and running.\n\n\u003c!-- Keep updated with the raw contents of build.sc from this repo. --\u003e\n```scala\n// This is build.sc file.\n\n// 1) If you downloaded `BuildrModule.sc` locally:\nimport $file.{BuildrModule =\u003e bm}\n\n// 1) If loading from github, be sure to reference a commit instead of main branch:\n// import $url.{`https://raw.githubusercontent.com/vic/mill-buildr/main/BuildrModule.sc` =\u003e bm}\n\n// 2) Define a mill module as usual, in this example `buildr/src/*.scala`\nobject buildr extends bm.BuildrModule {\n   // customize as any other ScalaModule, define custom coursierRepos, add ivyDeps, etc.\n}\n\n// 3) Finally compile and load your build definition into the mill runtime.\nbuildr.loadRuntime(build) // `build` here is the root-module since this file is named `build.sc`\n\n@ // This ammonite marker is *very important* as it separate compilation units.\n\n// All set. Now you can import your compiled mill-modules and\n// (for this example see code at `buildr/src/buildr/ProjectOne.scala`)\nimport _root_.buildr.{ProjectOne, ProjectTwo, ProjectThree}\n\n// That's it. All your `build.sc` file does is define the top level objects.\nobject one extends ProjectOne\nobject two extends ProjectTwo\nobject three extends ProjectThree\n```\n\nSee the full example on this repository's `build.sc` file. Try running `mill '__.{one,two}'`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvic%2Fmill-buildr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvic%2Fmill-buildr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvic%2Fmill-buildr/lists"}