mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Update ktfmt component on FBS:master
Reviewed By: cortinico Differential Revision: D96922887 fbshipit-source-id: 357f51f07c3bff9e517e0e7466dc5dfe4028a98a
This commit is contained in:
1 parent
56908a74c7
commit
57268c5ba0
11 files changed
+135
-144
No files matched your search
@@ -292,11 +292,10 @@ val preparePrefab by
|
||||
outputDir.set(prefabHeadersDir)
|
||||
}
|
||||
|
||||
val createNativeDepsDirectories by
|
||||
tasks.registering {
|
||||
downloadsDir.mkdirs()
|
||||
thirdPartyNdkDir.mkdirs()
|
||||
}
|
||||
val createNativeDepsDirectories by tasks.registering {
|
||||
downloadsDir.mkdirs()
|
||||
thirdPartyNdkDir.mkdirs()
|
||||
}
|
||||
|
||||
val downloadBoostDest = File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz")
|
||||
val downloadBoost by
|
||||
@@ -437,23 +436,21 @@ val prepareGlog by
|
||||
}
|
||||
|
||||
// Tasks used by Fantom to download the Native 3p dependencies used.
|
||||
val prepareNative3pDependencies by
|
||||
tasks.registering {
|
||||
dependsOn(
|
||||
prepareBoost,
|
||||
prepareDoubleConversion,
|
||||
prepareFastFloat,
|
||||
prepareFmt,
|
||||
prepareFolly,
|
||||
prepareGlog,
|
||||
)
|
||||
}
|
||||
val prepareNative3pDependencies by tasks.registering {
|
||||
dependsOn(
|
||||
prepareBoost,
|
||||
prepareDoubleConversion,
|
||||
prepareFastFloat,
|
||||
prepareFmt,
|
||||
prepareFolly,
|
||||
prepareGlog,
|
||||
)
|
||||
}
|
||||
|
||||
val prepareKotlinBuildScriptModel by
|
||||
tasks.registering {
|
||||
// This task is run when Gradle Sync is running.
|
||||
// We create it here so we can let it depend on preBuild inside the android{}
|
||||
}
|
||||
val prepareKotlinBuildScriptModel by tasks.registering {
|
||||
// This task is run when Gradle Sync is running.
|
||||
// We create it here so we can let it depend on preBuild inside the android{}
|
||||
}
|
||||
|
||||
// As ReactAndroid builds from source, the codegen needs to be built before it can be invoked.
|
||||
// This is not the case for users of React Native, as we ship a compiled version of the codegen.
|
||||
|
||||
@@ -81,21 +81,20 @@ val hermesBuildOutputFileTree =
|
||||
fileTree(hermesBuildDir.toString())
|
||||
.include("**/*.cmake", "**/*.marks", "**/compiler_depends.ts", "**/Makefile", "**/link.txt")
|
||||
|
||||
val hermesVersionProvider: Provider<String> =
|
||||
providers.provider {
|
||||
var hermesVersion = if (hermesV1Enabled) "250829098.0.0-stable" else "main"
|
||||
val hermesVersionFile =
|
||||
File(
|
||||
reactNativeRootDir,
|
||||
if (hermesV1Enabled) "sdks/.hermesv1version" else "sdks/.hermesversion",
|
||||
)
|
||||
val hermesVersionProvider: Provider<String> = providers.provider {
|
||||
var hermesVersion = if (hermesV1Enabled) "250829098.0.0-stable" else "main"
|
||||
val hermesVersionFile =
|
||||
File(
|
||||
reactNativeRootDir,
|
||||
if (hermesV1Enabled) "sdks/.hermesv1version" else "sdks/.hermesversion",
|
||||
)
|
||||
|
||||
if (hermesVersionFile.exists()) {
|
||||
hermesVersion = hermesVersionFile.readText()
|
||||
}
|
||||
if (hermesVersionFile.exists()) {
|
||||
hermesVersion = hermesVersionFile.readText()
|
||||
}
|
||||
|
||||
hermesVersion
|
||||
}
|
||||
hermesVersion
|
||||
}
|
||||
|
||||
val ndkBuildJobs = Runtime.getRuntime().availableProcessors().toString()
|
||||
val prefabHeadersDir = File("$buildDir/prefab-headers")
|
||||
|
||||
+9
-10
@@ -97,16 +97,15 @@ internal class FrameTimingsObserver(
|
||||
}
|
||||
}
|
||||
|
||||
private val frameMetricsListener =
|
||||
Window.OnFrameMetricsAvailableListener { _, frameMetrics, _ ->
|
||||
// Guard against calls after stop()
|
||||
if (!isTracing) {
|
||||
return@OnFrameMetricsAvailableListener
|
||||
}
|
||||
val beginTimestamp = frameMetrics.getMetric(FrameMetrics.VSYNC_TIMESTAMP)
|
||||
val endTimestamp = beginTimestamp + frameMetrics.getMetric(FrameMetrics.TOTAL_DURATION)
|
||||
emitFrameTiming(beginTimestamp, endTimestamp)
|
||||
}
|
||||
private val frameMetricsListener = Window.OnFrameMetricsAvailableListener { _, frameMetrics, _ ->
|
||||
// Guard against calls after stop()
|
||||
if (!isTracing) {
|
||||
return@OnFrameMetricsAvailableListener
|
||||
}
|
||||
val beginTimestamp = frameMetrics.getMetric(FrameMetrics.VSYNC_TIMESTAMP)
|
||||
val endTimestamp = beginTimestamp + frameMetrics.getMetric(FrameMetrics.TOTAL_DURATION)
|
||||
emitFrameTiming(beginTimestamp, endTimestamp)
|
||||
}
|
||||
|
||||
private fun emitFrameTiming(beginTimestamp: Long, endTimestamp: Long) {
|
||||
val frameId = frameCounter++
|
||||
|
||||
+10
-10
@@ -142,8 +142,9 @@ internal class PerfMonitorOverlayView(
|
||||
val dialog =
|
||||
createAnchoredDialog(dpToPx(12f), dpToPx(12f)).apply { setContentView(containerLayout) }
|
||||
dialog.window?.apply {
|
||||
attributes =
|
||||
attributes?.apply { flags = flags or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE }
|
||||
attributes = attributes?.apply {
|
||||
flags = flags or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
|
||||
}
|
||||
}
|
||||
|
||||
return dialog
|
||||
@@ -158,14 +159,13 @@ internal class PerfMonitorOverlayView(
|
||||
setCancelable(false)
|
||||
}
|
||||
dialog.window?.apply {
|
||||
attributes =
|
||||
attributes?.apply {
|
||||
width = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
gravity = Gravity.TOP or Gravity.END
|
||||
x = offsetX.toInt()
|
||||
y = offsetY.toInt()
|
||||
}
|
||||
attributes = attributes?.apply {
|
||||
width = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
height = WindowManager.LayoutParams.WRAP_CONTENT
|
||||
gravity = Gravity.TOP or Gravity.END
|
||||
x = offsetX.toInt()
|
||||
y = offsetY.toInt()
|
||||
}
|
||||
}
|
||||
dialog.window?.decorView?.let { decorView ->
|
||||
ViewCompat.setOnApplyWindowInsetsListener(decorView) { view, windowInsets ->
|
||||
|
||||
+21
-20
@@ -44,28 +44,27 @@ public class ReactChoreographer private constructor(choreographerProvider: Chore
|
||||
private var totalCallbacks = 0
|
||||
@GuardedBy("callbackQueues") private var hasPostedCallback = false
|
||||
|
||||
private val frameCallback =
|
||||
Choreographer.FrameCallback { frameTimeNanos ->
|
||||
synchronized(callbackQueues) {
|
||||
// Callbacks run once and are then automatically removed, the callback will
|
||||
// be posted again from postFrameCallback
|
||||
hasPostedCallback = false
|
||||
for (i in callbackQueues.indices) {
|
||||
val callbackQueue = callbackQueues[i]
|
||||
val initialLength = callbackQueue.size
|
||||
for (callback in 0 until initialLength) {
|
||||
val frameCallback = callbackQueue.pollFirst()
|
||||
if (frameCallback != null) {
|
||||
frameCallback.doFrame(frameTimeNanos)
|
||||
totalCallbacks--
|
||||
} else {
|
||||
FLog.e(ReactConstants.TAG, "Tried to execute non-existent frame callback")
|
||||
}
|
||||
}
|
||||
private val frameCallback = Choreographer.FrameCallback { frameTimeNanos ->
|
||||
synchronized(callbackQueues) {
|
||||
// Callbacks run once and are then automatically removed, the callback will
|
||||
// be posted again from postFrameCallback
|
||||
hasPostedCallback = false
|
||||
for (i in callbackQueues.indices) {
|
||||
val callbackQueue = callbackQueues[i]
|
||||
val initialLength = callbackQueue.size
|
||||
for (callback in 0 until initialLength) {
|
||||
val frameCallback = callbackQueue.pollFirst()
|
||||
if (frameCallback != null) {
|
||||
frameCallback.doFrame(frameTimeNanos)
|
||||
totalCallbacks--
|
||||
} else {
|
||||
FLog.e(ReactConstants.TAG, "Tried to execute non-existent frame callback")
|
||||
}
|
||||
maybeRemoveFrameCallback()
|
||||
}
|
||||
}
|
||||
maybeRemoveFrameCallback()
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
UiThreadUtil.runOnUiThread { choreographer = choreographerProvider.getChoreographer() }
|
||||
@@ -138,6 +137,8 @@ public class ReactChoreographer private constructor(choreographerProvider: Chore
|
||||
|
||||
@VisibleForTesting
|
||||
internal fun overrideInstanceForTest(instance: ReactChoreographer?): ReactChoreographer? =
|
||||
choreographer.also { choreographer = instance }
|
||||
choreographer.also {
|
||||
choreographer = instance
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-5
@@ -989,11 +989,10 @@ public class ReactHostImpl(
|
||||
jsBundleLoader.onSuccess(
|
||||
{ task ->
|
||||
val bundleLoader = checkNotNull(task.getResult())
|
||||
val reactContext =
|
||||
bridgelessReactContextRef.getOrCreate {
|
||||
stateTracker.enterState(method, "Creating BridgelessReactContext")
|
||||
BridgelessReactContext(context, this)
|
||||
}
|
||||
val reactContext = bridgelessReactContextRef.getOrCreate {
|
||||
stateTracker.enterState(method, "Creating BridgelessReactContext")
|
||||
BridgelessReactContext(context, this)
|
||||
}
|
||||
reactContext.jsExceptionHandler = devSupportManager
|
||||
|
||||
stateTracker.enterState(method, "Creating ReactInstance")
|
||||
|
||||
+3
-2
@@ -17,6 +17,7 @@ internal object ReactRootViewTagGenerator {
|
||||
|
||||
@JvmStatic
|
||||
@Synchronized
|
||||
fun getNextRootViewTag(): Int =
|
||||
nextRootViewTag.also { nextRootViewTag += ROOT_VIEW_TAG_INCREMENT }
|
||||
fun getNextRootViewTag(): Int = nextRootViewTag.also {
|
||||
nextRootViewTag += ROOT_VIEW_TAG_INCREMENT
|
||||
}
|
||||
}
|
||||
+12
-13
@@ -92,19 +92,18 @@ internal class InsetBoxShadowDrawable(
|
||||
bounds.right - (computedBorderInsets?.right ?: 0f),
|
||||
bounds.bottom - (computedBorderInsets?.bottom ?: 0f),
|
||||
)
|
||||
val paddingBoxRadii =
|
||||
computedBorderRadii?.let {
|
||||
floatArrayOf(
|
||||
innerRadius(it.topLeft.horizontal, computedBorderInsets?.left),
|
||||
innerRadius(it.topLeft.vertical, computedBorderInsets?.top),
|
||||
innerRadius(it.topRight.horizontal, computedBorderInsets?.right),
|
||||
innerRadius(it.topRight.vertical, computedBorderInsets?.top),
|
||||
innerRadius(it.bottomRight.horizontal, computedBorderInsets?.right),
|
||||
innerRadius(it.bottomRight.vertical, computedBorderInsets?.bottom),
|
||||
innerRadius(it.bottomLeft.horizontal, computedBorderInsets?.left),
|
||||
innerRadius(it.bottomLeft.vertical, computedBorderInsets?.bottom),
|
||||
)
|
||||
}
|
||||
val paddingBoxRadii = computedBorderRadii?.let {
|
||||
floatArrayOf(
|
||||
innerRadius(it.topLeft.horizontal, computedBorderInsets?.left),
|
||||
innerRadius(it.topLeft.vertical, computedBorderInsets?.top),
|
||||
innerRadius(it.topRight.horizontal, computedBorderInsets?.right),
|
||||
innerRadius(it.topRight.vertical, computedBorderInsets?.top),
|
||||
innerRadius(it.bottomRight.horizontal, computedBorderInsets?.right),
|
||||
innerRadius(it.bottomRight.vertical, computedBorderInsets?.bottom),
|
||||
innerRadius(it.bottomLeft.horizontal, computedBorderInsets?.left),
|
||||
innerRadius(it.bottomLeft.vertical, computedBorderInsets?.bottom),
|
||||
)
|
||||
}
|
||||
|
||||
val x = offsetX.dpToPx()
|
||||
val y = offsetY.dpToPx()
|
||||
|
||||
+8
-9
@@ -132,15 +132,14 @@ internal object TouchesHelper {
|
||||
}
|
||||
|
||||
for (touchData in changedTouches) {
|
||||
val eventData =
|
||||
touchData?.let { td ->
|
||||
val ed = td.copy()
|
||||
val changedTouchesArray = getWritableArray(/* copyObjects */ true, changedTouches)
|
||||
val touchesArray = getWritableArray(/* copyObjects */ true, touches)
|
||||
ed.putArray(CHANGED_TOUCHES_KEY, changedTouchesArray)
|
||||
ed.putArray(TOUCHES_KEY, touchesArray)
|
||||
ed
|
||||
}
|
||||
val eventData = touchData?.let { td ->
|
||||
val ed = td.copy()
|
||||
val changedTouchesArray = getWritableArray(/* copyObjects */ true, changedTouches)
|
||||
val touchesArray = getWritableArray(/* copyObjects */ true, touches)
|
||||
ed.putArray(CHANGED_TOUCHES_KEY, changedTouchesArray)
|
||||
ed.putArray(TOUCHES_KEY, touchesArray)
|
||||
ed
|
||||
}
|
||||
|
||||
eventEmitter.receiveEvent(
|
||||
event.surfaceId,
|
||||
|
||||
+6
-4
@@ -326,15 +326,17 @@ public open class ReactViewManager : ReactClippingViewManager<ReactViewGroup>()
|
||||
|
||||
@ReactProp(name = "nativeBackgroundAndroid")
|
||||
public open fun setNativeBackground(view: ReactViewGroup, background: ReadableMap?) {
|
||||
val bg =
|
||||
background?.let { ReactDrawableHelper.createDrawableFromJSDescription(view.context, it) }
|
||||
val bg = background?.let {
|
||||
ReactDrawableHelper.createDrawableFromJSDescription(view.context, it)
|
||||
}
|
||||
BackgroundStyleApplicator.setFeedbackUnderlay(view, bg)
|
||||
}
|
||||
|
||||
@ReactProp(name = "nativeForegroundAndroid")
|
||||
public open fun setNativeForeground(view: ReactViewGroup, foreground: ReadableMap?) {
|
||||
view.foreground =
|
||||
foreground?.let { ReactDrawableHelper.createDrawableFromJSDescription(view.context, it) }
|
||||
view.foreground = foreground?.let {
|
||||
ReactDrawableHelper.createDrawableFromJSDescription(view.context, it)
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = ViewProps.NEEDS_OFFSCREEN_ALPHA_COMPOSITING)
|
||||
|
||||
@@ -67,12 +67,11 @@ val testerBuildOutputFileTree =
|
||||
fileTree(testerBuildDir.toString())
|
||||
.include("**/*.cmake", "**/*.marks", "**/compiler_depends.ts", "**/Makefile", "**/link.txt")
|
||||
|
||||
val createNativeDepsDirectories by
|
||||
tasks.registering {
|
||||
downloadsDir.mkdirs()
|
||||
thirdParty.mkdirs()
|
||||
reportsDir.mkdirs()
|
||||
}
|
||||
val createNativeDepsDirectories by tasks.registering {
|
||||
downloadsDir.mkdirs()
|
||||
thirdParty.mkdirs()
|
||||
reportsDir.mkdirs()
|
||||
}
|
||||
|
||||
val downloadFollyDest = File(reactAndroidDownloadsDir, "folly-${FOLLY_VERSION}.tar.gz")
|
||||
|
||||
@@ -148,40 +147,36 @@ val prepareRNCodegen by
|
||||
into(codegenOutDir)
|
||||
}
|
||||
|
||||
val enableHermesBuild by
|
||||
tasks.registering {
|
||||
project(":packages:react-native:ReactAndroid:hermes-engine") {
|
||||
tasks.configureEach { enabled = true }
|
||||
}
|
||||
}
|
||||
val enableHermesBuild by tasks.registering {
|
||||
project(":packages:react-native:ReactAndroid:hermes-engine") {
|
||||
tasks.configureEach { enabled = true }
|
||||
}
|
||||
}
|
||||
|
||||
val prepareHermesDependencies by
|
||||
tasks.registering {
|
||||
dependsOn(
|
||||
enableHermesBuild,
|
||||
":packages:react-native:ReactAndroid:hermes-engine:buildHermesLibWithDebugger",
|
||||
":packages:react-native:ReactAndroid:hermes-engine:prepareHeadersForPrefabWithDebugger",
|
||||
)
|
||||
}
|
||||
val prepareHermesDependencies by tasks.registering {
|
||||
dependsOn(
|
||||
enableHermesBuild,
|
||||
":packages:react-native:ReactAndroid:hermes-engine:buildHermesLibWithDebugger",
|
||||
":packages:react-native:ReactAndroid:hermes-engine:prepareHeadersForPrefabWithDebugger",
|
||||
)
|
||||
}
|
||||
|
||||
val prepareNative3pDependencies by
|
||||
tasks.registering {
|
||||
dependsOn(
|
||||
prepareGflags,
|
||||
prepareNlohmannJson,
|
||||
prepareFolly,
|
||||
":packages:react-native:ReactAndroid:prepareBoost",
|
||||
":packages:react-native:ReactAndroid:prepareDoubleConversion",
|
||||
":packages:react-native:ReactAndroid:prepareFastFloat",
|
||||
":packages:react-native:ReactAndroid:prepareFmt",
|
||||
":packages:react-native:ReactAndroid:prepareGlog",
|
||||
)
|
||||
}
|
||||
val prepareNative3pDependencies by tasks.registering {
|
||||
dependsOn(
|
||||
prepareGflags,
|
||||
prepareNlohmannJson,
|
||||
prepareFolly,
|
||||
":packages:react-native:ReactAndroid:prepareBoost",
|
||||
":packages:react-native:ReactAndroid:prepareDoubleConversion",
|
||||
":packages:react-native:ReactAndroid:prepareFastFloat",
|
||||
":packages:react-native:ReactAndroid:prepareFmt",
|
||||
":packages:react-native:ReactAndroid:prepareGlog",
|
||||
)
|
||||
}
|
||||
|
||||
val prepareAllDependencies by
|
||||
tasks.registering {
|
||||
dependsOn(prepareRNCodegen, prepareHermesDependencies, prepareNative3pDependencies)
|
||||
}
|
||||
val prepareAllDependencies by tasks.registering {
|
||||
dependsOn(prepareRNCodegen, prepareHermesDependencies, prepareNative3pDependencies)
|
||||
}
|
||||
|
||||
val configureFantomTester by
|
||||
tasks.registering(CustomExecTask::class) {
|
||||
|
||||
Reference in new issue
Block a user