Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add bazel build #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 40 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,42 @@
# Ignore all delve binaries
**/debug
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig

# Ignore VSCode
.vscode/
# Created by https://www.gitignore.io/api/bazel,code,go
# Edit at https://www.gitignore.io/?templates=bazel,code,go

### Bazel ###
# gitignore template for Bazel build system
# website: https://bazel.build/

# Ignore all bazel-* symlinks. There is no full list since this can change
# based on the name of the directory bazel is cloned into.
/bazel-*

### Code ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### Go ###
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

### Go Patch ###
/vendor/
/Godeps/

# End of https://www.gitignore.io/api/bazel,code,go

# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

# Ignore Go binary
deepwork
32 changes: 32 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
load("@bazel_gazelle//:def.bzl", "gazelle")

gazelle(
name = "gazelle",
prefix = "github.com/simontheleg/deepwork",
)

go_library(
name = "go_default_library",
srcs = [
"applescriptHandler.go",
"donotdisturbHandler.go",
"main.go",
],
importpath = "github.com/simontheleg/deepwork",
visibility = ["//visibility:private"],
deps = ["@com_github_mitchellh_go_homedir//:go_default_library"],
)

go_binary(
name = "deepwork",
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)

go_test(
name = "go_default_test",
srcs = ["main_test.go"],
embed = [":go_default_library"],
deps = ["@com_github_mitchellh_go_homedir//:go_default_library"],
)
11 changes: 11 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,15 @@ Open up all communication apps again

```shell
deepwork off
```

## Develop

### Build with Bazel

To build with bazel simply run the following

```shell
bazel run //:gazelle -- update-repos -from_file=go.mod
bazel build //:deepwork
```
33 changes: 33 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# download go rules
http_archive(
name = "io_bazel_rules_go",
urls = ["https://github.com/bazelbuild/rules_go/releases/download/0.18.5/rules_go-0.18.5.tar.gz"],
sha256 = "a82a352bffae6bee4e95f68a8d80a70e87f42c4741e6a448bec11998fcc82329",
)

# download gazelle
http_archive(
name = "bazel_gazelle",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.17.0/bazel-gazelle-0.17.0.tar.gz"],
sha256 = "3c681998538231a2d24d0c07ed5a7658cb72bfb5fd4bf9911157c0e9ac6a2687",
)

# load go rules
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")

go_rules_dependencies()

go_register_toolchains()

# load gazelle
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

gazelle_dependencies()

go_repository(
name = "com_github_mitchellh_go_homedir",
importpath = "github.com/mitchellh/go-homedir",
tag = "v1.1.0",
)