GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Improved gradle buildscript · Issue #219 · hyperxpro/Brotli4j Closed DescriptionHi, I took the buildscript listed in the README and improved it to be substantially less awful. Instead of doing what is listed in the README, you can add a component metadata rule: @CacheableRule abstract class Brotli4JRule : ComponentMetadataRule { data class NativeVariant(val os: String, val arch: String, val classifier: String) private val nativeVariants = listOf( NativeVariant(OperatingSystemFamily.WINDOWS, Architectures.AARCH64.canonicalName, "windows-aarch64"), NativeVariant(OperatingSystemFamily.WINDOWS, Architectures.X86_64.canonicalName, "windows-x86_64"), NativeVariant(OperatingSystemFamily.MACOS, Architectures.X86_64.canonicalName, "osx-x86_64"), NativeVariant(OperatingSystemFamily.MACOS, Architectures.AARCH64.canonicalName, "osx-aarch64"), NativeVariant(OperatingSystemFamily.LINUX, Architectures.X86_64.canonicalName, "linux-x86_64"), NativeVariant(OperatingSystemFamily.LINUX, Architectures.AARCH64.canonicalName, "linux-aarch64"), NativeVariant(OperatingSystemFamily.LINUX, Architectures.ARM_V7.canonicalName, "linux-armv7"), NativeVariant(OperatingSystemFamily.LINUX, "s390x", "linux-s390x"), NativeVariant(OperatingSystemFamily.LINUX, "riscv64", "linux-riscv64"), NativeVariant(OperatingSystemFamily.LINUX, "ppc64le", "linux-ppc64le"), ) @get:Inject abstract val objects: ObjectFactory override fun execute(context: ComponentMetadataContext) { listOf("compile", "runtime").forEach { base -> addVariant(context, base) } } private fun addVariant(context: ComponentMetadataContext, base: String) { val version = context.details.id.version nativeVariants.forEach { variant -> context.details.addVariant("${variant.classifier}-${base}", base) { attributes { attributes.attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named(variant.os)) attributes.attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named(variant.arch)) } withFiles { addFile("native-${variant.classifier}-${version}.jar", "../../native-${variant.classifier}/${version}/native-${variant.classifier}-${version}.jar") } } } context.details.addVariant("all-${base}", base) { attributes { attributes.attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named("all")) attributes.attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named("all")) } withFiles { nativeVariants.forEach { variant -> addFile("native-${variant.classifier}-${version}.jar", "../../native-${variant.classifier}/${version}/native-${variant.classifier}-${version}.jar") } } } context.details.withVariant(base) { this.withFiles { this.removeAllFiles() } } } } you can use this rule in one of two ways:
then, you just add a dependency on this would be significantly easier if all of those additional variants were all just different classifiers of the original jar, eg. in maven you might have related: #142 to add support for shadow, you would then also include the following: configurations.named { it.contains("shadow", true) }.configureEach {
attributes {
attribute(OperatingSystemFamily.OPERATING_SYSTEM_ATTRIBUTE, objects.named("all"))
attribute(MachineArchitecture.ARCHITECTURE_ATTRIBUTE, objects.named("all"))
}
}all of these were using the kotlin DSL, however it shouldn't be too difficult to translate to the groovy DSL. Activity
MetadataMetadataAssigneesLabelsNo labels TypeProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |