feat(assetbundle): 完成已验证结构的重建发布闭环
bat-rust / Build and test Rust (push) Canceled after 0s
bat-rust / Build and test Go API (push) Canceled after 0s

This commit is contained in:
2026-09-10 00:46:48 +08:00
parent 68c6c91b1e
commit 69b6e36bf0
21 changed files with 1588 additions and 101 deletions
+15 -22
View File
@@ -475,11 +475,10 @@ pub fn validate_translation_workbench_with_glossary_path(
}
changed_entries += 1;
let source_kind = normalized_text_source_kind(entry.text_source_kind.as_deref());
let is_publishable = entry.archive_entry.is_none()
&& matches!(
source_kind.as_deref(),
Some("textasset" | "typetreefield" | "managedreferencefield")
);
let is_publishable = matches!(
source_kind.as_deref(),
Some("textasset" | "typetreefield" | "managedreferencefield")
);
if is_publishable {
let serialized_file = entry
.serialized_file
@@ -579,10 +578,7 @@ fn validate_current_glossary_qa(
}
/// Converts reviewed entries to localized patch operations supported by the
/// current UnityFS write layer.
///
/// ZIP-inner bundles are intentionally rejected here because they require a
/// separate archive rewrite boundary.
/// current UnityFS write layer and its ZIP rewrite boundary.
pub fn localized_patch_operations(
resource_root: &Path,
workbench: &TranslationWorkbench,
@@ -654,16 +650,11 @@ pub fn localized_patch_operations_with_glossary_path(
entry.id
));
};
if entry.archive_entry.is_some() {
return Err(anyhow::anyhow!(
"TextUnit {} 位于 zip archive entry,当前 publish-localized 不支持直接修改 zip 内 bundle",
entry.id
));
}
let source_kind = normalized_text_source_kind(entry.text_source_kind.as_deref());
let field_path = entry.field_path.clone();
if !seen.insert((
entry.destination.clone(),
entry.archive_entry.clone(),
serialized_file.clone(),
path_id,
field_path.clone(),
@@ -688,6 +679,7 @@ pub fn localized_patch_operations_with_glossary_path(
patch.expected_name = entry.asset_name.clone();
operations.push(LocalizedPatchInput::TextAsset(LocalizedTextAssetPatch {
bundle_path: entry.destination.clone(),
archive_entry: entry.archive_entry.clone(),
text_asset: patch,
metadata,
}));
@@ -702,6 +694,7 @@ pub fn localized_patch_operations_with_glossary_path(
operations.push(LocalizedPatchInput::StringField(
LocalizedStringFieldPatch {
bundle_path: entry.destination.clone(),
archive_entry: entry.archive_entry.clone(),
string_field: StringFieldPatch {
serialized_file_path: serialized_file,
path_id,
@@ -771,12 +764,6 @@ pub fn localized_text_asset_patches(
entry.id
));
};
if entry.archive_entry.is_some() {
return Err(anyhow::anyhow!(
"TextUnit {} 位于 zip archive entry,当前 publish-localized 不支持直接修改 zip 内 bundle",
entry.id
));
}
if normalized_text_source_kind(entry.text_source_kind.as_deref()).as_deref()
!= Some("textasset")
{
@@ -785,7 +772,12 @@ pub fn localized_text_asset_patches(
entry.id
));
}
if !seen.insert((entry.destination.clone(), serialized_file.clone(), path_id)) {
if !seen.insert((
entry.destination.clone(),
entry.archive_entry.clone(),
serialized_file.clone(),
path_id,
)) {
return Err(anyhow::anyhow!(
"翻译工作台包含重复 patch 目标:{}",
entry.id
@@ -811,6 +803,7 @@ pub fn localized_text_asset_patches(
}
patches.push(LocalizedTextAssetPatch {
bundle_path: entry.destination.clone(),
archive_entry: entry.archive_entry.clone(),
text_asset: patch,
metadata: Some(localized_patch_metadata(
entry,