Record accepted Windows native baseline and Android CI build route
native-ci / native-linux (teamspeach-native-linux-arm64, aarch64-unknown-linux-gnu) (push) Canceled after 0s
native-ci / native-linux (teamspeach-native-linux-x64, x86_64-unknown-linux-gnu) (push) Canceled after 0s

This commit is contained in:
bit9992 committed 2026-11-11 11:32:53 +03:00
1 parent 5ce12714ac
commit 05e8d34bcf
14 files changed
+44167 -43609

No files matched your search

+3 -2
View File
@@ -95,14 +95,15 @@ impl Environment {
let path = vcvars.to_string_lossy().replace('/', "\\");
if path.contains(['"', '\n', '\r', '%', '!']) { return Err("Visual Studio path contains unsupported command-shell characters".into()); }
let mut activation = self.command("cmd.exe");
// cmd defaults to the console OEM code page; capture expects UTF-8 and paths may be Unicode.
activation.args(["/D", "/S", "/C"]);
#[cfg(windows)]
{
use std::os::windows::process::CommandExt;
activation.raw_arg(format!("\"call \"{path}\" {architecture} >nul && set\""));
activation.raw_arg(format!("\"chcp 65001 >nul && call \"{path}\" {architecture} >nul && set\""));
}
#[cfg(not(windows))]
activation.arg(format!("call \"{path}\" {architecture} >nul && set"));
activation.arg(format!("chcp 65001 >nul && call \"{path}\" {architecture} >nul && set"));
let output = capture(&mut activation)?;
for line in output.lines() {
let Some((key, value)) = line.split_once('=') else { continue; };
+57 -27
View File
@@ -7,7 +7,7 @@ mod release;
use std::{env, path::PathBuf, process::ExitCode};
const USAGE: &str = "usage: cargo run --locked -p xtask -- <deps|build|package|smoke|verify-package> --target <rust-triple> [--llvm-dir <dir>] [--skia-source <dir>] [--jobs <count>] [--out <directory>] [--scenario offline-ui|migration|media-loopback|codec-fixtures] [--codec-probe <executable>] [--device <explicit serial/UDID>] [--app <test APK/simulator app>] [--test-harness true|false]\n cargo run --locked -p xtask -- check-version\n cargo run --locked -p xtask -- <prepare-release|publish-release> --out <downloaded-artifacts-directory>\n\ndeps provisions pinned WebRTC sources; build verifies dependencies and compiles release binaries.\npackage consumes built binaries and host packaging tools; verify-package inspects actual archives.\nsmoke requires a test-harness build and creates a fresh disposable profile/output.\nprepare-release validates both Linux architecture bundles and assembles the native manifest.\npublish-release requires a matching trusted tag, GITEA_TOKEN and GITHUB_SERVER_URL/GITHUB_REPOSITORY; uploads to a new draft, reads back hashes, then publishes.\nNo SDK installations, automatic tags or inferred signing credentials.\nWindows: MSVC/SDK/NSIS/7-Zip; Linux: linuxdeploy/appimagetool/unsquashfs; macOS: Xcode/dylibbundler; Android: cached Gradle/JDK17/SDK36/NDK28+; iOS: Xcode/XcodeGen/provisioning for IPA.\nPackaging alone does not authorize distribution; retain artwork rights and platform acceptance review.";
const USAGE: &str = "usage: cargo run --locked -p xtask -- <deps|build|package|smoke|verify-package> --target <rust-triple> [--llvm-dir <dir>] [--skia-source <dir>] [--jobs <count>] [--out <directory>] [--scenario offline-ui|migration|media-loopback|codec-fixtures] [--codec-probe <executable>] [--device <explicit serial/UDID>] [--app <test APK/simulator app>] [--test-harness true|false] [--gradle-online true|false]\n cargo run --locked -p xtask -- check-version\n cargo run --locked -p xtask -- <prepare-release|publish-release> --out <downloaded-artifacts-directory>\n\ndeps provisions pinned WebRTC sources; build verifies dependencies and compiles release binaries.\npackage consumes built binaries and host packaging tools; verify-package inspects actual archives.\nAndroid package defaults to offline Gradle; --gradle-online true explicitly permits dependency resolution (not SDK/distribution installation).\nsmoke requires a test-harness build and creates a fresh disposable profile/output.\nprepare-release validates both Linux architecture bundles and assembles the native manifest.\npublish-release requires a matching trusted tag, GITEA_TOKEN and GITHUB_SERVER_URL/GITHUB_REPOSITORY; uploads to a new draft, reads back hashes, then publishes.\nNo SDK installations, automatic tags or inferred signing credentials.\nWindows: MSVC/SDK/NSIS/7-Zip; Linux: linuxdeploy/appimagetool/unsquashfs; macOS: Xcode/dylibbundler; Android: local checksum-pinned Gradle zip/JDK17+/SDK36/NDK28+; iOS: Xcode/XcodeGen/provisioning for IPA.\nPackaging alone does not authorize distribution; retain artwork rights and platform acceptance review.";
#[derive(Debug)]
pub(crate) struct Options {
@@ -21,6 +21,7 @@ pub(crate) struct Options {
device: Option<String>,
app: Option<PathBuf>,
test_harness: bool,
gradle_online: bool,
}
fn run() -> Result<(), String> {
@@ -33,32 +34,7 @@ fn run() -> Result<(), String> {
if !matches!(operation.as_str(), "deps" | "build" | "package" | "smoke" | "verify-package" | "check-version" | "prepare-release" | "publish-release") {
return Err(format!("unsupported operation {operation:?}\n{USAGE}"));
}
let mut options = Options { target: String::new(), llvm_dir: None, skia_source: None, jobs: None, out: None, scenario: None, codec_probe: None, device: None, app: None, test_harness: false };
let mut seen = std::collections::BTreeSet::new();
while let Some(flag) = args.next() {
if !seen.insert(flag.clone()) { return Err(format!("duplicate option {flag}")); }
let value = args.next().ok_or_else(|| format!("missing value for {flag}\n{USAGE}"))?;
match flag.as_str() {
"--target" => options.target = value,
"--llvm-dir" => options.llvm_dir = Some(PathBuf::from(value)),
"--skia-source" => options.skia_source = Some(PathBuf::from(value)),
"--out" => options.out = Some(PathBuf::from(value)),
"--scenario" => options.scenario = Some(value),
"--codec-probe" => options.codec_probe = Some(PathBuf::from(value)),
"--device" => options.device = Some(value),
"--app" => options.app = Some(PathBuf::from(value)),
"--test-harness" => options.test_harness = value.parse().map_err(|_| "--test-harness requires true or false")?,
"--jobs" => {
let jobs: usize = value.parse().map_err(|_| "--jobs must be a positive integer")?;
if jobs == 0 { return Err("--jobs must be greater than zero".into()); }
options.jobs = Some(jobs);
}
_ => return Err(format!("unknown option {flag}\n{USAGE}")),
}
}
if !matches!(operation.as_str(), "check-version" | "prepare-release" | "publish-release") {
deps::Target::parse(&options.target)?;
}
let options = parse_options(&operation, args)?;
let root = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.parent().ok_or("xtask is not inside a workspace")?.to_owned();
match operation.as_str() {
@@ -74,6 +50,60 @@ fn run() -> Result<(), String> {
}
}
fn parse_options(operation: &str, mut args: impl Iterator<Item = String>) -> Result<Options, String> {
let mut options = Options { target: String::new(), llvm_dir: None, skia_source: None, jobs: None, out: None, scenario: None, codec_probe: None, device: None, app: None, test_harness: false, gradle_online: false };
let mut seen = std::collections::BTreeSet::new();
while let Some(flag) = args.next() {
if !seen.insert(flag.clone()) { return Err(format!("duplicate option {flag}")); }
let value = args.next().ok_or_else(|| format!("missing value for {flag}\n{USAGE}"))?;
match flag.as_str() {
"--target" => options.target = value,
"--llvm-dir" => options.llvm_dir = Some(PathBuf::from(value)),
"--skia-source" => options.skia_source = Some(PathBuf::from(value)),
"--out" => options.out = Some(PathBuf::from(value)),
"--scenario" => options.scenario = Some(value),
"--codec-probe" => options.codec_probe = Some(PathBuf::from(value)),
"--device" => options.device = Some(value),
"--app" => options.app = Some(PathBuf::from(value)),
"--test-harness" => options.test_harness = value.parse().map_err(|_| "--test-harness requires true or false")?,
"--gradle-online" => options.gradle_online = value.parse().map_err(|_| "--gradle-online requires true or false")?,
"--jobs" => {
let jobs: usize = value.parse().map_err(|_| "--jobs must be a positive integer")?;
if jobs == 0 { return Err("--jobs must be greater than zero".into()); }
options.jobs = Some(jobs);
}
_ => return Err(format!("unknown option {flag}\n{USAGE}")),
}
}
if !matches!(operation, "check-version" | "prepare-release" | "publish-release") {
deps::Target::parse(&options.target)?;
}
if seen.contains("--gradle-online") && (operation != "package" || deps::Target::parse(&options.target)?.os != "android") {
return Err("--gradle-online is supported only by Android package".into());
}
Ok(options)
}
#[cfg(test)]
mod tests {
use super::*;
fn options(operation: &str, args: &[&str]) -> Result<Options, String> {
parse_options(operation, args.iter().map(|arg| (*arg).to_owned()))
}
#[test] fn gradle_online_is_explicit_and_android_package_only() {
let target = ["--target", "aarch64-linux-android"];
assert!(!options("package", &target).unwrap().gradle_online);
for (value, expected) in [("true", true), ("false", false)] {
assert_eq!(options("package", &[target[0], target[1], "--gradle-online", value]).unwrap().gradle_online, expected);
}
assert!(options("package", &[target[0], target[1], "--gradle-online", "yes"]).is_err());
assert!(options("package", &[target[0], target[1], "--gradle-online"]).is_err());
assert!(options("package", &[target[0], target[1], "--gradle-online", "true", "--gradle-online", "false"]).is_err());
assert!(options("build", &[target[0], target[1], "--gradle-online", "true"]).is_err());
assert!(options("package", &["--target", "x86_64-unknown-linux-gnu", "--gradle-online", "false"]).is_err());
}
}
fn main() -> ExitCode {
match run() {
Ok(()) => ExitCode::SUCCESS,
+19 -6
View File
@@ -1,5 +1,6 @@
//! Local-only packaging. No command in this module publishes, downloads SDKs, or
//! mutates a runner. Unsigned outputs are recorded explicitly, never release entries.
//! Local-only packaging. Commands never publish, install SDKs, or mutate a runner.
//! Android dependency resolution is offline unless explicitly enabled by the caller.
//! Unsigned outputs are recorded explicitly, never release entries.
use std::{env, fs, io::Read, path::{Path, PathBuf}, process::Command};
use base64::{Engine, engine::general_purpose::STANDARD};
use serde_json::{Value, json};
@@ -163,11 +164,11 @@ pub(crate) fn package(root: &Path, options: &Options) -> Result<(),String> {
stage_build_receipt(&release,&jni.join(abi),&stage)?;
let signed=env::var_os("TEAMSPEACH_ANDROID_KEYSTORE").is_some();
if signed{for key in ["TEAMSPEACH_ANDROID_STORE_PASSWORD","TEAMSPEACH_ANDROID_KEY_ALIAS","TEAMSPEACH_ANDROID_KEY_PASSWORD"]{if env::var_os(key).is_none(){return Err(format!("missing signing credential {key}"));}}}
let mut gradle=Command::new("sh");gradle.current_dir(root.join("platform/android")).arg("gradlew").args(["--offline","--no-daemon"])
.arg(format!("-PnativeJniDir={}",jni.display())).arg(format!("-PwebrtcJar={}",jar.display())).arg(format!("-PtargetAbi={abi}"))
let mut gradle=android_gradle_command(&root.join("platform/android"),&work,options.gradle_online);
gradle.arg(format!("-PnativeJniDir={}",jni.display())).arg(format!("-PwebrtcJar={}",jar.display())).arg(format!("-PtargetAbi={abi}"))
.arg(format!("-PnativeAssetsDir={}",stage.display())).arg(format!("-PversionName={version}")).arg(format!("-PtestHarness={}",options.test_harness));
gradle.arg("nativeArtifacts");run(&mut gradle)?;
let outputs=json_file(&root.join("platform/android/build/native-artifacts.json"))?;
let outputs=json_file(&work.join("gradle-build/native-artifacts.json"))?;
if outputs["schema"]!=1||outputs["abi"]!=abi||outputs["harness"]!=options.test_harness||outputs["testOnly"]!=(options.test_harness||target.cpu=="x64")||outputs["channel"]!="direct"{return Err("Android artifact report identity/test-harness/channel mismatch".into());}
let apks=outputs["apk"].as_array().ok_or("Android artifact report missing APK list")?;
if apks.len()!=1{return Err("expected exactly one ABI-specific APK".into());}
@@ -178,7 +179,7 @@ pub(crate) fn package(root: &Path, options: &Options) -> Result<(),String> {
// Preserve the direct-install APK before rebuilding the store
// variant without REQUEST_INSTALL_PACKAGES/self-update routing.
gradle.arg("-PbuildChannel=google-play");run(&mut gradle)?;
let store=json_file(&root.join("platform/android/build/native-artifacts.json"))?;
let store=json_file(&work.join("gradle-build/native-artifacts.json"))?;
if store["schema"]!=1||store["abi"]!=abi||store["harness"]!=false||store["testOnly"]!=false||store["channel"]!="google-play"{return Err("Android store artifact report mismatch".into());}
source=PathBuf::from(store["aab"].as_str().ok_or("store AAB path missing")?);
}
@@ -231,6 +232,18 @@ pub(crate) fn package(root: &Path, options: &Options) -> Result<(),String> {
println!("PUBLICATION BLOCKED: no release/tag/upload performed; artwork rights and full platform acceptance remain separate gates.");Ok(())
}
fn android_gradle_command(project:&Path,work:&Path,online:bool)->Command{
let mut command=Command::new("sh");
command.current_dir(project).arg("gradlew").arg("--no-daemon");
if !online{command.arg("--offline");}
// Both generated outputs and Gradle's project cache belong to this fresh
// package, not a previous harness/production/channel invocation.
command.arg("--project-cache-dir").arg(work.join("gradle-project-cache"))
.arg(format!("-PnativeBuildDir={}",work.join("gradle-build").display()))
.arg("-Pandroid.builder.sdkDownload=false");
command
}
fn atomic_replace(source:&Path,destination:&Path)->Result<(),String>{
#[cfg(windows)]{
use std::os::windows::ffi::OsStrExt;