|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +load("@vaticle_dependencies//tool/checkstyle:rules.bzl", "checkstyle_test") |
| 19 | +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test") |
| 20 | +load("//go:rules.bzl", "swig_native_go_library") |
| 21 | + |
| 22 | +# TODO: Building this target doesn't put the dynamic library (libtypedb_driver_go_native.dylib for MacOS) into |
| 23 | +# bazel-bin/go, while it's needed for the clinkopts below. |
| 24 | +swig_native_go_library( |
| 25 | + name = "typedb_driver_go_native", |
| 26 | + lib = "//c:typedb_driver_clib_headers", |
| 27 | + package_name= "typedb_driver", |
| 28 | + interface = "//c:typedb_driver.i", |
| 29 | + includes = ["//c:swig/typedb_driver_go.swg"], |
| 30 | + enable_cxx = True, |
| 31 | + visibility = ["//visibility:public"], |
| 32 | +) |
| 33 | + |
| 34 | +# TODO: Cannot be built in CI because of the absolute path used in clinkopts. |
| 35 | +# For now, requires manually running `bazel build //go:libtypedb_driver_go_native` before this building this target. |
| 36 | +#go_library( |
| 37 | +# name = "driver-go", |
| 38 | +# srcs = glob(["*.go"]), |
| 39 | +# data = ["//:LICENSE"], |
| 40 | +# importpath = "typedb_driver/go", |
| 41 | +# clinkopts = [ |
| 42 | +# "-L$TYPEDB_DRIVER_PATH/typedb-driver/bazel-bin/go", # TODO: Use relative path instead of the full path (couldn't make working for now) |
| 43 | +# "-ltypedb_driver_go_native", |
| 44 | +# "-framework", "CoreFoundation" |
| 45 | +# ], |
| 46 | +# deps = [ |
| 47 | +# "//go:typedb_driver_go_native", |
| 48 | +# "//go/api/user:user", |
| 49 | +# "//go/api/database:database", |
| 50 | +# "//go/connection:connection", |
| 51 | +# ], |
| 52 | +# cgo = True, |
| 53 | +# visibility = ["//visibility:public"], |
| 54 | +#) |
| 55 | + |
| 56 | +# TODO: The targets below are proofs of concept and are placed here for a simpler linker debug process. |
| 57 | +# It runs based on `driver_proof_of_concept.go` (NOTICE: this file is built inside the library, which is incorrect, |
| 58 | +# but it was enough for a simple proof of concept. Need to verify if the dynamic library can be found by external packages. |
| 59 | +#go_binary( |
| 60 | +# name = "driver-temp-exe", |
| 61 | +# embed = [":driver-go"], |
| 62 | +# visibility = ["//visibility:public"], |
| 63 | +#) |
| 64 | + |
| 65 | +# TODO: This test doesn't work because it can't find the driver's native dynamic library. |
| 66 | +#go_test( |
| 67 | +# name = "db-connection-test", |
| 68 | +# srcs = ["//go/test/integration:db_connection_test.go"], |
| 69 | +# embed = ["//go:driver-go"], |
| 70 | +# visibility = ["//visibility:public"], |
| 71 | +#) |
| 72 | + |
| 73 | +checkstyle_test( |
| 74 | + name = "checkstyle", |
| 75 | + size = "small", |
| 76 | + include = glob(["*"]), |
| 77 | + exclude = glob([ |
| 78 | + "README.md", |
| 79 | + "docs/**/*.adoc", |
| 80 | + ]), |
| 81 | + license_type = "apache-header", |
| 82 | +) |
0 commit comments