Skip to content

Commit

Permalink
update build.gradle,fix annotation processor does not set java parser…
Browse files Browse the repository at this point in the history
… language version.

Took 38 minutes
  • Loading branch information
xkball committed Oct 15, 2024
1 parent 62fa775 commit e445ebc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.xkball.tin_tea_tech.util;

import com.github.javaparser.ParserConfiguration;
import com.github.javaparser.StaticJavaParser;
import com.sun.tools.javac.api.JavacTrees;
import com.sun.tools.javac.code.Symtab;
Expand Down Expand Up @@ -112,6 +113,7 @@ public static void addCodec(String type, String codecTypeName, String codecRef,
}

public static void readFromSources() {
StaticJavaParser.getParserConfiguration().setLanguageLevel(ParserConfiguration.LanguageLevel.JAVA_21);
for (var env : enter.getEnvs()) {
var tree = env.tree;
if (!(tree instanceof JCTree.JCClassDecl classTree)) return;
Expand Down
Empty file.
41 changes: 6 additions & 35 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,6 @@ plugins {
id 'net.neoforged.moddev' version '2.0.16-beta'
}


//from https://github.com/teaconmc/PowerTool/blob/1.21-neoforge/build.gradle
abstract class TeaConDumpPathToGitHub extends DefaultTask {
@Input
abstract Property<String> getPublishName()
@InputFile
abstract RegularFileProperty getTargetFile()
@TaskAction
void dump() {
if (System.env.GITHUB_ACTIONS) {
File theFile = targetFile.getAsFile().get()

def outputFile = new File(System.env.GITHUB_OUTPUT)
// Use the env-specific line separator for maximally possible compatibility
def newLine = System.getProperty('line.separator')
println outputFile.name
println theFile.name
// Write out new env variable for later usage
outputFile << newLine << "artifact_name=${theFile.getName()}"
outputFile << newLine << "artifact_publish_name=${publishName.get()}"
outputFile << newLine << "artifact_path=${theFile.absolutePath}"
}
}
}

tasks.register("githubActionOutput", TeaConDumpPathToGitHub) { task ->
task.onlyIf {
System.env.GITHUB_ACTIONS
}
var endfix = System.env.VERSION_IDENTIFIER +"-"+ LocalDateTime.now(ZoneOffset.ofHours(8)).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME)
task.getPublishName().set("${jar.archiveBaseName.get()}-${version}-${endfix}-nightly.jar")
task.getTargetFile().set(jar.archiveFile)
}


tasks.named('wrapper', Wrapper).configure {
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
Expand All @@ -62,6 +27,11 @@ repositories {

base {
archivesName = mod_id
if(System.env.GITHUB_ACTIONS){
var endfix = System.env.VERSION_IDENTIFIER +"-"+ LocalDateTime.now(ZoneOffset.ofHours(8)).format(DateTimeFormatter.ISO_LOCAL_DATE_TIME).replace(':','-')
archivesName="${archivesName.get()}-${version}-${endfix}-nightly"
version=''
}
}

// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
Expand Down Expand Up @@ -245,6 +215,7 @@ jar {
from("build/classes/java/main/META-INF"){
include '**/*'
into 'META-INF'
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}

}
Expand Down

0 comments on commit e445ebc

Please sign in to comment.