@@ -104,20 +104,84 @@ if [ -f ../go.mod ]; then
104104 fi
105105 fi
106106
107- echo " Listing generated files:"
108- ls -la * .xcframework 2> /dev/null || echo " No .xcframework files found"
107+ echo " Listing generated files in current directory :"
108+ ls -la * .xcframework 2> /dev/null || echo " No .xcframework files found in current directory "
109109
110- echo " Moving xcframework to ios/Frameworks"
111- mkdir -p ios/Frameworks
110+ # Find the Flutter project root by looking for pubspec.yaml
111+ echo " Locating Flutter project root..."
112+ FLUTTER_ROOT=" "
113+ CURRENT_DIR=$( pwd)
114+
115+ # Check various possible locations for pubspec.yaml
116+ if [ -f " pubspec.yaml" ]; then
117+ FLUTTER_ROOT=" ."
118+ echo " Found Flutter project root at current directory"
119+ elif [ -f " ../pubspec.yaml" ]; then
120+ FLUTTER_ROOT=" ../"
121+ echo " Found Flutter project root at ../"
122+ elif [ -f " ../../pubspec.yaml" ]; then
123+ FLUTTER_ROOT=" ../../"
124+ echo " Found Flutter project root at ../../"
125+ elif [ -f " ../../../pubspec.yaml" ]; then
126+ FLUTTER_ROOT=" ../../../"
127+ echo " Found Flutter project root at ../../../"
128+ else
129+ # Try to find it by searching upwards
130+ SEARCH_DIR=" $CURRENT_DIR "
131+ for i in {1..5}; do
132+ SEARCH_DIR=" $( dirname " $SEARCH_DIR " ) "
133+ if [ -f " $SEARCH_DIR /pubspec.yaml" ]; then
134+ FLUTTER_ROOT=$( realpath --relative-to=" $CURRENT_DIR " " $SEARCH_DIR " )
135+ echo " Found Flutter project root at: $FLUTTER_ROOT "
136+ break
137+ fi
138+ done
139+
140+ if [ -z " $FLUTTER_ROOT " ]; then
141+ echo " Warning: Cannot find Flutter project root (pubspec.yaml), using default relative path"
142+ FLUTTER_ROOT=" ../../"
143+ fi
144+ fi
145+
146+ echo " Using Flutter project root: $FLUTTER_ROOT "
147+ echo " Creating iOS Frameworks directory at: ${FLUTTER_ROOT} ios/Frameworks"
148+ mkdir -p " ${FLUTTER_ROOT} ios/Frameworks"
112149
113150 # Check if xcframework files exist before moving
114151 if ls * .xcframework 1> /dev/null 2>&1 ; then
115- mv -f ./* .xcframework ios/Frameworks/
152+ echo " Moving xcframework files to Flutter iOS Frameworks directory..."
153+
154+ # Copy files to Flutter project
155+ for framework in * .xcframework; do
156+ echo " Moving $framework to ${FLUTTER_ROOT} ios/Frameworks/"
157+ mv " $framework " " ${FLUTTER_ROOT} ios/Frameworks/"
158+ done
159+
116160 echo " iOS framework build completed successfully"
117- echo " Files in ios/Frameworks:"
118- ls -la ios/Frameworks/
161+ echo " Files in Flutter iOS Frameworks directory:"
162+ ls -la " ${FLUTTER_ROOT} ios/Frameworks/"
163+
164+ # Verify the files are in the expected location
165+ EXPECTED_PATH=" ${FLUTTER_ROOT} ios/Frameworks"
166+ if [ -d " $EXPECTED_PATH " ] && [ " $( ls -A " $EXPECTED_PATH " ) " ]; then
167+ echo " ✅ Framework files successfully placed in: $EXPECTED_PATH "
168+ echo " Absolute path: $( cd " $EXPECTED_PATH " && pwd) "
169+ else
170+ echo " ❌ Warning: Framework files may not be in the expected location"
171+ fi
172+
173+ # Also create a local ios/Frameworks for backward compatibility
174+ mkdir -p ios/Frameworks
175+ if [ -d " ${FLUTTER_ROOT} ios/Frameworks" ]; then
176+ cp -f " ${FLUTTER_ROOT} ios/Frameworks/" * .xcframework ios/Frameworks/ 2> /dev/null || true
177+ echo " Local backup copy created in: $( pwd) /ios/Frameworks/"
178+ ls -la ios/Frameworks/ 2> /dev/null || echo " No local backup copy created"
179+ fi
119180 else
120181 echo " Warning: No .xcframework files were generated"
182+ echo " Checking if files were generated with different names..."
183+ ls -la * .framework 2> /dev/null || echo " No .framework files found either"
184+ ls -la openlistlib* 2> /dev/null || echo " No openlistlib files found"
121185 exit 1
122186 fi
123187else
0 commit comments