1/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import androidx.build.SupportConfig
18
19import static androidx.build.dependencies.DependenciesKt.*
20import androidx.build.LibraryGroups
21import androidx.build.LibraryVersions
22import androidx.build.SupportLibraryExtension
23
24apply plugin: androidx.build.SupportKotlinLibraryPlugin
25
26
27sourceSets {
28    test.java.srcDirs += 'src/tests/kotlin'
29}
30
31dependencies {
32    compile(XPP3)
33    compile(XMLPULL)
34    compile(KOTLIN_STDLIB)
35
36    compile(JAVAPOET)
37
38    testCompile(JUNIT)
39    testCompile(GOOGLE_COMPILE_TESTING)
40    def logger = new com.android.build.gradle.internal.LoggerWrapper(project.logger)
41    def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger)
42    testCompile fileTree(dir: "${sdkHandler.sdkFolder}/platforms/android-$SupportConfig.CURRENT_SDK_VERSION/",
43            include : "android.jar")
44    testCompile fileTree(dir: "${new File(project(":navigation:navigation-common").buildDir, "libJar")}",
45            include : "*.jar")
46    testCompile files(org.gradle.internal.jvm.Jvm.current().getToolsJar())
47}
48
49tasks.findByName("test").doFirst {
50    // android.jar and xmlpull has the same classes, but android.jar has stubs instead of real
51    // implementation, so we move android.jar to end of classpath
52    def classpath = it.classpath.getFiles()
53    def androidJar = classpath.find { it.name == "android.jar" }
54    classpath.remove(androidJar)
55    classpath.add(androidJar)
56    it.classpath = files(classpath)
57}
58
59tasks.findByName("compileKotlin").dependsOn(":navigation:navigation-common:jarDebug")
60
61supportLibrary {
62    name = 'Android Navigation TypeSafe Arguments Generator'
63    publish = true
64    mavenVersion = LibraryVersions.NAVIGATION
65    mavenGroup = LibraryGroups.NAVIGATION
66    inceptionYear = '2017'
67    description = "Android Navigation TypeSafe Arguments Generator"
68    url = SupportLibraryExtension.ARCHITECTURE_URL
69}
70