Skip to content
This repository has been archived by the owner on Sep 16, 2021. It is now read-only.

Fix devserver on windows #327

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f253579
Use native.sh_binary for cross-platform ts_devserver
filipesilva Sep 24, 2018
dfea264
Use runfiles resolution in ts_devserver
filipesilva Sep 24, 2018
d47b47d
Resolve all devserver files using runfiles manifest
devversion Nov 24, 2018
a81355e
Support index.html files in subdirectories on windows
devversion Dec 21, 2018
7c51ca3
Properly handle directories for symlinked runfiles in devserver
devversion Nov 26, 2018
dc1eee9
Update gazelle and properly resolve Go runfile library
devversion Nov 26, 2018
d5b6ee3
Add workaround for specifying serving_path on windows.
devversion Nov 27, 2018
6436d0d
Do not resolve entry_module as runfile
devversion Dec 26, 2018
4119d69
Support serving runfiles through absolute manifest path
devversion Dec 28, 2018
2f6f2f1
fixup! Resolve all devserver files using runfiles manifest
devversion Jan 10, 2019
04ad329
fixup! Resolve all devserver files using runfiles manifest
devversion Jan 13, 2019
7ad2cd0
Fixes for golint and refactoring for g3
mgechev Jan 14, 2019
4defde8
Refactor Runfile invocation and fix golint errors
mgechev Jan 14, 2019
31d196f
Refactor Runfile invocation and fix golint errors
mgechev Jan 14, 2019
ff3fd3c
fixup! Refactor Runfile invocation and fix golint errors
devversion Jan 15, 2019
93b834f
fixup! Refactor Runfile invocation and fix golint errors
devversion Jan 15, 2019
cc1a219
Update method name
mgechev Jan 15, 2019
2e761b5
Do not depend on external rules_go package
mgechev Jan 16, 2019
1bf1739
Add logic to resolve runfiles within G3 without using external runfil…
devversion Jan 17, 2019
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
Prev Previous commit
Next Next commit
Refactor Runfile invocation and fix golint errors
  • Loading branch information
mgechev committed Jan 14, 2019
commit 31d196fdfa61991f0a0578a7053820e8ed458999
7 changes: 5 additions & 2 deletions devserver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@ package(default_visibility = ["//visibility:public"])

go_library(
name = "go_default_library",
srcs = ["main.go", "runfile-filesystem.go"],
srcs = [
"main.go",
"runfile-filesystem.go",
],
importpath = "github.com/bazelbuild/rules_typescript/devserver",
visibility = ["//visibility:private"],
deps = [
"//devserver/concatjs:go_default_library",
"//devserver/devserver:go_default_library",
"//devserver/util:go_default_library",
"//devserver/utils:go_default_library",
],
)

Expand Down
12 changes: 6 additions & 6 deletions devserver/concatjs/concatjs.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ type FileSystem interface {
ResolvePath(root string, file string) (string, error)
}

// realFileSystem implements FileSystem by actual disk access.
type RealFileSystem struct {}
// RealFileSystem implements FileSystem by actual disk access.
type RealFileSystem struct{}

// Gets the last modification time of the specified file.
// StatMtime gets the last modification time of the specified file.
func (fs *RealFileSystem) StatMtime(filename string) (time.Time, error) {
devversion marked this conversation as resolved.
Show resolved Hide resolved
s, err := os.Stat(filename)
if err != nil {
Expand All @@ -113,17 +113,17 @@ func (fs *RealFileSystem) StatMtime(filename string) (time.Time, error) {
return s.ModTime(), nil
}

// Reads the specified file using the real filesystem.
// ReadFile reads the specified file using the real filesystem.
func (fs *RealFileSystem) ReadFile(filename string) ([]byte, error) {
devversion marked this conversation as resolved.
Show resolved Hide resolved
return ioutil.ReadFile(filename)
}

// Resolves the specified path within a given root by joining root and the filepath.
// ResolvePath resolves the specified path within a given root by joining root and the filepath.
// This is only works if the specified file is located within the given root in the
// real filesystem. This does not work in Bazel where requested files aren't always
// located within the specified root. Files would need to be resolved as runfiles.
func (fs *RealFileSystem) ResolvePath(root string, file string) (string, error) {
devversion marked this conversation as resolved.
Show resolved Hide resolved
return filepath.Join(root, file), nil;
return filepath.Join(root, file), nil
}

// FileCache caches a set of files in memory and provides a single
Expand Down
2 changes: 1 addition & 1 deletion devserver/devserver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go_library(
name = "go_default_library",
srcs = ["devserver.go"],
deps = [
"//devserver/util:go_default_library",
"//devserver/utils:go_default_library",
],
importpath = "github.com/bazelbuild/rules_typescript/devserver/devserver",
visibility = ["//visibility:public"],
Expand Down
2 changes: 1 addition & 1 deletion devserver/devserver/test/test-workspace/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ filegroup(
name = "sources",
srcs = glob(["**/*"]),
visibility = ["//visibility:public"],
)
)
2 changes: 1 addition & 1 deletion devserver/utils/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ go_library(
],
importpath = "github.com/bazelbuild/rules_typescript/devserver/utils",
visibility = ["//visibility:public"],
)
)
18 changes: 9 additions & 9 deletions examples/devserver/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ ts_devserver(
"build_bazel_rules_typescript/examples/devserver/",
],
static_files = [
# Files you want to import from the "additional_root_paths", still need to be explicitly specified
# as files that should be served. The root paths just make it more convenient to import those dependencies.
"@npm//tslib",
":say-hello",
":print-host",
":index.html",
# Files you want to import from the "additional_root_paths", still need to be explicitly specified
# as files that should be served. The root paths just make it more convenient to import those dependencies.
"@npm//tslib",
":say-hello",
":print-host",
":index.html",
],
# Dependencies that produce JavaScript output will be automatically picked up by ConcatJS and will be
# part of the serving_path bundle.
Expand All @@ -33,11 +33,11 @@ ts_devserver(
genrule(
name = "say-hello",
outs = ["say-hello.js"],
cmd = "echo 'console.log(\"Hello!\")' > $@"
cmd = "echo 'console.log(\"Hello!\")' > $@",
)

genrule(
name = "print-host",
outs = ["test/print-host.js"],
cmd = "echo 'console.log(location.host)' > $@"
)
cmd = "echo 'console.log(location.host)' > $@",
)
2 changes: 1 addition & 1 deletion internal/devserver/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package(default_visibility = [
])

exports_files([
"ts_devserver.bzl", # Exported to be consumed for generating skydoc.
"ts_devserver.bzl", # Exported to be consumed for generating skydoc.
"launcher_template.sh",
])

Expand Down