diff options
author | George Miller <George@livio.io> | 2022-06-07 11:51:11 -0400 |
---|---|---|
committer | George Miller <George@livio.io> | 2022-06-07 11:51:11 -0400 |
commit | 1e189c8ade7b3e536c4fc031d76bd1c4f1984249 (patch) | |
tree | 4f2a72c7dc177ab4cff82cd9c3ebfdb9d08c092d | |
parent | d7e23b481bc5c87c79a19b741893c0fd86b72f72 (diff) | |
download | sdl_ios-1e189c8ade7b3e536c4fc031d76bd1c4f1984249.tar.gz |
testing
Comiting before I do my testing in case I accidentally discard changes
-rwxr-xr-x | scripts/cleanup.sh | 40 | ||||
-rwxr-xr-x | scripts/create_framework.sh | 80 | ||||
-rwxr-xr-x | scripts/release.sh | 36 |
3 files changed, 85 insertions, 71 deletions
diff --git a/scripts/cleanup.sh b/scripts/cleanup.sh new file mode 100755 index 000000000..e66178707 --- /dev/null +++ b/scripts/cleanup.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# the purpose here is to remove some files that may be created during testing of the framework script + +#process is that for each file, we check if it exists, and if it does, we nuke it + +# If we are running from the scripts directory, we want to pop back to the project root to do everything. +if [[ $PWD == *"scripts" ]]; then + cd .. +fi +# If, for some reason, we are not now in the correct working directory, exit +if [[ $PWD != *"sdl_ios" ]]; then + echo "Please run this from the sdl_ios project root or the sdl_ios/scripts directory" + exit 0 +fi + +# these show in finder as files, but show in Fork as folders +# bash aparently also sees them as folders +#SmartDeviceLink-Device.xcarchive +#SmartDeviceLink-Simulator.xcarchive + +#folders +folder="SmartDeviceLink-Device.xcarchive" +if [ -d "$folder" ]; then rm -r $folder; fi + +folder="SmartDeviceLink-Simulator.xcarchive" +if [ -d "$folder" ]; then rm -r $folder; fi + +# this one shouldn't exist, but just in case +folder="SmartDeviceLink.xcframework" +if [ -d "$folder" ]; then rm -r $folder; fi + + +# this is a file, but finder can open it like a folder +# also, the version in the middle changes. SO we'll use wildcard chars +#SmartDeviceLink-7.4.2.xcframework.zip + +#files +file_name="SmartDeviceLink-?.?.?.xcframework.zip" +if [ -f $file_name ]; then rm $file_name; fi diff --git a/scripts/create_framework.sh b/scripts/create_framework.sh index 64e079769..952e45adb 100755 --- a/scripts/create_framework.sh +++ b/scripts/create_framework.sh @@ -1,10 +1,11 @@ #!/bin/bash # George Miller -# 06-03-2022 +# 07-07-2022 # If you don't have permission to run, try: chmod u+x create_framework.sh -# a utility function for prompting the user Y/N + +# utility function for prompting the user Y/N # takes in a string promt for the input # returns 1 for yes/true or 0 for no/false prompt_user() { @@ -34,28 +35,33 @@ if [[ $PWD != *"sdl_ios" ]]; then exit 0 fi -# 2 get the verison number -# get the verison number -# at this point the version in the project file should be correct, so use it. -project_file="./SmartDeviceLink-iOS.xcodeproj/project.pbxproj" -current_version_number=$(sed -n '/MARKETING_VERSION/{s/MARKETING_VERSION = //;s/;//;s/^[[:space:]]*//;p;q;}' $project_file) -if [ -z $current_version_number ]; then current_version_number="1.0.0"; fi -echo "Current Version: "$current_version_number -# todo - we can streamline this by trusting the project file to always have the correct version (bail out if project file missing) -prompt_user "Is this version correct" -if [[ $? == 0 ]]; then - # Prompt user for new version - echo "Enter the new version number (semantic versioning x.x.x format) or blank to skip: " - read new_version_number +# if there is no command line ask for a version number +if [ -z $1 ]; then + # 2 get the verison number + # get the verison number + # at this point the version in the project file should be correct, so use it. + project_file="./SmartDeviceLink-iOS.xcodeproj/project.pbxproj" + current_version_number=$(sed -n '/MARKETING_VERSION/{s/MARKETING_VERSION = //;s/;//;s/^[[:space:]]*//;p;q;}' $project_file) + if [ -z $current_version_number ]; then current_version_number="1.0.0"; fi + echo "Current Version: "$current_version_number + + # todo - we can streamline this by trusting the project file to always have the correct version (bail out if project file missing) + prompt_user "Is this version correct" + if [[ $? == 0 ]]; then + # Prompt user for new version + echo "Enter the new version number (semantic versioning x.x.x format) or blank to skip: " + read new_version_number - # If blank or the same, then skip. Otherwise change the version number - if [ -z $new_version_number ]; then - echo "No version number entered. Skipping..." - new_version_number=$current_version_number + # If blank or the same, then skip. Otherwise change the version number + if [ -z $new_version_number ]; then + echo "No version number entered. Skipping..." + new_version_number=$current_version_number + fi fi +else + new_version_number=$1 fi - # 3 Add a binary xcframework archive for manual installation with the following commands echo echo "Creating a binary xcframework for manual installation" @@ -68,31 +74,23 @@ xcodebuild -create-xcframework -framework './SmartDeviceLink-Device.xcarchive/Pr folder="SmartDeviceLink.xcframework" zip_file_name="SmartDeviceLink-$new_version_number.xcframework.zip" -read user_input # kill the old zip if present. Useful for re-running the script if [ -f $zip_file_name ]; then rm $zip_file_name; fi -read user_input -# verify file exists before acting on it. -if [ -d "$folder" ]; then zip $zip_file_name $folder; fi -read user_input -# Check to see if the zip exists, and then remove old files. -if [ -f "$zip_file_name" ]; then rm -r $folder; fi -read user_input +# verify folder exists before acting on it. +if [ -d "$folder" ]; then + zip $zip_file_name $folder + # Check to see if the zip exists, and then remove old files. + if [ -f "$zip_file_name" ]; then rm -r $folder; fi +fi + +#cleanup artifacts +folder="SmartDeviceLink-Device.xcarchive" +if [ -d "$folder" ]; then rm -r $folder; fi + +folder="SmartDeviceLink-Simulator.xcarchive" +if [ -d "$folder" ]; then rm -r $folder; fi echo echo "The xcframework zip file was created at $zip_file_name. Please add it to the Github Release, then press enter..." read user_input -# 14 Rename the docset and pack it -prompt_user "Would you like to create a the docset" -if [[ $? == 1 ]]; then - # SmartDeviceLink-$new_version_number-docset.tgz - docset_directory="docs/docsets/" - docset_tar_file_name="SmartDeviceLink-$new_version_number-docset.tgz" - tar -czf $docset_tar_file_name $docset_directory - - echo - echo "Please add the docset at $docset_tar_file_name to the Github release, then press enter..." - read user_input - #todo - phase 4 - adding the docset to the release shoudl also be automatic -fi
\ No newline at end of file diff --git a/scripts/release.sh b/scripts/release.sh index 660d13068..72d143e62 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -142,6 +142,7 @@ fi echo echo "Please update CHANGELOG.md, then return here and press enter..." read user_input +# TODO - check modified info before and after so we can detect if the user failed to update the file. # 5 generate documentation @@ -194,8 +195,6 @@ if [[ $? == 1 ]]; then echo "Please check that everything is correct. Then, assuming you have permissions, push to master, then press enter..." fi - - echo # 9 tag it prompt_user "Would you like to tag this release with $new_version_number? (This will not push the tag)" @@ -232,37 +231,14 @@ if [[ $? == 1 ]]; then pod trunk push SmartDeviceLink-iOS.podspec --allow-warnings fi -# TODO - Chop here, and make everything for the framework into it's own script. - -# 13 Add a binary xcframework archive for manual installation with the following commands echo prompt_user "Would you like to create a binary xcframework for manual installation" if [[ $? == 1 ]]; then - xcodebuild archive -project 'SmartDeviceLink-iOS.xcodeproj/' -scheme 'SmartDeviceLink' -configuration Release -destination 'generic/platform=iOS' -archivePath './SmartDeviceLink-Device.xcarchive' SKIP_INSTALL=NO - xcodebuild archive -project 'SmartDeviceLink-iOS.xcodeproj/' -scheme 'SmartDeviceLink' -configuration Release -destination 'generic/platform=iOS Simulator' -archivePath './SmartDeviceLink-Simulator.xcarchive' SKIP_INSTALL=NO - xcodebuild -create-xcframework -framework './SmartDeviceLink-Device.xcarchive/Products/Library/Frameworks/SmartDeviceLink.framework/' -framework './SmartDeviceLink-Simulator.xcarchive/Products/Library/Frameworks/SmartDeviceLink.framework/' -output './SmartDeviceLink.xcframework' - - folder="SmartDeviceLink.xcframework" - zip_file_name="SmartDeviceLink-$new_version_number.xcframework.zip" - if [ -f $zip_file_name ]; then - # kill the old zip if present. Useful for re-running the script - rm $zip_file_name - fi - - # verify file exists before acting on it. - if [ -d "$folder" ]; then - zip $zip_file_name $folder - fi - - # Check to see if the zip exists, and then remove old files. - if [ -f "$zip_file_name" ]; then - rm -r $folder - fi - - echo - echo "The xcframework zip file was created at $zip_file_name. Please add it to the Github Release, then press enter..." - read user_input - #TODO - phase 4 - automate adding to release + # create framework + # we pass in the version so that the framework script does not need to ask + # remember the user will need to ahve permissions for the framework script + chmod u+x ./scripts/create_framework.sh #I don't know if this works? + ./scripts/create_framework.sh $new_version_number fi # 14 Rename the docset and pack it |