Add support for build tags (#1054)
By default all bridges are available. You can turn off certain bridges by providing e.g. "nodiscord" as a build tag. go build -tags nomsteams,noapi
This commit is contained in:
parent
0e4973e15c
commit
2b7eab629d
|
@ -0,0 +1,11 @@
|
|||
// +build !noapi
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
"github.com/42wim/matterbridge/bridge/api"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["api"] = api.New
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
// +build !nodiscord
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bdiscord "github.com/42wim/matterbridge/bridge/discord"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["discord"] = bdiscord.New
|
||||
UserTypingSupport["discord"] = struct{}{}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !nogitter
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bgitter "github.com/42wim/matterbridge/bridge/gitter"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["gitter"] = bgitter.New
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !noirc
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
birc "github.com/42wim/matterbridge/bridge/irc"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["irc"] = birc.New
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !nokeybase
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bkeybase "github.com/42wim/matterbridge/bridge/keybase"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["keybase"] = bkeybase.New
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !nomatrix
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bmatrix "github.com/42wim/matterbridge/bridge/matrix"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["matrix"] = bmatrix.New
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !nomattermost
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bmattermost "github.com/42wim/matterbridge/bridge/mattermost"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["mattermost"] = bmattermost.New
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !nomsteams
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bmsteams "github.com/42wim/matterbridge/bridge/msteams"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["msteams"] = bmsteams.New
|
||||
}
|
|
@ -2,47 +2,9 @@ package bridgemap
|
|||
|
||||
import (
|
||||
"github.com/42wim/matterbridge/bridge"
|
||||
"github.com/42wim/matterbridge/bridge/api"
|
||||
bdiscord "github.com/42wim/matterbridge/bridge/discord"
|
||||
bgitter "github.com/42wim/matterbridge/bridge/gitter"
|
||||
birc "github.com/42wim/matterbridge/bridge/irc"
|
||||
bkeybase "github.com/42wim/matterbridge/bridge/keybase"
|
||||
bmatrix "github.com/42wim/matterbridge/bridge/matrix"
|
||||
bmattermost "github.com/42wim/matterbridge/bridge/mattermost"
|
||||
bmsteams "github.com/42wim/matterbridge/bridge/msteams"
|
||||
brocketchat "github.com/42wim/matterbridge/bridge/rocketchat"
|
||||
bslack "github.com/42wim/matterbridge/bridge/slack"
|
||||
bsshchat "github.com/42wim/matterbridge/bridge/sshchat"
|
||||
bsteam "github.com/42wim/matterbridge/bridge/steam"
|
||||
btelegram "github.com/42wim/matterbridge/bridge/telegram"
|
||||
bwhatsapp "github.com/42wim/matterbridge/bridge/whatsapp"
|
||||
bxmpp "github.com/42wim/matterbridge/bridge/xmpp"
|
||||
bzulip "github.com/42wim/matterbridge/bridge/zulip"
|
||||
)
|
||||
|
||||
var (
|
||||
FullMap = map[string]bridge.Factory{
|
||||
"api": api.New,
|
||||
"discord": bdiscord.New,
|
||||
"gitter": bgitter.New,
|
||||
"irc": birc.New,
|
||||
"mattermost": bmattermost.New,
|
||||
"matrix": bmatrix.New,
|
||||
"rocketchat": brocketchat.New,
|
||||
"slack-legacy": bslack.NewLegacy,
|
||||
"slack": bslack.New,
|
||||
"sshchat": bsshchat.New,
|
||||
"steam": bsteam.New,
|
||||
"telegram": btelegram.New,
|
||||
"whatsapp": bwhatsapp.New,
|
||||
"xmpp": bxmpp.New,
|
||||
"zulip": bzulip.New,
|
||||
"keybase": bkeybase.New,
|
||||
"msteams": bmsteams.New,
|
||||
}
|
||||
|
||||
UserTypingSupport = map[string]struct{}{
|
||||
"slack": {},
|
||||
"discord": {},
|
||||
}
|
||||
FullMap = map[string]bridge.Factory{}
|
||||
UserTypingSupport = map[string]struct{}{}
|
||||
)
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// +build !norocketchat
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
brocketchat "github.com/42wim/matterbridge/bridge/rocketchat"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["rocketchat"] = brocketchat.New
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
// +build !noslack
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bslack "github.com/42wim/matterbridge/bridge/slack"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["slack-legacy"] = bslack.NewLegacy
|
||||
FullMap["slack"] = bslack.New
|
||||
UserTypingSupport["slack"] = struct{}{}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !nosshchat
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bsshchat "github.com/42wim/matterbridge/bridge/sshchat"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["sshchat"] = bsshchat.New
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !nosteam
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bsteam "github.com/42wim/matterbridge/bridge/steam"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["steam"] = bsteam.New
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !notelegram
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
btelegram "github.com/42wim/matterbridge/bridge/telegram"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["telegram"] = btelegram.New
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !nowhatsapp
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bwhatsapp "github.com/42wim/matterbridge/bridge/whatsapp"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["whatsapp"] = bwhatsapp.New
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !noxmpp
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bxmpp "github.com/42wim/matterbridge/bridge/xmpp"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["xmpp"] = bxmpp.New
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
// +build !nozulip
|
||||
|
||||
package bridgemap
|
||||
|
||||
import (
|
||||
bzulip "github.com/42wim/matterbridge/bridge/zulip"
|
||||
)
|
||||
|
||||
func init() {
|
||||
FullMap["zulip"] = bzulip.New
|
||||
}
|
Loading…
Reference in New Issue