upgrade bc, export packages, switch logging

This commit is contained in:
Craig Raw 2020-04-01 12:35:47 +02:00
parent 4f15cd48aa
commit 53f0268445
5 changed files with 47 additions and 26 deletions

View file

@ -1,8 +1,28 @@
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.javamodularity:moduleplugin:1.6.0"
}
}
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '4.0.2'
}
def javamodularityPluginId = 'org.javamodularity.moduleplugin'
final hasPlugin = project.getPlugins().hasPlugin(javamodularityPluginId);
if(hasPlugin) {
final Plugin plugin = project.getPlugins().getPlugin(javamodularityPluginId)
println 'Plugin already applied - version ' + plugin.properties['javamodularityPluginId']
} else {
apply plugin: "org.javamodularity.moduleplugin"
}
group 'com.craigraw'
version '0.1'
@ -21,7 +41,7 @@ dependencies {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
exclude group: 'junit', module: 'junit'
}
implementation ('org.bouncycastle:bcprov-jdk15on:1.60') {
implementation ('org.bouncycastle:bcprov-jdk15on:1.64') {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
implementation ('ch.qos.logback:logback-classic:1.2.3') {

View file

@ -61,21 +61,8 @@ public class ECKey {
* Utility for compressing an elliptic curve point. Returns the same point if it's already compressed.
* See the ECKey class docs for a discussion of point compression.
*/
public static ECPoint compressPoint(ECPoint point) {
return getPointWithCompression(point, true);
}
public static LazyECPoint compressPoint(LazyECPoint point) {
return point.isCompressed() ? point : new LazyECPoint(compressPoint(point.get()), true);
}
private static ECPoint getPointWithCompression(ECPoint point, boolean compressed) {
if (point.isCompressed() == compressed)
return point;
point = point.normalize();
BigInteger x = point.getAffineXCoord().toBigInteger();
BigInteger y = point.getAffineYCoord().toBigInteger();
return CURVE.getCurve().createPoint(x, y, compressed);
return point.isCompressed() ? point : new LazyECPoint(point.get(), true);
}
/**

View file

@ -1,3 +1,8 @@
module com.craigraw.drongo {
requires org.bouncycastle.provider;
requires slf4j.api;
exports com.craigraw.drongo;
exports com.craigraw.drongo.psbt;
exports com.craigraw.drongo.protocol;
exports com.craigraw.drongo.address;
}

View file

@ -1,10 +0,0 @@
log4j.rootLogger=DEBUG, stdout, file
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%-5p] %d %c - %m%n
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=drongo.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=[%-5p] %d %c - %m%n

View file

@ -0,0 +1,19 @@
<configuration>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>drongo.log</file>
<encoder>
<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
</encoder>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%msg%n</pattern>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>