# Copyright 2020 The Chromium 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/config/python.gni") import("//testing/libfuzzer/fuzzer_test.gni") source_set("unit_tests") { testonly = true sources = [ "extractor_unittest.cc", "generate_schema_org_code_unittest.cc", "validator_unittest.cc", ] deps = [ ":extractor", ":generate_schema_org_code", ":schema_org", ":schema_org_properties", "//base", "//base/test:test_support", "//components/schema_org/common:improved_mojom", "//services/data_decoder/public/cpp:test_support", "//testing/gmock", "//testing/gtest", ] } executable("schema_org_name_generator") { sources = [ "schema_org_name_generator.cc" ] deps = [ "//base", "//url", ] } compiled_action("schema_org_name_data") { tool = ":schema_org_name_generator" args = [ rebase_path("//third_party/schema_org/schema.jsonld", root_build_dir), rebase_path("//third_party/schema_org/overrides.jsonld", root_build_dir), rebase_path("$target_gen_dir/schema_org_name_data.json", root_build_dir), ] inputs = [ "//third_party/schema_org/schema.jsonld", "//third_party/schema_org/overrides.jsonld", ] outputs = [ "$target_gen_dir/schema_org_name_data.json" ] } # TODO(crbug.com/1112471): Get this to run cleanly under Python 3. python2_action("generate_schema_org_code") { script = "//components/schema_org/generate_schema_org_code.py" sources = [ "templates/schema_org_entity_names.cc.tmpl", "templates/schema_org_entity_names.h.tmpl", "templates/schema_org_enums.cc.tmpl", "templates/schema_org_enums.h.tmpl", "templates/schema_org_property_configurations.cc.tmpl", "templates/schema_org_property_configurations.h.tmpl", "templates/schema_org_property_names.cc.tmpl", "templates/schema_org_property_names.h.tmpl", ] args = [ "--schema-file", rebase_path("//third_party/schema_org/schema.jsonld", root_build_dir), "--overrides-file", rebase_path("//third_party/schema_org/overrides.jsonld", root_build_dir), "--name-file", rebase_path("$target_gen_dir/schema_org_name_data.json", root_build_dir), "--output-dir", rebase_path("$target_gen_dir", root_build_dir), "--templates", ] + sources inputs = [ "//third_party/schema_org/schema.jsonld", "//third_party/schema_org/overrides.jsonld", ] outputs = [ "$target_gen_dir/schema_org_entity_names.h", "$target_gen_dir/schema_org_entity_names.cc", "$target_gen_dir/schema_org_property_configurations.h", "$target_gen_dir/schema_org_property_configurations.cc", "$target_gen_dir/schema_org_property_names.h", "$target_gen_dir/schema_org_property_names.cc", "$target_gen_dir/schema_org_enums.h", "$target_gen_dir/schema_org_enums.cc", ] deps = [ ":schema_org_name_data" ] } static_library("schema_org_properties") { sources = [ "$target_gen_dir/schema_org_entity_names.cc", "$target_gen_dir/schema_org_entity_names.h", "$target_gen_dir/schema_org_enums.cc", "$target_gen_dir/schema_org_enums.h", "$target_gen_dir/schema_org_property_configurations.cc", "$target_gen_dir/schema_org_property_configurations.h", "$target_gen_dir/schema_org_property_names.cc", "$target_gen_dir/schema_org_property_names.h", ] deps = [ ":generate_schema_org_code", "//base", ] } static_library("extractor") { sources = [ "extractor.cc", "extractor.h", ] deps = [ "//base", "//components/schema_org:generate_schema_org_code", "//components/schema_org:schema_org", "//components/schema_org:schema_org_properties", "//components/schema_org/common", "//components/schema_org/common:improved_mojom", "//services/data_decoder/public/cpp", ] } static_library("schema_org") { sources = [ "validator.cc", "validator.h", ] deps = [ "//base", "//components/schema_org:generate_schema_org_code", "//components/schema_org:schema_org_properties", "//components/schema_org/common:improved_mojom", ] } fuzzer_test("extractor_fuzzer") { sources = [ "extractor_fuzzer.cc" ] deps = [ ":extractor", ":schema_org_properties", "//base", "//base/test:test_support", "//components/schema_org/common:improved_mojom", "//services/data_decoder/public/cpp:test_support", ] }