diff --git a/build.gradle b/build.gradle index 3326377..d6c00e8 100644 --- a/build.gradle +++ b/build.gradle @@ -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') { diff --git a/src/main/java/com/craigraw/drongo/crypto/ECKey.java b/src/main/java/com/craigraw/drongo/crypto/ECKey.java index d2cac1a..99dcaad 100644 --- a/src/main/java/com/craigraw/drongo/crypto/ECKey.java +++ b/src/main/java/com/craigraw/drongo/crypto/ECKey.java @@ -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); } /** diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 834007f..8edb601 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -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; } \ No newline at end of file diff --git a/src/main/resources/log4j.properties b/src/main/resources/log4j.properties deleted file mode 100644 index 7f3af57..0000000 --- a/src/main/resources/log4j.properties +++ /dev/null @@ -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 \ No newline at end of file diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml new file mode 100644 index 0000000..704a0ee --- /dev/null +++ b/src/main/resources/logback.xml @@ -0,0 +1,19 @@ + + + drongo.log + + %date %level [%thread] %logger{10} [%file:%line] %msg%n + + + + + + %msg%n + + + + + + + + \ No newline at end of file