-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
158 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} | ||
} |