Skip to content

Commit

Permalink
Project import generated by Copybara.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 238687426
  • Loading branch information
Mobile Ads Developer Relations authored and Samuel Stow committed Mar 18, 2019
1 parent 089ed1b commit 0c5901c
Show file tree
Hide file tree
Showing 17 changed files with 723 additions and 1 deletion.
30 changes: 30 additions & 0 deletions adapters/Mobfox/BuildScript/README.md
@@ -0,0 +1,30 @@
# Steps to generate universal static library and framework

**Note:** These build scripts are intended only for publishers who want to
modify and rebuild the MobFox adapter framework. If you just want to use the
MobFox adapter, simply add `pod 'GoogleMobileAdsMediationMobFox'` to
your Podfile and run `pod install --repo-update`.

## Prerequisites
- Xcode 9.0 or higher
- Deployment target of 9.0 or higher
- Google Mobile Ads SDK
- MobFox SDK
- MobFox Adapter Source Code

## Setup Instructions
- Drop GoogleMobileAds framework to
Project Directory->Drop_Framework_And_Headers.
- Drop MobFox framework to
Project Directory->Drop_Framework_And_Headers.

## Build Instructions
- To build a static library, select target scheme (FatAdapter). Edit scheme to
Release OR Build.
- Clean and Run/Archive.
- To build a framework, select target scheme (Framework). Edit scheme to
Release OR Build.
- Clean and Run/Archive.

**Note:** New adapter file and/or framework will be generated in your
Project Directory->Library folder.
50 changes: 50 additions & 0 deletions adapters/Mobfox/BuildScript/Script_Framework.sh
@@ -0,0 +1,50 @@
#!/bin/bash
# Combine iOS Device and Simulator libraries for the various architectures
# into a single framework.

# Remove build directories if exist.
if [ -d "${BUILT_PRODUCTS_DIR}" ]; then
rm -rf "${BUILT_PRODUCTS_DIR}"
fi

# Remove framework if exists.
if [ -d "${OUTPUT_FOLDER}/${FRAMEWORK_NAME}.framework" ]; then
rm -rf "${OUTPUT_FOLDER}/${FRAMEWORK_NAME}.framework"
fi

# Create output directory.
mkdir -p "${OUTPUT_FOLDER}"

# Export framework at path.
export FRAMEWORK_LOCATION="${BUILT_PRODUCTS_DIR}/${FRAMEWORK_NAME}.framework"

# Create the path to the real framework headers.
mkdir -p "${FRAMEWORK_LOCATION}/Versions/A/Headers"

# Create the required symlinks.
/bin/ln -sfh A "${FRAMEWORK_LOCATION}/Versions/Current"
/bin/ln -sfh Versions/Current/Headers "${FRAMEWORK_LOCATION}/Headers"
/bin/ln -sfh "Versions/Current/${FRAMEWORK_NAME}" \
"${FRAMEWORK_LOCATION}/${FRAMEWORK_NAME}"

# Build static library for iOS Device.
xcodebuild -target Adapter ONLY_ACTIVE_ARCH=NO -configuration "${CONFIGURATION}" clean build -sdk "iphoneos" ARCHS="armv7 arm64" BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" OBJROOT="${OBJROOT}" SYMROOT="${SYMROOT}" "${ACTION}" -UseModernBuildSystem=0

# Build static library for iOS Simulator.
xcodebuild -target Adapter ONLY_ACTIVE_ARCH=NO -configuration "${CONFIGURATION}" clean build -sdk "iphonesimulator" ARCHS="i386 x86_64" BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" OBJROOT="${OBJROOT}" SYMROOT="${SYMROOT}" "${ACTION}" -UseModernBuildSystem=0

# Create universal framework using lipo.
lipo -create "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${LIB_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${LIB_NAME}.a" -output "${FRAMEWORK_LOCATION}/Versions/A/${FRAMEWORK_NAME}"

# Copy the public headers into the framework.
/bin/cp -a "${TARGET_BUILD_DIR}/${PUBLIC_HEADERS_FOLDER_PATH}/" \
"${FRAMEWORK_LOCATION}/Versions/A/Headers"

# Copy the framework to the library directory.
ditto "${FRAMEWORK_LOCATION}" "${OUTPUT_FOLDER}/${FRAMEWORK_NAME}.framework"

# Create Modules directory.
mkdir -p "${OUTPUT_FOLDER}/${FRAMEWORK_NAME}.framework/Modules"

# Copy the module map to modules directory.
/bin/cp -a "${MODULE_MAP_PATH}/module.modulemap" "${OUTPUT_FOLDER}/${FRAMEWORK_NAME}.framework/Modules/module.modulemap"
18 changes: 18 additions & 0 deletions adapters/Mobfox/BuildScript/Script_Library.sh
@@ -0,0 +1,18 @@
#!/bin/bash
# Combine iOS Device and Simulator libraries for the various architectures
# into a single fat library.


# Create output directory if it doesn't exist.
if [ ! -d "${OUTPUT_FOLDER}" ]; then
mkdir -p "${OUTPUT_FOLDER}"
fi

# Step 1. Build static library for iOS Device.
xcodebuild -target Adapter ONLY_ACTIVE_ARCH=NO -configuration "${CONFIGURATION}" clean build -sdk "iphoneos" ARCHS="armv7 arm64" BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" OBJROOT="${OBJROOT}" SYMROOT="${SYMROOT}" "${ACTION}" -UseModernBuildSystem=0

# Step 2. Build static library for iOS Simulator.
xcodebuild -target Adapter ONLY_ACTIVE_ARCH=NO -configuration "${CONFIGURATION}" clean build -sdk "iphonesimulator" ARCHS="i386 x86_64" BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" OBJROOT="${OBJROOT}" SYMROOT="${SYMROOT}" "${ACTION}" -UseModernBuildSystem=0

# Step 3. Create universal fat library using lipo.
lipo -create "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${LIB_NAME}.a" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${LIB_NAME}.a" -output "${OUTPUT_FOLDER}/${FAT_LIBRARY_NAME}.a"
4 changes: 4 additions & 0 deletions adapters/Mobfox/CHANGELOG.md
@@ -0,0 +1,4 @@
# MobFox Mediation Adapter for Google Mobile Ads SDK for iOS

## Version 1.0.0
- Initial release.
55 changes: 55 additions & 0 deletions adapters/Mobfox/Configuration/Adapter.xcconfig
@@ -0,0 +1,55 @@
//
// Adapter.xcconfig
// Adapter
//

/// Third Party AD Network Name.
AD_NETWORK_NAME = MobFox
FRAMEWORK_NAME = $(AD_NETWORK_NAME)Adapter

/// Xcode variables
PRODUCT_NAME = Adapter
EXECUTABLE_PREFIX = lib

/// User defined variables.
LIB_NAME = $(EXECUTABLE_PREFIX)$(PRODUCT_NAME)
FAT_LIBRARY_NAME = $(LIB_NAME)$(AD_NETWORK_NAME)

OUTPUT_FOLDER = ${PROJECT_DIR}/Library

MIN_OS_MAJOR_VERSION = 9
MIN_OS_MINOR_VERSION = 0
MIN_OS_MAJOR_VERSION_64_BIT = 9
MIN_OS_MINOR_VERSION_64_BIT = 0

/// Xcode variables
/// General Build settings.
IPHONEOS_DEPLOYMENT_TARGET = $(MIN_OS_MAJOR_VERSION).$(MIN_OS_MINOR_VERSION)
IPHONEOS_DEPLOYMENT_TARGET[arch=arm64] = $(MIN_OS_MAJOR_VERSION_64_BIT).$(MIN_OS_MINOR_VERSION_64_BIT)
IPHONEOS_DEPLOYMENT_TARGET[arch=x86_64] = $(MIN_OS_MAJOR_VERSION_64_BIT).$(MIN_OS_MINOR_VERSION_64_BIT)
MODULE_MAP_PATH = $(SRCROOT)/Public
PUBLIC_HEADERS_FOLDER_PATH = "$(SRCROOT)/Public/**"
FRAMEWORK_SEARCH_PATHS = $(inherited) "$(SRCROOT)/Drop_Framework_And_Headers/**"
LIBRARY_SEARCH_PATHS = $(inherited) "$(SRCROOT)/Drop_Framework_And_Headers/**"
HEADER_SEARCH_PATHS = $(inherited) "$(SRCROOT)/Drop_Framework_And_Headers/**"
SDKROOT = iphoneos
SUPPORTED_PLATFORMS = iphoneos iphonesimulator
ONLY_ACTIVE_ARCH = NO
VALID_ARCHS = arm64 armv7 i386 x86_64
TARGETED_DEVICE_FAMILY = 1,2
BITCODE_GENERATION_MODE = bitcode
ENABLE_BITCODE = YES
CLANG_ENABLE_MODULES = YES
CLANG_ENABLE_OBJC_ARC = YES
GCC_WARN_UNDECLARED_SELECTOR = YES
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
ALWAYS_SEARCH_USER_PATHS = NO
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES
GCC_WARN_UNUSED_VARIABLE = YES
GCC_WARN_ABOUT_RETURN_TYPE = YES
PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES
SEPARATE_STRIP = YES
STRIP_INSTALLED_PRODUCT = YES
DEAD_CODE_STRIPPING = YES
4 changes: 4 additions & 0 deletions adapters/Mobfox/Configuration/Debug.xcconfig
@@ -0,0 +1,4 @@
//
// Debug.xcconfig
// MobFoxAdapter
//
4 changes: 4 additions & 0 deletions adapters/Mobfox/Configuration/Release.xcconfig
@@ -0,0 +1,4 @@
//
// Release.xcconfig
// MobFoxAdapter
//
1 change: 1 addition & 0 deletions adapters/Mobfox/Drop_Framework_And_Headers/README.md
@@ -0,0 +1 @@
Drop all necessary frameworks in this folder. Don’t link them to any target in Xcode project.
1 change: 1 addition & 0 deletions adapters/Mobfox/Library/README.md
@@ -0,0 +1 @@
Static library and Framework will be generated in this folder.

0 comments on commit 0c5901c

Please sign in to comment.