[topaz][fuchsia][migration] Delete dart_fidl_json as it is not being
used anywhere, other than the test contained within.

Change-Id: I3c35efea29ff333b6f1075ab9eed4def0b3d3460
Reviewed-on: https://fuchsia-review.googlesource.com/c/topaz/+/516201
Reviewed-by: Chase Latta <chaselatta@google.com>
Commit-Queue: Naud Ghebre <naudzghebre@google.com>
diff --git a/bin/dart_fidl_json/dart_fidl_json.gni b/bin/dart_fidl_json/dart_fidl_json.gni
deleted file mode 100644
index b573a73..0000000
--- a/bin/dart_fidl_json/dart_fidl_json.gni
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright 2018 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.
-
-import("//build/compiled_action.gni")
-import("//build/dart/fidlmerge_dart.gni")
-import("//build/dart/toolchain.gni")
-
-# Declares a library that contains Dart JSON serialization/deserialization
-# support for the given FIDL library
-#
-# Parameters
-#
-#   fidl_target (required)
-#     Specifies the fidl target from which to read fidl json. For example,
-#     "//sdk/fidl/fuchsia.setui" for fuchsia.setui.
-#
-#   template_path (optional)
-#     Specifies the template to use to generate the formatting code. Default
-#     //topaz/bin/dart_fidl_json/json.fidlmerge.
-#
-#   amendments_path (optional)
-#     Specifies a JSON file that contains amendments to be made to the fidl
-#     model before the template is applied. For example,
-#     "//garnet/public/build/fostr/fidl/fuchsia.media/amendments.fidlmerge".
-#     See the fidlmerge README for details.
-#
-#   deps, public_deps, test_only, visibility (optional)
-#     These parameters are forwarded to the source_set. This template lists
-#     //garnet/public/lib/fostr and the value of fidl_target as public_deps.
-#
-
-template("json_fidl") {
-  assert(defined(invoker.fidl_target),
-         "json_fidl requires parameter fidl_target.")
-
-  fidl_target = invoker.fidl_target
-
-  template_path = "//topaz/bin/dart_fidl_json/json.fidlmerge"
-  if (defined(invoker.template_path)) {
-    template_path = invoker.template_path
-  }
-
-  fidlmerge_dart(target_name) {
-    forward_variables_from(invoker,
-                           [
-                             "deps",
-                             "testonly",
-                             "visibility",
-                             "amendments_path",
-                           ])
-
-    fidl_target = "$fidl_target"
-
-    template_path = "$template_path"
-
-    generated_source_base = "json"
-
-    if (defined(invoker.additional_include)) {
-      options = "include=${invoker.additional_include}"
-    }
-  }
-}
diff --git a/bin/dart_fidl_json/json.fidlmerge b/bin/dart_fidl_json/json.fidlmerge
deleted file mode 100644
index d7d0370..0000000
--- a/bin/dart_fidl_json/json.fidlmerge
+++ /dev/null
@@ -1,342 +0,0 @@
-{{/*
-
-FidlMerge Template for JSON generation.
-
-*/}}
-
-{{/* Produces the copyright messages for a file header. */}}
-{{/* TODO: variable copyright year. */}}
-{{- define "FileHeader" -}}
-// Copyright 2018 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.
-
-// WARNING: This file is machine generated by fidlmerge.
-// ignore_for_file: prefer_constructors_over_static_methods
-// ignore_for_file: unnecessary_lambdas
-// ignore_for_file: unused_import
-
-{{- end }}
-
-{{- define "FidlInclude" }}
-import 'dart:typed_data';
-import 'package:fidl{{- range .Name.Parts }}_{{ . }}{{ end }}/fidl_async.dart';
-{{ end }}
-
-{{/*
-Generates the dart type from the specified Type as root.
-*/}}
-{{- define "DartType" -}}
-{{- if eq .Kind "identifier" -}}
-{{ template "TypeTemplate" .Identifier }}
-{{- else if eq .Kind "string" -}}
-String
-{{- else if eq .Kind "primitive" -}}
-{{- $type := .PrimitiveSubtype }}
-{{- if eq $type "bool" -}}
-bool
-{{- else if or (eq $type "int32") (eq $type "int8") (eq $type "uint8") (eq $type "int32") (eq $type "int64") (eq $type "uint8") (eq $type "uint16") (eq $type "uint32") (eq $type "uint64") -}}
-int
-{{- else if (eq $type "float32") (eq $type "float64") -}}
-double
-{{- end -}}
-{{- end -}}
-{{- end -}}
-
-{{/*
-Returns the list type for numerical based primitives.
-*/}}
-{{- define "DartNumericalPrimitiveListType" -}}
-{{- if eq . "int8" -}}
-Int8List
-{{- else if eq . "int16" -}}
-Int16List
-{{- else if eq . "int32" -}}
-Int32List
-{{- else if eq . "int64" -}}
-Int64List
-{{- else if eq . "uint8" -}}
-Uint8List
-{{- else if eq . "uint16" -}}
-Uint16List
-{{- else if eq . "uint32" -}}
-Uint32List
-{{- else if eq . "uint64" -}}
-Uint64List
-{{- else if eq . "float32" -}}
-Float32List
-{{- else if eq . "float64" -}}
-Float64List
-{{- end -}}
-{{- end -}}
-
-
-{{/*
-Generates the dart list type from the specified Type as root.
-*/}}
-{{- define "DartListConvertFmt" -}}
-{{- if eq .Kind "primitive" -}}
-{{- $type := .PrimitiveSubtype }}
-{{- if eq $type "bool" -}}
-%s
-{{- else -}}
-{{- printf (execTmpl "DartNumericalPrimitiveListType" $type) }}.fromList(%s)
-{{- end -}}
-{{- else -}}
-%s
-{{- end -}}
-{{- end -}}
-
-
-{{- define "EncodeFmt" -}}
-{{- if eq .Kind "identifier" -}}
-{{- printf "%s.toJson(%%s)" (execTmpl "CvtClassTemplate" .Identifier) -}}
-{{- else -}}
-%s
-{{- end -}}
-{{- end}}
-
-{{- define "DecodeFmt" -}}
-{{- if eq .Kind "identifier" -}}
-{{- printf "%s.fromJson(%%s)" (execTmpl "CvtClassTemplate" .Identifier) -}}
-{{- else -}}
-%s
-{{- end -}}
-{{- end}}
-
-{{/*
-Generates a format string for encoding an object to json. First param is the
-value expression and the second is the converter class.
-*/}}
-{{- define "ListEncodeFmtTemplate" -}}
-{{- $encodeFmt := printf (execTmpl "EncodeFmt" .Type.ElementType) "val" -}}
-{{- printf "%%s?.map((val)=>%s)?.toList()" $encodeFmt -}}
-{{- end -}}
-
-{{/*
-Generates a format string for encoding an object to json. First param is the
-value expression for the json object, the second is the converter class, and the
-third is dart type.
-*/}}
-{{- define "ListDecodeFmtTemplate" -}}
-{{- $decodeFmt := printf (execTmpl "DecodeFmt" .Type.ElementType) "val" -}}
-{{- $convert := printf "%%s?.map((val)=>%1s)?.cast<%2s>()?.toList()" $decodeFmt (execTmpl "DartType" .Type.ElementType) -}}
-{{- printf (execTmpl "DartListConvertFmt" .Type.ElementType) $convert -}}
-{{- end -}}
-
-{{/*
-Generates Dart class name from fidl type. Root object is the type identifier.
-*/}}
-{{- define "TypeTemplate" }}{{ toUpperCamelCase .Parts.Name }}{{- end }}
-
-{{/*
-Generates Dart converter class name from fidl type. Root object is the type identifier.
-*/}}
-{{- define "CvtClassTemplate" }}{{ template "TypeTemplate" . }}Converter{{- end }}
-
-{{/*
-Generates JSON encoding expression format for the given member type.
-*/}}
-{{- define "EncodeMember" -}}
-{{- if or (eq .Type.Kind "vector") (eq .Type.Kind "array") -}}
-{{ template "ListEncodeFmtTemplate" . }}
-{{- else -}}
-{{ template "EncodeFmt" .Type }}
-{{- end -}}
-{{- end -}}
-
-{{/*
-Generates JSON decoding expression format for the given member type.
-*/}}
-{{- define "DecodeMember" -}}
-{{- if or (eq .Type.Kind "vector") (eq .Type.Kind "array") -}}
-{{ template "ListDecodeFmtTemplate" . }}
-{{- else -}}
-{{ template "DecodeFmt" .Type }}
-{{- end -}}
-{{- end -}}
-
-{{- define "EnumConverterDecls" }}
-  {{- range .Enums }}
-{{- $type := execTmpl "TypeTemplate" .Name }}
-class {{ $type }}Converter {
-  static Object toJson(Object enumVal) {
-    if (!(enumVal is {{ $type }})) {
-      return null;
-    }
-    final Map<String, dynamic> map = {};
-    switch(enumVal) {
-    {{- range .Members }}
-      {{- $val := toLowerCamelCase .Name }}
-      case {{ $type }}.{{ $val }}:
-        map['value'] = '{{.Name}}';
-        break;
-    {{- end}}
-    }
-    return map;
-  }
-
-  static {{ $type }} fromJson(Map<String, dynamic> json) {
-    if (json == null || !json.containsKey('value')) {
-      return null;
-    }
-
-    switch(json['value']) {
-    {{- range .Members }}
-      {{- $val := toLowerCamelCase .Name }}
-      case '{{.Name}}':
-        return {{ $type }}.{{ $val }};
-    {{- end}}
-    }
-
-    return null;
-  }
-}
-{{ end }}
-{{- end }}
-
-{{- define "TableConverterDecls" }}
-  {{- range .Tables }}
-{{- if eq .TypeShapeV1.MaxHandles 0 }}
-{{ $type := execTmpl "TypeTemplate" .Name }}
-{{ $className := (execTmpl "CvtClassTemplate" .Name) }}
-class {{ $className}} {
-  static Object toJson(Object tableVal) {
-    if (tableVal is {{ $type }}) {
-      return {
-      {{- range .Members }}
-        {{- if not .Reserved }}
-        {{- $member_name := toLowerCamelCase .Name }}
-        {{- $value_expr := printf "tableVal.%s" $member_name }}
-        '{{ .Name }}': {{ printf (execTmpl "EncodeMember" .) $value_expr }},
-        {{- end }}
-      {{- end }}
-      };
-    }
-    return null;
-  }
-
-  static {{ $type }} fromJson(Map<String, dynamic> json) {
-    if (json == null) {
-      return null;
-    }
-
-    return {{ $type }}(
-{{- range .Members }}
-  {{- if eq .Reserved false }}
-  {{- $jsonVal := printf "json['%s']" .Name }}
-      {{ toLowerCamelCase .Name}}: {{ $jsonVal }} != null ? {{ printf (execTmpl "DecodeMember" .) $jsonVal }} : null,
-  {{- end }}
-{{- end }}
-    );
-  }
-}
-
-{{- end }}
-  {{- end }}
-{{- end }}
-
-{{- define "StructConverterDecls" }}
-  {{- range .Structs }}
-{{- if eq .TypeShapeV1.MaxHandles 0 }}
-{{ $type := execTmpl "TypeTemplate" .Name }}
-{{ $className := (execTmpl "CvtClassTemplate" .Name) }}
-class {{ $className }} {
-  static Object toJson(Object structVal) {
-    if (structVal is {{ $type }}) {
-      return {
-      {{- range .Members }}
-        {{- $member_name := toLowerCamelCase .Name }}
-        {{- $value_expr := printf "structVal.%s" $member_name }}
-          '{{ .Name }}': {{ printf (execTmpl "EncodeMember" .) $value_expr }},
-      {{- end }}
-      };
-    }
-
-    return null;
-  }
-
-  static {{ $type }} fromJson(Map<String, dynamic> json) {
-    if (json == null) {
-      return null;
-    }
-
-    return {{ $type }}(
-{{- range .Members }}
-  {{- $jsonVal := printf "json['%s']" .Name }}
-      {{ toLowerCamelCase .Name}}: {{ $jsonVal }} != null ? {{ printf (execTmpl "DecodeMember" .) $jsonVal }} : null,
-{{- end }}
-    );
-  }
-}
-{{- end }}
-{{- end }}
-{{- end }}
-
-{{- define "UnionConverterDecls" -}}
-  {{- range . -}}
-{{- if eq .TypeShapeV1.MaxHandles 0 }}
-{{- $type := execTmpl "TypeTemplate" .Name }}
-{{- $typeKey := "type" }}
-{{- $valueKey := "value" }}
-{{- $className := (execTmpl "CvtClassTemplate" .Name) }}
-class {{ $className }} {
-  static Object toJson(Object unionVal) {
-    if (unionVal is {{ $type }}) {
-      switch(unionVal.$tag) {
-      {{- if .IsFlexible }}
-        case {{ $type }}Tag.$unknown:
-          return {
-            '{{ $typeKey }}': '{{ .Name }}',
-            '{{ $valueKey }}': '<UNKNOWN>',
-          };
-      {{- end }}
-      {{- range .Members }}
-        {{- $member_name := toLowerCamelCase .Name }}
-         {{- $value_expr := print "unionVal." $member_name }}
-        case {{ $type }}Tag.{{ $member_name }}:
-          return {
-            '{{ $typeKey }}': '{{ .Name }}',
-            '{{ $valueKey }}': {{ printf (execTmpl "EncodeMember" .) $value_expr }},
-          };
-      {{- end }}
-      }
-    }
-
-    return null;
-  }
-
-  static {{ $type }} fromJson(Map<String, dynamic> json) {
-    if (json == null) {
-      return null;
-    }
-
-    switch(json['{{ $typeKey }}']) {
-    {{- range .Members }}
-         {{- $member_ctor := printf "%s.with%s" $type (toUpperCamelCase .Name) -}}
-         {{- $jsonVal := printf "json['%s']" $valueKey }}
-      case '{{ .Name }}':
-        return {{ $member_ctor}}({{ printf (execTmpl "DecodeMember" .) $jsonVal }});
-    {{- end }}
-    }
-
-    return null;
-  }
-}
-{{ end }}
-{{- end }}
-{{- end }}
-
-{{- define "ImplementationFile" }}
-  {{- template "FileHeader" . }}
-  {{- template "FidlInclude" . }}
-  {{- template "EnumConverterDecls" . }}
-  {{- template "UnionConverterDecls" .Unions }}
-  {{- template "StructConverterDecls" . }}
-  {{- template "TableConverterDecls" . }}
-{{- end }}
-
-{{- define "Main" }}
-  {{- $file_path := .Output ".dart" }}
-  {{- .Generate $file_path "ImplementationFile" . }}
-{{- end }}
diff --git a/bin/dart_fidl_json/test/BUILD.gn b/bin/dart_fidl_json/test/BUILD.gn
deleted file mode 100644
index 4000033..0000000
--- a/bin/dart_fidl_json/test/BUILD.gn
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright 2018 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.
-
-import("//build/dart/test.gni")
-import("//topaz/bin/dart_fidl_json/dart_fidl_json.gni")
-
-json_fidl("dart_fidl_json_test_fidl_json") {
-  fidl_target = "//topaz//bin/dart_fidl_json/test/fidl/dart.fidl.json.test"
-
-  deps = [ "//topaz//bin/dart_fidl_json/test/fidl/dart.fidl.json.test" ]
-}
-
-dart_test("dart_fidl_json_test") {
-  sources = [ "json_test.dart" ]
-
-  deps = [
-    ":dart_fidl_json_test_fidl_json",
-    "//third_party/dart-pkg/pub/test",
-    "//topaz/bin/dart_fidl_json/test/fidl/dart.fidl.json.test",
-  ]
-}
diff --git a/bin/dart_fidl_json/test/analysis_options.yaml b/bin/dart_fidl_json/test/analysis_options.yaml
deleted file mode 100644
index d981466..0000000
--- a/bin/dart_fidl_json/test/analysis_options.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright 2018 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.
-
-include: ../../analysis_options.yaml
-
diff --git a/bin/dart_fidl_json/test/fidl/dart.fidl.json.test/BUILD.gn b/bin/dart_fidl_json/test/fidl/dart.fidl.json.test/BUILD.gn
deleted file mode 100644
index a8d10a8..0000000
--- a/bin/dart_fidl_json/test/fidl/dart.fidl.json.test/BUILD.gn
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2018 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.
-
-import("//build/fidl/fidl.gni")
-
-fidl("dart.fidl.json.test") {
-  # TODO(fxb/35879): Remove lint exclusions by fixing known FIDL lint violations in this target
-  excluded_checks = [
-    "invalid-case-for-constant",
-    "invalid-copyright-for-platform-source-library",
-    "string-bounds-not-specified",
-    "too-many-nested-libraries",
-    "vector-bounds-not-specified",
-  ]
-
-  name = "test.dart.fidl.json"
-  sources = [ "types.test.fidl" ]
-}
diff --git a/bin/dart_fidl_json/test/fidl/dart.fidl.json.test/types.test.fidl b/bin/dart_fidl_json/test/fidl/dart.fidl.json.test/types.test.fidl
deleted file mode 100644
index fcc8896..0000000
--- a/bin/dart_fidl_json/test/fidl/dart.fidl.json.test/types.test.fidl
+++ /dev/null
@@ -1,36 +0,0 @@
-library test.dart.fidl.json;
-
-struct ExampleStruct {
-  string foo;
-  int32 bar;
-  vector<ExampleStruct2> structs;
-  vector<string> vals;
-  vector<uint32> integers;
-};
-
-struct ExampleStruct2 {
-  int32 baz;
-};
-
-union ExampleUnion {
-  1: ExampleStruct struct1;
-  2: ExampleStruct2 struct2;
-};
-
-flexible union ExampleXUnion {
-  1: ExampleStruct struct1;
-  2: ExampleStruct2 struct2;
-  3: int32 bar;
-};
-
-enum ExampleEnum {
-  val1 = 1;
-  val2 = 2;
-  val3 = 3;
-};
-
-table ExampleTable {
-  1: string foo;
-  2: reserved;
-  3: int32 bar;
-};
diff --git a/bin/dart_fidl_json/test/pubspec.yaml b/bin/dart_fidl_json/test/pubspec.yaml
deleted file mode 100644
index 5f795ce..0000000
--- a/bin/dart_fidl_json/test/pubspec.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2018 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.
-
-name: dart_fidl_json_test
diff --git a/bin/dart_fidl_json/test/test/json_test.dart b/bin/dart_fidl_json/test/test/json_test.dart
deleted file mode 100644
index b6de337..0000000
--- a/bin/dart_fidl_json/test/test/json_test.dart
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2018 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.
-import 'dart:convert';
-import 'dart:typed_data';
-
-import 'package:fidl_dart_fidl_json_test_fidl_json/json.dart';
-import 'package:fidl_test_dart_fidl_json/fidl_async.dart';
-import 'package:test/test.dart';
-
-void main() {
-  // Ensure enum encode/decode.
-  test('test_enum', () async {
-    const ExampleEnum sourceEnum = ExampleEnum.val1;
-
-    expect(
-        ExampleEnumConverter.fromJson(
-            jsonDecode(jsonEncode(ExampleEnumConverter.toJson(sourceEnum)))),
-            sourceEnum);
-  });
-
-  // Ensure struct encode/decode.
-  test('test_struct', () async {
-    ExampleStruct struct = ExampleStruct(
-        bar: 1,
-        foo: 'test',
-        structs: null,
-        vals: ['foo', 'bar'],
-        integers: Uint32List.fromList([1, 2]));
-
-    expect(
-        struct,
-        ExampleStructConverter.fromJson(
-            jsonDecode(jsonEncode(ExampleStructConverter.toJson(struct)))));
-
-    ExampleStruct structWithVector = ExampleStruct(
-        bar: 1,
-        foo: 'test',
-        structs: [ExampleStruct2(baz: 2)],
-        vals: ['foo'],
-        integers: Uint32List.fromList([3, 4]));
-    expect(
-        structWithVector,
-        ExampleStructConverter.fromJson(jsonDecode(
-            jsonEncode(ExampleStructConverter.toJson(structWithVector)))));
-  });
-
-  // Ensure union encode/decode.
-  test('test_union', () async {
-    const ExampleUnion exampleUnion = ExampleUnion.withStruct1(ExampleStruct(
-        bar: 1, foo: 'test', structs: null, vals: null, integers: null));
-
-    expect(
-        exampleUnion,
-        ExampleUnionConverter.fromJson(jsonDecode(
-            jsonEncode(ExampleUnionConverter.toJson(exampleUnion)))));
-  });
-
-  // Ensure xunion encode/decode.
-  test('test_xunion', () async {
-    const ExampleXUnion exampleUnion = ExampleXUnion.withStruct1(ExampleStruct(
-        bar: 1, foo: 'test', structs: null, vals: null, integers: null));
-
-    expect(
-        exampleUnion,
-        ExampleXUnionConverter.fromJson(jsonDecode(
-            jsonEncode(ExampleXUnionConverter.toJson(exampleUnion)))));
-  });
-
-  // Ensure table encode/decode.
-  test('test_table', () async {
-    const ExampleTable exampleTable = ExampleTable(bar: 1, foo: 'test');
-
-    expect(
-        exampleTable,
-        ExampleTableConverter.fromJson(jsonDecode(
-            jsonEncode(ExampleTableConverter.toJson(exampleTable)))));
-  });
-}