[codesign + open to suggestions] log warning instead of exception when metadata isn't present (#2329)

* ignore silently if no metadata

* improve warnings
diff --git a/codesign/lib/src/file_codesign_visitor.dart b/codesign/lib/src/file_codesign_visitor.dart
index 96b6b5e..0302a8e 100644
--- a/codesign/lib/src/file_codesign_visitor.dart
+++ b/codesign/lib/src/file_codesign_visitor.dart
@@ -317,8 +317,11 @@
         ? fileSystem.path.join(parent.path, 'entitlements.txt')
         : fileSystem.path.join(parent.path, 'without_entitlements.txt');
     if (!(await fileSystem.file(entitlementFilePath).exists())) {
-      throw CodesignException('$entitlementFilePath not found \n'
-          'make sure you have provided them along with the engine artifacts \n');
+      log.warning('$entitlementFilePath not found. '
+          'by default, system will assume there is no ${entitlements ? '' : 'without_'}entitlements file. '
+          'As a result, no binary will be codesigned.'
+          'if this is not intended, please provide them along with the engine artifacts.');
+      return <String>{};
     }
 
     final Set<String> fileWithEntitlements = <String>{};
diff --git a/codesign/test/file_codesign_visitor_test.dart b/codesign/test/file_codesign_visitor_test.dart
index c336340..d06c537 100644
--- a/codesign/test/file_codesign_visitor_test.dart
+++ b/codesign/test/file_codesign_visitor_test.dart
@@ -651,7 +651,7 @@
       );
     });
 
-    test('throw exception when configuration file is missing', () async {
+    test('log warnings when configuration file is missing', () async {
       fileSystem.file('${rootDirectory.absolute.path}/test_entitlement_2/entitlements.txt')
         ..createSync(recursive: true)
         ..writeAsStringSync(
@@ -675,14 +675,20 @@
           'file_c',
         ]),
       );
+      await codesignVisitor.parseEntitlements(
+        fileSystem.directory('${rootDirectory.absolute.path}/test_entitlement_2'),
+        false,
+      );
+      final List<String> messages = records
+          .where((LogRecord record) => record.level == Level.WARNING)
+          .map((LogRecord record) => record.message)
+          .toList();
       expect(
-        () => codesignVisitor.parseEntitlements(
-          fileSystem.directory('/Users/xilaizhang/Desktop/test_entitlement_2'),
-          false,
-        ),
-        throwsA(
-          isA<CodesignException>(),
-        ),
+        messages,
+        contains('${rootDirectory.absolute.path}/test_entitlement_2/without_entitlements.txt not found. '
+            'by default, system will assume there is no without_entitlements file. '
+            'As a result, no binary will be codesigned.'
+            'if this is not intended, please provide them along with the engine artifacts.'),
       );
     });
   });