Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apl-db-updater/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@

<artifactId>apl-db-updater</artifactId>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.apollocurrency</groupId>
<artifactId>apl-bom-ext</artifactId>
<version>2.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- Flyway -->
<dependency>
Expand Down
8 changes: 8 additions & 0 deletions apl-dex/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,12 @@
</repository>
</repositories>

<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
15 changes: 15 additions & 0 deletions apl-exec/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
</dependency>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<!-- unit tests -->
<dependency>
<groupId>org.junit.platform</groupId>
Expand Down Expand Up @@ -82,6 +92,11 @@
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.apollocurrency.aplwallet.apl.util.env.dirprovider.DirProviderFactory;
import com.apollocurrency.aplwallet.apl.util.env.dirprovider.PredefinedDirLocations;
import com.apollocurrency.aplwallet.apl.util.injectable.PropertiesHolder;
import com.beust.jcommander.JCommander;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -49,6 +48,8 @@
import java.util.Properties;
import java.util.UUID;

import picocli.CommandLine;

/**
* Main Apollo startup class
*
Expand Down Expand Up @@ -178,26 +179,23 @@ public static void main(String[] argv) {
//parse command line first

CmdLineArgs args = new CmdLineArgs();
JCommander jc = JCommander.newBuilder()
.addObject(args)
.build();
jc.setProgramName(Constants.APPLICATION);
CommandLine pc = new CommandLine(args);
try {
jc.parse(argv);
CommandLine.ParseResult parseResult = pc.parseArgs(argv);
if (args.help) {
pc.usage(System.err);
System.exit(PosixExitCodes.OK.exitCode());
}
} catch (RuntimeException ex) {
System.err.println("Error parsing command line arguments.");
System.err.println(ex.getMessage());
jc.usage();
pc.usage(System.err);
System.exit(PosixExitCodes.EX_USAGE.exitCode());
}
if (args.getNetIdx() >= 0 && !args.chainId.isEmpty()) {
System.err.println("--chainId, --testnet and --net parameters are incompatible, please specify only one");
System.exit(PosixExitCodes.EX_USAGE.exitCode());
}
if (args.help) {
jc.usage();
System.exit(PosixExitCodes.OK.exitCode());
}


//set main application class to runtime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,64 +1,76 @@
package com.apollocurrency.aplwallet.apl.exec;

import com.beust.jcommander.Parameter;

/**
/*
* Copyright © 2018-2022 Apollo Foundation
* Command line parameters
*
* @author alukin@gmail.com
* @author tx_hv@ukr.net
*/

package com.apollocurrency.aplwallet.apl.exec;

import picocli.CommandLine.Command;
import picocli.CommandLine.Option;

@Command(name = "apollo-blockchain")
public class CmdLineArgs {

public static int DEFAULT_DEBUG_LEVEL = 2;

@Parameter(names = {"--debug", "-d"}, description = "Debug level [0-4] from ERROR to TRACE")
@Option(names = {"--debug", "-d"}, description = "Common debug level [0-4] from ERROR=0, WARN=1, INFO=2, DEBUG=3, TRACE=4")
public int debug = DEFAULT_DEBUG_LEVEL;
@Parameter(names = {"--debug-updater", "-du"}, description = "Force updater to use debug certificates for verifying update transactions")
@Option(names = {"--debug-updater", "-du"}, description = "Force updater to use debug certificates for verifying update transactions")
public boolean debugUpdater;
@Parameter(names = {"--help", "-h"}, help = true, description = "Print help message")
@Option(names = {"--help", "-h"}, usageHelp = true, help = true, description = "Print help message")
public boolean help;
@Parameter(names = {"--service-mode", "-s"}, help = true, description = "Run in service mode with current system user")
@Option(names = {"--service-mode", "-s"}, arity = "0..1", defaultValue = "false", fallbackValue = "true", description = "Run in service mode with current system user")
public boolean serviceMode;
@Parameter(names = {"--ignore-resources"}, description = "Ignore resources bundled with application jar. Default is false")
public boolean ingnoreResources = false;
@Parameter(names = {"--config-dir", "-c"}, description = "Load all configuration and resources from specified path. System resources not ignored, standard config search is ignored.")
@Option(names = {"--ignore-resources"}, description = "Ignore resources bundled with application jar. Default is false")
public boolean ignoreResources = false;
@Option(names = {"--config-dir", "-c"}, description = "Load all configuration and resources from specified path. System resources not ignored, standard config search is ignored.")
public String configDir = "";
@Parameter(names = {"--log-dir", "-l"}, description = "Save log files to from specified directory.")
@Option(names = {"--log-dir", "-l"}, description = "Save log files to from specified directory.")
public String logDir = "";
@Parameter(names = {"--db-dir"}, description = "Load/Save DB files to from specified directory. Ignored if DB URL is remote.")
@Option(names = {"--db-dir"}, description = "Load/Save DB files to from specified directory. Ignored if DB URL is remote.")
public String dbDir = "";
@Parameter(names = {"--vault-key-dir"}, description = "Load/Save vault wallets keys to/form specified keystore directory.")
@Option(names = {"--vault-key-dir"}, description = "Load/Save vault wallets keys to/form specified keystore directory.")
public String vaultKeystoreDir = "";
@Parameter(names = {"--dex-key-dir"}, description = "Load/Save dex keys to/form specified keystore directory.")
@Option(names = {"--dex-key-dir"}, description = "Load/Save dex keys to/form specified keystore directory.")
public String dexKeystoreDir = "";
@Parameter(names = {"--no-shard-import"}, description = "Start from Genesis block, do not try to import last shard")
@Option(names = {"--no-shard-import"}, arity = "0..1", defaultValue = "false", fallbackValue = "true",
description = "Empty node starts downloading blocks from Genesis block, does not try to import last shard downloaded from another sharded nodes." +
" Default: ${DEFAULT-VALUE}, if specified without parameter value is: ${FALLBACK-VALUE}."
)
public boolean noShardImport = false;
@Parameter(names = {"--no-shard-create"}, description = "Do not create shards even if it configured to do so. Shards require much more resources")
@Option(names = {"--no-shard-create"}, arity = "0..1", defaultValue = "false", fallbackValue = "true",
description = "Do not create shards even if it configured to do so, default: ${DEFAULT-VALUE}, " +
"if specified without parameter: ${FALLBACK-VALUE}. Shards are require more OS resources."
)
public boolean noShardCreate = false;

@Parameter(names = {"--update-attachment-file", "-u"}, description = "Full path to file which represent json of UpdateAttachment for local updates debug")
@Option(names = {"--update-attachment-file", "-u"},
description = "Full path to file which represent json of UpdateAttachment for local updates with debugging purpose.")
public String updateAttachmentFile = "";

// TODO cleanup apl-default.properties
@Parameter(names = {"--2fa-dir"}, description = "Load/Save 2FA keys to/form specified directory. Note that this parameter will not work when you do not set apl.store2FAInFileSystem=true in apl-default.properties")
@Option(names = {"--2fa-dir"}, description = "Load/Save 2FA keys to/form specified directory. Note that this Option will not work when you do not set apl.store2FAInFileSystem=true in apl-default.properties")
public String twoFactorAuthDir = "";
@Parameter(names = {"--dexp-dir"}, description = "Export/Import CSV data to/form specified directory.")
@Option(names = {"--dexp-dir"}, description = "Export/Import CSV data to/form specified directory.")
public String dataExportDir = "";
@Parameter(names = {"--pid-file"}, description = "Save PID to specified file.")
@Option(names = {"--pid-file"}, description = "Save PID to specified file.")
public String pidFile = "";
@Parameter(names = {"--net", "-n"}, help = true, description = "Connect to net [0-4]. 0 means mainnet, 1 - 1st testnet and so on")
@Option(names = {"--net", "-n"}, help = true, description = "Connect to net [0-4]. 0 means mainnet, 1 - 1st testnet and so on")
public int netIdx = -1;
@Parameter(names = {"--chain", "-C"}, help = true, description = "Connect to net with given chainID. UUID of chain id may be specified partially, 6 symbos min. Configs must be present.")
@Option(names = {"--chain", "-C"}, help = true, description = "Connect to net with given chainID. UUID of chain id may be specified partially, 6 symbols min. Config file must be present.")
public String chainId = "";
@Parameter(names = {"--testnet"}, help = true, description = "Connect to testent 1. Has higher priority then --net")
@Option(names = {"--testnet"}, help = true, description = "Connect to testent 1. Has higher priority then --net")
public boolean isTestnet = false;
//---
@Parameter(names = {"--disable-weld-concurrent-deployment"},
description = "If use it, Weld doesn't use ConcurrentDeployer and ConcurrentValidator to build the container. Default value is true.")
@Option(names = {"--disable-weld-concurrent-deployment"}, defaultValue = "false",
description = "If use it, Weld doesn't use ConcurrentDeployer and ConcurrentValidator to build the container. Default value is ${DEFAULT-VALUE}.")
public boolean disableWeldConcurrentDeployment = false;

public boolean isResourceIgnored() {
return ingnoreResources;
return ignoreResources;
}

public int getNetIdx() {
Expand Down
Loading