Skip to content

Commit d09b3c8

Browse files
java modules: modularize handlebars modules
- fix #1018
1 parent cd2d035 commit d09b3c8

26 files changed

Lines changed: 259 additions & 16 deletions

File tree

handlebars-caffeine/src/main/java/com/github/jknack/handlebars/cache/CaffeineTemplateCache.java renamed to handlebars-caffeine/src/main/java/com/github/jknack/handlebars/caffeine/CaffeineTemplateCache.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Apache License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
44
* Copyright (c) 2012 Edgar Espina
55
*/
6-
package com.github.jknack.handlebars.cache;
6+
package com.github.jknack.handlebars.caffeine;
77

88
import static java.util.Objects.requireNonNull;
99

@@ -14,6 +14,7 @@
1414
import com.github.jknack.handlebars.Handlebars;
1515
import com.github.jknack.handlebars.Parser;
1616
import com.github.jknack.handlebars.Template;
17+
import com.github.jknack.handlebars.cache.TemplateCache;
1718
import com.github.jknack.handlebars.io.TemplateSource;
1819

1920
/**

handlebars-caffeine/src/main/java/com/github/jknack/handlebars/io/CaffeineTemplateLoader.java renamed to handlebars-caffeine/src/main/java/com/github/jknack/handlebars/caffeine/CaffeineTemplateLoader.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
* Apache License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
44
* Copyright (c) 2012 Edgar Espina
55
*/
6-
package com.github.jknack.handlebars.io;
6+
package com.github.jknack.handlebars.caffeine;
77

88
import java.io.IOException;
99
import java.nio.charset.Charset;
1010
import java.util.function.Function;
1111

1212
import com.github.benmanes.caffeine.cache.Cache;
1313
import com.github.jknack.handlebars.Handlebars;
14+
import com.github.jknack.handlebars.io.TemplateLoader;
15+
import com.github.jknack.handlebars.io.TemplateSource;
1416

1517
/**
1618
* Decorates an existing TemplateLoader with a GuavaCache. This is useful to avoid constantly
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module com.github.jknack.handlebars.caffeine {
2+
exports com.github.jknack.handlebars.caffeine;
3+
4+
requires org.slf4j;
5+
requires com.github.jknack.handlebars;
6+
requires com.github.benmanes.caffeine;
7+
}

handlebars-caffeine/src/test/java/com/github/jknack/handlebars/cache/CaffeineTemplateCacheTest.java renamed to handlebars-caffeine/src/test/java/com/github/jknack/handlebars/caffeine/cache/CaffeineTemplateCacheTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Apache License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
44
* Copyright (c) 2012 Edgar Espina
55
*/
6-
package com.github.jknack.handlebars.cache;
6+
package com.github.jknack.handlebars.caffeine.cache;
77

88
import static org.junit.jupiter.api.Assertions.assertEquals;
99
import static org.junit.jupiter.api.Assertions.fail;
@@ -23,6 +23,7 @@
2323
import com.github.jknack.handlebars.HandlebarsException;
2424
import com.github.jknack.handlebars.Parser;
2525
import com.github.jknack.handlebars.Template;
26+
import com.github.jknack.handlebars.caffeine.CaffeineTemplateCache;
2627
import com.github.jknack.handlebars.io.TemplateSource;
2728

2829
public class CaffeineTemplateCacheTest {

handlebars-guava-cache/pom.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,26 @@
5555
</dependency>
5656
</dependencies>
5757

58+
<build>
59+
<plugins>
60+
<plugin>
61+
<groupId>org.apache.maven.plugins</groupId>
62+
<artifactId>maven-surefire-plugin</artifactId>
63+
<version>3.2.5</version>
64+
<configuration>
65+
<!-- set default locale of the test JVM to en_US because some tests expect e.g. the dollar sign as currency symbol -->
66+
<argLine>-Duser.language=en -Duser.country=US</argLine>
67+
<useModulePath>false</useModulePath>
68+
<includes>
69+
<include>**/*Test.java</include>
70+
<include>**/Issue*.java</include>
71+
<include>**/Hbs*.java</include>
72+
</includes>
73+
<excludes>
74+
<exclude>**/*BenchTest.java</exclude>
75+
</excludes>
76+
</configuration>
77+
</plugin>
78+
</plugins>
79+
</build>
5880
</project>

handlebars-guava-cache/src/main/java/com/github/jknack/handlebars/io/GuavaCachedTemplateLoader.java renamed to handlebars-guava-cache/src/main/java/com/github/jknack/handlebars/guava/GuavaCachedTemplateLoader.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
* Apache License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
44
* Copyright (c) 2012 Edgar Espina
55
*/
6-
package com.github.jknack.handlebars.io;
6+
package com.github.jknack.handlebars.guava;
77

88
import java.io.IOException;
99
import java.nio.charset.Charset;
1010
import java.util.concurrent.ExecutionException;
1111
import java.util.concurrent.TimeUnit;
1212

1313
import com.github.jknack.handlebars.Handlebars;
14+
import com.github.jknack.handlebars.io.TemplateLoader;
15+
import com.github.jknack.handlebars.io.TemplateSource;
1416
import com.google.common.cache.Cache;
1517
import com.google.common.cache.CacheBuilder;
1618

handlebars-guava-cache/src/main/java/com/github/jknack/handlebars/cache/GuavaTemplateCache.java renamed to handlebars-guava-cache/src/main/java/com/github/jknack/handlebars/guava/GuavaTemplateCache.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Apache License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
44
* Copyright (c) 2012 Edgar Espina
55
*/
6-
package com.github.jknack.handlebars.cache;
6+
package com.github.jknack.handlebars.guava;
77

88
import static java.util.Objects.requireNonNull;
99

@@ -13,6 +13,7 @@
1313
import com.github.jknack.handlebars.HandlebarsException;
1414
import com.github.jknack.handlebars.Parser;
1515
import com.github.jknack.handlebars.Template;
16+
import com.github.jknack.handlebars.cache.TemplateCache;
1617
import com.github.jknack.handlebars.io.ReloadableTemplateSource;
1718
import com.github.jknack.handlebars.io.TemplateSource;
1819
import com.google.common.cache.Cache;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module com.github.jknack.handlebars.guava {
2+
exports com.github.jknack.handlebars.guava;
3+
4+
requires org.slf4j;
5+
requires com.github.jknack.handlebars;
6+
requires com.google.common;
7+
}

handlebars-guava-cache/src/test/java/com/github/jknack/handlebars/io/GuavaCachedTemplateLoaderTest.java renamed to handlebars-guava-cache/src/test/java/com/github/jknack/handlebars/guava/GuavaCachedTemplateLoaderTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Apache License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
44
* Copyright (c) 2012 Edgar Espina
55
*/
6-
package com.github.jknack.handlebars.io;
6+
package com.github.jknack.handlebars.guava;
77

88
import static java.lang.System.out;
99
import static org.junit.jupiter.api.Assertions.assertNotNull;
@@ -13,6 +13,8 @@
1313

1414
import org.junit.jupiter.api.Test;
1515

16+
import com.github.jknack.handlebars.io.FileTemplateLoader;
17+
import com.github.jknack.handlebars.io.TemplateLoader;
1618
import com.google.common.base.Stopwatch;
1719

1820
public class GuavaCachedTemplateLoaderTest {

handlebars-guava-cache/src/test/java/com/github/jknack/handlebars/cache/GuavaTemplateCacheTest.java renamed to handlebars-guava-cache/src/test/java/com/github/jknack/handlebars/guava/GuavaTemplateCacheTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Apache License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
44
* Copyright (c) 2012 Edgar Espina
55
*/
6-
package com.github.jknack.handlebars.cache;
6+
package com.github.jknack.handlebars.guava;
77

88
import static org.junit.jupiter.api.Assertions.assertEquals;
99
import static org.mockito.ArgumentMatchers.any;

0 commit comments

Comments
 (0)