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

multiple subprojects #33

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
154 changes: 154 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
plugins {
id "java"
id "com.diffplug.spotless" version "6.19.0"
id "net.ltgt.errorprone" version "3.1.0"
}

// ignore root project
spotless.enforceCheck(false)
jar.enabled(false)

allprojects {
apply plugin: 'java'
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'checkstyle'
apply plugin: 'com.diffplug.spotless'
apply plugin: 'net.ltgt.errorprone'

repositories {
mavenCentral()
maven {
url "https://artifacts.consensys.net/public/teku/maven/"
}
maven {
url "https://dl.cloudsmith.io/public/libp2p/jvm-libp2p/maven/"
}
maven {
url "https://hyperledger.jfrog.io/artifactory/besu-maven/"
}
maven {
url "https://artifacts.consensys.net/public/maven/maven/"
}
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(20)
}
withJavadocJar()
withSourcesJar()
}

javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
options.addBooleanOption('-enable-preview', true)
options.addStringOption('-release', '20')
options.addStringOption('-add-modules', 'jdk.incubator.concurrent')
}

jacoco {
toolVersion = "0.8.9"
}

jacocoTestReport {
dependsOn test

reports {
csv.required = true
}
}

jacocoTestCoverageVerification {
violationRules {
rule {
limit {
minimum = 0
}
}
}
}

check {
dependsOn += jacocoTestCoverageVerification
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
finalizedBy jacocoTestReport
}

checkstyle {
toolVersion = '10.10.0'
// default checkstyle config -- specific to your team agreement
configFile = project(":").file("config/checkstyle/google_checks.xml")
}

spotless {
// optional: limit format enforcement to just the files changed by this feature branch
// ratchetFrom 'origin/main'

format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'

// define the steps to apply to those files
trimTrailingWhitespace()
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// Use the default importOrder configuration
// don't need to set target, it is inferred from java
// apply a specific flavor of google-java-format
googleJavaFormat('1.17.0')
// fix formatting of type annotations
formatAnnotations()

licenseHeaderFile(project(":").file("config/spotless/java.license")).named('hildr').onlyIfContentMatches('/*\n' +
' * Copyright 2023 281165273grape@gmail.com')
licenseHeaderFile(project(":").file("config/spotless/besu.license")).named('besu').onlyIfContentMatches('/*\n' +
' * Copyright ConsenSys AG')
licenseHeaderFile(project(":").file("config/spotless/java-thinkAfCod.license")).named('hildr-batcher').onlyIfContentMatches('/*\n' +
' * Copyright 2023 q315xia@163.com')

importOrder()

removeUnusedImports()
}
}

tasks.withType(Test).configureEach {
def outputDir = reports.junitXml.outputLocation
jvmArgumentProviders << ({
[
"-Djunit.platform.reporting.open.xml.enabled=true",
"-Djunit.platform.reporting.output.dir=${outputDir.get().asFile.absolutePath}",
"--enable-preview"
]
} as CommandLineArgumentProvider)
}

tasks.withType(JavaCompile).configureEach {
options.annotationProcessorPath = configurations.annotationProcessor
options.compilerArgs += "--enable-preview"
options.compilerArgs += "-Xlint:preview"
options.compilerArgs += ["--add-modules", "jdk.incubator.concurrent"]
options.compilerArgs += ["-Aproject=${project.group}/${project.name}"]
}

tasks.withType(Test).configureEach {
jvmArgs += "--enable-preview"
jvmArgs += ["--add-modules", "jdk.incubator.concurrent"]
}

tasks.withType(JavaExec).configureEach {
jvmArgs += "--enable-preview"
jvmArgs += ["--add-modules", "jdk.incubator.concurrent"]
}
}
15 changes: 15 additions & 0 deletions config/spotless/java-thinkAfCod.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright 2023 q315xia@163.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*/
170 changes: 1 addition & 169 deletions hildr-batcher/build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,9 @@
plugins {
id 'java'
id 'application'
id 'checkstyle'
id "jacoco"
id "com.diffplug.spotless" version "6.19.0"
id "net.ltgt.errorprone" version "3.1.0"
id 'org.graalvm.buildtools.native' version '0.9.22'
}

group = 'io.optimism'
version = '0.1.0'

repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
maven {
url "https://artifacts.consensys.net/public/teku/maven/"
}
maven {
url "https://dl.cloudsmith.io/public/libp2p/jvm-libp2p/maven/"
}
maven {
url "https://hyperledger.jfrog.io/artifactory/besu-maven/"
}
maven {
url "https://artifacts.consensys.net/public/maven/maven/"
}
}
version = '0.1.1'

application {
// Define the main class for the application.
Expand Down Expand Up @@ -107,151 +84,6 @@ dependencies {
errorprone("com.google.errorprone:error_prone_core:2.18.0")
}

// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(20)
}
}

test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
finalizedBy jacocoTestReport
}

jacoco {
toolVersion = "0.8.9"
}

jacocoTestReport {
dependsOn test

reports {
csv.required = true
}
}

jacocoTestCoverageVerification {

violationRules {
rule {
limit {
minimum = 0
}
}
}
}

checkstyle {
toolVersion = '10.10.0'
// default checkstyle config -- specific to your team agreement
configFile = project(":").file("config/checkstyle/google_checks.xml")
// Google style (idiosyncratic to Google):
// configFile = project(":").file("config/checkstyle/google_checks.xml")
// SUN style (closest to modern Java styles) -- the basis for this project:
// configFile = project(":").file("config/checkstyle/sun_checks.xml")
// ignoreFailures = false
// maxWarnings = 0
}

spotless {
// optional: limit format enforcement to just the files changed by this feature branch
// ratchetFrom 'origin/main'

format 'misc', {
// define the files to apply `misc` to
target '*.gradle', '*.md', '.gitignore'

// define the steps to apply to those files
trimTrailingWhitespace()
indentWithTabs() // or spaces. Takes an integer argument if you don't like 4
endWithNewline()
}
java {
// Use the default importOrder configuration

// don't need to set target, it is inferred from java

// apply a specific flavor of google-java-format
googleJavaFormat('1.17.0')
// fix formatting of type annotations
formatAnnotations()
// make sure every file has the following copyright header.
// optionally, Spotless can set copyright years by digging
// through git history (see "license" section below)
licenseHeaderFile(project(":").file("config/spotless/java.license")).named('hildr').onlyIfContentMatches('/*\n' +
' * Copyright 2023 281165273grape@gmail.com')
licenseHeaderFile(project(":").file("config/spotless/besu.license")).named('besu').onlyIfContentMatches('/*\n' +
' * Copyright ConsenSys AG')

importOrder()

removeUnusedImports()
}
}

checkstyleMain
.exclude('io/optimism/rpc/handler/TimeoutHandler.java')
.exclude('io/optimism/rpc/handler/JsonRpcExecutorHandler.java')
.exclude('io/optimism/rpc/handler/JsonRpcParseHandler.java')
.exclude('io/optimism/rpc/methods/JsonRpcMethod.java')
.exclude('io/optimism/rpc/methods/JsonRpcMethodsFactory.java')
.exclude('io/optimism/rpc/methods/JsonRpcProcessor.java')
.exclude('io/optimism/rpc/execution/LoggedJsonRpcProcessor.java')
.exclude('io/optimism/rpc/internal/JsonRpcRequest.java')
.exclude('io/optimism/rpc/internal/JsonRpcRequestContext.java')
.exclude('io/optimism/rpc/internal/JsonRpcRequestId.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcResponse.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcErrorResponse.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcError.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcResponseType.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcNoResponse.java')
.exclude('io/optimism/rpc/execution/BaseJsonRpcProcessor.java')
.exclude('io/optimism/rpc/execution/JsonRpcProcessor.java')
//testSets {
// integrationTest
//}

tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}

check {
dependsOn += jacocoTestCoverageVerification
// dependsOn += integrationTest
}

tasks.withType(Test).configureEach {
def outputDir = reports.junitXml.outputLocation
jvmArgumentProviders << ({
[
"-Djunit.platform.reporting.open.xml.enabled=true",
"-Djunit.platform.reporting.output.dir=${outputDir.get().asFile.absolutePath}",
"--enable-preview"
]
} as CommandLineArgumentProvider)
}

java {
withJavadocJar()
withSourcesJar()
}


javadoc {
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
options.addBooleanOption('-enable-preview', true)
options.addStringOption('-release', '20')
options.addStringOption('-add-modules', 'jdk.incubator.concurrent')
}

jar {
manifest {
attributes "Main-Class": "io.optimism.HildrBatcher"
Expand Down
Loading
Loading