Skip to content

Commit

Permalink
Merge pull request #482 from onato/master
Browse files Browse the repository at this point in the history
Extract the framework target binaries from the CodeCoverageTargets.
  • Loading branch information
ksuther authored Apr 25, 2021
2 parents 91a8b29 + ff5d79f commit 9f35596
Show file tree
Hide file tree
Showing 11 changed files with 385 additions and 9 deletions.
13 changes: 13 additions & 0 deletions lib/slather/project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,19 @@ def find_binary_files
def find_buildable_names(xcscheme)
found_buildable_names = []

# enumerate code coverage targets
begin
code_coverage_targets = xcscheme.test_action.xml_element.elements['CodeCoverageTargets']
targets = code_coverage_targets.map do |node|
Xcodeproj::XCScheme::BuildableReference.new(node) if node.is_a?(REXML::Element)
end.compact
buildable_names = targets.each do |target|
found_buildable_names.push(target.buildable_name)
end
rescue
# just in case if there are no entries in the test action
end

# enumerate build action entries
begin
xcscheme.build_action.entries.each do |entry|
Expand Down
19 changes: 19 additions & 0 deletions spec/fixtures/FixtureFramework/FixtureFramework.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// FixtureFramework.h
// FixtureFramework
//
// Created by Stephen Williams on 11/03/21.
// Copyright © 2021 marklarr. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for FixtureFramework.
FOUNDATION_EXPORT double FixtureFrameworkVersionNumber;

//! Project version string for FixtureFramework.
FOUNDATION_EXPORT const unsigned char FixtureFrameworkVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <FixtureFramework/PublicHeader.h>


7 changes: 7 additions & 0 deletions spec/fixtures/FixtureFramework/FlashExperiment.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Foundation

public struct FlashExperiment {
public let isAwesome = true

public init() {}
}
24 changes: 24 additions & 0 deletions spec/fixtures/FixtureFramework/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2021 marklarr. All rights reserved.</string>
</dict>
</plist>
34 changes: 34 additions & 0 deletions spec/fixtures/FixtureFrameworkTests/FixtureFrameworkTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// FixtureFrameworkTests.swift
// FixtureFrameworkTests
//
// Created by Stephen Williams on 11/03/21.
// Copyright © 2021 marklarr. All rights reserved.
//

import XCTest
@testable import FixtureFramework

class FixtureFrameworkTests: XCTestCase {

override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDownWithError() throws {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}

func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}

func testPerformanceExample() throws {
// This is an example of a performance test case.
self.measure {
// Put the code you want to measure the time of here.
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import XCTest
import FixtureFramework

class FlashExperimentTests: XCTestCase {
func testExample() throws {
let sut = FlashExperiment()
XCTAssertTrue(sut.isAwesome, "Your flash experiment isn't awesome!")
}
}
22 changes: 22 additions & 0 deletions spec/fixtures/FixtureFrameworkTests/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
Loading

0 comments on commit 9f35596

Please sign in to comment.