Skip to content

Commit

Permalink
mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
wilsonwatson committed Jul 31, 2024
1 parent 66c569d commit fd046b0
Show file tree
Hide file tree
Showing 24 changed files with 131 additions and 129 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,4 +161,8 @@ bin/
# Simulation GUI and other tools window save file
*-window.json

/src/main/java/org/frc5572/robotools/IOTypes.java
/.idea

/processor/src/main/java/org/frc5572/robotools/IOTypes.java

/build
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion gen_io_types/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ async fn main() {
}
}

let mut outf = std::fs::File::create(source_dir.join("src/main/java/org/frc5572/robotools/IOTypes.java")).unwrap();
let mut outf = std::fs::File::create(source_dir.join("processor/src/main/java/org/frc5572/robotools/IOTypes.java")).unwrap();
writeln!(&mut outf, "package org.frc5572.robotools;\n").unwrap();
writeln!(&mut outf, "/** Auto-generated list of IO interfaces and classes. */").unwrap();
writeln!(&mut outf, "public class IOTypes {{\n").unwrap();
Expand Down
22 changes: 11 additions & 11 deletions ...in/java/org/frc5572/util/serde/Serde.java → ...in/java/org/frc5572/util/mixin/Final.java
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package org.frc5572.util.serde;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/** File supports serialization to and from a log table. */
@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.TYPE})
public @interface Serde {}
package org.frc5572.util.mixin;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.TYPE})

Check warning on line 8 in lib/src/main/java/org/frc5572/util/mixin/Final.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./lib/src/main/java/org/frc5572/util/mixin/Final.java:8:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
@Retention(RetentionPolicy.CLASS)
public @interface Final {
}
18 changes: 18 additions & 0 deletions lib/src/main/java/org/frc5572/util/mixin/Mixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package org.frc5572.util.mixin;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.TYPE})

Check warning on line 8 in lib/src/main/java/org/frc5572/util/mixin/Mixin.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./lib/src/main/java/org/frc5572/util/mixin/Mixin.java:8:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
@Retention(RetentionPolicy.CLASS)
public @interface Mixin {

Class<?>[] value() default { };

Check warning on line 12 in lib/src/main/java/org/frc5572/util/mixin/Mixin.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./lib/src/main/java/org/frc5572/util/mixin/Mixin.java:12:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

String[] targets() default { };

Check warning on line 14 in lib/src/main/java/org/frc5572/util/mixin/Mixin.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./lib/src/main/java/org/frc5572/util/mixin/Mixin.java:14:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

int priority() default 1000;

Check warning on line 16 in lib/src/main/java/org/frc5572/util/mixin/Mixin.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./lib/src/main/java/org/frc5572/util/mixin/Mixin.java:16:5: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck)

}
23 changes: 11 additions & 12 deletions .../java/org/frc5572/util/serde/Aliases.java → ...ava/org/frc5572/util/mixin/Overwrite.java
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package org.frc5572.util.serde;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.SOURCE)
@Target({ElementType.FIELD})
public @interface Aliases {
Alias[] value();
}
package org.frc5572.util.mixin;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.TYPE})

Check warning on line 8 in lib/src/main/java/org/frc5572/util/mixin/Overwrite.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./lib/src/main/java/org/frc5572/util/mixin/Overwrite.java:8:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
@Retention(RetentionPolicy.CLASS)
public @interface Overwrite {
}
11 changes: 11 additions & 0 deletions lib/src/main/java/org/frc5572/util/mixin/Shadow.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.frc5572.util.mixin;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.TYPE})

Check warning on line 8 in lib/src/main/java/org/frc5572/util/mixin/Shadow.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./lib/src/main/java/org/frc5572/util/mixin/Shadow.java:8:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
@Retention(RetentionPolicy.CLASS)
public @interface Shadow {
}
11 changes: 11 additions & 0 deletions lib/src/main/java/org/frc5572/util/mixin/inject/At.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.frc5572.util.mixin.inject;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.TYPE})

Check warning on line 8 in lib/src/main/java/org/frc5572/util/mixin/inject/At.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./lib/src/main/java/org/frc5572/util/mixin/inject/At.java:8:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
@Retention(RetentionPolicy.CLASS)
public @interface At {
}
11 changes: 11 additions & 0 deletions lib/src/main/java/org/frc5572/util/mixin/inject/Inject.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.frc5572.util.mixin.inject;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target({ElementType.TYPE})

Check warning on line 8 in lib/src/main/java/org/frc5572/util/mixin/inject/Inject.java

View workflow job for this annotation

GitHub Actions / Linting

[testtool] reported by reviewdog 🐶 Missing a Javadoc comment. Raw Output: /github/workspace/./lib/src/main/java/org/frc5572/util/mixin/inject/Inject.java:8:1: warning: Missing a Javadoc comment. (com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck)
@Retention(RetentionPolicy.CLASS)
public @interface Inject {
}
4 changes: 0 additions & 4 deletions lib/src/main/java/org/frc5572/util/profiler/AutoProfile.java

This file was deleted.

15 changes: 0 additions & 15 deletions lib/src/main/java/org/frc5572/util/serde/Alias.java

This file was deleted.

12 changes: 0 additions & 12 deletions lib/src/main/java/org/frc5572/util/serde/Casing.java

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions lib/src/main/java/org/frc5572/util/serde/Rename.java

This file was deleted.

13 changes: 0 additions & 13 deletions lib/src/main/java/org/frc5572/util/serde/RenameAll.java

This file was deleted.

9 changes: 0 additions & 9 deletions lib/src/main/java/org/frc5572/util/serde/Serialize.java

This file was deleted.

7 changes: 0 additions & 7 deletions lib/src/main/java/org/frc5572/util/serde/SingleSerdeItem.java

This file was deleted.

5 changes: 0 additions & 5 deletions lib/src/main/java/org/frc5572/util/serde/Skip.java

This file was deleted.

13 changes: 0 additions & 13 deletions lib/src/main/java/org/frc5572/util/serde/With.java

This file was deleted.

29 changes: 29 additions & 0 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
plugins {
id 'java-gradle-plugin'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.9.10'
}

group = "com.github.Frc5572"
var githubProjectName = "RobotTools"

repositories {
mavenCentral()
}

gradlePlugin {
plugins {
register("ffstMixin") {
id = "$group.$githubProjectName"
implementationClass = 'org.frc5572.mixin.MixinPlugin'
}
}
}

kotlin {
jvmToolchain(17)
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile.class).configureEach {
jvmTargetValidationMode = org.jetbrains.kotlin.gradle.dsl.jvm.JvmTargetValidationMode.WARNING
}
19 changes: 19 additions & 0 deletions plugin/src/main/kotlin/org/frc5572/mixin/MixinPlugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.frc5572.mixin;

import org.gradle.api.Project
import org.gradle.api.Plugin
import org.gradle.api.Task
import org.gradle.api.tasks.JavaExec
import org.gradle.jvm.tasks.Jar

class MixinPlugin: Plugin<Project> {
override fun apply(target: Project) {
target.tasks.withType(Jar::class.java) { task ->
task.doLast {
task.outputs.files.forEach {
println(it.path)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ public boolean process(Set<? extends TypeElement> arg0, RoundEnvironment roundEn
}
}
CompilationData compilationData = new CompilationData(typeElements, processingEnv);
SerdeProcessor.processTypes(compilationData);
AutoProfileProcessor.processTypes(compilationData);
// SerdeProcessor.processTypes(compilationData);
// AutoProfileProcessor.processTypes(compilationData);
return false;
}

Expand Down
5 changes: 0 additions & 5 deletions processor/src/main/kotlin/org/frc5572/robotools/Test.kt

This file was deleted.

1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ plugins {
}

rootProject.name = 'robot-tools'
include('plugin')
include('processor')
include('lib')

0 comments on commit fd046b0

Please sign in to comment.