Initial commit

This commit is contained in:
Guillaume Tâche
2024-11-15 19:17:27 +01:00
commit f583c9942b
65 changed files with 7069 additions and 0 deletions

84
maven-plugin/pom.xml Normal file
View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.gtache</groupId>
<artifactId>fxml-compiler</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>fxml-compiler-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>fxml-compiler-maven-plugin Maven Mojo</name>
<properties>
<maven.api.version>3.9.9</maven.api.version>
<maven.annotations.version>3.15.1</maven.annotations.version>
<maven.core.version>3.9.9</maven.core.version>
<maven.plugin.version>3.15.1</maven.plugin.version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>${maven.plugin.version}</version>
<executions>
<execution>
<id>help-mojo</id>
<goals>
<goal>helpmojo</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>com.github.gtache</groupId>
<artifactId>fxml-compiler-loader</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${maven.api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>${maven.annotations.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.core.version}</version>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>

View File

@@ -0,0 +1,32 @@
package com.github.gtache.fxml.compiler.maven;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import java.nio.file.Path;
/**
* Main mojo for FXML compiler
*/
@Mojo(name = "fxml-compile", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
public class FXMLCompilerMojo extends AbstractMojo {
@Parameter(defaultValue = "${project}", required = true, readonly = true)
private MavenProject project;
@Parameter(defaultValue = "${project.build.directory}/generated-sources", required = true)
private Path outputDirectory;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
for (final var resource : project.getResources()) {
final var location = resource.getLocation("");
location.toString();
}
project.addCompileSourceRoot(outputDirectory.toAbsolutePath().toString());
}
}