mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-25 19:01:41 +01:00
Merge branch 'develop' into throwables
This commit is contained in:
28
.travis.yml
28
.travis.yml
@@ -1,5 +1,5 @@
|
|||||||
language: objective-c
|
language: objective-c
|
||||||
osx_image: xcode9
|
osx_image: xcode10
|
||||||
sudo: false
|
sudo: false
|
||||||
git:
|
git:
|
||||||
submodules: false
|
submodules: false
|
||||||
@@ -10,17 +10,17 @@ env:
|
|||||||
- LC_CTYPE=en_US.UTF-8
|
- LC_CTYPE=en_US.UTF-8
|
||||||
- LANG=en_US.UTF-8
|
- LANG=en_US.UTF-8
|
||||||
matrix:
|
matrix:
|
||||||
- DESTINATION="OS=11.0,name=iPhone 8" SCHEME="CoreStore iOS" SDK=iphonesimulator11.0 RUN_TESTS="YES" POD_LINT="NO"
|
- DESTINATION="arch=x86_64" SCHEME="CoreStore OSX" SDK=macosx10.14 RUN_TESTS="YES" POD_LINT="NO"
|
||||||
- DESTINATION="OS=10.3,name=iPhone 7" SCHEME="CoreStore iOS" SDK=iphonesimulator11.0 RUN_TESTS="YES" POD_LINT="NO"
|
- DESTINATION="OS=12.0,name=iPhone XS" SCHEME="CoreStore iOS" SDK=iphonesimulator12.0 RUN_TESTS="YES" POD_LINT="NO"
|
||||||
- DESTINATION="OS=10.1,name=iPhone 7" SCHEME="CoreStore iOS" SDK=iphonesimulator11.0 RUN_TESTS="YES" POD_LINT="NO"
|
- DESTINATION="OS=11.0.1,name=iPhone 8" SCHEME="CoreStore iOS" SDK=iphonesimulator12.0 RUN_TESTS="YES" POD_LINT="NO"
|
||||||
- DESTINATION="OS=9.0,name=iPhone 6 Plus" SCHEME="CoreStore iOS" SDK=iphonesimulator11.0 RUN_TESTS="YES" POD_LINT="NO"
|
- DESTINATION="OS=10.3.1,name=iPhone 7" SCHEME="CoreStore iOS" SDK=iphonesimulator12.0 RUN_TESTS="YES" POD_LINT="NO"
|
||||||
- DESTINATION="arch=x86_64" SCHEME="CoreStore OSX" SDK=macosx10.13 RUN_TESTS="YES" POD_LINT="NO"
|
- DESTINATION="OS=10.1,name=iPhone 7" SCHEME="CoreStore iOS" SDK=iphonesimulator12.0 RUN_TESTS="YES" POD_LINT="NO"
|
||||||
- DESTINATION="OS=4.0,name=Apple Watch - 42mm" SCHEME="CoreStore watchOS" SDK=watchsimulator4.0 RUN_TESTS="NO" POD_LINT="NO"
|
- DESTINATION="OS=4.0,name=Apple Watch - 42mm" SCHEME="CoreStore watchOS" SDK=watchsimulator5.0 RUN_TESTS="NO" POD_LINT="NO"
|
||||||
- DESTINATION="OS=3.2,name=Apple Watch - 42mm" SCHEME="CoreStore watchOS" SDK=watchsimulator4.0 RUN_TESTS="NO" POD_LINT="NO"
|
- DESTINATION="OS=3.2,name=Apple Watch - 42mm" SCHEME="CoreStore watchOS" SDK=watchsimulator5.0 RUN_TESTS="NO" POD_LINT="NO"
|
||||||
- DESTINATION="OS=2.2,name=Apple Watch - 42mm" SCHEME="CoreStore watchOS" SDK=watchsimulator4.0 RUN_TESTS="NO" POD_LINT="NO"
|
- DESTINATION="OS=2.2,name=Apple Watch - 42mm" SCHEME="CoreStore watchOS" SDK=watchsimulator5.0 RUN_TESTS="NO" POD_LINT="NO"
|
||||||
- DESTINATION="OS=11.0,name=Apple TV 1080p" SCHEME="CoreStore tvOS" SDK=appletvsimulator11.0 RUN_TESTS="YES" POD_LINT="NO"
|
- DESTINATION="OS=12.0,name=Apple TV 4K" SCHEME="CoreStore tvOS" SDK=appletvsimulator12.0 RUN_TESTS="YES" POD_LINT="NO"
|
||||||
- DESTINATION="OS=10.2,name=Apple TV 1080p" SCHEME="CoreStore tvOS" SDK=appletvsimulator11.0 RUN_TESTS="YES" POD_LINT="NO"
|
- DESTINATION="OS=11.0,name=Apple TV 4K (at 1080p)" SCHEME="CoreStore tvOS" SDK=appletvsimulator12.0 RUN_TESTS="YES" POD_LINT="NO"
|
||||||
- DESTINATION="OS=9.2,name=Apple TV 1080p" SCHEME="CoreStore tvOS" SDK=appletvsimulator11.0 RUN_TESTS="YES" POD_LINT="NO"
|
- DESTINATION="OS=10.2,name=Apple TV 1080p" SCHEME="CoreStore tvOS" SDK=appletvsimulator12.0 RUN_TESTS="YES" POD_LINT="NO"
|
||||||
before_install:
|
before_install:
|
||||||
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
|
- gem install cocoapods --no-rdoc --no-ri --no-document --quiet
|
||||||
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
|
- gem install xcpretty --no-rdoc --no-ri --no-document --quiet
|
||||||
@@ -39,8 +39,8 @@ script:
|
|||||||
xcodebuild -workspace CoreStore.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
|
xcodebuild -workspace CoreStore.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
|
||||||
xcodebuild -workspace CoreStore.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
|
xcodebuild -workspace CoreStore.xcworkspace -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Release ONLY_ACTIVE_ARCH=NO clean test | xcpretty -c;
|
||||||
fi
|
fi
|
||||||
- xcodebuild -workspace "CoreStore.xcworkspace" -scheme "CoreStoreDemo" -sdk "iphonesimulator11.0" -destination "OS=11.0,name=iPhone 8" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
|
- xcodebuild -workspace "CoreStore.xcworkspace" -scheme "CoreStoreDemo" -sdk "iphonesimulator12.0" -destination "OS=11.0.1,name=iPhone 8" -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
|
||||||
- xcodebuild -workspace "CoreStore.xcworkspace" -scheme "CoreStoreDemo" -sdk "iphonesimulator11.0" -destination "OS=11.0,name=iPhone 8" -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
|
- xcodebuild -workspace "CoreStore.xcworkspace" -scheme "CoreStoreDemo" -sdk "iphonesimulator12.0" -destination "OS=11.0.1,name=iPhone 8" -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
|
||||||
- if [ $POD_LINT == "YES" ]; then
|
- if [ $POD_LINT == "YES" ]; then
|
||||||
pod lib lint --quick;
|
pod lib lint --quick;
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
|
|||||||
|
|
||||||
// MARK: Equatable
|
// MARK: Equatable
|
||||||
|
|
||||||
public static func == (lhs: CustomMapping, rhs: CustomMapping) -> Bool {
|
public static func ==(lhs: CustomMapping, rhs: CustomMapping) -> Bool {
|
||||||
|
|
||||||
switch (lhs, rhs) {
|
switch (lhs, rhs) {
|
||||||
|
|
||||||
@@ -324,7 +324,7 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
|
|||||||
|
|
||||||
// MARK: Equatable
|
// MARK: Equatable
|
||||||
|
|
||||||
public static func == (lhs: CustomSchemaMappingProvider, rhs: CustomSchemaMappingProvider) -> Bool {
|
public static func ==(lhs: CustomSchemaMappingProvider, rhs: CustomSchemaMappingProvider) -> Bool {
|
||||||
|
|
||||||
return lhs.sourceVersion == rhs.sourceVersion
|
return lhs.sourceVersion == rhs.sourceVersion
|
||||||
&& lhs.destinationVersion == rhs.destinationVersion
|
&& lhs.destinationVersion == rhs.destinationVersion
|
||||||
@@ -422,8 +422,8 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
|
|||||||
entityMapping.sourceExpression = expression(forSource: sourceEntity)
|
entityMapping.sourceExpression = expression(forSource: sourceEntity)
|
||||||
entityMapping.attributeMappings = autoreleasepool { () -> [NSPropertyMapping] in
|
entityMapping.attributeMappings = autoreleasepool { () -> [NSPropertyMapping] in
|
||||||
|
|
||||||
let sourceAttributes = sourceEntity.cs_resolvedAttributeRenamingIdentities()
|
let sourceAttributes = sourceEntity.cs_resolveAttributeNames()
|
||||||
let destinationAttributes = destinationEntity.cs_resolvedAttributeRenamingIdentities()
|
let destinationAttributes = destinationEntity.cs_resolveAttributeRenamingIdentities()
|
||||||
|
|
||||||
var attributeMappings: [NSPropertyMapping] = []
|
var attributeMappings: [NSPropertyMapping] = []
|
||||||
for (renamingIdentifier, destination) in destinationAttributes {
|
for (renamingIdentifier, destination) in destinationAttributes {
|
||||||
@@ -439,8 +439,8 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
|
|||||||
}
|
}
|
||||||
entityMapping.relationshipMappings = autoreleasepool { () -> [NSPropertyMapping] in
|
entityMapping.relationshipMappings = autoreleasepool { () -> [NSPropertyMapping] in
|
||||||
|
|
||||||
let sourceRelationships = sourceEntity.cs_resolvedRelationshipRenamingIdentities()
|
let sourceRelationships = sourceEntity.cs_resolveRelationshipNames()
|
||||||
let destinationRelationships = destinationEntity.cs_resolvedRelationshipRenamingIdentities()
|
let destinationRelationships = destinationEntity.cs_resolveRelationshipRenamingIdentities()
|
||||||
var relationshipMappings: [NSPropertyMapping] = []
|
var relationshipMappings: [NSPropertyMapping] = []
|
||||||
for (renamingIdentifier, destination) in destinationRelationships {
|
for (renamingIdentifier, destination) in destinationRelationships {
|
||||||
|
|
||||||
@@ -476,8 +476,8 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
|
|||||||
]
|
]
|
||||||
autoreleasepool {
|
autoreleasepool {
|
||||||
|
|
||||||
let sourceAttributes = sourceEntity.cs_resolvedAttributeRenamingIdentities()
|
let sourceAttributes = sourceEntity.cs_resolveAttributeNames()
|
||||||
let destinationAttributes = destinationEntity.cs_resolvedAttributeRenamingIdentities()
|
let destinationAttributes = destinationEntity.cs_resolveAttributeRenamingIdentities()
|
||||||
|
|
||||||
let transformedRenamingIdentifiers = Set(destinationAttributes.keys)
|
let transformedRenamingIdentifiers = Set(destinationAttributes.keys)
|
||||||
.intersection(sourceAttributes.keys)
|
.intersection(sourceAttributes.keys)
|
||||||
@@ -493,8 +493,8 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
|
|||||||
}
|
}
|
||||||
entityMapping.relationshipMappings = autoreleasepool { () -> [NSPropertyMapping] in
|
entityMapping.relationshipMappings = autoreleasepool { () -> [NSPropertyMapping] in
|
||||||
|
|
||||||
let sourceRelationships = sourceEntity.cs_resolvedRelationshipRenamingIdentities()
|
let sourceRelationships = sourceEntity.cs_resolveRelationshipNames()
|
||||||
let destinationRelationships = destinationEntity.cs_resolvedRelationshipRenamingIdentities()
|
let destinationRelationships = destinationEntity.cs_resolveRelationshipRenamingIdentities()
|
||||||
let transformedRenamingIdentifiers = Set(destinationRelationships.keys)
|
let transformedRenamingIdentifiers = Set(destinationRelationships.keys)
|
||||||
.intersection(sourceRelationships.keys)
|
.intersection(sourceRelationships.keys)
|
||||||
|
|
||||||
@@ -593,9 +593,9 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
|
|||||||
var allMappedSourceKeys: [KeyPathString: KeyPathString] = [:]
|
var allMappedSourceKeys: [KeyPathString: KeyPathString] = [:]
|
||||||
var allMappedDestinationKeys: [KeyPathString: KeyPathString] = [:]
|
var allMappedDestinationKeys: [KeyPathString: KeyPathString] = [:]
|
||||||
|
|
||||||
let sourceRenamingIdentifiers = sourceModel.cs_resolvedRenamingIdentities()
|
let sourceRenamingIdentifiers = sourceModel.cs_resolveNames()
|
||||||
let sourceEntityNames = sourceModel.entitiesByName
|
let sourceEntityNames = sourceModel.entitiesByName
|
||||||
let destinationRenamingIdentifiers = destinationModel.cs_resolvedRenamingIdentities()
|
let destinationRenamingIdentifiers = destinationModel.cs_resolveRenamingIdentities()
|
||||||
let destinationEntityNames = destinationModel.entitiesByName
|
let destinationEntityNames = destinationModel.entitiesByName
|
||||||
|
|
||||||
let removedRenamingIdentifiers = Set(sourceRenamingIdentifiers.keys)
|
let removedRenamingIdentifiers = Set(sourceRenamingIdentifiers.keys)
|
||||||
@@ -699,8 +699,7 @@ public class CustomSchemaMappingProvider: Hashable, SchemaMappingProvider {
|
|||||||
destinationEntity: destinationEntityName
|
destinationEntity: destinationEntityName
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
transformMappings.insert(
|
transformMappings.insert(
|
||||||
.transformEntity(
|
.transformEntity(
|
||||||
|
|||||||
@@ -32,24 +32,30 @@ import Foundation
|
|||||||
internal extension NSEntityDescription {
|
internal extension NSEntityDescription {
|
||||||
|
|
||||||
@nonobjc
|
@nonobjc
|
||||||
internal func cs_resolvedAttributeRenamingIdentities() -> [String: (attribute: NSAttributeDescription, versionHash: Data)] {
|
internal func cs_resolveAttributeNames() -> [String: (attribute: NSAttributeDescription, versionHash: Data)] {
|
||||||
|
return self.attributesByName.reduce(into: [:], { (result, attribute: (name: String, description: NSAttributeDescription)) in
|
||||||
var mapping: [String: (attribute: NSAttributeDescription, versionHash: Data)] = [:]
|
result[attribute.name] = (attribute.description, attribute.description.versionHash)
|
||||||
for (attributeName, attributeDescription) in self.attributesByName {
|
})
|
||||||
|
|
||||||
mapping[attributeDescription.renamingIdentifier ?? attributeName] = (attributeDescription, attributeDescription.versionHash)
|
|
||||||
}
|
|
||||||
return mapping
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@nonobjc
|
@nonobjc
|
||||||
internal func cs_resolvedRelationshipRenamingIdentities() -> [String: (relationship: NSRelationshipDescription, versionHash: Data)] {
|
internal func cs_resolveAttributeRenamingIdentities() -> [String: (attribute: NSAttributeDescription, versionHash: Data)] {
|
||||||
|
return self.attributesByName.reduce(into: [:], { (result, attribute: (name: String, description: NSAttributeDescription)) in
|
||||||
|
result[attribute.description.renamingIdentifier ?? attribute.name] = (attribute.description, attribute.description.versionHash)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var mapping: [String: (relationship: NSRelationshipDescription, versionHash: Data)] = [:]
|
@nonobjc
|
||||||
for (relationshipName, relationshipDescription) in self.relationshipsByName {
|
internal func cs_resolveRelationshipNames() -> [String: (relationship: NSRelationshipDescription, versionHash: Data)] {
|
||||||
|
return self.relationshipsByName.reduce(into: [:], { (result, relationship: (name: String, description: NSRelationshipDescription)) in
|
||||||
|
result[relationship.name] = (relationship.description, relationship.description.versionHash)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
mapping[relationshipDescription.renamingIdentifier ?? relationshipName] = (relationshipDescription, relationshipDescription.versionHash)
|
@nonobjc
|
||||||
}
|
internal func cs_resolveRelationshipRenamingIdentities() -> [String: (relationship: NSRelationshipDescription, versionHash: Data)] {
|
||||||
return mapping
|
return self.relationshipsByName.reduce(into: [:], { (result, relationship: (name: String, description: NSRelationshipDescription)) in
|
||||||
|
result[relationship.description.renamingIdentifier ?? relationship.name] = (relationship.description, relationship.description.versionHash)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,13 +32,16 @@ import Foundation
|
|||||||
internal extension NSManagedObjectModel {
|
internal extension NSManagedObjectModel {
|
||||||
|
|
||||||
@nonobjc
|
@nonobjc
|
||||||
internal func cs_resolvedRenamingIdentities() -> [String: (entity: NSEntityDescription, versionHash: Data)] {
|
internal func cs_resolveNames() -> [String: (entity: NSEntityDescription, versionHash: Data)] {
|
||||||
|
return self.entitiesByName.reduce(into: [:], { (result, entity: (name: String, description: NSEntityDescription)) in
|
||||||
|
result[entity.name] = (entity.description, entity.description.versionHash)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var mapping: [String: (entity: NSEntityDescription, versionHash: Data)] = [:]
|
@nonobjc
|
||||||
for (entityName, entityDescription) in self.entitiesByName {
|
internal func cs_resolveRenamingIdentities() -> [String: (entity: NSEntityDescription, versionHash: Data)] {
|
||||||
|
return self.entitiesByName.reduce(into: [:], { (result, entity: (name: String, description: NSEntityDescription)) in
|
||||||
mapping[entityDescription.renamingIdentifier ?? entityName] = (entityDescription, entityDescription.versionHash)
|
result[entity.description.renamingIdentifier ?? entity.name] = (entity.description, entity.description.versionHash)
|
||||||
}
|
})
|
||||||
return mapping
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user