Skip to content

Commit

Permalink
jmh: fix JMH
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed May 18, 2024
1 parent a13cfac commit ea5576e
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Allay-API/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

group = "org.allaymc"
description = "api"
version = "0.0.1"
version = "1.0.0"

dependencies {
api(libs.network) {
Expand Down
2 changes: 1 addition & 1 deletion Allay-CodeGen/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group = "org.allaymc"
description = "codegen"
version = "0.0.1"
version = "1.0.0"

dependencies {
implementation(libs.javapoet)
Expand Down
2 changes: 1 addition & 1 deletion Allay-Data/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
group = "org.allaymc"
description = "data"
version = "0.0.1"
version = "1.0.0"

dependencies {
implementation(project(":Allay-Server"))
Expand Down
2 changes: 1 addition & 1 deletion Allay-ExamplePlugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {

group = "org.allaymc"
description = "example-plugin"
version = "0.0.1"
version = "1.0.0"

dependencies {
compileOnly(project(":Allay-API"))
Expand Down
10 changes: 1 addition & 9 deletions Allay-Server/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {

group = "org.allaymc"
description = "server"
version = "0.0.1"
version = "1.0.0"

application {
mainClass.set("org.allaymc.server.Allay")
Expand Down Expand Up @@ -77,14 +77,6 @@ tasks.sourcesJar {
dependsOn("generateGitProperties")
}

tasks.jmh {
// Add the executed test case
includes.add("AABBTreeJMHTest")
// includes.add("BlockStateUpdateJMHTest")
// includes.add("ChunkJMHTest")
// includes.add("ThroughList2Array")
}

tasks.runShadow {
workingDir = File("${rootProject.projectDir}/.run/")
this.jarFile = file("build/libs/Allay-Server-$version-all.jar")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.allaymc.server;

import org.allaymc.api.block.property.enums.PillarAxis;
import org.allaymc.api.block.property.enums.WoodType;
import org.allaymc.api.block.property.enums.MinecraftFacingDirection;
import org.allaymc.api.block.type.BlockState;
import org.allaymc.api.block.type.BlockTypes;
import org.allaymc.api.data.VanillaBlockPropertyTypes;
Expand All @@ -22,23 +21,22 @@
@Fork(1)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
public class BlockStateUpdateJMHTest {
private BlockState wood;
private BlockState observer;

@Setup
public void init() throws MissingImplementationException {
Allay.initAllayAPI();
wood = BlockTypes.WOOD_TYPE.getDefaultState();
observer = BlockTypes.OBSERVER_TYPE.getDefaultState();
}

@Benchmark
public void test1() {
wood = wood.setProperty(VanillaBlockPropertyTypes.PILLAR_AXIS, PillarAxis.Z);
observer = observer.setProperty(VanillaBlockPropertyTypes.MINECRAFT_FACING_DIRECTION, MinecraftFacingDirection.UP);
}

@Benchmark
public void test2() {
wood = wood.setProperty(VanillaBlockPropertyTypes.PILLAR_AXIS, PillarAxis.Z);
wood = wood.setProperty(VanillaBlockPropertyTypes.STRIPPED_BIT, true);
wood = wood.setProperty(VanillaBlockPropertyTypes.WOOD_TYPE, WoodType.DARK_OAK);
observer = observer.setProperty(VanillaBlockPropertyTypes.MINECRAFT_FACING_DIRECTION, MinecraftFacingDirection.UP);
observer = observer.setProperty(VanillaBlockPropertyTypes.POWERED_BIT, true);
}
}
28 changes: 14 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ repositories {
maven("https://storehouse.okaeri.eu/repository/maven-public/")
}

// Do not build this root project, this is only used as a control submodule
tasks.forEach {
it.enabled = false
}

idea {
module {
isDownloadSources = true
isDownloadJavadoc = false
}
}

// Do not build this root project, this is only used as a control submodule
tasks.forEach {
it.enabled = false
}

// Enable gradle wrapper update task
tasks.wrapper {
enabled = true
Expand All @@ -40,6 +40,10 @@ tasks.prepareKotlinBuildScriptModel {
enabled = true
}

tasks.build {
group = "alpha build"
}

// The build of the root module does not need to write logic,
// and the build of the same name of all submodules will be automatically called
tasks.register<DefaultTask>("fastBuild") {
Expand All @@ -50,10 +54,6 @@ tasks.register<DefaultTask>("buildForGithubAction") {
group = "alpha build"
}

tasks.build {
group = "alpha build"
}

tasks.clean {
group = "alpha build"
enabled = true
Expand Down Expand Up @@ -94,6 +94,11 @@ subprojects {
withSourcesJar()
}

tasks.build {
group = "alpha build"
dependsOn("shadowJar")
}

tasks.register<DefaultTask>("fastBuild") {
dependsOn(tasks.build)
group = "alpha build"
Expand All @@ -114,11 +119,6 @@ subprojects {
tasks["javadocJar"].enabled = false
}

tasks.build {
group = "alpha build"
dependsOn("shadowJar")
}

tasks.clean {
group = "alpha build"
enabled = true
Expand Down

0 comments on commit ea5576e

Please sign in to comment.