commit 052a8328d717a1455387eaa6acd9edd6b65cf5bd Author: Carsten Otto Date: Thu May 20 20:30:43 2021 +0100 initial commit diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..78db2224 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: 'Bug: ' +labels: 'bug' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Which commands did you run to reproduce this? +If this only happens for specific transactions/addresses, please include this in the report. + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional context** +Add any other context about the problem here. + +* Which version (git commit) are you running? +* Which operating system and terminal software are you using? diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..1515e509 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: 'Feature Request: ' +labels: 'enhancement' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 00000000..f4deb89e --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,47 @@ +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + - cron: '26 1 * * 1' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + language: [ 'java' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + - name: Configure cache + uses: actions/cache@v2 + env: + cache-name: gradle + with: + path: ~/.gradle/caches/build-cache* + key: ${{ runner.os }}-codeql-${{ env.cache-name }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-codeql-${{ env.cache-name }}- + ${{ runner.os }}-codeql- + ${{ runner.os }}- + - name: Set up JDK 16 + uses: actions/setup-java@v2 + with: + java-version: '16' + distribution: 'adopt' + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..b0cec347 --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,34 @@ +name: Java CI with Gradle + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Configure cache + uses: actions/cache@v2 + env: + cache-name: gradle + with: + path: ~/.gradle/caches/build-cache* + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Set up JDK 16 + uses: actions/setup-java@v2 + with: + java-version: '16' + distribution: 'adopt' + - name: Build with Gradle + run: ./gradlew build diff --git a/.github/workflows/mutationtests.yml b/.github/workflows/mutationtests.yml new file mode 100644 index 00000000..26b2dd2f --- /dev/null +++ b/.github/workflows/mutationtests.yml @@ -0,0 +1,34 @@ +name: Run mutation tests + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + mutationtests: + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Configure cache + uses: actions/cache@v2 + env: + cache-name: mutationtests + with: + path: ~/.gradle/caches/build-cache* + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Set up JDK 16 + uses: actions/setup-java@v2 + with: + java-version: '16' + distribution: 'adopt' + - name: Run mutation tests + run: ./gradlew pitest diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..1a1a8024 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.gradle +!gradle/wrapper/gradle-wrapper.jar +.idea +build/ \ No newline at end of file diff --git a/.java-version b/.java-version new file mode 100644 index 00000000..b6a7d89c --- /dev/null +++ b/.java-version @@ -0,0 +1 @@ +16 diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..bcff10c1 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Carsten Otto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..25d4a001 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# lnd-manageJ + +## What can you do with lnd-manageJ? + +Right now, nothing. Sorry. Work in progress. + +## What is the purpose of lnd-manageJ? + +In the far future, you can run lnd-manageJ in the background and constantly gather information from your +[lnd](https://github.com/lightningnetwork/lnd) node. +This information is condensed and analyzed so that + + - you can see your node's and each peer's/channel's forwarding activity + - you can understand each channel's/peer's forwarding characteristics (is it a sink? a source? bidirectional?) + - you can tweak the forwarding fees based on previous and forecasted routing activity + +In short, lnd-manageJ helps you understand and manage the inner workings of your lnd node. + +## How can I run lnd-manageJ? + +Install Java 16 and run `./start.sh`. + +## Disclaimer +This project is not related to bitromortac's Python based [lndmanage](https://github.com/bitromortac/lndmanage). + +## Can I help? + +Sure! Please test the software, review the code, create feature requests, report bugs, ... + +## How can I reach you? +I'm in the [lnd slack](https://dev.lightning.community/) and on [Twitter](https://twitter.com/c_otto83). \ No newline at end of file diff --git a/application/build.gradle b/application/build.gradle new file mode 100644 index 00000000..9558a6a3 --- /dev/null +++ b/application/build.gradle @@ -0,0 +1,11 @@ +plugins { + id 'lnd-manageJ.java-conventions' +} + +dependencies { + implementation 'org.flywaydb:flyway-core' +} + +bootJar { + archiveClassifier.set('boot') +} \ No newline at end of file diff --git a/application/src/main/java/de/cotto/lndmanagej/Application.java b/application/src/main/java/de/cotto/lndmanagej/Application.java new file mode 100644 index 00000000..a2ad8e53 --- /dev/null +++ b/application/src/main/java/de/cotto/lndmanagej/Application.java @@ -0,0 +1,11 @@ +package de.cotto.lndmanagej; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Application { + public static void main(String[] arguments) { + SpringApplication.run(Application.class, arguments); + } +} diff --git a/application/src/main/resources/application.properties b/application/src/main/resources/application.properties new file mode 100644 index 00000000..f6bb834c --- /dev/null +++ b/application/src/main/resources/application.properties @@ -0,0 +1,9 @@ +spring.application.name=lnd-manageJ +spring.datasource.url=jdbc:h2:file:./lnd-manageJ.db +spring.main.banner-mode=off +spring.jpa.hibernate.ddl-auto=update +spring.jpa.database-platform=org.hibernate.dialect.H2Dialect +spring.profiles.active=default +spring.flyway.baseline-on-migrate=true +logging.level.root=warn +logging.pattern.console=%d %clr(%-5p) %logger: %m%rEx{2}%n \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 00000000..f408cb53 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,17 @@ +plugins { + id 'groovy-gradle-plugin' +} + +repositories { + gradlePluginPortal() +} + +dependencies { + implementation 'de.aaschmid:gradle-cpd-plugin:3.2' + implementation 'net.ltgt.gradle:gradle-errorprone-plugin:2.0.1' + implementation 'net.ltgt.gradle:gradle-nullaway-plugin:1.1.0' + implementation 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.1' + implementation 'org.springframework.boot:spring-boot-gradle-plugin:2.4.5' + implementation 'com.adarshr:gradle-test-logger-plugin:3.0.0' + implementation 'info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.6.0' +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/lnd-manageJ.checkstyle.gradle b/buildSrc/src/main/groovy/lnd-manageJ.checkstyle.gradle new file mode 100644 index 00000000..831bd294 --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.checkstyle.gradle @@ -0,0 +1,8 @@ +plugins { + id 'checkstyle' +} + +checkstyle { + toolVersion '8.42' + maxWarnings = 0 +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/lnd-manageJ.cpd.gradle b/buildSrc/src/main/groovy/lnd-manageJ.cpd.gradle new file mode 100644 index 00000000..52bc36c3 --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.cpd.gradle @@ -0,0 +1,8 @@ +plugins { + id 'de.aaschmid.cpd' +} +check.dependsOn cpdCheck + +cpd { + toolVersion = '6.34.0' +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/lnd-manageJ.errorprone.gradle b/buildSrc/src/main/groovy/lnd-manageJ.errorprone.gradle new file mode 100644 index 00000000..5373fadc --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.errorprone.gradle @@ -0,0 +1,33 @@ +plugins { + id 'net.ltgt.errorprone' + id 'net.ltgt.nullaway' +} + +tasks.withType(JavaCompile).configureEach { + options.errorprone.nullaway { + excludedFieldAnnotations.add('org.mockito.Mock') + excludedFieldAnnotations.add('org.mockito.InjectMocks') + } +} + +dependencies { + errorprone 'com.google.errorprone:error_prone_core:2.7.1' + errorprone 'com.uber.nullaway:nullaway:0.9.1' +} + +nullaway { + annotatedPackages.add('de.cotto') +} + +tasks.withType(JavaCompile).configureEach { + options.errorprone.disable('EqualsGetClass') + options.errorprone.nullaway { + severity = net.ltgt.gradle.errorprone.CheckSeverity.ERROR + excludedFieldAnnotations.add('org.mockito.Mock') + excludedFieldAnnotations.add('org.mockito.InjectMocks') + excludedFieldAnnotations.add('org.junit.jupiter.api.io.TempDir') + excludedFieldAnnotations.add('org.springframework.beans.factory.annotation.Autowired') + excludedFieldAnnotations.add('org.springframework.boot.test.mock.mockito.MockBean') + excludedClassAnnotations.add('org.springframework.boot.context.properties.ConfigurationProperties') + } +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/lnd-manageJ.integration-tests.gradle b/buildSrc/src/main/groovy/lnd-manageJ.integration-tests.gradle new file mode 100644 index 00000000..bc1b7b8c --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.integration-tests.gradle @@ -0,0 +1,37 @@ +plugins { + id 'lnd-manageJ.tests' +} + +sourceSets { + integrationTest { + compileClasspath += sourceSets.main.output + runtimeClasspath += sourceSets.main.output + } +} + +configurations { + integrationTestImplementation.extendsFrom testImplementation + integrationTestRuntimeOnly.extendsFrom testRuntimeOnly +} + +task integrationTest(type: Test) { + description = 'Runs integration tests.' + group = 'verification' + + testClassesDirs = sourceSets.integrationTest.output.classesDirs + classpath = sourceSets.integrationTest.runtimeClasspath + shouldRunAfter test +} +check.dependsOn integrationTest + +dependencies { + testImplementation 'com.tngtech.archunit:archunit:0.18.0' + testImplementation 'org.awaitility:awaitility:4.1.0' + +} + +integrationTest { + testlogger { + slowThreshold 2000 + } +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/lnd-manageJ.jacoco.gradle b/buildSrc/src/main/groovy/lnd-manageJ.jacoco.gradle new file mode 100644 index 00000000..ab44618f --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.jacoco.gradle @@ -0,0 +1,53 @@ +plugins { + id 'jacoco' +} + +check.dependsOn jacocoTestCoverageVerification +jacocoTestCoverageVerification.dependsOn jacocoTestReport + +tasks.withType(Test).configureEach { + jacocoTestCoverageVerification.dependsOn it + jacocoTestReport.mustRunAfter it +} + +jacocoTestReport { + getExecutionData().setFrom(fileTree(buildDir).include('/jacoco/*.exec')) +} +jacocoTestCoverageVerification { + getExecutionData().setFrom(fileTree(buildDir).include('/jacoco/*.exec')) + + violationRules { + rule { + limit { + counter = 'BRANCH' + value = 'COVEREDRATIO' + minimum = 0.99 + } + } + rule { + limit { + counter = 'CLASS' + value = 'COVEREDRATIO' + minimum = 1.0 + } + } + rule { + limit { + counter = 'INSTRUCTION' + value = 'COVEREDRATIO' + minimum = 0.99 + } + } + rule { + limit { + counter = 'METHOD' + value = 'COVEREDRATIO' + minimum = 0.99 + } + } + } +} + +jacoco { + toolVersion = '0.8.7' +} diff --git a/buildSrc/src/main/groovy/lnd-manageJ.java-conventions.gradle b/buildSrc/src/main/groovy/lnd-manageJ.java-conventions.gradle new file mode 100644 index 00000000..ca60fa23 --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.java-conventions.gradle @@ -0,0 +1,35 @@ +plugins { + id 'java' + id 'lnd-manageJ.cpd' + id 'lnd-manageJ.errorprone' + id 'lnd-manageJ.checkstyle' + id 'lnd-manageJ.tests' + id 'lnd-manageJ.mutationtests' + id 'lnd-manageJ.integration-tests' + id 'lnd-manageJ.spotbugs' + id 'lnd-manageJ.pmd' + id 'lnd-manageJ.jacoco' + id 'org.springframework.boot' + id 'io.spring.dependency-management' +} + +java { + sourceCompatibility = JavaVersion.VERSION_16 + targetCompatibility = JavaVersion.VERSION_16 + consistentResolution { + useCompileClasspathVersions() + } +} + +repositories { + mavenCentral() +} + +tasks.withType(JavaCompile).configureEach { + options.compilerArgs << '-Werror' +} + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter' + implementation 'org.apache.commons:commons-lang3:3.12.0' +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/lnd-manageJ.java-library-conventions.gradle b/buildSrc/src/main/groovy/lnd-manageJ.java-library-conventions.gradle new file mode 100644 index 00000000..344da44b --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.java-library-conventions.gradle @@ -0,0 +1,12 @@ +plugins { + id 'java-library' + id 'lnd-manageJ.java-conventions' +} + +bootJar { + enabled = false + archiveClassifier.set('boot') +} +jar { + enabled = true +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/lnd-manageJ.mutationtests.gradle b/buildSrc/src/main/groovy/lnd-manageJ.mutationtests.gradle new file mode 100644 index 00000000..23288480 --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.mutationtests.gradle @@ -0,0 +1,20 @@ +plugins { + id 'lnd-manageJ.tests' + id 'info.solidsoft.pitest' +} + +pitest { + targetClasses = ['de.cotto.*'] + pitestVersion = '1.6.6' + junit5PluginVersion = '0.14' + outputFormats = ['XML', 'HTML'] + timestampedReports = false + failWhenNoMutations = false + excludedMethods = ['hashCode'] + threads = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 + testStrengthThreshold = 100 +} + +tasks.withType(info.solidsoft.gradle.pitest.PitestTask).configureEach { + dependsOn test +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/lnd-manageJ.pmd.gradle b/buildSrc/src/main/groovy/lnd-manageJ.pmd.gradle new file mode 100644 index 00000000..a350653c --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.pmd.gradle @@ -0,0 +1,21 @@ +plugins { + id 'pmd' +} + +pmd { + ruleSetFiles = files("${rootDir}/config/pmd-ruleset.xml") + ruleSets = [] + consoleOutput = true + toolVersion = '6.34.0' +} +tasks.withType(Test).forEach { testTask -> + tasks.withType(Pmd).forEach { pmdTask -> + String expected = ("pmd" + testTask.getName()).toLowerCase() + if (expected == pmdTask.getName().toLowerCase()) { + testTask.shouldRunAfter(pmdTask) + } + if (pmdTask.getName() == "pmdMain") { + testTask.shouldRunAfter(pmdTask) + } + } +} diff --git a/buildSrc/src/main/groovy/lnd-manageJ.spotbugs.gradle b/buildSrc/src/main/groovy/lnd-manageJ.spotbugs.gradle new file mode 100644 index 00000000..e0b110ff --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.spotbugs.gradle @@ -0,0 +1,27 @@ +plugins { + id 'com.github.spotbugs' +} + +spotbugsMain.reports.configure { + xml.enabled = false + html.enabled = true +} +spotbugsTest.reports.configure { + xml.enabled = false + html.enabled = true +} +spotbugs { + excludeFilter = file("${rootDir}/config/spotbugs-exclude.xml") +} + +tasks.withType(Test).forEach { testTask -> + tasks.withType(com.github.spotbugs.snom.SpotBugsTask).forEach { spotbugsTask -> + String expected = ("spotbugs" + testTask.getName()).toLowerCase() + if (expected == spotbugsTask.getName().toLowerCase()) { + testTask.shouldRunAfter(spotbugsTask) + } + if (spotbugsTask.getName() == "spotbugsMain") { + testTask.shouldRunAfter(spotbugsTask) + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/lnd-manageJ.tests.gradle b/buildSrc/src/main/groovy/lnd-manageJ.tests.gradle new file mode 100644 index 00000000..c81362f2 --- /dev/null +++ b/buildSrc/src/main/groovy/lnd-manageJ.tests.gradle @@ -0,0 +1,25 @@ +plugins { + id 'java' + id 'com.adarshr.test-logger' +} + +dependencies { + testImplementation 'nl.jqno.equalsverifier:equalsverifier:3.6' + testImplementation 'org.springframework.boot:spring-boot-starter-test' +} + +tasks.withType(Test).configureEach { + useJUnitPlatform() + afterTest { descriptor, result -> + if (result.resultType == TestResult.ResultType.SKIPPED) { + throw new GradleException('Do not ignore test cases') + } + } +} + +testlogger { + theme 'standard-parallel' + slowThreshold 1000 + showPassed false + showSimpleNames true +} diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 00000000..1d801a7f --- /dev/null +++ b/config/checkstyle/checkstyle.xml @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/pmd-ruleset.xml b/config/pmd-ruleset.xml new file mode 100644 index 00000000..b512449c --- /dev/null +++ b/config/pmd-ruleset.xml @@ -0,0 +1,140 @@ + + + + + + Custom rules + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/spotbugs-exclude.xml b/config/spotbugs-exclude.xml new file mode 100644 index 00000000..22ee7db1 --- /dev/null +++ b/config/spotbugs-exclude.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..9dbe42ff --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.jvmargs=-Xmx2G diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..0f80bbf5 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 00000000..4f906e0c --- /dev/null +++ b/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$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"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 00000000..ac1b06f9 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,89 @@ +@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=. +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%" == "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%"=="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 diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..ef451b7f --- /dev/null +++ b/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'lnd-manageJ' +include 'application' diff --git a/start.sh b/start.sh new file mode 100755 index 00000000..d8f88781 --- /dev/null +++ b/start.sh @@ -0,0 +1 @@ +./gradlew application:bootJar && clear && java -jar application/build/libs/application-boot.jar