mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Rename core_adapter to nearby_connections and version the dlls
PiperOrigin-RevId: 459543362
This commit is contained in:
@@ -12,6 +12,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
load("//third_party/lexan/build_defs:lexan.bzl", "lexan")
|
||||
load(
|
||||
"expand_version_template.bzl",
|
||||
"expand_version_template",
|
||||
)
|
||||
load("//tools/build_defs/testing:bzl_library.bzl", "bzl_library")
|
||||
|
||||
licenses(["notice"])
|
||||
|
||||
@@ -33,9 +38,36 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
bzl_library(
|
||||
name = "expand_version_template_bzl",
|
||||
srcs = ["expand_version_template.bzl"],
|
||||
parse_tests = False,
|
||||
visibility = ["//visibility:private"],
|
||||
)
|
||||
|
||||
# Default version if none is provided.
|
||||
vardef("VERSION", "1.0.0.0")
|
||||
|
||||
# When built with rapid, a version value will be passed down from the build config via blaze
|
||||
# When built manually, invoke blaze with --define=VERSION=1.2.3.4
|
||||
# If VERSION is not passed from blaze, the default value defined above will be used.
|
||||
expand_version_template(
|
||||
name = "version_expanded",
|
||||
out = "version.rc",
|
||||
template = "version.rc.tpl",
|
||||
version = varref("VERSION"),
|
||||
)
|
||||
|
||||
lexan.resource_files(
|
||||
name = "resources",
|
||||
rc_files = [
|
||||
":version_expanded",
|
||||
],
|
||||
)
|
||||
|
||||
# Build with --config=lexan
|
||||
lexan.cc_windows_dll(
|
||||
name = "core_adapter",
|
||||
name = "nearby_connections",
|
||||
srcs = [
|
||||
"advertising_options_w.cc",
|
||||
"connection_options_w.cc",
|
||||
@@ -65,6 +97,7 @@ lexan.cc_windows_dll(
|
||||
tags = ["windows-dll"],
|
||||
visibility = ["//location/nearby/testing:__subpackages__"],
|
||||
deps = [
|
||||
":resources",
|
||||
"//third_party/dart_lang/v2:dart_api_dl",
|
||||
"//connections:core",
|
||||
"//connections:core_types",
|
||||
@@ -79,7 +112,7 @@ lexan.cc_windows_dll(
|
||||
# Build with --config=lexan
|
||||
# TODO(b/203019344) Move this configuration under dart folder and create a BUILD there.
|
||||
lexan.cc_windows_dll(
|
||||
name = "core_adapter_dart",
|
||||
name = "nearby_connections_dart",
|
||||
srcs = [
|
||||
"advertising_options_w.cc",
|
||||
"connection_options_w.cc",
|
||||
@@ -108,6 +141,7 @@ lexan.cc_windows_dll(
|
||||
defines = ["CORE_ADAPTER_DART_DLL"],
|
||||
tags = ["windows-dll"],
|
||||
deps = [
|
||||
":resources",
|
||||
"//third_party/dart_lang/v2:dart_api_dl",
|
||||
"//connections:core",
|
||||
"//connections:core_types",
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
"""Rule for specialized expansion of template files. This performs a simple search over the template
|
||||
file for the keys $VERSION and $VS_VERSION and replaces them with the corresponding values, derived
|
||||
from the version provided. Supports make variables.
|
||||
|
||||
Typical usage:
|
||||
load("expand_version_template.bzl", "expand_version_template")
|
||||
expand_version_template(
|
||||
name = "ExpandMyTemplate",
|
||||
out = "my.txt",
|
||||
template = "my.template",
|
||||
version = varref("VERSION"),
|
||||
)
|
||||
|
||||
Args:
|
||||
name: The name of the rule.
|
||||
out: The destination of the expanded file
|
||||
template: The template file to expand
|
||||
version: A string containing the version number. Supports make variables.
|
||||
"""
|
||||
|
||||
def expand_version_template_impl(ctx):
|
||||
version = ctx.expand_make_variables(
|
||||
"expand_version_template",
|
||||
ctx.attr.version,
|
||||
{},
|
||||
)
|
||||
vs_version = version.replace(".", ",")
|
||||
ctx.actions.expand_template(
|
||||
template = ctx.file.template,
|
||||
output = ctx.outputs.out,
|
||||
substitutions = {
|
||||
"$VERSION": version,
|
||||
"$VS_VERSION": vs_version,
|
||||
},
|
||||
)
|
||||
|
||||
expand_version_template = rule(
|
||||
implementation = expand_version_template_impl,
|
||||
attrs = {
|
||||
"template": attr.label(mandatory = True, allow_single_file = True),
|
||||
"version": attr.string(mandatory = False),
|
||||
"out": attr.output(mandatory = True),
|
||||
},
|
||||
)
|
||||
@@ -0,0 +1,32 @@
|
||||
#include "winres.h"
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION $VS_VERSION
|
||||
PRODUCTVERSION $VS_VERSION
|
||||
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS VS_FF_DEBUG
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS VOS__WINDOWS32
|
||||
FILETYPE VFT_APP
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904e4"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Google LLC"
|
||||
VALUE "FileDescription", "Nearby Connections"
|
||||
VALUE "FileVersion", "$VERSION"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2022 Google. All rights reserved." "\0"
|
||||
VALUE "ProductName", "Nearby Connections"
|
||||
VALUE "ProductVersion", "$VERSION"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1252
|
||||
END
|
||||
END
|
||||
Reference in New Issue
Block a user