Skip to content

Commit

Permalink
Move to kapt for annotation processing (allows kotlin to be used in t…
Browse files Browse the repository at this point in the history
…he core module)
  • Loading branch information
blahblahbloopster committed Apr 3, 2021
1 parent 02e68d2 commit 31f8d6c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public class AssetsProcess extends BaseProcessor{

@Override
public void process(RoundEnvironment env) throws Exception{
processSounds("Sounds", rootDirectory + "/core/assets/sounds", "arc.audio.Sound");
processSounds("Musics", rootDirectory + "/core/assets/music", "arc.audio.Music");
processSounds("Sounds", rootDirectory + "/assets/sounds", "arc.audio.Sound");
processSounds("Musics", rootDirectory + "/assets/music", "arc.audio.Music");
processUI(env.getElementsAnnotatedWith(StyleDefaults.class));
}

Expand All @@ -33,11 +33,11 @@ void processUI(Set<? extends Element> elements) throws Exception{
MethodSpec.Builder loadStyles = MethodSpec.methodBuilder("loadStyles").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
MethodSpec.Builder icload = MethodSpec.methodBuilder("load").addModifiers(Modifier.PUBLIC, Modifier.STATIC);
CodeBlock.Builder ichinit = CodeBlock.builder();
String resources = rootDirectory + "/core/assets-raw/sprites/ui";
Jval icons = Jval.read(Fi.get(rootDirectory + "/core/assets-raw/fontgen/config.json").readString());
String resources = rootDirectory + "/assets-raw/sprites/ui";
Jval icons = Jval.read(Fi.get(rootDirectory + "/assets-raw/fontgen/config.json").readString());

ObjectMap<String, String> texIcons = new OrderedMap<>();
PropertiesUtils.load(texIcons, Fi.get(rootDirectory + "/core/assets/icons/icons.properties").reader());
PropertiesUtils.load(texIcons, Fi.get(rootDirectory + "/assets/icons/icons.properties").reader());

StringBuilder iconcAll = new StringBuilder();

Expand Down
20 changes: 17 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ buildscript{
}
}

plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.32'
id "org.jetbrains.kotlin.kapt" version "1.4.32"
}

allprojects{
apply plugin: 'maven'

Expand Down Expand Up @@ -287,6 +292,16 @@ project(":ios"){

project(":core"){
apply plugin: "java-library"
apply plugin: "kotlin"
apply plugin: "kotlin-kapt"

kapt {
javacOptions {
option("-source", "14")
option("-target", "1.8")
option("--enable-preview")
}
}

compileJava.options.fork = true

Expand Down Expand Up @@ -354,10 +369,9 @@ project(":core"){
api "com.github.Anuken:rhino:$rhinoVersion"
if(localArc() && debugged()) api arcModule("extensions:recorder")

compileOnly project(":annotations")
annotationProcessor project(":annotations")
annotationProcessor 'com.github.Anuken:jabel:34e4c172e65b3928cd9eabe1993654ea79c409cd'

compileOnly project(":annotations")
kapt project(":annotations")
}

afterEvaluate{
Expand Down
6 changes: 6 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
org.gradle.daemon=true
org.gradle.jvmargs=-Xms256m -Xmx1024m
archash=0e99b0291f81d74d335dca8b0cf3bf26931f1197
# Don't recompute annotations if sources haven't been changed
kapt.incremantal.apt = true
# Multithreaded
kapt.use.worker.api=true
# Compilation avoidance (see https://kotlinlang.org/docs/kapt.html#compile-avoidance-for-kapt-since-1-3-20)
kapt.include.compile.classpath=false

0 comments on commit 31f8d6c

Please sign in to comment.