Update to kotlin 1.6 (#63)

Use kotlin 1.6 (and gradle 7.5.1)
This commit is contained in:
Fabrice Drouin 2022-09-21 16:00:19 +02:00 committed by GitHub
parent d01a067159
commit d4eba9fb96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 116 additions and 138 deletions

View File

@ -3,8 +3,8 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.dokka.Platform import org.jetbrains.dokka.Platform
plugins { plugins {
kotlin("multiplatform") version "1.5.31" kotlin("multiplatform") version "1.6.21"
id("org.jetbrains.dokka") version "1.5.30" id("org.jetbrains.dokka") version "1.6.21"
`maven-publish` `maven-publish`
} }
@ -15,14 +15,14 @@ buildscript {
} }
dependencies { dependencies {
classpath("com.android.tools.build:gradle:4.0.2") classpath("com.android.tools.build:gradle:4.2.2")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.5.30") classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.6.21")
} }
} }
allprojects { allprojects {
group = "fr.acinq.secp256k1" group = "fr.acinq.secp256k1"
version = "0.6.5-SNAPSHOT" version = "0.7.0-SNAPSHOT"
repositories { repositories {
google() google()
@ -69,7 +69,7 @@ kotlin {
} }
sourceSets.all { sourceSets.all {
languageSettings.useExperimentalAnnotation("kotlin.RequiresOptIn") languageSettings.optIn("kotlin.RequiresOptIn")
} }
} }

View File

@ -4,14 +4,8 @@ org.gradle.parallel = true
# kotlin # kotlin
kotlin.code.style = official kotlin.code.style = official
kotlin.incremental.multiplatform = true
kotlin.parallel.tasks.in.project = true
#kotlin.mpp.enableGranularSourceSetsMetadata = true
kotlin.native.enableDependencyPropagation = false
kotlin.native.ignoreDisabledTargets = true kotlin.native.ignoreDisabledTargets = true
kotlin.mpp.enableCInteropCommonization=true
# https://github.com/gradle/gradle/issues/11412
systemProp.org.gradle.internal.publish.checksums.insecure = true
# Android # Android
android.useAndroidX = true android.useAndroidX = true

Binary file not shown.

View File

@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionSha256Sum=f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

2
gradlew vendored
View File

@ -82,6 +82,7 @@ esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@ -129,6 +130,7 @@ fi
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"` APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"` JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath # We build the pattern for arguments to be converted via cygpath

22
gradlew.bat vendored
View File

@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -54,7 +54,7 @@ goto fail
set JAVA_HOME=%JAVA_HOME:"=% set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init if exist "%JAVA_EXE%" goto execute
echo. echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@ -64,28 +64,14 @@ echo location of your Java installation.
goto fail goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

View File

@ -1,5 +1,3 @@
import org.jetbrains.dokka.Platform
plugins { plugins {
id("com.android.library") id("com.android.library")
kotlin("android") kotlin("android")
@ -32,7 +30,7 @@ android {
externalNativeBuild { externalNativeBuild {
cmake { cmake {
setPath("src/main/CMakeLists.txt") path("src/main/CMakeLists.txt")
} }
} }
ndkVersion = "21.4.7075529" ndkVersion = "21.4.7075529"

View File

@ -1,5 +1,3 @@
import org.jetbrains.dokka.Platform
plugins { plugins {
kotlin("jvm") kotlin("jvm")
id("org.jetbrains.dokka") id("org.jetbrains.dokka")
@ -22,7 +20,7 @@ dependencies {
val generateHeaders by tasks.creating(JavaCompile::class) { val generateHeaders by tasks.creating(JavaCompile::class) {
group = "build" group = "build"
classpath = sourceSets["main"].compileClasspath classpath = sourceSets["main"].compileClasspath
destinationDir = file("${buildDir}/generated/jni") destinationDirectory.set(file("${buildDir}/generated/jni"))
source = sourceSets["main"].java source = sourceSets["main"].java
options.compilerArgs = listOf( options.compilerArgs = listOf(
"-h", file("${buildDir}/generated/jni").absolutePath, "-h", file("${buildDir}/generated/jni").absolutePath,

View File

@ -5,29 +5,29 @@ public class Secp256k1CFunctions {
* All flags' lower 8 bits indicate what they're for. Do not use directly. * All flags' lower 8 bits indicate what they're for. Do not use directly.
*/ */
public static int SECP256K1_FLAGS_TYPE_MASK = ((1 << 8) - 1); public static int SECP256K1_FLAGS_TYPE_MASK = ((1 << 8) - 1);
public static int SECP256K1_FLAGS_TYPE_CONTEXT = (1 << 0); public static final int SECP256K1_FLAGS_TYPE_CONTEXT = (1 << 0);
public static int SECP256K1_FLAGS_TYPE_COMPRESSION = (1 << 1); public static final int SECP256K1_FLAGS_TYPE_COMPRESSION = (1 << 1);
/** /**
* The higher bits contain the actual data. Do not use directly. * The higher bits contain the actual data. Do not use directly.
*/ */
public static int SECP256K1_FLAGS_BIT_CONTEXT_VERIFY = (1 << 8); public static final int SECP256K1_FLAGS_BIT_CONTEXT_VERIFY = (1 << 8);
public static int SECP256K1_FLAGS_BIT_CONTEXT_SIGN = (1 << 9); public static final int SECP256K1_FLAGS_BIT_CONTEXT_SIGN = (1 << 9);
public static int SECP256K1_FLAGS_BIT_COMPRESSION = (1 << 8); public static final int SECP256K1_FLAGS_BIT_COMPRESSION = (1 << 8);
/** /**
* Flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size, and * Flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size, and
* secp256k1_context_preallocated_create. * secp256k1_context_preallocated_create.
*/ */
public static int SECP256K1_CONTEXT_VERIFY = (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_VERIFY); public static final int SECP256K1_CONTEXT_VERIFY = (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_VERIFY);
public static int SECP256K1_CONTEXT_SIGN = (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_SIGN); public static final int SECP256K1_CONTEXT_SIGN = (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_SIGN);
public static int SECP256K1_CONTEXT_NONE = (SECP256K1_FLAGS_TYPE_CONTEXT); public static final int SECP256K1_CONTEXT_NONE = (SECP256K1_FLAGS_TYPE_CONTEXT);
/** /**
* Flag to pass to secp256k1_ec_pubkey_serialize. * Flag to pass to secp256k1_ec_pubkey_serialize.
*/ */
public static int SECP256K1_EC_COMPRESSED = (SECP256K1_FLAGS_TYPE_COMPRESSION | SECP256K1_FLAGS_BIT_COMPRESSION); public static final int SECP256K1_EC_COMPRESSED = (SECP256K1_FLAGS_TYPE_COMPRESSION | SECP256K1_FLAGS_BIT_COMPRESSION);
public static int SECP256K1_EC_UNCOMPRESSED = (SECP256K1_FLAGS_TYPE_COMPRESSION); public static final int SECP256K1_EC_UNCOMPRESSED = (SECP256K1_FLAGS_TYPE_COMPRESSION);
public static native long secp256k1_context_create(int flags); public static native long secp256k1_context_create(int flags);

View File

@ -2,7 +2,6 @@ pluginManagement {
repositories { repositories {
google() google()
gradlePluginPortal() gradlePluginPortal()
jcenter()
} }
} }
rootProject.name = "secp256k1-kmp" rootProject.name = "secp256k1-kmp"

View File

@ -41,16 +41,16 @@ public interface Secp256k1 {
* Verify a Schnorr signature. * Verify a Schnorr signature.
* *
* @param signature 64 bytes signature. * @param signature 64 bytes signature.
* @param message message signed. * @param data message signed.
* @param pubkey signer's x-only public key (32 bytes). * @param pub signer's x-only public key (32 bytes).
*/ */
public fun verifySchnorr(signature: ByteArray, data: ByteArray, pub: ByteArray): Boolean public fun verifySchnorr(signature: ByteArray, data: ByteArray, pub: ByteArray): Boolean
/** /**
* Create a Schnorr signature. * Create a Schnorr signature.
* *
* @param message message to sign. * @param data message to sign.
* @param privkey signer's private key. * @param sec signer's private key.
* @param auxrand32 32 bytes of fresh randomness (optional). * @param auxrand32 32 bytes of fresh randomness (optional).
*/ */
public fun signSchnorr(data: ByteArray, sec: ByteArray, auxrand32: ByteArray?): ByteArray public fun signSchnorr(data: ByteArray, sec: ByteArray, auxrand32: ByteArray?): ByteArray