Morten Krogh-Jespersen | 81c3408 | 2023-06-22 15:37:41 +0200 | [diff] [blame] | 1 | // Copyright (c) 2023, the R8 project authors. Please see the AUTHORS file |
| 2 | // for details. All rights reserved. Use of this source code is governed by a |
| 3 | // BSD-style license that can be found in the LICENSE file. |
| 4 | |
| 5 | import org.gradle.api.JavaVersion |
| 6 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile |
| 7 | |
| 8 | plugins { |
| 9 | `kotlin-dsl` |
| 10 | `java-library` |
| 11 | id("dependencies-plugin") |
| 12 | } |
| 13 | |
| 14 | val root = getRoot() |
| 15 | |
| 16 | java { |
| 17 | sourceSets.test.configure { |
| 18 | java.srcDirs.clear() |
| 19 | java.srcDir(root.resolveAll("src", "test", "examples")) |
| 20 | } |
| 21 | sourceCompatibility = JavaVersion.VERSION_1_8 |
| 22 | targetCompatibility = JavaVersion.VERSION_1_8 |
| 23 | } |
| 24 | |
| 25 | dependencies { |
| 26 | testCompileOnly(Deps.mockito) |
| 27 | } |
| 28 | |
Morten Krogh-Jespersen | 836cf30 | 2023-08-07 14:06:10 +0200 | [diff] [blame] | 29 | val thirdPartyCompileDependenciesTask = ensureThirdPartyDependencies( |
| 30 | "compileDeps", |
| 31 | listOf(Jdk.JDK_11.getThirdPartyDependency())) |
| 32 | |
Morten Krogh-Jespersen | 81c3408 | 2023-06-22 15:37:41 +0200 | [diff] [blame] | 33 | tasks { |
Morten Krogh-Jespersen | b823d0b | 2023-08-07 14:06:49 +0200 | [diff] [blame] | 34 | compileTestJava { |
| 35 | options.compilerArgs = listOf("-g:source,lines") |
| 36 | } |
| 37 | |
| 38 | register<JavaCompile>("debuginfo-all") { |
| 39 | source = sourceSets.test.get().allSource |
| 40 | include("**/*.java") |
| 41 | classpath = sourceSets.test.get().compileClasspath |
| 42 | destinationDirectory.set(getRoot().resolveAll("build","test","examples","classes_debuginfo_all")) |
| 43 | options.compilerArgs = listOf("-g") |
| 44 | } |
| 45 | |
| 46 | register<JavaCompile>("debuginfo-none") { |
| 47 | source = sourceSets.test.get().allSource |
| 48 | include("**/*.java") |
| 49 | classpath = sourceSets.test.get().compileClasspath |
| 50 | destinationDirectory.set(getRoot().resolveAll("build","test","examples","classes_debuginfo_none")) |
| 51 | options.compilerArgs = listOf("-g:none") |
Morten Krogh-Jespersen | 81c3408 | 2023-06-22 15:37:41 +0200 | [diff] [blame] | 52 | } |
| 53 | } |
Morten Krogh-Jespersen | b823d0b | 2023-08-07 14:06:49 +0200 | [diff] [blame] | 54 | |
| 55 | // We just need to register the examples jars for it to be referenced by other modules. This should |
| 56 | // be placed after all task registrations. |
| 57 | val buildExampleJars = buildExampleJars("examples") |