-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildsdk.sh
executable file
·135 lines (110 loc) · 2.98 KB
/
buildsdk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Variables
OUTDIR=`pwd`/out
TMPOUTDIR=`pwd`/tmpout
AARPATH=build/outputs/aar
BASEDIR=`pwd`
MEDDIR=`pwd`/mediation/mediatedviews
MEDFORDIR=`pwd`/mediation/mediating
SDKDIR=`pwd`/sdk
COMBINE=$TMPOUTDIR/combine
# Adapters to include in AAR
# space after each item required
LIBS=""
LIBS+="mediation/mediatedviews/AdColony "
LIBS+="mediation/mediatedviews/AdMob "
LIBS+="mediation/mediatedviews/Amazon "
LIBS+="mediation/mediatedviews/Chartboost "
LIBS+="mediation/mediatedviews/Facebook "
LIBS+="mediation/mediatedviews/GooglePlay "
LIBS+="mediation/mediatedviews/InMobi "
LIBS+="mediation/mediatedviews/MillennialMedia "
LIBS+="mediation/mediatedviews/MoPub "
LIBS+="mediation/mediatedviews/InMobi "
LIBS+="mediation/mediatedviews/Vdopia "
LIBS+="mediation/mediatedviews/Vungle "
LIBS+="mediation/mediatedviews/Yahoo "
LIBS+="mediation/mediating/Google "
LIBS+="mediation/mediating/MoPub "
LIBS+="sdk "
# for moving mediation adapter aars
function moveaar {
NAME=${1//\//_}
echoX 'moving aar for' $NAME
cp $BASEDIR/$1/$AARPATH/*.aar $TMPOUTDIR/$NAME.aar
unzip $TMPOUTDIR/$NAME.aar -d $TMPOUTDIR/$NAME
(cd $COMBINE; jar xf $TMPOUTDIR/$NAME/classes.jar)
}
function echoX {
echo -e "BUILDSDKLOG: $@"
}
#####
# Execute
#####
echoX "Begin Building SDK AARs"
#####
# Prep
#####
rm -rf $OUTDIR
rm -rf $TMPOUTDIR
#####
# Build
#####
echoX "Building AN SDK"
# build AN SDK
gradle clean assembleRelease
echoX "Building AN Mediation Adapters"
# build Mediation adapters
cd $MEDDIR
gradle clean assembleRelease
echoX "Building Mediation Adapters for AN"
# build Mediated adapters
cd $MEDFORDIR
gradle clean assembleRelease
#####
# Copy AARs
#####
echoX "Copying AARs"
# Prep to move AARs
mkdir -p $COMBINE
mkdir -p $OUTDIR
# move aars
for i in $LIBS;
do
moveaar $i
done
# merge classes.jar files
echoX "Combining for classes.jar"
cd $COMBINE
jar cf $TMPOUTDIR/classes.jar com*
#####
# Package ANSDK.aar
####
echoX "packaging ANSDK.aar"
SDKAAR=$OUTDIR/ANSDKAAR
STAGE=$OUTDIR/ANSDK
mkdir -p $SDKAAR
mkdir -p $STAGE
unzip $SDKDIR/$AARPATH/sdk-release.aar -d $SDKAAR
cp -f $TMPOUTDIR/classes.jar $SDKAAR/classes.jar
mkdir -p $SDKAAR/libs
cp $MEDDIR/MillennialMedia/libs/*.jar $SDKAAR/libs
cd $SDKAAR
zip -r $STAGE/ANSDK.aar *
rm -rf $SDKAAR
##### README
echoX "Create README"
cd $STAGE
touch README.txt
echo -e "
The AppNexus Mobile Advertising SDK for Android
===============================================
Include ANSDK.aar in your project in order to receive AppNexus ads. ANSDK.aar includes the AppNexus SDK as well as all of the adapters that enable the AppNexus SDK to mediate supported third-party networks. Check the Documentation for a complete list of supported networks.
ANSDK.aar also contains adapters used by the Google or MoPub SDKs to mediate the AppNexus SDK.
Documentation is available on our wiki: https://wiki.appnexus.com/display/sdk/Mobile+SDKs.
" >> README.txt
##### zip ANSDK.aar + README.txt
echoX "zip ANSDK.zip"
zip -r $OUTDIR/ANSDK.zip .
# cleanup
rm -rf $TMPOUTDIR
echoX "End script"