-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathbuild.gradle
More file actions
236 lines (219 loc) · 9.85 KB
/
Copy pathbuild.gradle
File metadata and controls
236 lines (219 loc) · 9.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
plugins {
id 'com.android.application' version '8.10.1' apply false
id 'org.jetbrains.kotlin.android' version '2.2.21' apply false
id 'org.jetbrains.kotlin.jvm' version '2.2.21' apply false
}
allprojects {
group = providers.gradleProperty('GROUP').get()
version = providers.gradleProperty('VERSION_NAME').get()
}
subprojects {
pluginManager.withPlugin('maven-publish') {
publishing {
publications.withType(MavenPublication).configureEach {
pom {
name = "Android Agent Harness ${project.name}"
description = 'Provider-neutral bounded Agent runtime and host SDK.'
url = 'https://github.com/susyimes/android-agent-harness'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
scm {
connection = 'scm:git:https://github.com/susyimes/android-agent-harness.git'
developerConnection =
'scm:git:ssh://git@github.com/susyimes/android-agent-harness.git'
url = 'https://github.com/susyimes/android-agent-harness'
}
}
}
repositories {
maven {
name = 'sdkLocal'
url = rootProject.layout.buildDirectory.dir('sdk-repository')
}
}
}
}
}
tasks.register('auditProvenance') {
group = 'verification'
description = 'Rejects private configuration, embedded credentials, product namespaces, local machine paths, and binary product assets.'
doLast {
def repositoryFiles = fileTree(rootDir) {
exclude '.git/**'
exclude '.gradle/**'
exclude '.gradle-user-home/**'
exclude '**/build/**'
}.files.findAll { file -> file.isFile() }
def forbiddenBaseNames = [
'.env',
'credentials.json',
'local.properties',
'secrets.properties'
] as Set
def forbiddenSuffixes = ['.jks', '.keystore', '.p12', '.pem']
def forbiddenNames = repositoryFiles.findAll { file ->
def name = file.name.toLowerCase(Locale.ROOT)
forbiddenBaseNames.contains(name) ||
forbiddenSuffixes.any { suffix -> name.endsWith(suffix) } ||
name.startsWith('id_rsa')
}
def sourceAndBuildFiles = fileTree(rootDir) {
include 'build.gradle'
include 'settings.gradle'
include 'gradle.properties'
include '**/*.gradle'
include '*/src/**/*.kt'
include '*/src/**/*.xml'
include 'README.md'
include 'THIRD_PARTY_NOTICES.md'
include 'docs/**/*.md'
exclude '**/build/**'
}.files.findAll { file -> file.isFile() }
def productNamespaces = ['com' + '.mirror', 'com' + '.truebox']
def embeddedCredential = ~/(?i)(api[_-]?key|access[_-]?token|client[_-]?secret|password)\s*[:=]\s*["'][^"']+["']/
def privateLocalPath = ~/(?i)\b[a-z]:\\[^\s`]/
def contentViolations = []
sourceAndBuildFiles.each { file ->
def text = file.getText('UTF-8')
productNamespaces.each { marker ->
if (text.toLowerCase(Locale.ROOT).contains(marker)) {
contentViolations << "${file}: product namespace '${marker}'"
}
}
if (embeddedCredential.matcher(text).find()) {
contentViolations << "${file}: embedded credential-like assignment"
}
if (privateLocalPath.matcher(text).find()) {
contentViolations << "${file}: local machine path"
}
}
def binarySampleAssets = fileTree(file('sample/src/main/res')) {
include '**/*'
exclude '**/*.xml'
}.files.findAll { file -> file.isFile() }
if (!forbiddenNames.isEmpty() || !contentViolations.isEmpty() || !binarySampleAssets.isEmpty()) {
def findings = []
findings.addAll(forbiddenNames.collect { file -> "forbidden file: ${file}" })
findings.addAll(contentViolations)
findings.addAll(binarySampleAssets.collect { file -> "binary sample asset: ${file}" })
throw new GradleException("Provenance/privacy audit failed:\n - ${findings.join('\n - ')}")
}
logger.lifecycle("Provenance/privacy audit passed (${repositoryFiles.size()} repository files inspected).")
}
}
tasks.register('checkM0') {
group = 'verification'
description = 'Runs the minimal architecture tests, provenance audit, JVM demo build, and Android sample debug build.'
dependsOn 'auditProvenance'
dependsOn ':harness-core:test'
dependsOn ':agent-sdk:test'
dependsOn ':agent-approval:test'
dependsOn ':context-engine:test'
dependsOn ':agent-state:test'
dependsOn ':agent-permission-android:testDebugUnitTest'
dependsOn ':agent-data-android:testDebugUnitTest'
dependsOn ':agent-scheduling:test'
dependsOn ':agent-scheduling-android:testDebugUnitTest'
dependsOn ':agent-feedback:test'
dependsOn ':agent-voice-android:testDebugUnitTest'
dependsOn ':provider-openai:test'
dependsOn ':harness-eval:test'
dependsOn ':device-loop:test'
dependsOn ':device-loop-android:testDebugUnitTest'
dependsOn ':web4agent-android:testDebugUnitTest'
dependsOn ':demo:test'
dependsOn ':agent-sdk-android:testDebugUnitTest'
dependsOn ':sdk-consumer-smoke:test'
dependsOn ':sample:testDebugUnitTest'
dependsOn ':sample:assembleDebugAndroidTest'
dependsOn ':sample:lintDebug'
dependsOn ':sample:assembleDebug'
}
tasks.register('checkConnectedSample') {
group = 'verification'
description = 'Runs the sample instrumentation suite on a connected Android device.'
dependsOn ':sample:connectedDebugAndroidTest'
}
tasks.register('checkSdkAbi') {
group = 'verification'
description = 'Checks published JVM SDK modules against committed Kotlin ABI baselines.'
dependsOn ':harness-core:checkLegacyAbi'
dependsOn ':agent-sdk:checkLegacyAbi'
dependsOn ':agent-approval:checkLegacyAbi'
dependsOn ':context-engine:checkLegacyAbi'
dependsOn ':agent-state:checkLegacyAbi'
dependsOn ':agent-scheduling:checkLegacyAbi'
dependsOn ':agent-feedback:checkLegacyAbi'
dependsOn ':provider-openai:checkLegacyAbi'
dependsOn ':harness-eval:checkLegacyAbi'
dependsOn ':device-loop:checkLegacyAbi'
}
tasks.register('publishJvmSdk') {
group = 'publishing'
description = 'Builds and publishes JVM SDK JAR artifacts to build/sdk-repository.'
dependsOn ':harness-core:publishSdkPublicationToSdkLocalRepository'
dependsOn ':agent-sdk:publishSdkPublicationToSdkLocalRepository'
dependsOn ':agent-approval:publishSdkPublicationToSdkLocalRepository'
dependsOn ':context-engine:publishSdkPublicationToSdkLocalRepository'
dependsOn ':agent-state:publishSdkPublicationToSdkLocalRepository'
dependsOn ':agent-scheduling:publishSdkPublicationToSdkLocalRepository'
dependsOn ':agent-feedback:publishSdkPublicationToSdkLocalRepository'
dependsOn ':provider-openai:publishSdkPublicationToSdkLocalRepository'
dependsOn ':harness-eval:publishSdkPublicationToSdkLocalRepository'
dependsOn ':device-loop:publishSdkPublicationToSdkLocalRepository'
}
tasks.register('publishSdk') {
group = 'publishing'
description = 'Builds and publishes all SDK JAR/AAR artifacts to build/sdk-repository.'
dependsOn 'publishJvmSdk'
dependsOn ':device-loop-android:publishSdkPublicationToSdkLocalRepository'
dependsOn ':web4agent-android:publishSdkPublicationToSdkLocalRepository'
dependsOn ':agent-sdk-android:publishSdkPublicationToSdkLocalRepository'
dependsOn ':agent-permission-android:publishSdkPublicationToSdkLocalRepository'
dependsOn ':agent-data-android:publishSdkPublicationToSdkLocalRepository'
dependsOn ':agent-scheduling-android:publishSdkPublicationToSdkLocalRepository'
dependsOn ':agent-voice-android:publishSdkPublicationToSdkLocalRepository'
}
tasks.register('checkSdk') {
group = 'verification'
description = 'Runs SDK tests, ABI checks, external-consumer tests, and JAR/AAR publication.'
dependsOn 'auditProvenance'
dependsOn 'checkSdkAbi'
dependsOn ':harness-core:test'
dependsOn ':agent-sdk:test'
dependsOn ':agent-approval:test'
dependsOn ':context-engine:test'
dependsOn ':agent-state:test'
dependsOn ':agent-permission-android:testDebugUnitTest'
dependsOn ':agent-data-android:testDebugUnitTest'
dependsOn ':agent-scheduling:test'
dependsOn ':agent-scheduling-android:testDebugUnitTest'
dependsOn ':agent-feedback:test'
dependsOn ':agent-voice-android:testDebugUnitTest'
dependsOn ':provider-openai:test'
dependsOn ':harness-eval:test'
dependsOn ':device-loop:test'
dependsOn ':device-loop-android:testDebugUnitTest'
dependsOn ':web4agent-android:testDebugUnitTest'
dependsOn ':agent-sdk-android:testDebugUnitTest'
dependsOn ':device-loop-android:lintRelease'
dependsOn ':web4agent-android:lintRelease'
dependsOn ':agent-sdk-android:lintRelease'
dependsOn ':agent-permission-android:lintRelease'
dependsOn ':agent-data-android:lintRelease'
dependsOn ':agent-scheduling-android:lintRelease'
dependsOn ':agent-voice-android:lintRelease'
dependsOn ':sdk-consumer-smoke:test'
dependsOn ':sdk-android-consumer-smoke:testDebugUnitTest'
dependsOn 'publishSdk'
}
tasks.register('runDemo') {
group = 'application'
description = 'Runs the deterministic provider -> tool -> provider demo.'
dependsOn ':demo:run'
}