-
-
Notifications
You must be signed in to change notification settings - Fork 0
plugin: update Things security and XcodeGen defaults #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| import json | ||
| import os | ||
| import subprocess | ||
| import sys | ||
| import tempfile | ||
| import unittest | ||
| from contextlib import contextmanager | ||
|
|
@@ -218,6 +219,7 @@ def test_xcodegen_path_can_succeed_with_fake_tools(self) -> None: | |
| self.assertIn("- path: Sources", project_yml) | ||
| self.assertIn("- path: Shared", project_yml) | ||
| self.assertIn("- path: Tests", project_yml) | ||
| self.assertEqual(project_yml.count('- "**/.gitkeep"'), 2) | ||
| self.assertNotIn("- path: Sources/App", project_yml) | ||
| self.assertNotIn("- path: Sources/Resources", project_yml) | ||
| self.assertNotIn("- path: Sources/Support", project_yml) | ||
|
|
@@ -317,6 +319,18 @@ def test_xcodegen_path_can_succeed_with_fake_tools(self) -> None: | |
| "ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES", | ||
| (target / "Configurations" / "Shared.xcconfig").read_text(encoding="utf-8"), | ||
| ) | ||
| self.assertIn( | ||
| "LOCALIZATION_PREFERS_STRING_CATALOGS = YES", | ||
| (target / "Configurations" / "Shared.xcconfig").read_text(encoding="utf-8"), | ||
| ) | ||
| self.assertIn( | ||
| "STRING_CATALOG_GENERATE_SYMBOLS = YES", | ||
| (target / "Configurations" / "Shared.xcconfig").read_text(encoding="utf-8"), | ||
| ) | ||
| self.assertIn( | ||
| "SWIFT_EMIT_LOC_STRINGS = YES", | ||
| (target / "Configurations" / "Shared.xcconfig").read_text(encoding="utf-8"), | ||
| ) | ||
| self.assertIn( | ||
| "DEAD_CODE_STRIPPING = YES", | ||
| (target / "Configurations" / "Shared.xcconfig").read_text(encoding="utf-8"), | ||
|
|
@@ -329,6 +343,10 @@ def test_xcodegen_path_can_succeed_with_fake_tools(self) -> None: | |
| "PRODUCT_BUNDLE_IDENTIFIER = com.example.DemoApp.tests", | ||
| (target / "Configurations" / "Tests.xcconfig").read_text(encoding="utf-8"), | ||
| ) | ||
| self.assertIn( | ||
| "GENERATE_INFOPLIST_FILE = YES", | ||
| (target / "Configurations" / "Tests.xcconfig").read_text(encoding="utf-8"), | ||
| ) | ||
| self.assertIn("xcodegen_template_paths", payload) | ||
| self.assertIn("standard_directory_paths", payload) | ||
| self.assertTrue((target / "AGENTS.md").exists()) | ||
|
|
@@ -372,6 +390,86 @@ def test_xcodegen_path_can_succeed_with_fake_tools(self) -> None: | |
| self.assertTrue((target / ".github" / "workflows" / "validate-repo-maintenance.yml").exists()) | ||
| self.assertEqual(payload["validation_result"], "passed (xcodebuild -list)") | ||
|
|
||
| @unittest.skipUnless( | ||
| sys.platform == "darwin" and os.environ.get("APPLE_DEV_SKILLS_RUN_XCODEGEN_INTEGRATION") == "1", | ||
| "Set APPLE_DEV_SKILLS_RUN_XCODEGEN_INTEGRATION=1 on macOS to run the XcodeGen integration test.", | ||
| ) | ||
| def test_xcodegen_bootstrap_generates_catalog_symbols(self) -> None: | ||
| with tempfile.TemporaryDirectory() as tmpdir: | ||
| code, payload = self.run_script( | ||
| "--name", | ||
| "TemplateProbe", | ||
| "--file-prefix", | ||
| "TMP", | ||
| "--destination", | ||
| tmpdir, | ||
| "--platform", | ||
| "macos", | ||
| "--project-generator", | ||
| "xcodegen", | ||
| "--skip-validation", | ||
| ) | ||
| self.assertEqual(code, 0, payload) | ||
|
|
||
| target = Path(payload["resolved_path"]) | ||
| project = target / "TemplateProbe.xcodeproj" | ||
| derived_data_path = Path(tmpdir) / "DerivedData" | ||
| build_settings = subprocess.run( | ||
| [ | ||
| "xcodebuild", | ||
| "-showBuildSettings", | ||
| "-project", | ||
| str(project), | ||
| "-scheme", | ||
| "TemplateProbe", | ||
| "-derivedDataPath", | ||
| str(derived_data_path), | ||
| ], | ||
| cwd=target, | ||
| capture_output=True, | ||
| text=True, | ||
| check=False, | ||
| ) | ||
| self.assertEqual(build_settings.returncode, 0, build_settings.stderr) | ||
| for setting in ( | ||
| "ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES", | ||
| "LOCALIZATION_PREFERS_STRING_CATALOGS = YES", | ||
| "STRING_CATALOG_GENERATE_SYMBOLS = YES", | ||
| "SWIFT_EMIT_LOC_STRINGS = YES", | ||
| ): | ||
| self.assertIn(setting, build_settings.stdout) | ||
|
|
||
| test_result = subprocess.run( | ||
| [ | ||
| "xcodebuild", | ||
| "test", | ||
| "-project", | ||
| str(project), | ||
| "-scheme", | ||
| "TemplateProbe", | ||
| "-destination", | ||
| "platform=macOS,arch=arm64", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the new opt-in XcodeGen integration test, hard-coding the destination to Useful? React with 👍 / 👎. |
||
| "-derivedDataPath", | ||
| str(derived_data_path), | ||
| ], | ||
| cwd=target, | ||
| capture_output=True, | ||
| text=True, | ||
| check=False, | ||
| ) | ||
| self.assertEqual(test_result.returncode, 0, test_result.stdout + test_result.stderr) | ||
|
|
||
| generated_sources = derived_data_path.glob( | ||
| "Build/Intermediates.noindex/TemplateProbe.build/**/DerivedSources" | ||
| ) | ||
| generated_files = { | ||
| source.name | ||
| for directory in generated_sources | ||
| for source in directory.glob("Generated*.swift") | ||
| } | ||
| self.assertIn("GeneratedAssetSymbols.swift", generated_files) | ||
| self.assertIn("GeneratedStringSymbols_Localizable.swift", generated_files) | ||
|
|
||
| def test_xcodegen_templates_are_checked_in_as_bootstrap_sources(self) -> None: | ||
| expected_templates = { | ||
| "project.yml.tmpl", | ||
|
|
@@ -399,6 +497,7 @@ def test_xcodegen_templates_are_checked_in_as_bootstrap_sources(self) -> None: | |
| self.assertIn("- path: Sources", project_template) | ||
| self.assertIn("- path: Shared", project_template) | ||
| self.assertIn("- path: Tests", project_template) | ||
| self.assertEqual(project_template.count('- "**/.gitkeep"'), 2) | ||
| self.assertNotIn("- path: Sources/App", project_template) | ||
| self.assertNotIn("- path: Sources/Resources", project_template) | ||
| self.assertNotIn("- path: Sources/Support", project_template) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.