Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Convert examples/ and tests/ into sub-workspaces #48

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
24 changes: 18 additions & 6 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
---
buildifier:
version: latest
platforms:
ubuntu1604:
tasks:
ubuntu1604_build:
platform: ubuntu1604
build_targets:
- "..."
test_targets:
ubuntu1804_build:
platform: ubuntu1804
build_targets:
- "..."
ubuntu1804:
macos_build:
platform: macos
build_targets:
- "..."
ubuntu1604_test:
working_directory: tests
platform: ubuntu1604
test_targets:
- "..."
macos:
build_targets:
ubuntu1804_test:
working_directory: tests
platform: ubuntu1804
test_targets:
- "..."
macos_test:
working_directory: tests
platform: macos
test_targets:
- "..."
2 changes: 2 additions & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
examples/
tests/
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
node_modules
/bazel-*
**/bazel-*
5 changes: 0 additions & 5 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ bzl_library(
exports_files(["LICENSE"])

# BEGIN-INTERNAL
exports_files(
["tsconfig.json"],
visibility = ["//visibility:public"],
)

pkg_npm(
name = "npm_package",
srcs = [
Expand Down
18 changes: 18 additions & 0 deletions examples/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2020 The Bazel Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

exports_files(
["tsconfig.json"],
visibility = ["//visibility:public"],
)
10 changes: 10 additions & 0 deletions examples/WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
workspace(
name = "build_bazel_rules_postcss_examples",
managed_directories = {"@npm": ["node_modules"]},
)

load("@build_bazel_rules_postcss_examples//:package.bzl", "rules_postcss_examples_dependencies")
rules_postcss_examples_dependencies()

load("@build_bazel_rules_postcss_examples//:repositories.bzl", "postcss_examples_repositories")
postcss_examples_repositories()
6 changes: 3 additions & 3 deletions examples/additional_outputs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:index.bzl", "postcss_binary", "postcss_plugin")
load("@build_bazel_rules_postcss//:index.bzl", "postcss_binary", "postcss_plugin")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

postcss_plugin(
name = "list_selectors",
srcs = [
"list-selectors.js",
],
node_require = "build_bazel_rules_postcss/examples/additional_outputs/list-selectors.js",
node_require = "build_bazel_rules_postcss_examples/additional_outputs/list-selectors.js",
)

postcss_binary(
Expand Down
4 changes: 2 additions & 2 deletions examples/autoprefixer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:index.bzl", "autoprefixer")
load("@build_bazel_rules_postcss//:index.bzl", "autoprefixer")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

AUTO_PREFIXER_BROWSERS = "ie >= 9, edge >= 12, firefox >= 42, chrome >= 32, safari >= 8, opera >= 38, ios_saf >= 9.2, android >= 4.3, and_uc >= 9.9"

Expand Down
6 changes: 3 additions & 3 deletions examples/custom_plugin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:index.bzl", "postcss_binary", "postcss_plugin")
load("@build_bazel_rules_postcss//:index.bzl", "postcss_binary", "postcss_plugin")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

postcss_plugin(
name = "unquote",
srcs = [
"unquote.js",
],
node_require = "build_bazel_rules_postcss/examples/custom_plugin/unquote.js",
node_require = "build_bazel_rules_postcss_examples/custom_plugin/unquote.js",
)

postcss_binary(
Expand Down
6 changes: 3 additions & 3 deletions examples/custom_plugin_ts/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# limitations under the License.

load("@npm//@bazel/typescript:index.bzl", "ts_library")
load("//:index.bzl", "postcss_binary", "postcss_plugin")
load("@build_bazel_rules_postcss//:index.bzl", "postcss_binary", "postcss_plugin")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

ts_library(
name = "unquote_ts",
Expand All @@ -37,7 +37,7 @@ postcss_plugin(
srcs = [
":unquote_js",
],
node_require = "build_bazel_rules_postcss/examples/custom_plugin_ts/unquote.js",
node_require = "build_bazel_rules_postcss_examples/custom_plugin_ts/unquote.js",
)

postcss_binary(
Expand Down
6 changes: 3 additions & 3 deletions examples/data_attr/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:index.bzl", "postcss_binary", "postcss_plugin")
load("@build_bazel_rules_postcss//:index.bzl", "postcss_binary", "postcss_plugin")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

postcss_plugin(
name = "header",
srcs = ["header.js"],
node_require = "build_bazel_rules_postcss/examples/data_attr/header.js",
node_require = "build_bazel_rules_postcss_examples/data_attr/header.js",
)

postcss_binary(
Expand Down
4 changes: 2 additions & 2 deletions examples/multi_binary/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:index.bzl", "postcss_multi_binary", "postcss_plugin")
load("@build_bazel_rules_postcss//:index.bzl", "postcss_multi_binary", "postcss_plugin")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

AUTO_PREFIXER_BROWSERS = "ie >= 9, edge >= 12, firefox >= 42, chrome >= 32, safari >= 8, opera >= 38, ios_saf >= 9.2, android >= 4.3, and_uc >= 9.9"

Expand Down
4 changes: 2 additions & 2 deletions examples/multi_sourcemap/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:index.bzl", "postcss_multi_binary", "postcss_plugin")
load("@build_bazel_rules_postcss//:index.bzl", "postcss_multi_binary", "postcss_plugin")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

AUTO_PREFIXER_BROWSERS = "ie >= 9, edge >= 12, firefox >= 42, chrome >= 32, safari >= 8, opera >= 38, ios_saf >= 9.2, android >= 4.3, and_uc >= 9.9"

Expand Down
44 changes: 44 additions & 0 deletions examples/package.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright 2020 The Bazel Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Fetches transitive dependencies required for the PostCSS rule examples"""

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Buildifier thinks this is a build target macro because of using native.*.
# buildifier: disable=unnamed-macro
def rules_postcss_examples_dependencies():
# NodeJS rules.
http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "5bf77cc2d13ddf9124f4c1453dd96063774d755d4fc75d922471540d1c9a8ea8",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/2.0.0/rules_nodejs-2.0.0.tar.gz"],
)

# Sass rules.
http_archive(
name = "io_bazel_rules_sass",
sha256 = "9dcfba04e4af896626f4760d866f895ea4291bc30bf7287887cefcf4707b6a62",
urls = [
"https://github.com/bazelbuild/rules_sass/archive/1.26.3.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_sass/archive/1.26.3.zip",
],
strip_prefix = "rules_sass-1.26.3",
)

# PostCSS rules.
native.local_repository(
name = "build_bazel_rules_postcss",
path = "../",
)
15 changes: 15 additions & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"private": true,
"description": "Examples for PostCSS Bazel rules",
"dependencies": {
"@types/node": "^12.12.7",
"autoprefixer": "9.4.3",
"minimist": "1.2.3",
"postcss": "^7.0.7",
"rtlcss": "^2.4.0",
"typescript": "^3.7.2"
},
"devDependencies": {
"@bazel/typescript": "^2.0.0"
}
}
6 changes: 3 additions & 3 deletions examples/positional_data_attr/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:index.bzl", "postcss_binary", "postcss_plugin")
load("@build_bazel_rules_postcss//:index.bzl", "postcss_binary", "postcss_plugin")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

postcss_plugin(
name = "header",
srcs = ["header.js"],
node_require = "build_bazel_rules_postcss/examples/positional_data_attr/header.js",
node_require = "build_bazel_rules_postcss_examples/positional_data_attr/header.js",
)

postcss_binary(
Expand Down
34 changes: 34 additions & 0 deletions examples/repositories.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2020 The Bazel Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Install PostCSS example dependencies"""

load("@build_bazel_rules_nodejs//:index.bzl", "yarn_install")
load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories")
load("@io_bazel_rules_sass//:package.bzl", "rules_sass_dependencies")
load("@build_bazel_rules_postcss//:repositories.bzl", "postcss_repositories")

def postcss_examples_repositories():
"""Set up environment for PostCSS examples."""

yarn_install(
name = "npm",
package_json = "@build_bazel_rules_postcss_examples//:package.json",
yarn_lock = "@build_bazel_rules_postcss_examples//:yarn.lock",
)

rules_sass_dependencies()
sass_repositories()

postcss_repositories()
4 changes: 2 additions & 2 deletions examples/rtlcss/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:index.bzl", "rtlcss")
load("@build_bazel_rules_postcss//:index.bzl", "rtlcss")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

rtlcss(
name = "rtlcss",
Expand Down
4 changes: 2 additions & 2 deletions examples/sourcemap/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# limitations under the License.

load("@io_bazel_rules_sass//:defs.bzl", "sass_binary")
load("//:index.bzl", "autoprefixer")
load("@build_bazel_rules_postcss//:index.bzl", "autoprefixer")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

AUTO_PREFIXER_BROWSERS = "ie >= 9, edge >= 12, firefox >= 42, chrome >= 32, safari >= 8, opera >= 38, ios_saf >= 9.2, android >= 4.3, and_uc >= 9.9"

Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json → examples/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"strict": true
},
"include": [
"examples/*.ts",
"*_ts/*.ts",
]
}
4 changes: 2 additions & 2 deletions examples/wrapper/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("//:index.bzl", "postcss_binary", "postcss_plugin")
load("@build_bazel_rules_postcss//:index.bzl", "postcss_binary", "postcss_plugin")

package(default_visibility = ["//tests:__subpackages__"])
package(default_visibility = ["//visibility:public"])

postcss_plugin(
name = "rtlcss",
Expand Down
Loading