Skip to content

Commit

Permalink
Merge pull request #4 from filmil/update-to-goapp-v9
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamjenson authored Aug 9, 2023
2 parents 9c7a3f5 + 359a30f commit 6c3ff61
Show file tree
Hide file tree
Showing 17 changed files with 615 additions and 231 deletions.
6 changes: 6 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Allows temporary user settings to be placed here. From
# https://bazel.build/configure/best-practices#bazelrc-file
try-import %workspace%/user.bazelrc

build --cxxopt=-std=c++14
build --host_cxxopt=-std=c++14
1 change: 0 additions & 1 deletion .blazerc

This file was deleted.

14 changes: 8 additions & 6 deletions BUILD → BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,29 @@ buildifier(name = "buildifier")

go_library(
name = "go_default_library",
srcs = ["main.go"],
srcs = ["//wasm:files"],
importpath = "github.com/grahamjenson/bazel-golang-wasm-proto",
visibility = ["//visibility:private"],
deps = [
"//protos/api:go_default_library",
"//server:go_default_library",
"@com_github_maxence_charriere_go_app_v6//pkg/app:go_default_library",
"@com_github_maxence_charriere_go_app_v9//pkg/app:go_default_library",
],
)

go_binary(
name = "server",
args = [
"--bootstrap-css-path=$(location @com_github_bootstrap//file:bootstrap.css)",
"--wasm-path=$(location //wasm:app.wasm)",
"--icon-path=$(location //wasm:icon)",
],
data = [
"//wasm:app.wasm",
"//wasm:icon",
"@com_github_bootstrap//file:bootstrap.css",
"@com_github_ec2instances//file:instances.json",
],
args = [
"--bootstrap-css-path=$(location @com_github_bootstrap//file:bootstrap.css)",
"--wasm-path=$(location //wasm:app.wasm)",
],
embed = [":go_default_library"],
visibility = ["//visibility:public"],
)
39 changes: 8 additions & 31 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,26 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

http_archive(
name = "io_bazel_rules_go",
sha256 = "e6a6c016b0663e06fa5fccf1cd8152eab8aa8180c583ec20c872f4f9953a7ac5",
sha256 = "51dc53293afe317d2696d4d6433a4c33feedb7748a9e352072e2ec3c0dafd2c6",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.22.1/rules_go-v0.22.1.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.22.1/rules_go-v0.22.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.40.1/rules_go-v0.40.1.zip",
],
)

http_archive(
name = "bazel_gazelle",
sha256 = "d8c45ee70ec39a57e7a05e5027c32b1576cc7f16d9dd37135b0eddde45cf1b10",
sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
],
)

git_repository(
name = "com_google_protobuf",
commit = "09745575a923640154bcf307fba8aedff47f240a",
commit = "21edc3b26fc80771baea78d8bd8df1285b12cae2",
remote = "https://github.com/protocolbuffers/protobuf",
shallow_since = "1558721209 -0700",
patches = [
"//third_party:0001-Updates-the-zlib-version-in-use-to-1.2.13.patch",
],
patch_args = [ "-p1" ],
)

http_archive(
Expand All @@ -47,24 +42,6 @@ http_archive(
# Overrides to get WASM working with protoc
###

http_archive(
name = "com_github_golang_protobuf",
patch_args = ["-p1"],
patches = [
# copy and edit from @io_bazel_rules_go
"//third_party:proto.patch",
# additional targets may depend on generated code for well known types
"@io_bazel_rules_go//third_party:com_github_golang_protobuf-extras.patch",
],
sha256 = "3b1ab4c27a3a3ea02fcd5d701d4680cf724e0b7499c67f520f1f1dd03ef0bc45",
strip_prefix = "protobuf-1.3.3",
# v1.3.3, latest as of 2020-02-21
urls = [
"https://mirror.bazel.build/github.com/golang/protobuf/archive/v1.3.3.zip",
"https://github.com/golang/protobuf/archive/v1.3.3.zip",
],
)

http_archive(
name = "com_github_gogo_protobuf",
patch_args = ["-p1"],
Expand All @@ -88,7 +65,7 @@ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_depe

go_rules_dependencies()

go_register_toolchains(go_version = "1.14")
go_register_toolchains(go_version = "1.20.5")

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

Expand Down
21 changes: 17 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
module github.com/grahamjenson/bazel-golang-wasm-proto

go 1.20

require (
github.com/lyft/protoc-gen-star v0.4.14
github.com/maxence-charriere/go-app/v6 v6.2.0
google.golang.org/grpc v1.27.1
github.com/golang/protobuf v1.5.3
github.com/lyft/protoc-gen-star v0.6.2
github.com/maxence-charriere/go-app/v9 v9.7.3
google.golang.org/grpc v1.57.0
)

go 1.13
require (
github.com/google/uuid v1.3.0 // indirect
github.com/spf13/afero v1.3.3 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.9.0 // indirect
golang.org/x/sys v0.7.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/protobuf v1.31.0 // indirect
)
54 changes: 0 additions & 54 deletions main.go

This file was deleted.

18 changes: 9 additions & 9 deletions protos/api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ proto_library(
visibility = ["//visibility:public"],
)

go_library(
name = "go_default_library",
embed = [":api_go_proto"],
importpath = "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api",
visibility = ["//visibility:public"],
)

go_proto_library(
name = "api_go_proto",
compilers = [
"@io_bazel_rules_go//proto:go_grpc",
"//tools:go_server", # keep
"//tools:go_client", # keep
"//tools:go_server", #keep
"//tools:go_client", #keep
],
importpath = "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api",
proto = ":api_proto",
visibility = ["//visibility:public"],
)

go_library(
name = "go_default_library",
embed = [":api_go_proto"],
importpath = "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api",
visibility = ["//visibility:public"],
)
4 changes: 2 additions & 2 deletions protos/api/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ syntax = "proto3";

package api;

option go_package = "github.com/grahamjenson/bazel-golang-wasm-protoc/protos/api";
option go_package = "github.com/grahamjenson/bazel-golang-wasm-proto/protos/api";

message Instance {
string name = 1;
string name = 1;
string instance_type = 2;
float ecu = 3;
float memory = 4;
Expand Down
Loading

0 comments on commit 6c3ff61

Please sign in to comment.