Skip to content

Commit

Permalink
v.0.0.0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
belyaev-mikhail committed Mar 31, 2020
1 parent 71dfc7a commit 09fec7f
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 19 deletions.
12 changes: 12 additions & 0 deletions .github/bintray-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>bintray-vorpal-research-kotlin-maven</id>
<username>${env.BINTRAY_USERNAME}</username>
<password>${env.BINTRAY_PASSWORD}</password>
</server>
</servers>
</settings>
53 changes: 53 additions & 0 deletions .github/workflows/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Java CD

on:
release:
types: published

jobs:
publish:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Deploy to Bintray
id: deploy-to-bintray
run: |
mvn versions:set -DnewVersion=${{ github.event.release.tag_name }}
mvn deploy -s .github/bintray-settings.xml || echo "deploy failed" >&2
env:
BINTRAY_USERNAME: ${{ secrets.bintray_username }}
BINTRAY_PASSWORD: ${{ secrets.bintray_password }}

- name: Move sources jar file
run: mv target/*-sources.jar sources.jar

- name: Move target jar file
run: mv target/*.jar target.jar

- name: Attach source jar to release
id: upload-source-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: sources.jar
asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}-sources.jar
asset_content_type: application/zip

- name: Attach target jar to release
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: target.jar
asset_name: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.jar
asset_content_type: application/zip
17 changes: 17 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Java CI

on: [push]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B package
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

<groupId>ru.spbstu</groupId>
<artifactId>kotlin-wheels</artifactId>
<version>0.0.0.6</version>
<version>0.0.0.8-SNAPSHOT</version>

<properties>
<java.version>1.8</java.version>
<kotlin.version>1.3.61</kotlin.version>
<kotlin.version>1.3.71</kotlin.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Expand Down
6 changes: 3 additions & 3 deletions src/main/kotlin/ru/spbstu/wheels/Bits.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@file: Suppress(Warnings.NOTHING_TO_INLINE)
@file: UseExperimental(ExperimentalStdlibApi::class, ExperimentalUnsignedTypes::class)
@file: OptIn(ExperimentalStdlibApi::class, ExperimentalUnsignedTypes::class)

package ru.spbstu.wheels

Expand All @@ -20,7 +20,7 @@ val IntBits.Companion.SIZE get() = Int.SIZE_BITS

fun IntBits.Companion.fromString(s: String): IntBits = IntBits(s.toUInt(2).toInt())

@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
inline class IntBits
constructor(val data: Int) {
companion object {}
Expand Down Expand Up @@ -113,7 +113,7 @@ val LongBits.Companion.SIZE get() = Long.SIZE_BITS

fun LongBits.Companion.fromString(s: String): LongBits = bits(s.toULong(2).toLong())

@UseExperimental(ExperimentalStdlibApi::class)
@OptIn(ExperimentalStdlibApi::class)
inline class LongBits
constructor(val data: Long) {
companion object {}
Expand Down
1 change: 1 addition & 0 deletions src/main/kotlin/ru/spbstu/wheels/Expando.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ open class Expando {


inline class Expansion(val map: MutableMap<String, Any?> = mutableMapOf()) {
@Suppress(Warnings.OVERRIDE_BY_INLINE, Warnings.NOTHING_TO_INLINE)
override inline fun toString(): String = map.entries.joinToString(", ") { (k, v) -> "$k=$v" }
}
32 changes: 19 additions & 13 deletions src/main/kotlin/ru/spbstu/wheels/Hash.kt
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
@file: Suppress(Warnings.NOTHING_TO_INLINE)
package ru.spbstu.wheels

import kotlinx.warnings.Warnings

// == values.toSet().hashCode()
fun <T> setHashCode(values: Iterable<T>): Int = values.fold(0) { acc, c -> acc + c.hashCode() }

// == values.toList().hashCode()
fun <T> orderedHashCode(values: Iterable<T>): Int = values.fold(1) { acc, c -> 31 * acc + c.hashCode() }

fun <A, B> hashCombine(a: A, b: B): Int {
var result = a?.hashCode() ?: 0
result = 31 * result + (b?.hashCode() ?: 0)
inline fun <A, B> hashCombine(a: A, b: B): Int {
var result = 1
result = 31 * result + a.hashCode()
result = 31 * result + b.hashCode()
return result
}
fun <A, B, C> hashCombine(a: A, b: B, c: C): Int {
var result = a?.hashCode() ?: 0
result = 31 * result + (b?.hashCode() ?: 0)
result = 31 * result + (c?.hashCode() ?: 0)
inline fun <A, B, C> hashCombine(a: A, b: B, c: C): Int {
var result = 1
result = 31 * result + a.hashCode()
result = 31 * result + b.hashCode()
result = 31 * result + c.hashCode()
return result
}
fun <A, B, C, D> hashCombine(a: A, b: B, c: C, d: D): Int {
var result = a?.hashCode() ?: 0
result = 31 * result + (b?.hashCode() ?: 0)
result = 31 * result + (c?.hashCode() ?: 0)
result = 31 * result + (d?.hashCode() ?: 0)
inline fun <A, B, C, D> hashCombine(a: A, b: B, c: C, d: D): Int {
var result = 1
result = 31 * result + a.hashCode()
result = 31 * result + b.hashCode()
result = 31 * result + c.hashCode()
result = 31 * result + d.hashCode()
return result
}
fun <T> hashCombine(vararg t: T): Int {
inline fun <T> hashCombine(vararg t: T): Int {
var result = 1
for(e in t) result = 31 * result + e.hashCode()
return result
Expand Down
1 change: 0 additions & 1 deletion src/test/kotlin/ru/spbstu/wheels/BitsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith

@ExperimentalStdlibApi
class BitsTest {
@Test
fun boringOps() {
Expand Down

0 comments on commit 09fec7f

Please sign in to comment.