From 1512c6ea620fa3cbc945aebfa289f889f81aec53 Mon Sep 17 00:00:00 2001 From: exceptionfactory Date: Wed, 16 Apr 2025 22:35:55 -0500 Subject: [PATCH] Set Bouncy Castle as optional feature in Gradle build - Added bouncyCastle feature for marking Bouncy Castle libraries as optional --- build.gradle | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index a5365f89..e575db33 100644 --- a/build.gradle +++ b/build.gradle @@ -49,11 +49,19 @@ configurations.implementation.transitive = false def bouncycastleVersion = "1.80" def sshdVersion = "2.15.0" +java { + withJavadocJar() + withSourcesJar() + registerFeature('bouncyCastle') { + usingSourceSet(sourceSets.main) + } +} + dependencies { implementation "org.slf4j:slf4j-api:2.0.17" - implementation "org.bouncycastle:bcprov-jdk18on:$bouncycastleVersion" - implementation "org.bouncycastle:bcpkix-jdk18on:$bouncycastleVersion" implementation "com.hierynomus:asn-one:0.6.0" + bouncyCastleImplementation "org.bouncycastle:bcprov-jdk18on:$bouncycastleVersion" + bouncyCastleImplementation "org.bouncycastle:bcpkix-jdk18on:$bouncycastleVersion" } license { @@ -68,11 +76,6 @@ license { ]) } -java { - withJavadocJar() - withSourcesJar() -} - if (!JavaVersion.current().isJava9Compatible()) { throw new GradleScriptException("Minimum compilation version is Java 9") } @@ -98,6 +101,8 @@ testing { implementation "org.apache.sshd:sshd-sftp:$sshdVersion" implementation "org.apache.sshd:sshd-scp:$sshdVersion" implementation "ch.qos.logback:logback-classic:1.5.18" + implementation "org.bouncycastle:bcprov-jdk18on:$bouncycastleVersion" + implementation "org.bouncycastle:bcpkix-jdk18on:$bouncycastleVersion" } targets {