-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
145 additions
and
17 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
27 changes: 27 additions & 0 deletions
27
gradle-twirl/src/main/java/play/twirl/gradle/TwirlCompile.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,27 @@ | ||
/* | ||
* Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
package play.twirl.gradle; | ||
|
||
import java.io.File; | ||
import org.gradle.api.file.DirectoryProperty; | ||
import org.gradle.api.tasks.OutputDirectory; | ||
import org.gradle.api.tasks.SourceTask; | ||
import org.gradle.api.tasks.TaskAction; | ||
|
||
public abstract class TwirlCompile extends SourceTask { | ||
|
||
@OutputDirectory | ||
public abstract DirectoryProperty getDestinationDirectory(); | ||
|
||
@TaskAction | ||
void compile() { | ||
for (File sourceFile : getSource().getFiles()) { | ||
try { | ||
System.out.println("Compile Twirl template " + sourceFile.getName()); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} | ||
} |
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
12 changes: 12 additions & 0 deletions
12
gradle-twirl/src/main/java/play/twirl/gradle/TwirlSourceDirectorySet.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,12 @@ | ||
/* | ||
* Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
package play.twirl.gradle; | ||
|
||
import org.gradle.api.file.SourceDirectorySet; | ||
|
||
/** | ||
* A {@code TwirlSourceDirectorySet} defines the properties and methods added to a {@link | ||
* org.gradle.api.tasks.SourceSet} by the {@code TwirlPlugin}. | ||
*/ | ||
public interface TwirlSourceDirectorySet extends SourceDirectorySet {} |
19 changes: 19 additions & 0 deletions
19
gradle-twirl/src/main/java/play/twirl/gradle/internal/DefaultTwirlSourceDirectorySet.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,19 @@ | ||
/* | ||
* Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
package play.twirl.gradle.internal; | ||
|
||
import javax.inject.Inject; | ||
import org.gradle.api.file.SourceDirectorySet; | ||
import org.gradle.api.internal.file.DefaultSourceDirectorySet; | ||
import org.gradle.api.internal.tasks.TaskDependencyFactory; | ||
import play.twirl.gradle.TwirlSourceDirectorySet; | ||
|
||
public class DefaultTwirlSourceDirectorySet extends DefaultSourceDirectorySet | ||
implements TwirlSourceDirectorySet { | ||
@Inject | ||
public DefaultTwirlSourceDirectorySet( | ||
SourceDirectorySet sourceDirectorySet, TaskDependencyFactory taskDependencyFactory) { | ||
super(sourceDirectorySet, taskDependencyFactory); // Gradle 8+ | ||
} | ||
} |
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