Skip to content
Permalink
Browse files

Reformat BUCK files to follow new buildifier format

Summary: buildifier was updated and now we sort loads!

Reviewed By: zertosh

Differential Revision: D9771824

fbshipit-source-id: 0001aa5f656d4aa40b3498d5bfd792a3d14e56e1
  • Loading branch information...
mzlee authored and facebook-github-bot committed Sep 11, 2018
1 parent eef8d47 commit c5daf3fed900a949a4e449a7c55b4bc1e9e7fdd9
@@ -1,4 +1,4 @@
load("//tools/build_defs/oss:rn_defs.bzl", "JNI_TARGET", "subdir_glob", "oss_cxx_library")
load("//tools/build_defs/oss:rn_defs.bzl", "JNI_TARGET", "oss_cxx_library", "subdir_glob")

# This target is only used in open source
oss_cxx_library(
@@ -1,4 +1,4 @@
load("//tools/build_defs/oss:rn_defs.bzl", "rn_android_library", "rn_android_resource", "react_native_dep", "rn_prebuilt_jar")
load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "rn_android_library", "rn_android_resource", "rn_prebuilt_jar")

# This is a bit messy and hopefully a temporary thing
# The problem is that Gradle extracts appcompat resources into app namespace, com.facebook.react
@@ -8,4 +8,4 @@ remote_file(
name = "infer-annotations.jar",
sha1 = "f514ff4ca022a579d9cf7524846988b646ae4491",
url = "mvn:com.facebook.infer.annotation:infer-annotation:jar:0.11.2",
)
)
@@ -1,5 +1,5 @@
load("@fbsource//tools/build_defs:glob_defs.bzl", "subdir_glob")
load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "ANDROID_JSC_DEPS", "APPLE", "get_apple_compiler_flags", "APPLE_JSC_DEPS", "get_debug_preprocessor_flags", "get_android_inspector_flags", "get_apple_inspector_flags", "react_native_xplat_target", "rn_xplat_cxx_library")
load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "ANDROID_JSC_DEPS", "APPLE", "APPLE_JSC_DEPS", "get_android_inspector_flags", "get_apple_compiler_flags", "get_apple_inspector_flags", "get_debug_preprocessor_flags", "react_native_xplat_target", "rn_xplat_cxx_library")

CXX_LIBRARY_COMPILER_FLAGS = [
"-std=c++14",
@@ -3,9 +3,9 @@ load(
"ANDROID_JSC_DEPS",
"APPLE",
"APPLE_JSC_DEPS",
"react_native_xplat_target",
"jni_instrumentation_test_lib",
"fb_xplat_cxx_test",
"jni_instrumentation_test_lib",
"react_native_xplat_target",
)

TEST_SRCS = [
@@ -68,7 +68,7 @@ function copyProjectTemplateAndReplace(
}

const relativeFilePath = path.relative(srcPath, absoluteSrcFilePath);
const relativeRenamedPath = dotFilePath(relativeFilePath)
const relativeRenamedPath = translateFilePath(relativeFilePath)
.replace(/HelloWorld/g, newProjectName)
.replace(/helloworld/g, newProjectName.toLowerCase());

@@ -112,18 +112,19 @@ function copyProjectTemplateAndReplace(
}

/**
* There are various dotfiles in the templates folder in the RN repo. We want
* There are various files in the templates folder in the RN repo. We want
* these to be ignored by tools when working with React Native itself.
* Example: _babelrc file is ignored by Babel, renamed to .babelrc inside
* a real app folder.
* This is especially important for .gitignore because npm has some special
* behavior of automatically renaming .gitignore to .npmignore.
*/
function dotFilePath(path) {
function translateFilePath(path) {
if (!path) {
return path;
}
return path
.replace('_BUCK', 'BUCK')
.replace('_gitignore', '.gitignore')
.replace('_gitattributes', '.gitattributes')
.replace('_babelrc', '.babelrc')
@@ -8,23 +8,13 @@
# - `buck install -r android/app` - compile, install and run application
#

load(":build_defs.bzl", "create_aar_targets", "create_jar_targets")

lib_deps = []

for jarfile in glob(['libs/*.jar']):
name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
lib_deps.append(':' + name)
prebuilt_jar(
name = name,
binary_jar = jarfile,
)
create_aar_targets(glob(["libs/*.aar"]))

for aarfile in glob(['libs/*.aar']):
name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
lib_deps.append(':' + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
)
create_jar_targets(glob(["libs/*.jar"]))

android_library(
name = "all-libs",
@@ -0,0 +1,19 @@
"""Helper definitions to glob .aar and .jar targets"""

def create_aar_targets(aarfiles):
for aarfile in aarfiles:
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
lib_deps.append(":" + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
)

def create_jar_targets(jarfiles):
for jarfile in jarfiles:
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")]
lib_deps.append(":" + name)
prebuilt_jar(
name = name,
binary_jar = jarfile,
)

0 comments on commit c5daf3f

Please sign in to comment.
You can’t perform that action at this time.