-
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.
Merge remote-tracking branch 'origin/main' into 229-set-java-17-as-ne…
…w-baseline
- Loading branch information
Showing
81 changed files
with
2,518 additions
and
320 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?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>gg.jte</groupId> | ||
<artifactId>jte-parent</artifactId> | ||
<version>2.3.3-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>jte-extension-api-mocks</artifactId> | ||
<packaging>jar</packaging> | ||
<dependencies> | ||
<dependency> | ||
<groupId>gg.jte</groupId> | ||
<artifactId>jte-extension-api</artifactId> | ||
<version>2.3.3-SNAPSHOT</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>gg.jte</groupId> | ||
<artifactId>jte-runtime</artifactId> | ||
<version>2.3.3-SNAPSHOT</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifestEntries> | ||
<Automatic-Module-Name>gg.jte.extension.api.mocks</Automatic-Module-Name> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
75 changes: 75 additions & 0 deletions
75
jte-extension-api-mocks/src/main/java/gg/jte/extension/MockConfig.java
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 |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package gg.jte.extension; | ||
|
||
import gg.jte.ContentType; | ||
|
||
import java.nio.file.Path; | ||
|
||
/** | ||
* Mock implementation to help with testing extensions. | ||
*/ | ||
public class MockConfig implements JteConfig { | ||
Path generatedSourcesRoot; | ||
Path generatedResourcesRoot; | ||
String projectNamespace; | ||
String packageName; | ||
ContentType contentType; | ||
|
||
public static MockConfig mockConfig() { | ||
return new MockConfig(); | ||
} | ||
|
||
public MockConfig generatedSourcesRoot(Path value) { | ||
generatedSourcesRoot = value; | ||
return this; | ||
} | ||
|
||
public MockConfig generatedResourcesRoot(Path value) { | ||
generatedResourcesRoot = value; | ||
return this; | ||
} | ||
|
||
public MockConfig projectNamespace(String value) { | ||
projectNamespace = value; | ||
return this; | ||
} | ||
|
||
public MockConfig packageName(String value) { | ||
packageName = value; | ||
return this; | ||
} | ||
|
||
public MockConfig contentType(ContentType value) { | ||
contentType = value; | ||
return this; | ||
} | ||
|
||
@Override | ||
public Path generatedSourcesRoot() { | ||
return generatedSourcesRoot; | ||
} | ||
|
||
@Override | ||
public Path generatedResourcesRoot() { | ||
return generatedResourcesRoot; | ||
} | ||
|
||
@Override | ||
public String projectNamespace() { | ||
return projectNamespace; | ||
} | ||
|
||
@Override | ||
public String packageName() { | ||
return packageName; | ||
} | ||
|
||
@Override | ||
public ContentType contentType() { | ||
return contentType; | ||
} | ||
|
||
@Override | ||
public ClassLoader classLoader() { | ||
return getClass().getClassLoader(); | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
jte-extension-api-mocks/src/main/java/gg/jte/extension/MockParamDescription.java
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package gg.jte.extension; | ||
|
||
/** | ||
* Mock implementation to help with testing extensions. | ||
*/ | ||
public class MockParamDescription implements ParamDescription { | ||
String type; | ||
String name; | ||
String defaultValue; | ||
|
||
public static MockParamDescription mockParamDescription() { | ||
return new MockParamDescription(); | ||
} | ||
|
||
public MockParamDescription type(String value) { | ||
type = value; | ||
return this; | ||
} | ||
|
||
public MockParamDescription name(String value) { | ||
name = value; | ||
return this; | ||
} | ||
|
||
public MockParamDescription defaultValue(String value) { | ||
defaultValue = value; | ||
return this; | ||
} | ||
|
||
@Override | ||
public String type() { | ||
return type; | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public String defaultValue() { | ||
return defaultValue; | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
jte-extension-api-mocks/src/main/java/gg/jte/extension/MockTemplateDescription.java
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 |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package gg.jte.extension; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
/** | ||
* Mock implementation to help with testing extensions. | ||
*/ | ||
public class MockTemplateDescription implements TemplateDescription { | ||
String name; | ||
String packageName; | ||
String className; | ||
List<ParamDescription> params = new ArrayList<>(); | ||
private final List<String> imports = new ArrayList<>(); | ||
|
||
public static MockTemplateDescription mockTemplateDescription() { | ||
return new MockTemplateDescription(); | ||
} | ||
|
||
public MockTemplateDescription name(String value) { | ||
name = value; | ||
return this; | ||
} | ||
|
||
public MockTemplateDescription packageName(String value) { | ||
packageName = value; | ||
return this; | ||
} | ||
|
||
public MockTemplateDescription className(String value) { | ||
className = value; | ||
return this; | ||
} | ||
|
||
public MockTemplateDescription params(List<ParamDescription> value) { | ||
params.clear(); | ||
params.addAll(value); | ||
return this; | ||
} | ||
|
||
public MockTemplateDescription addParams(ParamDescription... value) { | ||
params.addAll(Arrays.asList(value)); | ||
return this; | ||
} | ||
|
||
public MockTemplateDescription imports(List<String> value) { | ||
imports.clear(); | ||
imports.addAll(value); | ||
return this; | ||
} | ||
|
||
public MockTemplateDescription addImports(String... value) { | ||
imports.addAll(Arrays.asList(value)); | ||
return this; | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public String packageName() { | ||
return packageName; | ||
} | ||
|
||
@Override | ||
public String className() { | ||
return className; | ||
} | ||
|
||
@Override | ||
public List<ParamDescription> params() { | ||
return params; | ||
} | ||
|
||
@Override | ||
public List<String> imports() { | ||
return imports; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea/modules.xml | ||
.idea/jarRepositories.xml | ||
.idea/compiler.xml | ||
.idea/libraries/ | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# jte-extension-api | ||
|
||
This module defines the interface to add extensions to jte generation. | ||
Extensions can generate additional files based on metadata about jte templates. | ||
|
||
## Writing an Extension | ||
|
||
Extension authors must implement the `JteExtension` interface. | ||
The implementing class must have a no-argument constructor so that it can be instantiated by name. | ||
|
||
## Testing | ||
|
||
The companion module jte-extension-api-mocks provides mock implementations of the API interfaces to help with writing unit tests. | ||
|
||
## Usage | ||
|
||
The jte Maven and Gradle plugins allow configuring extensions. | ||
|
||
## Examples | ||
|
||
* jte-models module is an extension that generates typesafe facades for templates. | ||
* test/jte-runtime-cp-test-models uses the Maven plugin to apply the jte-models extension. | ||
* test/jte-runtime-cp-test-models-gradle uses the Gradle plugin to apply the jte-models extension. |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?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>gg.jte</groupId> | ||
<artifactId>jte-parent</artifactId> | ||
<version>2.3.3-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>jte-extension-api</artifactId> | ||
<packaging>jar</packaging> | ||
<dependencies> | ||
<dependency> | ||
<groupId>gg.jte</groupId> | ||
<artifactId>jte-runtime</artifactId> | ||
<version>2.3.3-SNAPSHOT</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifestEntries> | ||
<Automatic-Module-Name>gg.jte.extension.api</Automatic-Module-Name> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
21 changes: 21 additions & 0 deletions
21
jte-extension-api/src/main/java/gg/jte/extension/JteConfig.java
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package gg.jte.extension; | ||
|
||
import gg.jte.ContentType; | ||
|
||
import java.nio.file.Path; | ||
|
||
/** | ||
* An instance of this type will be given to an extension, so that it can access configuration of the jte compiler. | ||
*/ | ||
public interface JteConfig { | ||
Path generatedSourcesRoot(); | ||
Path generatedResourcesRoot(); | ||
|
||
String projectNamespace(); | ||
|
||
String packageName(); | ||
|
||
ContentType contentType(); | ||
|
||
ClassLoader classLoader(); | ||
} |
Oops, something went wrong.