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
b592ddbd
Commit
b592ddbd
authored
Feb 22, 2026
by
dsq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expect/actual实现
parent
519a5ca4
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
23 deletions
+60
-23
build.gradle.kts
composeApp/build.gradle.kts
+23
-7
TestLog.iosArm64.kt
.../iosArm64Main/kotlin/com.dong.demo013/TestLog.iosArm64.kt
+5
-0
TestLog.ohosArm64.kt
...hosArm64Main/kotlin/com.dong.demo013/TestLog.ohosArm64.kt
+1
-1
TimerControllerImpl.kt
...sArm64Main/kotlin/com.dong.demo013/TimerControllerImpl.kt
+1
-1
gradle.properties
gradle.properties
+1
-1
libkn.so
harmonyApp/entry/libs/arm64-v8a/libkn.so
+0
-0
libkn_api.h
harmonyApp/entry/src/main/cpp/include/libkn_api.h
+29
-13
No files found.
composeApp/build.gradle.kts
View file @
b592ddbd
...
...
@@ -78,15 +78,19 @@ kotlin {
ohosArm64
{
binaries
.
sharedLib
{
baseName
=
"kn"
// 共享库名称为kn
freeCompilerArgs
+=
listOf
(
"-Xbinary=sanitizer=address"
)
freeCompilerArgs
+=
listOf
(
"-Xbinary=sanitizer=address"
,
"-Xdisable-platform-devices"
// 禁用平台设备库
)
export
(
libs
.
compose
.
multiplatform
.
export
)
// 导出compose多平台库的接口
}
val
main
by
compilations
.
getting
// 获取主编译内容
// val resource by main.cinterops.creating {
// //配置C interop(cinterop)资源
// defFile(file("src/ohosArm64Main/cinterop/resource.def")) // cinterop定义文件
// includeDirs(file("src/ohosArm64Main/cinterop/include")) // cinterop包含目录
// }
// val main by compilations.getting // 获取主编译内容
// val resource by main.cinterops.creating {
// //配置C interop(cinterop)资源
// defFile(file("src/ohosArm64Main/cinterop/resource.def")) // cinterop定义文件
// includeDirs(file("src/ohosArm64Main/cinterop/include")) // cinterop包含目录
// compilerOpts("-fno-modules") // 禁用模块以避免平台库依赖
// }
}
...
...
@@ -108,9 +112,21 @@ kotlin {
implementation
(
libs
.
kotlinx
.
coroutines
.
core
)
// 官方协程核心库
implementation
(
libs
.
atomicFu
)
// Kotlin AtomicFu原子库
}
commonTest
.
dependencies
{
implementation
(
libs
.
kotlin
.
test
)
// 添加Kotlin通用测试依赖
}
val
ohosArm64Main
by
getting
{
dependencies
{
api
(
libs
.
compose
.
multiplatform
.
export
)
// 导出compose多平台接口给依赖消费者
// 添加OHOS平台特定依赖
implementation
(
"org.jetbrains.kotlin:kotlin-stdlib"
)
}
}
// iOS平台配置
iosMain
{
dependencies
{
implementation
(
libs
.
kotlinx
.
coroutines
.
core
)
// iOS也需要协程支持
}
}
}
...
...
composeApp/src/iosArm64Main/kotlin/com.dong.demo013/TestLog.iosArm64.kt
0 → 100644
View file @
b592ddbd
package
com.dong.demo013
actual
fun
createTimer
():
com
.
dong
.
demo013
.
TimerController
{
TODO
(
"Not yet implemented"
)
}
composeApp/src/ohosArm64Main/kotlin/com.dong.demo013/TestLog.ohosArm64.kt
View file @
b592ddbd
package
com.dong.demo013
import
com.dong.
test1
.TimerControllerImpl
import
com.dong.
demo013
.TimerControllerImpl
import
kotlinx.coroutines.DelicateCoroutinesApi
import
kotlinx.coroutines.GlobalScope
import
kotlinx.coroutines.launch
...
...
composeApp/src/ohosArm64Main/kotlin/com.dong.demo013/TimerControllerImpl.kt
View file @
b592ddbd
package
com.dong.
test1
package
com.dong.
demo013
import
com.dong.demo013.TimerController
import
kotlinx.atomicfu.AtomicBoolean
...
...
gradle.properties
View file @
b592ddbd
...
...
@@ -16,4 +16,4 @@ kotlin.native.cacheKind=none
org.gradle.internal.http.connectionTimeout
=
100000
org.gradle.internal.http.socketTimeout
=
100000
kotlin.mpp.applyDefaultHierarchyTemplate
=
false
#
kotlin.mpp.applyDefaultHierarchyTemplate=false
harmonyApp/entry/libs/arm64-v8a/libkn.so
View file @
b592ddbd
No preview for this file type
harmonyApp/entry/src/main/cpp/include/libkn_api.h
View file @
b592ddbd
...
...
@@ -122,7 +122,7 @@ typedef struct {
}
libkn_kref_com_dong_demo013_OhosPlatform
;
typedef
struct
{
libkn_KNativePtr
pinned
;
}
libkn_kref_com_dong_
test1
_TimerControllerImpl
;
}
libkn_kref_com_dong_
demo013
_TimerControllerImpl
;
extern
void
*
MainArkUIViewController
(
void
*
env
);
extern
libkn_KInt
hiLogPrintMsg
(
libkn_KUInt
type
,
libkn_KUInt
level
,
libkn_KUInt
domain
,
const
char
*
tag
,
const
char
*
message
);
...
...
@@ -293,69 +293,85 @@ typedef struct {
libkn_kref_com_dong_demo013_OhosPlatform
(
*
OhosPlatform
)();
const
char
*
(
*
get_name
)(
libkn_kref_com_dong_demo013_OhosPlatform
thiz
);
}
OhosPlatform
;
struct
{
libkn_KType
*
(
*
_type
)(
void
);
libkn_kref_com_dong_demo013_TimerControllerImpl
(
*
TimerControllerImpl
)();
libkn_KLong
(
*
get_elapsedTime
)(
libkn_kref_com_dong_demo013_TimerControllerImpl
thiz
);
libkn_KBoolean
(
*
get_isRunning
)(
libkn_kref_com_dong_demo013_TimerControllerImpl
thiz
);
void
(
*
reset
)(
libkn_kref_com_dong_demo013_TimerControllerImpl
thiz
);
void
(
*
start
)(
libkn_kref_com_dong_demo013_TimerControllerImpl
thiz
);
void
(
*
stop
)(
libkn_kref_com_dong_demo013_TimerControllerImpl
thiz
);
}
TimerControllerImpl
;
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter_
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter_
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter_
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter_
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter__
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter__
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter__
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter__
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter___
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter___
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter___
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter___
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter____
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter____
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter____
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter____
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter_____
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter_____
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter_____
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter_____
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter______
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter______
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter______
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter______
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter_______
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter_______
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter_______
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter_______
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter________
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter________
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter________
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter________
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter_________
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter_________
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter_________
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter_________
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter__________
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter__________
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter__________
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter__________
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter___________
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter___________
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter___________
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter___________
)();
void
*
(
*
MainArkUIViewController_
)(
void
*
env
);
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter____________
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter____________
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter____________
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter____________
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter_____________
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter_____________
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter_____________
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter_____________
)();
libkn_kref_com_dong_demo013_Platform
(
*
getPlatform
)();
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter______________
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter______________
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter______________
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter______________
)();
libkn_kref_com_dong_demo013_TimerController
(
*
createTimer
)();
libkn_KInt
(
*
hiLogPrintMsg_
)(
libkn_KUInt
type
,
libkn_KUInt
level
,
libkn_KUInt
domain
,
const
char
*
tag
,
const
char
*
message
);
libkn_kref_com_dong_demo013_LogController
(
*
startLog
)(
libkn_KInt
speed
,
libkn_kref_kotlin_Function1
onLogGenerated
,
libkn_kref_kotlin_Function1
onTimerUpdated
);
libkn_KInt
(
*
com_dong_demo013_Greeting
$
stableprop_getter_______________
)();
libkn_KInt
(
*
com_dong_demo013_LogControllerImpl
$
stableprop_getter_______________
)();
libkn_KInt
(
*
com_dong_demo013_OhosPlatform
$
stableprop_getter_______________
)();
libkn_KInt
(
*
com_dong_demo013_TimerControllerImpl
$
stableprop_getter_______________
)();
}
demo013
;
struct
{
struct
{
libkn_KType
*
(
*
_type
)(
void
);
libkn_kref_com_dong_test1_TimerControllerImpl
(
*
TimerControllerImpl
)();
libkn_KLong
(
*
get_elapsedTime
)(
libkn_kref_com_dong_test1_TimerControllerImpl
thiz
);
libkn_KBoolean
(
*
get_isRunning
)(
libkn_kref_com_dong_test1_TimerControllerImpl
thiz
);
void
(
*
reset
)(
libkn_kref_com_dong_test1_TimerControllerImpl
thiz
);
void
(
*
start
)(
libkn_kref_com_dong_test1_TimerControllerImpl
thiz
);
void
(
*
stop
)(
libkn_kref_com_dong_test1_TimerControllerImpl
thiz
);
}
TimerControllerImpl
;
libkn_KInt
(
*
com_dong_test1_TimerControllerImpl
$
stableprop_getter
)();
}
test1
;
}
dong
;
}
com
;
struct
{
...
...
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