Build first-party C++ deps of OSS React Native with Buck

Reviewed By: sdwilsh

Differential Revision: D2840290

fb-gh-sync-id: 3dd4f7ee83a520d5c01f7864f443a04aa73b35fa
This commit is contained in:
Martin Konicek 2016-01-21 05:23:39 -08:00 committed by facebook-github-bot-5
parent d8b5539151
commit f97138f36f

View File

@ -0,0 +1,37 @@
/*
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#ifndef __ANDROID__
#error "This file should only be compiled for Android."
#endif
#include <jni/fbjni/References.h>
#include <jni/fbjni/CoreClasses.h>
namespace facebook {
namespace jni {
namespace internal {
static int32_t getApiLevel() {
auto cls = findClassLocal("android/os/Build$VERSION");
auto fld = cls->getStaticField<int32_t>("SDK_INT");
if (fld) {
return cls->getStaticFieldValue(fld);
}
return 0;
}
bool doesGetObjectRefTypeWork() {
static auto level = getApiLevel();
return level >= 14;
}
}
}
}