Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/cli3' into bug/#334-download-mul…
Browse files Browse the repository at this point in the history
…tiple-sources-with-same-dest
  • Loading branch information
yzerk committed May 5, 2023
2 parents d22d983 + 89f6d6b commit af80ddb
Show file tree
Hide file tree
Showing 14 changed files with 173 additions and 52 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
needs: build
strategy:
matrix:
os: [ ubuntu-latest ]
os: [ ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand All @@ -72,9 +72,11 @@ jobs:
reporter: java-junit

- name: Generate code coverage report
if: matrix.os == 'ubuntu-latest'
run: ./gradlew build jacocoTestReport

- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
63 changes: 32 additions & 31 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import com.github.spotbugs.snom.SpotBugsReport
import static de.fayard.refreshVersions.core.Versions.versionFor

plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '7.0.0'
id 'com.github.johnrengelman.shadow'
id 'jacoco'
id "com.github.spotbugs" version "4.7.1"
id 'org.asciidoctor.jvm.convert' version '3.1.0'
id 'com.github.spotbugs'
id 'org.asciidoctor.jvm.convert'
}

apply plugin: 'checkstyle'
Expand All @@ -30,43 +31,43 @@ repositories {
}

dependencies {
implementation 'org.json:json:20210307'
implementation 'commons-cli:commons-cli:1.4'
implementation 'org.apache.logging.log4j:log4j-api:2.17.1'
implementation 'org.apache.logging.log4j:log4j-core:2.17.1'
implementation 'org.yaml:snakeyaml:1.29'
implementation 'commons-io:commons-io:2.10.0'
implementation 'org.json:json:_'
implementation 'commons-cli:commons-cli:_'
implementation 'org.apache.logging.log4j:log4j-api:_'
implementation 'org.apache.logging.log4j:log4j-core:_'
implementation 'org.yaml:snakeyaml:_'
implementation 'commons-io:commons-io:_'

implementation 'org.glassfish.jersey.core:jersey-client:3.0.2'
implementation 'org.glassfish.jersey.inject:jersey-hk2:3.0.2'
implementation 'org.glassfish.jersey.media:jersey-media-multipart:3.0.2'
implementation 'javax.activation:activation:1.1.1'
implementation 'org.glassfish.jersey.core:jersey-client:_'
implementation 'org.glassfish.jersey.inject:jersey-hk2:_'
implementation 'org.glassfish.jersey.media:jersey-media-multipart:_'
implementation 'javax.activation:activation:_'

implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'net.lingala.zip4j:zip4j:2.8.0'
implementation 'net.ricecode:string-similarity:1.0.0'
implementation 'com.github.fge:json-patch:1.9'
implementation 'io.github.cdimascio:dotenv-java:2.2.0'
implementation 'org.apache.commons:commons-lang3:_'
implementation 'net.lingala.zip4j:zip4j:_'
implementation 'net.ricecode:string-similarity:_'
implementation 'com.github.fge:json-patch:_'
implementation 'io.github.cdimascio:dotenv-java:_'

implementation 'org.apache.httpcomponents:httpclient:4.5.13'
implementation 'org.apache.httpcomponents:httpclient:_'

compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
testCompileOnly 'org.projectlombok:lombok:1.18.20'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.20'
compileOnly 'org.projectlombok:lombok:_'
annotationProcessor 'org.projectlombok:lombok:_'
testCompileOnly 'org.projectlombok:lombok:_'
testAnnotationProcessor 'org.projectlombok:lombok:_'

implementation 'com.github.crowdin:crowdin-api-client-java:1.6.2'
implementation 'com.github.crowdin:crowdin-api-client-java:_'

testImplementation 'org.junit.jupiter:junit-jupiter:5.7.2'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.mockito:mockito-core:3.11.2'
testImplementation Testing.junit.jupiter
testImplementation Testing.hamcrest
testImplementation Testing.mockito.core

spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.11.0'
spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:_'
}

dependencies {
implementation "info.picocli:picocli:4.7.1"
annotationProcessor "info.picocli:picocli-codegen:4.7.1"
implementation "info.picocli:picocli:_"
annotationProcessor "info.picocli:picocli-codegen:_"
}

jar {
Expand All @@ -93,7 +94,7 @@ test {
}

jacoco {
toolVersion = "0.8.7"
toolVersion = versionFor(project, "version.jacoco")
reportsDirectory = file("$buildDir/reports")
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 23 additions & 12 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright ? 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions ?$var?, ?${var}?, ?${var:-default}?, ?${var+SET}?,
# ?${var#prefix}?, ?${var%suffix}?, and ?$( cmd )?;
# * compound commands having a testable exit status, especially ?case?;
# * various built-in commands including ?command?, ?set?, and ?ulimit?.
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
Expand All @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -143,12 +140,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand All @@ -205,6 +210,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
15 changes: 9 additions & 6 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Expand Down Expand Up @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
7 changes: 6 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
rootProject.name = 'cli'

plugins {
// See https://jmfayard.github.io/refreshVersions
id 'de.fayard.refreshVersions' version '0.51.0'
}

rootProject.name = 'cli'
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.mockito.Mockito;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
Expand Down Expand Up @@ -73,6 +77,7 @@ public void testDest() throws IOException {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testDestAndUnaryAsterisk() throws IOException {
PropertiesWithFiles pb = NewPropertiesWithFilesUtilBuilder
.minimalBuiltPropertiesBean(
Expand Down Expand Up @@ -105,6 +110,7 @@ public void testDestAndUnaryAsterisk() throws IOException {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testDifferentPatterns() throws IOException {
PropertiesWithFiles pb = NewPropertiesWithFilesUtilBuilder
.minimalBuiltPropertiesBean("/folder_1/**/*.xml", "/%locale%/folder_1/**/%file_name%.xml")
Expand Down Expand Up @@ -189,6 +195,7 @@ public void testDifferentPatterns() throws IOException {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testWithPreserveHierarchyFalse() throws IOException {
PropertiesWithFiles pb = NewPropertiesWithFilesUtilBuilder
.minimalBuiltPropertiesBean("/folder_1/**/*.xml", "/%locale%/folder_1/**/%file_name%.xml")
Expand Down Expand Up @@ -255,6 +262,7 @@ public void testWithPreserveHierarchyFalse() throws IOException {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testDryRun() {
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
PrintStream ps = System.out;
Expand Down Expand Up @@ -293,6 +301,7 @@ public void testDryRun() {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testReviewedOnly() throws IOException {
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
PrintStream ps = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.crowdin.cli.commands.Outputter;
import com.crowdin.client.sourcefiles.model.File;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -55,6 +57,7 @@ public void testSimple_oneLocalFile_oneProjectFile_noObsolete() {
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSimple_oneLocalFile_twoProjectFile_oneObsolete() {
final String exportPattern = "/%file_name%.csv";
final String projectFilePath = "file1.csv";
Expand Down Expand Up @@ -124,6 +127,7 @@ public void testSimple_oneLocalFile_twoProjectFile_oneIgnoreProjectFile_noObsole
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_oneObsoleteDirectory() {
final String exportPattern = "/**/%file_name%.csv";
final String projectFilePath = "path/to/file1.csv";
Expand Down Expand Up @@ -165,6 +169,7 @@ public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_oneObsoleteDi
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_noPreserveHierarchy() {
final String exportPattern = "/**/%file_name%.csv";
String projectFilePath = "file1.csv";
Expand Down Expand Up @@ -200,6 +205,7 @@ public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_noPreserveHie
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_noPreserveHierarchy_2_withFolders() {
final String exportPattern = "/**/%file_name%.csv";
String projectFilePath = "to/file1.csv";
Expand Down Expand Up @@ -237,6 +243,7 @@ public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_noPreserveHie
}

@Test
@DisabledOnOs(OS.WINDOWS)
public void testSimple_oneLocalFile_twoProjectFile_oneObsoleteFile_twoObsoleteDirectory() {
final String exportPattern = "/**/%file_name%.csv";
final String projectFilePath = "path/to/file1.csv";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import com.crowdin.client.sourcefiles.model.GeneralFileExportOptions;
import com.crowdin.client.sourcefiles.model.PropertyFileExportOptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -52,6 +54,7 @@ public void testIsMultilingualFile() {

@ParameterizedTest
@MethodSource
@DisabledOnOs(OS.WINDOWS)
public void isProjectFileSatisfiesThePatternsTest(String projectFilePath, String sourcePattern, List<String> ignorePattern, boolean preserveHierarchy, boolean expected) {
assertEquals(expected, ProjectFilesUtils.isProjectFilePathSatisfiesPatterns(sourcePattern, ignorePattern, preserveHierarchy).test(projectFilePath));
}
Expand Down
Loading

0 comments on commit af80ddb

Please sign in to comment.