diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml new file mode 100644 index 0000000..2e1cdd5 --- /dev/null +++ b/.github/workflows/Build.yml @@ -0,0 +1,30 @@ +name: Gradle CI + +on: [push, pull_request] + +jobs: + build-on-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build + + build-on-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build diff --git a/.github/workflows/publishing.yml b/.github/workflows/Publishing.yml similarity index 59% rename from .github/workflows/publishing.yml rename to .github/workflows/Publishing.yml index 8251eb6..5beb290 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/Publishing.yml @@ -1,19 +1,37 @@ -# This is a basic workflow to help you get started with Actions +name: Publishing -name: Publish - -# Controls when the action will run. Triggers the workflow on push or pull request -# events but only for the master branch on: release: types: - created -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build: - runs-on: ubuntu-latest + publish-runtime-on-macos: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Gradle clean + run: ./gradlew clean + - name: Gradle build + run: ./gradlew build # if test's failed, don't publish + - name: Check keys + run: ./gradlew :kotlin-jvm-blocking-bridge:ensureBintrayAvailable + -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }} + -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }} + - name: :kotlin-jvm-blocking-bridge:publish + run: ./gradlew + :kotlin-jvm-blocking-bridge:publish + -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }} + -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }} + + publish-runtime-on-windows: + runs-on: windows-latest steps: - uses: actions/checkout@v2 - name: Set up JDK 1.8 @@ -28,9 +46,6 @@ jobs: run: ./gradlew build # if test's failed, don't publish - name: Check keys run: ./gradlew :kotlin-jvm-blocking-bridge:ensureBintrayAvailable - :kotlin-jvm-blocking-bridge-compiler:ensureBintrayAvailable - :kotlin-jvm-blocking-bridge-compiler-embeddable:ensureBintrayAvailable - :kotlin-jvm-blocking-bridge-gradle:ensureBintrayAvailable -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }} -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }} - name: :kotlin-jvm-blocking-bridge:publish @@ -38,21 +53,47 @@ jobs: :kotlin-jvm-blocking-bridge:publish -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }} -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }} + + publish-others-on-ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Gradle clean + run: ./gradlew clean + - name: Gradle build + run: ./gradlew build # if test's failed, don't publish + - name: Check keys + run: ./gradlew :kotlin-jvm-blocking-bridge:ensureBintrayAvailable + :kotlin-jvm-blocking-bridge-compiler:ensureBintrayAvailable + :kotlin-jvm-blocking-bridge-compiler-embeddable:ensureBintrayAvailable + :kotlin-jvm-blocking-bridge-gradle:ensureBintrayAvailable + -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }} + -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }} + - name: :kotlin-jvm-blocking-bridge-compiler:bintrayUpload run: ./gradlew :kotlin-jvm-blocking-bridge-compiler:bintrayUpload -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }} -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }} + - name: :kotlin-jvm-blocking-bridge-compiler-embeddable:bintrayUpload run: ./gradlew :kotlin-jvm-blocking-bridge-compiler-embeddable:bintrayUpload -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }} -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }} + - name: :kotlin-jvm-blocking-bridge-gradle:bintrayUpload run: ./gradlew :kotlin-jvm-blocking-bridge-gradle:bintrayUpload -Dbintray_user=${{ secrets.BINTRAY_USER }} -Pbintray_user=${{ secrets.BINTRAY_USER }} -Dbintray_key=${{ secrets.BINTRAY_KEY }} -Pbintray_key=${{ secrets.BINTRAY_KEY }} + - name: Publish Gradle plugin run: ./gradlew :kotlin-jvm-blocking-bridge-gradle:publishPlugins diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 2187fa2..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Gradle CI - -on: [push, pull_request] - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew build diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index 6694999..acdaf03 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -1,5 +1,5 @@ object Versions { - const val project = "1.0.3" + const val project = "1.0.4" const val idePlugin = "1.2.0" const val kotlin = "1.4.0" diff --git a/ide-plugin/build.gradle.kts b/ide-plugin/build.gradle.kts index 7a3708b..51e33a2 100644 --- a/ide-plugin/build.gradle.kts +++ b/ide-plugin/build.gradle.kts @@ -52,6 +52,7 @@ tasks.getByName("publishPlugin", org.jetbrains.intellij.tasks.PublishTask::class } tasks.withType { + sinceBuild("193.*") untilBuild("205.*") } diff --git a/runtime/build.gradle.kts b/runtime/build.gradle.kts index ce73261..0d8daf1 100644 --- a/runtime/build.gradle.kts +++ b/runtime/build.gradle.kts @@ -19,14 +19,8 @@ kotlin { js { useCommonJs() } - val hostOs = System.getProperty("os.name") - val isMingwX64 = hostOs.startsWith("Windows") - val nativeTarget = when { - hostOs == "Mac OS X" -> macosX64("native") - hostOs == "Linux" -> linuxX64("native") - isMingwX64 -> mingwX64("native") - else -> throw GradleException("Host OS is not supported in Kotlin/Native.") - } + apply(from = file("gradle/compile-native-multiplatform.gradle")) + } sourceSets { diff --git a/runtime/gradle/compile-native-multiplatform.gradle b/runtime/gradle/compile-native-multiplatform.gradle new file mode 100644 index 0000000..2b9c1b9 --- /dev/null +++ b/runtime/gradle/compile-native-multiplatform.gradle @@ -0,0 +1,71 @@ +/* + * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. + */ + +project.ext.ideaActive = System.getProperty('idea.active') == 'true' + +kotlin { + targets { + def hostOs = System.getProperty("os.name") + + def linuxEnabled = hostOs == "Mac OS X" + def macosEnabled = hostOs == "Linux" + def winEnabled = hostOs.startsWith("Windows") + + project.ext.isLinuxHost = linuxEnabled + project.ext.isMacosHost = macosEnabled + project.ext.isWinHost = winEnabled + + if (project.ext.ideaActive) { + def ideaPreset = presets.linuxX64 + if (macosEnabled) ideaPreset = presets.macosX64 + if (winEnabled) ideaPreset = presets.mingwX64 + project.ext.ideaPreset = ideaPreset + } + } +} + +project.ext.nativeMainSets = [] +project.ext.nativeTestSets = [] + +kotlin { + targets.metaClass.addTarget = { preset -> + def target = delegate.fromPreset(preset, preset.name) + project.ext.nativeMainSets.add(target.compilations['main'].kotlinSourceSets.first()) + project.ext.nativeTestSets.add(target.compilations['test'].kotlinSourceSets.first()) + } + + targets { + if (project.ext.ideaActive) { + fromPreset(project.ext.ideaPreset, 'native') + } else { + addTarget(presets.linuxX64) + addTarget(presets.iosArm64) + addTarget(presets.iosArm32) + addTarget(presets.iosX64) + addTarget(presets.macosX64) + addTarget(presets.mingwX64) + addTarget(presets.tvosArm64) + addTarget(presets.tvosX64) + addTarget(presets.watchosArm32) + addTarget(presets.watchosArm64) + addTarget(presets.watchosX86) + } + } + + sourceSets { + nativeMain { dependsOn commonMain } + // Empty source set is required in order to have native tests task + nativeTest {} + + if (!project.ext.ideaActive) { + configure(nativeMainSets) { + dependsOn nativeMain + } + + configure(nativeTestSets) { + dependsOn nativeTest + } + } + } +}