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
14
2
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'
21
4
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
+ }
25
9
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'
29
17
}
30
18
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
+ }
32
26
33
27
android {
34
28
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 )
38
31
39
32
defaultPublishConfig " release"
40
33
34
+ lintOptions {
35
+ abortOnError false
36
+ }
37
+
41
38
defaultConfig {
42
39
minSdkVersion 19
43
40
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
56
43
57
44
setProperty(" archivesBaseName" , " unity-ads" )
58
45
59
46
buildConfigField(' String' , ' WEBVIEW_BRANCH' , getPropertyStringWithDefaultValue(' WEBVIEW_BRANCH' , ' "' + versionName + ' "' ))
47
+ buildConfigField(' int' , ' VERSION_CODE' , " $versionCode " )
48
+ buildConfigField(' String' , ' VERSION_NAME' , " \" $versionName \" " )
60
49
testBuildType " debug"
61
50
62
51
testInstrumentationRunner ' androidx.test.runner.AndroidJUnitRunner'
@@ -80,59 +69,43 @@ android {
80
69
consumerProguardFiles ' proguard-rules.pro'
81
70
}
82
71
}
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'
106
72
}
107
73
108
- task javadoc (type : Javadoc , overwrite : true ) {
74
+ task javadoc (type : Javadoc ) {
109
75
description " Generates Javadoc for Release"
110
76
source = android. sourceSets. main. java. srcDirs
111
77
ext. androidJar = " ${ android.sdkDirectory} /platforms/${ android.compileSdkVersion} /android.jar"
78
+ ext. generatedClass = " build/generated/source/buildConfig/release/"
112
79
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)
114
84
}
115
85
options {
116
86
links " http://docs.oracle.com/javase/7/docs/api/"
117
- linksOffline " http://developer.android.com/reference" ," ${ android.sdkDirectory} /docs/reference"
118
87
}
119
88
exclude ' **/R.java'
120
89
exclude ' com/unity3d/services/ar/view/GLSurfaceView.java'
121
90
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'
122
93
exclude ' com/unity3d/services/ar/view/ARView.java'
123
94
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'
124
97
destinationDir = file(" ../javadoc/" )
125
98
}
126
99
127
100
task androidJavadocsJar (type : Jar , dependsOn : javadoc) {
128
- classifier = " javadoc"
129
- baseName = " ${ archivesBaseName} "
101
+ archiveClassifier . set( " javadoc" )
102
+ archiveBaseName . set( " ${ archivesBaseName} " )
130
103
from javadoc. destinationDir
131
104
}
132
105
133
106
task androidSourcesJar (type : Jar ) {
134
- classifier = " sources"
135
- baseName = " ${ archivesBaseName} "
107
+ archiveClassifier . set( " sources" )
108
+ archiveBaseName . set( " ${ archivesBaseName} " )
136
109
from android. sourceSets. main. java. srcDirs
137
110
}
138
111
@@ -141,66 +114,6 @@ artifacts {
141
114
archives androidSourcesJar
142
115
}
143
116
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
-
204
117
def getPropertyStringWithDefaultValue (String key , String defaultValue ) {
205
118
def value = project. getProperties(). get(key)
206
119
// Ensure that string is quoted
@@ -211,6 +124,6 @@ def getPropertyStringWithDefaultValue(String key, String defaultValue) {
211
124
return value != null ? value : defaultValue
212
125
}
213
126
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