ann-flavor-cocoapods 0.1.21 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/exe/ann-ios-flavorize +7 -2
- data/lib/ann_flavor_cocoapods/podfile_helper.rb +48 -5
- data/lib/ann_flavor_cocoapods/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: '0510266791f6543ce641e8082e693844065a0e8bc414e5a01ca12a46db95f63e'
|
|
4
|
+
data.tar.gz: 9faee734f2d21213120042445ba92c39c3b9cfc61f43566c1dec9539d29edc90
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3ab7ba628dfbde6570a1a389e70f6d3e6762f7a5960c74e4411807162066491d613e435b44f0eafb3ed90712f6ffd5bb9b40bd014aa01048c7b2cda6947bbdec
|
|
7
|
+
data.tar.gz: 83bb48dbf460a63f816965cb222161f20456bb60f1046060121ae3538074b05d6fcb5279e95c1d5b01bd40e53cf3b9c763f7e2b49806daf950577ff299d5935b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.24
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **iOS-only (non-Flutter) project support for `project_id`-mode Firebase**: the plugin now detects project layout once, at `pod install` time, by checking for `pubspec.yaml` at the project root. Flutter projects (pubspec.yaml present) keep resolving generated Firebase config files from `lib/generated/firebase/`, unchanged. Plain Xcode projects with no Flutter wrapper (pubspec.yaml absent) now resolve them from `ios/generated/firebase/` instead of incorrectly assuming a `lib/` directory that doesn't exist. `config_file` mode (an explicit path in `annspec.yaml`) is unaffected by this change on either layout. `ann-ios-flavorize setup` now prints which layout it detected (`Detected: Flutter project` / `Detected: iOS-only project`) and its error messages no longer assume a Flutter project when `annspec.yaml` or `ios/Podfile` is missing.
|
|
7
|
+
|
|
8
|
+
## 0.1.23
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Upgrading past 0.1.22 did not actually fix the `../../` path bug for any project that had already run `pod install` against an earlier version — `inject_build_phases`'s idempotency check only tested whether a phase carrying our marker text already existed, never whether its content matched the currently-installed gem. Once injected, a stale build phase was permanently baked into `project.pbxproj` and silently skipped on every later `pod install`, regardless of gem upgrades. The check now removes any existing `[ann-flavor] Copy Firebase plist` / `[ann-flavor] Remove Firebase plist` phases by name before re-adding fresh ones on every `post_integrate` run, so the injected script always matches the installed gem version. **Projects with a stale phase already baked in from a prior version must run `pod install` once with 0.1.23 to self-heal** — no manual `project.pbxproj` editing needed.
|
|
12
|
+
|
|
13
|
+
## 0.1.22
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- 0.1.21 fixed which target the Firebase plist copy build phase runs in but left an off-by-one in the source path it computes — `"${SRCROOT}/../../#{plist_path}"` looked two directories above `$SRCROOT` (`<project_root>/ios`), landing one level *above* the Flutter project root, so the script failed with `Firebase plist not found` even though the file existed exactly where expected. `plist_path` is relative to the Flutter project root, and for the real `Runner` target `$SRCROOT` is `<project_root>/ios` — one level below it — so only a single `..` is needed. Fixed.
|
|
17
|
+
|
|
3
18
|
## 0.1.21
|
|
4
19
|
|
|
5
20
|
### Fixed
|
data/exe/ann-ios-flavorize
CHANGED
|
@@ -52,17 +52,22 @@ def run_setup(root)
|
|
|
52
52
|
annspec = File.join(root, 'annspec.yaml')
|
|
53
53
|
unless File.exist?(annspec)
|
|
54
54
|
warn "✗ annspec.yaml not found in #{root}"
|
|
55
|
-
warn " Run ann-ios-flavorize from your
|
|
55
|
+
warn " Run ann-ios-flavorize from your project root (the directory containing"
|
|
56
|
+
warn " annspec.yaml and ios/), or use --project <dir>."
|
|
56
57
|
exit 1
|
|
57
58
|
end
|
|
58
59
|
|
|
59
60
|
podfile_path = File.join(root, 'ios', 'Podfile')
|
|
60
61
|
unless File.exist?(podfile_path)
|
|
61
62
|
warn "✗ ios/Podfile not found in #{root}"
|
|
62
|
-
warn " Create an
|
|
63
|
+
warn " Create an ios/ directory with a Podfile first (via Xcode or `pod init`),"
|
|
64
|
+
warn " then re-run this command."
|
|
63
65
|
exit 1
|
|
64
66
|
end
|
|
65
67
|
|
|
68
|
+
layout = File.exist?(File.join(root, 'pubspec.yaml')) ? 'Flutter project' : 'iOS-only project (no pubspec.yaml found)'
|
|
69
|
+
puts "Detected: #{layout}"
|
|
70
|
+
|
|
66
71
|
plugin_line = "plugin 'ann-ios-flavorize'"
|
|
67
72
|
content = File.read(podfile_path)
|
|
68
73
|
|
|
@@ -38,12 +38,16 @@ module AnnFlavorCocoapods
|
|
|
38
38
|
ios = spec.app&.ios
|
|
39
39
|
return if ios.nil?
|
|
40
40
|
|
|
41
|
+
layout = detect_project_layout(project_root)
|
|
42
|
+
|
|
41
43
|
# Build a map: configuration_name → config_file path.
|
|
42
44
|
# Xcode configuration names are capitalized: Release-<flavor>, Debug-<flavor>.
|
|
43
45
|
config_map = {}
|
|
44
46
|
ios.flavors.each_key do |flavor_key|
|
|
45
47
|
AnnFlavorCore::Resolver::STANDARD_BUILD_TYPES.each do |bt|
|
|
46
|
-
fb_file = AnnFlavorCore::IosResolution.firebase_config_path(
|
|
48
|
+
fb_file = AnnFlavorCore::IosResolution.firebase_config_path(
|
|
49
|
+
ios, flavor_key, bt, generated_dir: layout[:generated_dir]
|
|
50
|
+
)
|
|
47
51
|
next unless fb_file
|
|
48
52
|
|
|
49
53
|
# Map Xcode config name (e.g. "Release-ledger_in") → plist path
|
|
@@ -60,6 +64,29 @@ module AnnFlavorCocoapods
|
|
|
60
64
|
inject_build_phases(installer, project_root, config_map)
|
|
61
65
|
end
|
|
62
66
|
|
|
67
|
+
# Detects whether project_root is a Flutter project (has pubspec.yaml, so
|
|
68
|
+
# generated Firebase files live under lib/generated/firebase/) or a plain
|
|
69
|
+
# iOS-only Xcode project with no Flutter wrapper (no pubspec.yaml — ios/
|
|
70
|
+
# itself is the effective root, so generated Firebase files live under
|
|
71
|
+
# ios/generated/firebase/ instead, since there is no lib/ to nest under).
|
|
72
|
+
# Either way, the returned generated_dir is relative to project_root, and
|
|
73
|
+
# for the real Runner target $SRCROOT is always <project_root>/ios — one
|
|
74
|
+
# level below project_root — so inject_build_phases always needs exactly
|
|
75
|
+
# one ".." hop to reach it, regardless of layout.
|
|
76
|
+
#
|
|
77
|
+
# Resolved once here, at pod install time, rather than probed for at build
|
|
78
|
+
# time inside the generated shell script — a runtime "try here, then try
|
|
79
|
+
# one level up" fallback would mask a genuinely wrong layout instead of
|
|
80
|
+
# surfacing it, exactly the failure mode already fixed once in this file
|
|
81
|
+
# (DEF-061, #61 and the 0.1.22/0.1.23 stale-path bugs).
|
|
82
|
+
def self.detect_project_layout(project_root)
|
|
83
|
+
if File.exist?(File.join(project_root, 'pubspec.yaml'))
|
|
84
|
+
{ generated_dir: 'lib/generated/firebase' }
|
|
85
|
+
else
|
|
86
|
+
{ generated_dir: 'ios/generated/firebase' }
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
63
90
|
# Returns the bundle ID for a given flavor key and build type (e.g. "debug"),
|
|
64
91
|
# applying build_types[build_type].id_suffix from either flavor or default.
|
|
65
92
|
# An unknown flavor key falls back to the unsuffixed default id (matches
|
|
@@ -103,8 +130,18 @@ module AnnFlavorCocoapods
|
|
|
103
130
|
def self.inject_build_phases(installer, project_root, config_map)
|
|
104
131
|
# Build the per-config shell that selects the right source file.
|
|
105
132
|
# Uses a case statement keyed on $CONFIGURATION (Xcode build setting).
|
|
133
|
+
# plist_path is always relative to project_root (either
|
|
134
|
+
# lib/generated/firebase/... for a Flutter project, or
|
|
135
|
+
# ios/generated/firebase/... for an iOS-only project — see
|
|
136
|
+
# detect_project_layout); for the real Runner target (fixed by
|
|
137
|
+
# DEF-061, #61) $SRCROOT is <project_root>/ios, one level below
|
|
138
|
+
# project_root regardless of layout — a single ".." reaches it in both
|
|
139
|
+
# cases. (The old ".." x2 was seemingly sized for Pods-Runner's
|
|
140
|
+
# $SRCROOT, one level deeper still inside CocoaPods' generated
|
|
141
|
+
# Pods.xcodeproj, but that build phase never actually ran there either,
|
|
142
|
+
# so this was never previously exercised.)
|
|
106
143
|
case_body = config_map.map do |xcode_config, plist_path|
|
|
107
|
-
" #{xcode_config}) SRC_PLIST=\"${SRCROOT}
|
|
144
|
+
" #{xcode_config}) SRC_PLIST=\"${SRCROOT}/../#{plist_path}\" ;;"
|
|
108
145
|
end.join("\n")
|
|
109
146
|
|
|
110
147
|
pre_build_script = <<~SHELL
|
|
@@ -143,9 +180,15 @@ module AnnFlavorCocoapods
|
|
|
143
180
|
# product type, not a hardcoded "Runner"/"Pods-Runner" name.
|
|
144
181
|
next unless target.symbol_type == :application
|
|
145
182
|
|
|
146
|
-
#
|
|
147
|
-
|
|
148
|
-
|
|
183
|
+
# Remove any previously-injected phases before re-adding fresh ones.
|
|
184
|
+
# A presence-only check here (skip if a phase with our marker already
|
|
185
|
+
# exists) would leave a stale script baked into project.pbxproj forever
|
|
186
|
+
# once injected once — pod install does not re-read the gem's current
|
|
187
|
+
# script content into an existing phase, so upgrading the gem alone
|
|
188
|
+
# would never fix an already-injected, now-outdated shell_script.
|
|
189
|
+
target.build_phases.reject! do |p|
|
|
190
|
+
p.respond_to?(:name) && ['[ann-flavor] Copy Firebase plist', '[ann-flavor] Remove Firebase plist'].include?(p.name)
|
|
191
|
+
end
|
|
149
192
|
|
|
150
193
|
pre = target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
|
|
151
194
|
pre.name = '[ann-flavor] Copy Firebase plist'
|