Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Gradle] Add destination directory to the action params #658

Merged
merged 1 commit into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
gradle-build-root: gradle-twirl
cmd: |
sbt ci-release
sbt +compiler/publishM2 ci-release
cd gradle-twirl
./gradlew --no-daemon publishToSonatype -x test -PsonatypeUsername="$SONATYPE_USERNAME" -PsonatypePassword="$SONATYPE_PASSWORD"
secrets: inherit
Expand All @@ -29,7 +29,7 @@ jobs:
with:
gradle-build-root: gradle-twirl
cmd: |
sbt ci-release
sbt +compiler/publishM2 ci-release
cd gradle-twirl
./gradlew --no-daemon publishPlugins -x test -Pgradle.publish.key="$GRADLE_PUBLISH_KEY" -Pgradle.publish.secret="$GRADLE_PUBLISH_SECRET"
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ void compile() {
TwirlCompileAction.class,
parameters -> {
parameters.getSourceFile().set(sourceFile);
parameters.getDestinationDirectory().set(getDestinationDirectory());
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,18 @@
package play.twirl.gradle;

import org.gradle.workers.WorkAction;
import play.twirl.gradle.internal.TwirlCompileParams;

public abstract class TwirlCompileAction implements WorkAction<TwirlCompileParams> {

@Override
public void execute() {
try {
System.out.println(
"Compile Twirl template " + getParameters().getSourceFile().getAsFile().get().getName());
"Compile Twirl template "
+ getParameters().getSourceFile().getAsFile().get().getName()
+ " into "
+ getParameters().getDestinationDirectory().getAsFile().get().getCanonicalPath());
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/*
* Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com>
*/
package play.twirl.gradle;
package play.twirl.gradle.internal;

import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.workers.WorkParameters;

public interface TwirlCompileParams extends WorkParameters {

RegularFileProperty getSourceFile();

DirectoryProperty getDestinationDirectory();
}
Loading