summaryrefslogtreecommitdiff
path: root/test_project/app/build.gradle.kts
blob: b5da6e1e47f5cb6353093888a080fc848bdb82f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
plugins {
    id("com.android.application")
}

android {
    namespace = "org.the_jk.testproject"
    compileSdk {
        version = release(37)
    }

    defaultConfig {
        applicationId = "org.the_jk.testproject"
        minSdk = 26
        targetSdk = 37
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            optimization {
                enable = true
                packageScope = setOf("androidx.**", "kotlin.**", "kotlinx.**")
            }
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
}

dependencies {
    implementation(libs.androidx.appcompat)
    implementation(libs.androidx.core.ktx)
    implementation(libs.material)
    testImplementation(libs.junit)
    androidTestImplementation(libs.androidx.espresso.core)
    androidTestImplementation(libs.androidx.junit)
}

// kotlin-proxy: shadow the Kotlin compiler in the compile DAEMON by putting
// the stub jar FIRST on its classpath (the kotlinBuildToolsApiClasspath
// configuration, whose resolved file order becomes the daemon's -cp).
//
// KGP adds kotlin-build-tools-compat/-impl to this configuration itself, so
// only the stub jar needs to be declared here - first, to win the lookup.
//
// Deliberately NO configuration-time resolution (no Configuration.files /
// .incoming access): AGP's DependencyResolutionChecks raises
// "was resolved during configuration time" for that. Declaring a dependency
// does not resolve; resolution happens at execution time when the compile
// task runs.
val proxyStubJar = file("/home/the_jk/source/kotlin_proxy/dist/kotlin-proxy-compiler-stubs.jar")
afterEvaluate {
    try {
        configurations.getByName("kotlinBuildToolsApiClasspath")
            .dependencies.add(dependencies.create(files(proxyStubJar)))
        logger.lifecycle("kotlin-proxy: stub jar present=" + proxyStubJar.exists())
    } catch (t: Throwable) {
        logger.lifecycle("kotlin-proxy: AGP injection FAILED: " + t)
    }
}