11import com.android.ddmlib.DdmPreferences
22
33apply plugin : ' com.android.library'
4+ apply plugin : ' kotlin-android'
5+ apply from : ' ../dokka.gradle'
46
57Properties properties = new Properties ()
68if (project. rootProject. file(' local.properties' ). exists()) {
@@ -10,8 +12,8 @@ if (project.rootProject.file('local.properties').exists()) {
1012ext {
1113 GROUP_ID = " com.unity3d.ads"
1214 ARTIFACT_ID = " unity-ads"
13- VERSION_ID = " 4.4.1 "
14- VERSION_CODE = 4410
15+ VERSION_ID = " 4.5.0 "
16+ VERSION_CODE = 4500
1517 SIGN_AAR = properties. getProperty(" SIGN_AAR" ) ?: false
1618}
1719
@@ -49,6 +51,27 @@ android {
4951 targetCompatibility JavaVersion . VERSION_1_7
5052 }
5153
54+ tasks. withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile ). configureEach {
55+ if (it. name. contains(" UnitTest" )) {
56+ sourceCompatibility = JavaVersion . VERSION_1_8
57+ targetCompatibility = JavaVersion . VERSION_1_8
58+ kotlinOptions {
59+ jvmTarget = " 1.8"
60+ }
61+ } else {
62+ sourceCompatibility = JavaVersion . VERSION_1_6
63+ targetCompatibility = JavaVersion . VERSION_1_6
64+ kotlinOptions {
65+ jvmTarget = " 1.6"
66+ }
67+ }
68+ kotlinOptions {
69+ apiVersion = " 1.4"
70+ languageVersion = " 1.4"
71+ freeCompilerArgs = freeCompilerArgs + " -Xopt-in=kotlin.RequiresOptIn" + " -Xallow-result-return-type"
72+ }
73+ }
74+
5275 buildTypes {
5376 release {
5477 minifyEnabled false
@@ -65,6 +88,9 @@ android {
6588
6689dependencies {
6790 implementation fileTree(dir : ' libs' , include : [' *.jar' ])
91+ implementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
92+ implementation " org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version "
93+ androidTestCompileOnly project(' :unity-scaradapter-2100' )
6894 androidTestCompileOnly project(' :unity-scaradapter-2000' )
6995 androidTestCompileOnly project(' :unity-scaradapter-1950' )
7096 androidTestCompileOnly project(' :unity-scaradapter-1920' )
@@ -80,37 +106,20 @@ dependencies {
80106 androidTestImplementation ' com.google.android.gms:play-services-ads:19.5.0'
81107 androidTestImplementation ' com.android.billingclient:billing:4.0.0'
82108 compileOnly ' com.google.ar:core:1.0.0'
109+ compileOnly project(' :unity-scaradapter-2100' )
83110 compileOnly project(' :unity-scaradapter-2000' )
84111 compileOnly project(' :unity-scaradapter-1950' )
85112 compileOnly project(' :unity-scaradapter-1920' )
86113 compileOnly project(' :unity-scaradapter-common' )
87114 testImplementation ' junit:junit:4.13.2'
115+ testImplementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
116+ testImplementation " org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version "
117+ testImplementation " org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutines_version "
118+ testImplementation " org.mockito.kotlin:mockito-kotlin:4.0.0"
88119 testImplementation ' org.mockito:mockito-core:2.28.2'
89120 testImplementation ' com.android.billingclient:billing:4.0.0'
90- }
91-
92- task javadoc (type : Javadoc ) {
93- description " Generates Javadoc for Release"
94- source = android. sourceSets. main. java. srcDirs
95- ext. androidJar = " ${ android.sdkDirectory} /platforms/${ android.compileSdkVersion} /android.jar"
96- ext. generatedClass = " build/generated/source/buildConfig/release/"
97- doFirst {
98- classpath + = project. files(android. getBootClasspath(). join(File . pathSeparator))
99- classpath + = files(ext. androidJar)
100- classpath + = fileTree(dir : ' libs' , include : [' *.jar' ])
101- classpath + = files(ext. generatedClass)
102- }
103- options {
104- links " http://docs.oracle.com/javase/7/docs/api/"
105- }
106- exclude ' **/R.java'
107- destinationDir = file(" ../javadoc/" )
108- }
109-
110- task androidJavadocsJar (type : Jar , dependsOn : javadoc) {
111- archiveClassifier. set(" javadoc" )
112- archiveBaseName. set(" ${ archivesBaseName} " )
113- from javadoc. destinationDir
121+ testImplementation " io.mockk:mockk:1.11.0"
122+ testImplementation ' org.json:json:20180813'
114123}
115124
116125task androidSourcesJar (type : Jar ) {
@@ -119,9 +128,15 @@ task androidSourcesJar(type: Jar) {
119128 from android. sourceSets. main. java. srcDirs
120129}
121130
131+ task androidJavadocsJar (type : Jar , dependsOn : dokkaJavadoc) {
132+ archiveClassifier. set(" javadoc" )
133+ archiveBaseName. set(" ${ archivesBaseName} " )
134+ from " $rootDir /../javadoc/"
135+ }
136+
122137artifacts {
123- archives androidJavadocsJar
124138 archives androidSourcesJar
139+ archives androidJavadocsJar
125140}
126141
127142def getPropertyStringWithDefaultValue (String key , String defaultValue ) {
0 commit comments