New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Makefile #49
Add Makefile #49
Conversation
According to https://guides.cocoapods.org/making/using-pod-lib-create.html#deploying-your-library `pod spec lint` checks the external repo and associated tag, not the current state of the current commit, so it does not make sense to run this (unless we are going to push a new version)
This is in order to not force an Xcode version to run the code.
.scripts/prerequisites.sh
Outdated
|
||
if ! which xcodebuild >/dev/null; then | ||
echo "xcodebuild does not seem to be installed. You can install it by installing Xcode from the App Store." | ||
exit 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be more useful if we could exit only when we've run all the tests. We can print all the messages we want, and only exit in the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in a698e94
Makefile
Outdated
@@ -0,0 +1,44 @@ | |||
XCARGS := -workspace VelocidiSDK.xcworkspace \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please align these properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 6aaf770
Makefile
Outdated
all: clean build | ||
|
||
clean: | ||
set -o pipefail && xcodebuild $(XCARGS) -scheme VelocidiSDK clean | xcpretty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this clean the examples too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 3d01567
Makefile
Outdated
@@ -0,0 +1,44 @@ | |||
XCARGS := -workspace VelocidiSDK.xcworkspace \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add this file to the xcode group, so that it is visible inside the project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 323259f
Makefile
Outdated
|
||
oclint: | ||
set -o pipefail && \ | ||
xcodebuild -scheme VelocidiSDK -sdk iphoneos -workspace VelocidiSDK.xcworkspace clean && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we save a line here and do xcodebuild -scheme VelocidiSDK -sdk iphoneos -workspace VelocidiSDK.xcworkspace COMPILER_INDEX_STORE_ENABLE=NO clean build
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 6aaf770
prerequisites: | ||
.scripts/prerequisites.sh | ||
|
||
oclint: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've had some challenges running this.
pyenv: python3: command not found
The `python3' command exists in these Python versions:
3.7.9
Note: See 'pyenv help global' for tips on allowing both
python2 and python3 to be found.
make: *** [oclint] Error 127
dlopen(/usr/local/bin/../lib/oclint/rules/libTooManyMethodsRule.dylib, 1): no suitable image found. Did find:
/usr/local/bin/../lib/oclint/rules/libTooManyMethodsRule.dylib: code signature in (/usr/local/bin/../lib/oclint/rules/libTooManyMethodsRule.dylib) not valid for use in process using Library Validation: library load disallowed by system policy
oclint: error: cannot open dynamic library: /usr/local/bin/../lib/oclint/rules/libTooManyMethodsRule.dylib
make: *** [oclint] Error 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I ever had this problem. I tried uninstalling and installing oclint and I could not replicate this issue. I don't use pyenv
, so it might be related to that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regardless of pyenv
, I think python3
is required.
The second problem is not related to python.
prerequisites: | ||
.scripts/prerequisites.sh | ||
|
||
oclint: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this oclint run also for the examples?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a command for this in 3025b2c
exit 1 | ||
fi | ||
|
||
if ! which xcpretty >/dev/null; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tools are all mostly dead :(
The project seems mostly dead: xcpretty/xcpretty#360
Co-authored-by: André Cardoso <[email protected]>
Co-authored-by: André Cardoso <[email protected]>
Co-authored-by: André Cardoso <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #49 +/- ##
=======================================
Coverage 92.71% 92.71%
=======================================
Files 54 54
Lines 728 728
=======================================
Hits 675 675
Misses 53 53 Continue to review full report at Codecov.
|
Move clean instruction.
Makefile
Outdated
-destination "platform=iOS Simulator,OS=$(TEST_SDK),name=$(TEST_DEVICE)" \ | ||
GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES GCC_GENERATE_TEST_COVERAGE_FILES=YES CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | ||
|
||
all: clean build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I think that it is most common to have the default target be only the build phase. This allows one to take advantage of an incremental compilation while repeatedly calling make
.
clean
is normally called separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that makes more sense! Fixed in 173f363
Makefile
Outdated
build: | ||
set -o pipefail && xcodebuild $(XCARGS) -scheme VelocidiSDK build | xcpretty | ||
|
||
test: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the test
target depend on the build
target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Fixed in 173f363
pod install --project-directory=Examples/ | ||
|
||
build-objc-example: | ||
set -o pipefail && xcodebuild $(XCARGS) -scheme ObjcExample clean build | xcpretty |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't these examples depend on the install-examples
target?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 173f363
…'build'. 'build-...-examples' targets depend on 'install-examples'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine.
In the future, I think we should try to actually force the use of oclint
which is, right now, an optional step of the build. Unlike swiftlint
that runs as part of the compilation step, we don't force oclint
to run anywhere. It would be nice if we could make a better use of it even automate its recommendations.
We also have some other steps that might be integrated with the Makefile
, such as the documentation build and publishing steps.
Added a Makefile with the purpose of aggregating commonly used commands. Also added a
prerequisites
script and make command, to make it easier for someone new to bootstrap a new development system.I could have added some make commands related to publishing the pod/or documentation, but decided not to, as that is still a manual process and those commands would end up not being really useful on their own.
Also removed the
pod spec lint
from being executed in the tests. This command does not test the current commit, but rather the external repo and associated tag.