@@ -1014,6 +1014,83 @@ fileprivate struct InstallLocTaskConstructionTests: CoreBasedTests {
10141014 }
10151015 }
10161016
1017+ @Test ( . requireSDKs( . macOS) )
1018+ func copyFilesRulesMergeRegion( ) async throws {
1019+ let testProject = TestProject (
1020+ " aProject " ,
1021+ groupTree: TestGroup (
1022+ " SomeFiles " , path: " Sources " ,
1023+ children: [
1024+ TestVariantGroup ( " Localizable.strings " , children: [
1025+ TestFile ( " en.lproj/Localizable.strings " , regionVariantName: " en " ) ,
1026+ TestFile ( " ja.lproj/Localizable.strings " , regionVariantName: " ja " ) ,
1027+ TestFile ( " zh_TW.lproj/Localizable.strings " , regionVariantName: " zh_TW " ) ,
1028+ ] ) ,
1029+ ] ) ,
1030+ buildConfigurations: [
1031+ TestBuildConfiguration (
1032+ " Debug " ,
1033+ buildSettings: [
1034+ " PRODUCT_NAME " : " $(TARGET_NAME) " ,
1035+ " GENERATE_INFOPLIST_FILE " : " YES " ,
1036+ " APPLY_RULES_IN_COPY_FILES " : " YES "
1037+ ] ) ,
1038+ ] ,
1039+ targets: [
1040+ TestStandardTarget (
1041+ " CoreFoo " , type: . framework,
1042+ buildPhases: [
1043+ TestCopyFilesBuildPhase ( [
1044+ " Localizable.strings " ,
1045+ ] , destinationSubfolder: . absolute, destinationSubpath: " /System/Library/Bundles/MyBundle.bundle " , onlyForDeployment: true ) ,
1046+ TestCopyFilesBuildPhase ( [
1047+ " Localizable.strings " ,
1048+ ] , destinationSubfolder: . builtProductsDir, destinationSubpath: " OtherProduct.bundle " , onlyForDeployment: false ) ,
1049+ ]
1050+ )
1051+ ] )
1052+ let tester = try await TaskConstructionTester ( getCore ( ) , testProject)
1053+
1054+ // installloc single language
1055+ await tester. checkBuild ( BuildParameters ( action: . installLoc, configuration: " Release " , overrides: [ " INSTALLLOC_LANGUAGE " : " ja " ] ) , runDestination: . macOS) { results in
1056+ results. checkTarget ( " CoreFoo " ) { target in
1057+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " Copy " , " /tmp/Test/aProject/build/Debug/OtherProduct.bundle/ja.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/ja.lproj/Localizable.strings " ] ) )
1058+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " Copy " , " /tmp/aProject.dst/System/Library/Bundles/MyBundle.bundle/ja.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/ja.lproj/Localizable.strings " ] ) )
1059+ }
1060+
1061+ results. checkNoDiagnostics ( )
1062+ }
1063+
1064+ // installloc multi-language
1065+ await tester. checkBuild ( BuildParameters ( action: . installLoc, configuration: " Release " , overrides: [ " INSTALLLOC_LANGUAGE " : " ja zh_TW " ] ) , runDestination: . macOS) { results in
1066+ results. checkTarget ( " CoreFoo " ) { target in
1067+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " Copy " , " /tmp/Test/aProject/build/Debug/OtherProduct.bundle/ja.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/ja.lproj/Localizable.strings " ] ) )
1068+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " Copy " , " /tmp/aProject.dst/System/Library/Bundles/MyBundle.bundle/ja.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/ja.lproj/Localizable.strings " ] ) )
1069+
1070+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " Copy " , " /tmp/Test/aProject/build/Debug/OtherProduct.bundle/zh_TW.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/zh_TW.lproj/Localizable.strings " ] ) )
1071+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " Copy " , " /tmp/aProject.dst/System/Library/Bundles/MyBundle.bundle/zh_TW.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/zh_TW.lproj/Localizable.strings " ] ) )
1072+ }
1073+
1074+ results. checkNoDiagnostics ( )
1075+ }
1076+
1077+ // install
1078+ await tester. checkBuild ( BuildParameters ( action: . install, configuration: " Release " ) , runDestination: . macOS) { results in
1079+ results. checkTarget ( " CoreFoo " ) { target in
1080+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " CopyStringsFile " , " /tmp/Test/aProject/build/Debug/OtherProduct.bundle/en.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/en.lproj/Localizable.strings " ] ) )
1081+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " CopyStringsFile " , " /tmp/aProject.dst/System/Library/Bundles/MyBundle.bundle/en.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/en.lproj/Localizable.strings " ] ) )
1082+
1083+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " CopyStringsFile " , " /tmp/Test/aProject/build/Debug/OtherProduct.bundle/ja.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/ja.lproj/Localizable.strings " ] ) )
1084+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " CopyStringsFile " , " /tmp/aProject.dst/System/Library/Bundles/MyBundle.bundle/ja.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/ja.lproj/Localizable.strings " ] ) )
1085+
1086+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " CopyStringsFile " , " /tmp/Test/aProject/build/Debug/OtherProduct.bundle/zh_TW.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/zh_TW.lproj/Localizable.strings " ] ) )
1087+ results. checkTaskExists ( . matchTarget( target) , . matchRule( [ " CopyStringsFile " , " /tmp/aProject.dst/System/Library/Bundles/MyBundle.bundle/zh_TW.lproj/Localizable.strings " , " /tmp/Test/aProject/Sources/zh_TW.lproj/Localizable.strings " ] ) )
1088+ }
1089+
1090+ results. checkNoDiagnostics ( )
1091+ }
1092+ }
1093+
10171094 @Test ( . requireSDKs( . iOS) )
10181095 func installLocForFramework( ) async throws {
10191096 let testProject = TestProject (
0 commit comments