Skip to content

Commit

Permalink
Merge pull request #42 from FigureTechnologies/renovate/gradle-8.x
Browse files Browse the repository at this point in the history
Update dependency gradle from `7.6.1` to `v8`
  • Loading branch information
mtps authored May 2, 2023
2 parents 04ab46a + 7080eb1 commit f845580
Show file tree
Hide file tree
Showing 32 changed files with 339 additions and 224 deletions.
11 changes: 11 additions & 0 deletions .build-logic/local-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
}

dependencies {
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
}
31 changes: 31 additions & 0 deletions .build-logic/local-plugins/src/main/kotlin/with-core.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import org.gradle.api.JavaVersion
import org.gradle.kotlin.dsl.repositories

val libs = the<org.gradle.accessors.dm.LibrariesForLibs>()

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
java
`java-library`
}

java {
withSourcesJar()
withJavadocJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

repositories {
mavenCentral()
}

dependencies {
implementation(platform("org.jetbrains.kotlin:kotlin-bom"))
implementation("org.jetbrains.kotlin", "kotlin-stdlib-jdk8")
implementation("org.jetbrains.kotlin", "kotlin-stdlib")
implementation("org.jetbrains.kotlin", "kotlin-reflect")

implementation(libs.bouncyCastle)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.signing

val libs = the<org.gradle.accessors.dm.LibrariesForLibs>()

val artifactName = if (name.startsWith("hdwallet")) name else "hdwallet-$name"

inner class PublishingInfo {
val group = "tech.figure"
val name = "Provenance HDWallet Implementation"
val description = "A collection of libraries to facilitate HDWallet usage"
val url = "https://figure.tech"
}

val info = PublishingInfo()

plugins {
`maven-publish`
signing
}

val projectGroup = "tech.figure.hdwallet"
val projectVersion = project.property("version")?.takeIf { it != "unspecified" } ?: "1.0-SNAPSHOT"


publishing {
publications {
create<MavenPublication>("maven") {
groupId = info.group
artifactId = artifactName
version = projectVersion.toString()

from(components["java"])

pom {
name.set(info.name)
description.set(info.description)
url.set(info.url)

licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}

developers {
developer {
id.set("[email protected]")
name.set("Figure Technologies")
email.set("[email protected]")
}
}

scm {
connection.set("[email protected]:FigureTechnologies/hdwallet.git")
developerConnection.set("[email protected]/FigureTechnologies/hdwallet.git")
url.set("https://github.com/FigureTechnologies/hdwallet")
}
}
}
}
signing {
setRequired {
gradle.taskGraph.allTasks.any { it is PublishToMavenRepository }
}
sign(publishing.publications["maven"])
}
}
12 changes: 12 additions & 0 deletions .build-logic/local-plugins/src/main/kotlin/with-testing.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
val libs = the<org.gradle.accessors.dm.LibrariesForLibs>()

plugins {
`java-library`
}

dependencies {
testImplementation(libs.bundles.junit)

testImplementation(libs.commons.codec)
testImplementation(libs.jackson.kotlin)
}
19 changes: 19 additions & 0 deletions .build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
rootProject.name = "build-logic"

// This is for the kotlin-dsl
dependencyResolutionManagement {
repositories {
mavenCentral()
gradlePluginPortal() // so that external plugins can be resolved in dependencies section
}

// kinda hacky way to make a catalog from our own catalog, but it works!
// Link: https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

include("local-plugins")
5 changes: 3 additions & 2 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ jobs:
- name: Java Setup
uses: actions/setup-java@v1
with:
java-version: 11
java-version: '17'
distribution: 'zulu'
server-id: github

- name: GPG Setup
Expand All @@ -40,7 +41,7 @@ jobs:
- name: Build with Gradle
run: |
./gradlew clean build :jacocoTestReport --refresh-dependencies -Pversion=$VERSION
./gradlew clean build --refresh-dependencies -Pversion=$VERSION
- name: Publish to Maven Central
# if: github.event_name == 'release'
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ jobs:
# Store version for later use.
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 11
java-version: '17'
distribution: 'zulu'
server-id: github

- name: Build with Gradle
Expand Down
12 changes: 10 additions & 2 deletions base58/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
dependencies {
implementation(project(":common"))
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("with-core")
id("with-testing")
id("with-publishing")
}

dependencies {
implementation(projects.common)
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* numbers), and finally represent the resulting base-58 digits as alphanumeric ASCII characters.
*/
public class Base58 {
/** Base58 alphabet. */
public static final char[] ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz".toCharArray();
private static final char ENCODED_ZERO = ALPHABET[0];
private static final int[] INDEXES = new int[128];
Expand Down Expand Up @@ -153,6 +154,12 @@ public static byte[] decode(String input) throws InvalidCharacter {
return Arrays.copyOfRange(decoded, outputStart - zeros, decoded.length);
}

/**
* Decode the input from a base58 string into a BigInteger representation of the byte array.
* @param input The base58 encoded input to decode.
* @return BigInteger representation of the byte array.
* @throws InvalidCharacter if the input contains an invalid character.
*/
public static BigInteger decodeToBigInteger(String input) throws InvalidCharacter {
return new BigInteger(1, decode(input));
}
Expand All @@ -163,8 +170,10 @@ public static BigInteger decodeToBigInteger(String input) throws InvalidCharacte
* removed from the returned data.
*
* @param input the base58-encoded string to decode (which should include the checksum)
* @return byte array of decoded base58 string.
* @throws InvalidDataLength if the input is not base 58.
* @throws InvalidChecksum if the checksum does not validate.
* @throws InvalidCharacter if the input contains an invalid character.
*/
public static byte[] decodeChecked(String input) throws InvalidDataLength, InvalidChecksum, InvalidCharacter {
byte[] decoded = decode(input);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package tech.figure.hdwallet.encoding.shadow.org.bitcoinj.core;

/**
* InvalidCharacter exception type.
*/
public class InvalidCharacter extends Throwable {
/**
* @param c the invalid character.
* @param i the location of the invalid character.
*/
public InvalidCharacter(char c, int i) {
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
package tech.figure.hdwallet.encoding.shadow.org.bitcoinj.core;

/**
* InvalidChecksum exception type.
*/
public class InvalidChecksum extends Throwable {
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
package tech.figure.hdwallet.encoding.shadow.org.bitcoinj.core;

/**
* InvalidDataLength exception type.
*/
public class InvalidDataLength extends Throwable {
/**
* InvalidDataLength
* @param s the error message.
*/
public InvalidDataLength(String s) {
super(s);
}
Expand Down
8 changes: 7 additions & 1 deletion bech32/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
plugins {
id("with-core")
id("with-testing")
id("with-publishing")
}

dependencies {
implementation("commons-codec", "commons-codec", Versions.commonsCodec)
implementation(libs.commons.codec)
}
13 changes: 11 additions & 2 deletions bip32/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
plugins {
id("with-core")
id("with-testing")
id("with-publishing")
}

dependencies {
listOf(":base58", ":bip39", ":bip44", ":ec", ":common")
.map { implementation(project(it)) }
implementation(projects.base58)
implementation(projects.bip39)
implementation(projects.bip44)
implementation(projects.ec)
implementation(projects.common)
}
11 changes: 8 additions & 3 deletions bip39/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
plugins {
id("with-core")
id("with-testing")
id("with-publishing")
}

dependencies {
implementation(project(":common"))
testImplementation("commons-codec", "commons-codec", Versions.commonsCodec)
testImplementation("com.fasterxml.jackson.module", "jackson-module-kotlin", Versions.jackson)
implementation(projects.common)
implementation(libs.bouncyCastle)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import com.fasterxml.jackson.module.kotlin.registerKotlinModule
object Json {
val om = ObjectMapper().registerKotlinModule()

inline fun String.asTree(): TreeNode = om.readTree(this)
fun String.asTree(): TreeNode = om.readTree(this)
}
7 changes: 5 additions & 2 deletions bip44/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
dependencies {
}
plugins {
id("with-core")
id("with-testing")
id("with-publishing")
}
2 changes: 1 addition & 1 deletion bip44/src/main/kotlin/tech/figure/hdwallet/bip44/Paths.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object PathElements {

}

internal fun List<PathElement>.toString() =
internal fun List<PathElement>.toPathString() =
(listOf("m") + map { it.toString() }).joinToString("/")

const val BIP44_HARDENING_FLAG = 0x80000000.toInt()
Expand Down
Loading

0 comments on commit f845580

Please sign in to comment.