Skip to content

Commit

Permalink
Merge pull request #29 from Thodor12/feature/support-config-cache
Browse files Browse the repository at this point in the history
  • Loading branch information
kingthorin authored Oct 21, 2024
2 parents a729e85 + a87d9e7 commit 337835a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Recommended minimum Gradle version is now 8.8.

### Fixed
- Address configuration cache problems.

## [0.4.0] - 2024-05-07
### Added
- Allow to filter out translated files when copying them.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void from(String dir) {
@TaskAction
void copy() {
CrowdinConfiguration configuration = getCrowdinConfiguration();
Path baseDir = getProject().getProjectDir().toPath();
Path baseDir = getProjectLayout().getProjectDirectory().getAsFile().toPath();
Path packagesDir = getTranslationsPackageDirectory().getAsFile().get().toPath();

TranslationsCopier copier =
Expand Down
11 changes: 10 additions & 1 deletion src/main/java/org/zaproxy/gradle/crowdin/tasks/CrowdinTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
import javax.inject.Inject;
import org.gradle.api.DefaultTask;
import org.gradle.api.file.ProjectLayout;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.provider.MapProperty;
import org.gradle.api.provider.Property;
Expand Down Expand Up @@ -64,6 +66,11 @@ protected CrowdinTask() {
getConfigurationTokens().convention(Collections.emptyMap());
}

@Inject
protected ProjectLayout getProjectLayout() {
throw new UnsupportedOperationException();
}

@Input
public abstract Property<String> getAuthToken();

Expand Down Expand Up @@ -118,7 +125,9 @@ protected <R> R apiRequest(Function<Client, R> access) {
protected LocalVfs createLocalVfs(CrowdinProject crowdinProject) {
try {
return new LocalVfs(
getProject().getProjectDir().toPath(), crowdinProject, getSimpleLogger());
getProjectLayout().getProjectDirectory().getAsFile().toPath(),
crowdinProject,
getSimpleLogger());
} catch (IOException e) {
throw new CrowdinPluginException(
"An error occurred while enumerating the local files, cause: " + e.getMessage(),
Expand Down

0 comments on commit 337835a

Please sign in to comment.