Skip to content
This repository has been archived by the owner on Jun 22, 2022. It is now read-only.

Commit

Permalink
Merge branch 'snapshot/0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Salomon BRYS committed Nov 2, 2020
2 parents 30f7328 + 0f8dfd5 commit afb9bef
Show file tree
Hide file tree
Showing 50 changed files with 994 additions and 1,878 deletions.
32 changes: 24 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest] # [macOS-latest, windows-latest]
os: [macOS-latest, windows-latest]
steps:
- name: Check out
uses: actions/checkout@v2
Expand All @@ -40,18 +40,31 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set up Windows
if: matrix.os == 'windows-latest'
run: |
rm.exe "C:/WINDOWS/system32/bash.EXE"
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
choco install llvm
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# https://youtrack.jetbrains.com/issue/KT-42485
echo "LIBCLANG_DISABLE_CRASH_RECOVERY=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup kodein.local.properties
run: cp .github/conf/kodein.local.${{ matrix.os }}.properties kodein.local.properties
- name: Set up Gradle & Konan
shell: bash
run: ./gradlew
- name: Check
run: ./gradlew check
shell: bash
run: ./gradlew check
- name: Upload
run: ./gradlew hostOnlyPublish --stacktrace
shell: bash
run: ./gradlew hostOnlyPublish --stacktrace
- name: Discard
if: ${{ failure() || cancelled() }}
run: ./gradlew postBintrayDiscard
shell: bash
run: ./gradlew postBintrayDiscard

build-upload-publish:
needs: build-upload
Expand Down Expand Up @@ -87,16 +100,19 @@ jobs:
java-version: 11
- name: Setup kodein.local.properties
run: cp .github/conf/kodein.local.ubuntu-latest.properties kodein.local.properties
- name: Set up Gradle & Konan
shell: bash
run: ./gradlew
- name: Check
run: ./gradlew check
shell: bash
run: ./gradlew check
- name: Upload
run: ./gradlew publish --stacktrace
shell: bash
run: ./gradlew publish --stacktrace
- name: Discard
if: ${{ failure() || cancelled() }}
run: ./gradlew postBintrayDiscard
shell: bash
run: ./gradlew postBintrayDiscard
- name: Publish
run: ./gradlew postBintrayPublish
shell: bash
run: ./gradlew postBintrayPublish
32 changes: 24 additions & 8 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest] # [macOS-latest, windows-latest]
os: [macOS-latest, windows-latest]
steps:
- name: Check out
uses: actions/checkout@v2
Expand All @@ -50,18 +50,31 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set up Windows
if: matrix.os == 'windows-latest'
run: |
rm.exe "C:/WINDOWS/system32/bash.EXE"
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
choco install llvm
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# https://youtrack.jetbrains.com/issue/KT-42485
echo "LIBCLANG_DISABLE_CRASH_RECOVERY=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup kodein.local.properties
run: cp .github/conf/kodein.local.${{ matrix.os }}.properties kodein.local.properties
- name: Set up Gradle & Konan
shell: bash
run: ./gradlew
- name: Check
run: ./gradlew check
shell: bash
run: ./gradlew check
- name: Upload
run: ./gradlew hostOnlyPublish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }} --stacktrace
shell: bash
run: ./gradlew hostOnlyPublish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }} --stacktrace
- name: Discard
if: ${{ failure() || cancelled() }}
run: ./gradlew postBintrayDiscard -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
shell: bash
run: ./gradlew postBintrayDiscard -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}

build-upload-publish:
needs: build-upload
Expand Down Expand Up @@ -97,16 +110,19 @@ jobs:
java-version: 11
- name: Setup kodein.local.properties
run: cp .github/conf/kodein.local.ubuntu-latest.properties kodein.local.properties
- name: Set up Gradle & Konan
shell: bash
run: ./gradlew
- name: Check
run: ./gradlew check
shell: bash
run: ./gradlew check
- name: Upload
run: ./gradlew publish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }} --stacktrace
shell: bash
run: ./gradlew publish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }} --stacktrace
- name: Discard
if: ${{ failure() || cancelled() }}
run: ./gradlew postBintrayDiscard -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
shell: bash
run: ./gradlew postBintrayDiscard -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
- name: Publish
run: ./gradlew postBintrayPublish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
shell: bash
run: ./gradlew postBintrayPublish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
17 changes: 15 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest] # [ubuntu-latest, macOS-latest, windows-latest]
os: [ubuntu-latest, macOS-latest, windows-latest]
steps:
- name: Check out
uses: actions/checkout@v2
Expand All @@ -40,6 +40,16 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
- name: Set up Windows
if: matrix.os == 'windows-latest'
run: |
rm.exe "C:/WINDOWS/system32/bash.EXE"
echo "C:\msys64\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
choco install llvm
echo "C:\Program Files\LLVM\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
# https://youtrack.jetbrains.com/issue/KT-42485
echo "LIBCLANG_DISABLE_CRASH_RECOVERY=1" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Setup Android SDK dir
if: matrix.os == 'ubuntu-latest'
run: echo sdk.dir=$ANDROID_HOME > local.properties
Expand All @@ -48,6 +58,9 @@ jobs:
run: $ANDROID_HOME/tools/bin/sdkmanager "ndk;21.0.6113669"
- name: Setup kodein.local.properties
run: cp .github/conf/kodein.local.${{ matrix.os }}.properties kodein.local.properties
- name: Set up Gradle & Konan
shell: bash
run: ./gradlew
- name: Check
run: ./gradlew check
shell: bash
run: ./gradlew check
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package-lock.json
*.a
*.o
*.so
cmake-build-debug/
cmake-build-*/

# C++
.cxx
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#### 0.4.0 (02-11-2020)

- BREAKING CHANGES
* JNI for desktop JVM artifacts renamed to `kodein-db-jni-jvm`, `kodein-db-jni-jvm-linux`, `kodein-db-jni-jvm-macos` & `kodein-db-jni-jvm-windows` (added `-jvm-`).
* `DB.factory` renamed to `DB.default`. Not a breaking change if you are using `DB.open` & `DB.destroy` utilities.

- MODULES
* new `kodein-leveldb-inmemory` and `kodein-db-inmemory` modules that contain in-memory only backend. DO NOT USE IN PRODUCTION! This is for tests only!

- CORE
* Kotlin `1.4.10`.

- BUILD
* Restored Windows build.
33 changes: 27 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ plugins {
id("org.kodein.root")
}

val kotlinxAtomicFuVer by extra { "0.14.4" } // CAUTION: also change in buildscript!
val kotlinxSerializationVer by extra { "1.0.0-RC" }
val kodeinLogVer by extra { "0.6.0" }
val kodeinMemoryVer by extra { "0.4.0" }

buildscript {
repositories {
maven(url = "https://kotlin.bintray.com/kotlinx")
Expand All @@ -31,9 +26,35 @@ allprojects {
}
}

val kotlinxAtomicFuVer by extra { "0.14.4" } // CAUTION: also change in buildscript!
val kotlinxSerializationVer by extra { "1.0.0-RC" }
val kodeinLogVer by extra { "0.6.0" }
val kodeinMemoryVer by extra { "0.4.0" }

val androidNdkVer by extra { "21.0.6113669" } // CAUTION: also change in CI workflows!

val currentOs = org.gradle.internal.os.OperatingSystem.current()!!

when {
currentOs.isWindows -> {
extra["osName"] = "windows"
extra["libExt"] = "dll"
}
currentOs.isMacOsX -> {
extra["osName"] = "macos"
extra["libExt"] = "dylib"
}
currentOs.isLinux -> {
extra["osName"] = "linux"
extra["libExt"] = "so"
}
else -> error("Unknown operating system ${currentOs.name}")
}


kodeinPublications {
repo = "Kodein-DB"
}

// see https://github.com/gradle/kotlin-dsl/issues/607#issuecomment-375687119
subprojects { parent!!.path.takeIf { it != rootProject.path }?.let { evaluationDependsOn(it) } }
//subprojects { parent!!.path.takeIf { it != rootProject.path }?.let { evaluationDependsOn(it) } }
20 changes: 20 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins {
`kotlin-dsl`
}

repositories {
jcenter()
}

gradlePlugin{
plugins {
register("android-ndk-plugin") {
id = "org.kodein.gradle.android-ndk"
implementationClass = "org.kodein.gradle.androidNdkPlugin"
}
register("cmake-plugin") {
id = "org.kodein.gradle.cmake"
implementationClass = "org.kodein.gradle.cmake.CMakePlugin"
}
}
}
38 changes: 38 additions & 0 deletions buildSrc/src/main/kotlin/org/kodein/gradle/androidNdkPlugin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.kodein.gradle

import org.gradle.api.Plugin
import org.gradle.api.Project
import java.io.File
import java.util.*
import kotlin.collections.HashMap


class androidNdkPlugin : Plugin<Project> {

class Extension(private val rootProject: Project) {
fun ndkPath(version: String): String {
(rootProject.findProperty("android-ndk-$version-path") as? String)?.let { return it }

val localPropsFile = rootProject.file("local.properties")
check(localPropsFile.exists()) { "Please create android root local.properties" }

val localProps = localPropsFile.inputStream().use { Properties().apply { load(it) } }

val sdkDir = localProps.getProperty("sdk.dir")?.let { File(it) }
?: throw IllegalStateException("Please set sdk.dir android sdk path in root local.properties")

val ndkDir = sdkDir.resolve("ndk").resolve(version).takeIf { it.exists() }
?: throw IllegalStateException("Please install Android NDK version $version")

val ndkPath = ndkDir.absolutePath
@Suppress("UNCHECKED_CAST")
(rootProject.properties as HashMap<String, Any>).put("android-ndk-$version-path", ndkPath)

return ndkPath
}
}

override fun apply(target: Project) {
target.extensions.add("androidNdk", Extension(target.rootProject))
}
}
40 changes: 40 additions & 0 deletions buildSrc/src/main/kotlin/org/kodein/gradle/cmake/CMakeBuildTask.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package org.kodein.gradle.cmake

import org.gradle.api.tasks.*
import java.io.File


open class CMakeBuildTask : AbstractExecTask<CMakeBuildTask>(CMakeBuildTask::class.java) {

private lateinit var conf: CMakeConfigureTask

@get:Input
var target: String = "install"

@get:InputDirectory
val cmakeProjectDir: File get() = conf.cmakeProjectDir

@get:OutputDirectory
val installDir: File
get() = File(conf.installPath)

init {
group = "build"
executable = "cmake"
}

internal fun initialize(conf: CMakeConfigureTask) {
this.conf = conf
dependsOn(conf)
workingDir = conf.workingDir
}

override fun exec() {
val a = mutableListOf("--build", ".")
a.addAll(args ?: emptyList())
a.addAll(listOf("--target", target))
setArgs(a)
super.exec()
}

}
Loading

0 comments on commit afb9bef

Please sign in to comment.