{"id":19858625,"url":"https://github.com/ilevd/compile-time","last_synced_at":"2025-10-04T14:13:35.498Z","repository":{"id":78840354,"uuid":"491839041","full_name":"ilevd/compile-time","owner":"ilevd","description":"Run Clojure function or forms in compile time","archived":false,"fork":false,"pushed_at":"2022-05-14T05:44:26.000Z","size":13,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T19:42:20.503Z","etag":null,"topics":["clojrue","eval","macros"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ilevd.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-05-13T09:35:20.000Z","updated_at":"2024-10-29T18:37:26.000Z","dependencies_parsed_at":"2023-04-28T06:44:45.117Z","dependency_job_id":null,"html_url":"https://github.com/ilevd/compile-time","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/ilevd%2Fcompile-time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilevd%2Fcompile-time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilevd%2Fcompile-time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilevd%2Fcompile-time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilevd","download_url":"https://codeload.github.com/ilevd/compile-time/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251779201,"owners_count":21642517,"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":["clojrue","eval","macros"],"created_at":"2024-11-12T14:24:09.674Z","updated_at":"2025-10-04T14:13:30.475Z","avatar_url":"https://github.com/ilevd.png","language":"Clojure","readme":"# compile-time\n\nA Clojure library designed to run your Clojure code at compile time.\n\n## Rationale\n\nSometimes you need to run some code in compile time, for example to load some data, or read last GIT commit info.\nExactly for this purpose this library was designed.\n\n## Installation \n\n[![Clojars Project](https://img.shields.io/clojars/v/org.clojars.ilevd/compile-time.svg)](https://clojars.org/org.clojars.ilevd/compile-time)\n\n## Usage\n\nRequire lib and use `run` or `run-fn` macros:\n\n```Clojure\n(ns my-app.core\n  (:require [compile-time.core :ad ct]))\n\n(def data (ct/run\n            (println \"Run in compile time\")\n            (+ 10 20)))\n\n;; so it will expand to (def data 30) when the app will run\n```\n\n### API\n\n#### run\n\n`(compile-time.core/run [\u0026 forms])`\n\nPass body to `run` macros. All forms will be evaluated and the result of evaluating the last form will be returned.\n\n\n#### run-fn\n\n`(compile-time.core/run-fn [f \u0026 args])`\n\nIf you need to evaluate just one function, you may use `run-fn`.\n\n### Real example\n\nSuppose you need to get last GIT commit info from your project repository at compile time:\n\n```Clojure\n(ns my-app.core\n  (:require [clj-jgit.porcelain :as git]\n            [compile-time.core :ad ct]))\n\n(defn current-commit\n  \"Get GIT commit info\"\n  []\n  (let [repo        (git/load-repo (.getAbsolutePath (clojure.java.io/file \"\")))\n        commit-data (first (git/git-log repo :max-count 1))]\n    {:commit {:id     (.getName (:id commit-data))\n              :date   (-\u003e commit-data :committer :date)\n              :author (-\u003e commit-data :committer :name)\n              :msg    (:msg commit-data)}}))\n\n(def commit-info (ct/run (current-commit)))\n\n:; or with run-fn\n(def commit-info (ct/run-fn current-commit))\n```\n\n\n## License\n\nilevd © 2022","funding_links":[],"categories":["Clojure"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filevd%2Fcompile-time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filevd%2Fcompile-time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filevd%2Fcompile-time/lists"}