Create Fragment lint module
Test: ./gradlew bOS
Change-Id: Ic37b0bf0f11d4b05614ace42c32c0dc57c4c1b33
diff --git a/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt b/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
index 7048853..77045c2c 100644
--- a/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
@@ -67,6 +67,7 @@
prebuilts(LibraryGroups.EMOJI, "1.0.0")
prebuilts(LibraryGroups.ENTERPRISE, "1.0.0-beta01")
prebuilts(LibraryGroups.EXIFINTERFACE, "1.1.0-rc01")
+ ignore(LibraryGroups.FRAGMENT.group, "fragment-lint")
ignore(LibraryGroups.FRAGMENT.group, "fragment-truth")
prebuilts(LibraryGroups.FRAGMENT, "1.2.0-beta01")
prebuilts(LibraryGroups.GRIDLAYOUT, "1.0.0")
diff --git a/fragment/fragment-lint/OWNERS b/fragment/fragment-lint/OWNERS
new file mode 100644
index 0000000..80569a3
--- /dev/null
+++ b/fragment/fragment-lint/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/fragment/fragment-lint/build.gradle b/fragment/fragment-lint/build.gradle
new file mode 100644
index 0000000..5fad370
--- /dev/null
+++ b/fragment/fragment-lint/build.gradle
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2019 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.AndroidXExtension
+import androidx.build.CompilationTarget
+import androidx.build.LibraryGroups
+import androidx.build.LibraryVersions
+import androidx.build.SdkHelperKt
+import androidx.build.Publish
+
+plugins {
+ id("AndroidXPlugin")
+ id("kotlin")
+}
+
+ext.generatedResources = "$buildDir/generated/sdkResourcesForTest"
+
+sourceSets {
+ test.resources.srcDirs += generatedResources
+}
+
+task generateSdkResource() {
+ outputs.dir(generatedResources)
+ doLast {
+ new File(generatedResources, "sdk.prop").withWriter('UTF-8') { writer ->
+ writer.write("sdk.dir=${SdkHelperKt.getSdkPath(project.rootDir)}")
+ }
+ }
+}
+
+tasks["compileTestJava"].dependsOn generateSdkResource
+
+dependencies {
+ // compileOnly because we use lintChecks and it doesn't allow other types of deps
+ // this ugly hack exists because of b/63873667
+ if (rootProject.hasProperty("android.injected.invoked.from.ide")) {
+ compileOnly LINT_API_LATEST
+ } else {
+ compileOnly LINT_API_MIN
+ }
+ compileOnly KOTLIN_STDLIB
+
+ testImplementation KOTLIN_STDLIB
+ testImplementation LINT_CORE
+ testImplementation LINT_TESTS
+}
+
+androidx {
+ name = "Android Fragment Lint Checks"
+ toolingProject = true
+ publish = Publish.NONE
+ mavenVersion = LibraryVersions.FRAGMENT
+ mavenGroup = LibraryGroups.FRAGMENT
+ inceptionYear = "2019"
+ description = "Android Fragment Lint Checks"
+ url = AndroidXExtension.ARCHITECTURE_URL
+ compilationTarget = CompilationTarget.HOST
+}
diff --git a/fragment/fragment-lint/src/main/AndroidManifest.xml b/fragment/fragment-lint/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..c7fb82d
--- /dev/null
+++ b/fragment/fragment-lint/src/main/AndroidManifest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2019 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.
+ -->
+<manifest package="androidx.fragment.lint"/>
diff --git a/settings.gradle b/settings.gradle
index 2ccbdbb..88d9842 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -117,6 +117,7 @@
includeProject(":exifinterface", "exifinterface")
includeProject(":fragment:fragment", "fragment/fragment")
includeProject(":fragment:fragment-ktx", "fragment/fragment-ktx")
+includeProject(":fragment:fragment-lint", "fragment/fragment-lint")
includeProject(":fragment:fragment-testing", "fragment/fragment-testing")
includeProject(":fragment:fragment-truth", "fragment/fragment-truth")
includeProject(":fakeannotations", "fakeannotations")