-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add metadata to generated code in CLI processor
- Loading branch information
Showing
11 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,11 @@ | |
import java.io.File; | ||
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
import java.time.OffsetDateTime; | ||
import java.time.ZoneOffset; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import javax.annotation.processing.Processor; | ||
import javax.tools.JavaFileObject; | ||
import org.junit.jupiter.api.Test; | ||
import com.google.testing.compile.Compilation; | ||
|
@@ -93,13 +96,20 @@ public interface ExampleComponent { | |
import java.util.Map; | ||
import java.util.Optional; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.processing.Generated; | ||
import rapier.internal.RapierGenerated; | ||
import rapier.cli.CliSyntaxException; | ||
import rapier.cli.CliFlagParameter; | ||
import rapier.cli.CliOptionParameter; | ||
import rapier.cli.CliPositionalParameter; | ||
import rapier.cli.compiler.thirdparty.com.sigpwned.just.args.JustArgs; | ||
@Module | ||
@RapierGenerated | ||
@Generated( | ||
value = "[email protected]", | ||
comments = "https://www.example.com", | ||
date = "2024-01-01T12:34:56Z") | ||
public class RapierExampleComponentCliModule { | ||
// Positional parameters | ||
|
@@ -372,13 +382,20 @@ public interface ExampleComponent { | |
import java.util.Map; | ||
import java.util.Optional; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.processing.Generated; | ||
import rapier.internal.RapierGenerated; | ||
import rapier.cli.CliSyntaxException; | ||
import rapier.cli.CliFlagParameter; | ||
import rapier.cli.CliOptionParameter; | ||
import rapier.cli.CliPositionalParameter; | ||
import rapier.cli.compiler.thirdparty.com.sigpwned.just.args.JustArgs; | ||
@Module | ||
@RapierGenerated | ||
@Generated( | ||
value = "[email protected]", | ||
comments = "https://www.example.com", | ||
date = "2024-01-01T12:34:56Z") | ||
public class RapierExampleComponentCliModule { | ||
// Positional parameters | ||
|
@@ -635,13 +652,20 @@ public interface ExampleComponent { | |
import java.util.Map; | ||
import java.util.Optional; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.processing.Generated; | ||
import rapier.internal.RapierGenerated; | ||
import rapier.cli.CliSyntaxException; | ||
import rapier.cli.CliFlagParameter; | ||
import rapier.cli.CliOptionParameter; | ||
import rapier.cli.CliPositionalParameter; | ||
import rapier.cli.compiler.thirdparty.com.sigpwned.just.args.JustArgs; | ||
@Module | ||
@RapierGenerated | ||
@Generated( | ||
value = "[email protected]", | ||
comments = "https://www.example.com", | ||
date = "2024-01-01T12:34:56Z") | ||
public class RapierExampleComponentCliModule { | ||
// Positional parameters | ||
|
@@ -876,13 +900,20 @@ public interface ExampleComponent { | |
import java.util.Map; | ||
import java.util.Optional; | ||
import javax.annotation.Nullable; | ||
import javax.annotation.processing.Generated; | ||
import rapier.internal.RapierGenerated; | ||
import rapier.cli.CliSyntaxException; | ||
import rapier.cli.CliFlagParameter; | ||
import rapier.cli.CliOptionParameter; | ||
import rapier.cli.CliPositionalParameter; | ||
import rapier.cli.compiler.thirdparty.com.sigpwned.just.args.JustArgs; | ||
@Module | ||
@RapierGenerated | ||
@Generated( | ||
value = "[email protected]", | ||
comments = "https://www.example.com", | ||
date = "2024-01-01T12:34:56Z") | ||
public class RapierExampleComponentCliModule { | ||
// Positional parameters | ||
|
@@ -1038,6 +1069,30 @@ public List<Boolean> provideFlag59dcb7aAsListOfBoolean() { | |
.hasSourceEquivalentTo(expectedOutput); | ||
} | ||
|
||
public static final OffsetDateTime TEST_DATE = | ||
OffsetDateTime.of(2024, 1, 1, 12, 34, 56, 0, ZoneOffset.UTC); | ||
|
||
public static final String TEST_VERSION = "1.2.3"; | ||
|
||
public static final String TEST_URL = "https://www.example.com"; | ||
|
||
/** | ||
* We need to set the date and version so our generated source code is deterministic. | ||
*/ | ||
@Override | ||
protected List<Processor> getAnnotationProcessors() { | ||
List<Processor> result = super.getAnnotationProcessors(); | ||
for (Processor processor : result) { | ||
if (processor instanceof CliProcessor) { | ||
CliProcessor cp = (CliProcessor) processor; | ||
cp.setDate(TEST_DATE); | ||
cp.setVersion(TEST_VERSION); | ||
cp.setUrl(TEST_URL); | ||
} | ||
} | ||
return unmodifiableList(result); | ||
} | ||
|
||
/** | ||
* We need to include the generated classes from the rapier-cli module in the classpath for our | ||
* tests. | ||
|
@@ -1047,6 +1102,7 @@ protected List<File> getCompileClasspath() throws FileNotFoundException { | |
List<File> result = new ArrayList<>(); | ||
result.addAll(super.getCompileClasspath()); | ||
result.add(resolveProjectFile("../rapier-cli/target/classes")); | ||
result.add(resolveProjectFile("../rapier-core/target/classes")); | ||
return unmodifiableList(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters