diff --git a/.gitignore b/.gitignore index 31b4aad..ef32bdb 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..e2e3bd5 --- /dev/null +++ b/BUILD.bazel @@ -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"], +) diff --git a/Readme.md b/Readme.md index d2b7894..4d26a5b 100644 --- a/Readme.md +++ b/Readme.md @@ -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 ``` \ No newline at end of file diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..e510b46 --- /dev/null +++ b/WORKSPACE @@ -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", +)