1- apply plugin : ' com.android.library'
2- apply plugin : ' com.jfrog.bintray'
3- apply plugin : ' com.github.dcendents.android-maven'
4- apply plugin : ' jacoco'
5-
6- ext {
7- bintrayRepo = " UnityAds"
8- bintrayName = " unityads"
9-
10- publishedGroupId = ' com.unity3d.ads'
11- libraryName = ' unity-ads'
12- artifact = ' unity-ads'
13- archivesBaseName = ' unity-ads'
1+ import com.android.ddmlib.DdmPreferences
142
15- libraryDescription = ' Monetize your entire player base and reach new audiences with video ads.'
16-
17- siteUrl = ' https://github.com/Unity-Technologies/unity-ads-android'
18- gitUrl = ' https://github.com/Unity-Technologies/unity-ads-android.git'
19-
20- libraryVersion = ' 3.7.1'
3+ apply plugin : ' com.android.library'
214
22- developerId = ' sbankhead'
23- developerName = ' Steven Bankhead'
24- developerEmail = ' sbankhead@unity3d.com'
5+ Properties properties = new Properties ()
6+ if (project. rootProject. file(' local.properties' ). exists()) {
7+ properties. load(project. rootProject. file(' local.properties' ). newDataInputStream())
8+ }
259
26- licenseName = ' Unity Ads License'
27- licenseUrl = ' https://unity3d.com/legal/monetization-services-terms-of-service'
28- allLicenses = [" Unity Ads License" ]
10+ dependencies {
11+ testImplementation ' junit:junit:4.12'
12+ androidTestImplementation ' org.mockito:mockito-core:2.25.0'
13+ androidTestImplementation ' org.mockito:mockito-android:2.25.0'
14+ androidTestImplementation ' androidx.test.ext:junit:1.1.1'
15+ androidTestImplementation ' androidx.test:rules:1.1.1'
16+ compileOnly ' com.google.ar:core:1.0.0'
2917}
3018
31- version = libraryVersion
19+ ext {
20+ GROUP_ID = " com.unity3d.ads"
21+ ARTIFACT_ID = " unity-ads"
22+ VERSION_ID = " 3.7.2"
23+ VERSION_CODE = 3720
24+ SIGN_AAR = properties. getProperty(" SIGN_AAR" ) ?: false
25+ }
3226
3327android {
3428 compileSdkVersion 30
35- buildToolsVersion ' 28.0.2'
36- com.android.ddmlib.DdmPreferences . setLogLevel(" verbose" )
37- com.android.ddmlib.DdmPreferences . setTimeOut(10 * 60000 )
29+ DdmPreferences . setLogLevel(" verbose" )
30+ DdmPreferences . setTimeOut(10 * 60000 )
3831
3932 defaultPublishConfig " release"
4033
34+ lintOptions {
35+ abortOnError false
36+ }
37+
4138 defaultConfig {
4239 minSdkVersion 19
4340 targetSdkVersion 30
44- /*
45- Please ensure that the last two digits of version number does not exceed 50 unless
46- it is a China SDK. This is because adding 50 to the version number is a one-to-one
47- mapping between normal SDK and China SDK.
48-
49- Example : version number 2350 corresponds to China version of 2300.
50-
51- All SDK with version numbers with last two digits >= 50 will be treated
52- as China SDK for filtering in the backend.
53- */
54- versionCode = 3710
55- versionName = " 3.7.1"
41+ versionCode = VERSION_CODE
42+ versionName = VERSION_ID
5643
5744 setProperty(" archivesBaseName" , " unity-ads" )
5845
5946 buildConfigField(' String' , ' WEBVIEW_BRANCH' , getPropertyStringWithDefaultValue(' WEBVIEW_BRANCH' , ' "' + versionName + ' "' ))
47+ buildConfigField(' int' , ' VERSION_CODE' , " $versionCode " )
48+ buildConfigField(' String' , ' VERSION_NAME' , " \" $versionName \" " )
6049 testBuildType " debug"
6150
6251 testInstrumentationRunner ' androidx.test.runner.AndroidJUnitRunner'
@@ -80,59 +69,43 @@ android {
8069 consumerProguardFiles ' proguard-rules.pro'
8170 }
8271 }
83-
84- libraryVariants. all { variant ->
85- variant. outputs. all { output ->
86- if (outputFile != null && outputFileName. endsWith(' .aar' )) {
87- outputFileName = " ${ archivesBaseName} -${ variant.buildType.name} .aar"
88- }
89- }
90- }
91-
92- testVariants. all { variant ->
93- variant. outputs. all { output ->
94- outputFileName = " ../../androidTest.apk"
95- }
96- }
97- }
98-
99- dependencies {
100- testImplementation ' junit:junit:4.12'
101- androidTestImplementation ' org.mockito:mockito-core:2.25.0'
102- androidTestImplementation ' org.mockito:mockito-android:2.25.0'
103- androidTestImplementation ' androidx.test.ext:junit:1.1.1'
104- androidTestImplementation ' androidx.test:rules:1.1.1'
105- compileOnly ' com.google.ar:core:1.0.0'
10672}
10773
108- task javadoc (type : Javadoc , overwrite : true ) {
74+ task javadoc (type : Javadoc ) {
10975 description " Generates Javadoc for Release"
11076 source = android. sourceSets. main. java. srcDirs
11177 ext. androidJar = " ${ android.sdkDirectory} /platforms/${ android.compileSdkVersion} /android.jar"
78+ ext. generatedClass = " build/generated/source/buildConfig/release/"
11279 doFirst {
113- classpath = project. files(android. getBootClasspath(). join(File . pathSeparator)) + files(ext. androidJar)
80+ classpath + = project. files(android. getBootClasspath(). join(File . pathSeparator))
81+ classpath + = files(ext. androidJar)
82+ classpath + = fileTree(dir : ' libs' , include : [' *.jar' ])
83+ classpath + = files(ext. generatedClass)
11484 }
11585 options {
11686 links " http://docs.oracle.com/javase/7/docs/api/"
117- linksOffline " http://developer.android.com/reference" ," ${ android.sdkDirectory} /docs/reference"
11887 }
11988 exclude ' **/R.java'
12089 exclude ' com/unity3d/services/ar/view/GLSurfaceView.java'
12190 exclude ' com/unity3d/services/ar/api/AR.java'
91+ exclude ' com/unity3d/services/ar/ARUtils.java'
92+ exclude ' com/unity3d/services/ar/configuration/ARModuleConfiguration.java'
12293 exclude ' com/unity3d/services/ar/view/ARView.java'
12394 exclude ' com/unity3d/services/ar/view/ARViewHandler.java'
95+ exclude ' com/unity3d/services/ar/view/BackgroundRenderer.java'
96+ exclude ' com/unity3d/services/ar/view/DisplayRotationHelper.java'
12497 destinationDir = file(" ../javadoc/" )
12598}
12699
127100task androidJavadocsJar (type : Jar , dependsOn : javadoc) {
128- classifier = " javadoc"
129- baseName = " ${ archivesBaseName} "
101+ archiveClassifier . set( " javadoc" )
102+ archiveBaseName . set( " ${ archivesBaseName} " )
130103 from javadoc. destinationDir
131104}
132105
133106task androidSourcesJar (type : Jar ) {
134- classifier = " sources"
135- baseName = " ${ archivesBaseName} "
107+ archiveClassifier . set( " sources" )
108+ archiveBaseName . set( " ${ archivesBaseName} " )
136109 from android. sourceSets. main. java. srcDirs
137110}
138111
@@ -141,66 +114,6 @@ artifacts {
141114 archives androidSourcesJar
142115}
143116
144- jacoco {
145- toolVersion = ' 0.8.1'
146- }
147-
148- tasks. withType(Test ) {
149- jacoco. includeNoLocationClasses = true
150- }
151-
152- task jacocoTestReport (type : JacocoReport ) {
153- reports {
154- xml. enabled = true
155- html. enabled = true
156- }
157-
158- def fileFilter = [' **/R.class' , ' **/R$*.class' , ' **/BuildConfig.*' , ' **/Manifest*.*' , ' **/*Test*.*' , ' android/**/*.*' ]
159- def javaClasses = fileTree(dir : " $project . buildDir /intermediates/classes/debug" , excludes : fileFilter)
160- def javaSrc = " $project . projectDir /src/main/java"
161-
162- sourceDirectories = files([javaSrc])
163- classDirectories = files([javaClasses])
164- executionData = fileTree(dir : project. buildDir, includes : [
165- ' outputs/code-coverage/connected/*coverage.ec'
166- ])
167- }
168-
169- // Bintray
170- task localProperties {
171- if (! file(" $rootDir /local.properties" ). exists()) {
172- file(" $rootDir /local.properties" ). withWriterAppend { w -> " " }
173- }
174- }
175-
176- bintray {
177- Properties properties = new Properties ()
178- properties. load(project. rootProject. file(' local.properties' ). newDataInputStream())
179-
180- user = properties. getProperty(" bintray.user" )
181- key = properties. getProperty(" bintray.apikey" )
182-
183- configurations = [' archives' ]
184- pkg {
185- repo = bintrayRepo
186- name = bintrayName
187- desc = libraryDescription
188- websiteUrl = siteUrl
189- vcsUrl = gitUrl
190- licenses = allLicenses
191- publish = true
192- publicDownloadNumbers = false
193- version {
194- desc = libraryDescription
195- gpg {
196- sign = true // Determines whether to GPG sign the files. The default is false
197- passphrase = properties. getProperty(" bintray.gpg.password" )
198- // Optional. The passphrase for GPG signing'
199- }
200- }
201- }
202- }
203-
204117def getPropertyStringWithDefaultValue (String key , String defaultValue ) {
205118 def value = project. getProperties(). get(key)
206119 // Ensure that string is quoted
@@ -211,6 +124,6 @@ def getPropertyStringWithDefaultValue(String key, String defaultValue) {
211124 return value != null ? value : defaultValue
212125}
213126
214- if (project . rootProject . file( ' local.properties ' ) . exists()) {
215- apply from : ' mavenPomBintrayUpload .gradle'
216- }
127+ apply from : ' publishing.gradle '
128+ apply from : ' artifactory .gradle'
129+ apply from : ' jacoco.gradle '
0 commit comments