supabase-operator/magefiles/build.go

49 lines
1.3 KiB
Go
Raw Normal View History

2025-01-20 17:20:04 +01:00
/*
Copyright 2025 Peter Kurfer.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"log/slog"
"github.com/magefile/mage/mg" // mg contains helpful utility functions, like Deps
)
// Default target to run when none is specified
// If not set, running mage will list available targets
// var Default = Build
// A build step that requires additional params, or platform specific steps for example
func Build() error {
mg.Deps(InstallDeps, InstallToolDeps)
slog.Info("Building...")
return Go("build", "-o", "bin/manager", "cmd/main.go")
}
func Run() error {
mg.Deps(InstallDeps, InstallToolDeps)
return Go("run", "./cmd/main.go")
}
func InstallToolDeps() error {
return Go("mod", "download", "-x", "-modfile=tools/go.mod")
}
func InstallDeps() error {
return Go("mod", "download", "-x")
}