github.com/apache/beam/sdks/v2@v2.48.2/java/container/agent/build.gradle (about) 1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * License); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an AS IS BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 plugins { 20 id 'org.apache.beam.module' 21 } 22 23 if (project.hasProperty('java11Home')) { 24 javaVersion = "1.11" 25 } else if (project.hasProperty('java17Home')) { 26 javaVersion = "1.17" 27 } 28 29 applyJavaNature( 30 exportJavadoc: false, 31 publish: false 32 ) 33 34 description = "Apache Beam :: SDKs :: Java :: Container :: Agent" 35 36 jar { 37 manifest { 38 attributes("Agent-Class": "org.apache.beam.agent.OpenModuleAgent", 39 "Can-Redefine-Classes": true, 40 "Can-Retransform-Classes": true, 41 "Premain-Class": "org.apache.beam.agent.OpenModuleAgent") 42 } 43 } 44 45 if (project.hasProperty('java11Home')) { 46 def java11Home = project.findProperty('java11Home') 47 project.tasks.withType(JavaCompile) { 48 options.fork = true 49 options.forkOptions.javaHome = java11Home as File 50 options.compilerArgs += ['-Xlint:-path'] 51 } 52 } else if (project.hasProperty('java17Home')) { 53 project.tasks.withType(JavaCompile) { 54 setJava17Options(options) 55 56 checkerFramework { 57 skipCheckerFramework = true 58 } 59 } 60 } 61 62 // Module classes requires JDK > 8 63 project.tasks.each { 64 it.onlyIf { 65 project.hasProperty('java11Home') || project.hasProperty('java17Home') 66 || JavaVersion.VERSION_1_8.compareTo(JavaVersion.current()) < 0 67 } 68 }