# hotbuild
一个跨平台的热编译工具
通过监视项目目录文件的修改,将自动触发重新编译和运行。运行目录和监视目录可以不同。监视项目路径下所有递归子目录中的文件修改。
![hotbuild](https://github.com/wandercn/hotbuild/raw/master/logo.jpg "hotbuild")
# 项目网站
[hotbuild.ffactory.org](https://hotbuild.ffactory.org)
# 安装
go get -u github.com/wandercn/hotbuild@latest
# 初始化
```
wander$ cd $your_project_dir/
wander$ hotbuild initconf
2021/07/28 11:10:03 create config file: .hotbuild.toml
```
# 运行
```
wander$ cd $your_project_dir/
wander$ hotbuild run
_ _ ___ _____ ____ _ _ ___ _ ____
| | | |/ _ \_ _| | __ )| | | |_ _| | | _ \
| |_| | | | || | | _ \| | | || || | | | | |
| _ | |_| || | | |_) | |_| || || |___| |_| |
|_| |_|\___/ |_| |____/ \___/|___|_____|____/ v1.0.5, built with Go 1.16.5
.............................. ( Start rebuilding ) .................................
.............................. [ Build successfully ] ...............................
.............................. { Start running } ....................................
2021/07/06 09:56:26.913 [I] [asm_amd64.s:1371] http server Running on http://0.0.0.0:8080
2021/07/06 09:56:26.913 [I] [asm_amd64.s:1371] Admin server Running on :8088
```
# 自定义配置
初始化文件在 $your_project_dir/.hotbuild.toml,you 你可以自行修改配置。
```
wander$ cd $your_project_dir/
wander$ cat .hotbuild.toml
buildcmd = "go build -o ./tmp_bin"
excludedir = [".git", "tmp", "docs", "vendor"]
projectdir = "/Users/apple/workspace/src/example.com/"
runcmd = "./tmp_bin"
```
| | en | zh-cn |
|:----- |:----- |:----- |
|buildcmd | Compile command |编译命令 |
|excludedir | Exclude tracked folders |排除跟踪的文件夹 |
|projectdir | Project directory to track |需要跟踪的项目目录|
|runcmd | Run command |运行命令 |
# 问题排除
1. the "Too many open files" error of MacOSX
```
# maxfiles is 256 too small.
wander$ launchctl limit
cpu unlimited unlimited
filesize unlimited unlimited
data unlimited unlimited
stack 8388608 67104768
core 0 unlimited
rss unlimited unlimited
memlock unlimited unlimited
maxproc 2784 4176
maxfiles 256 10240
# change maxfiles to 4096.
wander$ sudo launchctl limit maxfiles 4096 unlimited
wander$ launchctl limit
cpu unlimited unlimited
filesize unlimited unlimited
data unlimited unlimited
stack 8388608 67104768
core 0 unlimited
rss unlimited unlimited
memlock unlimited unlimited
maxproc 2784 4176
maxfiles 4096 10240
```
# 作者留言
有兴趣的朋友可以试试,有问题可以提[Issues](https://github.com/wandercn/hotbuild/issues),觉得好用别忘了给我个
[Star](https://github.com/wandercn/hotbuild/stargazers)
更多评论
纯个人国产项目
想在brew.sh提交一个软件,发现还有关注度要求, * GitHub repository not notable enough (<30 forks, <30 watchers and <75 stars)
Error: 1 problem in 1 formula detected。
一个跨平台跟踪文件修改自动编译的工具,有空的可以试一下。觉得好的帮忙给 star forks watchers
https://hotbuild.ffactory.org
#2