blob: 62dc6e219b3aa4c9c681337088a1363c013f1b32 [file] [log] [blame]
/*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import static androidx.build.dependencies.DependenciesKt.*
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.SupportLibraryExtension
import androidx.build.SupportConfig
apply plugin: androidx.build.SupportKotlinLibraryPlugin
apply plugin: 'java-gradle-plugin'
ext.generatedResources = "$buildDir/generated/resources"
sourceSets {
test.java.srcDirs += 'src/tests/kotlin'
test.resources.srcDirs += generatedResources
}
dependencies {
compile build_libs.gradle
compile project(":navigation:navigation-safe-args-generator")
compile gradleApi()
compile(GSON)
testCompile gradleTestKit()
testCompile(JUNIT)
}
task generateSdkResource() {
inputs.property("compileSdkVersion", SupportConfig.CURRENT_SDK_VERSION)
inputs.property("buildToolsVersion", SupportConfig.BUILD_TOOLS_VERSION)
outputs.dir(generatedResources)
doLast {
// Properties.write will have a timestamp, that invalidates the task,
// so we don't use it and write a file manually
new File(generatedResources, "sdk.prop").withWriter('UTF-8') { writer ->
writer.write("compileSdkVersion=$SupportConfig.CURRENT_SDK_VERSION\n")
writer.write("buildToolsVersion=$SupportConfig.BUILD_TOOLS_VERSION\n")
}
}
}
test {
testLogging { showStandardStreams = true }
}
tasks["compileTestJava"].dependsOn generateSdkResource
gradlePlugin {
plugins {
safeargs {
id = "androidx.navigation.safeargs"
implementationClass = "androidx.navigation.safeargs.gradle.SafeArgsPlugin"
}
}
}
supportLibrary {
name = "Android Navigation TypeSafe Arguments Gradle Plugin"
publish = true
mavenVersion = LibraryVersions.NAVIGATION
mavenGroup = LibraryGroups.NAVIGATION
inceptionYear = "2017"
description = "Android Navigation TypeSafe Arguments Gradle Plugin"
url = SupportLibraryExtension.ARCHITECTURE_URL
}