Skip to content

Commit

Permalink
chore: update gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
mabels committed Apr 8, 2023
1 parent b242945 commit cd86ae6
Show file tree
Hide file tree
Showing 10 changed files with 118 additions and 118 deletions.
2 changes: 1 addition & 1 deletion kotlin/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
178 changes: 89 additions & 89 deletions kotlin/gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
4 changes: 2 additions & 2 deletions kotlin/lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

plugins {
// Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin.
id("org.jetbrains.kotlin.jvm") version "1.3.72"
id("org.jetbrains.kotlin.jvm") version "1.8.20"

// Apply the java-library plugin for API and implementation separation.
`java-library`
Expand All @@ -27,7 +27,7 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")

// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation("com.google.guava:guava:29.0-jre")
implementation("com.google.guava:guava:31.1-jre")

// Use the Kotlin test library.
testImplementation("org.jetbrains.kotlin:kotlin-test")
Expand Down
32 changes: 16 additions & 16 deletions kotlin/lib/src/main/kotlin/com/adviser/ipaddress/IPAddress.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ class IPAddress(

companion object {
fun sort(ipas: List<IPAddress>): MutableList<IPAddress> {
var ret = ipas.toMutableList()
ret.sortWith(Comparator { a, b -> a.compare(b); })
val ret = ipas.toMutableList()
ret.sortWith({ a, b -> a.compare(b); })
return ret
}

Expand Down Expand Up @@ -204,7 +204,7 @@ class IPAddress(
fun split_to_u32(addr: String): Result<Long> {
var ip = 0L
var shift = 24
var split_addr = addr.split("."); //.collect::<Vec<&str>>()
var split_addr = addr.split(".") //.collect::<Vec<&str>>()
if (split_addr.size > 4) {
return Result.Err("IP has not the right format:${addr}")
}
Expand Down Expand Up @@ -272,7 +272,7 @@ class IPAddress(
}

fun split_to_num(addr: String): Result<BigInteger> {
var pre_post = addr.trim().split("::").toMutableList()
val pre_post = addr.trim().split("::").toMutableList()
if (pre_post.isEmpty() && addr.contains("::")) {
//pre_post = Arrays.copyOf(pre_post, pre_post.size + 1)
//pre_post.set(pre_post.size - 1, "")
Expand Down Expand Up @@ -343,7 +343,7 @@ class IPAddress(
if (pos < 0) {
pos = 0
}
val stack_len = stack.size; // borrow checker
val stack_len = stack.size // borrow checker
// println!("loop:{}:{}", pos, stack_len)
// if stack_len == 1 {
// println!("exit 1")
Expand Down Expand Up @@ -376,15 +376,15 @@ class IPAddress(
stack.get(first).includes(stack.get(second))) {
pos = pos - 2
val idx = pos_to_idx(pos, stack_len)
stack.set(idx, stack.get(first).clone()); // kaputt
stack.set(idx, stack.get(first).clone()) // kaputt
stack.removeAt(pos_to_idx(pos + 1, stack_len))
// println!("remove-2:{}:{}", pos + 1, stack_len)
pos = pos - 1; // backtrack
pos = pos - 1 // backtrack
} else {
val myFirst = stack.get(first)
stack.set(first, myFirst.change_prefix(myFirst.prefix.add(1).unwrap()).unwrap()); //reset prefix
stack.set(first, myFirst.change_prefix(myFirst.prefix.add(1).unwrap()).unwrap()) //reset prefix
// println!("easy:{}:{}=>{}", pos, stack_len, stack[first].to_string())
pos = pos - 1; // do it with second as first
pos = pos - 1 // do it with second as first
}
}
}
Expand All @@ -410,7 +410,7 @@ class IPAddress(
}

fun sum_first_found(arr: List<IPAddress>): List<IPAddress> {
var dup = arr.toMutableList()
val dup = arr.toMutableList()
if (dup.size < 2) {
return dup
}
Expand All @@ -431,7 +431,7 @@ class IPAddress(
}

fun to_ipaddress_vec(vec: List<String>): Result<List<IPAddress>> {
var ret = mutableListOf<IPAddress>()
val ret = mutableListOf<IPAddress>()
for (ipstr in vec) {
val ipa = parse(ipstr)
if (ipa.isErr()) {
Expand Down Expand Up @@ -691,11 +691,11 @@ class IPAddress(

fun dns_parts(): IntArray {
val len = this.ip_bits.bits / this.ip_bits.dns_bits
var ret = IntArray(len)
val ret = IntArray(len)
var num = BigInteger.ZERO.add(this.host_address)
val mask = BigInteger.ONE.shiftLeft(this.ip_bits.dns_bits)
for (i in 0 until len) {
var part = num.mod(mask)
val part = num.mod(mask)
num = num.shiftRight(this.ip_bits.dns_bits)
ret.set(i, part.intValueExact())
}
Expand Down Expand Up @@ -824,7 +824,7 @@ class IPAddress(
/// /// "172.16.100.4/22"
///
fun to_string(): String {
var ret = StringBuilder()
val ret = StringBuilder()
ret.append(this.to_s())
ret.append("/")
ret.append(this.prefix.to_s())
Expand Down Expand Up @@ -875,7 +875,7 @@ class IPAddress(

fun bits(): String {
val num = this.host_address.toString(2)
var ret = StringBuilder()
val ret = StringBuilder()
for (i in num.length until this.ip_bits.bits) {
ret.append("0")
}
Expand Down Expand Up @@ -1303,7 +1303,7 @@ class IPAddress(

fun newprefix(num: Int): Result<Prefix> {
for (i in num until this.ip_bits.bits) {
var a = Math.floor(Math.log(i.toDouble()) / Math.log(2.0))
val a = Math.floor(Math.log(i.toDouble()) / Math.log(2.0))
if (a == Math.log(i.toDouble()) / Math.log(2.0)) {
return this.prefix.add(a.toInt())
}
Expand Down
8 changes: 4 additions & 4 deletions kotlin/lib/src/main/kotlin/com/adviser/ipaddress/IpV4.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package com.adviser.ipaddress.kotlin

import java.math.BigInteger

val x80000000 = BigInteger.valueOf(2147483648L)
val xc0000000 = BigInteger.valueOf(3221225472L)
val xe0000000 = BigInteger.valueOf(3758096384L)
val x80000000: BigInteger = BigInteger.valueOf(2147483648L)
val xc0000000: BigInteger = BigInteger.valueOf(3221225472L)
val xe0000000: BigInteger = BigInteger.valueOf(3758096384L)

val is_private = arrayOf(
IPAddress.parse("10.0.0.0/8").unwrap(),
Expand Down Expand Up @@ -49,7 +49,7 @@ class IpV4 {
fun create(str: String): Result<IPAddress> {
val splitted = IPAddress.split_at_slash(str)
if (!IPAddress.is_valid_ipv4(splitted.addr)) {
return Result.Err("Invalid IP ${str}")
return Result.Err("Invalid IP $str")
}
var ip_prefix_num = Result.Ok(32)
if (splitted.netmask !== null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import java.math.BigInteger
class Ipv6Loopback {
companion object {
fun create(): IPAddress {
return IpV6.from_int(BigInteger.ONE, 128).unwrap();
return IpV6.from_int(BigInteger.ONE, 128).unwrap()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Ipv6Mapped {
val split_colon = ret.addr.split(":")
if (split_colon.size <= 1) {
// println!("---1")
return Result.Err("not mapped format-1: ${str}")
return Result.Err("not mapped format-1: $str")
}
var netmask = ""
if (ret.netmask != null) {
Expand Down
2 changes: 1 addition & 1 deletion kotlin/lib/src/main/kotlin/com/adviser/ipaddress/Prefix.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface VtFrom {
}
*/

public class Prefix(val num: Int,
class Prefix(val num: Int,
val ip_bits: IpBits,
val net_mask: BigInteger,
val vt_from: (p: Prefix, n: Int) -> Result<Prefix>) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.adviser.ipaddress.kotlin


public class Prefix128 {
class Prefix128 {

companion object {

Expand Down
4 changes: 2 additions & 2 deletions kotlin/lib/src/main/kotlin/com/adviser/ipaddress/Rle.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Rle(val part: Int, var pos: Int, var cnt: Int, var max: Boolean) {
return "<Rle@part:{:x},pos:{},cnt:{},max:{}> self.part, self.pos, self.cnt, self.max)"
}

public final override fun equals(other: Any?): Boolean {
final override fun equals(other: Any?): Boolean {
if (other is Rle) {
return eq(other)
}
Expand Down Expand Up @@ -43,7 +43,7 @@ class Rle(val part: Int, var pos: Int, var cnt: Int, var max: Boolean) {
_last.max = false
} else if (prev.cnt == _last.cnt) {
// nothing
} else if (prev.cnt < _last.cnt) {
} else /* if (prev.cnt < _last.cnt) */ {
// println!("<<<<< last={:?}->{}->prev={:?}", _last, idx, prev)
//this.ret[idx].max = false
prev.max = false
Expand Down

0 comments on commit cd86ae6

Please sign in to comment.