├── .gitignore ├── .gitattributes ├── src └── xcderiveddata.bash ├── Makefile ├── LICENSE.md └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | xcderiveddata 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | Makefile linguist-detectable=false 2 | -------------------------------------------------------------------------------- /src/xcderiveddata.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o pipefail 5 | set -o nounset 6 | 7 | if ! [ -x "$(command -v xcodebuild)" ]; then 8 | echo 'Error: xcodebuild is not installed.' >&2 9 | exit 1 10 | fi 11 | 12 | xcodebuild -showBuildSettings $@ | 13 | grep -m 1 "BUILD_DIR" | 14 | grep -oEi "\/.*" | 15 | sed 's#/Build/Products##' 16 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | SHELL = /bin/bash 2 | 3 | prefix ?= /usr/local 4 | bindir ?= $(prefix)/bin 5 | srcdir = src 6 | 7 | .DEFAULT_GOAL = all 8 | 9 | .PHONY: all 10 | all: xcderiveddata 11 | 12 | xcderiveddata: $(srcdir)/xcderiveddata.bash 13 | @cp $< $@ 14 | @chmod +x $@ 15 | 16 | .PHONY: install 17 | install: xcderiveddata 18 | @install -d "$(bindir)" 19 | @install xcderiveddata "$(bindir)" 20 | 21 | .PHONY: uninstall 22 | uninstall: 23 | @rm -rf "$(bindir)/xcderiveddata" 24 | 25 | .PHONY: clean 26 | clean: 27 | @rm -f xcderiveddata 28 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2019 Read Evaluate Press, LLC 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the "Software"), 5 | to deal in the Software without restriction, including without limitation 6 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 7 | and/or sell copies of the Software, and to permit persons to whom the 8 | Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 14 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 18 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19 | DEALINGS IN THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # xcderiveddata 2 | 3 | A command-line utility that prints the path of the derived data directory 4 | for the current Xcode project. 5 | 6 | ## Requirements 7 | 8 | - Xcode 9 | 10 | ## Command-Line Usage 11 | 12 | The `xcderiveddata` executable can be run from the command line 13 | from any directory with an Xcode project: 14 | 15 | ```terminal 16 | $ find . -name "*.xcodeproj" -maxdepth 1 17 | MyApp.xcodeproj 18 | 19 | $ xcderiveddata 20 | ~/Library/Developer/Xcode/DerivedData/MyApp-abcdefghijklmnopqr1234567890 21 | ``` 22 | 23 | Any additional arguments are passed to `xcodebuild`, 24 | which can be used to set the target, scheme, and any other other options 25 | for the specified project or workspace: 26 | 27 | ```terminal 28 | $ find . -name "*.xc*" -maxdepth 1 29 | MyApp.xcodeproj 30 | MyFramework.xcodeproj 31 | MyWorkspace.xcworkspace 32 | 33 | $ xcderiveddata -workspace MyWorkspace.xcworkspace \ 34 | -scheme MyFramework 35 | ~/Library/Developer/Xcode/DerivedData/MyFramework-abcdefghijklmnopqr1234567890 36 | ``` 37 | 38 | You can pipe the result of `xcderiveddata` into other commands 39 | to automate your build process. 40 | For example, 41 | here's how to locate any `xcresult` bundles generated by your test target: 42 | 43 | ```terminal 44 | $ xcderiveddata | xargs -I{} find {} -name '*.xcresult' 45 | ``` 46 | 47 | ### Installation 48 | 49 | #### Homebrew 50 | 51 | Run the following command to install using [homebrew](https://brew.sh/): 52 | 53 | ```terminal 54 | $ brew install nshipster/formulae/xcderiveddata 55 | ``` 56 | 57 | #### Manually 58 | 59 | Run the following commands to build and install manually: 60 | 61 | ```terminal 62 | $ git clone https://github.com/NSHipster/xcderiveddata.git 63 | $ cd xcderiveddata 64 | $ make install 65 | ``` 66 | 67 | ## License 68 | 69 | MIT 70 | 71 | ## Contact 72 | 73 | Mattt ([@mattt](https://twitter.com/mattt)) 74 | --------------------------------------------------------------------------------