Skip to content

Commit

Permalink
Adding shell project for I-Mobile adapter.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 240633450
  • Loading branch information
nomulam committed Mar 27, 2019
1 parent e7d58f4 commit 726a73e
Show file tree
Hide file tree
Showing 16 changed files with 755 additions and 0 deletions.
27 changes: 27 additions & 0 deletions adapters/I-Mobile/BuildScript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Steps to generate universal static library and framework

**Note:** These build scripts are intended only for publishers who want to
modify and rebuild the i-mobile adapter framework.

## Prerequisites
- Xcode 9.0 or higher
- Deployment target of 6.0 or higher
- Google Mobile Ads SDK
- i-mobile SDK

## Setup Instructions
- Drop GoogleMobileAds framework to
Project Directory->Drop_Framework_And_Headers.
- Drop i-mobile 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/I-Mobile/BuildScript/Script_Framework.sh
Original file line number Diff line number Diff line change
@@ -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/I-Mobile/BuildScript/Script_Library.sh
Original file line number Diff line number Diff line change
@@ -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/I-Mobile/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# i-mobile Mediation Adapter for Google Mobile Ads SDK for iOS

## Version x.y.z.a
- Under development
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "GoogleMobileAdsMediationIMobile",
"version": "x.y.z.a",
"summary": "i-mobile adapter used for mediation with the Google Mobile Ads SDK",
"description": "The Google Mobile Ads SDK is the latest generation in Google mobile advertising featuring refined ad formats and streamlined APIs for access to mobile ad networks and advertising solutions. Google Mobile Ads Mediation helps maximize your fill rate and increase your monetization by sending ad requests to multiple networks to ensure you find the best available network to serve ads. This adapter enables you to use Google Mobile Ads Mediation to request ads from the I-mobile.",
"homepage": "https://developers.google.com/admob/ios/mediation/i-mobile",
"license": {
"type": "Apache 2.0",
"text": "Copyright 2019 Google Inc."
},
"authors": "Google Inc.",
"platforms": {
"ios": "9.0"
},
"vendored_frameworks": [
"IMobileAdapter-x.y.z.a/IMobileAdapter.framework"
],
"dependencies": {
"IMobile": "x.y.z",
"Google-Mobile-Ads-SDK": ">= 7.41.0"
},
"preserve_paths": [
"IMobileAdapter-x.y.z.a/README.md"
],
"requires_arc": true,
"source": {
"http": "https://google.bintray.com/mobile-ads-adapters-ios/IMobileAdapter/x.y.z.a/IMobileAdapter-x.y.z.a.zip"
}
}
55 changes: 55 additions & 0 deletions adapters/I-Mobile/Configuration/Adapter.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
// Adapter.xcconfig
// Adapter
//

/// Third Party AD Network Name.
AD_NETWORK_NAME = IMobile
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 = 6
MIN_OS_MINOR_VERSION = 0
MIN_OS_MAJOR_VERSION_64_BIT = 7
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/I-Mobile/Configuration/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Debug.xcconfig
// IMobileAdapter
//
4 changes: 4 additions & 0 deletions adapters/I-Mobile/Configuration/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
//
// Release.xcconfig
// IMobileAdapter
//
2 changes: 2 additions & 0 deletions adapters/I-Mobile/Drop_Framework_And_Headers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Drop all necessary frameworks in this folder. Don’t link them to any target in
Xcode project.
Loading

0 comments on commit 726a73e

Please sign in to comment.