Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"main"
]
}
6 changes: 3 additions & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@ exports_files(["LICENSE"])

genrule(
name = "bundle",
outs = ["bundle.zip"],
srcs = [
"LICENSE",
"//codelab-elements:README.md",
"//codelab-elements:all_files",
"@prettify//:prettify",
"@prettify",
"@polyfill//:custom_elements",
"@polyfill//:native_shim",
],
outs = ["bundle.zip"],
cmd = "zip -j $@ $(SRCS)",
)

genrule(
name = "npm_dist",
outs = ["npm_dist.zip"],
srcs = [
"LICENSE",
"package.json",
"//codelab-elements:README.md",
"//codelab-elements:all_files",
],
outs = ["npm_dist.zip"],
cmd = "zip -j $@ $(SRCS)",
)
170 changes: 19 additions & 151 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,163 +1,31 @@
workspace(name = "googlecodelabs_custom_elements")
workspace(name="googlecodelabs_tools")

maven_server(
name = "default",
url = "https://repo1.maven.org/maven2/"
)

maven_jar(
name = "org_apache_httpcomponents_httpclient",
artifact = "org.apache.httpcomponents:httpclient:4.5.5",
)

maven_jar(
name = "org_apache_httpcomponents_httpmime",
artifact = "org.apache.httpcomponents:httpmime:4.5.5",
)

maven_jar(
name = "org_apache_httpcomponents_httpcore",
artifact = "org.apache.httpcomponents:httpcore:4.4.9",
)

maven_jar(
name = "org_apache_commons_exec",
artifact = "org.apache.commons:commons-exec:1.3",
)

maven_jar(
name = "org_seleniumhq_selenium_api",
artifact = "org.seleniumhq:selenium-api:3.9.1",
)

maven_jar(
name = "org_seleniumhq_selenium_remote_driver",
artifact = "org.seleniumhq.selenium:selenium-remote-driver:3.8.1",
)

maven_jar(
name = "net_java_dev_jna_platform",
artifact = "net.java.dev:jna-client:4.5.1",
)

maven_jar(
name = "net_java_dev_jna",
artifact = "net.java.dev:jna:4.5.1",
)

maven_jar(
name = "net_bytebuddy",
artifact = "net.bytebuddy:byte-buddy:1.7.9",
)

maven_jar(
name = "com_squareup_okio",
artifact = "com.squareup:okio:1.14.0",
)

maven_jar(
name = "com_squareup_okhttp3_okhttp",
artifact = "com.squareup.okhttp3:okhttp:3.9.1",
)

maven_jar(
name = "cglib_nodep",
artifact = "cglib:cglib-nodep:3.2.6",
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

maven_jar(
name = "junit",
artifact = "junit:junit:4.12",
)

maven_jar(
name = "commons_logging",
artifact = "commons-logging:commons-logging:1.2",
)

maven_jar(
name = "commons_codec",
artifact = "commons-codec:commons-codec:1.11",
)

maven_jar(
name = "org_hamcrest_core",
artifact = "org.hamcrest:hamcrest-core:1.3",
)

new_http_archive(
name = "com_google_javascript_closure_compiler",
build_file = "third_party/BUILD.closure",
url = "https://repo1.maven.org/maven2/com/google/javascript/closure-compiler-unshaded/v20180805/closure-compiler-unshaded-v20180805.jar",
)

# Required by io_bazel_rules_webtesting.
skylib_ver = "f9b0ff1dd3d119d19b9cacbbc425a9e61759f1f5"
http_archive(
name = "bazel_skylib",
sha256 = "ce27a2007deda8a1de65df9de3d4cd93a5360ead43c5ff3017ae6b3a2abe485e",
strip_prefix = "bazel-skylib-{v}".format(v=skylib_ver),
urls = [
"https://github.com/bazelbuild/bazel-skylib/archive/{v}.tar.gz".format(v=skylib_ver),
name="io_bazel_rules_go",
sha256="91585017debb61982f7054c9688857a2ad1fd823fc3f9cb05048b0025c47d023",
urls=[
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.42.0/rules_go-v0.42.0.zip",
],
)

rules_closure_ver = "0.9.0"
http_archive(
name = "io_bazel_rules_closure",
sha256 = "054717a2e6a415001bc4c608b208723526bdf6cace3592ca6efb3749ba18ce21",
strip_prefix = "rules_closure-{v}".format(v=rules_closure_ver),
url = "https://github.com/shawnbuso/rules_closure/archive/{v}.zip".format(v=rules_closure_ver),
)
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
closure_repositories()

http_archive(
name = "io_bazel_rules_go",
sha256 = "53c8222c6eab05dd49c40184c361493705d4234e60c42c4cd13ab4898da4c6be",
url = "https://github.com/bazelbuild/rules_go/releases/download/0.10.0/rules_go-0.10.0.tar.gz",
)
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_register_toolchains")
go_rules_dependencies()
go_register_toolchains()

rules_webtesting_ver = "936c760cff973a63031be0d0518b40a228e224e3"
http_archive(
name = "io_bazel_rules_webtesting",
sha256 = "797b75e792a34728a6a3846c7c3d3ad669f12cd8490b888cc969bad93d236b1b",
strip_prefix = "rules_webtesting-{v}".format(v=rules_webtesting_ver),
url = "https://github.com/bazelbuild/rules_webtesting/archive/{v}.zip".format(v=rules_webtesting_ver),
)
load(
"@io_bazel_rules_webtesting//web:repositories.bzl",
"browser_repositories",
"web_test_repositories",
)
web_test_repositories()
browser_repositories(chromium = True)

prettify_ver = "2013-03-04"
new_http_archive(
name = "prettify",
build_file = "third_party/BUILD.prettify",
strip_prefix = "code-prettify-{v}".format(v=prettify_ver),
url = "https://github.com/google/code-prettify/archive/{v}.zip".format(v=prettify_ver),
name="gazelle",
sha256="d3fa66a39028e97d76f9e2db8f1b0c11c099e8e01bf363a923074784e451f809",
urls=[
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.33.0/bazel-gazelle-v0.33.0.tar.gz",
],
)

new_http_archive(
name = "polyfill",
build_file = "third_party/BUILD.polyfill",
sha256 = "9606cdeacbb67f21fb495a4b0a0e5ea6a137fc453945907822e1b930e77124d4",
strip_prefix = "custom-elements-1.0.8",
url = "https://github.com/webcomponents/custom-elements/archive/v1.0.8.zip",
)
load("@io_bazel_rules_go//go:deps.bzl",
"go_register_toolchains", "go_rules_dependencies")
load("@gazelle//:deps.bzl", "gazelle_dependencies")

git_repository(
name = "io_bazel_rules_sass",
remote = "https://github.com/bazelbuild/rules_sass.git",
tag = "0.0.3",
)
go_rules_dependencies()

load("@io_bazel_rules_sass//sass:sass.bzl", "sass_repositories")
go_register_toolchains(version="1.20.7")

sass_repositories()
gazelle_dependencies()
22 changes: 22 additions & 0 deletions claat/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@gazelle//:def.bzl", "gazelle")

gazelle(name = "gazelle")

go_library(
name = "claat_lib",
srcs = ["main.go"],
importpath = "github.com/googlecodelabs/tools/claat",
visibility = ["//visibility:private"],
deps = [
"//claat/cmd",
"//claat/parser/gdoc",
"//claat/parser/md",
],
)

go_binary(
name = "claat",
embed = [":claat_lib"],
visibility = ["//visibility:public"],
)
31 changes: 31 additions & 0 deletions claat/cmd/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "cmd",
srcs = [
"export.go",
"serve.go",
"update.go",
"util.go",
],
importpath = "github.com/googlecodelabs/tools/claat/cmd",
visibility = ["//visibility:public"],
deps = [
"//claat/fetch",
"//claat/parser/gdoc",
"//claat/parser/md",
"//claat/render",
"//claat/types",
"//claat/util",
],
)

go_test(
name = "cmd_test",
srcs = ["export_test.go"],
data = glob(["testdata/**"]),
deps = [
":cmd",
"@com_github_google_go_cmp//cmp:go_default_library",
],
)
23 changes: 23 additions & 0 deletions claat/fetch/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "fetch",
srcs = ["fetch.go"],
importpath = "github.com/googlecodelabs/tools/claat/fetch",
visibility = ["//visibility:public"],
deps = [
"//claat/fetch/drive/auth",
"//claat/nodes",
"//claat/parser",
"//claat/types",
"//claat/util",
],
)

go_test(
name = "fetch_test",
srcs = ["fetch_test.go"],
data = glob(["testdata/**"]),
embed = [":fetch"],
deps = ["//claat/parser/gdoc"],
)
19 changes: 19 additions & 0 deletions claat/fetch/drive/auth/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "auth",
srcs = ["auth.go"],
importpath = "github.com/googlecodelabs/tools/claat/fetch/drive/auth",
visibility = ["//visibility:public"],
deps = [
"@org_golang_x_net//context:go_default_library",
"@org_golang_x_oauth2//:go_default_library",
],
)

go_test(
name = "auth_test",
srcs = ["auth_test.go"],
embed = [":auth"],
deps = ["@org_golang_x_oauth2//:go_default_library"],
)
47 changes: 47 additions & 0 deletions claat/nodes/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "nodes",
srcs = [
"button.go",
"code.go",
"grid.go",
"header.go",
"iframe.go",
"image.go",
"import.go",
"infobox.go",
"itemslist.go",
"list.go",
"nodes.go",
"survey.go",
"text.go",
"url.go",
"youtube.go",
],
importpath = "github.com/googlecodelabs/tools/claat/nodes",
visibility = ["//visibility:public"],
)

go_test(
name = "nodes_test",
srcs = [
"button_test.go",
"code_test.go",
"grid_test.go",
"header_test.go",
"iframe_test.go",
"image_test.go",
"import_test.go",
"infobox_test.go",
"itemslist_test.go",
"list_test.go",
"nodes_test.go",
"survey_test.go",
"text_test.go",
"url_test.go",
"youtube_test.go",
],
embed = [":nodes"],
deps = ["@com_github_google_go_cmp//cmp:go_default_library"],
)
21 changes: 21 additions & 0 deletions claat/parser/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "parser",
srcs = [
"parse.go",
"trim.go",
],
importpath = "github.com/googlecodelabs/tools/claat/parser",
visibility = ["//visibility:public"],
deps = [
"//claat/nodes",
"//claat/types",
],
)

go_test(
name = "parser_test",
srcs = ["trim_test.go"],
embed = [":parser"],
)
Loading