|
| 1 | +import org.elasticsearch.gradle.internal.info.BuildParams |
| 2 | + |
| 3 | +/* |
| 4 | + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one |
| 5 | + * or more contributor license agreements. Licensed under the Elastic License |
| 6 | + * 2.0 and the Server Side Public License, v 1; you may not use this file except |
| 7 | + * in compliance with, at your election, the Elastic License 2.0 or the Server |
| 8 | + * Side Public License, v 1. |
| 9 | + */ |
| 10 | +apply plugin: 'elasticsearch.publish' |
| 11 | + |
| 12 | +// we want to keep the JDKs in our IDEs set to JDK 8 until minimum JDK is bumped to 11 so we do not include this source set in our IDEs |
| 13 | +if (!isEclipse) { |
| 14 | + sourceSets { |
| 15 | + java9 { |
| 16 | + java { |
| 17 | + srcDirs = ['src/main/java9'] |
| 18 | + } |
| 19 | + } |
| 20 | + } |
| 21 | + |
| 22 | + configurations { |
| 23 | + java9Compile.extendsFrom(compile) |
| 24 | + } |
| 25 | + |
| 26 | + dependencies { |
| 27 | + java9Implementation sourceSets.main.output |
| 28 | + java9Implementation 'org.lz4:lz4-java:1.8.0' |
| 29 | + } |
| 30 | + |
| 31 | + tasks.named('compileJava9Java').configure { |
| 32 | + sourceCompatibility = 9 |
| 33 | + targetCompatibility = 9 |
| 34 | + } |
| 35 | + |
| 36 | + tasks.named('forbiddenApisJava9').configure { |
| 37 | + if (BuildParams.runtimeJavaVersion < JavaVersion.VERSION_1_9) { |
| 38 | + targetCompatibility = JavaVersion.VERSION_1_9.getMajorVersion() |
| 39 | + } |
| 40 | + replaceSignatureFiles 'jdk-signatures' |
| 41 | + } |
| 42 | + |
| 43 | + tasks.named('jar').configure { |
| 44 | + metaInf { |
| 45 | + into 'versions/9' |
| 46 | + from sourceSets.java9.output |
| 47 | + } |
| 48 | + manifest.attributes('Multi-Release': 'true') |
| 49 | + } |
| 50 | +} |
| 51 | + |
| 52 | +sourceSets { |
| 53 | + test { |
| 54 | + runtimeClasspath = project.objects.fileCollection().from( |
| 55 | + output, |
| 56 | + tasks.named('jar'), |
| 57 | + project.configurations.testRuntimeClasspath) |
| 58 | + } |
| 59 | +} |
| 60 | + |
| 61 | +dependencies { |
| 62 | + api 'org.lz4:lz4-java:1.8.0' |
| 63 | + api project(':libs:elasticsearch-core') |
| 64 | + |
| 65 | + testImplementation(project(":test:framework")) { |
| 66 | + exclude group: 'org.elasticsearch', module: 'elasticsearch-lz4' |
| 67 | + } |
| 68 | +} |
| 69 | + |
| 70 | +tasks.named("forbiddenPatterns").configure { |
| 71 | + exclude '**/*.binary' |
| 72 | +} |
| 73 | + |
| 74 | +tasks.named('forbiddenApisMain').configure { |
| 75 | + // lz4 does not depend on core, so only jdk signatures should be checked |
| 76 | + replaceSignatureFiles 'jdk-signatures' |
| 77 | +} |
| 78 | + |
| 79 | +tasks.named("thirdPartyAudit").configure { |
| 80 | + ignoreViolations( |
| 81 | + // from java-lz4 |
| 82 | + 'net.jpountz.util.UnsafeUtils' |
| 83 | + ) |
| 84 | +} |
0 commit comments