You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2021/02/10 02:27:25 UTC

[skywalking-satellite] 01/01: Unify the build process on all platforms

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch platform/windows
in repository https://gitbox.apache.org/repos/asf/skywalking-satellite.git

commit 0a914843181db019cb7c992d325ceceb2bd5eefa
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Wed Feb 10 10:26:07 2021 +0800

    Unify the build process on all platforms
---
 Makefile                                             |  4 ++--
 plugins/queue/queue_repository.go                    |  7 -------
 plugins/queue/{queue_repository.go => queues.go}     | 20 ++++++--------------
 .../queue/{queue_repository.go => queues_windows.go} | 20 +++++---------------
 4 files changed, 13 insertions(+), 38 deletions(-)

diff --git a/Makefile b/Makefile
index 5919891..1749558 100644
--- a/Makefile
+++ b/Makefile
@@ -38,7 +38,7 @@ GO_BUILD_FLAGS = -v
 GO_BUILD_LDFLAGS = -X main.version=$(VERSION)
 GQL_GEN = $(GO_PATH)/bin/gqlgen
 
-PLATFORMS := linux darwin
+PLATFORMS := linux darwin windows
 os = $(word 1, $@)
 ARCH = amd64
 
@@ -79,7 +79,7 @@ clean: tools
 	-rm -rf coverage.txt
 
 .PHONY: build
-build: deps linux darwin
+build: deps linux darwin windows
 
 .PHONY: check
 check: clean
diff --git a/plugins/queue/queue_repository.go b/plugins/queue/queue_repository.go
index 9ca29cc..44c8843 100644
--- a/plugins/queue/queue_repository.go
+++ b/plugins/queue/queue_repository.go
@@ -22,18 +22,11 @@ import (
 
 	"github.com/apache/skywalking-satellite/internal/pkg/plugin"
 	"github.com/apache/skywalking-satellite/plugins/queue/api"
-	"github.com/apache/skywalking-satellite/plugins/queue/memory"
-	"github.com/apache/skywalking-satellite/plugins/queue/mmap"
 )
 
 // RegisterQueuePlugins register the used queue plugins.
 func RegisterQueuePlugins() {
 	plugin.RegisterPluginCategory(reflect.TypeOf((*api.Queue)(nil)).Elem())
-	queues := []api.Queue{
-		// Please register the queue plugins at here.
-		new(memory.Queue),
-		new(mmap.Queue),
-	}
 	for _, q := range queues {
 		plugin.RegisterPlugin(q)
 	}
diff --git a/plugins/queue/queue_repository.go b/plugins/queue/queues.go
similarity index 71%
copy from plugins/queue/queue_repository.go
copy to plugins/queue/queues.go
index 9ca29cc..79d1138 100644
--- a/plugins/queue/queue_repository.go
+++ b/plugins/queue/queues.go
@@ -15,26 +15,18 @@
 // specific language governing permissions and limitations
 // under the License.
 
+// +build !windows
+
 package queue
 
 import (
-	"reflect"
-
-	"github.com/apache/skywalking-satellite/internal/pkg/plugin"
 	"github.com/apache/skywalking-satellite/plugins/queue/api"
 	"github.com/apache/skywalking-satellite/plugins/queue/memory"
 	"github.com/apache/skywalking-satellite/plugins/queue/mmap"
 )
 
-// RegisterQueuePlugins register the used queue plugins.
-func RegisterQueuePlugins() {
-	plugin.RegisterPluginCategory(reflect.TypeOf((*api.Queue)(nil)).Elem())
-	queues := []api.Queue{
-		// Please register the queue plugins at here.
-		new(memory.Queue),
-		new(mmap.Queue),
-	}
-	for _, q := range queues {
-		plugin.RegisterPlugin(q)
-	}
+var queues = []api.Queue{
+	// Please register the queue plugins available on Linux, MacOS here.
+	new(memory.Queue),
+	new(mmap.Queue),
 }
diff --git a/plugins/queue/queue_repository.go b/plugins/queue/queues_windows.go
similarity index 67%
copy from plugins/queue/queue_repository.go
copy to plugins/queue/queues_windows.go
index 9ca29cc..1bd507f 100644
--- a/plugins/queue/queue_repository.go
+++ b/plugins/queue/queues_windows.go
@@ -15,26 +15,16 @@
 // specific language governing permissions and limitations
 // under the License.
 
+// +build windows
+
 package queue
 
 import (
-	"reflect"
-
-	"github.com/apache/skywalking-satellite/internal/pkg/plugin"
 	"github.com/apache/skywalking-satellite/plugins/queue/api"
 	"github.com/apache/skywalking-satellite/plugins/queue/memory"
-	"github.com/apache/skywalking-satellite/plugins/queue/mmap"
 )
 
-// RegisterQueuePlugins register the used queue plugins.
-func RegisterQueuePlugins() {
-	plugin.RegisterPluginCategory(reflect.TypeOf((*api.Queue)(nil)).Elem())
-	queues := []api.Queue{
-		// Please register the queue plugins at here.
-		new(memory.Queue),
-		new(mmap.Queue),
-	}
-	for _, q := range queues {
-		plugin.RegisterPlugin(q)
-	}
+var queues = []api.Queue{
+	// Please register the queue plugins available on Windows platform here.
+	new(memory.Queue),
 }