mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Reformat code
This commit is contained in:
parent
795b73df87
commit
d1e760f447
6 changed files with 130 additions and 140 deletions
30
.github/workflows/ci.yml
vendored
30
.github/workflows/ci.yml
vendored
|
@ -1,6 +1,6 @@
|
||||||
name: signal-cli CI
|
name: signal-cli CI
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [ push, pull_request ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -11,17 +11,17 @@ jobs:
|
||||||
java: [ '11', '16' ]
|
java: [ '11', '16' ]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
- name: Compress archive
|
- name: Compress archive
|
||||||
run: gzip -n -9 build/distributions/signal-cli-*.tar
|
run: gzip -n -9 build/distributions/signal-cli-*.tar
|
||||||
- name: Archive production artifacts
|
- name: Archive production artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: signal-cli-archive-${{ matrix.java }}
|
name: signal-cli-archive-${{ matrix.java }}
|
||||||
path: build/distributions/signal-cli-*.tar.gz
|
path: build/distributions/signal-cli-*.tar.gz
|
||||||
|
|
72
.github/workflows/codeql-analysis.yml
vendored
72
.github/workflows/codeql-analysis.yml
vendored
|
@ -2,10 +2,10 @@ name: "CodeQL"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master, ]
|
branches: [ master ]
|
||||||
pull_request:
|
pull_request:
|
||||||
# The branches below must be a subset of the branches above
|
# The branches below must be a subset of the branches above
|
||||||
branches: [master]
|
branches: [ master ]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 7 * * 4'
|
- cron: '0 7 * * 4'
|
||||||
|
|
||||||
|
@ -16,45 +16,45 @@ jobs:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Setup Java JDK
|
- name: Setup Java JDK
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
# We must fetch at least the immediate parents so that if this is
|
# We must fetch at least the immediate parents so that if this is
|
||||||
# a pull request then we can checkout the head.
|
# a pull request then we can checkout the head.
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
# If this run was triggered by a pull request event, then checkout
|
# If this run was triggered by a pull request event, then checkout
|
||||||
# the head of the pull request instead of the merge commit.
|
# the head of the pull request instead of the merge commit.
|
||||||
- run: git checkout HEAD^2
|
- run: git checkout HEAD^2
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
if: ${{ github.event_name == 'pull_request' }}
|
||||||
|
|
||||||
# Initializes the CodeQL tools for scanning.
|
# Initializes the CodeQL tools for scanning.
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v1
|
uses: github/codeql-action/init@v1
|
||||||
# Override language selection by uncommenting this and choosing your languages
|
# Override language selection by uncommenting this and choosing your languages
|
||||||
# with:
|
# with:
|
||||||
# languages: go, javascript, csharp, python, cpp, java
|
# languages: go, javascript, csharp, python, cpp, java
|
||||||
|
|
||||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or 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)
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
- name: Autobuild
|
- name: Autobuild
|
||||||
uses: github/codeql-action/autobuild@v1
|
uses: github/codeql-action/autobuild@v1
|
||||||
|
|
||||||
# ℹ️ Command-line programs to run using the OS shell.
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
# 📚 https://git.io/JvXDl
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
# ✏️ 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
|
# and modify them (or add more) to build your code if your project
|
||||||
# uses a compiled language
|
# uses a compiled language
|
||||||
|
|
||||||
#- run: |
|
#- run: |
|
||||||
# make bootstrap
|
# make bootstrap
|
||||||
# make release
|
# make release
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v1
|
uses: github/codeql-action/analyze@v1
|
||||||
|
|
20
.idea/codeStyles/Project.xml
generated
20
.idea/codeStyles/Project.xml
generated
|
@ -29,22 +29,7 @@
|
||||||
<option name="JD_P_AT_EMPTY_LINES" value="false" />
|
<option name="JD_P_AT_EMPTY_LINES" value="false" />
|
||||||
</JavaCodeStyleSettings>
|
</JavaCodeStyleSettings>
|
||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
<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>
|
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
<XML>
|
<XML>
|
||||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||||
|
@ -74,5 +59,8 @@
|
||||||
<rules />
|
<rules />
|
||||||
</arrangement>
|
</arrangement>
|
||||||
</codeStyleSettings>
|
</codeStyleSettings>
|
||||||
|
<codeStyleSettings language="kotlin">
|
||||||
|
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||||
|
</codeStyleSettings>
|
||||||
</code_scheme>
|
</code_scheme>
|
||||||
</component>
|
</component>
|
|
@ -48,9 +48,9 @@ tasks.withType<JavaCompile> {
|
||||||
tasks.withType<Jar> {
|
tasks.withType<Jar> {
|
||||||
manifest {
|
manifest {
|
||||||
attributes(
|
attributes(
|
||||||
"Implementation-Title" to project.name,
|
"Implementation-Title" to project.name,
|
||||||
"Implementation-Version" to project.version,
|
"Implementation-Version" to project.version,
|
||||||
"Main-Class" to application.mainClass.get()
|
"Main-Class" to application.mainClass.get()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ val assembleNativeImage by tasks.registering {
|
||||||
var graalVMHome = ""
|
var graalVMHome = ""
|
||||||
doFirst {
|
doFirst {
|
||||||
graalVMHome = System.getenv("GRAALVM_HOME")
|
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 {
|
exec {
|
||||||
workingDir = File(".")
|
workingDir = File(".")
|
||||||
commandLine("$graalVMHome/bin/native-image",
|
commandLine(
|
||||||
"-H:Path=$nativeBinaryOutputPath",
|
"$graalVMHome/bin/native-image",
|
||||||
"-H:Name=$nativeBinaryName",
|
"-H:Path=$nativeBinaryOutputPath",
|
||||||
"-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
|
"-H:Name=$nativeBinaryName",
|
||||||
"-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
|
"-H:JNIConfigurationFiles=graalvm-config-dir/jni-config.json",
|
||||||
"-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
|
"-H:DynamicProxyConfigurationFiles=graalvm-config-dir/proxy-config.json",
|
||||||
"-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
|
"-H:ResourceConfigurationFiles=graalvm-config-dir/resource-config.json",
|
||||||
"--no-fallback",
|
"-H:ReflectionConfigurationFiles=graalvm-config-dir/reflect-config.json",
|
||||||
"--allow-incomplete-classpath",
|
"--no-fallback",
|
||||||
"--report-unsupported-elements-at-runtime",
|
"--allow-incomplete-classpath",
|
||||||
"--enable-url-protocols=http,https",
|
"--report-unsupported-elements-at-runtime",
|
||||||
"--enable-https",
|
"--enable-url-protocols=http,https",
|
||||||
"--enable-all-security-services",
|
"--enable-https",
|
||||||
"-cp",
|
"--enable-all-security-services",
|
||||||
sourceSets.main.get().runtimeClasspath.asPath,
|
"-cp",
|
||||||
application.mainClass.get())
|
sourceSets.main.get().runtimeClasspath.asPath,
|
||||||
|
application.mainClass.get()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,11 +9,12 @@ import org.gradle.api.artifacts.Dependency
|
||||||
class CheckLibVersionsPlugin : Plugin<Project> {
|
class CheckLibVersionsPlugin : Plugin<Project> {
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
project.task("checkLibVersions") {
|
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 {
|
doLast {
|
||||||
project.configurations.flatMap { it.allDependencies }
|
project.configurations.flatMap { it.allDependencies }
|
||||||
.toSet()
|
.toSet()
|
||||||
.forEach { checkDependency(it) }
|
.forEach { checkDependency(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
99
run_tests.sh
99
run_tests.sh
|
@ -1,15 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
if [ $# -ne 2 ]; then
|
if [ $# -ne 2 ]; then
|
||||||
echo "Usage: $0 NUMBER_1 NUMBER_2"
|
echo "Usage: $0 NUMBER_1 NUMBER_2"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
# To update graalvm config, set GRAALVM_HOME, e.g:
|
# To update graalvm config, set GRAALVM_HOME, e.g:
|
||||||
# export GRAALVM_HOME=/usr/lib/jvm/java-11-graalvm
|
# export GRAALVM_HOME=/usr/lib/jvm/java-11-graalvm
|
||||||
if [ ! -z "$GRAALVM_HOME" ]; then
|
if [ ! -z "$GRAALVM_HOME" ]; then
|
||||||
export JAVA_HOME=$GRAALVM_HOME
|
export JAVA_HOME=$GRAALVM_HOME
|
||||||
export SIGNAL_CLI_OPTS='-agentlib:native-image-agent=config-merge-dir=graalvm-config-dir/'
|
export SIGNAL_CLI_OPTS='-agentlib:native-image-agent=config-merge-dir=graalvm-config-dir/'
|
||||||
fi
|
fi
|
||||||
export SIGNAL_CLI="$PWD/build/install/signal-cli/bin/signal-cli"
|
export SIGNAL_CLI="$PWD/build/install/signal-cli/bin/signal-cli"
|
||||||
|
|
||||||
|
@ -24,47 +24,47 @@ PATH_LINK="$PATH_TEST_CONFIG/link"
|
||||||
./gradlew installDist
|
./gradlew installDist
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
set -x
|
set -x
|
||||||
"$SIGNAL_CLI" --service-environment="sandbox" $@
|
"$SIGNAL_CLI" --service-environment="sandbox" $@
|
||||||
set +x
|
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
|
NUMBER=$1
|
||||||
PIN=$2
|
PIN=$2
|
||||||
echo -n "Enter a captcha token (https://signalcaptchas.org/registration/generate.html): "
|
echo -n "Enter a captcha token (https://signalcaptchas.org/registration/generate.html): "
|
||||||
read CAPTCHA
|
read CAPTCHA
|
||||||
run_main -u "$NUMBER" register --captcha "$CAPTCHA"
|
run_main -u "$NUMBER" register --captcha "$CAPTCHA"
|
||||||
echo -n "Enter validation code for ${NUMBER}: "
|
echo -n "Enter validation code for ${NUMBER}: "
|
||||||
read CODE
|
read CODE
|
||||||
if [ -z "$PIN" ]; then
|
if [ -z "$PIN" ]; then
|
||||||
run_main -u "$NUMBER" verify "$CODE"
|
run_main -u "$NUMBER" verify "$CODE"
|
||||||
else
|
else
|
||||||
run_main -u "$NUMBER" verify "$CODE" --pin "$PIN"
|
run_main -u "$NUMBER" verify "$CODE" --pin "$PIN"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function link() {
|
function link() {
|
||||||
NUMBER=$1
|
NUMBER=$1
|
||||||
LINK_CODE_FILE="$PATH_TEST_CONFIG/link_code"
|
LINK_CODE_FILE="$PATH_TEST_CONFIG/link_code"
|
||||||
rm -f "$LINK_CODE_FILE"
|
rm -f "$LINK_CODE_FILE"
|
||||||
mkfifo "$LINK_CODE_FILE"
|
mkfifo "$LINK_CODE_FILE"
|
||||||
run_linked link -n "test-device" > "$LINK_CODE_FILE" &
|
run_linked link -n "test-device" >"$LINK_CODE_FILE" &
|
||||||
read LINK_CODE < "$LINK_CODE_FILE"
|
read LINK_CODE <"$LINK_CODE_FILE"
|
||||||
run_main -u "$NUMBER" addDevice --uri "$LINK_CODE"
|
run_main -u "$NUMBER" addDevice --uri "$LINK_CODE"
|
||||||
wait
|
wait
|
||||||
run_linked -u "$NUMBER" send --note-to-self -m hi
|
run_linked -u "$NUMBER" send --note-to-self -m hi
|
||||||
run_main -u "$NUMBER" receive
|
run_main -u "$NUMBER" receive
|
||||||
run_linked -u "$NUMBER" receive
|
run_linked -u "$NUMBER" receive
|
||||||
run_main -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
|
## Basic send/receive
|
||||||
for OUTPUT in "plain-text" "json"; do
|
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" --output="$OUTPUT" getUserStatus "$NUMBER_1" "$NUMBER_2" "+111111111"
|
||||||
run_main -u "$NUMBER_1" send "$NUMBER_2" -m hi
|
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" send "$NUMBER_1" -m hi
|
||||||
run_main -u "$NUMBER_1" send -g "$GROUP_ID" -m hi -a LICENSE
|
run_main -u "$NUMBER_1" send -g "$GROUP_ID" -m hi -a LICENSE
|
||||||
TIMESTAMP=$(uname -a | run_main -u "$NUMBER_1" send "$NUMBER_2")
|
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_2" sendReaction "$NUMBER_1" -e 🍀 -a "$NUMBER_1" -t "$TIMESTAMP"
|
||||||
run_main -u "$NUMBER_1" remoteDelete "$NUMBER_2" -t "$TIMESTAMP"
|
run_main -u "$NUMBER_1" remoteDelete "$NUMBER_2" -t "$TIMESTAMP"
|
||||||
run_main -u "$NUMBER_2" --output="$OUTPUT" receive
|
run_main -u "$NUMBER_2" --output="$OUTPUT" receive
|
||||||
run_main -u "$NUMBER_1" --output="$OUTPUT" receive
|
run_main -u "$NUMBER_1" --output="$OUTPUT" receive
|
||||||
run_main -u "$NUMBER_1" send -e "$NUMBER_2"
|
run_main -u "$NUMBER_1" send -e "$NUMBER_2"
|
||||||
run_main -u "$NUMBER_2" --output="$OUTPUT" receive
|
run_main -u "$NUMBER_2" --output="$OUTPUT" receive
|
||||||
done
|
done
|
||||||
|
|
||||||
## Profile
|
## Profile
|
||||||
run_main -u "$NUMBER_1" updateProfile --given-name=GIVEN --family-name=FAMILY --about=ABOUT --about-emoji=EMOJI --avatar=LICENSE
|
run_main -u "$NUMBER_1" updateProfile --given-name=GIVEN --family-name=FAMILY --about=ABOUT --about-emoji=EMOJI --avatar=LICENSE
|
||||||
|
|
||||||
|
|
||||||
## Provisioning
|
## Provisioning
|
||||||
link "$NUMBER_1"
|
link "$NUMBER_1"
|
||||||
link "$NUMBER_2"
|
link "$NUMBER_2"
|
||||||
|
@ -137,11 +136,11 @@ run_linked -u "$NUMBER_1" sendSyncRequest
|
||||||
run_main -u "$NUMBER_1" sendContacts
|
run_main -u "$NUMBER_1" sendContacts
|
||||||
|
|
||||||
for OUTPUT in "plain-text" "json"; do
|
for OUTPUT in "plain-text" "json"; do
|
||||||
run_main -u "$NUMBER_1" send "$NUMBER_2" -m hi
|
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" send "$NUMBER_1" -m hi
|
||||||
run_main -u "$NUMBER_2" --output="$OUTPUT" receive
|
run_main -u "$NUMBER_2" --output="$OUTPUT" receive
|
||||||
run_main -u "$NUMBER_1" --output="$OUTPUT" receive
|
run_main -u "$NUMBER_1" --output="$OUTPUT" receive
|
||||||
run_linked -u "$NUMBER_1" --output="$OUTPUT" receive
|
run_linked -u "$NUMBER_1" --output="$OUTPUT" receive
|
||||||
done
|
done
|
||||||
|
|
||||||
run_main -u "$NUMBER_1" removeDevice -d 2
|
run_main -u "$NUMBER_1" removeDevice -d 2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue