-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0b6be3d
Showing
15 changed files
with
575 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
4.2.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: build | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-latest, macos-latest ] | ||
bazel: [ "4.2.1", "5.0.0-pre.20210929.1" ] | ||
java: [ 11, 17 ] | ||
runs-on: ${{ matrix.os }} | ||
name: OS ${{ matrix.os }} bazel ${{ matrix.bazel }} java ${{ matrix.java }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
- name: Set Bazelisk Version ${{ matrix.bazel }} | ||
run: | | ||
echo ${{ matrix.bazel }} > .bazelversion | ||
- name: Build | ||
run: | | ||
./baseliskw build //... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/.idea/ | ||
/bazel-* | ||
/.ijwb | ||
/.DS_Store | ||
/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library", "nodejs_binary") | ||
load("@npm//typescript:index.bzl", "tsc") | ||
|
||
genrule( | ||
name = "gen", | ||
outs = ["index.ts"], | ||
cmd = """ | ||
cat >$@ <<EOL | ||
import some from "lib_a"; | ||
some(); | ||
""", | ||
) | ||
|
||
tsc( | ||
name = "tsc", | ||
outs = ["index.js"], | ||
args = [ | ||
"-p", | ||
"$(execpath //:tsconfig.json)", | ||
"--outDir", | ||
"$(RULEDIR)", | ||
], | ||
data = [ | ||
":gen", | ||
"//:tsconfig.json", | ||
"//lib_a:lib", | ||
"@npm//@types/node", | ||
], | ||
) | ||
|
||
js_library( | ||
name = "lib", | ||
srcs = [":tsc"], | ||
) | ||
|
||
nodejs_binary( | ||
name = "bin", | ||
data = [":lib"], | ||
entry_point = ":index.js", | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# bazel-js-showcase | ||
|
||
Update package-lock.json: | ||
```shell | ||
bazel run @nodejs//:npm -- install | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
workspace(name = "bazel-js-showcase") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "build_bazel_rules_nodejs", | ||
sha256 = "4e1a5633267a0ca1d550cced2919dd4148575c0bafd47608b88aea79c41b5ca3", | ||
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/4.2.0/rules_nodejs-4.2.0.tar.gz"], | ||
) | ||
|
||
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "npm_install") | ||
|
||
node_repositories( | ||
node_version = "16.0.0", | ||
) | ||
|
||
npm_install( | ||
name = "npm", | ||
exports_directories_only = True, | ||
package_json = "//:package.json", | ||
package_lock_json = "//:package-lock.json", | ||
symlink_node_modules = False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/usr/bin/env sh | ||
|
||
############################################################################## | ||
## | ||
## Bazel start up script for UN*X (based on gradlew script from gradle wrapper project) | ||
## | ||
## | ||
############################################################################## | ||
|
||
# Attempt to set APP_HOME | ||
# Resolve links: $0 may be a link | ||
PRG="$0" | ||
# Need this for relative symlinks. | ||
while [ -h "$PRG" ] ; do | ||
ls=`ls -ld "$PRG"` | ||
link=`expr "$ls" : '.*-> \(.*\)$'` | ||
if expr "$link" : '/.*' > /dev/null; then | ||
PRG="$link" | ||
else | ||
PRG=`dirname "$PRG"`"/$link" | ||
fi | ||
done | ||
SAVED="`pwd`" | ||
cd "`dirname \"$PRG\"`/" >/dev/null | ||
APP_HOME="`pwd -P`" | ||
cd "$SAVED" >/dev/null | ||
|
||
APP_NAME="bazelisk" | ||
APP_BASE_NAME=`basename "$0"` | ||
|
||
warn () { | ||
echo "$*" | ||
} | ||
|
||
die () { | ||
echo | ||
echo "$*" | ||
echo | ||
exit 1 | ||
} | ||
|
||
## Determine OS. | ||
darwin=false | ||
linux=false | ||
|
||
case "`uname`" in | ||
Darwin* ) | ||
darwin=true | ||
;; | ||
Linux* ) | ||
linux=true | ||
;; | ||
esac | ||
|
||
BINARY_PATH="" | ||
if $darwin; then | ||
BINARY_PATH=bazelisk-darwin-amd64 | ||
elif $linux; then | ||
BINARY_PATH=bazelisk-linux-amd64 | ||
else | ||
die "UNSUPPORTED OS! Command 'uname' says: `uname`. 'darwin' = $darwin and 'linux' = $linux" | ||
fi | ||
|
||
|
||
exec "$APP_HOME/bazelisk/$BINARY_PATH" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
directories: | ||
. | ||
|
||
derive_targets_from_directories: true | ||
|
||
additional_languages: | ||
typescript | ||
javascript |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
load("@build_bazel_rules_nodejs//:index.bzl", "js_library") | ||
|
||
js_library( | ||
name = "lib", | ||
srcs = ["index.js"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const some = () => { | ||
console.log('some'); | ||
}; | ||
|
||
exports.some = some; |
Oops, something went wrong.