From 376b876bf51d3f9ac7202e775182860d67d78cd9 Mon Sep 17 00:00:00 2001 From: Jiaqi Guo Date: Tue, 29 Dec 2020 16:45:25 -0800 Subject: [PATCH 1/7] Add a demo proto --- WORKSPACE | 49 ++++++++++++++++++++++++++++++++++++++ package.json | 5 +++- webapp/aoj/app/BUILD | 13 ++++++++++ webapp/aoj/app/app.ts | 5 ++++ webapp/aoj/app/thing.proto | 5 ++++ yarn.lock | 15 ++++++++++++ 6 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 webapp/aoj/app/thing.proto diff --git a/WORKSPACE b/WORKSPACE index a08d69b..26af43d 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" @@ -115,3 +134,33 @@ git_repository( remote = "https://github.com/jiaqi/bazville.git", tag = "v_0_0_2", ) + +load("@npm//@bazel/labs:package.bzl", "npm_bazel_labs_dependencies") + +npm_bazel_labs_dependencies() + +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 c0dc838..06da3fe 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": "^2.3.1", "@bazel/rollup": "^2.3.1", "@bazel/terser": "^2.3.1", @@ -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", @@ -67,4 +70,4 @@ "test": "bazel test //...", "postinstall": "ngcc" } -} +} \ No newline at end of file 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..9c1273c 100644 --- a/webapp/aoj/app/app.ts +++ b/webapp/aoj/app/app.ts @@ -1,5 +1,10 @@ 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 { + constructor() { + const thing = new Thing(); + console.log(`The thing: ${thing}`); + } } \ No newline at end of file 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 e0580f9..e6e35e2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1048,6 +1048,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@^2.3.1": version "2.3.2" resolved "https://registry.yarnpkg.com/@bazel/protractor/-/protractor-2.3.2.tgz#a57daa9488c40fa30843947f26474891db130229" @@ -3544,6 +3549,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" @@ -3566,6 +3576,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.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb" integrity sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw== +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" From 29c232978a74291125de7454c825ba8f1ede0d61 Mon Sep 17 00:00:00 2001 From: Jiaqi Guo Date: Fri, 1 Jan 2021 10:07:34 -0800 Subject: [PATCH 2/7] Add build time dependency for pb --- webapp/aoj/BUILD | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/aoj/BUILD b/webapp/aoj/BUILD index 158fa83..b7371e3 100644 --- a/webapp/aoj/BUILD +++ b/webapp/aoj/BUILD @@ -41,6 +41,7 @@ rollup_bundle( "@npm//@angular/animations", "@npm//@rollup/plugin-commonjs", "@npm//@rollup/plugin-node-resolve", + "@npm//google-protobuf", ], ) From 38487008237e4b96d01080423bd5fc3c5c2a4dd5 Mon Sep 17 00:00:00 2001 From: Jiaqi Guo Date: Sun, 10 Jan 2021 11:23:48 -0800 Subject: [PATCH 3/7] Image move --- java/org/cyclopsgroup/aoj/server/BUILD | 6 ++- .../aoj/server/WEB-INF/jsp/index.jsp | 44 +++++++++--------- .../aoj/server/{ => images}/favicon.png | Bin 3 files changed, 26 insertions(+), 24 deletions(-) rename java/org/cyclopsgroup/aoj/server/{ => images}/favicon.png (100%) diff --git a/java/org/cyclopsgroup/aoj/server/BUILD b/java/org/cyclopsgroup/aoj/server/BUILD index 6deeb40..2fb67b3 100644 --- a/java/org/cyclopsgroup/aoj/server/BUILD +++ b/java/org/cyclopsgroup/aoj/server/BUILD @@ -17,8 +17,10 @@ java_library( # Web application directory. webapp( name = "webapp", - srcs = glob(["WEB-INF/**"]) + [ - ":favicon.png", + srcs = glob([ + "WEB-INF/**", + "images/**", + ]) + [ "//webapp/aoj", ], deps = [":serverlib"], diff --git a/java/org/cyclopsgroup/aoj/server/WEB-INF/jsp/index.jsp b/java/org/cyclopsgroup/aoj/server/WEB-INF/jsp/index.jsp index 5c9d604..f48e500 100644 --- a/java/org/cyclopsgroup/aoj/server/WEB-INF/jsp/index.jsp +++ b/java/org/cyclopsgroup/aoj/server/WEB-INF/jsp/index.jsp @@ -1,25 +1,25 @@ -<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> - - +<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + + - - - Angular on Java - - - - - - - + + + Angular on Java + + + + + + + - - - - - - - - + + + + + + + + - \ No newline at end of file + \ No newline at end of file diff --git a/java/org/cyclopsgroup/aoj/server/favicon.png b/java/org/cyclopsgroup/aoj/server/images/favicon.png similarity index 100% rename from java/org/cyclopsgroup/aoj/server/favicon.png rename to java/org/cyclopsgroup/aoj/server/images/favicon.png From bd6fa7894c53a59fa88a12c508c26823aeb69567 Mon Sep 17 00:00:00 2001 From: Jiaqi Guo Date: Sun, 10 Jan 2021 11:44:58 -0800 Subject: [PATCH 4/7] Adding link_workspace_root=true --- WORKSPACE | 8 ++++---- webapp/aoj/BUILD | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 26af43d..803afc1 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,7 +4,6 @@ workspace( ) load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") # # Enable global maven dependency. @@ -129,10 +128,11 @@ load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories") sass_repositories() -git_repository( +http_archive( name = "bazville", - remote = "https://github.com/jiaqi/bazville.git", - tag = "v_0_0_2", + sha256 = "902e1fee3d2cf2b1df479b486545c859d9ad3edecc0895559ca49bc58b10c9ad", + 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") diff --git a/webapp/aoj/BUILD b/webapp/aoj/BUILD index b7371e3..ec737fd 100644 --- a/webapp/aoj/BUILD +++ b/webapp/aoj/BUILD @@ -35,6 +35,7 @@ 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", From 3a8eaa51dc0e298d20699e1572b1262eedc69c8f Mon Sep 17 00:00:00 2001 From: Jiaqi Guo Date: Sun, 10 Jan 2021 19:29:37 -0800 Subject: [PATCH 5/7] Trigger a rebuild --- WORKSPACE | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WORKSPACE b/WORKSPACE index ba9b56d..77ac24a 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -140,6 +140,8 @@ 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", From e11b9189461ac7ce5aa07866a594abef07a31c67 Mon Sep 17 00:00:00 2001 From: Jiaqi Guo Date: Mon, 27 Dec 2021 11:07:38 -0800 Subject: [PATCH 6/7] Bad characters --- yarn.lock | 1 - 1 file changed, 1 deletion(-) diff --git a/yarn.lock b/yarn.lock index 6e286ba..195ec04 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1101,7 +1101,6 @@ resolved "https://registry.yarnpkg.com/@bazel/ibazel/-/ibazel-0.14.0.tgz#86fa0002bed2ce1123b7ad98d4dd4623a0d93244" integrity sha512-s0gyec6lArcRDwVfIP6xpY8iEaFpzrSpyErSppd3r2O49pOEg7n6HGS/qJ8ncvme56vrDk6crl/kQ6VAdEO+rg== -<<<<<<< HEAD "@bazel/labs@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@bazel/labs/-/labs-3.0.0.tgz#1e7f22acee029aee27b01bef018656ad31c20c35" From 97c9a7752fc2ba909ee3bfe88e98375842d4a552 Mon Sep 17 00:00:00 2001 From: Jiaqi Guo Date: Mon, 27 Dec 2021 11:08:48 -0800 Subject: [PATCH 7/7] empty line --- webapp/aoj/app/app.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/aoj/app/app.ts b/webapp/aoj/app/app.ts index 9c1273c..0e6e1d9 100644 --- a/webapp/aoj/app/app.ts +++ b/webapp/aoj/app/app.ts @@ -7,4 +7,5 @@ export class App { const thing = new Thing(); console.log(`The thing: ${thing}`); } -} \ No newline at end of file +} +