Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for epilogue annotations #744

Merged
merged 3 commits into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ public class WPIJavaDepsExtension {

private final ProviderFactory providers;

private static String dependencyNotation(String groupId, String artifactId, Provider<String> version) {
return groupId + ":" + artifactId + ":" + version.get();
}

private void createJavaDependencies(String groupdId, String artifactId, Provider<String> version) {
wpilibDeps.add(providers.provider(() -> {
return groupdId + ":" + artifactId + ":" + version.get();
return dependencyNotation(groupdId, artifactId, version);
}));

wpilibSources.add(providers.provider(() -> {
return groupdId + ":" + artifactId + ":" + version.get() + ":sources";
return dependencyNotation(groupdId, artifactId, version) + ":sources";
}));
}

private Provider<String> createJniDependency(String groupdId, String artifactId, Provider<String> version, boolean debug, String platform) {
String debugString = debug ? "debug" : "";
return providers.provider(() -> {
return groupdId + ":" + artifactId + ":" + version.get() + ":" + platform + debugString + "@zip";
return dependencyNotation(groupdId, artifactId, version) + ":" + platform + debugString + "@zip";
});
}

Expand All @@ -50,6 +54,7 @@ public WPIJavaDepsExtension(WPIVersionsExtension versions, ProviderFactory provi
createJavaDependencies("edu.wpi.first.wpiutil", "wpiutil-java", versions.getWpilibVersion());
createJavaDependencies("edu.wpi.first.apriltag", "apriltag-java", versions.getWpilibVersion());
createJavaDependencies("edu.wpi.first.wpiunits", "wpiunits-java", versions.getWpilibVersion());
createJavaDependencies("edu.wpi.first.epilogue", "epilogue-runtime-java", versions.getWpilibVersion());

createJavaDependencies("edu.wpi.first.thirdparty.frc2024.opencv", "opencv-java", versions.getOpencvVersion());
createJavaDependencies("org.ejml", "ejml-simple", versions.getEjmlVersion());
Expand All @@ -65,6 +70,16 @@ public List<Provider<String>> wpilib() {
return wpilibDeps;
}

/** Dependencies required for using WPILib's Java annotations during compilation. */
public List<Provider<String>> wpilibAnnotations() {
// epilogue-runtime is a dependency of epilogue-processor, and needs to be on the annotation processor
// classpath at compile time for the processor to function
return List.of(
providers.provider(() -> dependencyNotation("edu.wpi.first.epilogue", "epilogue-processor-java", versions.getWpilibVersion())),
providers.provider(() -> dependencyNotation("edu.wpi.first.epilogue", "epilogue-runtime-java", versions.getWpilibVersion()))
);
}

public List<Provider<String>> wpilibSources() {
return wpilibSources;
}
Expand Down