1// Copyright (C) 2020 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Proto library
16package {
17    // See: http://go/android-license-faq
18    // A large-scale-change added 'default_applicable_licenses' to import
19    // all of the 'license_kinds' from "packages_modules_GeoTZ_license"
20    // to get the below license kinds:
21    //   SPDX-license-identifier-Apache-2.0
22    //   legacy_restricted
23    default_applicable_licenses: ["packages_modules_GeoTZ_license"],
24}
25
26java_library_host {
27    name: "geotz_data_pipeline_protos",
28    proto: {
29        type: "full",
30        include_dirs: ["external/protobuf/src"],
31    },
32
33    srcs: ["src/main/proto/**/*.proto"],
34}
35
36// A library containing the code for the pipeline steps defined below.
37java_library_host {
38    name: "geotz_data_pipeline",
39    srcs: ["src/main/java/**/*.java"],
40    static_libs: [
41        "geotz_data_pipeline_protos",
42        "geotz_geojson",
43        "geotz_host_common",
44        "geotz_s2storage_tools_protos",
45        "guava",
46        "jcommander",
47        "libprotobuf-java-full",
48        "s2-geometry-library-java",
49        "tzids",
50        "tztools_common",
51    ],
52}
53
54// Step 1 of the OSM time zone geolocation reference data pipeline.
55//
56// Converts geojson time zone boundaries (from timezone-boundary-builder) to TzS2Polygon proto
57// files, one per time zone ID.
58java_binary_host {
59    name: "geotz_geojsontz_to_tzs2polygons",
60    main_class: "com.android.timezone.location.data_pipeline.steps.GeoJsonTzToTzS2Polygons",
61    static_libs: ["geotz_data_pipeline"],
62}
63
64// Step 2 of the OSM time zone geolocation reference data pipeline.
65//
66// Reads TzS2Polygon proto files and writes out TzS2Polygon proto files with canonical time zone
67// IDs, combining multiple input files into output files where necessary.
68java_binary_host {
69    name: "geotz_canonicalize_tzs2polygons",
70    main_class: "com.android.timezone.location.data_pipeline.steps.CanonicalizeTzS2Polygons",
71    static_libs: ["geotz_data_pipeline"],
72}
73
74// Step 3 of the OSM time zone geolocation reference data pipeline.
75//
76// Converts TzS2Polygon proto files to TsS2CellUnion proto files at a maximum S2 level.
77java_binary_host {
78    name: "geotz_tzs2polygons_to_tzs2cellunions",
79    main_class: "com.android.timezone.location.data_pipeline.steps.TzS2PolygonsToTzS2CellUnions",
80    static_libs: ["geotz_data_pipeline"],
81}
82
83// Step 4 of the OSM time zone geolocation reference data pipeline.
84//
85// Converts TsS2CellUnion proto files to (single time zone) TzS2Ranges proto files.
86java_binary_host {
87    name: "geotz_tzs2cellunions_to_tzs2ranges",
88    main_class: "com.android.timezone.location.data_pipeline.steps.TzS2CellUnionsToTzS2Ranges",
89    static_libs: ["geotz_data_pipeline"],
90}
91
92// Step 5 of the OSM time zone geolocation reference data pipeline.
93//
94// Merges multiple, single time zone TzS2Ranges proto files into one, multiple time zone TzS2Ranges
95// proto file
96java_binary_host {
97    name: "geotz_mergetzs2ranges",
98    main_class: "com.android.timezone.location.data_pipeline.steps.MergeTzS2Ranges",
99    static_libs: ["geotz_data_pipeline"],
100}
101
102// Step 6 of the OSM time zone geolocation reference data pipeline.
103//
104// Converts the one, multiple time zone TzS2Ranges proto file to the file format required by the
105// geotz_createtzs2file tool.
106java_binary_host {
107    name: "geotz_createtzs2fileinput",
108    main_class: "com.android.timezone.location.data_pipeline.steps.CreateTzS2ProtoDataFile",
109    static_libs: ["geotz_data_pipeline"],
110}
111
112// A library containing debug tooling. See java_binary_host definitions below for details.
113java_library_host {
114    name: "geotz_data_pipeline_debug",
115    srcs: ["src/debug/java/**/*.java"],
116    static_libs: [
117        "geotz_data_pipeline",
118    ],
119}
120
121// Dev / debug tool: Prints basic stats about TzS2Range files. See the Java class for details.
122java_binary_host {
123    name: "geotz_data_pipeline_debug_printtzs2rangesstats",
124    main_class: "com.android.timezone.location.data_pipeline.tools.PrintTzS2RangeStats",
125    static_libs: ["geotz_data_pipeline_debug"],
126}
127
128// Dev / debug tool: Prints basic stats about TzS2CellUnion files. See the Java class for details.
129java_binary_host {
130    name: "geotz_data_pipeline_debug_printtzs2cellunionstats",
131    main_class: "com.android.timezone.location.data_pipeline.tools.PrintTzS2CellUnionStats",
132    static_libs: ["geotz_data_pipeline_debug"],
133}
134
135// Tests for the pipeline steps.
136java_test_host {
137    name: "geotz_data_pipeline_tests",
138    srcs: ["src/test/java/**/*.java"],
139    java_resource_dirs: ["src/test/java/"],
140    static_libs: [
141        "geotz_data_pipeline",
142        "junit",
143    ],
144}
145
146// A host library containing geojson-jackson and all its dependencies.
147java_library_host {
148    name: "geotz_geojson",
149    static_libs: [
150        "geojson-jackson",
151        "jackson-annotations",
152        "jackson-core",
153        "jackson-databind",
154    ],
155}
156