Rename LLCPP tab to C++
This CL renames the editor tab "LLCPP" to "C++", and changes the string
identifier representing it from "llcpp" to "cpp". It decodes "llcpp"
into "cpp" on the client (from localStorage) and server (from client).
Test: manually tested loading new client with "llcpp" in localStorage
Test: manually tested old client on LLCPP tab with new server
Bug: 106610
Change-Id: I788ab913757a8a1ec06826bdebb3b7a4bcdc6649
Reviewed-on: https://fuchsia-review.googlesource.com/c/fidlbolt/+/711102
Reviewed-by: Yifei Teng <yifeit@google.com>
diff --git a/README.md b/README.md
index fdeb0c1..c3a03d7 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
To run a local fidlbolt server:
1. Follow the [Fuchsia: Get Started][fuchsia] guide.
-2. Build FIDL tools: `fx build host_x64/{fidlc,fidlgen_{llcpp,hlcpp,rust,go,dart}} zircon/tools`.
+2. Build FIDL tools: `fx build host_x64/{fidlc,fidlgen_{cpp,hlcpp,rust,go,dart}} zircon/tools`.
3. Ensure that you have [Go][] and [Node.js][] installed.
4. Build and run with `make run`.
5. View the app at `http://localhost:8080`.
diff --git a/backend/analyze_test.go b/backend/analyze_test.go
new file mode 100644
index 0000000..66cf657
--- /dev/null
+++ b/backend/analyze_test.go
@@ -0,0 +1,10 @@
+// Copyright 2020 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package main
+
+import "testing"
+
+func TestLibraryCacheGet(t *testing.T) {
+}
diff --git a/backend/server.go b/backend/server.go
index f177417..cf57363 100644
--- a/backend/server.go
+++ b/backend/server.go
@@ -20,7 +20,7 @@
// Deployment information, or nil.
deployment *deployment
// External programs used by fidlbolt.
- fidlFormat, fidlLint, fidlc, fidlgenLlcpp, fidlgenHlcpp, fidlgenRust,
+ fidlFormat, fidlLint, fidlc, fidlgenCpp, fidlgenHlcpp, fidlgenRust,
fidlgenGo, fidlgenDart, clangFormat, rustfmt program
// External files used by fidlbolt.
rustfmtToml string
@@ -56,7 +56,7 @@
if err != nil {
return nil, err
}
- s.fidlgenLlcpp, err = findProgram("fidlgen_llcpp", bin)
+ s.fidlgenCpp, err = findProgram("fidlgen_cpp", bin)
if err != nil {
return nil, err
}
@@ -204,6 +204,7 @@
Bytes mode = "bytes"
BytesPlus mode = "bytes+"
C mode = "c"
+ CPP mode = "cpp"
Dart mode = "dart"
Diff mode = "diff"
FIDL mode = "fidl"
@@ -211,7 +212,6 @@
Go mode = "go"
HLCPP mode = "hlcpp"
JSON mode = "json"
- LLCPP mode = "llcpp"
Rust mode = "rust"
)
@@ -228,7 +228,7 @@
FIDL: {},
JSON: {},
C: {},
- LLCPP: {},
+ CPP: {},
HLCPP: {},
Rust: {},
Go: {},
@@ -247,6 +247,20 @@
},
}
+func (m *mode) UnmarshalJSON(data []byte) error {
+ var s string
+ if err := json.Unmarshal(data, &s); err != nil {
+ return err
+ }
+ // TODO(fxbug.dev/106610): This is kept for backwards compatibility with old
+ // clients. Remove this eventually.
+ if s == "llcpp" {
+ s = "cpp"
+ }
+ *m = mode(s)
+ return nil
+}
+
// validate validates a request. Once validated, any errors in processing the
// request are considered internal server errors.
func (r *request) validate() error {
@@ -266,7 +280,7 @@
}
// TODO(fxbug.dev/93781): Instead of identifiers like "header" and "source",
- // use actual file names, as we have started doing for LLCPP.
+ // use actual file names, as we have started doing for C++.
switch r.OutputMode {
case JSON:
switch r.Options.File {
@@ -280,7 +294,7 @@
default:
return fmt.Errorf("invalid HLCPP file option: %q", r.Options.File)
}
- case LLCPP:
+ case CPP:
switch r.Options.File {
case "common_types.h", "markers.h", "wire_types.h",
"wire_types.cc", "wire.h", "wire_messaging.h",
@@ -292,7 +306,7 @@
"type_conversions.cc":
case "tables":
default:
- return fmt.Errorf("invalid LLCPP file option: %q", r.Options.File)
+ return fmt.Errorf("invalid C++ file option: %q", r.Options.File)
}
case C:
switch r.Options.File {
@@ -412,7 +426,7 @@
}
switch r.OutputMode {
- case C, LLCPP, HLCPP:
+ case C, CPP, HLCPP:
if r.Options.File == "tables" {
return fidlc("--tables", "/dev/stdout")
}
@@ -517,8 +531,8 @@
default:
return "", fmt.Errorf("invalid file: %q", r.Options.File)
}
- case LLCPP:
- if _, err := s.fidlgenLlcpp.runInfallible(ctx,
+ case CPP:
+ if _, err := s.fidlgenCpp.runInfallible(ctx,
"-json", jsonIR,
"-root", temp.path,
"-clang-format-path", s.clangFormat.path,
diff --git a/backend/system.go b/backend/system.go
index 0e4ea12..3f5720d 100644
--- a/backend/system.go
+++ b/backend/system.go
@@ -39,7 +39,7 @@
return "", fmt.Errorf("cannot find %s (searched in %s)", name, strings.Join(dirs, ", "))
}
-/// runResult stores the result of running a program.
+// runResult stores the result of running a program.
type runResult struct {
// True if the exit code is zero, false otherwise.
success bool
diff --git a/frontend/src/elm/Mode.elm b/frontend/src/elm/Mode.elm
index 8054f83..fb21bf1 100644
--- a/frontend/src/elm/Mode.elm
+++ b/frontend/src/elm/Mode.elm
@@ -57,6 +57,7 @@
= Bytes
| BytesPlus
| C
+ | Cpp
| Dart
| Diff
| Fidl
@@ -64,7 +65,6 @@
| Go
| Hlcpp
| Json
- | Llcpp
| Rust
@@ -77,7 +77,7 @@
outputs input =
case input of
Fidl ->
- [ Fidl, Json, C, Llcpp, Hlcpp, Rust, Go, Dart ]
+ [ Fidl, Json, C, Cpp, Hlcpp, Rust, Go, Dart ]
FidlText ->
-- TODO(mkember): Add BytesPlus once implemented.
@@ -219,11 +219,11 @@
]
]
- -- TODO(fxbug.dev/93781): Since LLCPP has so many files, we are
+ -- TODO(fxbug.dev/93781): Since C++ has so many files, we are
-- using the real filenames rather than coming up with "Sentence
-- case names" for each one. We should change the other ones to
-- be consistent (and eventually not hardcode any of this).
- ( Fidl, Llcpp ) ->
+ ( Fidl, Cpp ) ->
[ files ( "common_types.h", "common_types.h" )
[ ( "markers.h", "markers.h" )
, ( "wire_types.h", "wire_types.h" )
@@ -249,8 +249,8 @@
-- "tables.c" in the dropdown, but still passing the
-- identifier "tables" to the backend like all other
-- bindings. Although coding tables aren't produced by
- -- fidlgen_llcpp, they are used by LLCPP, and the idea
- -- was to include all files related to that binding.
+ -- fidlgen_cpp, they're used by its bindings, and the
+ -- idea was to include all related files.
, ( "tables", "tables.c" )
]
]
@@ -373,6 +373,9 @@
C ->
"c"
+ Cpp ->
+ "cpp"
+
Dart ->
"dart"
@@ -394,9 +397,6 @@
Json ->
"json"
- Llcpp ->
- "llcpp"
-
Rust ->
"rust"
@@ -413,6 +413,9 @@
"c" ->
Just C
+ "cpp" ->
+ Just Cpp
+
"dart" ->
Just Dart
@@ -434,8 +437,10 @@
"json" ->
Just Json
+ -- TODO(fxbug.dev/106610): This is kept for backwards compatibility to
+ -- decode editor state saved in localStorage. Remove this eventually.
"llcpp" ->
- Just Llcpp
+ Just Cpp
"rust" ->
Just Rust
@@ -456,6 +461,9 @@
C ->
"C"
+ Cpp ->
+ "C++"
+
Dart ->
"Dart"
@@ -477,8 +485,5 @@
Json ->
"JSON"
- Llcpp ->
- "LLCPP"
-
Rust ->
"Rust"
diff --git a/frontend/src/mode.ts b/frontend/src/mode.ts
index 6a7de1f..8ebd5ea 100644
--- a/frontend/src/mode.ts
+++ b/frontend/src/mode.ts
@@ -5,6 +5,7 @@
| 'bytes+'
| 'bytes'
| 'c'
+ | 'cpp'
| 'dart'
| 'diff'
| 'fidl'
@@ -12,7 +13,6 @@
| 'go'
| 'hlcpp'
| 'json'
- | 'llcpp'
| 'rust';
export type InputMode = 'fidl' | 'fidltext' | 'bytes';
@@ -50,6 +50,7 @@
'bytes+': 'text',
bytes: 'bytes',
c: 'c_cpp',
+ cpp: 'c_cpp',
dart: 'dart',
diff: 'text',
fidl: 'fidl',
@@ -57,7 +58,6 @@
go: 'golang',
hlcpp: 'c_cpp',
json: 'json',
- llcpp: 'c_cpp',
rust: 'rust',
};
diff --git a/prepare_deployment.sh b/prepare_deployment.sh
index 637aec9..d9a6236 100755
--- a/prepare_deployment.sh
+++ b/prepare_deployment.sh
@@ -87,10 +87,10 @@
"fidl-format"
"fidl-lint"
"fidlc"
+ "fidlgen_cpp"
"fidlgen_dart"
"fidlgen_go"
"fidlgen_hlcpp"
- "fidlgen_llcpp"
"fidlgen_rust"
)