-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c84fb1
commit 0e4d80d
Showing
107 changed files
with
13,366 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MAKEFLAGS += --silent | ||
|
||
update_dependencies: | ||
echo "👉 Updating Nuke" | ||
make update_nuke version=11.3.1 | ||
echo "👉 Updating SwiftyGif" | ||
make update_swiftygif version=5.4.2 | ||
|
||
update_nuke: check_version_parameter | ||
./Scripts/updateDependency.sh $(version) Dependencies/Nuke Sources/StreamChatSwiftUI/StreamNuke Sources | ||
./Scripts/removePublicDeclarations.sh Sources/StreamChatSwiftUI/StreamNuke | ||
|
||
update_swiftygif: check_version_parameter | ||
./Scripts/updateDependency.sh $(version) Dependencies/SwiftyGif Sources/StreamChatSwiftUI/StreamSwiftyGif SwiftyGif | ||
./Scripts/removePublicDeclarations.sh Sources/StreamChatSwiftUI/StreamSwiftyGif | ||
|
||
check_version_parameter: | ||
@if [ "$(version)" = "" ]; then\ | ||
echo "❌ Missing version parameter"; \ | ||
exit 1;\ | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Usage: ./removePublicDeclarations.sh Sources/StreamNuke | ||
# | ||
# This script would iterate over the files on a particular directory, and perform basic replacement operations. | ||
# It heavily relies on 'sed': | ||
# sed -i '<backup-file-extension>' -e 's/<original-string>/<replacement>/g' <file> | ||
# ^ | ||
# Passing empty string prevents the creation of backup files | ||
|
||
args=("$@") | ||
directory=$1 | ||
|
||
replaceDeclaration() { | ||
original=$1 | ||
replacement=$2 | ||
file=$3 | ||
`sed -i '' -e "s/$original/$replacement/g" $file` | ||
} | ||
|
||
files=`find $directory -name "*.swift"` | ||
for f in $files | ||
do | ||
replaceDeclaration 'public internal(set) ' '' $f | ||
replaceDeclaration 'open ' '' $f | ||
replaceDeclaration 'public ' '' $f | ||
|
||
# Nuke | ||
if [[ $directory == *"Nuke"* ]]; then | ||
replaceDeclaration 'var log' 'var nukeLog' $f | ||
replaceDeclaration 'log =' 'nukeLog =' $f | ||
replaceDeclaration 'log: log' 'log: nukeLog' $f | ||
replaceDeclaration 'signpost(log' 'signpost(nukeLog' $f | ||
replaceDeclaration ' Cache(' ' NukeCache(' $f | ||
replaceDeclaration ' Cache<' ' NukeCache<' $f | ||
replaceDeclaration ' Image?' ' NukeImage?' $f | ||
replaceDeclaration ' Image(' ' NukeImage(' $f | ||
replaceDeclaration 'struct Image:' 'struct NukeImage:' $f | ||
replaceDeclaration 'extension Image {' 'extension NukeImage {' $f | ||
replaceDeclaration 'Content == Image' 'Content == NukeImage' $f | ||
replaceDeclaration ' VideoPlayerView' ' NukeVideoPlayerView' $f | ||
replaceDeclaration 'typealias Color' 'typealias NukeColor' $f | ||
replaceDeclaration 'extension Color' 'extension NukeColor' $f | ||
replaceDeclaration 'AssetType' 'NukeAssetType' $f | ||
replaceDeclaration 'typealias ImageRequest = Nuke.ImageRequest' '' $f | ||
replaceDeclaration 'typealias ImageResponse = Nuke.ImageResponse' '' $f | ||
replaceDeclaration 'typealias ImagePipeline = Nuke.ImagePipeline' '' $f | ||
replaceDeclaration 'typealias ImageContainer = Nuke.ImageContainer' '' $f | ||
replaceDeclaration 'open class ' '' $f | ||
replaceDeclaration 'import Nuke' '' $f | ||
|
||
# Remove Cancellable interface duplicate | ||
if [[ $f == *"DataLoader"* && `head -10 $f` == *"protocol Cancellable"* ]]; then | ||
`sed -i '' -e '7,11d' $f` | ||
fi | ||
|
||
# Rename files | ||
if [[ $f == *"Caching/Cache.swift" ]]; then | ||
new_f="${f/Cache.swift/NukeCache.swift}" | ||
mv "$f" "$new_f" | ||
elif [[ $f == *"NukeUI/VideoPlayerView.swift" ]]; then | ||
new_f="${f/VideoPlayerView.swift/NukeVideoPlayerView.swift}" | ||
mv "$f" "$new_f" | ||
fi | ||
fi | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Usage: ./removeUnneededSymbols.sh StreamChatSwiftUI ./Products | ||
# | ||
# Creating an xcframework for StreamChatSwiftUI generates a .bcsymbolmap file for itself, and one for | ||
# each of its dependencies too (eg. StreamChat). That means that we will end up having something like: | ||
# | ||
# -> StreamChatSwiftUI/BCSymbolMaps/ | ||
# <UUID-StreamChatSwiftUI>.bcsymbolmap | ||
# <UUID-StreamChat>.bcsymbolmap | ||
# | ||
# When adding both StreamChat and StreamChatSwiftUI to an app, it will throw an error when trying to compile | ||
# saying that there are multiple executions producing the same file (<UUID-StreamChat>.bcsymbolmap). | ||
# | ||
# This script will remove duplicated .bcsymbolmap in the generated xcframeworks. | ||
# If we countinue with the same example, it will leave it as follows: | ||
# | ||
# -> StreamChatSwiftUI/BCSymbolMaps/ | ||
# <UUID-StreamChatSwiftUI>.bcsymbolmap | ||
# | ||
# Each xcframework only contains its symbols now. | ||
|
||
args=("$@") | ||
library=$1 | ||
output_directory=$2 | ||
|
||
function removeUnneededSymbols() { | ||
arch=$1 | ||
path="$output_directory/$library.xcframework/$arch/BCSymbolMaps" | ||
cd $path | ||
|
||
# Looking for [...]/DerivedSources/[LIBRARY-NAME]_vers.c | ||
regex="(\/DerivedSources\/)([a-zA-Z_]*)(_vers.c)" | ||
files="*.bcsymbolmap" | ||
for f in $files | ||
do | ||
text=`head -10 $f` | ||
[[ $text =~ $regex ]] | ||
library_match="${BASH_REMATCH[2]}" | ||
if [[ $library_match != $library ]] | ||
then | ||
echo "→ Removing uneeded 'bcsymbolmap' from $library-$arch: $library_match - $f" | ||
rm $f | ||
fi | ||
done | ||
|
||
cd - >/dev/null | ||
} | ||
|
||
removeUnneededSymbols "ios-arm64" | ||
removeUnneededSymbols "ios-arm64_x86_64-simulator" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Usage: ./updateDependency.sh 10.3.3 Dependencies/Nuke Sources/StreamNuke Sources | ||
# | ||
# This script gets the source code of a dependency of a given library, and copies it to our codebase | ||
|
||
ensure_clean_git () { | ||
if !(git diff-index --quiet HEAD) | ||
then | ||
echo "→ Seems like git is not clean in $dependency_directory. Please make sure it is clean, and run it again" | ||
exit 1 | ||
fi | ||
} | ||
|
||
args=("$@") | ||
version=$1 | ||
dependency_directory=$2 | ||
output_directory=$3 | ||
sources_directory=$4 | ||
|
||
dependency_url="" | ||
|
||
if [[ $dependency_directory == *"Nuke"* ]]; then | ||
dependency_url="[email protected]:kean/Nuke.git" | ||
elif [[ $dependency_directory == *"SwiftyGif"* ]]; then | ||
dependency_url="[email protected]:kirualex/SwiftyGif.git" | ||
else | ||
echo "→ Unknown dependency at $dependency_directory" | ||
exit 1 | ||
fi | ||
|
||
if ! [[ -d "$dependency_directory" ]]; then | ||
echo "→ $dependency_directory does not exist in your filesystem. Cloning the repo" | ||
git clone $dependency_url $dependency_directory | ||
fi | ||
|
||
cd $dependency_directory | ||
|
||
ensure_clean_git | ||
|
||
git fetch --tags | ||
git checkout $version | ||
|
||
ensure_clean_git | ||
|
||
cd - | ||
|
||
echo "→ Copying source files" | ||
rm -rf $output_directory | ||
mkdir $output_directory | ||
cp -r "$dependency_directory/$sources_directory/." $output_directory | ||
|
||
|
||
for f in `find $output_directory -type f \( -iname \*.h -o -iname \*.plist \)` | ||
do | ||
echo "→ Removing $f" | ||
rm $f | ||
done | ||
|
||
rm -rf $dependency_directory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,6 @@ | |
// | ||
|
||
import AVKit | ||
import Nuke | ||
import NukeUI | ||
import StreamChat | ||
import SwiftUI | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.