Browse Source

Introduced fsnotify build tag to select watcher implementation

Signed-off-by: Nicolas De Loof <[email protected]>
Nicolas De Loof 3 weeks ago
parent
commit
e22426443e
3 changed files with 8 additions and 4 deletions
  1. 6 2
      Makefile
  2. 1 1
      pkg/watch/watcher_darwin.go
  3. 1 1
      pkg/watch/watcher_naive.go

+ 6 - 2
Makefile

@@ -29,6 +29,10 @@ ifeq ($(DETECTED_OS),Windows)
 	BINARY_EXT=.exe
 	BINARY_EXT=.exe
 endif
 endif
 
 
+ifeq ($(DETECTED_OS),Darwin)
+	GO_BUILDTAGS += fsnotify
+endif
+
 BUILD_FLAGS?=
 BUILD_FLAGS?=
 TEST_FLAGS?=
 TEST_FLAGS?=
 E2E_TEST?=
 E2E_TEST?=
@@ -62,11 +66,11 @@ build:
 
 
 .PHONY: binary
 .PHONY: binary
 binary:
 binary:
-	$(BUILDX_CMD) bake binary
+	BUILD_TAGS="$(GO_BUILDTAGS)" $(BUILDX_CMD) bake binary
 
 
 .PHONY: binary-with-coverage
 .PHONY: binary-with-coverage
 binary-with-coverage:
 binary-with-coverage:
-	$(BUILDX_CMD) bake binary-with-coverage
+	BUILD_TAGS="$(GO_BUILDTAGS)" $(BUILDX_CMD) bake binary-with-coverage
 
 
 .PHONY: install
 .PHONY: install
 install: binary
 install: binary

+ 1 - 1
pkg/watch/watcher_darwin.go

@@ -1,4 +1,4 @@
-//go:build darwin
+//go:build fsnotify
 
 
 /*
 /*
    Copyright 2020 Docker Compose CLI authors
    Copyright 2020 Docker Compose CLI authors

+ 1 - 1
pkg/watch/watcher_naive.go

@@ -1,4 +1,4 @@
-//go:build !darwin
+//go:build !fsnotify
 
 
 /*
 /*
    Copyright 2020 Docker Compose CLI authors
    Copyright 2020 Docker Compose CLI authors