[
  {
    "path": ".cirrus.yml",
    "content": "container:\n  image: gradle:jdk8\n\ncheck_task:\n  gradle_cache:\n    folder: ~/.gradle/caches\n  check_script: ./gradlew tasks\n  cleanup_before_cache_script:\n    - rm -rf ~/.gradle/caches/$GRADLE_VERSION/\n    - rm -rf ~/.gradle/caches/transforms-1\n    - rm -rf ~/.gradle/caches/journal-1\n    - find ~/.gradle/caches/ -name \"*.lock\" -type f -delete\n"
  },
  {
    "path": ".github/workflows/gradle-wrapper-validation.yml",
    "content": "name: \"Validate Gradle Wrapper\"\non: [push, pull_request]\n\njobs:\n  validation:\n    name: \"Validation\"\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: gradle/wrapper-validation-action@v1\n"
  },
  {
    "path": ".gitignore",
    "content": "# IDEA\n*.iml\n/.idea\nout/\n/local.properties\n\n# Gradle\n.gradle\nbuild\n/reports\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# Changelog\n## 0.3.0\n * Depend on Dagger Reflect 0.3.0 ([#30](https://github.com/soundcloud/delect/pull/30))\n * Support Gradle Configuration Cache ([#31](https://github.com/soundcloud/delect/pull/31), [#32](https://github.com/soundcloud/delect/pull/32))\n\n## 0.2.0\n * Add Dagger Reflect Lint rules if possible. [PR](https://github.com/soundcloud/delect/pull/13) Thanks [winterdroid](https://github.com/winterDroid)\n * Depend on Dagger Reflect 0.2.0 [PR](https://github.com/soundcloud/delect/pull/24)\n * Add Full Reflection Support. [PR](https://github.com/soundcloud/delect/pull/25)\n\n## 0.1.0\n * Initial Release\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright 2019 SoundCloud\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "⚠️ **Delect has been retired!**\n\nAfter 2+ years of service it's time to retire Delect. We won’t be developing the plugin further and we won’t provide support but you’re welcome to keep using Delect if it works for you ✌️\n\n# Delect - The Gradle Plugin for Dagger Reflect\n\nDelect automatically substitutes Dagger for Dagger Reflect for faster local builds.\n\n[Dagger](https://github.com/google/dagger), a dependency injection framework for Java, can slow down compilation with its lengthy annotation processing and code generation.\n\n[Dagger Reflect](https://github.com/jakewharton/dagger-reflect) uses the same API as Dagger but swaps the compile time annotation processing for runtime based reflection.\n\n## Usage\nDelect uses the [partial reflection approach](https://github.com/jakewharton/dagger-reflect#usage).\n\n1. Add the plugin to your project's root build.gradle:\n```\nbuildscript {\n  classpath 'com.soundcloud.delect:delect-plugin:0.3.0'\n}\napply plugin: 'com.soundcloud.delect'\n```\n2. Make sure to use the `@Component.Builder` or `@Component.Factory` to create component instances.\n3. Add the runtime retention policy to all `@Qualifier`, `@MapKey` and other custom Dagger annotations:\n```\n@Retention(RUNTIME)\n```\n4. Add `dagger.reflect=true` to `gradle.properties`.\n  You can also add it to `~/.gradle/gradle.properties` so it doesn't need to be checked into the project.\n5. Build -- and skip all that pesky code generation!\n\n## Plugin Development\n\nTo publish to maven local:\n```\n./gradlew -b buildSrc/build.gradle.kts publishToMavenLocal\n```\nTo publish:\n```\n./gradlew -b buildSrc/build.gradle.kts publishMavenJavaPublicationToMavenRepository\n```\n\n## Found more than one jar in the 'lintChecks' configuration.\n\nThis is a [bug in AGP](https://issuetracker.google.com/issues/141840950).\nTo disable Dagger Reflect lint checks:\n```groovy\ndelect {\n  enableReflectLintCheck = false\n}\n```\n\n## License\n\n```\nCopyright 2019 SoundCloud\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n"
  },
  {
    "path": "build.gradle.kts",
    "content": "plugins {\n    id(\"com.soundcloud.delect\")\n}\n\nallprojects {\n    repositories {\n        mavenCentral()\n    }\n}\n\ntasks.wrapper {\n    distributionType = Wrapper.DistributionType.ALL\n    gradleVersion = \"6.6\"\n}\n"
  },
  {
    "path": "buildSrc/build.gradle.kts",
    "content": "group = \"com.soundcloud.delect\"\nversion = \"0.3.0\"\n\nrepositories {\n    google()\n    mavenCentral()\n}\n\nplugins {\n    `kotlin-dsl`\n    id(\"java-gradle-plugin\")\n    id(\"org.jmailen.kotlinter\") version \"2.4.1\"\n    `maven-publish`\n    signing\n}\n\ndependencies {\n    compileOnly(gradleApi())\n\n    testImplementation(gradleTestKit())\n    testImplementation(\"junit:junit:4.13\")\n    testImplementation(\"com.google.truth:truth:1.0.1\")\n}\n\ngradlePlugin {\n    plugins {\n        create(\"delect\") {\n            id = group.toString()\n            displayName = \"Delect\"\n            description = \"The Gradle Plugin for Dagger Reflect\"\n            implementationClass = \"com.soundcloud.reflect.DaggerReflectPlugin\"\n        }\n    }\n}\n\nkotlinDslPluginOptions {\n    experimentalWarning.set(false)\n}\n\ntasks.register<Jar>(\"sourcesJar\") {\n    from(sourceSets.main.get().allSource)\n    archiveClassifier.set(\"sources\")\n}\n\ntasks.register<Jar>(\"javadocJar\") {\n    from(tasks.javadoc)\n    archiveClassifier.set(\"javadoc\")\n}\n\nval isReleaseBuild : Boolean = !version.toString().endsWith(\"SNAPSHOT\")\n\nval sonatypeUsername : String? by project\nval sonatypePassword : String? by project\n\npublishing {\n    repositories {\n        repositories {\n            maven {\n                val releasesRepoUrl = uri(\"https://oss.sonatype.org/service/local/staging/deploy/maven2/\")\n                val snapshotsRepoUrl = uri(\"https://oss.sonatype.org/content/repositories/snapshots/\")\n                url = if (isReleaseBuild) releasesRepoUrl else snapshotsRepoUrl\n                credentials {\n                    username = sonatypeUsername\n                    password = sonatypePassword\n                }\n            }\n        }\n    }\n    publications {\n        create<MavenPublication>(\"mavenJava\") {\n            from(components[\"java\"])\n            artifact(tasks[\"sourcesJar\"])\n            artifact(tasks[\"javadocJar\"])\n            pom {\n                name.set(\"Delect\")\n                description.set(\"The Gradle Plugin for Dagger Reflect\")\n                url.set(\"https://github.com/soundcloud/delect\")\n                licenses {\n                    license {\n                        name.set(\"The Apache License, Version 2.0\")\n                        url.set(\"http://www.apache.org/licenses/LICENSE-2.0.txt\")\n                    }\n                }\n                developers {\n                    developer {\n                        id.set(\"SoundCloud\")\n                        name.set(\"SoundCloud\")\n                    }\n                }\n                scm {\n                    connection.set(\"scm:git:git://github.com/soundcloud/delect.git\")\n                    developerConnection.set(\"scm:git:ssh://github.com/soundcloud/delect.git\")\n                    url.set(\"https://github.com/soundcloud/delect\")\n                }\n            }\n        }\n    }\n}\n\nsigning {\n    setRequired(isReleaseBuild)\n    sign(publishing.publications[\"mavenJava\"])\n}\n"
  },
  {
    "path": "buildSrc/settings.gradle.kts",
    "content": "rootProject.name = \"delect-plugin\""
  },
  {
    "path": "buildSrc/src/main/java/com/soundcloud/reflect/DaggerReflectPlugin.kt",
    "content": "package com.soundcloud.reflect\n\nimport org.gradle.api.Plugin\nimport org.gradle.api.Project\nimport org.gradle.kotlin.dsl.dependencies\nimport org.gradle.util.VersionNumber\n\nclass DaggerReflectPlugin : Plugin<Project> {\n    override fun apply(target: Project) {\n        val extension = target.extensions.create(\"delect\", DelectExtension::class.java)\n\n        if (!shouldActivateDaggerReflect(target)) {\n            return\n        }\n\n        target.logger.warn(\"Using Dagger Reflect\")\n\n        target.allprojects {\n            configurations.all config@{\n                if (!extension.addReflectAnnotationProcessor) {\n                    withDependencies {\n                        removeIf { it.group == daggerGroupId && it.name == \"dagger-compiler\" }\n                        removeIf { it.group == daggerGroupId && it.name == \"dagger-android-processor\" }\n                    }\n                }\n                dependencies.all {\n                    // If we depend on the dagger runtime, also add the dagger reflect runtime.\n                    if (group == daggerGroupId && name == \"dagger\") {\n                        dependencies {\n                            add(\n                                this@config.name,\n                                \"$reflectDaggerGroupId:dagger-reflect:${extension.daggerReflectVersion}\"\n                            )\n                            if (extension.enableReflectLintCheck &&\n                                (maxUnsupportedDaggerLintVersion < VersionNumber.parse(extension.daggerReflectVersion))\n                            ) {\n                                whenLintPluginAdded {\n                                    add(\n                                        \"lintChecks\",\n                                        \"$reflectDaggerGroupId:dagger-reflect-lint:${extension.daggerReflectVersion}\"\n                                    )\n                                }\n                            }\n                        }\n                    }\n                }\n                resolutionStrategy {\n                    componentSelection {\n                        withModule(\"$daggerGroupId:dagger\") {\n                            if (VersionNumber.parse(candidate.version) < minSupportedDaggerVersion) {\n                                // We need to use at least 2.22 in order for certain dagger annotations to have runtime retention.\n                                reject(\"Version must be $minSupportedDaggerVersion or higher.\")\n                            }\n                        }\n                    }\n                    if (extension.addReflectAnnotationProcessor) {\n                        dependencySubstitution {\n                            // Substitute dagger compiler for dagger reflect compiler.\n                            substitute(\n                                module(\"$daggerGroupId:dagger-compiler\")\n                            ).apply {\n                                with(module(\"$reflectDaggerGroupId:dagger-reflect-compiler:${extension.daggerReflectVersion}\"))\n                                because(\"We want to build faster.\")\n                            }\n\n                            substitute(module(\"$daggerGroupId:dagger-android-processor\"))\n                                .with(module(\"$reflectDaggerGroupId:dagger-reflect-compiler:${extension.daggerReflectVersion}\"))\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    private fun shouldActivateDaggerReflect(target: Project): Boolean {\n        val propertyProvider = target.providers.gradleProperty(\"dagger.reflect\").forUseAtConfigurationTime()\n        return (propertyProvider.isPresent && propertyProvider.get() == \"true\")\n    }\n\n    private fun Project.whenLintPluginAdded(block: () -> Unit) {\n        supportedLintPlugins.forEach { pluginId ->\n            plugins.withId(pluginId) { block() }\n        }\n    }\n\n    companion object {\n        const val daggerGroupId = \"com.google.dagger\"\n        const val reflectDaggerGroupId = \"com.jakewharton.dagger\"\n        val minSupportedDaggerVersion = VersionNumber.parse(\"2.22\")\n        val maxUnsupportedDaggerLintVersion = VersionNumber.parse(\"0.1.0\")\n        val supportedLintPlugins = listOf(\"com.android.lint\", \"com.android.application\", \"com.android.library\")\n    }\n}\n"
  },
  {
    "path": "buildSrc/src/main/java/com/soundcloud/reflect/DelectExtension.kt",
    "content": "package com.soundcloud.reflect\n\nopen class DelectExtension {\n    var daggerReflectVersion = \"0.3.0\"\n    /**\n     * By default, we use the Reflect Annotation Processor to connect the App's code the the\n     * Dagger Reflect runtime as outlined in the partial reflection approach:\n     * https://github.com/jakewharton/dagger-reflect#partial-reflection\n     *\n     * Disable to use the full reflection approach. This requires changing the app's logic a bit.\n     * https://github.com/jakewharton/dagger-reflect#full-reflection\n     */\n    var addReflectAnnotationProcessor = true\n\n    var enableReflectLintCheck = true\n}\n"
  },
  {
    "path": "buildSrc/src/test/fixtures/java-module/build.gradle.kts",
    "content": "plugins {\n    java\n    application\n}\n\nrepositories {\n    mavenCentral()\n}\n\napplication {\n    mainClassName = \"com.delect.test.java.Starter\"\n}\n\ndependencies {\n    annotationProcessor(\"com.google.dagger:dagger-compiler:2.24\")\n    implementation(\"com.google.dagger:dagger:2.24\")\n}"
  },
  {
    "path": "buildSrc/src/test/fixtures/java-module/src/main/java/com/delect/test/java/AppComponent.java",
    "content": "package com.delect.test.java;\n\nimport dagger.Component;\nimport dagger.Module;\nimport dagger.Provides;\n\n@Component\npublic interface AppComponent {\n\n    @Module\n    abstract class AppModule {\n        @Provides Foo provideFoo() {\n            return new Foo();\n        }\n    }\n}\n"
  },
  {
    "path": "buildSrc/src/test/fixtures/java-module/src/main/java/com/delect/test/java/Foo.java",
    "content": "package com.delect.test.java;\n\npublic class Foo {\n    public Foo() {\n    }\n}\n"
  },
  {
    "path": "buildSrc/src/test/fixtures/java-module/src/main/java/com/delect/test/java/Starter.java",
    "content": "package com.delect.test.java;\n\npublic class Starter {\n    public static void main(String[] args) {\n        AppComponent appComponent = DaggerAppComponent.create();\n        try {\n            Class<?> daggerReflectClass = Class.forName(\"dagger.reflect.DaggerReflect\");\n            System.out.println(\"dagger reflect class is available\");\n        } catch (ClassNotFoundException e) {\n            System.out.println(\"dagger reflect class not available\");\n        }\n    }\n}\n"
  },
  {
    "path": "buildSrc/src/test/fixtures/java-module-full-reflect/build.gradle.kts",
    "content": "plugins {\n    java\n    application\n}\n\nrepositories {\n    mavenCentral()\n}\n\napplication {\n    mainClassName = \"com.delect.test.java.Starter\"\n}\n\ndependencies {\n    annotationProcessor(\"com.google.dagger:dagger-compiler:2.24\")\n    implementation(\"com.google.dagger:dagger:2.24\")\n}"
  },
  {
    "path": "buildSrc/src/test/fixtures/java-module-full-reflect/src/main/java/com/delect/test/java/AppComponent.java",
    "content": "package com.delect.test.java;\n\nimport dagger.Component;\nimport dagger.Module;\nimport dagger.Provides;\n\n@Component\npublic interface AppComponent {\n\n    @Module\n    abstract class AppModule {\n        @Provides Foo provideFoo() {\n            return new Foo();\n        }\n    }\n}\n"
  },
  {
    "path": "buildSrc/src/test/fixtures/java-module-full-reflect/src/main/java/com/delect/test/java/Foo.java",
    "content": "package com.delect.test.java;\n\npublic class Foo {\n    public Foo() {\n    }\n}\n"
  },
  {
    "path": "buildSrc/src/test/fixtures/java-module-full-reflect/src/main/java/com/delect/test/java/Starter.java",
    "content": "package com.delect.test.java;\n\nimport dagger.Dagger;\n\npublic class Starter {\n    public static void main(String[] args) {\n        AppComponent appComponent = Dagger.create(AppComponent.class);\n        try {\n            Class<?> daggerReflectClass = Class.forName(\"dagger.reflect.DaggerReflect\");\n            System.out.println(\"dagger reflect class is available\");\n        } catch (ClassNotFoundException e) {\n            System.out.println(\"dagger reflect class not available\");\n        }\n    }\n}\n"
  },
  {
    "path": "buildSrc/src/test/java/com/soundcloud/reflect/DaggerReflectPluginIntegrationTest.kt",
    "content": "package com.soundcloud.reflect\n\nimport com.google.common.truth.Truth.assertThat\nimport org.gradle.testkit.runner.GradleRunner\nimport org.junit.Rule\nimport org.junit.Test\nimport org.junit.rules.TemporaryFolder\nimport java.io.File\n\nclass DaggerReflectPluginIntegrationTest {\n    @get:Rule\n    val testProjectDir = TemporaryFolder()\n\n    @Test\n    fun `test plugin without dagger reflect enabled`() {\n        setupJavaModuleTextFixtureAndDelectPlugin()\n\n        val result = GradleRunner.create()\n            .withProjectDir(testProjectDir.root)\n            .withPluginClasspath()\n            .withArguments(\"run\")\n            .build()\n\n        assertThat(result.output).contains(\"dagger reflect class not available\")\n    }\n\n    @Test\n    fun `test plugin with dagger reflect enabled`() {\n        setupJavaModuleTextFixtureAndDelectPlugin()\n\n        enableDaggerReflect()\n        val result = GradleRunner.create()\n            .withProjectDir(testProjectDir.root)\n            .withPluginClasspath()\n            .withArguments(\"run\")\n            .build()\n\n        assertThat(result.output).contains(\"dagger reflect class is available\")\n    }\n\n    @Test\n    fun `test no code generation fails compile when referencing generated code`() {\n        val fixtureName = \"java-module\"\n        testProjectDir.newFile(\"build.gradle\").writeText(\n            \"\"\"\n            plugins {\n                id 'com.soundcloud.delect'\n            }\n            delect {\n                addReflectAnnotationProcessor = false\n            }\n            \"\"\".trimIndent()\n        )\n\n        writeSettingsGradle(fixtureName)\n        copyProjectFixture(fixtureName)\n        enableDaggerReflect()\n\n        val result = GradleRunner.create()\n            .withProjectDir(testProjectDir.root)\n            .withPluginClasspath()\n            .withArguments(\"run\")\n            .buildAndFail()\n\n        assertThat(result.output).contains(\n            \"error: cannot find symbol\\n\" +\n                \"        AppComponent appComponent = DaggerAppComponent.create();\\n\" +\n                \"                                    ^\\n\" +\n                \"  symbol:   variable DaggerAppComponent\"\n        )\n    }\n\n    @Test\n    fun `test no code generation succeeds with full reflection`() {\n        val fixtureName = \"java-module-full-reflect\"\n        testProjectDir.newFile(\"build.gradle\").writeText(\n            \"\"\"\n            plugins {\n                id 'com.soundcloud.delect'\n            }\n            delect {\n                addReflectAnnotationProcessor = false\n            }\n            \"\"\".trimIndent()\n        )\n\n        writeSettingsGradle(fixtureName)\n        copyProjectFixture(fixtureName)\n        enableDaggerReflect()\n\n        val result = GradleRunner.create()\n            .withProjectDir(testProjectDir.root)\n            .withPluginClasspath()\n            .withArguments(\"run\")\n            .build()\n\n        assertThat(result.output).contains(\"dagger reflect class is available\")\n    }\n\n    @Test\n    fun `is compatible with the configuration cache`() {\n        setupJavaModuleTextFixtureAndDelectPlugin()\n\n        enableDaggerReflect()\n        val runner = GradleRunner.create()\n            .withProjectDir(testProjectDir.root)\n            .withPluginClasspath()\n            .withGradleVersion(\"6.6\")\n            .withArguments(\"run\", \"--configuration-cache\")\n\n        val result = runner.build()\n        assertThat(result.output).contains(\"SUCCESS\")\n        assertThat(result.output).contains(\"dagger reflect class is available\")\n        assertThat(result.output).contains(\"Configuration cache entry stored.\")\n\n        val resultTwo = runner.build()\n        assertThat(resultTwo.output).contains(\"SUCCESS\")\n        assertThat(resultTwo.output).contains(\"dagger reflect class is available\")\n        assertThat(resultTwo.output).contains(\"Reusing configuration cache.\")\n    }\n\n    private fun setupJavaModuleTextFixtureAndDelectPlugin() {\n        val fixtureName = \"java-module\"\n        writePluginBuildGradle()\n\n        writeSettingsGradle(fixtureName)\n\n        copyProjectFixture(fixtureName)\n    }\n\n    private fun writePluginBuildGradle() {\n        testProjectDir.newFile(\"build.gradle\").writeText(\n            \"\"\"\n            plugins {\n                id 'com.soundcloud.delect'\n            }\n            \"\"\".trimIndent()\n        )\n    }\n\n    private fun writeSettingsGradle(moduleName: String) {\n        testProjectDir.newFile(\"settings.gradle\").writeText(\n            \"\"\"\n            include '$moduleName'\n            \"\"\".trimIndent()\n        )\n    }\n\n    private fun enableDaggerReflect() {\n        testProjectDir.newFile(\"gradle.properties\").writeText(\"dagger.reflect=true\")\n    }\n\n    private fun copyProjectFixture(fixtureName: String) {\n        File(\"src/test/fixtures/$fixtureName\").copyRecursively(testProjectDir.newFile(fixtureName), true)\n    }\n}\n"
  },
  {
    "path": "gradle/wrapper/gradle-wrapper.properties",
    "content": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-6.6-all.zip\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\n"
  },
  {
    "path": "gradle.properties",
    "content": "org.gradle.daemon=true\norg.gradle.parellel=true\n\nkotlin.code.style=official\n\ndagger.reflect=true\n"
  },
  {
    "path": "gradlew",
    "content": "#!/usr/bin/env sh\n\n#\n# Copyright 2015 the original author or authors.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS='\"-Xmx64m\" \"-Xms64m\"'\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn () {\n    echo \"$*\"\n}\n\ndie () {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\nnonstop=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\n  NONSTOP* )\n    nonstop=true\n    ;;\nesac\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" -a \"$nonstop\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin or MSYS, switch paths to Windows format before running java\nif [ \"$cygwin\" = \"true\" -o \"$msys\" = \"true\" ] ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=`expr $i + 1`\n    done\n    case $i in\n        0) set -- ;;\n        1) set -- \"$args0\" ;;\n        2) set -- \"$args0\" \"$args1\" ;;\n        3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Escape application args\nsave () {\n    for i do printf %s\\\\n \"$i\" | sed \"s/'/'\\\\\\\\''/g;1s/^/'/;\\$s/\\$/' \\\\\\\\/\" ; done\n    echo \" \"\n}\nAPP_ARGS=`save \"$@\"`\n\n# Collect all arguments for the java command, following the shell quoting and substitution rules\neval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS \"\\\"-Dorg.gradle.appname=$APP_BASE_NAME\\\"\" -classpath \"\\\"$CLASSPATH\\\"\" org.gradle.wrapper.GradleWrapperMain \"$APP_ARGS\"\n\nexec \"$JAVACMD\" \"$@\"\n"
  },
  {
    "path": "gradlew.bat",
    "content": "@rem\r\n@rem Copyright 2015 the original author or authors.\r\n@rem\r\n@rem Licensed under the Apache License, Version 2.0 (the \"License\");\r\n@rem you may not use this file except in compliance with the License.\r\n@rem You may obtain a copy of the License at\r\n@rem\r\n@rem      https://www.apache.org/licenses/LICENSE-2.0\r\n@rem\r\n@rem Unless required by applicable law or agreed to in writing, software\r\n@rem distributed under the License is distributed on an \"AS IS\" BASIS,\r\n@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n@rem See the License for the specific language governing permissions and\r\n@rem limitations under the License.\r\n@rem\r\n\r\n@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@rem  Gradle startup script for Windows\r\n@rem\r\n@rem ##########################################################################\r\n\r\n@rem Set local scope for the variables with windows NT shell\r\nif \"%OS%\"==\"Windows_NT\" setlocal\r\n\r\nset DIRNAME=%~dp0\r\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\r\nset APP_BASE_NAME=%~n0\r\nset APP_HOME=%DIRNAME%\r\n\r\n@rem Resolve any \".\" and \"..\" in APP_HOME to make it shorter.\r\nfor %%i in (\"%APP_HOME%\") do set APP_HOME=%%~fi\r\n\r\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\r\nset DEFAULT_JVM_OPTS=\"-Xmx64m\" \"-Xms64m\"\r\n\r\n@rem Find java.exe\r\nif defined JAVA_HOME goto findJavaFromJavaHome\r\n\r\nset JAVA_EXE=java.exe\r\n%JAVA_EXE% -version >NUL 2>&1\r\nif \"%ERRORLEVEL%\" == \"0\" goto execute\r\n\r\necho.\r\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:findJavaFromJavaHome\r\nset JAVA_HOME=%JAVA_HOME:\"=%\r\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\r\n\r\nif exist \"%JAVA_EXE%\" goto execute\r\n\r\necho.\r\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\r\necho.\r\necho Please set the JAVA_HOME variable in your environment to match the\r\necho location of your Java installation.\r\n\r\ngoto fail\r\n\r\n:execute\r\n@rem Setup the command line\r\n\r\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\r\n\r\n\r\n@rem Execute Gradle\r\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %*\r\n\r\n:end\r\n@rem End local scope for the variables with windows NT shell\r\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\r\n\r\n:fail\r\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\r\nrem the _cmd.exe /c_ return code!\r\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\r\nexit /b 1\r\n\r\n:mainEnd\r\nif \"%OS%\"==\"Windows_NT\" endlocal\r\n\r\n:omega\r\n"
  },
  {
    "path": "settings.gradle",
    "content": "rootProject.name = 'gradle-plugin'\n\n"
  }
]