Skip to content
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

Merged
merged 19 commits into from Mar 31, 2021
Merged

Add Makefile #49

merged 19 commits into from Mar 31, 2021

Conversation

duartepinto
Copy link
Contributor

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.

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.

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
Copy link
Contributor

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.

Copy link
Contributor Author

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 \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please align these properly.

Copy link
Contributor Author

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 Show resolved Hide resolved
Makefile Outdated
all: clean build

clean:
set -o pipefail && xcodebuild $(XCARGS) -scheme VelocidiSDK clean | xcpretty
Copy link
Contributor

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?

Copy link
Contributor Author

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 Show resolved Hide resolved
Makefile Outdated
@@ -0,0 +1,44 @@
XCARGS := -workspace VelocidiSDK.xcworkspace \
Copy link
Contributor

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.

Copy link
Contributor Author

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 && \
Copy link
Contributor

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?

Copy link
Contributor Author

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:
Copy link
Contributor

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

Screenshot 2021-03-26 at 12 14 59

Copy link
Contributor Author

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.

Copy link
Contributor

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:
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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

duartepinto and others added 3 commits March 26, 2021 12:50
Co-authored-by: André Cardoso <[email protected]>
Co-authored-by: André Cardoso <[email protected]>
Co-authored-by: André Cardoso <[email protected]>
@codecov
Copy link

codecov bot commented Mar 26, 2021

Codecov Report

Merging #49 (173f363) into master (601faf8) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 601faf8...173f363. Read the comment docs.

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
Copy link
Contributor

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.

Copy link
Contributor Author

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:
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Copy link
Contributor Author

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'.
Copy link
Contributor

@thyandrecardoso thyandrecardoso left a 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.

@thyandrecardoso thyandrecardoso merged commit f4b1698 into master Mar 31, 2021
@thyandrecardoso thyandrecardoso deleted the makefile branch March 31, 2021 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants