[general] moving ios and android project under ./platform folder
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<?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>BenchmarkAppTests</key>
|
||||
<dict>
|
||||
<key>BlueprintName</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>BundleIdentifiersForCrashReportEmphasis</key>
|
||||
<array>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<string>com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
<key>CommandLineArguments</key>
|
||||
<array/>
|
||||
<key>DependentProductPaths</key>
|
||||
<array>
|
||||
<string>__TESTROOT__/Debug-iphoneos/BenchmarkApp.app</string>
|
||||
<string>__TESTROOT__/Debug-iphoneos/BenchmarkApp.app/PlugIns/BenchmarkAppTests.xctest</string>
|
||||
</array>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>OS_ACTIVITY_DT_MODE</key>
|
||||
<string>YES</string>
|
||||
<key>SQLITE_ENABLE_THREAD_ASSERTIONS</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
<key>IsAppHostedTestBundle</key>
|
||||
<true/>
|
||||
<key>ProductModuleName</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>RunOrder</key>
|
||||
<integer>0</integer>
|
||||
<key>SystemAttachmentLifetime</key>
|
||||
<string>deleteOnSuccess</string>
|
||||
<key>TestBundlePath</key>
|
||||
<string>__TESTHOST__/PlugIns/BenchmarkAppTests.xctest</string>
|
||||
<key>TestHostBundleIdentifier</key>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<key>TestHostPath</key>
|
||||
<string>__TESTROOT__/Debug-iphoneos/BenchmarkApp.app</string>
|
||||
<key>TestLanguage</key>
|
||||
<string></string>
|
||||
<key>TestRegion</key>
|
||||
<string></string>
|
||||
<key>TestingEnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>DYLD_FALLBACK_FRAMEWORK_PATH</key>
|
||||
<string></string>
|
||||
<key>DYLD_INSERT_LIBRARIES</key>
|
||||
<string>__PLATFORMS__/iPhoneOS.platform/Developer/usr/lib/libXCTestBundleInject.dylib</string>
|
||||
<key>XCInjectBundleInto</key>
|
||||
<string>unused</string>
|
||||
</dict>
|
||||
<key>ToolchainsSettingValue</key>
|
||||
<array/>
|
||||
<key>UITargetAppCommandLineArguments</key>
|
||||
<array/>
|
||||
<key>UserAttachmentLifetime</key>
|
||||
<string>deleteOnSuccess</string>
|
||||
</dict>
|
||||
<key>__xctestrun_metadata__</key>
|
||||
<dict>
|
||||
<key>FormatVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,68 @@
|
||||
<?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>BenchmarkAppTests</key>
|
||||
<dict>
|
||||
<key>BlueprintName</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>BundleIdentifiersForCrashReportEmphasis</key>
|
||||
<array>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<string>com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
<key>CommandLineArguments</key>
|
||||
<array/>
|
||||
<key>DependentProductPaths</key>
|
||||
<array>
|
||||
<string>__TESTROOT__/Release-iphoneos/BenchmarkApp.app</string>
|
||||
<string>__TESTROOT__/Release-iphoneos/BenchmarkApp.app/PlugIns/BenchmarkAppTests.xctest</string>
|
||||
</array>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>OS_ACTIVITY_DT_MODE</key>
|
||||
<string>YES</string>
|
||||
<key>SQLITE_ENABLE_THREAD_ASSERTIONS</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
<key>IsAppHostedTestBundle</key>
|
||||
<true/>
|
||||
<key>ProductModuleName</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>RunOrder</key>
|
||||
<integer>0</integer>
|
||||
<key>SystemAttachmentLifetime</key>
|
||||
<string>deleteOnSuccess</string>
|
||||
<key>TestBundlePath</key>
|
||||
<string>__TESTHOST__/PlugIns/BenchmarkAppTests.xctest</string>
|
||||
<key>TestHostBundleIdentifier</key>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<key>TestHostPath</key>
|
||||
<string>__TESTROOT__/Release-iphoneos/BenchmarkApp.app</string>
|
||||
<key>TestLanguage</key>
|
||||
<string></string>
|
||||
<key>TestRegion</key>
|
||||
<string></string>
|
||||
<key>TestingEnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>DYLD_FALLBACK_FRAMEWORK_PATH</key>
|
||||
<string></string>
|
||||
<key>DYLD_INSERT_LIBRARIES</key>
|
||||
<string>__PLATFORMS__/iPhoneOS.platform/Developer/usr/lib/libXCTestBundleInject.dylib</string>
|
||||
<key>XCInjectBundleInto</key>
|
||||
<string>unused</string>
|
||||
</dict>
|
||||
<key>ToolchainsSettingValue</key>
|
||||
<array/>
|
||||
<key>UITargetAppCommandLineArguments</key>
|
||||
<array/>
|
||||
<key>UserAttachmentLifetime</key>
|
||||
<string>deleteOnSuccess</string>
|
||||
</dict>
|
||||
<key>__xctestrun_metadata__</key>
|
||||
<dict>
|
||||
<key>FormatVersion</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
62
benchmark/ios/Info.plist
Normal file
62
benchmark/ios/Info.plist
Normal file
@@ -0,0 +1,62 @@
|
||||
<?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>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>BenchmarkApp</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleLongVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>com.mapbox.BenchmarkApp</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>MBGL</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>7877</string>
|
||||
<key>CSResourcesFileMapped</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>© 2014–2020 Mapbox</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>fetch</string>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
7
benchmark/ios/README.md
Normal file
7
benchmark/ios/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# iOS BenchmarkRunner App
|
||||
|
||||
This is a blank single-view-controller iOS app, linked against to a C++ static libraries, plus a a simple unit xctest. We use CMake to create an Xcode-friendly out-of-source build system. In another word, the build system is maintained by `CMakeLists` file,instead of a configured `.xcodeproj` file.
|
||||
|
||||
This CMake project can build the executable BenchmarkApp which is linked to the static C++ library 'mbgl-benchmark'. CMakeLists.txt files are the only build configuration kept in source control. This is in contrast to committing the `.xcodeproj` directory which includes the backing XML, which is nonsensically hard to edit by hand.
|
||||
|
||||
The test instantiates ObjC object of class `IosTestRunner` from the app, the class will instantiates a C++ object from the linked library `mbgl-benchmark` and calls running benchmark function on it. It subsequently deletes the C++ object pointer. In the end, the test will check the existence of test report, which is a json file that attach to xctest result.
|
||||
16
benchmark/ios/codesigning/BenchmarkApp.app.xcent.template
Normal file
16
benchmark/ios/codesigning/BenchmarkApp.app.xcent.template
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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>application-identifier</key>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkApp</string>
|
||||
<key>com.apple.developer.team-identifier</key>
|
||||
<string>$TEAM_ID</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkApp</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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>application-identifier</key>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
<key>com.apple.developer.team-identifier</key>
|
||||
<string>$TEAM_ID</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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>application-identifier</key>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
<key>com.apple.developer.team-identifier</key>
|
||||
<string>$TEAM_ID</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
16
benchmark/ios/codesigning/XCTest.framework.xcent.template
Normal file
16
benchmark/ios/codesigning/XCTest.framework.xcent.template
Normal file
@@ -0,0 +1,16 @@
|
||||
<?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>application-identifier</key>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
<key>com.apple.developer.team-identifier</key>
|
||||
<string>$TEAM_ID</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
11
benchmark/ios/codesigning/codesign_all.sh
Executable file
11
benchmark/ios/codesigning/codesign_all.sh
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
identity=$(/usr/bin/env xcrun security find-identity -v -p codesigning)
|
||||
var=${identity#*1)\ }
|
||||
CODE_SIGN_IDENTITY=${var%\ \"Apple\ Development*}
|
||||
|
||||
codesign --force --sign $CODE_SIGN_IDENTITY --entitlements codesigning/BenchmarkApp.app.xcent --timestamp=none ./Release-iphoneos/BenchmarkApp.app
|
||||
codesign --force --sign $CODE_SIGN_IDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/BenchmarkApp.app/Frameworks/libXCTestSwiftSupport.dylib
|
||||
codesign --force --sign $CODE_SIGN_IDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/BenchmarkApp.app/Frameworks/libXCTestBundleInject.dylib
|
||||
codesign --force --sign $CODE_SIGN_IDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/BenchmarkApp.app/Frameworks/XCTAutomationSupport.framework
|
||||
codesign --force --sign $CODE_SIGN_IDENTITY --deep --preserve-metadata=identifier,entitlements,flags --timestamp=none ./Release-iphoneos/BenchmarkApp.app/Frameworks/XCTest.framework
|
||||
codesign --force --sign $CODE_SIGN_IDENTITY --deep --entitlements codesigning/BenchmarkAppTests.xctest.xcent --timestamp=none ./Release-iphoneos/BenchmarkApp.app/PlugIns/BenchmarkAppTests.xctest
|
||||
40
benchmark/ios/codesigning/generate-entitlements.swift
Executable file
40
benchmark/ios/codesigning/generate-entitlements.swift
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/swift
|
||||
|
||||
/// Generates Entitlement files .xcent for codesigning, containing the correct team id
|
||||
import Swift
|
||||
import Foundation
|
||||
|
||||
let fileManager = FileManager.default
|
||||
|
||||
let contentsOfCurrentWorkingDirectory = try FileManager.default.contentsOfDirectory(at: URL(fileURLWithPath: "./codesigning/"), includingPropertiesForKeys: nil, options: [])
|
||||
|
||||
guard let rawTeamIdEnv = getenv("IOS_DEVELOPMENT_TEAM") else {
|
||||
print("Please add a IOS_DEVELOPMENT_TEAM environment variable.")
|
||||
exit(1)
|
||||
}
|
||||
|
||||
let teamId2 = String(utf8String: rawTeamIdEnv)
|
||||
|
||||
for file in contentsOfCurrentWorkingDirectory {
|
||||
if (file.pathExtension == "template") {
|
||||
var content = ""
|
||||
do {
|
||||
content = try String(contentsOf: file, encoding: .utf8)
|
||||
}
|
||||
catch {
|
||||
print("Error reading xcent file: \(error).")
|
||||
}
|
||||
|
||||
content = content.replacingOccurrences(of: "$TEAM_ID", with: teamId2!)
|
||||
|
||||
var targetFile = file
|
||||
targetFile.deletePathExtension()
|
||||
do {
|
||||
try content.write(to: targetFile, atomically: false, encoding: .utf8)
|
||||
print("Entitlement " + targetFile.absoluteString + " generated.")
|
||||
}
|
||||
catch {
|
||||
print("Error writing xcent file: \(error).")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?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>application-identifier</key>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
<key>com.apple.developer.team-identifier</key>
|
||||
<string>$TEAM_ID</string>
|
||||
<key>get-task-allow</key>
|
||||
<true/>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>$TEAM_ID.com.mapbox.BenchmarkAppTests</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
3
benchmark/ios/fastlane/Appfile
Normal file
3
benchmark/ios/fastlane/Appfile
Normal file
@@ -0,0 +1,3 @@
|
||||
app_identifier("com.mapbox.BenchmarkApp") # The bundle identifier of your app
|
||||
apple_id ENV['MAPBOX_APPLE_ID']
|
||||
team_id ENV['MAPBOX_APPLE_TEAM_ID'] # Developer Portal Team ID
|
||||
5
benchmark/ios/fastlane/Matchfile
Normal file
5
benchmark/ios/fastlane/Matchfile
Normal file
@@ -0,0 +1,5 @@
|
||||
git_url("git@github.com:mapbox/apple-certificates.git")
|
||||
type("development") # The default type, can be: appstore, adhoc, enterprise or development
|
||||
app_identifier(["com.mapbox.BenchmarkApp", "com.mapbox.BenchmarkAppTests"])
|
||||
username ENV['MAPBOX_APPLE_ID']
|
||||
keychain_name("fastlane_keychain")
|
||||
12
benchmark/ios/iosTestRunner.h
Normal file
12
benchmark/ios/iosTestRunner.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NSString *dataDir = @"benchmark-data";
|
||||
NSString *resultFilePath = @"benchmark/results.json";
|
||||
|
||||
__attribute__((visibility ("default")))
|
||||
@interface IosTestRunner : NSObject
|
||||
|
||||
- (NSString*) getResultPath;
|
||||
- (BOOL) getTestStatus;
|
||||
|
||||
@end
|
||||
34
benchmark/ios/ios_test_runner.cpp
Normal file
34
benchmark/ios/ios_test_runner.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <ios_test_runner.hpp>
|
||||
|
||||
#include <mbgl/benchmark.hpp>
|
||||
|
||||
#include <mbgl/util/logging.hpp>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
|
||||
#define EXPORT __attribute__((visibility("default")))
|
||||
|
||||
EXPORT
|
||||
bool TestRunner::startTest(const std::string& basePath) {
|
||||
std::vector<std::string> arguments = {"mbgl-benchmark-runner",
|
||||
"--benchmark_repetitions=10",
|
||||
"--benchmark_format=json",
|
||||
"--benchmark_out=" + basePath + "/benchmark/results.json"};
|
||||
std::vector<char*> argv;
|
||||
for (const auto& arg : arguments) {
|
||||
argv.push_back(const_cast<char*>(arg.data()));
|
||||
}
|
||||
argv.push_back(nullptr);
|
||||
|
||||
if (chdir(basePath.c_str())) {
|
||||
mbgl::Log::Error(mbgl::Event::General, "Failed to change the directory to " + basePath);
|
||||
return false;
|
||||
}
|
||||
|
||||
mbgl::Log::Info(mbgl::Event::General, "Start BenchmarkRunner");
|
||||
int status = mbgl::runBenchmark(static_cast<uint32_t>(argv.size()), argv.data());
|
||||
mbgl::Log::Info(mbgl::Event::General, "BenchmarkRunner finished with status: '%d'", status);
|
||||
|
||||
return status == 0;
|
||||
}
|
||||
22
benchmark/ios/tests/Info.plist
Normal file
22
benchmark/ios/tests/Info.plist
Normal file
@@ -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>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.mapbox.BenchmarkAppTests</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>BenchmarkAppTests</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user