sparkling-method 2.1.0-rc.12 → 2.1.0-rc.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/package.json +6 -1
  2. package/android/build.gradle.kts +0 -245
  3. package/android/gradle.properties +0 -1
  4. package/android/proguard-rules.pro +0 -21
  5. package/android/src/androidTest/java/com/tiktok/sparkling/sparkling/methods/ExampleInstrumentedTest.kt +0 -27
  6. package/android/src/main/AndroidManifest.xml +0 -5
  7. package/android/src/main/java/com/tiktok/sparkling/method/protocol/BridgeContext.kt +0 -74
  8. package/android/src/main/java/com/tiktok/sparkling/method/protocol/DefaultBridgeClientImp.kt +0 -47
  9. package/android/src/main/java/com/tiktok/sparkling/method/protocol/DefaultBridgeLifeClientImp.kt +0 -233
  10. package/android/src/main/java/com/tiktok/sparkling/method/protocol/InnerBridge.kt +0 -134
  11. package/android/src/main/java/com/tiktok/sparkling/method/protocol/entity/BridgeCall.kt +0 -79
  12. package/android/src/main/java/com/tiktok/sparkling/method/protocol/entity/BridgeResult.kt +0 -68
  13. package/android/src/main/java/com/tiktok/sparkling/method/protocol/handler/BridgeDispatcher.kt +0 -198
  14. package/android/src/main/java/com/tiktok/sparkling/method/protocol/handler/BridgeFactoryManager.kt +0 -16
  15. package/android/src/main/java/com/tiktok/sparkling/method/protocol/handler/BridgeThreadDispatcher.kt +0 -56
  16. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/errors/JSBErrorReportModel.kt +0 -144
  17. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/interceptor/BridgeMockInterceptor.kt +0 -30
  18. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/lifecycle/fe/FeCallMonitorModel.kt +0 -66
  19. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/lynx/LynxBridgeDelegateModule.kt +0 -31
  20. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/lynx/LynxBridgeProtol.kt +0 -69
  21. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/lynx/LynxRuntimeBridgeDelegateModule.kt +0 -31
  22. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/lynx/LynxViewImpl.kt +0 -29
  23. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/lynx/RealLynxBridgeDelegate.kt +0 -147
  24. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/monitor/BridgeSDKMonitor.kt +0 -239
  25. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/monitor/IBridgeMonitor.kt +0 -17
  26. package/android/src/main/java/com/tiktok/sparkling/method/protocol/impl/monitor/MonitorEntity.kt +0 -22
  27. package/android/src/main/java/com/tiktok/sparkling/method/protocol/interfaces/IBridgeCallback.kt +0 -14
  28. package/android/src/main/java/com/tiktok/sparkling/method/protocol/interfaces/IBridgeClient.kt +0 -19
  29. package/android/src/main/java/com/tiktok/sparkling/method/protocol/interfaces/IBridgeHandler.kt +0 -23
  30. package/android/src/main/java/com/tiktok/sparkling/method/protocol/interfaces/IBridgeLifeClient.kt +0 -45
  31. package/android/src/main/java/com/tiktok/sparkling/method/protocol/interfaces/IBridgeMethodCallback.kt +0 -10
  32. package/android/src/main/java/com/tiktok/sparkling/method/protocol/interfaces/IBridgeProtocol.kt +0 -22
  33. package/android/src/main/java/com/tiktok/sparkling/method/protocol/utils/BridgeConstants.kt +0 -13
  34. package/android/src/main/java/com/tiktok/sparkling/method/protocol/utils/BridgeConverter.kt +0 -147
  35. package/android/src/main/java/com/tiktok/sparkling/method/protocol/utils/LogUtils.kt +0 -37
  36. package/android/src/main/java/com/tiktok/sparkling/method/protocol/utils/MonitorUtils.kt +0 -41
  37. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/BridgeLocalPool.kt +0 -70
  38. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/BridgeSettings.kt +0 -19
  39. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/BusinessCallHandler.kt +0 -100
  40. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/CancelCallbackConfig.kt +0 -13
  41. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/DefaultCallHandler.kt +0 -106
  42. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/IBridgeMethod.kt +0 -118
  43. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/PiperDataExt.kt +0 -71
  44. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/SparklingBridge.kt +0 -374
  45. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/Utils.kt +0 -89
  46. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/interfaces/IBridgeNotFound.kt +0 -11
  47. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/processor/LynxDataProcessorForMap.kt +0 -204
  48. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/processor/LynxPlatformDataProcessor.kt +0 -239
  49. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/processor/WebPlatformDataProcessor.kt +0 -307
  50. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/processor/WebProcessorForMap.kt +0 -227
  51. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/util/BridgeMethodCallbackHelper.kt +0 -29
  52. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/util/BridgeProtocolConstants.kt +0 -12
  53. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/util/DataConvertUtils.kt +0 -684
  54. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/util/IConvertUtils.kt +0 -44
  55. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/util/LogHelper.kt +0 -30
  56. package/android/src/main/java/com/tiktok/sparkling/method/registry/api/util/ThreadPool.kt +0 -73
  57. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/BridgeCollections.kt +0 -194
  58. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/BridgePlatformType.kt +0 -13
  59. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/IBridgeContext.kt +0 -137
  60. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/IDLBridgeMethod.kt +0 -100
  61. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/IDLMethodProvider.kt +0 -13
  62. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/IDLMethodRegistry.kt +0 -132
  63. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/IDLMethodRegistryCache.kt +0 -150
  64. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/IDLMethodRegistryCacheManager.kt +0 -34
  65. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/IDLProxyClient.kt +0 -28
  66. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/IRegister.kt +0 -21
  67. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/LocalBridge.kt +0 -70
  68. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/ReadableMapImpl.kt +0 -227
  69. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/RegistryCache.kt +0 -77
  70. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/SparklingBridgeManager.kt +0 -50
  71. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/annotation/IDLMethodIntEnum.kt +0 -15
  72. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/annotation/IDLMethodName.kt +0 -14
  73. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/annotation/IDLMethodParamField.kt +0 -42
  74. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/annotation/IDLMethodParamModel.kt +0 -10
  75. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/annotation/IDLMethodResultModel.kt +0 -10
  76. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/annotation/IDLMethodStringEnum.kt +0 -15
  77. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/base/AbsSparklingIDLMethod.kt +0 -276
  78. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/exception/IDLMethodException.kt +0 -10
  79. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/exception/IllegalInputParamException.kt +0 -12
  80. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/exception/IllegalOperationException.kt +0 -12
  81. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/exception/IllegalOutputParamException.kt +0 -13
  82. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/interfaces/IContainerIDProvider.kt +0 -13
  83. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/interfaces/INameSpaceProvider.kt +0 -13
  84. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/interfaces/IPlatformDataProcessor.kt +0 -19
  85. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/interfaces/IReleasable.kt +0 -13
  86. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/model/context/BridgeCallThreadTypeConfig.kt +0 -44
  87. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/model/context/ContextProviderFactory.kt +0 -133
  88. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/model/idl/CompletionBlock.kt +0 -26
  89. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/model/idl/IDLDynamic.kt +0 -97
  90. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/model/idl/IDLMethodBaseModel.kt +0 -37
  91. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/model/idl/IDLMethodBaseParamModel.kt +0 -62
  92. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/model/idl/IDLMethodBaseResultModel.kt +0 -18
  93. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/utils/BridgeKTX.kt +0 -37
  94. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/utils/IAssignDir.kt +0 -25
  95. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/utils/IDLMethodHelper.kt +0 -44
  96. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/utils/IDLMethodResultModelArguments.kt +0 -264
  97. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/utils/IDLMethodResultModelHelper.kt +0 -194
  98. package/android/src/main/java/com/tiktok/sparkling/method/registry/core/utils/JsonUtils.kt +0 -200
  99. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/BridgeBaseRuntime.kt +0 -11
  100. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/CommonDependsProvider.kt +0 -14
  101. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/common/IHostNetworkDepend.kt +0 -19
  102. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/common/IHostPermissionDepend.kt +0 -34
  103. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/common/IHostThreadPoolExecutorDepend.kt +0 -12
  104. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/network/AbsStreamConnection.kt +0 -36
  105. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/network/AbsStringConnection.kt +0 -30
  106. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/network/HttpRequest.kt +0 -134
  107. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/network/NetworkRequestImpl.kt +0 -28
  108. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/network/RequestJsonFormatOptionConstants.kt +0 -10
  109. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/utils/BridgeAPIRequestUtils.kt +0 -365
  110. package/android/src/main/java/com/tiktok/sparkling/method/runtime/depend/utils/HttpUrlBuilder.kt +0 -97
  111. package/android/src/main/res/drawable/ic_launcher_background.xml +0 -170
  112. package/android/src/main/res/drawable/ic_launcher_foreground.xml +0 -30
  113. package/android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +0 -6
  114. package/android/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +0 -6
  115. package/android/src/main/res/mipmap-hdpi/ic_launcher.webp +0 -0
  116. package/android/src/main/res/mipmap-hdpi/ic_launcher_round.webp +0 -0
  117. package/android/src/main/res/mipmap-mdpi/ic_launcher.webp +0 -0
  118. package/android/src/main/res/mipmap-mdpi/ic_launcher_round.webp +0 -0
  119. package/android/src/main/res/mipmap-xhdpi/ic_launcher.webp +0 -0
  120. package/android/src/main/res/mipmap-xhdpi/ic_launcher_round.webp +0 -0
  121. package/android/src/main/res/mipmap-xxhdpi/ic_launcher.webp +0 -0
  122. package/android/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp +0 -0
  123. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher.webp +0 -0
  124. package/android/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp +0 -0
  125. package/android/src/main/res/values/colors.xml +0 -10
  126. package/android/src/main/res/values/strings.xml +0 -3
  127. package/android/src/test/java/com/tiktok/sparkling/method/TestApplication.kt +0 -19
  128. package/android/src/test/java/com/tiktok/sparkling/method/protocol/BridgeContextTest.kt +0 -89
  129. package/android/src/test/java/com/tiktok/sparkling/method/protocol/DefaultBridgeClientImpTest.kt +0 -78
  130. package/android/src/test/java/com/tiktok/sparkling/method/protocol/DefaultBridgeLifeClientImpTest.kt +0 -97
  131. package/android/src/test/java/com/tiktok/sparkling/method/protocol/InnerBridgeTest.kt +0 -105
  132. package/android/src/test/java/com/tiktok/sparkling/method/protocol/entity/BridgeCallTest.kt +0 -61
  133. package/android/src/test/java/com/tiktok/sparkling/method/protocol/entity/BridgeResultTest.kt +0 -74
  134. package/android/src/test/java/com/tiktok/sparkling/method/protocol/handler/BridgeDispatcherTest.kt +0 -96
  135. package/android/src/test/java/com/tiktok/sparkling/method/protocol/handler/BridgeFactoryManagerTest.kt +0 -21
  136. package/android/src/test/java/com/tiktok/sparkling/method/protocol/handler/BridgeThreadDispatcherTest.kt +0 -34
  137. package/android/src/test/java/com/tiktok/sparkling/method/protocol/impl/errors/JSBErrorReportModelTest.kt +0 -60
  138. package/android/src/test/java/com/tiktok/sparkling/method/protocol/impl/interceptor/BridgeMockInterceptorTest.kt +0 -51
  139. package/android/src/test/java/com/tiktok/sparkling/method/protocol/impl/lifecycle/fe/FeCallMonitorModelTest.kt +0 -65
  140. package/android/src/test/java/com/tiktok/sparkling/method/protocol/impl/lynx/LynxBridgeDelegateModuleTest.kt +0 -57
  141. package/android/src/test/java/com/tiktok/sparkling/method/protocol/impl/lynx/LynxBridgeProtocolTest.kt +0 -10
  142. package/android/src/test/java/com/tiktok/sparkling/method/protocol/impl/lynx/LynxRuntimeBridgeDelegateModuleTest.kt +0 -37
  143. package/android/src/test/java/com/tiktok/sparkling/method/protocol/impl/lynx/RealLynxBridgeDelegateTest.kt +0 -10
  144. package/android/src/test/java/com/tiktok/sparkling/method/protocol/impl/monitor/BridgeSDKMonitorTest.kt +0 -10
  145. package/android/src/test/java/com/tiktok/sparkling/method/protocol/impl/monitor/MonitorEntityTest.kt +0 -43
  146. package/android/src/test/java/com/tiktok/sparkling/method/registry/api/SparklingBridgeTest.kt +0 -444
  147. package/android/src/test/java/com/tiktok/sparkling/method/registry/api/util/DataConvertUtilsTest.kt +0 -236
  148. package/android/src/test/java/com/tiktok/sparkling/method/registry/core/IDLMethodRegistryTest.kt +0 -331
  149. package/android/src/test/java/com/tiktok/sparkling/method/registry/core/LocalBridgeTest.kt +0 -299
  150. package/android/src/test/java/com/tiktok/sparkling/method/registry/core/SparklingBridgeManagerTest.kt +0 -213
  151. package/android/src/test/java/com/tiktok/sparkling/method/registry/core/base/AbsSparklingIDLMethodTest.kt +0 -307
  152. package/android/src/test/java/com/tiktok/sparkling/method/registry/core/exception/IDLMethodExceptionTest.kt +0 -311
  153. package/android/src/test/java/com/tiktok/sparkling/method/runtime/depend/BridgeBaseRuntimeTest.kt +0 -54
  154. package/android/src/test/resources/robolectric.properties +0 -5
  155. package/src/index.ts +0 -240
  156. package/src/types.ts +0 -44
  157. package/src/typing.d.ts +0 -44
  158. package/tsconfig.json +0 -15
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sparkling-method",
3
- "version": "2.1.0-rc.12",
3
+ "version": "2.1.0-rc.14",
4
4
  "homepage": "https://tiktok.github.io/sparkling/",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,6 +9,11 @@
9
9
  },
10
10
  "main": "dist/index.js",
11
11
  "types": "dist/index.d.ts",
12
+ "files": [
13
+ "dist",
14
+ "ios",
15
+ "README.md"
16
+ ],
12
17
  "devDependencies": {
13
18
  "@lynx-js/types": "3.6.0",
14
19
  "typescript": "^5.8.3"
@@ -1,245 +0,0 @@
1
- import org.gradle.api.publish.PublishingExtension
2
- import org.gradle.api.publish.maven.MavenPublication
3
- import org.gradle.api.tasks.bundling.Jar
4
-
5
- plugins {
6
- alias(libs.plugins.android.library)
7
- alias(libs.plugins.kotlin.android)
8
- id("maven-publish")
9
- id("signing")
10
- jacoco
11
- }
12
-
13
- android {
14
- namespace = "com.tiktok.sparkling.method"
15
- compileSdk = 34
16
-
17
- defaultConfig {
18
- minSdk = 21
19
- testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
20
- }
21
-
22
- buildTypes {
23
- debug {
24
- enableUnitTestCoverage = true
25
- }
26
- release {
27
- isMinifyEnabled = false
28
- proguardFiles(
29
- getDefaultProguardFile("proguard-android-optimize.txt"),
30
- "proguard-rules.pro"
31
- )
32
- }
33
- }
34
- compileOptions {
35
- sourceCompatibility = JavaVersion.VERSION_11
36
- targetCompatibility = JavaVersion.VERSION_11
37
- }
38
- kotlinOptions {
39
- jvmTarget = "11"
40
- }
41
-
42
- testOptions {
43
- unitTests {
44
- isIncludeAndroidResources = true
45
- all {
46
- it.jvmArgs("-Xmx2048m", "-XX:MaxMetaspaceSize=512m")
47
- it.systemProperty("robolectric.logging.enabled", "true")
48
- it.systemProperty(
49
- "user.home",
50
- buildDir.resolve("robolectric-home").absolutePath
51
- )
52
- }
53
- }
54
- }
55
- }
56
-
57
- dependencies {
58
-
59
- implementation(libs.androidx.core.ktx)
60
- implementation(libs.androidx.appcompat)
61
- testImplementation(libs.junit)
62
- androidTestImplementation(libs.androidx.junit)
63
- androidTestImplementation(libs.androidx.espresso.core)
64
-
65
- // Testing dependencies
66
- testImplementation("io.mockk:mockk:1.13.8")
67
- testImplementation("org.robolectric:robolectric:4.10.3")
68
- testImplementation("org.bouncycastle:bcprov-jdk18on:1.75")
69
- testImplementation("androidx.test:core:1.5.0")
70
- testImplementation("androidx.test.ext:junit:1.1.5")
71
- testImplementation("org.mockito:mockito-core:5.2.0")
72
- testImplementation("org.mockito:mockito-inline:5.2.0")
73
- testImplementation("androidx.test:runner:1.5.2")
74
- testImplementation("androidx.test:rules:1.5.0")
75
- // Removed PowerMock due to compatibility issues with Robolectric and Java 11
76
-
77
- api(libs.lynx)
78
- api("com.google.code.gson:gson:2.8.9")
79
- }
80
-
81
- tasks.withType<Test>().configureEach {
82
- doFirst {
83
- buildDir.resolve("robolectric-home").mkdirs()
84
- }
85
- }
86
-
87
- tasks.register<JacocoReport>("jacocoTestReport") {
88
- dependsOn(tasks.named("testDebugUnitTest"))
89
-
90
- reports {
91
- xml.required.set(true)
92
- html.required.set(true)
93
- }
94
-
95
- val fileFilter = listOf(
96
- "**/R.class",
97
- "**/R$*.class",
98
- "**/BuildConfig.*",
99
- "**/Manifest*.*",
100
- "**/*Test*.*",
101
- "android/**/*.*"
102
- )
103
-
104
- val mainSrc = "${project.projectDir}/src/main/java"
105
- sourceDirectories.setFrom(files(mainSrc))
106
-
107
- val debugJavaTree = layout.buildDirectory.dir("intermediates/javac/debug").map { dir ->
108
- dir.asFileTree.matching {
109
- exclude(fileFilter)
110
- }
111
- }
112
- val debugKotlinTree = layout.buildDirectory.dir("tmp/kotlin-classes/debug").map { dir ->
113
- dir.asFileTree.matching {
114
- exclude(fileFilter)
115
- }
116
- }
117
- classDirectories.setFrom(debugJavaTree, debugKotlinTree)
118
-
119
- val unitTestCoverageExec = layout.buildDirectory.file("outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec")
120
- val jacocoExec = layout.buildDirectory.file("jacoco/testDebugUnitTest.exec")
121
- executionData.setFrom(files(unitTestCoverageExec, jacocoExec))
122
-
123
- onlyIf {
124
- executionData.files.any { it.exists() }
125
- }
126
- outputs.upToDateWhen { false }
127
- }
128
-
129
- val publishingGroupId = (findProperty("SPARKLING_PUBLISHING_GROUP_ID") as? String)
130
- ?: System.getenv("SPARKLING_PUBLISHING_GROUP_ID")
131
- ?: "com.tiktok.sparkling"
132
- val publishingVersion = (findProperty("SPARKLING_PUBLISHING_VERSION") as? String)
133
- ?: System.getenv("SPARKLING_PUBLISHING_VERSION")
134
- ?: "2.0.0"
135
-
136
- val androidSourcesJar by tasks.register<Jar>("androidSourcesJar") {
137
- archiveClassifier.set("sources")
138
- from(android.sourceSets.getByName("main").java.srcDirs)
139
- }
140
-
141
- val emptyJavadocJar by tasks.register<Jar>("javadocJar") {
142
- archiveClassifier.set("javadoc")
143
- }
144
-
145
- afterEvaluate {
146
- extensions.configure<PublishingExtension>("publishing") {
147
- publications {
148
- create<MavenPublication>("release") {
149
- groupId = publishingGroupId
150
- artifactId = "sparkling-method"
151
- version = publishingVersion
152
-
153
- from(components["release"])
154
- artifact(androidSourcesJar)
155
- artifact(emptyJavadocJar)
156
-
157
- pom {
158
- name.set("sparkling-method")
159
- description.set("Sparkling method Android SDK module")
160
- url.set("https://github.com/tiktok/sparkling")
161
-
162
- licenses {
163
- license {
164
- name.set("Apache-2.0")
165
- url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
166
- }
167
- }
168
-
169
- developers {
170
- developer {
171
- id.set("tiktok")
172
- name.set("TikTok")
173
- email.set("opensource@tiktok.com")
174
- }
175
- }
176
-
177
- scm {
178
- connection.set("scm:git:git://github.com/tiktok/sparkling.git")
179
- developerConnection.set("scm:git:ssh://github.com:tiktok/sparkling.git")
180
- url.set("https://github.com/tiktok/sparkling")
181
- }
182
- }
183
- }
184
- }
185
-
186
- repositories {
187
- maven {
188
- name = "MavenCentral"
189
- // Central Portal staging API (replaces legacy s01.oss.sonatype.org shut down June 2025)
190
- val repoUrl = (findProperty("mavenCentralRepoUrl") as? String)
191
- ?: System.getenv("MAVEN_CENTRAL_REPO_URL")
192
- ?: "https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"
193
- url = uri(repoUrl)
194
- credentials {
195
- username = (findProperty("mavenCentralUsername") as? String)
196
- ?: System.getenv("MAVEN_CENTRAL_USERNAME")
197
- ?: ""
198
- password = (findProperty("mavenCentralPassword") as? String)
199
- ?: System.getenv("MAVEN_CENTRAL_PASSWORD")
200
- ?: ""
201
- }
202
- }
203
- }
204
- }
205
- }
206
-
207
- // Signing configuration
208
- signing {
209
- val signingKeyId = (findProperty("signing.keyId") as? String)
210
- ?: System.getenv("SIGNING_KEY_ID")
211
- val signingPassword = (findProperty("signing.password") as? String)
212
- ?: System.getenv("SIGNING_PASSWORD")
213
- val signingSecretKeyRingFile = (findProperty("signing.secretKeyRingFile") as? String)
214
- ?: System.getenv("SIGNING_SECRET_KEY_RING_FILE")
215
- val signingKey = System.getenv("SIGNING_KEY")
216
-
217
- if (!signingKeyId.isNullOrBlank() && !signingPassword.isNullOrBlank()) {
218
- if (!signingKey.isNullOrBlank()) {
219
- // Use in-memory key (for CI/CD)
220
- useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
221
- print("Using in-memory GPG key for signing")
222
- } else if (!signingSecretKeyRingFile.isNullOrBlank() && file(signingSecretKeyRingFile).exists()) {
223
- // Use key ring file (for local development)
224
- useInMemoryPgpKeys(signingKeyId, file(signingSecretKeyRingFile).readText(), signingPassword)
225
- print("Using GPG key ring file for signing: $signingSecretKeyRingFile")
226
- } else {
227
- print("Warning: Signing key ID and password provided but no key content available")
228
- }
229
- } else {
230
- print("Warning: GPG signing not configured. Set SIGNING_KEY_ID and SIGNING_PASSWORD environment variables.")
231
- }
232
- }
233
-
234
- // Sign publications after they are configured
235
- afterEvaluate {
236
- signing {
237
- val hasSigningConfig = !(System.getenv("SIGNING_KEY_ID").isNullOrBlank() ||
238
- System.getenv("SIGNING_PASSWORD").isNullOrBlank())
239
- if (hasSigningConfig) {
240
- sign(extensions.getByType<PublishingExtension>().publications["release"])
241
- } else {
242
- print("Skipping signing for publication 'release' - no signing configuration")
243
- }
244
- }
245
- }
@@ -1 +0,0 @@
1
- SPARKLING_PUBLISHING_VERSION=2.0.0-rc.5
@@ -1,21 +0,0 @@
1
- # Add project specific ProGuard rules here.
2
- # You can control the set of applied configuration files using the
3
- # proguardFiles setting in build.gradle.
4
- #
5
- # For more details, see
6
- # http://developer.android.com/guide/developing/tools/proguard.html
7
-
8
- # If your project uses WebView with JS, uncomment the following
9
- # and specify the fully qualified class name to the JavaScript interface
10
- # class:
11
- #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12
- # public *;
13
- #}
14
-
15
- # Uncomment this to preserve the line number information for
16
- # debugging stack traces.
17
- #-keepattributes SourceFile,LineNumberTable
18
-
19
- # If you keep the line number information, uncomment this to
20
- # hide the original source file name.
21
- #-renamesourcefileattribute SourceFile
@@ -1,27 +0,0 @@
1
- // Copyright (c) 2022 TikTok Pte. Ltd.
2
- // Licensed under the Apache License Version 2.0 that can be found in the
3
- // LICENSE file in the root directory of this source tree.
4
- package com.tiktok.sparkling.sparkling.methods
5
-
6
- import androidx.test.platform.app.InstrumentationRegistry
7
- import androidx.test.ext.junit.runners.AndroidJUnit4
8
-
9
- import org.junit.Test
10
- import org.junit.runner.RunWith
11
-
12
- import org.junit.Assert.*
13
-
14
- /**
15
- * Instrumented test, which will execute on an Android device.
16
- *
17
- * See [testing documentation](http://d.android.com/tools/testing).
18
- */
19
- @RunWith(AndroidJUnit4::class)
20
- class ExampleInstrumentedTest {
21
- @Test
22
- fun useAppContext() {
23
- // Context of the app under test.
24
- val appContext = InstrumentationRegistry.getInstrumentation().targetContext
25
- assertEquals("com.tiktok.sparkling.methods", appContext.packageName)
26
- }
27
- }
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
-
4
-
5
- </manifest>
@@ -1,74 +0,0 @@
1
- // Copyright (c) 2022 TikTok Pte. Ltd.
2
- // Licensed under the Apache License Version 2.0 that can be found in the
3
- // LICENSE file in the root directory of this source tree.
4
-
5
-
6
- package com.tiktok.sparkling.method.protocol
7
-
8
- import com.tiktok.sparkling.method.registry.core.BridgePlatformType
9
- import com.tiktok.sparkling.method.registry.api.BusinessCallHandler
10
- import com.tiktok.sparkling.method.registry.api.DefaultCallHandler
11
- import com.tiktok.sparkling.method.registry.api.SparklingBridge
12
- import com.lynx.tasm.LynxBackgroundRuntime
13
- import com.lynx.tasm.LynxView
14
- import com.tiktok.sparkling.method.protocol.entity.BridgeCall
15
- import com.tiktok.sparkling.method.protocol.handler.BridgeDispatcher
16
- import com.tiktok.sparkling.method.protocol.impl.errors.JSBErrorReportModel
17
- import com.tiktok.sparkling.method.protocol.impl.interceptor.BridgeMockInterceptor
18
- import com.tiktok.sparkling.method.protocol.impl.monitor.IBridgeMonitor
19
- import com.tiktok.sparkling.method.protocol.interfaces.IBridgeLifeClient
20
- import com.tiktok.sparkling.method.protocol.interfaces.IBridgeProtocol
21
-
22
- class BridgeContext {
23
- companion object {
24
- fun getPlatformByBridgeContext(bridgeContext: BridgeContext): BridgePlatformType {
25
- return if (bridgeContext.platform == BridgePlatformType.LYNX) {
26
- BridgePlatformType.LYNX
27
- } else if (bridgeContext.platform == BridgePlatformType.WEB) {
28
- BridgePlatformType.WEB
29
- } else {
30
- BridgePlatformType.ALL
31
- }
32
- }
33
- }
34
-
35
- var sparklingBridge: SparklingBridge? = null
36
- var dispatcher: BridgeDispatcher? = null
37
- var bridgeClient = DefaultBridgeClientImp(this)
38
- val bridgeLifeClientImp = DefaultBridgeLifeClientImp(this)
39
- var lynxView : LynxView? = null
40
- var lynxBackgroundRuntime : LynxBackgroundRuntime? = null
41
- var containerId : String? = ""
42
- var protocols : MutableList<IBridgeProtocol> = mutableListOf()
43
- var monitor : MutableSet<IBridgeMonitor> = mutableSetOf()
44
- val defaultCallHandler: DefaultCallHandler = DefaultCallHandler()
45
- var businessCallHandler: BusinessCallHandler? = null
46
- var jsbMockInterceptor : BridgeMockInterceptor? = null // for JSB Mock
47
- var platform: BridgePlatformType = BridgePlatformType.ALL
48
-
49
-
50
- /**
51
- * force on context error, only record view level message in jsbExtension
52
- */
53
- val errorReportModel: JSBErrorReportModel = JSBErrorReportModel()
54
-
55
- fun registerProtocol(protocol: IBridgeProtocol){
56
- protocols.add(protocol)
57
- }
58
-
59
- fun getNamespace() = businessCallHandler?.nameSpace
60
-
61
- fun shouldHandleWithBusinessHandler(call: BridgeCall): Boolean {
62
- return if (businessCallHandler != null && (call.nameSpace == getNamespace() || call.nameSpace.isEmpty())) {
63
- businessCallHandler?.getBridge(this, call.bridgeName) != null
64
- } else false
65
- }
66
-
67
- fun registerIBridgeLifeClient(bridgeLifeClient: IBridgeLifeClient) {
68
- bridgeLifeClientImp.registerIBridgeLifeClient(bridgeLifeClient)
69
- }
70
-
71
- fun getCurrentUrl() : String? {
72
- return this.lynxView?.templateUrl ?: this.lynxBackgroundRuntime?.lastScriptUrl
73
- }
74
- }
@@ -1,47 +0,0 @@
1
- // Copyright (c) 2022 TikTok Pte. Ltd.
2
- // Licensed under the Apache License Version 2.0 that can be found in the
3
- // LICENSE file in the root directory of this source tree.
4
-
5
-
6
- package com.tiktok.sparkling.method.protocol
7
-
8
- import com.tiktok.sparkling.method.protocol.entity.BridgeCall
9
- import com.tiktok.sparkling.method.protocol.entity.BridgeResult
10
- import com.tiktok.sparkling.method.protocol.interfaces.IBridgeClient
11
- import com.tiktok.sparkling.method.protocol.interfaces.IBridgeHandler
12
- import com.tiktok.sparkling.method.protocol.interfaces.IBridgeProtocol
13
- import com.tiktok.sparkling.method.protocol.utils.LogUtils
14
- import org.json.JSONObject
15
-
16
- /**
17
- * default implementation
18
- */
19
- class DefaultBridgeClientImp(val bridgeContext: BridgeContext): IBridgeClient {
20
- private val TAG = "DefaultBridgeClientImp"
21
-
22
- override fun shouldInterceptRequest(call: BridgeCall): BridgeResult? {
23
- // TODO: implement by injection
24
- return null
25
- }
26
-
27
- override fun onBridgeInvoked(protocol: IBridgeProtocol, detail: JSONObject) {
28
- // FIXME pending
29
- }
30
-
31
- override fun onBridgeDispatched(call: BridgeCall) {
32
- LogUtils.e(TAG, "onBridgeCallback: bridgeName: ${call.bridgeName}")
33
- }
34
-
35
- override fun onBridgeResultReceived(name: String, handler: IBridgeHandler, detail: JSONObject) {
36
- LogUtils.e(TAG, "onBridgeCallback: bridgeName: $name")
37
- }
38
-
39
- override fun onBridgeCallback() {
40
- LogUtils.e(TAG, "onBridgeCallback")
41
- }
42
-
43
- override fun onBridgeRejected() {
44
- LogUtils.e(TAG, "onBridgeRejected")
45
- }
46
-
47
- }
@@ -1,233 +0,0 @@
1
- // Copyright (c) 2023 TikTok Pte. Ltd.
2
- // Licensed under the Apache License Version 2.0 that can be found in the
3
- // LICENSE file in the root directory of this source tree.
4
-
5
-
6
- package com.tiktok.sparkling.method.protocol
7
-
8
- import com.tiktok.sparkling.method.registry.core.IDLBridgeMethod
9
- import com.tiktok.sparkling.method.registry.api.containsPiperData
10
- import com.lynx.react.bridge.JavaOnlyMap
11
- import com.tiktok.sparkling.method.protocol.entity.BridgeCall
12
- import com.tiktok.sparkling.method.protocol.entity.BridgeResult
13
- import com.tiktok.sparkling.method.protocol.impl.lifecycle.fe.FeCallMonitorModel
14
- import com.tiktok.sparkling.method.protocol.impl.monitor.MonitorEntity
15
- import com.tiktok.sparkling.method.protocol.interfaces.IBridgeLifeClient
16
- import com.tiktok.sparkling.method.protocol.interfaces.ShouldHandleBridgeCallResultModel
17
- import com.tiktok.sparkling.method.protocol.utils.BridgeConstants
18
- import com.tiktok.sparkling.method.protocol.utils.BridgeConverter
19
-
20
- /**
21
- */
22
- class DefaultBridgeLifeClientImp(bridgeContext: BridgeContext) : IBridgeLifeClient() {
23
-
24
- private var bridgeLifeClients = ArrayList<IBridgeLifeClient>()
25
-
26
- fun registerIBridgeLifeClient(bridgeLifeClient: IBridgeLifeClient) {
27
- bridgeLifeClients.add(bridgeLifeClient)
28
- }
29
-
30
-
31
- override fun shouldHandleBridgeCall(
32
- call: BridgeCall,
33
- bridgeContext: BridgeContext
34
- ): ShouldHandleBridgeCallResultModel {
35
- //call other lifeClient
36
- bridgeLifeClients.forEach {
37
- val currentHandleModel = it.shouldHandleBridgeCall(call, bridgeContext)
38
- if (!currentHandleModel.shouldHandleBridgeCall) {
39
- // TODO
40
- }
41
- }
42
- return ShouldHandleBridgeCallResultModel(true, null)
43
- }
44
-
45
- override fun onBridgeCalledStart(bridgeCall: BridgeCall, bridgeContext: BridgeContext) {
46
- val endConvertParamsTime = System.currentTimeMillis()
47
- bridgeCall.jsbSDKErrorReportModel.apply {
48
- setJsbBridgeSdk("SparklingBridge")
49
- setJsbUrl(bridgeCall.url)
50
- setJsbMethodName(bridgeCall.bridgeName)
51
- setJsbEngine(bridgeCall.jsbEngine)
52
- when (bridgeCall.platform) {
53
- BridgeCall.PlatForm.Web -> Unit // TODO: Web related abilities will implement later
54
- BridgeCall.PlatForm.Lynx -> setView(bridgeCall.context.lynxView)
55
- else -> Unit
56
- }
57
- }
58
-
59
- bridgeCall.feCallMonitorModel.view = bridgeContext.lynxView
60
- bridgeCall.feCallMonitorModel.jsbNativeCallStart = System.currentTimeMillis()
61
- bridgeCall.feCallMonitorModel.bridgeName = bridgeCall.bridgeName
62
- bridgeCall.feCallMonitorModel.containerID = bridgeContext.containerId
63
-
64
- when (bridgeCall.platform) {
65
- BridgeCall.PlatForm.Web -> {
66
- // TODO: Web related abilities will implement later
67
- }
68
-
69
- else -> {
70
- (bridgeCall.params as? JavaOnlyMap)?.let { params ->
71
- (params?.getMap("data") ?: params).getMap(FeCallMonitorModel._JSB_CALLER_INFO)
72
- ?.asHashMap()?.forEach {
73
- bridgeCall.feCallMonitorModel.addCategory(
74
- "${FeCallMonitorModel.CALLER_PREFIX}${it.key}",
75
- it.value
76
- )
77
- }
78
- (params?.getMap("data") ?: params).getMap(FeCallMonitorModel._JSB_PERF_METRICS)
79
- ?.asHashMap()?.let {
80
- it.get(FeCallMonitorModel.JSB_FUNC_CALL_START).let {
81
- if (it is Long) {
82
- bridgeCall.feCallMonitorModel.jsbFuncCallStart = it
83
- }
84
- }
85
- it.get(FeCallMonitorModel.JSB_FUNC_CALL_END).let {
86
- if (it is Long) {
87
- bridgeCall.feCallMonitorModel.jsbFuncCallEnd = it
88
- }
89
- }
90
- }
91
-
92
- }
93
- }
94
- }
95
-
96
- //call other lifeClient
97
- bridgeLifeClients.forEach {
98
- it.onBridgeCalledStart(bridgeCall, bridgeContext)
99
- }
100
- }
101
-
102
- override fun onBridgeImplHandleStart(call: BridgeCall?, bridgeContext: BridgeContext) {
103
- //call other lifeClient
104
- bridgeLifeClients.forEach {
105
- it.onBridgeImplHandleStart(call, bridgeContext)
106
- }
107
- }
108
-
109
- override fun onBridgeImplHandleEnd(call: BridgeCall?, bridgeContext: BridgeContext) {
110
- //call other lifeClient
111
- bridgeLifeClients.forEach {
112
- it.onBridgeImplHandleEnd(call, bridgeContext)
113
- }
114
- }
115
-
116
- override fun onBridgeCallbackCallStart(
117
- result: BridgeResult,
118
- call: BridgeCall,
119
- mContext: BridgeContext
120
- ) {
121
- when (call.platform) {
122
- BridgeCall.PlatForm.Web -> {
123
- // TODO
124
- }
125
-
126
- BridgeCall.PlatForm.Lynx -> {
127
-
128
- }
129
-
130
- else -> {}
131
- }
132
-
133
-
134
- //call other lifeClient
135
- bridgeLifeClients.forEach {
136
- it.onBridgeCallbackCallStart(result, call, mContext)
137
- }
138
- }
139
-
140
- override fun onBridgeCallbackInvokeStart(result: BridgeResult, call: BridgeCall) {
141
-
142
- when (call.platform) {
143
- BridgeCall.PlatForm.Web -> {
144
- // TODO
145
- }
146
-
147
- BridgeCall.PlatForm.Lynx -> {
148
- call.lynxCallbackMap?.let { map ->
149
- val monitor = MonitorEntity().apply {
150
- name = call?.bridgeName
151
- url = call?.url
152
- beginTime = call?.timestamp
153
- endTime = System.currentTimeMillis()
154
- if (map.hasKey("code")) {
155
- val code = map.getInt("code", IDLBridgeMethod.UNKNOWN_ERROR)
156
- if (code != IDLBridgeMethod.UNKNOWN_ERROR) this.code = code
157
- }
158
- message = map.getString("msg", "")
159
-
160
- rawResult = BridgeConverter.revertJavaOnlyMap2JSONObject(map).apply {
161
- put("usePiperData", map.containsPiperData())
162
- put("bridgeCallThreadType", call.bridgeCallThreadType)
163
- }
164
- call.params?.let {
165
- rawRequest =
166
- BridgeConverter.revertJavaOnlyMap2JSONObject(call.params as JavaOnlyMap)
167
- }
168
- hitBusinessHandler = call?.hitBusinessHandler ?: false
169
- nameSpace = call?.nameSpace
170
- isRunInMainThread = call.isInMainThread
171
- }
172
- if (monitor.code == BridgeConstants.BRIDGE_CALL_SUCCESS) {
173
- call.context.monitor.forEach {
174
- it.onBridgeResolved(monitor)
175
- }
176
- } else {
177
- call.context.monitor.forEach {
178
- it.onBridgeRejected(monitor)
179
- }
180
- call.jsbSDKErrorReportModel.apply {
181
- setJsbErrorCode(monitor.code)
182
- putJsbExtension("error_message", monitor.message)
183
- putJsbExtension("bridgeCallThreadType", call.bridgeCallThreadType)
184
- }
185
- call.jsbSDKErrorReportModel.reportJSBErrorModel(call.context.errorReportModel)
186
- }
187
- }
188
- }
189
-
190
- else -> {}
191
- }
192
-
193
-
194
- //call other lifeClient
195
- bridgeLifeClients.forEach {
196
- it.onBridgeCallbackInvokeStart(result, call)
197
- }
198
-
199
- call.feCallMonitorModel.jsbCallbackStart = System.currentTimeMillis()
200
- }
201
-
202
- override fun onBridgeCalledEnd(call: BridgeCall, bridgeContext: BridgeContext) {
203
-
204
- when (call.platform) {
205
- BridgeCall.PlatForm.Web -> {
206
- // TODO
207
- }
208
- else -> {}
209
- }
210
-
211
- //call other lifeClient
212
- bridgeLifeClients.forEach {
213
- it.onBridgeCalledEnd(call, bridgeContext)
214
- }
215
- call.feCallMonitorModel.jsbCallbackEnd = System.currentTimeMillis()
216
- call.feCallMonitorModel.reportFeCallInfo()
217
- }
218
-
219
- //Event
220
- override fun onBridgeEventStart(eventName: String, data: Any?) {
221
- //call other lifeClient
222
- bridgeLifeClients.forEach {
223
- it.onBridgeEventStart(eventName, data)
224
- }
225
- }
226
-
227
- override fun onBridgeEventEnd(eventName: String, data: Any?) {
228
- //call other lifeClient
229
- bridgeLifeClients.forEach {
230
- it.onBridgeEventEnd(eventName, data)
231
- }
232
- }
233
- }