Skip to content

Commit

Permalink
Version 3.11.1 of the Google Mobile Ads Unity plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rampara committed Feb 12, 2018
1 parent f2caa5a commit e7d0995
Show file tree
Hide file tree
Showing 34 changed files with 977 additions and 11 deletions.
16 changes: 16 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
Google Mobile Ads Unity Plugin Change Log

**************
Version 3.11.1
**************

Plugin:
- Fixed issue where calling GetWidthInPixels() or GetHeightInPixels() resulted
in a null pointer exception.

Mediation packages:
- Added Facebook mediation support package.

Built and tested with:
- Google Play services 11.8.0
- Google Mobile Ads iOS SDK 7.28.0
- Unity Jar Resolver 1.2.61.0

**************
Version 3.11.0
**************
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
7 changes: 7 additions & 0 deletions mediation/AdColony/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# AdColony Adapter plugin for Google Mobile Ads SDK for Unity 3D Changelog

## 1.0.0

- First release!
- Supports Android adapter version 3.3.0.0.
- Supports iOS adapter version 3.3.0.0.
6 changes: 6 additions & 0 deletions mediation/AdColony/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# AdColony Adapter plugin for Google Mobile Ads SDK for Unity 3D

This is a plugin to be used in conjunction with the Google Mobile Ads SDK in
Google Play services. For requirements, instructions, and other info, see the
[AdColony Adapter Integration Guide](https://developers.google.com/admob/unity/mediation/adcolony).

105 changes: 103 additions & 2 deletions mediation/AdColony/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
* Gradle file to build a Unity package to add AdColony mediation support to the Google Mobile Ads Unity plugin.
* Usage: ./gradlew exportPackage
*/
plugins {
id "com.jfrog.bintray" version "1.7.3"
}

defaultTasks 'exportPackage'

Expand All @@ -20,12 +23,40 @@ project.ext {
'UNITY_EXE environment variable and point it to your Unity installation.')
}

versionString = '1.0.0'
pluginName = 'GoogleMobileAdsAdColonyMediation'
pluginFileName = "${pluginName}.unitypackage"
zipName = "${pluginName}-${versionString}"
zipFileName = "${zipName}.zip"
pluginSource = file('source/plugin').absolutePath
pluginBuildDir = file('temp/plugin-build-dir').absolutePath
buildPath = file('temp').absolutePath
exportPath = file('GoogleMobileAdsAdColonyMediation.unitypackage').absolutePath
exportPath = file(pluginFileName).absolutePath
}

// Build jar from android plugin source files using existing Gradle build file.
task buildAndroidPluginJar(type: GradleBuild) {
buildFile = 'source/android-library/adcolony/build.gradle'
tasks = ['build']
}

// Move android plugin jar to temporary build directory.
task copyAndroidLibraryJar(type: Copy) {
from("source/android-library/adcolony/build/intermediates/bundles/release/")
into("${pluginBuildDir}/Assets/Plugins/Android/")
include('classes.jar')
rename('classes.jar', 'adcolony-extras-library.jar')
}

// Copy Unity mediation extras interface to temporary build directory.
task copyExtrasInterface(type: Copy) {
from("../../source/plugin/Assets/GoogleMobileAds/Api/Mediation/")
into("${pluginBuildDir}/Assets/GoogleMobileAds/Api/Mediation/")
include('MediationExtras.cs')
}

copyAndroidLibraryJar.dependsOn(buildAndroidPluginJar)

// Build unity package using through command line interface.
// Create new unity project with files in temporary build directory and export files to a unity package.
// Command line usage and arguments documented at http://docs.unity3d.com/Manual/CommandLineArguments.html.
Expand All @@ -37,6 +68,7 @@ task exportPackage(type: Exec) {
"-projectPath", "${pluginBuildDir}",
"-logFile", "temp/unity.log",
"-exportPackage",
"Assets/GoogleMobileAds/Api/Mediation/AdColony",
"Assets/GoogleMobileAds/Editor",
"Assets/Plugins",
"${exportPath}",
Expand Down Expand Up @@ -64,5 +96,74 @@ task clearTempBuildFolder(type: Delete) {
delete { "${buildPath}" }
}

exportPackage.dependsOn(createTempBuildFolder)
exportPackage.dependsOn(createTempBuildFolder, copyAndroidLibraryJar, copyExtrasInterface)
exportPackage.finalizedBy(clearTempBuildFolder)

/**
* Delete task to delete any previously generated .zip files by makeZip task.
* makeZip depends on this task.
*/
task clearZip(type: Delete) {
// Targets to be deleted.
delete(zipFileName)
}

/**
* Zip task to make a zip archive. This task depends on exportPackage and clearZip tasks.
*/
task makeZip(type: Zip) {
// Targets to be added to the zip archive.
from("./${pluginFileName}", "./README.md", "./CHANGELOG.md")
// Root directory name for the zip archive.
into(zipName)
// Name of the zip archive.
archiveName zipFileName
// Destination directory in which the archive needs to be saved.
destinationDir file('.')
}

makeZip.dependsOn([clearZip, exportPackage])
makeZip.mustRunAfter([clearZip, exportPackage])

/**
* Bintray closure needed to run the bintrayUpload task.
*
* Usage:
* ./gradlew bintrayUpload -PbintrayUser=YOUR_BINTRAY_USER_ID -PbintrayApiKey=YOUR_BINTRAY_API_KEY
*
* The Bintray User ID and API key can be added to your system environment variables as BINTRAY_USER
* and BINTRAY_API_KEY respectively, and the command can be reduced to:
* ./gradlew bintrayUpload
*/
bintray {
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser')
: System.getenv('BINTRAY_USER')
key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey')
: System.getenv('BINTRAY_API_KEY')

filesSpec { // 'filesSpec' is a standard Gradle CopySpec
from zipFileName
into "${pluginName}/${versionString}"
}
dryRun = false // Deploy after running.
publish = false // Don't auto publish after deploying.
override = false // Don't override existing version artifacts that are already published.

pkg {
repo = 'mobile-ads-adapters-unity'
name = pluginName
userOrg = 'google'
desc = 'AdColony plugin for Google Mobile Ads Mediation.'
websiteUrl = 'https://developers.google.com/admob/unity/mediation/adcolony'
issueTrackerUrl = 'https://github.com/googleads/googleads-mobile-unity/issues'
vcsUrl = 'https://github.com/googleads/googleads-mobile-unity'
licenses = ['Apache-2.0']

version {
name = versionString
}
}
}

bintrayUpload.dependsOn(makeZip)
bintrayUpload.mustRunAfter(makeZip)
6 changes: 6 additions & 0 deletions mediation/AdColony/source/android-library/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
40 changes: 40 additions & 0 deletions mediation/AdColony/source/android-library/adcolony/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 26

defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

lintOptions {
abortOnError false
}
}

dependencies {
api project(':app')
api 'com.google.ads.mediation:adcolony:3.3.0.0'
}

task clearJar(type: Delete) {
delete 'build/libs/adcolony-extras-library.jar'
}

task makeJar(type: Copy) {
from('build/intermediates/bundles/release/')
into('build/libs/')
include('classes.jar')
rename('classes.jar', 'adcolony-extras-library.jar')
}

makeJar.dependsOn(clearJar, build)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/rampara/Library/Android/sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This Google Mobile Ads plugin library manifest will get merged with your
application's manifest, adding the necessary activity and permissions
required for displaying ads.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.unity.mediation.adcolony">
</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.google.unity.mediation.adcolony;

import android.os.Bundle;

import com.google.unity.ads.AdNetworkExtras;
import com.jirbo.adcolony.AdColonyAdapter;
import com.jirbo.adcolony.AdColonyBundleBuilder;

import java.util.HashMap;

/**
* Mediation extras bundle class for the AdColony adapter.
*/
public abstract class AdColonyUnityExtrasBuilder implements AdNetworkExtras {

/**
* Key to obtain Zone ID.
*/
private static final String KEY_ZONE_ID = "zone_id";

/**
* Key to obtain User ID.
*/
private static final String KEY_USER_ID = "user_id";

/**
* Key to obtain the "show pre popup" option.
*/
private static final String KEY_SHOW_PRE_POPUP = "show_pre_popup";

/**
* Key to obtain the "show post popup" option.
*/
private static final String KEY_SHOW_POST_POPUP = "show_post_popup";

/**
* Key to obtain test mode option.
*/
private static final String KEY_TEST_MODE = "test_mode";

@Override
public Bundle buildExtras(HashMap<String, String> extras) {
String zoneId = extras.get(KEY_ZONE_ID);
if (zoneId != null) {
AdColonyBundleBuilder.setZoneId(zoneId);
}

String userId = extras.get(KEY_USER_ID);
if (userId != null) {
AdColonyBundleBuilder.setUserId(userId);
}

String showPrePopup = extras.get(KEY_SHOW_PRE_POPUP);
if (showPrePopup != null) {
AdColonyBundleBuilder.setShowPostPopup(Boolean.valueOf(showPrePopup));
}

String showPostPopup = extras.get(KEY_SHOW_POST_POPUP);
if (showPostPopup != null) {
AdColonyBundleBuilder.setShowPostPopup(Boolean.valueOf(showPostPopup));
}

String testMode = extras.get(KEY_TEST_MODE);
if (testMode != null) {
AdColonyBundleBuilder.setTestModeEnabled(Boolean.valueOf(testMode));
}

return AdColonyBundleBuilder.build();
}

@Override
public Class getAdapterClass() {
return AdColonyAdapter.class;
}
}

21 changes: 21 additions & 0 deletions mediation/AdColony/source/android-library/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#Thu Nov 02 14:27:25 PDT 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
Loading

0 comments on commit e7d0995

Please sign in to comment.