From 15c83aa592389dc3217cca9de7649586091f4f32 Mon Sep 17 00:00:00 2001 From: Devin Bileck <603793+devinbileck@users.noreply.github.com> Date: Thu, 15 Nov 2018 22:34:05 -0800 Subject: [PATCH 1/3] Add .gitattributes file --- .gitattributes | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..69605aed703 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,16 @@ +# Auto detect text files and normalize line endings to LF +# This will handle all files NOT found below +* text=auto + +# These text files should retain Windows line endings (CRLF) +*.bat text eol=crlf + +# These binary files should be left untouched +# (binary is a macro for -text -diff) +*.bmp binary +*.gif binary +*.ico binary +*.jar binary +*.jpg binary +*.jpeg binary +*.png binary From fa5c402af5ed81fb27ffdccef1dbf897ad4be6c5 Mon Sep 17 00:00:00 2001 From: Devin Bileck <603793+devinbileck@users.noreply.github.com> Date: Thu, 15 Nov 2018 22:42:21 -0800 Subject: [PATCH 2/3] Normalize line endings --- .../src/main/java/bisq/asset/coins/Zero.java | 84 ++++----- .../test/java/bisq/asset/coins/ZeroTest.java | 86 ++++----- gradlew.bat | 168 +++++++++--------- 3 files changed, 169 insertions(+), 169 deletions(-) diff --git a/assets/src/main/java/bisq/asset/coins/Zero.java b/assets/src/main/java/bisq/asset/coins/Zero.java index 910d25f911d..ea0fbc83cd8 100644 --- a/assets/src/main/java/bisq/asset/coins/Zero.java +++ b/assets/src/main/java/bisq/asset/coins/Zero.java @@ -1,42 +1,42 @@ -/* - * This file is part of Bisq. - * - * Bisq is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bisq is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bisq. If not, see . - */ - -package bisq.asset.coins; - -import bisq.asset.AddressValidationResult; -import bisq.asset.AddressValidator; -import bisq.asset.Coin; - -public class Zero extends Coin { - - public Zero() { - super("Zero", "ZER", new ZeroAddressValidator()); - } - - - public static class ZeroAddressValidator implements AddressValidator { - - @Override - public AddressValidationResult validate(String address) { - // We only support t addresses (transparent transactions) - if (!address.startsWith("t1")) - return AddressValidationResult.invalidAddress("", "validation.altcoin.zAddressesNotSupported"); - - return AddressValidationResult.validAddress(); - } - } -} +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.asset.coins; + +import bisq.asset.AddressValidationResult; +import bisq.asset.AddressValidator; +import bisq.asset.Coin; + +public class Zero extends Coin { + + public Zero() { + super("Zero", "ZER", new ZeroAddressValidator()); + } + + + public static class ZeroAddressValidator implements AddressValidator { + + @Override + public AddressValidationResult validate(String address) { + // We only support t addresses (transparent transactions) + if (!address.startsWith("t1")) + return AddressValidationResult.invalidAddress("", "validation.altcoin.zAddressesNotSupported"); + + return AddressValidationResult.validAddress(); + } + } +} diff --git a/assets/src/test/java/bisq/asset/coins/ZeroTest.java b/assets/src/test/java/bisq/asset/coins/ZeroTest.java index fc110d137da..4fd5309f966 100644 --- a/assets/src/test/java/bisq/asset/coins/ZeroTest.java +++ b/assets/src/test/java/bisq/asset/coins/ZeroTest.java @@ -1,43 +1,43 @@ -/* - * This file is part of Bisq. - * - * Bisq is free software: you can redistribute it and/or modify it - * under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or (at - * your option) any later version. - * - * Bisq is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public - * License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with Bisq. If not, see . - */ - -package bisq.asset.coins; - -import bisq.asset.AbstractAssetTest; - -import org.junit.Test; - -public class ZeroTest extends AbstractAssetTest { - - public ZeroTest() { - super(new Zero()); - } - - @Test - public void testValidAddresses() { - assertValidAddress("t1cZTNaKS6juH6tGEhCUZmZhtbYGeYeuTrK"); - assertValidAddress("t1ZBPYJwK2UPbshwcYWRiCq7vw8VPDYumWu"); - } - - @Test - public void testInvalidAddresses() { - assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem"); - assertInvalidAddress("38NwrYsD1HxQW5zfLT0QcUUXGMPvQgzTSn"); - assertInvalidAddress("8tP9rh3SH6n9cSLmV22vnSNNw56LKGpLrB"); - assertInvalidAddress("8Zbvjr"); - } -} +/* + * This file is part of Bisq. + * + * Bisq is free software: you can redistribute it and/or modify it + * under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or (at + * your option) any later version. + * + * Bisq is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public + * License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Bisq. If not, see . + */ + +package bisq.asset.coins; + +import bisq.asset.AbstractAssetTest; + +import org.junit.Test; + +public class ZeroTest extends AbstractAssetTest { + + public ZeroTest() { + super(new Zero()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("t1cZTNaKS6juH6tGEhCUZmZhtbYGeYeuTrK"); + assertValidAddress("t1ZBPYJwK2UPbshwcYWRiCq7vw8VPDYumWu"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem"); + assertInvalidAddress("38NwrYsD1HxQW5zfLT0QcUUXGMPvQgzTSn"); + assertInvalidAddress("8tP9rh3SH6n9cSLmV22vnSNNw56LKGpLrB"); + assertInvalidAddress("8Zbvjr"); + } +} diff --git a/gradlew.bat b/gradlew.bat index e95643d6a2c..f9553162f12 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,84 +1,84 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="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 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="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 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega From 9f4f5c48e12ae5c3a29524ac67c8bea7df06d583 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Tue, 20 Nov 2018 14:15:01 +0100 Subject: [PATCH 3/3] Preserve CRLF line endings in .bat files This is specifically for the gradlew.bat file generated by the `gradle wrapper` command. Typically, this file should never be edited, but just in case it is, this configuration will preserve its original CRLF line endings. --- .editorconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.editorconfig b/.editorconfig index 62fd567a454..a2908b2c614 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,6 +9,9 @@ charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true +[*.bat] +end_of_line = crlf + [build.gradle] continuation_indent_size = 4