blob: 62dc6e219b3aa4c9c681337088a1363c013f1b32 [file] [log] [blame]
Sergey Vasilinets968529a2018-01-03 16:13:53 -08001/*
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
Sergey Vasilinets98971a72018-04-18 10:33:33 -070017import static androidx.build.dependencies.DependenciesKt.*
18import androidx.build.LibraryGroups
19import androidx.build.LibraryVersions
20import androidx.build.SupportLibraryExtension
21import androidx.build.SupportConfig
Sergey Vasilinets968529a2018-01-03 16:13:53 -080022
Sergey Vasilinets98971a72018-04-18 10:33:33 -070023apply plugin: androidx.build.SupportKotlinLibraryPlugin
Sergey Vasilinets968529a2018-01-03 16:13:53 -080024apply plugin: 'java-gradle-plugin'
25
Sergey Vasilinets973a5c02018-01-11 23:39:12 -080026ext.generatedResources = "$buildDir/generated/resources"
27
Sergey Vasilinets968529a2018-01-03 16:13:53 -080028sourceSets {
29 test.java.srcDirs += 'src/tests/kotlin'
Sergey Vasilinets973a5c02018-01-11 23:39:12 -080030 test.resources.srcDirs += generatedResources
Sergey Vasilinets968529a2018-01-03 16:13:53 -080031}
32
33dependencies {
Sergey Vasilinets973a5c02018-01-11 23:39:12 -080034 compile build_libs.gradle
Ian Lakec4ae7e62018-04-12 14:36:09 -070035 compile project(":navigation:navigation-safe-args-generator")
Sergey Vasilinets968529a2018-01-03 16:13:53 -080036 compile gradleApi()
Sergey Vasilinets7e7dfac2018-03-09 14:05:29 -080037 compile(GSON)
Sergey Vasilinets973a5c02018-01-11 23:39:12 -080038 testCompile gradleTestKit()
39 testCompile(JUNIT)
Sergey Vasilinets968529a2018-01-03 16:13:53 -080040}
41
Sergey Vasilinets973a5c02018-01-11 23:39:12 -080042task generateSdkResource() {
43 inputs.property("compileSdkVersion", SupportConfig.CURRENT_SDK_VERSION)
44 inputs.property("buildToolsVersion", SupportConfig.BUILD_TOOLS_VERSION)
45 outputs.dir(generatedResources)
46 doLast {
47 // Properties.write will have a timestamp, that invalidates the task,
48 // so we don't use it and write a file manually
49 new File(generatedResources, "sdk.prop").withWriter('UTF-8') { writer ->
50 writer.write("compileSdkVersion=$SupportConfig.CURRENT_SDK_VERSION\n")
51 writer.write("buildToolsVersion=$SupportConfig.BUILD_TOOLS_VERSION\n")
52 }
53 }
54}
55
Sergey Vasilinets7e7dfac2018-03-09 14:05:29 -080056test {
57 testLogging { showStandardStreams = true }
58}
59
Sergey Vasilinets973a5c02018-01-11 23:39:12 -080060tasks["compileTestJava"].dependsOn generateSdkResource
61
Sergey Vasilinets968529a2018-01-03 16:13:53 -080062gradlePlugin {
63 plugins {
64 safeargs {
Ian Lake1503d522018-02-15 13:43:50 -080065 id = "androidx.navigation.safeargs"
66 implementationClass = "androidx.navigation.safeargs.gradle.SafeArgsPlugin"
Sergey Vasilinets968529a2018-01-03 16:13:53 -080067 }
68 }
69}
70
71supportLibrary {
72 name = "Android Navigation TypeSafe Arguments Gradle Plugin"
73 publish = true
74 mavenVersion = LibraryVersions.NAVIGATION
75 mavenGroup = LibraryGroups.NAVIGATION
76 inceptionYear = "2017"
77 description = "Android Navigation TypeSafe Arguments Gradle Plugin"
78 url = SupportLibraryExtension.ARCHITECTURE_URL
79}