add build targets

This commit is contained in:
Christian Nieves
2023-07-12 21:40:39 -05:00
parent 28fae2c39d
commit 4060a5c274
5 changed files with 36 additions and 33 deletions

View File

@ -12,6 +12,9 @@ alias(
go_library( go_library(
name = "beornextract_lib", name = "beornextract_lib",
srcs = ["main.go"], srcs = ["main.go"],
importpath = "github.com/squk/lotr/beornextract", importpath = "github.com/squk/lotr/cmd/beornextract",
deps = ["@com_github_davecgh_go_spew//spew"], deps = [
"//cmd/beornextract/types",
"@com_github_davecgh_go_spew//spew",
],
) )

View File

@ -5,26 +5,26 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"github.com/squk/lotr/extract/types"
"github.com/davecgh/go-spew/spew" "github.com/davecgh/go-spew/spew"
"github.com/squk/lotr/cmd/beornextract/types"
) )
func main() { func main() {
fmt.Println("LOTR CARD PARSE") fmt.Println("LOTR CARD PARSE")
// Open our jsonFile // Open our jsonFile
jsonFile, err := os.Open("./data/Bot.Cards.json") jsonFile, err := os.Open("./data/Bot.Cards.json")
// if we os.Open returns an error then handle it // if we os.Open returns an error then handle it
if err != nil { if err != nil {
fmt.Println(err) fmt.Println(err)
return return
} }
fmt.Println("Successfully Opened users.json") fmt.Println("Successfully Opened users.json")
// defer the closing of our jsonFile so that we can parse it later on // defer the closing of our jsonFile so that we can parse it later on
defer jsonFile.Close() defer jsonFile.Close()
byteValue, _ := ioutil.ReadAll(jsonFile) byteValue, _ := ioutil.ReadAll(jsonFile)
c := []types.HallOfBeornCard{} c := []types.HallOfBeornCard{}
json.Unmarshal(byteValue, &c) json.Unmarshal(byteValue, &c)
spew.Dump(c) spew.Dump(c)

View File

@ -3,6 +3,6 @@ load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library( go_library(
name = "types", name = "types",
srcs = ["card.go"], srcs = ["card.go"],
importpath = "github.com/squk/lotr/beornextract/types", importpath = "github.com/squk/lotr/cmd/beornextract/types",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )

18
cmd/test/BUILD Normal file
View File

@ -0,0 +1,18 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "test_lib",
srcs = ["main.go"],
importpath = "github.com/squk/lotr/cmd/test",
visibility = ["//visibility:private"],
deps = [
"@com_github_davecgh_go_spew//spew",
"@com_github_mattn_go_sqlite3//:go-sqlite3",
],
)
go_binary(
name = "test",
embed = [":test_lib"],
visibility = ["//visibility:public"],
)

View File

@ -1,18 +0,0 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "cmd_lib",
srcs = ["main.go"],
importpath = "github.com/squk/lotr/sqlgen/cmd",
visibility = ["//visibility:private"],
deps = [
"@com_github_davecgh_go_spew//spew",
"@com_github_mattn_go_sqlite3//:go-sqlite3",
],
)
go_binary(
name = "cmd",
embed = [":cmd_lib"],
visibility = ["//visibility:public"],
)