Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Format java code #103

Merged
merged 5 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/release-java-bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ concurrency:
cancel-in-progress: true

jobs:
format:
name: Check Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref || github.ref }}
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
- name: Check formatting
run: ./gradlew spotlessCheck
working-directory: bindings/java/java_code

build:
name: Build - ${{ matrix.target }}
runs-on: ${{ matrix.os }}
Expand Down
148 changes: 83 additions & 65 deletions bindings/java/java_code/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,35 @@ plugins {
group = 'io.github.crate-crypto'
version = '0.0.3'

spotless {
java {
// Apply Google's Java formatting style
googleJavaFormat()

// Remove unused imports
importOrder()
removeUnusedImports()

// Enforce Unix line endings
endWithNewline()
indentWithSpaces(4)
trimTrailingWhitespace()
}

// Use a simpler formatter for Gradle files
groovy {
target '*.gradle'
// Basic formatting rules instead of Eclipse formatter
// which seems to have issues on arm64-linux
indentWithSpaces(4)
trimTrailingWhitespace()
endWithNewline()
}
}

java {
withJavadocJar()
withSourcesJar()
withJavadocJar()
withSourcesJar()
}

repositories {
Expand All @@ -30,17 +55,14 @@ if (hasProperty('buildScan')) {
dependencies {
testImplementation platform('org.junit:junit-bom:5.10.0')
testImplementation 'org.junit.jupiter:junit-jupiter'

implementation 'net.java.dev.jna:jna:5.12.1'
testImplementation 'io.tmio:tuweni-bytes:2.4.2'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.7.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.12.5'
testImplementation 'org.assertj:assertj-core:3.22.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'

def jacksonVersion = "2.14.2"

testFixturesImplementation("org.apache.tuweni:tuweni-units:2.3.1")
testFixturesImplementation("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}")
testFixturesImplementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jacksonVersion}")
Expand All @@ -51,79 +73,75 @@ test {
dependsOn cleanTest
testLogging.showStandardStreams = true
}

publishing {
publications {
maven(MavenPublication) {
from components.java

pom {
name = 'Verkle Cryptography Library'
description = 'A library for working with Cryptography used in verkle trie'
url = 'https://github.com/crate-crypto/rust-verkle'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'kevthedev'
name = 'Kevaundray Wedderburn'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/crate-crypto/rust-verkle.git'
developerConnection = 'scm:git:ssh://github.com:crate-crypto/rust-verkle.git'
url = 'https://github.com/crate-crypto/rust-verkle'
publishing {
publications {
maven(MavenPublication) {
from components.java
pom {
name = 'Verkle Cryptography Library'
description = 'A library for working with Cryptography used in verkle trie'
url = 'https://github.com/crate-crypto/rust-verkle'
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = 'kevthedev'
name = 'Kevaundray Wedderburn'
email = '[email protected]'
}
}
scm {
connection = 'scm:git:git://github.com/crate-crypto/rust-verkle.git'
developerConnection = 'scm:git:ssh://github.com:crate-crypto/rust-verkle.git'
url = 'https://github.com/crate-crypto/rust-verkle'
}
}
}
}
}
}

repositories {
maven {
url = layout.buildDirectory.dir('staging-deploy')
repositories {
maven {
url = layout.buildDirectory.dir('staging-deploy')
}
}
}
}

jreleaser {
// Jreleaser will look for .git and its at the top level repository
gitRootSearch = true
release {
// Skip releases as this is handled by release-please
github {
skipRelease = true
gitRootSearch = true
release {
github {
skipRelease = true
}
}
signing {
active = 'ALWAYS'
armored = true
}
}
signing {
active = 'ALWAYS'
armored = true
}
deploy {
maven {
mavenCentral {
sonatype {
active = 'ALWAYS'
url = 'https://central.sonatype.com/api/v1/publisher'
stagingRepository('build/staging-deploy')
deploy {
maven {
mavenCentral {
sonatype {
active = 'ALWAYS'
url = 'https://central.sonatype.com/api/v1/publisher'
stagingRepository('build/staging-deploy')
}
}
}
}
}
}
}

// JReleaser does not create this directory, so we manually create it
// JReleaser does not create this directory, so we manually create it
// ourselves.
tasks.register('createJReleaserOutputDir') {
doLast {
mkdir 'build/jreleaser'
}
doLast {
mkdir 'build/jreleaser'
}
}

tasks.named('jreleaserFullRelease') {
dependsOn 'createJReleaserOutputDir'
}
dependsOn 'createJReleaserOutputDir'
}
1 change: 0 additions & 1 deletion bindings/java/java_code/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
rootProject.name = 'java-verkle-cryptography'

Loading
Loading