| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | /* | 
					
						
							|  |  |  |  * Licensed to the Apache Software Foundation (ASF) under one or more | 
					
						
							|  |  |  |  * contributor license agreements.  See the NOTICE file distributed with | 
					
						
							|  |  |  |  * this work for additional information regarding copyright ownership. | 
					
						
							| 
									
										
										
										
											2019-12-28 21:03:53 +08:00
										 |  |  |  * The ASF licenses this file to you under the Apache License, Version 2.0 | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  |  * (the "License"); you may not use this file except in compliance with | 
					
						
							|  |  |  |  * the License.  You may obtain a copy of the License at | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-12-28 21:03:53 +08:00
										 |  |  |  * http://www.apache.org/licenses/LICENSE-2.0 | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Unless required by applicable law or agreed to in writing, software | 
					
						
							|  |  |  |  * distributed under the License is distributed on an "AS IS" BASIS, | 
					
						
							|  |  |  |  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
					
						
							|  |  |  |  * See the License for the specific language governing permissions and | 
					
						
							|  |  |  |  * limitations under the License. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2023-05-09 21:01:44 +08:00
										 |  |  | import com.gradle.enterprise.gradleplugin.internal.extension.BuildScanExtensionWithHiddenFeatures | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-27 20:37:49 +08:00
										 |  |  | import java.util.* | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-16 23:17:56 +08:00
										 |  |  | pluginManagement { | 
					
						
							|  |  |  |     plugins { | 
					
						
							| 
									
										
										
										
											2023-06-24 23:51:55 +08:00
										 |  |  |         id("com.github.vlsi.stage-vote-release") version "1.90" | 
					
						
							| 
									
										
										
										
											2019-10-16 23:17:56 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-19 18:26:41 +08:00
										 |  |  | plugins { | 
					
						
							| 
									
										
										
										
											2023-06-19 22:41:47 +08:00
										 |  |  |     id("com.gradle.enterprise") version "3.13.4" | 
					
						
							| 
									
										
										
										
											2023-06-29 15:32:49 +08:00
										 |  |  |     id("com.gradle.common-custom-user-data-gradle-plugin") version "1.11" | 
					
						
							| 
									
										
										
										
											2023-06-17 19:28:54 +08:00
										 |  |  |     id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" | 
					
						
							| 
									
										
										
										
											2020-08-19 18:26:41 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-23 18:40:25 +08:00
										 |  |  | dependencyResolutionManagement { | 
					
						
							|  |  |  |     repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) | 
					
						
							|  |  |  |     repositories { | 
					
						
							|  |  |  |         // TODO: support enableMavenLocal | 
					
						
							|  |  |  |         mavenCentral() | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | // This is the name of a current project | 
					
						
							|  |  |  | // Note: it cannot be inferred from the directory name as developer might clone JMeter to jmeter_tmp folder | 
					
						
							|  |  |  | rootProject.name = "jmeter" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-04-23 18:40:25 +08:00
										 |  |  | enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | includeBuild("build-logic-commons") | 
					
						
							|  |  |  | includeBuild("build-logic") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | include( | 
					
						
							| 
									
										
										
										
											2021-11-16 15:33:01 +08:00
										 |  |  |     "src:bom", | 
					
						
							| 
									
										
										
										
											2023-04-29 00:59:34 +08:00
										 |  |  |     "src:bom-testing", | 
					
						
							| 
									
										
										
										
											2023-04-23 18:40:25 +08:00
										 |  |  |     "src:bom-thirdparty", | 
					
						
							| 
									
										
										
										
											2021-11-16 15:33:01 +08:00
										 |  |  |     "src:bshclient", | 
					
						
							|  |  |  |     "src:launcher", | 
					
						
							|  |  |  |     "src:components", | 
					
						
							|  |  |  |     "src:config", | 
					
						
							|  |  |  |     "src:core", | 
					
						
							|  |  |  |     "src:examples", | 
					
						
							|  |  |  |     "src:functions", | 
					
						
							|  |  |  |     "src:generator", | 
					
						
							|  |  |  |     "src:jorphan", | 
					
						
							|  |  |  |     "src:licenses", | 
					
						
							|  |  |  |     "src:protocol:bolt", | 
					
						
							|  |  |  |     "src:protocol:ftp", | 
					
						
							|  |  |  |     "src:protocol:http", | 
					
						
							|  |  |  |     "src:protocol:java", | 
					
						
							|  |  |  |     "src:protocol:jdbc", | 
					
						
							|  |  |  |     "src:protocol:jms", | 
					
						
							|  |  |  |     "src:protocol:junit", | 
					
						
							|  |  |  |     "src:protocol:junit-sample", | 
					
						
							|  |  |  |     "src:protocol:ldap", | 
					
						
							|  |  |  |     "src:protocol:mail", | 
					
						
							|  |  |  |     "src:protocol:mongodb", | 
					
						
							|  |  |  |     "src:protocol:native", | 
					
						
							|  |  |  |     "src:protocol:tcp", | 
					
						
							|  |  |  |     "src:release", | 
					
						
							|  |  |  |     "src:testkit", | 
					
						
							|  |  |  |     "src:testkit-wiremock", | 
					
						
							| 
									
										
										
										
											2023-05-11 21:20:17 +08:00
										 |  |  |     "src:test-services", | 
					
						
							| 
									
										
										
										
											2021-11-16 15:33:01 +08:00
										 |  |  |     "src:dist", | 
					
						
							|  |  |  |     "src:dist-check" | 
					
						
							|  |  |  | ) | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | // See https://github.com/gradle/gradle/issues/1348#issuecomment-284758705 and | 
					
						
							|  |  |  | // https://github.com/gradle/gradle/issues/5321#issuecomment-387561204 | 
					
						
							|  |  |  | // Gradle inherits Ant "default excludes", however we do want to archive those files | 
					
						
							|  |  |  | org.apache.tools.ant.DirectoryScanner.removeDefaultExclude("**/.gitattributes") | 
					
						
							|  |  |  | org.apache.tools.ant.DirectoryScanner.removeDefaultExclude("**/.gitignore") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | fun String?.toBool(nullAs: Boolean, blankAs: Boolean, default: Boolean) = | 
					
						
							|  |  |  |     when { | 
					
						
							|  |  |  |         this == null -> nullAs | 
					
						
							|  |  |  |         isBlank() -> blankAs | 
					
						
							|  |  |  |         default -> !equals("false", ignoreCase = true) | 
					
						
							|  |  |  |         else -> equals("true", ignoreCase = true) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | fun property(name: String) = | 
					
						
							| 
									
										
										
										
											2021-11-16 15:33:01 +08:00
										 |  |  |     when (extra.has(name)) { | 
					
						
							|  |  |  |         true -> extra.get(name) as? String | 
					
						
							|  |  |  |         else -> null | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | if (property("localReleasePlugins").toBool(nullAs = false, blankAs = true, default = false)) { | 
					
						
							| 
									
										
										
										
											2021-11-16 15:33:01 +08:00
										 |  |  |     // This enables to use local clone of vlsi-release-plugins for debugging purposes | 
					
						
							|  |  |  |     includeBuild("../vlsi-release-plugins") | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-08-19 18:26:41 +08:00
										 |  |  | val isCiServer = System.getenv().containsKey("CI") | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-09 21:01:44 +08:00
										 |  |  | gradleEnterprise { | 
					
						
							|  |  |  |     server = "https://ge.apache.org" | 
					
						
							|  |  |  |     allowUntrustedServer = false | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     buildScan { | 
					
						
							|  |  |  |         capture { isTaskInputFiles = true } | 
					
						
							|  |  |  |         isUploadInBackground = !isCiServer | 
					
						
							|  |  |  |         publishAlways() | 
					
						
							|  |  |  |         this as BuildScanExtensionWithHiddenFeatures | 
					
						
							|  |  |  |         publishIfAuthenticated() | 
					
						
							|  |  |  |         obfuscation { | 
					
						
							|  |  |  |             ipAddresses { addresses -> addresses.map { "0.0.0.0" } } | 
					
						
							| 
									
										
										
										
											2020-08-19 18:26:41 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | // Checksum plugin sources can be validated at https://github.com/vlsi/vlsi-release-plugins | 
					
						
							|  |  |  | buildscript { | 
					
						
							| 
									
										
										
										
											2019-09-20 04:53:17 +08:00
										 |  |  |     dependencies { | 
					
						
							| 
									
										
										
										
											2019-10-16 23:17:56 +08:00
										 |  |  |         classpath("com.github.vlsi.gradle:checksum-dependency-plugin:${settings.extra["com.github.vlsi.checksum-dependency.version"]}") { | 
					
						
							| 
									
										
										
										
											2019-09-20 04:53:17 +08:00
										 |  |  |             // Gradle ships kotlin-stdlib which is good enough | 
					
						
							|  |  |  |             exclude("org.jetbrains.kotlin", "kotlin-stdlib") | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-12-03 17:00:14 +08:00
										 |  |  |         // Remove when Autostyle updates jgit dependency | 
					
						
							| 
									
										
										
										
											2023-07-10 08:50:48 +08:00
										 |  |  |         classpath("org.eclipse.jgit:org.eclipse.jgit:5.13.2.202306221912-r") | 
					
						
							| 
									
										
										
										
											2019-09-20 04:53:17 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     repositories { | 
					
						
							|  |  |  |         gradlePluginPortal() | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // Note: we need to verify the checksum for checksum-dependency-plugin itself | 
					
						
							| 
									
										
										
										
											2019-09-20 04:53:17 +08:00
										 |  |  | val expectedSha512 = mapOf( | 
					
						
							| 
									
										
										
										
											2021-12-03 17:00:14 +08:00
										 |  |  |     // TODO: remove JavaEWAH-1.1.12.jar, org.eclipse.jgit-5.13.0.202109080827-r.jar, slf4j-api-1.7.30.jar when Autostyle updates jgit | 
					
						
							|  |  |  |     "ECBBFD1C6593AFBAA4CA7F65E10BC67B12FF75EB221E490051522FAC8D291B202A0A165644A9C5AC9E5618CD771817C9052F171E5E6210CB021DF5A6E4CBF787" | 
					
						
							|  |  |  |         to "JavaEWAH-1.1.12.jar", | 
					
						
							| 
									
										
										
										
											2023-05-19 14:32:26 +08:00
										 |  |  |     "5A3821A07EEBC9B56F87054C71B9BAFA0D9D0B556AA16191F8676D748CEC755A741CD5500E8676493FFCA69E6C9608CAF86D80B60B5934EE108D77030C490194" | 
					
						
							|  |  |  |         to "JavaEWAH-1.1.13.jar", | 
					
						
							| 
									
										
										
										
											2023-06-29 15:32:49 +08:00
										 |  |  |     "761746DE12A20A9D04D395D1454220636770FE33399A49AE2D2F8E22177B261A9884FC36CB47F13CCBE5A9E9644A4EC9B1E0F657BA12ACA95E603D3A5C29E60B" | 
					
						
							|  |  |  |         to "common-custom-user-data-gradle-plugin-1.11.jar", | 
					
						
							| 
									
										
										
										
											2021-12-03 17:00:14 +08:00
										 |  |  |     "768DBB3BA2649A7025338197B4703B414983E4608138719B0D69201F7F49E57E0454846B41B775B135B083F820824749DA6121F20A812C4F155A97F09C9B15AC" | 
					
						
							|  |  |  |         to "org.eclipse.jgit-5.13.0.202109080827-r.jar", | 
					
						
							| 
									
										
										
										
											2023-05-19 14:32:26 +08:00
										 |  |  |     "DD1453E479CAC4E0D20143A1955654DC6C163916CA07C11F70F482F317BBF00A5FEDC8B198AF60BF17E9843E76DDA3103DAB3463384536F73A90AC0206CFB0E0" | 
					
						
							|  |  |  |         to "org.eclipse.jgit-5.13.1.202206130422-r.jar", | 
					
						
							| 
									
										
										
										
											2023-11-24 14:47:25 +08:00
										 |  |  |     "37ED7485AF83C40D3FC1965512F88E73D139D1CD099CFC71A7E87A38B2D2CD14BB34918718EC7F19A155AC0632B97BAC77295CFFC49F11275B1F7D82D0655357" | 
					
						
							|  |  |  |         to "org.eclipse.jgit-5.13.2.202306221912-r.jar", | 
					
						
							| 
									
										
										
										
											2021-12-03 17:00:14 +08:00
										 |  |  |     "E5435852569DDA596BA46138AF8EE9C4ECBA8A7A43F4F1E7897AEB4430523A0F037088A7B63877DF5734578F19D331F03D7B0F32D5AE6C425DF211947B3E6173" | 
					
						
							|  |  |  |         to "slf4j-api-1.7.30.jar", | 
					
						
							| 
									
										
										
										
											2023-06-19 22:41:47 +08:00
										 |  |  |     "F669488ABCCD8F6A0C631809C951BC2DADD606217C1AD99DABCBDAB11EDD85B08FF71283A18FF954290681EEDE80FD358C5D18F4C482C35F252DF8051306EF05" | 
					
						
							|  |  |  |         to "gradle-enterprise-gradle-plugin-3.13.4.jar", | 
					
						
							| 
									
										
										
										
											2023-01-11 00:43:18 +08:00
										 |  |  |     "4E240B7811EF90C090E83A181DACE41DA487555E4136221861B0060F9AF6D8B316F2DD0472F747ADB98CA5372F46055456EF04BDC0C3992188AB13302922FCE9" | 
					
						
							|  |  |  |         to "bcpg-jdk15on-1.70.jar", | 
					
						
							|  |  |  |     "7DCCFC636EE4DF1487615818CFA99C69941081DF95E8EF1EAF4BCA165594DFF9547E3774FD70DE3418ABACE77D2C45889F70BCD2E6823F8539F359E68EAF36D1" | 
					
						
							|  |  |  |         to "bcprov-jdk15on-1.70.jar", | 
					
						
							| 
									
										
										
										
											2019-09-20 04:53:17 +08:00
										 |  |  |     "17DAAF511BE98F99007D7C6B3762C9F73ADD99EAB1D222985018B0258EFBE12841BBFB8F213A78AA5300F7A3618ACF252F2EEAD196DF3F8115B9F5ED888FE827" | 
					
						
							| 
									
										
										
										
											2021-11-16 15:33:01 +08:00
										 |  |  |         to "okhttp-4.1.0.jar", | 
					
						
							| 
									
										
										
										
											2019-09-20 04:53:17 +08:00
										 |  |  |     "93E7A41BE44CC17FB500EA5CD84D515204C180AEC934491D11FC6A71DAEA761FB0EECEF865D6FD5C3D88AAF55DCE3C2C424BE5BA5D43BEBF48D05F1FA63FA8A7" | 
					
						
							| 
									
										
										
										
											2021-11-16 15:33:01 +08:00
										 |  |  |         to "okio-2.2.2.jar", | 
					
						
							| 
									
										
										
										
											2023-06-17 19:28:54 +08:00
										 |  |  |     "B9F87DECE28EABCCEDA58C77C3B602AEAE7A8AEF3D30DA838F4924A620B18C05D9DF86C5876BDE8AB5597C8C0CE808AD083CAF89C3A5AAC60C1E980C6C144A17" | 
					
						
							|  |  |  |         to "foojay-resolver-0.5.0.jar", | 
					
						
							|  |  |  |     "10BF91C79AB151B684834E3CA8BA7D7E19742A3EEB580BDE690FBA433F9FFFE3ABBD79ED3FE3F97986C3A2BADC4D14E28835A8EF89167B4B9CC6014242338769" | 
					
						
							|  |  |  |         to "gson-2.9.1.jar", | 
					
						
							| 
									
										
										
										
											2019-10-16 23:17:56 +08:00
										 |  |  |     settings.extra["com.github.vlsi.checksum-dependency.sha512"].toString() | 
					
						
							| 
									
										
										
										
											2021-11-16 15:33:01 +08:00
										 |  |  |         to "checksum-dependency-plugin.jar" | 
					
						
							| 
									
										
										
										
											2019-09-20 04:53:17 +08:00
										 |  |  | ) | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | fun File.sha512(): String { | 
					
						
							| 
									
										
										
										
											2019-09-20 04:53:17 +08:00
										 |  |  |     val md = java.security.MessageDigest.getInstance("SHA-512") | 
					
						
							|  |  |  |     forEachBlock { buffer, bytesRead -> | 
					
						
							|  |  |  |         md.update(buffer, 0, bytesRead) | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2023-04-27 20:37:49 +08:00
										 |  |  |     return BigInteger(1, md.digest()).toString(16).uppercase(Locale.ROOT) | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-09-20 04:53:17 +08:00
										 |  |  | val violations = | 
					
						
							|  |  |  |     buildscript.configurations["classpath"] | 
					
						
							|  |  |  |         .resolve() | 
					
						
							|  |  |  |         .sortedBy { it.name } | 
					
						
							|  |  |  |         .associateWith { it.sha512() } | 
					
						
							|  |  |  |         .filterNot { (_, sha512) -> expectedSha512.contains(sha512) } | 
					
						
							|  |  |  |         .entries | 
					
						
							|  |  |  |         .joinToString("\n  ") { (file, sha512) -> "SHA-512(${file.name}) = $sha512 ($file)" } | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-05 18:37:40 +08:00
										 |  |  | if (violations.isNotBlank()) { | 
					
						
							| 
									
										
										
										
											2020-08-19 18:26:41 +08:00
										 |  |  |     throw GradleException("Buildscript classpath has files that were not explicitly permitted:\n  $violations") | 
					
						
							| 
									
										
										
										
											2019-10-05 18:37:40 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-02-25 04:51:10 +08:00
										 |  |  | apply(plugin = "com.github.vlsi.checksum-dependency") | 
					
						
							| 
									
										
										
										
											2019-12-28 05:32:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | // This enables to try local Autostyle | 
					
						
							|  |  |  | property("localAutostyle")?.ifBlank { "../autostyle" }?.let { | 
					
						
							|  |  |  |     println("Importing project '$it'") | 
					
						
							| 
									
										
										
										
											2020-02-15 02:45:45 +08:00
										 |  |  |     includeBuild(it) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | property("localDarklaf")?.ifBlank { "../darklaf" }?.let { | 
					
						
							|  |  |  |     println("Importing project '$it'") | 
					
						
							|  |  |  |     includeBuild(it) | 
					
						
							| 
									
										
										
										
											2019-12-28 05:32:21 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2023-05-09 21:01:44 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | buildCache { | 
					
						
							|  |  |  |     local { | 
					
						
							|  |  |  |         isEnabled = !isCiServer | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     remote(gradleEnterprise.buildCache) { | 
					
						
							|  |  |  |         isEnabled = false | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |