From 7e9aa27b3b3b84392c91ac428ea0b0a7eaf66872 Mon Sep 17 00:00:00 2001 From: Federico2014 Date: Fri, 24 Jan 2025 11:22:58 +0800 Subject: [PATCH] refactor the gradlew directory (#15) --- .gitignore | 2 +- .../config => conf}/checkstyle/checkStyle.xml | 0 .../checkstyle/checkStyleAll.xml | 0 {tools => images}/shadow-fork.png | Bin tools/{ => dbfork}/README.md | 8 +- tools/dbfork/build.gradle | 2 +- {docker => tools/docker}/Dockerfile | 0 {docker => tools/docker}/build.gradle | 4 +- {docker => tools/docker}/docker-entrypoint.sh | 0 {docker => tools/docker}/docker.md | 0 {docker => tools/docker}/docker.sh | 0 {docker => tools/docker}/test.sh | 0 {docker => tools/docker}/tests/01/goss.yaml | 0 .../docker}/tests/01/goss_wait.yaml | 0 {docker => tools/docker}/tests/01/testSync.sh | 0 {docker => tools/docker}/tests/dgoss | 0 .../docker}/tests/goss-linux-amd64 | Bin {gradlew => tools/gradlew}/build.gradle | 0 .../gradle/wrapper/gradle-wrapper.jar | Bin .../gradle/wrapper/gradle-wrapper.properties | 0 {gradlew => tools/gradlew}/gradlew | 0 {gradlew => tools/gradlew}/gradlew.bat | 184 +++++++++--------- {gradlew => tools/gradlew}/settings.gradle | 4 +- 23 files changed, 102 insertions(+), 102 deletions(-) rename {tools/config => conf}/checkstyle/checkStyle.xml (100%) rename {tools/config => conf}/checkstyle/checkStyleAll.xml (100%) rename {tools => images}/shadow-fork.png (100%) rename tools/{ => dbfork}/README.md (97%) rename {docker => tools/docker}/Dockerfile (100%) rename {docker => tools/docker}/build.gradle (98%) rename {docker => tools/docker}/docker-entrypoint.sh (100%) rename {docker => tools/docker}/docker.md (100%) rename {docker => tools/docker}/docker.sh (100%) rename {docker => tools/docker}/test.sh (100%) rename {docker => tools/docker}/tests/01/goss.yaml (100%) rename {docker => tools/docker}/tests/01/goss_wait.yaml (100%) rename {docker => tools/docker}/tests/01/testSync.sh (100%) rename {docker => tools/docker}/tests/dgoss (100%) rename {docker => tools/docker}/tests/goss-linux-amd64 (100%) rename {gradlew => tools/gradlew}/build.gradle (100%) rename {gradlew => tools/gradlew}/gradle/wrapper/gradle-wrapper.jar (100%) rename {gradlew => tools/gradlew}/gradle/wrapper/gradle-wrapper.properties (100%) rename {gradlew => tools/gradlew}/gradlew (100%) rename {gradlew => tools/gradlew}/gradlew.bat (96%) rename {gradlew => tools/gradlew}/settings.gradle (53%) diff --git a/.gitignore b/.gitignore index c7867e8..b8cb97b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ .gradle/ .vscode/ .idea/ -docker/reports/ +tools/docker/reports/ build/ tmp/ target/ diff --git a/tools/config/checkstyle/checkStyle.xml b/conf/checkstyle/checkStyle.xml similarity index 100% rename from tools/config/checkstyle/checkStyle.xml rename to conf/checkstyle/checkStyle.xml diff --git a/tools/config/checkstyle/checkStyleAll.xml b/conf/checkstyle/checkStyleAll.xml similarity index 100% rename from tools/config/checkstyle/checkStyleAll.xml rename to conf/checkstyle/checkStyleAll.xml diff --git a/tools/shadow-fork.png b/images/shadow-fork.png similarity index 100% rename from tools/shadow-fork.png rename to images/shadow-fork.png diff --git a/tools/README.md b/tools/dbfork/README.md similarity index 97% rename from tools/README.md rename to tools/dbfork/README.md index ca13a15..3d6fbde 100644 --- a/tools/README.md +++ b/tools/dbfork/README.md @@ -17,7 +17,7 @@ developers can connect and interact with the node by [wallet-cli](https://tronpr The whole procedure of shadow fork is described in the following figure: -![image](./shadow-fork.png) +![image](../../images/shadow-fork.png) ### Obtain the state data To use the DBFork tool, we need to obtain the state data of the public chain first. There are three possible ways: @@ -119,11 +119,11 @@ Execute database fork command: # clone the tron-docker git clone https://github.com/tronprotocol/tron-docker.git # enter the directory -cd tron-docker/gradlew +cd tron-docker/tools/gradlew # compile the database fork tool -./gradlew :tools:dbfork:build +./gradlew :dbfork:build # execute full command -cd .. && java -jar tools/dbfork/build/libs/dbfork.jar -c fork.conf -d output-directory +java -jar ../dbfork/build/libs/dbfork.jar -c /path/to/fork.conf -d /path/to/output-directory ``` ### Launch the FullNode diff --git a/tools/dbfork/build.gradle b/tools/dbfork/build.gradle index 3dbfae7..131af48 100644 --- a/tools/dbfork/build.gradle +++ b/tools/dbfork/build.gradle @@ -61,7 +61,7 @@ jar { checkstyle { toolVersion = '8.41' - configFile = file("../config/checkstyle/checkStyle.xml") + configFile = file("../../conf/checkstyle/checkStyle.xml") } task checkstyleDBForkMain(type: Checkstyle) { diff --git a/docker/Dockerfile b/tools/docker/Dockerfile similarity index 100% rename from docker/Dockerfile rename to tools/docker/Dockerfile diff --git a/docker/build.gradle b/tools/docker/build.gradle similarity index 98% rename from docker/build.gradle rename to tools/docker/build.gradle index 85d0afc..77a98c5 100644 --- a/docker/build.gradle +++ b/tools/docker/build.gradle @@ -102,7 +102,7 @@ def isInterimBuild(dockerBuildVersion) { task testDocker { dependsOn sourceDocker - def dockerReportsDir = "reports/" + def dockerReportsDir = "${rootDir}/../docker/reports/" doFirst { new File(dockerReportsDir).mkdir() @@ -149,4 +149,4 @@ task dockerUpload { tasks.named('jar') { enabled = false -} \ No newline at end of file +} diff --git a/docker/docker-entrypoint.sh b/tools/docker/docker-entrypoint.sh similarity index 100% rename from docker/docker-entrypoint.sh rename to tools/docker/docker-entrypoint.sh diff --git a/docker/docker.md b/tools/docker/docker.md similarity index 100% rename from docker/docker.md rename to tools/docker/docker.md diff --git a/docker/docker.sh b/tools/docker/docker.sh similarity index 100% rename from docker/docker.sh rename to tools/docker/docker.sh diff --git a/docker/test.sh b/tools/docker/test.sh similarity index 100% rename from docker/test.sh rename to tools/docker/test.sh diff --git a/docker/tests/01/goss.yaml b/tools/docker/tests/01/goss.yaml similarity index 100% rename from docker/tests/01/goss.yaml rename to tools/docker/tests/01/goss.yaml diff --git a/docker/tests/01/goss_wait.yaml b/tools/docker/tests/01/goss_wait.yaml similarity index 100% rename from docker/tests/01/goss_wait.yaml rename to tools/docker/tests/01/goss_wait.yaml diff --git a/docker/tests/01/testSync.sh b/tools/docker/tests/01/testSync.sh similarity index 100% rename from docker/tests/01/testSync.sh rename to tools/docker/tests/01/testSync.sh diff --git a/docker/tests/dgoss b/tools/docker/tests/dgoss similarity index 100% rename from docker/tests/dgoss rename to tools/docker/tests/dgoss diff --git a/docker/tests/goss-linux-amd64 b/tools/docker/tests/goss-linux-amd64 similarity index 100% rename from docker/tests/goss-linux-amd64 rename to tools/docker/tests/goss-linux-amd64 diff --git a/gradlew/build.gradle b/tools/gradlew/build.gradle similarity index 100% rename from gradlew/build.gradle rename to tools/gradlew/build.gradle diff --git a/gradlew/gradle/wrapper/gradle-wrapper.jar b/tools/gradlew/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from gradlew/gradle/wrapper/gradle-wrapper.jar rename to tools/gradlew/gradle/wrapper/gradle-wrapper.jar diff --git a/gradlew/gradle/wrapper/gradle-wrapper.properties b/tools/gradlew/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from gradlew/gradle/wrapper/gradle-wrapper.properties rename to tools/gradlew/gradle/wrapper/gradle-wrapper.properties diff --git a/gradlew/gradlew b/tools/gradlew/gradlew similarity index 100% rename from gradlew/gradlew rename to tools/gradlew/gradlew diff --git a/gradlew/gradlew.bat b/tools/gradlew/gradlew.bat similarity index 96% rename from gradlew/gradlew.bat rename to tools/gradlew/gradlew.bat index 6689b85..93e3f59 100644 --- a/gradlew/gradlew.bat +++ b/tools/gradlew/gradlew.bat @@ -1,92 +1,92 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem - -@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=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@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="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -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 execute - -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 - -: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 %* - -:end -@rem End local scope for the variables with windows NT shell -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! -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 - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@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=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@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="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +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 execute + +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 + +: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 %* + +:end +@rem End local scope for the variables with windows NT shell +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! +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 + +:omega diff --git a/gradlew/settings.gradle b/tools/gradlew/settings.gradle similarity index 53% rename from gradlew/settings.gradle rename to tools/gradlew/settings.gradle index ec5bfd1..7e87c5e 100644 --- a/gradlew/settings.gradle +++ b/tools/gradlew/settings.gradle @@ -1,5 +1,5 @@ rootProject.name = 'tron-docker' include('docker') project(':docker').projectDir = new File(rootDir, '../docker') -include('tools:dbfork') -project(':tools:dbfork').projectDir = new File(rootDir, '../tools/dbfork') \ No newline at end of file +include('dbfork') +project(':dbfork').projectDir = new File(rootDir, '../dbfork')