Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Update oss loom to better reflect fbsource
Browse files Browse the repository at this point in the history
Reviewed By: BurntBrunch

Differential Revision: D7212531

fbshipit-source-id: a6355ddb9246fd4efa57e2f8eaab530fa6ce4cd8
  • Loading branch information
Jonathan Kim authored and facebook-github-bot committed Mar 10, 2018
1 parent 3f41c6f commit c096a71
Show file tree
Hide file tree
Showing 41 changed files with 595 additions and 616 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Provides OSS compatibility layer with internal FB macros."""
THIS_IS_FBANDROID = False


def fb_xplat_cxx_library(name, **kwargs):
Expand All @@ -15,4 +14,4 @@ def fb_xplat_cxx_library(name, **kwargs):
compiler_flags.append("-std=c++14")
kwargs["compiler_flags"] = compiler_flags

return cxx_library(name=name, **kwargs)
return native.cxx_library(name=name, **kwargs)
29 changes: 26 additions & 3 deletions buck_imports/maven_library → build_defs/profilo_oss_defs.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
def maven_library(
"""Provides OSS compatibile macros."""

load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")


def profilo_oss_android_library(**kwargs):
"""Delegates to the native android_library rule."""
native.android_library(**kwargs)


def profilo_oss_cxx_library(**kwargs):
"""Delegates to the native cxx_library rule."""
native.cxx_library(**kwargs)


def profilo_oss_java_library(**kwargs):
"""Delegates to the native java_library rule."""
native.java_library(**kwargs)


def profilo_oss_maven_library(
name,
group,
artifact,
Expand All @@ -19,15 +39,18 @@ def maven_library(
)

if packaging == 'jar':
prebuilt_jar(
native.prebuilt_jar(
name=name,
binary_jar=':{}'.format(remote_file_name),
visibility=visibility
)
else:
android_prebuilt_aar(
native.android_prebuilt_aar(
name=name,
aar=':{}'.format(remote_file_name),
visibility=visibility
)


def profilo_oss_xplat_cxx_library(**kwargs):
fb_xplat_cxx_library(**kwargs)
2 changes: 1 addition & 1 deletion cpp/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

PROVIDER_EXPORTED_HEADERS = ["TraceProviders.h"]

Expand Down
2 changes: 1 addition & 1 deletion cpp/api/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

fb_xplat_cxx_library(
name = "external_api",
Expand Down
2 changes: 1 addition & 1 deletion cpp/atrace/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

fb_xplat_cxx_library(
name = "atrace",
Expand Down
2 changes: 1 addition & 1 deletion cpp/generated/BUCK
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("//build_defs:fb_java_library.bzl", "fb_java_library")
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

fb_xplat_cxx_library(
name = "cpp",
Expand Down
2 changes: 1 addition & 1 deletion cpp/jni/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

fb_xplat_cxx_library(
name = "jni",
Expand Down
2 changes: 1 addition & 1 deletion cpp/logger/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

fb_xplat_cxx_library(
name = "logger",
Expand Down
2 changes: 1 addition & 1 deletion cpp/logger/lfrb/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

fb_xplat_cxx_library(
name = "lfrb",
Expand Down
2 changes: 1 addition & 1 deletion cpp/profiler/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

def tracer_library(version):
version_ = version.replace(".", "_")
Expand Down
2 changes: 1 addition & 1 deletion cpp/systemcounters/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

SYSTEM_COUNTERS_EXPORTED_HEADERS = ["SystemCounterThread.h"]

Expand Down
2 changes: 1 addition & 1 deletion cpp/test/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

cxx_test(
name = "providers",
Expand Down
2 changes: 1 addition & 1 deletion cpp/threadmetadata/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

fb_xplat_cxx_library(
name = "threadmetadata",
Expand Down
2 changes: 1 addition & 1 deletion cpp/util/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

UTIL_EXPORTED_HEADERS = [
"common.h",
Expand Down
2 changes: 1 addition & 1 deletion cpp/writer/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

fb_xplat_cxx_library(
name = "print_visitor",
Expand Down
2 changes: 1 addition & 1 deletion cpp/yarn/BUCK
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:fb_xplat_cxx.bzl", "fb_xplat_cxx_library")
load("//build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")

fb_xplat_cxx_library(
name = "headers_linux",
Expand Down
29 changes: 14 additions & 15 deletions deps/androidinternals/BUCK
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
include_defs("//build_defs/fb_xplat_cxx.bzl") # THIS_IS_FBANDROID
load("//build_defs:profilo_oss_defs.bzl", "profilo_oss_android_library")

if not THIS_IS_FBANDROID:
android_library(
name = "os",
srcs = [
"ReflectionHelper.java",
"android/os/SystemPropertiesInternal.java",
],
visibility = [
"PUBLIC",
],
deps = [
"//deps/jsr-305:jsr-305",
],
)
profilo_oss_android_library(
name = "os",
srcs = [
"ReflectionHelper.java",
"android/os/SystemPropertiesInternal.java",
],
visibility = [
"PUBLIC",
],
deps = [
"//deps/jsr-305:jsr-305",
],
)
15 changes: 7 additions & 8 deletions deps/atomic/BUCK
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
include_defs("//build_defs/fb_xplat_cxx.bzl") # THIS_IS_FBANDROID
load("//build_defs:profilo_oss_defs.bzl", "profilo_oss_cxx_library")

if not THIS_IS_FBANDROID:
cxx_library(
name = "atomic",
visibility = [
"PUBLIC",
],
)
profilo_oss_cxx_library(
name = "atomic",
visibility = [
"PUBLIC",
],
)
23 changes: 10 additions & 13 deletions deps/buildconstants/BUCK
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
load("//build_defs:fb_java_library.bzl", "fb_java_library")
load("//build_defs:profilo_oss_defs.bzl", "profilo_oss_java_library")

include_defs("//build_defs/fb_xplat_cxx.bzl") # THIS_IS_FBANDROID

if not THIS_IS_FBANDROID:
fb_java_library(
name = "buildconstants",
srcs = [
"BuildConstants.java",
],
visibility = [
"PUBLIC",
],
)
profilo_oss_java_library(
name = "buildconstants",
srcs = [
"BuildConstants.java",
],
visibility = [
"PUBLIC",
],
)
23 changes: 11 additions & 12 deletions deps/cjni/BUCK
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
include_defs("//build_defs/fb_xplat_cxx.bzl") # THIS_IS_FBANDROID
load("//build_defs:profilo_oss_defs.bzl", "profilo_oss_cxx_library")

if not THIS_IS_FBANDROID:
cxx_library(
name = "cjni",
header_namespace = "cjni",
exported_headers = glob(["*.h"]),
srcs = glob(["*.c"]),
preferred_linkage = "static",
visibility = [
"PUBLIC",
],
)
profilo_oss_cxx_library(
name = "cjni",
srcs = glob(["*.c"]),
header_namespace = "cjni",
exported_headers = glob(["*.h"]),
preferred_linkage = "static",
visibility = [
"PUBLIC",
],
)
32 changes: 15 additions & 17 deletions deps/cppdistract/BUCK
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:profilo_oss_defs.bzl", "profilo_oss_cxx_library")

include_defs("//build_defs/fb_xplat_cxx.bzl") # THIS_IS_FBANDROID

if not THIS_IS_FBANDROID:
cxx_library(
name = "cppdistract",
srcs = [
"dso.cpp",
],
exported_headers = [
"dso.h",
],
header_namespace = "cppdistract",
preferred_linkage = "static",
visibility = [
profilo_path("..."),
],
)
profilo_oss_cxx_library(
name = "cppdistract",
srcs = [
"dso.cpp",
],
header_namespace = "cppdistract",
exported_headers = [
"dso.h",
],
preferred_linkage = "static",
visibility = [
profilo_path("..."),
],
)
23 changes: 11 additions & 12 deletions deps/dalvik/BUCK
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
include_defs("//build_defs/fb_xplat_cxx.bzl") # THIS_IS_FBANDROID
load("//build_defs:profilo_oss_defs.bzl", "profilo_oss_cxx_library")

if not THIS_IS_FBANDROID:
cxx_library(
name = "dalvik-subset",
header_namespace = "dalvik-subset",
exported_headers = [
"internals.h",
],
visibility = [
"PUBLIC",
],
)
profilo_oss_cxx_library(
name = "dalvik-subset",
header_namespace = "dalvik-subset",
exported_headers = [
"internals.h",
],
visibility = [
"PUBLIC",
],
)
56 changes: 28 additions & 28 deletions deps/fb/BUCK
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
load("//buck_imports:profilo_path.bzl", "profilo_path")
load("//build_defs:profilo_oss_defs.bzl", "profilo_oss_cxx_library")

include_defs("//build_defs/fb_xplat_cxx.bzl") # THIS_IS_FBANDROID

if not THIS_IS_FBANDROID:
cxx_library(
name = "fb",
exported_headers = glob([
"**/*.h",
]),
header_namespace = "fb",
compiler_flags = [
"-fexceptions",
],
linker_flags = [
"-llog",
],
preprocessor_flags = [
"-DDISABLE_CPUCAP",
"-DDISABLE_XPLAT",
],
srcs = glob([
profilo_oss_cxx_library(
name = "fb",
srcs = glob(
[
"**/*.cpp",
],
excludes = [
"jni/android/*.cpp",
]),
soname = "libfb.$(ext)",
deps = [
profilo_path("deps/fbjni:fbjni"),
],
visibility = [
"PUBLIC",
],
)
),
header_namespace = "fb",
exported_headers = glob([
"**/*.h",
]),
compiler_flags = [
"-fexceptions",
],
linker_flags = [
"-llog",
],
preprocessor_flags = [
"-DDISABLE_CPUCAP",
"-DDISABLE_XPLAT",
],
soname = "libfb.$(ext)",
visibility = [
"PUBLIC",
],
deps = [
profilo_path("deps/fbjni:fbjni"),
],
)
Loading

0 comments on commit c096a71

Please sign in to comment.