Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGabriel committed Sep 15, 2015
0 parents commit 08ea322
Show file tree
Hide file tree
Showing 65 changed files with 3,321 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Build and Release Folders
bin/
build/

# Other files and folders
.settings/

# Java class files
*.class
*.classpath

# Log Files
*.log

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# OS X
.DS_Store
.AppleDouble
.LSOverride

# Files that might appear on external disk
.Spotlight-V100
.Trashes

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.xcuserstate
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Heyzap

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# AdMob ANE

A thin wrapper around the [Unity Ads](https://unityads.unity3d.com/) Android and iOS SDK for use on Heyzap's mediation.

The latest release can be found in [Releases](https://github.com/Heyzap/unityads-ane/releases).

Pull requests and issues are welcome.

#### Unity Ads Versions
- iOS: 1.4.5
- Android: 1.45

#### Adding to your project

- Add the `UnityAds.ane` to your Adobe Flex Builder or Adobe Flash project.

- If not done automatically, add the follow extension context to your application descriptor:

```xml
<extensions>
<extensionID>com.heyzap.sdk.extensions.unityads</extensionID>
</extensions>
```

#### Updating Unity Ads
**For iOS**:
- Replace `UnityAds.framework` and `UnityAds.bundle` in `ios/Vendor` with a newer version.
- Update `ios/platform.xml` with any new iOS frameworks that the newer version might be dependent on. Built-in iOS SDK frameworks can be added within the _linkerOptions_ tag. Custom iOS frameworks can be added under the _packagedDependencies_ tag and their respective `.framework` directories can be added to `ios/Vendor`. Drag and drop these `.framework` directories into the `UnityAdsANE.xcodeproj` project in XCode under the _Vendor_ group.

**For Android**:
- Replace `unity-ads.jar` in `android/libs` with a newer version.
- Update `android/platform.xml` with any new android libraries that the newer version might be dependent on. Android libraries can be added under the _packagedDependencies_ tag. The actual `.jar` files can be added to the `andorid/libs` directory.

After making the necessary modifications, build the new ANE by following the [building](#building) instructions below.

#### Building

##### Requirements:
- Mac OS X
- XCode
- [Apache Ant](http://ant.apache.org/)
- [AIR SDK](http://www.adobe.com/devnet/air/air-sdk-download.html)

##### Building:
- Add the path to your AIR SDK in `build.config` (under `air.sdk`)
- From the root of the repository, run `ant`.

After build completes, the native extension will be in `bin/UnityAds.ane`.
5 changes: 5 additions & 0 deletions actionscript/build.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Where any source (.as) files for the ANE will be
src.dir = src

# This is where we'll store temporary build files
build.dir = ./build
59 changes: 59 additions & 0 deletions actionscript/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="AdMob ANE Actionscript Build Script" default="all">

<record name="build.log" loglevel="verbose" action="start" />

<!-- Config File -->
<property file="build.config"/>

<target name="build" description="Build Actionscript Library">
<!-- Get path of all actionscript classes -->
<fileset dir="${src.dir}" casesensitive="yes" id="classfiles">
<include name="**/*.as"/>
</fileset>

<!-- Convert class paths to class IDs -->
<pathconvert property="classlist" refid="classfiles" pathsep=" " dirsep=".">
<regexpmapper from=".*src.(.*)\.as" to="\1"/>
</pathconvert>

<mkdir dir="${build.dir}"/>

<!-- Compile create .swc -->
<exec executable="${air.sdk}/bin/compc" failonerror="true">
<arg line='-source-path ${src.dir}'/>
<arg line='-output ${build.dir}/actionscript.swc'/>
<arg line='-swf-version=14'/>
<arg line='-external-library-path+="${air.sdk}/frameworks/libs/air/airglobal.swc"'/>
<arg line='-include-classes ${classlist}'/>
</exec>

<mkdir dir="${build.dir}/content"/>

<!-- Unzip packaged .swc and copy over the library.swf -->
<unzip src="${build.dir}/actionscript.swc" dest="${build.dir}/content" overwrite="true"/>

<mkdir dir="${output.dir}"/>
<mkdir dir="${output.dir}/default"/>

<!-- Copy over files to ActionScript output directory -->
<copy todir="${output.dir}" failonerror="true">

<!-- Copy over compile .swc -->
<file file="${build.dir}/actionscript.swc" />

<!-- copy over library.swf from extracted swc -->
<file file="${build.dir}/content/library.swf" />

</copy>
</target>

<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${output.dir}" />
<delete file="build.log" />
</target>

<target name="all" depends="clean, build" />

</project>
7 changes: 7 additions & 0 deletions actionscript/src/com/heyzap/sdk/extensions/admob/Dummy.as
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.heyzap.sdk.extensions.admob {
import flash.events.EventDispatcher;

public class Dummy extends EventDispatcher {
//Nothing goes here.
}
}
16 changes: 16 additions & 0 deletions build.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Path to AIR SDK
air.sdk = /Applications/Adobe\ Flash\ Builder\ 4.7/sdks/AIR3.7_4.6.0

# Directories of the individual platform projects
# Each platform project must have an ant build script (i.e. 'build.xml')
# That will build the necessary (and only the necessary) files required by the master project
# to {PLATFORM_DIRECTORY}/${output.dir}
ios.dir = ./ios
actionscript.dir = ./actionscript

# Name of output directory where each platform will build their portion
# For example, the iOS platform build will be in ${ios.dir}/${output.dir}
# The ane will be in the output directory in the root folder (i.e. in ./${output_dir})
output.dir = ./bin

output.name = AdMob.ane
55 changes: 55 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="AdMob ANE Build Script" default="all">

<record name="build.log" loglevel="verbose" action="start" />

<!-- Config File -->
<property file="build.config"/>

<macrodef name="platforms" description="Run Ant on all Platforms">
<attribute name="target" default="all"/>

<sequential>
<subant inheritall="false" target="@{target}">
<property name="output.dir" value="${output.dir}" />
<property name="air.sdk" value="${air.sdk}" />
<fileset dir="." includes="*/build.xml"/>
</subant>
</sequential>
</macrodef>

<target name="build" description="Build on all platforms.">
<platforms target="build"/>
</target>

<target name="package" depends="build" description="Package ANE">
<mkdir dir="${output.dir}/" />

<!-- Copy over library.swf to each platform output -->
<copy file="${actionscript.dir}/${output.dir}/library.swf" todir="${ios.dir}/${output.dir}" failonerror="true" />
<copy file="${actionscript.dir}/${output.dir}/library.swf" todir="${actionscript.dir}/${output.dir}/default" failonerror="true" />

<!-- Compile ANE -->
<exec executable="${air.sdk}/bin/adt" failonerror="true">
<arg value="-package"/>
<arg value="-target"/>
<arg value="ane"/>
<arg value="${output.dir}/${output.name}"/>
<arg value="extension.xml"/>
<arg line="-swc ${actionscript.dir}/${output.dir}/actionscript.swc"/>
<arg line="-platform iPhone-ARM -C ${ios.dir}/${output.dir} ."/>
<arg line="-platform default -C ${actionscript.dir}/${output.dir}/default ."/>
</exec>
</target>

<target name="clean">
<delete dir="${output.dir}" />
<delete file="build.log" />

<!-- Run clean on all other platforms -->
<platforms target="clean" />
</target>

<target name="all" depends="clean, package" />

</project>
18 changes: 18 additions & 0 deletions extension.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<extension xmlns="http://ns.adobe.com/air/extension/4.0">
<id>com.heyzap.sdk.extensions.admob</id>
<versionNumber>1.0</versionNumber>

<platforms>
<platform name="iPhone-ARM">
<applicationDeployment>
<nativeLibrary>libAdMobANE.a</nativeLibrary>
<initializer>AdMobANEInitializer</initializer>
<finalizer>AdMobANEFinalizer</finalizer>
</applicationDeployment>
</platform>

<platform name="default">
<applicationDeployment />
</platform>
</platforms>
</extension>
Loading

0 comments on commit 08ea322

Please sign in to comment.