22* Gradle file to build a Unity package to add AppLovin mediation support to the Google Mobile Ads Unity plugin.
33* Usage: ./gradlew exportPackage
44*/
5+ plugins {
6+ id " com.jfrog.bintray" version " 1.7.3"
7+ }
58
69defaultTasks ' exportPackage'
710
@@ -20,10 +23,15 @@ project.ext {
2023 ' UNITY_EXE environment variable and point it to your Unity installation.' )
2124 }
2225
26+ versionString = ' 1.0.0'
27+ pluginName = ' GoogleMobileAdsAppLovinMediation'
28+ pluginFileName = " ${ pluginName} .unitypackage"
29+ zipName = " ${ pluginName} -${ versionString} "
30+ zipFileName = " ${ zipName} .zip"
2331 pluginSource = file(' source/plugin' ). absolutePath
2432 pluginBuildDir = file(' temp/plugin-build-dir' ). absolutePath
2533 buildPath = file(' temp' ). absolutePath
26- exportPath = file(' GoogleMobileAdsAppLovinMediation.unitypackage ' ). absolutePath
34+ exportPath = file(pluginFileName ). absolutePath
2735}
2836
2937// Build unity package using through command line interface.
@@ -37,7 +45,7 @@ task exportPackage(type: Exec) {
3745 " -projectPath" , " ${ pluginBuildDir} " ,
3846 " -logFile" , " temp/unity.log" ,
3947 " -exportPackage" ,
40- " Assets/GoogleMobileAds/Editor " ,
48+ " Assets/GoogleMobileAds" ,
4149 " Assets/Plugins" ,
4250 " ${ exportPath} " ,
4351 " -quit"
@@ -66,3 +74,72 @@ task clearTempBuildFolder(type: Delete) {
6674
6775exportPackage. dependsOn(createTempBuildFolder)
6876exportPackage. finalizedBy(clearTempBuildFolder)
77+
78+ /**
79+ * Delete task to delete any previously generated .zip files by makeZip task.
80+ * makeZip depends on this task.
81+ */
82+ task clearZip (type : Delete ) {
83+ // Targets to be deleted.
84+ delete(zipFileName)
85+ }
86+
87+ /**
88+ * Zip task to make a zip archive. This task depends on exportPackage and clearZip tasks.
89+ */
90+ task makeZip (type : Zip ) {
91+ // Targets to be added to the zip archive.
92+ from(" ./${ pluginFileName} " , " ./README.md" , " ./CHANGELOG.md" )
93+ // Root directory name for the zip archive.
94+ into(zipName)
95+ // Name of the zip archive.
96+ archiveName zipFileName
97+ // Destination directory in which the archive needs to be saved.
98+ destinationDir file(' .' )
99+ }
100+
101+ makeZip. dependsOn([clearZip, exportPackage])
102+ makeZip. mustRunAfter([clearZip, exportPackage])
103+
104+ /**
105+ * Bintray closure needed to run the bintrayUpload task.
106+ *
107+ * Usage:
108+ * ./gradlew bintrayUpload -PbintrayUser=YOUR_BINTRAY_USER_ID -PbintrayApiKey=YOUR_BINTRAY_API_KEY
109+ *
110+ * The Bintray User ID and API key can be added to your system environment variables as BINTRAY_USER
111+ * and BINTRAY_API_KEY respectively, and the command can be reduced to:
112+ * ./gradlew bintrayUpload
113+ */
114+ bintray {
115+ user = project. hasProperty(' bintrayUser' ) ? project. property(' bintrayUser' )
116+ : System . getenv(' BINTRAY_USER' )
117+ key = project. hasProperty(' bintrayApiKey' ) ? project. property(' bintrayApiKey' )
118+ : System . getenv(' BINTRAY_API_KEY' )
119+
120+ filesSpec { // 'filesSpec' is a standard Gradle CopySpec
121+ from zipFileName
122+ into " ${ pluginName} /${ versionString} "
123+ }
124+ dryRun = false // Deploy after running.
125+ publish = false // Don't auto publish after deploying.
126+ override = false // Don't override existing version artifacts that are already published.
127+
128+ pkg {
129+ repo = ' mobile-ads-adapters-unity'
130+ name = pluginName
131+ userOrg = ' google'
132+ desc = ' AppLovin plugin for Google Mobile Ads Mediation.'
133+ websiteUrl = ' https://developers.google.com/admob/unity/mediation/applovin'
134+ issueTrackerUrl = ' https://github.com/googleads/googleads-mobile-unity/issues'
135+ vcsUrl = ' https://github.com/googleads/googleads-mobile-unity'
136+ licenses = [' Apache-2.0' ]
137+
138+ version {
139+ name = versionString
140+ }
141+ }
142+ }
143+
144+ bintrayUpload. dependsOn(makeZip)
145+ bintrayUpload. mustRunAfter(makeZip)
0 commit comments