Skip to content

Commit

Permalink
Clean up Xcode 9 warnings and upgrade PINCache (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
garrettmoon authored Oct 9, 2017
1 parent 1d25184 commit 21bf2fe
Show file tree
Hide file tree
Showing 72 changed files with 1,635 additions and 1,163 deletions.
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
git "https://chromium.googlesource.com/webm/libwebp" "v0.6.0"
github "pinterest/PINCache" "3.0.1-beta.5"
github "pinterest/PINCache" "3.0.1-beta.6"
github "pinterest/PINOperation"
4 changes: 2 additions & 2 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
git "https://chromium.googlesource.com/webm/libwebp" "v0.6.0"
github "pinterest/PINCache" "3.0.1-beta.5"
github "pinterest/PINOperation" "1.0.3"
github "pinterest/PINCache" "3.0.1-beta.6"
github "pinterest/PINOperation" "1.1"
7 changes: 7 additions & 0 deletions Carthage/Checkouts/PINCache/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

* Add your own contributions to the next release on the line below this with your name.

## 3.0.1 -- Beta 6
- [fix] Add some sane limits to the disk cache: [#201]https://github.com/pinterest/PINCache/pull/201
- [new] Update enumeration methods to allow a stop flag to be flipped by caller: [#204](https://github.com/pinterest/PINCache/pull/204)
- [performance] Improves cache miss performance by ~2 orders of magnitude on device: [#202](https://github.com/pinterest/PINCache/pull/202)
- [performance] Significantly improve startup performance: [#203](https://github.com/pinterest/PINCache/pull/203)

## 3.0.1 -- Beta 5
- [fix] Respect small byteLimit settings by checking object size in setObject: [#198](https://github.com/pinterest/PINCache/pull/198)
- [new] Added an ability to set custom encoder/decoder for file names: [#192](https://github.com/pinterest/PINCache/pull/192)

## 2.2.1 -- 2016 Mar 5
Expand Down
1 change: 1 addition & 0 deletions Carthage/Checkouts/PINCache/CI/exclude-from-build.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
"^plans/",
"^docs/",
"^README.md$",
"^CI/exclude-from-build.json$"
]
2 changes: 1 addition & 1 deletion Carthage/Checkouts/PINCache/Cartfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "pinterest/PINOperation" == 1.0.3
github "pinterest/PINOperation" ~> 1.1.0
2 changes: 1 addition & 1 deletion Carthage/Checkouts/PINCache/Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1 +1 @@
github "pinterest/PINOperation" "1.0.3"
github "pinterest/PINOperation" "1.1"
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 1.0.0 -- 2017 January 10 ###
## master
* Add your own contributions to the next release on the line below this with your name.

## 1.1 -- 2017 October 7
* Deprecate addOperation: in favor of scheduleOperation: [garrett](https://github.com/garrettmoon)

## 1.0.0 -- 2017 January 10

- Initial release!
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -eo pipefail

make all
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
"^plans/",
"^docs/",
"^CI/exclude-from-build.json$"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
source_pattern = /(\.m|\.mm|\.h)$/

# Sometimes it's a README fix, or something like that - which isn't relevant for
# including in a project's CHANGELOG for example
declared_trivial = github.pr_title.include? "#trivial"
has_changes_in_source_directory = !git.modified_files.grep(/Source/).empty?

modified_source_files = git.modified_files.grep(source_pattern)
has_modified_source_files = !modified_source_files.empty?
added_source_files = git.added_files.grep(source_pattern)
has_added_source_files = !added_source_files.empty?

# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
warn("PR is classed as Work in Progress") if github.pr_title.include? "[WIP]"

# Warn when there is a big PR
warn("This is a big PR, please consider splitting it up to ease code review.") if git.lines_of_code > 500

# Changelog entries are required for changes to source files.
no_changelog_entry = !git.modified_files.include?("CHANGELOG.md")
if has_changes_in_source_directory && no_changelog_entry && !declared_trivial
warn("Any source code changes should have an entry in CHANGELOG.md or have #trivial in their title.")
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

gem 'danger'
gem 'danger-slack'
377 changes: 176 additions & 201 deletions Carthage/Checkouts/PINCache/Carthage/Checkouts/PINOperation/LICENSE.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'PINOperation'
s.version = '1.0.3'
s.version = '1.1'
s.homepage = 'https://github.com/pinterest/PINOperation'
s.summary = 'Fast, concurrency-limited task queue for iOS and OS X.'
s.authors = { 'Garrett Moon' => 'garrett@pinterest.com' }
Expand All @@ -9,7 +9,7 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.frameworks = 'Foundation'
s.ios.deployment_target = '5.0'
s.osx.deployment_target = '10.7'
s.osx.deployment_target = '10.8'
s.tvos.deployment_target = '9.0'
s.watchos.deployment_target = '2.0'
pch_PIN = <<-EOS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@
CC0105571E27116600890935 /* Tests */,
CC01052E1E27110D00890935 /* Products */,
);
indentWidth = 2;
sourceTree = "<group>";
tabWidth = 2;
usesTabs = 0;
};
CC01052E1E27110D00890935 /* Products */ = {
isa = PBXGroup;
Expand Down Expand Up @@ -335,7 +338,7 @@
CC0105241E27110D00890935 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0730;
LastUpgradeCheck = 0900;
ORGANIZATIONNAME = Pinterest;
TargetAttributes = {
CC01052C1E27110D00890935 = {
Expand Down Expand Up @@ -510,13 +513,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
Expand Down Expand Up @@ -558,13 +569,21 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
Expand Down Expand Up @@ -629,6 +648,7 @@
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand All @@ -649,6 +669,7 @@
isa = XCBuildConfiguration;
buildSettings = {
APPLICATION_EXTENSION_API_ONLY = YES;
"CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0820"
LastUpgradeVersion = "0900"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -26,6 +26,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
Expand Down Expand Up @@ -55,6 +56,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![CocoaPods](https://img.shields.io/cocoapods/v/PINOperation.svg)](http://cocoadocs.org/docsets/PINOperation/)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
[![Build status](https://badge.buildkite.com/03e247305c96c3371f2ff2766e9c8c1efdd5fdb3a7eceaff43.svg?branch=master&style=flat)](https://buildkite.com/pinterest/pinoperation)
[![Build status](https://badge.buildkite.com/665147e3b6852a9c1c3a3df3ced779c32bc6396ba69fee4b6e.svg?branch=master&style=flat)](https://buildkite.com/pinterest/pinoperation)

## Fast, concurrency-limited task queue for iOS and macOS.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ @interface PINOperationGroup ()
dispatch_group_t _group;

dispatch_block_t _completion;
dispatch_queue_t _completionQueue;

BOOL _started;
BOOL _canceled;
Expand Down Expand Up @@ -58,7 +57,7 @@ - (instancetype)initWithOperationQueue:(PINOperationQueue *)operationQueue

- (void)dealloc
{
pthread_mutex_destroy(&_lock);
pthread_mutex_destroy(&_lock);
}

+ (instancetype)asyncOperationGroupWithQueue:(PINOperationQueue *)operationQueue
Expand All @@ -85,22 +84,14 @@ - (void)start
dispatch_group_leave(_group);
};

id <PINOperationReference> operationReference = [_operationQueue addOperation:groupBlock withPriority:[_operationPriorities[idx] unsignedIntegerValue]];
id <PINOperationReference> operationReference = [_operationQueue scheduleOperation:groupBlock withPriority:[_operationPriorities[idx] unsignedIntegerValue]];
[_groupToOperationReferences setObject:operationReference forKey:_operationReferences[idx]];
}

if (_completion) {
dispatch_queue_t completionQueue = _completionQueue ? _completionQueue : dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_queue_t completionQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_group_notify(_group, completionQueue, ^{
dispatch_block_t completion;
[self lock];
completion = _completion;
_completion = nil;
[self unlock];

if (completion) {
completion();
}
[self runCompletionIfNeeded];
});
}

Expand Down Expand Up @@ -167,6 +158,20 @@ - (void)waitUntilComplete
{
[self start];
dispatch_group_wait(_group, DISPATCH_TIME_FOREVER);
[self runCompletionIfNeeded];
}

- (void)runCompletionIfNeeded
{
dispatch_block_t completion;
[self lock];
completion = _completion;
_completion = nil;
[self unlock];

if (completion) {
completion();
}
}

- (void)lock
Expand Down
Loading

0 comments on commit 21bf2fe

Please sign in to comment.