]> nmode's Git Repositories - signal-cli/commitdiff
Reformat code
authorAsamK <asamk@gmx.de>
Sat, 12 Jun 2021 06:53:37 +0000 (08:53 +0200)
committerAsamK <asamk@gmx.de>
Sat, 12 Jun 2021 06:53:37 +0000 (08:53 +0200)
.github/workflows/ci.yml
.github/workflows/codeql-analysis.yml
.idea/codeStyles/Project.xml
build.gradle.kts
buildSrc/src/main/kotlin/CheckLibVersionsPlugin.kt
run_tests.sh

index ac6d30b323c981fefff55f42b5c79892bce8c533..28f5039ee3622d720b0e6c21e338d915b02cd8cd 100644 (file)
@@ -1,6 +1,6 @@
 name: signal-cli CI
 
 name: signal-cli CI
 
-on: [push, pull_request]
+on: [ push, pull_request ]
 
 jobs:
   build:
 
 jobs:
   build:
@@ -11,17 +11,17 @@ jobs:
         java: [ '11', '16' ]
 
     steps:
         java: [ '11', '16' ]
 
     steps:
-    - uses: actions/checkout@v1
-    - name: Set up JDK
-      uses: actions/setup-java@v1
-      with:
-        java-version: ${{ matrix.java }}
-    - name: Build with Gradle
-      run: ./gradlew build
-    - name: Compress archive
-      run: gzip -n -9 build/distributions/signal-cli-*.tar
-    - name: Archive production artifacts
-      uses: actions/upload-artifact@v2
-      with:
-        name: signal-cli-archive-${{ matrix.java }}
-        path: build/distributions/signal-cli-*.tar.gz
+      - uses: actions/checkout@v1
+      - name: Set up JDK
+        uses: actions/setup-java@v1
+        with:
+          java-version: ${{ matrix.java }}
+      - name: Build with Gradle
+        run: ./gradlew build
+      - name: Compress archive
+        run: gzip -n -9 build/distributions/signal-cli-*.tar
+      - name: Archive production artifacts
+        uses: actions/upload-artifact@v2
+        with:
+          name: signal-cli-archive-${{ matrix.java }}
+          path: build/distributions/signal-cli-*.tar.gz
index 8736e6196c1a13b80a0069a59d1af53e79161cd8..8e91e580387a0549a3386958e2e95694e76c6bc0 100644 (file)
@@ -2,10 +2,10 @@ name: "CodeQL"
 
 on:
   push:
 
 on:
   push:
-    branches: [master, ]
+    branches: [ master ]
   pull_request:
     # The branches below must be a subset of the branches above
   pull_request:
     # The branches below must be a subset of the branches above
-    branches: [master]
+    branches: [ master ]
   schedule:
     - cron: '0 7 * * 4'
 
   schedule:
     - cron: '0 7 * * 4'
 
@@ -16,45 +16,45 @@ jobs:
 
     steps:
 
 
     steps:
 
-    - name: Setup Java JDK
-      uses: actions/setup-java@v1
-      with:
-        java-version: 11
-
-    - name: Checkout repository
-      uses: actions/checkout@v2
-      with:
-        # We must fetch at least the immediate parents so that if this is
-        # a pull request then we can checkout the head.
-        fetch-depth: 2
-
-    # If this run was triggered by a pull request event, then checkout
-    # the head of the pull request instead of the merge commit.
-    - run: git checkout HEAD^2
-      if: ${{ github.event_name == 'pull_request' }}
-
-    # Initializes the CodeQL tools for scanning.
-    - name: Initialize CodeQL
-      uses: github/codeql-action/init@v1
-      # Override language selection by uncommenting this and choosing your languages
-      # with:
-      #   languages: go, javascript, csharp, python, cpp, java
-
-    # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
-    # If this step fails, then you should remove it and run the build manually (see below)
-    - name: Autobuild
-      uses: github/codeql-action/autobuild@v1
-
-    # â„šī¸ Command-line programs to run using the OS shell.
-    # đŸ“š https://git.io/JvXDl
-
-    # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines
-    #    and modify them (or add more) to build your code if your project
-    #    uses a compiled language
-
-    #- run: |
-    #   make bootstrap
-    #   make release
-
-    - name: Perform CodeQL Analysis
-      uses: github/codeql-action/analyze@v1
+      - name: Setup Java JDK
+        uses: actions/setup-java@v1
+        with:
+          java-version: 11
+
+      - name: Checkout repository
+        uses: actions/checkout@v2
+        with:
+          # We must fetch at least the immediate parents so that if this is
+          # a pull request then we can checkout the head.
+          fetch-depth: 2
+
+      # If this run was triggered by a pull request event, then checkout
+      # the head of the pull request instead of the merge commit.
+      - run: git checkout HEAD^2
+        if: ${{ github.event_name == 'pull_request' }}
+
+      # Initializes the CodeQL tools for scanning.
+      - name: Initialize CodeQL
+        uses: github/codeql-action/init@v1
+        # Override language selection by uncommenting this and choosing your languages
+        # with:
+        #   languages: go, javascript, csharp, python, cpp, java
+
+      # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
+      # If this step fails, then you should remove it and run the build manually (see below)
+      - name: Autobuild
+        uses: github/codeql-action/autobuild@v1
+
+      # â„šī¸ Command-line programs to run using the OS shell.
+      # đŸ“š https://git.io/JvXDl
+
+      # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines
+      #    and modify them (or add more) to build your code if your project
+      #    uses a compiled language
+
+      #- run: |
+      #   make bootstrap
+      #   make release
+
+      - name: Perform CodeQL Analysis
+        uses: github/codeql-action/analyze@v1
index d72f15eb1645db4dae3f5e623b89dccd1cb72a71..e2bacc4894bff166c53ec8b630272524cd3e3ae3 100644 (file)
       <option name="JD_P_AT_EMPTY_LINES" value="false" />
     </JavaCodeStyleSettings>
     <JetCodeStyleSettings>
       <option name="JD_P_AT_EMPTY_LINES" value="false" />
     </JavaCodeStyleSettings>
     <JetCodeStyleSettings>
-      <option name="PACKAGES_TO_USE_STAR_IMPORTS">
-        <value>
-          <package name="java.util" alias="false" withSubpackages="false" />
-          <package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
-          <package name="io.ktor" alias="false" withSubpackages="true" />
-        </value>
-      </option>
-      <option name="PACKAGES_IMPORT_LAYOUT">
-        <value>
-          <package name="" alias="false" withSubpackages="true" />
-          <package name="java" alias="false" withSubpackages="true" />
-          <package name="javax" alias="false" withSubpackages="true" />
-          <package name="kotlin" alias="false" withSubpackages="true" />
-          <package name="" alias="true" withSubpackages="true" />
-        </value>
-      </option>
+      <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
     </JetCodeStyleSettings>
     <XML>
       <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
     </JetCodeStyleSettings>
     <XML>
       <option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
@@ -74,5 +59,8 @@
         <rules />
       </arrangement>
     </codeStyleSettings>
         <rules />
       </arrangement>
     </codeStyleSettings>
+    <codeStyleSettings language="kotlin">
+      <option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
+    </codeStyleSettings>
   </code_scheme>
 </component>
\ No newline at end of file
   </code_scheme>
 </component>
\ No newline at end of file
index 70f2a2b4dbc52f7113b8dc06a826d5f4f4abe4fa..eac1c81658d71f47229898c8dd1528af901fdb6e 100644 (file)
@@ -48,9 +48,9 @@ tasks.withType<JavaCompile> {
 tasks.withType<Jar> {
     manifest {
         attributes(
 tasks.withType<Jar> {
     manifest {
         attributes(
-                "Implementation-Title" to project.name,
-                "Implementation-Version" to project.version,
-                "Main-Class" to application.mainClass.get()
+            "Implementation-Title" to project.name,
+            "Implementation-Version" to project.version,
+            "Main-Class" to application.mainClass.get()
         )
     }
 }
         )
     }
 }
@@ -70,7 +70,7 @@ val assembleNativeImage by tasks.registering {
     var graalVMHome = ""
     doFirst {
         graalVMHome = System.getenv("GRAALVM_HOME")
     var graalVMHome = ""
     doFirst {
         graalVMHome = System.getenv("GRAALVM_HOME")
-                ?: throw GradleException("Required GRAALVM_HOME environment variable not set.")
+            ?: throw GradleException("Required GRAALVM_HOME environment variable not set.")
     }
 
     doLast {
     }
 
     doLast {
@@ -81,22 +81,24 @@ val assembleNativeImage by tasks.registering {
 
         exec {
             workingDir = File(".")
 
         exec {
             workingDir = File(".")
-            commandLine("$graalVMHome/bin/native-image",
-                    "-H:Path=$nativeBinaryOutputPath",
-                    "-H:Name=$nativeBinaryName",
-                    "-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
-                    "-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
-                    "-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
-                    "-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
-                    "--no-fallback",
-                    "--allow-incomplete-classpath",
-                    "--report-unsupported-elements-at-runtime",
-                    "--enable-url-protocols=http,https",
-                    "--enable-https",
-                    "--enable-all-security-services",
-                    "-cp",
-                    sourceSets.main.get().runtimeClasspath.asPath,
-                    application.mainClass.get())
+            commandLine(
+                "$graalVMHome/bin/native-image",
+                "-H:Path=$nativeBinaryOutputPath",
+                "-H:Name=$nativeBinaryName",
+                "-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
+                "-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
+                "-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
+                "-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
+                "--no-fallback",
+                "--allow-incomplete-classpath",
+                "--report-unsupported-elements-at-runtime",
+                "--enable-url-protocols=http,https",
+                "--enable-https",
+                "--enable-all-security-services",
+                "-cp",
+                sourceSets.main.get().runtimeClasspath.asPath,
+                application.mainClass.get()
+            )
         }
     }
 }
         }
     }
 }
index 701bd6e3df11612d472b45462f51246db94acd31..270ae83540bc75701f4e30c9ee4ef53afeb8b104 100644 (file)
@@ -9,11 +9,12 @@ import org.gradle.api.artifacts.Dependency
 class CheckLibVersionsPlugin : Plugin<Project> {
     override fun apply(project: Project) {
         project.task("checkLibVersions") {
 class CheckLibVersionsPlugin : Plugin<Project> {
     override fun apply(project: Project) {
         project.task("checkLibVersions") {
-            description = "Find any 3rd party libraries which have released new versions to the central Maven repo since we last upgraded."
+            description =
+                "Find any 3rd party libraries which have released new versions to the central Maven repo since we last upgraded."
             doLast {
                 project.configurations.flatMap { it.allDependencies }
             doLast {
                 project.configurations.flatMap { it.allDependencies }
-                        .toSet()
-                        .forEach { checkDependency(it) }
+                    .toSet()
+                    .forEach { checkDependency(it) }
             }
         }
     }
             }
         }
     }
index ab9c91b0278230da1442d28e491f3067c0b9a55f..1405ada38db4ae5429c02abfdd4d6f15a83d33db 100755 (executable)
@@ -1,15 +1,15 @@
 #!/bin/sh
 if [ $# -ne 2 ]; then
 #!/bin/sh
 if [ $# -ne 2 ]; then
-       echo "Usage: $0 NUMBER_1 NUMBER_2"
-       exit 1
+  echo "Usage: $0 NUMBER_1 NUMBER_2"
+  exit 1
 fi
 
 set -e
 # To update graalvm config, set GRAALVM_HOME, e.g:
 # export GRAALVM_HOME=/usr/lib/jvm/java-11-graalvm
 if [ ! -z "$GRAALVM_HOME" ]; then
 fi
 
 set -e
 # To update graalvm config, set GRAALVM_HOME, e.g:
 # export GRAALVM_HOME=/usr/lib/jvm/java-11-graalvm
 if [ ! -z "$GRAALVM_HOME" ]; then
-       export JAVA_HOME=$GRAALVM_HOME
-       export SIGNAL_CLI_OPTS='-agentlib:native-image-agent=config-merge-dir=graalvm-config-dir/'
+  export JAVA_HOME=$GRAALVM_HOME
+  export SIGNAL_CLI_OPTS='-agentlib:native-image-agent=config-merge-dir=graalvm-config-dir/'
 fi
 export SIGNAL_CLI="$PWD/build/install/signal-cli/bin/signal-cli"
 
 fi
 export SIGNAL_CLI="$PWD/build/install/signal-cli/bin/signal-cli"
 
@@ -24,47 +24,47 @@ PATH_LINK="$PATH_TEST_CONFIG/link"
 ./gradlew installDist
 
 function run() {
 ./gradlew installDist
 
 function run() {
-       set -x
-       "$SIGNAL_CLI" --service-environment="sandbox" $@
-       set +x
+  set -x
+  "$SIGNAL_CLI" --service-environment="sandbox" $@
+  set +x
 }
 
 function run_main() {
 }
 
 function run_main() {
-       run --config="$PATH_MAIN" $@
+  run --config="$PATH_MAIN" $@
 }
 
 function run_linked() {
 }
 
 function run_linked() {
-       run --config="$PATH_LINK" $@
+  run --config="$PATH_LINK" $@
 }
 
 function register() {
 }
 
 function register() {
-       NUMBER=$1
-       PIN=$2
-       echo -n "Enter a captcha token (https://signalcaptchas.org/registration/generate.html): "
-       read CAPTCHA
-       run_main -u "$NUMBER" register --captcha "$CAPTCHA"
-       echo -n "Enter validation code for ${NUMBER}: "
-       read CODE
-       if [ -z "$PIN" ]; then
-               run_main -u "$NUMBER" verify "$CODE"
-       else
-               run_main -u "$NUMBER" verify "$CODE" --pin "$PIN"
-       fi
+  NUMBER=$1
+  PIN=$2
+  echo -n "Enter a captcha token (https://signalcaptchas.org/registration/generate.html): "
+  read CAPTCHA
+  run_main -u "$NUMBER" register --captcha "$CAPTCHA"
+  echo -n "Enter validation code for ${NUMBER}: "
+  read CODE
+  if [ -z "$PIN" ]; then
+    run_main -u "$NUMBER" verify "$CODE"
+  else
+    run_main -u "$NUMBER" verify "$CODE" --pin "$PIN"
+  fi
 }
 
 function link() {
 }
 
 function link() {
-       NUMBER=$1
-       LINK_CODE_FILE="$PATH_TEST_CONFIG/link_code"
-       rm -f "$LINK_CODE_FILE"
-       mkfifo "$LINK_CODE_FILE"
-       run_linked link -n "test-device" > "$LINK_CODE_FILE" &
-       read LINK_CODE < "$LINK_CODE_FILE"
-       run_main -u "$NUMBER" addDevice --uri "$LINK_CODE"
-       wait
-       run_linked -u "$NUMBER" send --note-to-self -m hi
-       run_main -u "$NUMBER" receive
-       run_linked -u "$NUMBER" receive
-       run_main -u "$NUMBER" receive
+  NUMBER=$1
+  LINK_CODE_FILE="$PATH_TEST_CONFIG/link_code"
+  rm -f "$LINK_CODE_FILE"
+  mkfifo "$LINK_CODE_FILE"
+  run_linked link -n "test-device" >"$LINK_CODE_FILE" &
+  read LINK_CODE <"$LINK_CODE_FILE"
+  run_main -u "$NUMBER" addDevice --uri "$LINK_CODE"
+  wait
+  run_linked -u "$NUMBER" send --note-to-self -m hi
+  run_main -u "$NUMBER" receive
+  run_linked -u "$NUMBER" receive
+  run_main -u "$NUMBER" receive
 }
 
 run_main --version
 }
 
 run_main --version
@@ -112,23 +112,22 @@ run_main -u "$NUMBER_2" trust "$NUMBER_1" -a
 
 ## Basic send/receive
 for OUTPUT in "plain-text" "json"; do
 
 ## Basic send/receive
 for OUTPUT in "plain-text" "json"; do
-       run_main -u "$NUMBER_1" --output="$OUTPUT" getUserStatus "$NUMBER_1" "$NUMBER_2" "+111111111"
-       run_main -u "$NUMBER_1" send "$NUMBER_2" -m hi
-       run_main -u "$NUMBER_2" send "$NUMBER_1" -m hi
-       run_main -u "$NUMBER_1" send -g "$GROUP_ID" -m hi -a LICENSE
-       TIMESTAMP=$(uname -a | run_main -u "$NUMBER_1" send "$NUMBER_2")
-       run_main -u "$NUMBER_2" sendReaction "$NUMBER_1" -e đŸ€ -a "$NUMBER_1" -t "$TIMESTAMP"
-       run_main -u "$NUMBER_1" remoteDelete "$NUMBER_2" -t "$TIMESTAMP"
-       run_main -u "$NUMBER_2" --output="$OUTPUT" receive
-       run_main -u "$NUMBER_1" --output="$OUTPUT" receive
-       run_main -u "$NUMBER_1" send -e "$NUMBER_2"
-       run_main -u "$NUMBER_2" --output="$OUTPUT" receive
+  run_main -u "$NUMBER_1" --output="$OUTPUT" getUserStatus "$NUMBER_1" "$NUMBER_2" "+111111111"
+  run_main -u "$NUMBER_1" send "$NUMBER_2" -m hi
+  run_main -u "$NUMBER_2" send "$NUMBER_1" -m hi
+  run_main -u "$NUMBER_1" send -g "$GROUP_ID" -m hi -a LICENSE
+  TIMESTAMP=$(uname -a | run_main -u "$NUMBER_1" send "$NUMBER_2")
+  run_main -u "$NUMBER_2" sendReaction "$NUMBER_1" -e đŸ€ -a "$NUMBER_1" -t "$TIMESTAMP"
+  run_main -u "$NUMBER_1" remoteDelete "$NUMBER_2" -t "$TIMESTAMP"
+  run_main -u "$NUMBER_2" --output="$OUTPUT" receive
+  run_main -u "$NUMBER_1" --output="$OUTPUT" receive
+  run_main -u "$NUMBER_1" send -e "$NUMBER_2"
+  run_main -u "$NUMBER_2" --output="$OUTPUT" receive
 done
 
 ## Profile
 run_main -u "$NUMBER_1" updateProfile --given-name=GIVEN --family-name=FAMILY --about=ABOUT --about-emoji=EMOJI --avatar=LICENSE
 
 done
 
 ## Profile
 run_main -u "$NUMBER_1" updateProfile --given-name=GIVEN --family-name=FAMILY --about=ABOUT --about-emoji=EMOJI --avatar=LICENSE
 
-
 ## Provisioning
 link "$NUMBER_1"
 link "$NUMBER_2"
 ## Provisioning
 link "$NUMBER_1"
 link "$NUMBER_2"
@@ -137,11 +136,11 @@ run_linked -u "$NUMBER_1" sendSyncRequest
 run_main -u "$NUMBER_1" sendContacts
 
 for OUTPUT in "plain-text" "json"; do
 run_main -u "$NUMBER_1" sendContacts
 
 for OUTPUT in "plain-text" "json"; do
-       run_main -u "$NUMBER_1" send "$NUMBER_2" -m hi
-       run_main -u "$NUMBER_2" send "$NUMBER_1" -m hi
-       run_main -u "$NUMBER_2" --output="$OUTPUT" receive
-       run_main -u "$NUMBER_1" --output="$OUTPUT" receive
-       run_linked -u "$NUMBER_1" --output="$OUTPUT" receive
+  run_main -u "$NUMBER_1" send "$NUMBER_2" -m hi
+  run_main -u "$NUMBER_2" send "$NUMBER_1" -m hi
+  run_main -u "$NUMBER_2" --output="$OUTPUT" receive
+  run_main -u "$NUMBER_1" --output="$OUTPUT" receive
+  run_linked -u "$NUMBER_1" --output="$OUTPUT" receive
 done
 
 run_main -u "$NUMBER_1" removeDevice -d 2
 done
 
 run_main -u "$NUMBER_1" removeDevice -d 2