Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TestToolChainDemo
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
dsq
TestToolChainDemo
Commits
3a1a03d9
Commit
3a1a03d9
authored
May 14, 2026
by
dsq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
用于临时测试-不合入master
parent
3754154c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
177 additions
and
19 deletions
+177
-19
build.gradle.kts
composeApp/build.gradle.kts
+19
-6
1500.kt
...p/src/commonMain/kotlin/com.dong.demo013/1500Text/1500.kt
+80
-0
App.kt
composeApp/src/commonMain/kotlin/com.dong.demo013/App.kt
+42
-5
TestLog.kt
composeApp/src/commonMain/kotlin/com.dong.demo013/TestLog.kt
+5
-1
TestLog.ios.kt
...oseApp/src/iosMain/kotlin/com.dong.demo013/TestLog.ios.kt
+10
-0
libs.versions.toml
gradle/libs.versions.toml
+1
-1
project.pbxproj
iosApp/iosApp.xcodeproj/project.pbxproj
+7
-5
iOSApp.swift
iosApp/iosApp/iOSApp.swift
+13
-1
No files found.
composeApp/build.gradle.kts
View file @
3a1a03d9
...
...
@@ -29,13 +29,10 @@ kotlin {
).
forEach
{
iosTarget
->
iosTarget
.
binaries
.
framework
{
baseName
=
"ComposeApp"
isStatic
=
true
}
iosTarget
.
compilations
.
getByName
(
"main"
)
{
compilerOptions
.
configure
{
freeCompilerArgs
.
add
(
"-Xbinary=sanitizer=address"
)
}
// 动态 framework:拖入 Xcode 后 Embed & Sign;静态需 -force_load,易与 *Stub 问题混淆。
isStatic
=
false
}
// 勿在 iOS 启用 Address Sanitizer(仅 OHOS 需要)。否则产物含大量未解析 Konan *Stub,Xcode 链接失败。
}
...
...
@@ -228,4 +225,20 @@ arrayOf("debug", "release").forEach { type ->
}
}
// 命令行打好 framework 后拖入 Xcode:产物在 composeApp/build/ios-drag-export/…
tasks
.
register
<
Sync
>(
"syncComposeAppFrameworkIosArm64Release"
)
{
group
=
"iOS"
description
=
"同步真机 arm64 Release 的 ComposeApp.framework 到 build/ios-drag-export/(供拖入 Xcode)"
dependsOn
(
"linkReleaseFrameworkIosArm64"
)
from
(
layout
.
buildDirectory
.
dir
(
"bin/iosArm64/releaseFramework/ComposeApp.framework"
))
into
(
layout
.
buildDirectory
.
dir
(
"ios-drag-export/arm64-release"
))
}
tasks
.
register
<
Sync
>(
"syncComposeAppFrameworkIosSimulatorArm64Release"
)
{
group
=
"iOS"
description
=
"同步 Apple Silicon 模拟器 arm64 Release 的 ComposeApp.framework 到 build/ios-drag-export/(供拖入 Xcode)"
dependsOn
(
"linkReleaseFrameworkIosSimulatorArm64"
)
from
(
layout
.
buildDirectory
.
dir
(
"bin/iosSimulatorArm64/releaseFramework/ComposeApp.framework"
))
into
(
layout
.
buildDirectory
.
dir
(
"ios-drag-export/simulator-arm64-release"
))
}
composeApp/src/commonMain/kotlin/com.dong.demo013/1500Text/1500.kt
0 → 100644
View file @
3a1a03d9
package
com.dong.demo013
import
androidx.compose.foundation.border
import
androidx.compose.foundation.layout.*
import
androidx.compose.foundation.rememberScrollState
import
androidx.compose.foundation.verticalScroll
import
androidx.compose.material3.Text
import
androidx.compose.runtime.Composable
import
androidx.compose.runtime.LaunchedEffect
import
androidx.compose.runtime.withFrameMillis
import
androidx.compose.ui.Alignment
import
androidx.compose.ui.Modifier
import
androidx.compose.ui.graphics.Color
import
androidx.compose.ui.semantics.contentDescription
import
androidx.compose.ui.semantics.semantics
import
androidx.compose.ui.unit.dp
import
androidx.compose.ui.unit.sp
private
fun
perfPlatformTag
():
String
{
val
n
=
"11111"
return
when
{
n
.
contains
(
"iOS"
,
ignoreCase
=
true
)
||
n
.
contains
(
"iPadOS"
,
ignoreCase
=
true
)
->
"ios"
n
.
contains
(
"Android"
,
ignoreCase
=
true
)
->
"android"
else
->
"harmony"
}
}
@Composable
internal
fun
Compose1500Text
()
{
val
scrollState
=
rememberScrollState
()
val
platformTag
=
perfPlatformTag
()
LaunchedEffect
(
Unit
)
{
// val enterTs = PerfLogger.get("scene_1500text_enter_click_ts") ?: nowMs()
//这里发送进入
os_signal_set
(
"进入页面"
)
// 至少等到一帧真正调度后再记「首帧」,避免与点击同一时刻的伪首帧
withFrameMillis
{
}
//这里发送首帧
os_signal_set
(
"进入首帧"
)
// 等布局给出可滚动高度后再滚到底,再等一帧记「完成」
while
(
scrollState
.
maxValue
==
0
)
{
os_signal_set
(
"一帧完成"
)
withFrameMillis
{
}
}
//这里发送开始滚动
os_signal_set
(
"开始滚动"
)
scrollState
.
scrollTo
(
scrollState
.
maxValue
)
withFrameMillis
{
}
//这里发送结束滚动
os_signal_set
(
"结束滚动"
)
}
Column
(
modifier
=
Modifier
.
verticalScroll
(
scrollState
).
fillMaxWidth
().
semantics
{
contentDescription
=
"包含 1500 个文本项目的性能测试列表"
},
horizontalAlignment
=
Alignment
.
CenterHorizontally
)
{
repeat
(
1500
)
{
index
->
Text
(
text
=
"Compose1500Text Item #$index"
,
fontSize
=
16
.
sp
,
modifier
=
Modifier
.
width
(
300
.
dp
)
.
height
(
50
.
dp
)
.
border
(
1
.
dp
,
Color
.
Gray
)
.
padding
(
10
.
dp
)
.
semantics
{
contentDescription
=
"文本项目 第 $index 号"
}
)
}
}
}
composeApp/src/commonMain/kotlin/com.dong.demo013/App.kt
View file @
3a1a03d9
...
...
@@ -29,7 +29,7 @@ import kotlin.native.concurrent.ThreadLocal
@Composable
internal
fun
App
()
{
LaunchedEffect
(
Unit
){
LaunchedEffect
(
Unit
)
{
allBreakpoints
()
}
MaterialTheme
{
...
...
@@ -45,6 +45,7 @@ internal fun App() {
}
)
}
is
Page
.
Detail
->
{
DemoScreen
(
demo
=
p
.
demo
,
onBack
=
{
page
=
Page
.
Home
})
}
...
...
@@ -60,10 +61,36 @@ internal fun HomeScreen(
modifier
=
Modifier
.
fillMaxSize
()
.
padding
(
16
.
dp
)
.
verticalScroll
(
rememberScrollState
())
,
.
verticalScroll
(
rememberScrollState
()),
verticalArrangement
=
Arrangement
.
spacedBy
(
16
.
dp
),
)
{
Card
(
modifier
=
Modifier
.
fillMaxWidth
(),
elevation
=
8
.
dp
,
shape
=
RoundedCornerShape
(
12
.
dp
)
)
{
Column
(
modifier
=
Modifier
.
fillMaxWidth
()
.
padding
(
16
.
dp
)
)
{
Button
(
onClick
=
{
os_signal_set
(
"离开首页"
)
val
debugDataDemo
=
ComponentDemo
(
id
=
"to_1500"
,
title
=
"进入1500Text测试页面"
,
group
=
ComposeGroup
.
Foundation
)
onSelect
(
debugDataDemo
)
},
modifier
=
Modifier
.
fillMaxWidth
()
)
{
}
}
}
// 第一个模块:debug页面
Card
(
modifier
=
Modifier
.
fillMaxWidth
(),
...
...
@@ -272,7 +299,7 @@ internal fun HomeScreen(
verticalArrangement
=
Arrangement
.
spacedBy
(
8
.
dp
)
)
{
Button
(
onClick
=
{
onClick
=
{
val
logDemo
=
ComponentDemo
(
id
=
"log_test_demo"
,
title
=
"日志测试演示(持续产生)"
,
...
...
@@ -331,16 +358,18 @@ internal fun DemoScreen(
)
{
Text
(
"返回首页"
)
}
// 根据 demo.id 显示对应的内容
when
(
demo
.
id
)
{
//日志
"log_test_demo"
->
{
HighLogDemo
()
}
"log_fault_demo"
->
{
FaultLogDemo
()
}
"log_over_demo"
->
{
NativeFaultDemo
()
}
...
...
@@ -348,15 +377,23 @@ internal fun DemoScreen(
"debug_test_demo"
->
{
DebugTestDemo
()
}
"debug_stepover_demo"
->
{
DebugStepOverDemo
()
}
"debug_stepinto_demo"
->
{
DebugStepIntoDemo
()
}
"debug_stepout_demo"
->
{
DebugStepOutDemo
()
}
"to_1500"
->
{
Compose1500Text
()
}
else
->
{
Text
(
text
=
"暂未实现: ${demo.title}"
,
...
...
composeApp/src/commonMain/kotlin/com.dong.demo013/TestLog.kt
View file @
3a1a03d9
...
...
@@ -14,4 +14,8 @@ expect fun testArkTsToKotin();
//稳定触发鸿蒙卡死
expect
fun
triggerANRByInfiniteLoop
();
\ No newline at end of file
expect
fun
triggerANRByInfiniteLoop
();
expect
fun
os_signal_set
(
type
:
String
)
composeApp/src/iosMain/kotlin/com.dong.demo013/TestLog.ios.kt
View file @
3a1a03d9
package
com.dong.demo013
import
platform.Foundation.NSNotificationCenter
actual
fun
pirntAllLevelHiLog
()
{
}
...
...
@@ -14,4 +16,12 @@ actual fun testArkTsToKotin() {
}
actual
fun
triggerANRByInfiniteLoop
()
{
}
actual
fun
os_signal_set
(
type
:
String
)
{
val
notificationName
=
"set_os_signal"
val
userInfo
=
null
NSNotificationCenter
.
defaultCenter
().
postNotificationName
(
notificationName
,
type
)
}
\ No newline at end of file
gradle/libs.versions.toml
View file @
3a1a03d9
...
...
@@ -23,7 +23,7 @@ composeMultiplatform = "1.9.2-0.2.0-04"
# Kotlin & testing
junit
=
"4.13.2"
kotlin
=
"2.2.21-0.2.0-
12
"
kotlin
=
"2.2.21-0.2.0-
04
"
kotlinx-coroutines
=
"1.10.2-0.2.0-02"
atomicFu
=
"0.31.0-0.2.0-03"
...
...
iosApp/iosApp.xcodeproj/project.pbxproj
View file @
3a1a03d9
...
...
@@ -175,7 +175,7 @@
);
runOnlyForDeploymentPostprocessing
=
0
;
shellPath
=
/bin/sh
;
shellScript
=
"if [ \"
YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"Skipping Gradle build task invocation due to OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED environment variable set to \\\"YES\\\"
\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :composeApp:embedAndSignAppleFrameworkForXcode\n"
;
shellScript
=
"if [ \"
1\" = \"${SKIP_GRADLE_KOTLIN_EMBED:-}\" ]; then\n echo \"SKIP_GRADLE_KOTLIN_EMBED=1: 跳过 Gradle,请使用已拖入的 ComposeApp.framework(FRAMEWORK_SEARCH_PATHS 含 \\$(PROJECT_DIR)/Frameworks)\"\n exit 0\nfi\nif [ \"YES\" = \"$OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED\" ]; then\n echo \"注意: OVERRIDE_KOTLIN_BUILD_IDE_SUPPORTED=YES 会跳过 embed;若未手动更新 framework,链接会失败。可设 SKIP_GRADLE_KOTLIN_EMBED=1 明确表示只用拖入的 framework。
\"\n exit 0\nfi\ncd \"$SRCROOT/..\"\n./gradlew :composeApp:embedAndSignAppleFrameworkForXcode\n"
;
};
/* End PBXShellScriptBuildPhase section */
...
...
@@ -323,7 +323,8 @@
ENABLE_PREVIEWS
=
YES
;
FRAMEWORK_SEARCH_PATHS
=
(
"$(inherited)"
,
"$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)"
,
"$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)"
,
"$(PROJECT_DIR)/Frameworks"
,
);
INFOPLIST_FILE
=
iosApp/Info.plist
;
IPHONEOS_DEPLOYMENT_TARGET
=
15.3
;
...
...
@@ -334,7 +335,7 @@
OTHER_LDFLAGS
=
(
"$(inherited)"
,
"-framework"
,
composeApp
,
"ComposeApp"
,
);
PRODUCT_BUNDLE_IDENTIFIER
=
com.eazytec.dong.testKmpIOS
;
PRODUCT_NAME
=
Demo
;
...
...
@@ -355,7 +356,8 @@
ENABLE_PREVIEWS
=
YES
;
FRAMEWORK_SEARCH_PATHS
=
(
"$(inherited)"
,
"$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)\n$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)"
,
"$(SRCROOT)/../composeApp/build/xcode-frameworks/$(CONFIGURATION)/$(SDK_NAME)"
,
"$(PROJECT_DIR)/Frameworks"
,
);
INFOPLIST_FILE
=
iosApp/Info.plist
;
IPHONEOS_DEPLOYMENT_TARGET
=
15.3
;
...
...
@@ -366,7 +368,7 @@
OTHER_LDFLAGS
=
(
"$(inherited)"
,
"-framework"
,
composeApp
,
"ComposeApp"
,
);
PRODUCT_BUNDLE_IDENTIFIER
=
com.eazytec.dong.testKmpIOS
;
PRODUCT_NAME
=
Demo
;
...
...
iosApp/iosApp/iOSApp.swift
View file @
3a1a03d9
...
...
@@ -7,7 +7,19 @@ struct iOSApp: App {
var
body
:
some
Scene
{
let
test1
:
String
=
"111"
;
WindowGroup
{
ContentView
()
ContentView
()
.
onAppear
(){
NotificationCenter
.
default
.
addObserver
(
forName
:
NSNotification
.
Name
(
"set_os_signal"
),
object
:
nil
,
queue
:
.
main
)
{
note
in
if
let
text
=
note
.
object
as?
String
{
print
(
"set_os_signal:
\(
text
)
"
)
}
}
}
.
ignoresSafeArea
()
.
background
(
Color
.
clear
)
// 确保整个背景透明
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment