Skip to content

Commit

Permalink
Merge pull request #4596 from vector-im/steve/add_setup_project_script
Browse files Browse the repository at this point in the history
Tools: Add a script to initialize quickly and easily the project
  • Loading branch information
SBiOSoftWhare authored Aug 9, 2021
2 parents f66ce59 + 2d3a912 commit 2815ef7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Changes to be released in next version
*

🧱 Build
*
* Add a script to initialize quickly and easily the project.

Others
* Docs: Add reference to AppIdentifiers.xcconfig in INSTALL.md
Expand Down
8 changes: 8 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ $ open Riot.xcworkspace
**Note**: If you have multiple Xcode versions installed don't forget to use the right version of Command Line Tools when you are building the app. To check the Command Line Tools version go to `Xcode > Preferences > Locations > Command Line Tools` and check that the displayed version match your Xcode version.


### Generate the project in one line without effort

If you want to generate the project easily and quickly, there is a local script called `setup_project.sh` that creates the `xcodeproj` and `xcworkspace` with all source files and dependencies with commands described before. It automatically selects the right dependencies based on your local Git branch or your Podfile local modifications. All you have to do is to go in the project root folder and run the script:

```
$ ./setup_project.sh
```

## Generate IPA

To build the IPA we are currently using [fastlane](https://fastlane.tools/).
Expand Down
30 changes: 30 additions & 0 deletions setup_project.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# Use this script to setup the Xcode project

# Remove existing project file if any
rm -r Riot.xcodeproj

# Create the xcodeproj with all project source files
xcodegen

# Use appropriated dependencies

# Check if Podfile changed in unstaged
git diff --exit-code --quiet --name-only Podfile
PODFILE_HAS_CHANGED_UNSTAGED=$?
# Check if Podfile changed in staged
git diff --staged --exit-code --quiet --name-only Podfile
PODFILE_HAS_CHANGED_STAGED=$?

# If Podfile has changed locally do not modify it
# otherwise use the appropriated dependencies according to the current branch
if [[ "$PODFILE_HAS_CHANGED_UNSTAGED" -eq 1 || "$PODFILE_HAS_CHANGED_STAGED" -eq 1 ]]; then
echo "Podfile has been changed locally do not modify it"
else
echo "Podfile has not been changed locally, use appropriated dependencies according to the current branch"
bundle exec fastlane point_dependencies_to_same_feature
fi

# Create the xcworkspace with all project dependencies
pod install

0 comments on commit 2815ef7

Please sign in to comment.