Build the Wolfskin TV shell and navigation
This commit is contained in:
parent
de452448ba
commit
f60a22e435
97 changed files with 4363 additions and 91 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import com.android.build.api.artifact.SingleArtifact
|
||||
import com.android.build.api.dsl.ApplicationExtension
|
||||
import com.android.build.api.dsl.ProductFlavor
|
||||
import com.android.build.api.variant.FilterConfiguration
|
||||
|
|
@ -5,6 +6,7 @@ import com.google.protobuf.gradle.id
|
|||
import com.mikepenz.aboutlibraries.plugin.DuplicateMode
|
||||
import com.mikepenz.aboutlibraries.plugin.DuplicateRule
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import java.io.File
|
||||
import java.util.Base64
|
||||
import java.util.Properties
|
||||
|
||||
|
|
@ -194,6 +196,7 @@ configure<ApplicationExtension> {
|
|||
sourceSets {
|
||||
getByName("main") {
|
||||
kotlin.directories += "$buildDir/generated/seerr_api/src/main/kotlin"
|
||||
kotlin.directories += "src/wolfskin/java"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -224,6 +227,47 @@ androidComponents {
|
|||
"Wholphin-${variant.flavorName}-${variant.buildType}-${output.versionName.get()}-${output.versionCode.get()}$abi.apk"
|
||||
output.outputFileName = outputFileName
|
||||
}
|
||||
if (variant.name == "defaultDebug") {
|
||||
val packagedApks = variant.artifacts.get(SingleArtifact.APK)
|
||||
val artifactLoader = variant.artifacts.getBuiltArtifactsLoader()
|
||||
val aapt2 = sdkComponents.aapt2.flatMap { it.executable }
|
||||
val checkWolfskinBranding = tasks.register("checkWolfskinBranding") {
|
||||
inputs.dir(packagedApks)
|
||||
inputs.file(aapt2)
|
||||
doLast {
|
||||
val artifacts = checkNotNull(artifactLoader.load(packagedApks.get())) {
|
||||
"Packaged default/debug APK metadata was not found; branding is unverified"
|
||||
}.elements
|
||||
check(artifacts.isNotEmpty()) { "No default/debug APKs were found; branding is unverified" }
|
||||
val header = Regex("""^\s*resource 0x[\da-fA-F]+ (?:[^\s:]+:)?([^\s/]+)/([^\s]+)""")
|
||||
val visibleTypes = setOf("string", "plurals", "array")
|
||||
// Upstream legal attribution and its project URL must survive the branding cutover.
|
||||
val legalNames = setOf("wolfskin_upstream_credit", "wolfskin_upstream_url")
|
||||
val violations = sortedSetOf<String>()
|
||||
artifacts.forEach { artifact ->
|
||||
val dump = providers.exec {
|
||||
commandLine(aapt2.get().asFile, "dump", "resources", artifact.outputFile)
|
||||
}.standardOutput.asText.get()
|
||||
var currentName: String? = null
|
||||
var inspected = 0
|
||||
dump.lineSequence().forEach { line ->
|
||||
val resource = header.find(line)
|
||||
if (resource != null) {
|
||||
currentName = resource.groupValues[2].takeIf { resource.groupValues[1] in visibleTypes }
|
||||
if (currentName != null) inspected++
|
||||
} else if (currentName != null && currentName !in legalNames && line.contains("Wholphin", ignoreCase = true)) {
|
||||
violations += "${File(artifact.outputFile).name}:$currentName"
|
||||
}
|
||||
}
|
||||
check(inspected > 0) { "No packaged string resources were decoded; branding is unverified" }
|
||||
logger.lifecycle("Inspected $inspected string/plural/array resources in ${File(artifact.outputFile).name}")
|
||||
}
|
||||
check(violations.isEmpty()) { "User-visible upstream branding remains: ${violations.joinToString()}" }
|
||||
logger.lifecycle("Wolfskin branding check passed (${artifacts.size} packaged debug APKs; legal attribution preserved)")
|
||||
}
|
||||
}
|
||||
tasks.matching { it.name == "assembleDefaultDebug" }.configureEach { dependsOn(checkWolfskinBranding) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -288,6 +332,7 @@ tasks.named("preBuild") {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":wolfskin-design"))
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.appcompat)
|
||||
implementation(platform(libs.androidx.compose.bom))
|
||||
|
|
@ -406,8 +451,18 @@ dependencies {
|
|||
testImplementation(libs.robolectric)
|
||||
testImplementation(libs.hilt.android.testing)
|
||||
testImplementation(libs.androidx.compose.ui.test.junit4)
|
||||
testImplementation("io.github.takahirom.roborazzi:roborazzi:1.77.0")
|
||||
testImplementation("io.github.takahirom.roborazzi:roborazzi-compose:1.77.0")
|
||||
androidTestImplementation(platform(libs.androidx.compose.bom))
|
||||
androidTestImplementation(libs.mockk.android)
|
||||
androidTestImplementation(libs.hilt.android.testing)
|
||||
androidTestImplementation(libs.androidx.compose.ui.test.manifest)
|
||||
}
|
||||
|
||||
tasks.withType<Test>().configureEach {
|
||||
dependsOn(":wolfskin-design:testDebugUnitTest")
|
||||
systemProperty("robolectric.dependency.dir", project(":wolfskin-design").layout.buildDirectory.dir("robolectric-sdk").get().asFile.absolutePath)
|
||||
systemProperty("robolectric.offline", "true")
|
||||
systemProperty("roborazzi.test.record", "true")
|
||||
systemProperty("wolfskin.captureDirectory", rootProject.layout.buildDirectory.dir("wolfskin-captures").get().asFile.absolutePath)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue