@@ -8,25 +8,54 @@ swift package update
88echo " Building Swift package..."
99swift build --configuration release --verbose
1010
11- echo " Build completed. Files in .build/release/:"
11+ echo " Build completed. Checking build output..."
12+
13+ # Check if build directory exists
14+ if [ ! -d " .build/release/" ]; then
15+ echo " ERROR: No .build/release directory found!"
16+ echo " Available .build directories:"
17+ ls -la .build/ 2> /dev/null || echo " No .build directory found at all"
18+ exit 1
19+ fi
20+
21+ echo " Files in .build/release/:"
1222ls -la .build/release/ 2> /dev/null || echo " No .build/release directory found"
1323
24+ # Also check for any library files specifically
25+ echo " Looking for library files in .build/release/:"
26+ find .build/release/ -name " *Loop*" -o -name " *.dylib" -o -name " *.so" -o -name " *.dll" 2> /dev/null || echo " No library files found"
27+
1428# Detect the operating system and set the library paths
1529if [[ " $OSTYPE " == " darwin" * ]]; then
1630 SOURCE_LIB=" .build/release/libLoopAlgorithmToPython.dylib"
1731 DEST_LIB=" ./loop_to_python_api/dlibs/macos/libLoopAlgorithmToPython.dylib"
1832elif [[ " $OSTYPE " == " linux-gnu" * ]]; then
33+ echo " Detected Linux system. Searching for library files..."
1934 # Linux: Swift might generate different library names/paths
2035 # Check for possible library names
2136 if [ -f " .build/release/libLoopAlgorithmToPython.so" ]; then
2237 SOURCE_LIB=" .build/release/libLoopAlgorithmToPython.so"
38+ echo " Found library: $SOURCE_LIB "
2339 elif [ -f " .build/release/LoopAlgorithmToPython.so" ]; then
2440 SOURCE_LIB=" .build/release/LoopAlgorithmToPython.so"
41+ echo " Found library: $SOURCE_LIB "
2542 elif [ -f " .build/release/libLoopAlgorithmToPython" ]; then
2643 SOURCE_LIB=" .build/release/libLoopAlgorithmToPython"
44+ echo " Found library (no extension): $SOURCE_LIB "
2745 else
28- echo " ERROR: Could not find Linux library file. Available files:"
29- find .build/release/ -name " *Loop*" -o -name " *.so" 2> /dev/null || echo " No library files found"
46+ echo " ERROR: Could not find Linux library file!"
47+ echo " Searched for:"
48+ echo " - .build/release/libLoopAlgorithmToPython.so"
49+ echo " - .build/release/LoopAlgorithmToPython.so"
50+ echo " - .build/release/libLoopAlgorithmToPython"
51+ echo " "
52+ echo " Available files in .build/release/:"
53+ ls -la .build/release/ 2> /dev/null || echo " Directory not accessible"
54+ echo " "
55+ echo " All library-like files found:"
56+ find .build/release/ -name " *Loop*" -o -name " *.so" -o -name " *.a" -o -name " lib*" 2> /dev/null || echo " No library files found"
57+ echo " "
58+ echo " Swift build might have failed or generated different output on Linux."
3059 exit 1
3160 fi
3261 DEST_LIB=" ./loop_to_python_api/dlibs/linux/libLoopAlgorithmToPython.so"
3867 exit 1
3968fi
4069
70+ # Create destination directory if it doesn't exist
71+ DEST_DIR=$( dirname " $DEST_LIB " )
72+ if [ ! -d " $DEST_DIR " ]; then
73+ echo " Creating destination directory: $DEST_DIR "
74+ mkdir -p " $DEST_DIR "
75+ fi
76+
4177# Copy the library
78+ echo " Copying library:"
79+ echo " From: $SOURCE_LIB "
80+ echo " To: $DEST_LIB "
81+
4282if cp " $SOURCE_LIB " " $DEST_LIB " ; then
43- echo " Library successfully copied to the loop_to_python_api folder!"
83+ echo " ✓ Library successfully copied!"
84+ echo " Final library info:"
85+ ls -la " $DEST_LIB "
4486else
45- echo " Failed to copy the library. Source: $SOURCE_LIB "
87+ echo " ✗ Failed to copy the library!"
88+ echo " Source file info:"
89+ ls -la " $SOURCE_LIB " 2> /dev/null || echo " Source file does not exist or is not accessible"
4690 echo " Available files in .build/release/:"
4791 ls -la .build/release/ 2> /dev/null || echo " No build output found"
92+ exit 1
4893fi
4994
0 commit comments