Skip to content

Commit ff7bd71

Browse files
committed
build: 更新 rustls platform verifier
1 parent 7c6a96c commit ff7bd71

13 files changed

Lines changed: 1423 additions & 1081 deletions

File tree

.github/scripts/fix-ndk-libgcc.sh

Lines changed: 0 additions & 60 deletions
This file was deleted.

LLM.md

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# LLM.md - AI-Assisted Contribution Guidelines
2+
3+
This document outlines the requirements for contributions that involve AI assistance in this project.
4+
5+
## Assisted-by Tag Requirement
6+
7+
When AI tools are used during development, the source must be clearly documented so everyone can understand the extent of AI involvement in each submission. All code contributions involving AI assistance must include an `Assisted-by` tag using the following format:
8+
9+
```
10+
Assisted-by: AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]
11+
```
12+
13+
### Format Specification
14+
15+
| Component | Description |
16+
|-----------|-------------|
17+
| `AGENT_NAME` | The name of the AI tool or framework used (e.g., Claude, OpenClaw, Copilot) |
18+
| `MODEL_VERSION` | The specific model version (e.g., claude-3-opus, gemini-2.5-pro, k2p5) |
19+
| `[TOOL1] [TOOL2]` | Optional: Additional specialized analysis tools used (e.g., coccinelle, sparse, smatch, clang-tidy) |
20+
21+
### Notes
22+
23+
- **Do not include** common everyday tools like git, gcc, make, or text editors
24+
- Only list specialized analysis or transformation tools that significantly contributed to the code
25+
- Multiple `Assisted-by` tags may be used if different AI tools were used for different parts of the contribution
26+
27+
### Examples
28+
29+
**Using Claude with coccinelle and sparse:**
30+
```
31+
Assisted-by: Claude:claude-3-opus coccinelle sparse
32+
```
33+
34+
**Using OpenClaw with no additional tools:**
35+
```
36+
Assisted-by: OpenClaw:k2p5
37+
```
38+
39+
**Using GitHub Copilot:**
40+
```
41+
Assisted-by: Copilot:gpt-4o
42+
```
43+
44+
**Multiple AI tools used:**
45+
```
46+
Assisted-by: Claude:claude-3-opus clang-tidy
47+
Assisted-by: OpenClaw:gemini-3.1-pro-preview
48+
```
49+
50+
## Where to Include
51+
52+
Add the `Assisted-by` tag(s) at the end of your commit message, after the sign-off line (if present):
53+
54+
```
55+
Fix memory leak in request handler
56+
57+
This patch fixes a use-after-free bug in the async request handler
58+
that could occur during rapid create/destroy cycles.
59+
60+
Signed-off-by: John Doe <john@example.com>
61+
Assisted-by: Claude:claude-3-opus coccinelle sparse
62+
```
63+
64+
## Why This Matters
65+
66+
1. **Transparency**: Maintainers and reviewers should know when AI has assisted in code creation
67+
2. **Attribution**: Proper credit for AI contributions helps track the evolution of development practices
68+
3. **Quality Assurance**: Understanding AI involvement helps set appropriate review standards
69+
4. **Audit Trail**: Creates a clear record for future reference and analysis
70+
71+
## Scope
72+
73+
This requirement applies to:
74+
- Code changes (any language)
75+
- Configuration files
76+
- Build scripts
77+
- Documentation (if substantially AI-generated)
78+
79+
This requirement does **not** apply to:
80+
- Minor typo fixes
81+
- Pure formatting changes
82+
- Changes made entirely without AI assistance

build.gradle.kts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,36 +11,9 @@ plugins {
1111
val buildToolsVersion by extra("36.0.0")
1212
val ndkVersion by extra("29.0.14206865")
1313

14-
// https://github.com/rustls/rustls-platform-verifier/issues/67#issuecomment-2265598462
15-
fun RepositoryHandler.rustlsPlatformVerifier(): MavenArtifactRepository {
16-
val manifestPath = let {
17-
val dependencyJson = providers.exec {
18-
workingDir = File(project.rootDir, "./uniffi")
19-
commandLine("cargo", "metadata", "--format-version", "1", "--filter-platform", "aarch64-linux-android", "--manifest-path", "clash-android-ffi/Cargo.toml")
20-
}.standardOutput.asText
21-
22-
val jsonSlurper = groovy.json.JsonSlurper()
23-
val jsonData = jsonSlurper.parseText(dependencyJson.get()) as Map<*, *>
24-
val packages = jsonData["packages"] as List<*>
25-
val path = packages
26-
.first { element ->
27-
val pkg = element as Map<*, *>
28-
pkg["name"] == "rustls-platform-verifier-android"
29-
}.let { it as Map<*, *> }["manifest_path"] as String
30-
31-
File(path)
32-
}
33-
34-
return maven {
35-
url = uri(File(manifestPath.parentFile, "maven").path)
36-
metadataSources.artifact()
37-
}
38-
}
39-
4014
allprojects {
4115
repositories {
4216
google()
4317
mavenCentral()
44-
rustlsPlatformVerifier()
4518
}
4619
}

core/build.gradle.kts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
1+
import groovy.json.JsonSlurper
2+
13
plugins {
24
alias(libs.plugins.android.library)
35
alias(libs.plugins.kotlin.android)
46
alias(libs.plugins.kotlin.compose)
57
alias(libs.plugins.cargo.ndk)
68
}
79

10+
fun findRustlsPlatformVerifierClasses(): File {
11+
val dependencyJson = providers.exec {
12+
workingDir = File(project.rootDir, "uniffi")
13+
commandLine("cargo", "metadata", "--format-version", "1")
14+
}.standardOutput.asText
15+
16+
val jsonSlurper = JsonSlurper()
17+
val jsonData = jsonSlurper.parseText(dependencyJson.get()) as Map<*, *>
18+
val packages = jsonData["packages"] as List<*>
19+
val path = packages
20+
.first { element ->
21+
val pkg = element as Map<*, *>
22+
pkg["name"] == "rustls-platform-verifier-android"
23+
}.let { it as Map<*, *> }["manifest_path"] as String
24+
25+
val manifestFile = File(path)
26+
return File(manifestFile.parentFile, "classes.jar")
27+
}
28+
829
android {
930
namespace = "rs.clash.android.ffi"
1031
compileSdk = 36
@@ -31,7 +52,7 @@ kotlin {
3152
}
3253

3354
dependencies {
34-
implementation(libs.rustls.platform.verifier)
55+
implementation(files(findRustlsPlatformVerifierClasses()))
3556
implementation(libs.androidx.core.ktx)
3657
implementation(libs.androidx.appcompat)
3758
implementation(libs.androidx.runtime)

gradle/libs.versions.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ compose-destinations-ksp = { group = "io.github.raamcosta.compose-destinations",
4848
ktlint-compose-rules = { group = "io.nlopez.compose.rules", name = "ktlint", version.ref = "ktlint-compose" }
4949
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" }
5050

51-
rustls-platform-verifier = { group = "rustls", name = "rustls-platform-verifier", version = "latest.release" }
5251

5352
[plugins]
5453
android-application = { id = "com.android.application", version.ref = "agp" }

justfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
gen:
2+
./gradlew assembleDebug -Prust-target=arm64
3+
build:
4+
./gradlew assembleDebug

uniffi/.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
#target = "aarch64-linux-android"
33
rustc-wrapper = "sccache"
44

5+
[env]
6+
RUSTC_BOOTSTRAP = { value = "1" }
7+
58
[target.aarch64-linux-android]
69
linker = "aarch64-linux-android23-clang"
710

0 commit comments

Comments
 (0)