diff --git a/WORKSPACE b/WORKSPACE index 6ff6e09..115f781 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -18,6 +18,25 @@ http_archive( RULES_JVM_EXTERNAL_TAG, ) +SKYLIB_RULE_VERSION = "1.0.3" + +SKYLIB_RULE_SHA265 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c" + +http_archive( + name = "bazel_skylib", + sha256 = SKYLIB_RULE_SHA265, + urls = [ + "https://github.com/bazelbuild/bazel-skylib/releases/download/%s/bazel-skylib-%s.tar.gz" % + (SKYLIB_RULE_VERSION, SKYLIB_RULE_VERSION), + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/%s/bazel-skylib-%s.tar.gz" % + (SKYLIB_RULE_VERSION, SKYLIB_RULE_VERSION), + ], +) + +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + +bazel_skylib_workspace() + load("@rules_jvm_external//:defs.bzl", "maven_install") GOOGLE_AUTO_VALUE_VERSION = "1.7" @@ -116,3 +135,35 @@ http_archive( strip_prefix = "bazville-v_0_0_2", urls = ["https://github.com/jiaqi/bazville/archive/v_0_0_2.zip"], ) + +load("@npm//@bazel/labs:package.bzl", "npm_bazel_labs_dependencies") + +npm_bazel_labs_dependencies() + +# Protobuf related stuff. + +http_archive( + name = "com_google_protobuf", + sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113", + strip_prefix = "protobuf-3.14.0", + urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz"], +) + +http_archive( + name = "rules_proto", + sha256 = "3bce0e2fcf502619119c7cac03613fb52ce3034b2159dd3ae9d35f7339558aa3", + strip_prefix = "rules_proto-84ba6ec814eebbf5312b2cc029256097ae0042c3", + urls = [ + "https://github.com/bazelbuild/rules_proto/archive/84ba6ec814eebbf5312b2cc029256097ae0042c3.tar.gz", + ], +) + +load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") + +rules_proto_dependencies() + +rules_proto_toolchains() + +load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") + +protobuf_deps() diff --git a/package.json b/package.json index 2dc3be8..b18118d 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,7 @@ "@bazel/benchmark-runner": "^0.1.0", "@bazel/buildifier": "^3.5.0", "@bazel/ibazel": "^0.14.0", + "@bazel/labs": "^3.0.0", "@bazel/protractor": "^3.2.0", "@bazel/rollup": "^3.2.0", "@bazel/terser": "^3.2.0", @@ -48,6 +49,8 @@ "@types/node": "6.14.6", "core-js": "2.6.9", "firebase-tools": "7.1.0", + "google-protobuf": "3.11.4", + "grpc-web": "1.1.0", "history-server": "^1.3.1", "html-insert-assets": "^0.6.0", "karma": "~4.1.0", diff --git a/webapp/aoj/BUILD b/webapp/aoj/BUILD index 158fa83..ec737fd 100644 --- a/webapp/aoj/BUILD +++ b/webapp/aoj/BUILD @@ -35,12 +35,14 @@ rollup_bundle( name = "js_bundle", config_file = "rollup.config.js", entry_points = {":main.ts": "index"}, + link_workspace_root = True, output_dir = True, deps = [ ":js_module", "@npm//@angular/animations", "@npm//@rollup/plugin-commonjs", "@npm//@rollup/plugin-node-resolve", + "@npm//google-protobuf", ], ) diff --git a/webapp/aoj/app/BUILD b/webapp/aoj/app/BUILD index 0578b07..c1ed103 100644 --- a/webapp/aoj/app/BUILD +++ b/webapp/aoj/app/BUILD @@ -1,13 +1,26 @@ load("//buildtools:ng_module.bzl", "ng_module") +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@npm//@bazel/labs:index.bzl", "ts_proto_library") package(default_visibility = ["//webapp/aoj:packages"]) +proto_library( + name = "thing_type", + srcs = ["thing.proto"], +) + +ts_proto_library( + name = "thing_type_ts", + proto = ":thing_type", +) + ng_module( name = "app", srcs = glob(["*.ts"]), assets = ["app.html"], tsconfig = "//webapp/aoj:tsconfig.json", deps = [ + ":thing_type_ts", "@npm//@angular/core", "@npm//@angular/platform-browser", ], diff --git a/webapp/aoj/app/app.ts b/webapp/aoj/app/app.ts index f98ec62..0e6e1d9 100644 --- a/webapp/aoj/app/app.ts +++ b/webapp/aoj/app/app.ts @@ -1,5 +1,11 @@ import { Component } from '@angular/core'; +import { Thing } from 'angular_on_java/webapp/aoj/app/thing_pb'; @Component({ selector: 'app-component', templateUrl: 'app.html' }) export class App { -} \ No newline at end of file + constructor() { + const thing = new Thing(); + console.log(`The thing: ${thing}`); + } +} + diff --git a/webapp/aoj/app/thing.proto b/webapp/aoj/app/thing.proto new file mode 100644 index 0000000..3d21181 --- /dev/null +++ b/webapp/aoj/app/thing.proto @@ -0,0 +1,5 @@ +syntax = "proto3"; + +message Thing { + string thing_id = 1; +} diff --git a/yarn.lock b/yarn.lock index e830a43..1b488de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1120,6 +1120,11 @@ resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.14.0.tgz#86fa0002bed2ce1123b7ad98d4dd4623a0d93244" integrity sha512-s0gyec6lArcRDwVfIP6xpY8iEaFpzrSpyErSppd3r2O49pOEg7n6HGS/qJ8ncvme56vrDk6crl/kQ6VAdEO+rg== +"@bazel/labs@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@bazel/labs/-/labs-3.0.0.tgz#1e7f22acee029aee27b01bef018656ad31c20c35" + integrity sha512-+3k2GDGvZ4lrP9wuP7Vqnsy1wU1Zlw6Kub0c8hNfuwc9oWxlobIDQx1hXCBjf0UaThnHoAzQDrRc1tviNQqnyg== + "@bazel/protractor@^3.2.0": version "3.8.0" resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-3.8.0.tgz#b04999a6156bcc24f3819ee61b2b068cdbe0e309" @@ -3643,6 +3648,11 @@ google-p12-pem@^0.1.0: dependencies: node-forge "^0.7.1" +google-protobuf@3.11.4: + version "3.11.4" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.11.4.tgz#598ca405a3cfa917a2132994d008b5932ef42014" + integrity sha512-lL6b04rDirurUBOgsY2+LalI6Evq8eH5TcNzi7TYQ3BsIWelT0KSOQSBsXuavEkNf+odQU6c0lgz3UsZXeNX9Q== + got@^6.7.1: version "6.7.1" resolved "https://registry.yarnpkg.com/got/-/got-6.7.1.tgz#240cd05785a9a18e561dc1b44b41c763ef1e8db0" @@ -3665,6 +3675,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.8.tgz#e412b8d33f5e006593cbd3cee6df9f2cebbe802a" integrity sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg== +grpc-web@1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/grpc-web/-/grpc-web-1.1.0.tgz#18f73583a0a8c0b6c44a5cba62e66376d0ad019e" + integrity sha512-oPoS4/E/EO0TA2ZOSf3AxV2AbWDeabwfbAo+8oXNenOw87RmKz4hME8Sy4KDu2dUnqK8cuGfzdQlJPAEQEygNQ== + gtoken@^1.2.1: version "1.2.3" resolved "https://registry.yarnpkg.com/gtoken/-/gtoken-1.2.3.tgz#5509571b8afd4322e124cf66cf68115284c476d8"