Skip to content

Commit eab9321

Browse files
authored
Merge pull request #103 from simplelocalize/update-dependencies
Update dependencies
2 parents 7f23fff + 03a3a12 commit eab9321

File tree

69 files changed

+745
-1349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+745
-1349
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
- '*-snapshot'
88
pull_request:
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
12+
cancel-in-progress: true
13+
1014
env:
1115
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
1216

@@ -15,20 +19,20 @@ jobs:
1519
name: "Build JAR"
1620
runs-on: ubuntu-latest
1721
steps:
18-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
1923
name: "Checkout"
20-
- uses: actions/setup-java@v3
24+
- uses: actions/setup-java@v4
2125
name: "Install Java"
2226
with:
23-
java-version: '17'
27+
java-version: '21'
2428
distribution: 'temurin'
2529
cache: 'maven'
2630
- name: "Build JAR"
2731
run: mvn -DskipTests -Pfatjar clean package
2832
- name: 'Get version'
2933
run: echo "::set-env name=VERSION::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
3034
- name: 'Upload artifact'
31-
uses: actions/upload-artifact@v3
35+
uses: actions/upload-artifact@v4
3236
with:
3337
name: 'simplelocalize-cli-${{env.VERSION}}.jar'
3438
path: 'target/simplelocalize-cli-${{env.VERSION}}.jar'
@@ -55,15 +59,13 @@ jobs:
5559
downloadFilename: 'simplelocalize-cli-windows.exe'
5660
runs-on: ${{ matrix.os }}
5761
steps:
58-
- uses: actions/checkout@v3
62+
- uses: actions/checkout@v4
5963
name: "Checkout"
6064
- uses: graalvm/setup-graalvm@v1
6165
name: "Install GraalVM"
6266
with:
63-
version: '22.3.2'
64-
java-version: '17.0.7'
67+
java-version: '21'
6568
distribution: 'graalvm'
66-
components: 'native-image'
6769
github-token: ${{ secrets.GITHUB_TOKEN }}
6870
native-image-job-reports: 'true'
6971
- name: "Build executable"
@@ -73,7 +75,7 @@ jobs:
7375
- name: "Rename executable"
7476
run: mv ./target/${{ matrix.filename }} ./target/${{ matrix.downloadFilename }}
7577
- name: "Upload artifact"
76-
uses: actions/upload-artifact@v3
78+
uses: actions/upload-artifact@v4
7779
with:
7880
name: simplelocalize-cli-${{ matrix.label }}
7981
path: ./target/${{ matrix.downloadFilename }}

.github/workflows/install-execute.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
schedule:
1010
- cron: '0 0 * * 0'
1111

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
1216
jobs:
1317
test-unix:
1418
name: "Testing ${{ matrix.version }} on ${{ matrix.os }}"

.github/workflows/run-tests.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66
branches:
77
- master
88

9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
913
env:
1014
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
1115

@@ -15,17 +19,17 @@ jobs:
1519
runs-on: ubuntu-latest
1620

1721
steps:
18-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
1923
with:
2024
fetch-depth: 0
21-
- uses: actions/setup-java@v3
25+
- uses: actions/setup-java@v4
2226
name: "Install Java"
2327
with:
24-
java-version: '17'
28+
java-version: '21'
2529
distribution: 'temurin'
2630
cache: 'maven'
2731
- name: Cache SonarCloud packages
28-
uses: actions/cache@v3
32+
uses: actions/cache@v4
2933
with:
3034
path: ~/.sonar/cache
3135
key: ${{ runner.os }}-sonar

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
*.iml
1717
*.ipr
1818

19+
extraction.json
20+
simplelocalize.yml
21+
22+
test
23+
1924
### NetBeans ###
2025
/nbproject/private/
2126
/nbbuild/
@@ -59,7 +64,7 @@ $RECYCLE.BIN/
5964
# Windows shortcuts
6065
*.lnk
6166

62-
/simplelocalize.yml
67+
/simplelocalize-sample.yml
6368
/dependency-reduced-pom.xml
6469
/build-far-jar.sh
6570
/build-quick.sh

pom.xml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,22 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>io.simplelocalize</groupId>
66
<artifactId>simplelocalize-cli</artifactId>
7-
<version>2.5.1</version>
7+
<version>2.6.0-beta</version>
88
<packaging>jar</packaging>
99
<name>simplelocalize-cli</name>
1010
<description>Official SimpleLocalize Command Line Interface</description>
1111

1212
<properties>
13-
<jdk.version>17</jdk.version>
13+
<jdk.version>21</jdk.version>
1414
<exec.mainClass>io.simplelocalize.cli.SimplelocalizeCliCommand</exec.mainClass>
1515
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1616
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
1717

1818
<!-- versions -->
1919
<junit5.version>5.9.2</junit5.version>
20-
<picocli.version>4.7.4</picocli.version>
20+
<picocli.version>4.7.5</picocli.version>
2121
<jackson.version>2.14.2</jackson.version>
22+
<lombok.version>1.18.30</lombok.version>
2223

2324
<!-- maven -->
2425
<maven.compiler.target>${jdk.version}</maven.compiler.target>
@@ -87,6 +88,13 @@
8788
<version>${jackson.version}</version>
8889
</dependency>
8990

91+
<dependency>
92+
<groupId>org.projectlombok</groupId>
93+
<artifactId>lombok</artifactId>
94+
<version>${lombok.version}</version>
95+
<optional>true</optional>
96+
</dependency>
97+
9098
<!-- test -->
9199
<dependency>
92100
<groupId>org.junit.jupiter</groupId>
@@ -115,13 +123,13 @@
115123
<dependency>
116124
<groupId>org.mockito</groupId>
117125
<artifactId>mockito-core</artifactId>
118-
<version>4.2.0</version>
126+
<version>5.7.0</version>
119127
<scope>test</scope>
120128
</dependency>
121129
<dependency>
122130
<groupId>org.mockito</groupId>
123131
<artifactId>mockito-junit-jupiter</artifactId>
124-
<version>4.2.0</version>
132+
<version>5.7.0</version>
125133
<scope>test</scope>
126134
</dependency>
127135
<dependency>
@@ -139,7 +147,7 @@
139147
<dependency>
140148
<groupId>org.mockito</groupId>
141149
<artifactId>mockito-inline</artifactId>
142-
<version>3.12.4</version>
150+
<version>5.2.0</version>
143151
<scope>test</scope>
144152
</dependency>
145153
<dependency>
@@ -184,8 +192,6 @@
184192
</activation>
185193
<build>
186194
<plugins>
187-
188-
189195
<plugin>
190196
<groupId>org.apache.maven.plugins</groupId>
191197
<artifactId>maven-jar-plugin</artifactId>
@@ -213,6 +219,11 @@
213219
<artifactId>picocli-codegen</artifactId>
214220
<version>${picocli.version}</version>
215221
</path>
222+
<path>
223+
<groupId>org.projectlombok</groupId>
224+
<artifactId>lombok</artifactId>
225+
<version>${lombok.version}</version>
226+
</path>
216227
</annotationProcessorPaths>
217228
<compilerArgs>
218229
<arg>-Aproject=${project.groupId}/${project.artifactId}</arg>

src/main/java/io/simplelocalize/cli/SimplelocalizeCliCommand.java

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,43 +53,33 @@ public static void main(String[] args)
5353

5454
@Command(
5555
name = "extract",
56-
description = "Extract translation keys from project files. Use 'simplelocalize extract --help' to learn more about the parameters.")
56+
description = "Extract translation keys from your project or website. Use 'simplelocalize extract --help' to learn more about the parameters.")
5757
public void extract(
58-
@Option(names = {"--apiKey"}, description = "Project API Key") String apiKey,
59-
@Option(names = {"--projectType"}, description = "Project type tells CLI how to find i18n keys in your project files") String projectType,
60-
@Option(names = {"--searchDir"}, description = "(Optional) Search directory tells CLI where to look for project files which may contain translation keys. Default: ./") String searchDirectory,
61-
@Option(names = {"--baseUrl"}, description = "(Optional) Set custom server URL") String baseUrl
58+
@Option(names = {"--projectType"}, description = "Choose extraction type") String projectType,
59+
@Option(names = {"--searchDir"}, description = "(Optional) Choose where to search it can be local file path. Default: ./") String searchDir,
60+
@Option(names = {"--outputPath"}, description = "(Optional) Choose where to save results. Default: ./extraction.json") String outputPath
6261
)
6362
{
6463
try
6564
{
6665
ConfigurationLoader configurationLoader = new ConfigurationLoader();
6766
Configuration configuration = configurationLoader.loadOrGetDefault(configurationFilePath);
68-
if (StringUtils.isNotEmpty(baseUrl))
69-
{
70-
configuration.setBaseUrl(baseUrl);
71-
}
72-
if (StringUtils.isNotEmpty(apiKey))
73-
{
74-
configuration.setApiKey(apiKey);
75-
}
7667
if (StringUtils.isNotEmpty(projectType))
7768
{
7869
configuration.setProjectType(projectType);
7970
}
80-
if (StringUtils.isNotEmpty(searchDirectory))
71+
if (StringUtils.isNotEmpty(searchDir))
8172
{
82-
configuration.setSearchDir(searchDirectory);
73+
configuration.setSearchDir(searchDir);
8374
}
84-
if (StringUtils.isNotEmpty(searchDirectory))
75+
if (StringUtils.isNotEmpty(outputPath))
8576
{
86-
configuration.setSearchDir(searchDirectory);
77+
configuration.setOutputPath(outputPath);
8778
}
8879
this.effectiveCommandConfiguration = configuration;
8980
ConfigurationValidator configurationValidator = new ConfigurationValidator();
9081
configurationValidator.validateExtractConfiguration(configuration);
91-
SimpleLocalizeClient client = SimpleLocalizeClient.create(configuration.getBaseUrl(), configuration.getApiKey());
92-
ExtractCommand extractCommand = new ExtractCommand(client, configuration);
82+
ExtractCommand extractCommand = new ExtractCommand(configuration);
9383
extractCommand.invoke();
9484
} catch (Exception e)
9585
{
@@ -352,8 +342,9 @@ public void startAutoTranslation(
352342

353343
if (languageKeys != null)
354344
{
355-
AutoTranslationConfiguration autoTranslationConfiguration = new AutoTranslationConfiguration();
356-
autoTranslationConfiguration.setLanguageKeys(languageKeys);
345+
AutoTranslationConfiguration autoTranslationConfiguration = AutoTranslationConfiguration.builder()
346+
.languageKeys(languageKeys)
347+
.build();
357348
configuration.setAutoTranslation(autoTranslationConfiguration);
358349
}
359350

src/main/java/io/simplelocalize/cli/client/HttpClientFactory.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public static HttpClient createHttpClient()
3838
ProxySelector proxySelector = getProxySelector(proxyConfigOptional);
3939
builder.proxy(proxySelector);
4040

41-
String proxyUsername = proxyConfigOptional.getUsername();
42-
String proxyPassword = proxyConfigOptional.getPassword();
41+
String proxyUsername = proxyConfigOptional.username();
42+
String proxyPassword = proxyConfigOptional.password();
4343
boolean hasProxyAuthentication = proxyUsername != null && proxyPassword != null;
4444
if (hasProxyAuthentication)
4545
{
@@ -63,8 +63,8 @@ private static String getSystemProxyVariable()
6363

6464
private static ProxySelector getProxySelector(ProxyConfiguration proxyConfigOptional)
6565
{
66-
String host = proxyConfigOptional.getHost();
67-
Integer port = proxyConfigOptional.getPort();
66+
String host = proxyConfigOptional.host();
67+
Integer port = proxyConfigOptional.port();
6868
InetSocketAddress proxyAddress = new InetSocketAddress(host, port);
6969
return ProxySelector.of(proxyAddress);
7070
}

src/main/java/io/simplelocalize/cli/client/SimpleLocalizeClient.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.nio.file.Files;
2121
import java.nio.file.Path;
2222
import java.nio.file.StandardOpenOption;
23-
import java.util.Collection;
2423
import java.util.List;
2524
import java.util.Objects;
2625
import java.util.Optional;
@@ -55,15 +54,6 @@ public static SimpleLocalizeClient create(String baseUrl, String apiKey)
5554
return new SimpleLocalizeClient(baseUrl, apiKey);
5655
}
5756

58-
public Integer uploadKeys(Collection<String> keys) throws IOException, InterruptedException
59-
{
60-
URI uri = uriFactory.buildSendKeysURI();
61-
HttpRequest httpRequest = httpRequestFactory.createSendKeysRequest(uri, keys);
62-
HttpResponse<String> httpResponse = httpClient.send(httpRequest, HttpResponse.BodyHandlers.ofString());
63-
throwOnError(httpResponse);
64-
return JsonPath.read(httpResponse.body(), "$.data.uniqueKeysProcessed");
65-
}
66-
6757
public void uploadFile(UploadRequest uploadRequest) throws IOException, InterruptedException
6858
{
6959
URI uri = uriFactory.buildUploadUri(uploadRequest);

src/main/java/io/simplelocalize/cli/client/SimpleLocalizeHttpRequestFactory.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package io.simplelocalize.cli.client;
22

3-
import com.fasterxml.jackson.core.JsonProcessingException;
43
import io.simplelocalize.cli.Version;
54
import io.simplelocalize.cli.client.dto.UploadRequest;
65

@@ -9,7 +8,6 @@
98
import java.net.http.HttpRequest;
109
import java.nio.file.Path;
1110
import java.security.SecureRandom;
12-
import java.util.Collection;
1311
import java.util.HashMap;
1412
import java.util.Map;
1513

@@ -28,14 +26,6 @@ public SimpleLocalizeHttpRequestFactory(String apiKey)
2826
this.random = new SecureRandom();
2927
}
3028

31-
HttpRequest createSendKeysRequest(URI uri, Collection<String> keys) throws JsonProcessingException
32-
{
33-
return createBaseRequest(uri)
34-
.POST(ClientBodyBuilders.ofKeysBody(keys))
35-
.header(CONTENT_TYPE_HEADER_NAME, "application/json")
36-
.build();
37-
}
38-
3929
HttpRequest createUploadFileRequest(URI uri, UploadRequest uploadRequest) throws IOException
4030
{
4131
int pseudoRandomNumber = (int) (random.nextDouble() * 1_000_000_000);

0 commit comments

Comments
 (0)