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
17/**
18 * This file was created using the `create_project.py` script located in the
19 * `<AndroidX root>/development/project-creator` directory.
20 *
21 * Please use that script when creating a new project, rather than copying an existing project and
22 * modifying its settings.
23 */
24import androidx.build.SoftwareType
25import androidx.build.SdkResourceGenerator
26
27plugins {
28    id("AndroidXPlugin")
29    id("kotlin")
30    id("java-gradle-plugin")
31}
32
33configurations {
34    // Config for plugin classpath to be used during tests
35    testPlugin {
36        canBeConsumed = false
37        canBeResolved = true
38    }
39}
40
41dependencies {
42    compileOnly("com.android.tools.build:gradle:8.1.1")
43    implementation(libs.kotlinStdlib)
44    implementation(project(":navigation:navigation-safe-args-generator"))
45    implementation(gradleApi())
46    implementation(libs.gson)
47
48    testImplementation(gradleTestKit())
49    testImplementation(project(":internal-testutils-gradle-plugin"))
50    testImplementation(libs.hamcrestCore)
51    testImplementation(libs.junit)
52    testPlugin("com.android.tools.build:gradle:8.1.1")
53    testPlugin("com.android.tools.build:aapt2:8.1.1-10154469")
54    testPlugin("com.android.tools.build:aapt2:8.1.1-10154469:linux")
55    testPlugin("com.android.tools.build:aapt2:8.1.1-10154469:osx")
56    testPlugin(libs.kotlinGradlePlugin)
57}
58
59tasks.withType(PluginUnderTestMetadata.class).named("pluginUnderTestMetadata").configure {
60    it.pluginClasspath.from(configurations.testPlugin)
61}
62
63tasks.withType(Test).configureEach { test ->
64    test.javaLauncher = javaToolchains.launcherFor {
65        // Test on JDK 17 which supports lower versions of AGP. This can be removed
66        // once we move to AGP 8.2.1+
67        languageVersion = JavaLanguageVersion.of(17)
68    }
69}
70
71gradlePlugin {
72    plugins {
73        safeargsJava {
74            id = "androidx.navigation.safeargs"
75            implementationClass = "androidx.navigation.safeargs.gradle.SafeArgsJavaPlugin"
76        }
77        safeargsKotlin {
78            id = "androidx.navigation.safeargs.kotlin"
79            implementationClass = "androidx.navigation.safeargs.gradle.SafeArgsKotlinPlugin"
80        }
81    }
82}
83
84androidx {
85    name = "Navigation TypeSafe Arguments Gradle Plugin"
86    type = SoftwareType.GRADLE_PLUGIN
87    inceptionYear = "2017"
88    description = "Android Navigation TypeSafe Arguments Gradle Plugin"
89}
90