Skip to content

Commit

Permalink
perf(core): Migrate to Java codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLion committed Sep 4, 2023
1 parent 2367f5d commit b59b951
Show file tree
Hide file tree
Showing 40 changed files with 1,868 additions and 1,439 deletions.
103 changes: 72 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,78 +5,115 @@ buildscript {
}

plugins {
id 'codenarc'
id 'groovy'
id 'jacoco'
id 'java-gradle-plugin'

id 'com.gradle.plugin-publish' version '1.2.1'
id('checkstyle')
id('jacoco')
id('java-gradle-plugin')

id('com.gradle.plugin-publish') version '1.2.1'
id('io.github.joselion.pretty-jupiter') version '2.2.1'
id('io.github.joselion.strict-null-check') version '2.3.0'
id('se.solrike.sonarlint') version '1.0.0-beta.15'
}

group = 'io.github.joselion'

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
toolchain {
languageVersion = JavaLanguageVersion.of(20)
vendor = JvmVendorSpec.ORACLE
}
}

javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
}

tasks.withType(GroovyCompile) {
groovyOptions.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked'
options.deprecation = true
}

dependencyLocking {
lockAllConfigurations()
}

codenarc {
reportFormat('console')
toolVersion('3.3.0')
checkstyle {
setToolVersion('10.12.3')
}

jacoco {
toolVersion('0.8.10')
sonarlint {
excludeRules = [
'java:S107', // Allow constructors with more than 7 parameters
'java:S3776', // Allow methods with more than 15 lines
'java:S4032', // Allow packages only containing `package-info.java`
]
includeRules = [
'java:S4266', // "Stream.collect()" calls should not be redundant
]
}

strictNullCheck {
versions {
eclipseAnnotations = '2.2.700'
findBugs = '3.0.2'
}
}

repositories {
mavenCentral()
}

dependencies {
annotationProcessor('org.projectlombok:lombok:1.18.28')
compileOnly('org.projectlombok:lombok:1.18.28')
sonarlintPlugins('org.sonarsource.java:sonar-java-plugin:7.20.0.31692')

implementation(localGroovy())

testImplementation(gradleTestKit())
testRuntimeOnly('net.bytebuddy:byte-buddy:1.14.7')
testRuntimeOnly('org.objenesis:objenesis:3.3')
testAnnotationProcessor('org.projectlombok:lombok:1.18.28')
testCompileOnly('org.eclipse.jdt:org.eclipse.jdt.annotation:2.2.700')
testCompileOnly('org.projectlombok:lombok:1.18.28')
testImplementation('org.mockito:mockito-core:5.5.0')
}

testing {
suites {
def applySpock = { suite ->
suite.useSpock('2.4-M1-groovy-3.0')
configureEach {
useJUnitJupiter('5.10.0')

suite.targets {
dependencies {
implementation('org.assertj:assertj-core:3.24.2')
}
}

testkit(JvmTestSuite) {
dependencies {
implementation(gradleTestKit())
}

targets {
all {
testTask.configure {
testLogging {
showStandardStreams(true)
events('passed', 'skipped', 'failed')
}
shouldRunAfter(test)
}
}
}
}
}
}

test(applySpock)
e2e(JvmTestSuite, applySpock)
prettyJupiter {
duration {
customThreshold = [testkit: 1000]
}
}

tasks.named('check') {
dependsOn(testing.suites.e2e)
jacoco {
toolVersion('0.8.10')
}

jacocoTestReport {
dependsOn(test, e2e)
dependsOn(test, testkit)

reports {
html.required = true
Expand Down Expand Up @@ -106,5 +143,9 @@ gradlePlugin {
}
}

testSourceSets(sourceSets.e2e)
testSourceSets.add(sourceSets.testkit)
}

tasks.named('check') {
dependsOn(testing.suites.testkit)
}
11 changes: 11 additions & 0 deletions buildscript-gradle.lockfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,16 @@
# This file is expected to be part of source control.
com.gradle.plugin-publish:com.gradle.plugin-publish.gradle.plugin:1.2.1=classpath
com.gradle.publish:plugin-publish-plugin:1.2.1=classpath
io.github.furstenheim:copy_down:1.1=classpath
io.github.joselion.pretty-jupiter:io.github.joselion.pretty-jupiter.gradle.plugin:2.2.1=classpath
io.github.joselion.strict-null-check:io.github.joselion.strict-null-check.gradle.plugin:2.3.0=classpath
io.github.joselion:pretty-jupiter:2.2.1=classpath
io.github.joselion:strict-null-check:2.3.0=classpath
org.apache.commons:commons-lang3:3.11=classpath
org.apache.commons:commons-text:1.9=classpath
org.apache.maven:maven-model:3.6.3=classpath
org.jsoup:jsoup:1.15.2=classpath
org.sonarsource.sonarlint.core:sonarlint-core:8.0.2.42487=classpath
se.solrike.sonarlint:se.solrike.sonarlint.gradle.plugin:1.0.0-beta.15=classpath
se.solrike.sonarlint:sonarlint-gradle-plugin:1.0.0-beta.15=classpath
empty=
123 changes: 123 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" "https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name="Checker">
<property name="fileExtensions" value="java" />
<property name="severity" value="error" />

<!-- Filters -->
<module name="SuppressWithPlainTextCommentFilter" />
<module name="SuppressionFilter">
<property name="file" value="${config_loc}/suppressions.xml" default="config/checkstyle/suppressions.xml" />
<property name="optional" value="false" />
</module>

<!-- Miscellaneous -->
<module name="NewlineAtEndOfFile" />

<!-- Regexp -->
<module name="RegexpSingleline">
<property name="format" value="(?!\*)[^$]\s+$" />
<property name="minimum" value="0" />
<property name="maximum" value="0" />
<property name="message" value="Line has trailing spaces." />
</module>

<!-- Size Violations -->
<module name="FileLength">
<property name="max" value="2000" />
</module>
<module name="LineLength">
<property name="max" value="120" />
<property name="ignorePattern" value="^package.*|^import.*" />
</module>

<!-- Whitespace -->
<module name="FileTabCharacter" />

<module name="TreeWalker">
<property name="tabWidth" value="2" />

<!-- Block Checks -->
<module name="LeftCurly" />
<module name="NeedBraces" />
<module name="RightCurly" />

<!-- Class Design -->
<module name="InnerTypeLast" />
<module name="InterfaceIsType" />
<module name="OneTopLevelClass" />
<module name="VisibilityModifier" />

<!-- Coding -->
<module name="EqualsHashCode" />
<module name="InnerAssignment" />
<module name="OneStatementPerLine" />
<module name="UnnecessaryParentheses" />
<module name="UnnecessarySemicolonAfterOuterTypeDeclaration" />
<module name="UnnecessarySemicolonAfterTypeMemberDeclaration" />
<module name="UnnecessarySemicolonInEnumeration" />
<module name="UnnecessarySemicolonInTryWithResources" />

<!-- Javadoc Comments -->
<module name="InvalidJavadocPosition" />

<!-- Imports -->
<module name="AvoidStarImport" />
<module name="ImportOrder">
<property name="groups" value="/^java\./,javax,org,com" />
<property name="ordered" value="true" />
<property name="separated" value="true" />
<property name="sortStaticImportsAlphabetically" value="true" />
<property name="option" value="top" />
</module>
<module name="RedundantImport" />
<module name="UnusedImports" />

<!-- Miscellaneous -->
<module name="FinalParameters" />
<module name="NoCodeInFile" />
<module name="UpperEll" />

<!-- Modifiers -->
<module name="ModifierOrder" />
<module name="RedundantModifier" />

<!-- Naming Conventions -->
<module name="ClassTypeParameterName" />
<module name="ConstantName" />
<module name="IllegalIdentifierName" />
<module name="InterfaceTypeParameterName" />
<module name="LambdaParameterName" />
<module name="LocalFinalVariableName" />
<module name="LocalVariableName" />
<module name="MemberName" />
<module name="MethodName" />
<module name="MethodTypeParameterName" />
<module name="PackageName">
<property name="format" value="^[a-z]+(\.[a-z][a-z0-9]*)*$" />
</module>
<module name="ParameterName" />
<module name="PatternVariableName" />
<module name="RecordComponentName" />
<module name="RecordTypeParameterName" />
<module name="StaticVariableName" />
<module name="TypeName" />

<!-- Whitespace -->
<module name="EmptyLineSeparator">
<property name="allowMultipleEmptyLines" value="false" />
</module>
<module name="GenericWhitespace" />
<module name="MethodParamPad" />
<module name="NoLineWrap" />
<module name="NoWhitespaceAfter" />
<module name="NoWhitespaceBefore" />
<module name="NoWhitespaceBeforeCaseDefaultColon" />
<module name="ParenPad" />
<module name="SingleSpaceSeparator" />
<module name="TypecastParenPad" />
<module name="WhitespaceAfter" />
<module name="WhitespaceAround" />
</module>
</module>
10 changes: 10 additions & 0 deletions config/checkstyle/suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.3//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd">

<suppressions>
<!-- Tests -->
<suppress
checks="InnerTypeLast|MethodName|TypeName"
files=".*[\\/]src[\\/]test|testkit[\\/]"
/>
</suppressions>
28 changes: 0 additions & 28 deletions config/codenarc/codenarc.xml

This file was deleted.

Loading

0 comments on commit b59b951

Please sign in to comment.