Skip to content

Commit

Permalink
Update kotlin MPP and AGP versions (#30)
Browse files Browse the repository at this point in the history
* Update kotlin and AGP versions

* add github action

* Bump moar

* Upgrade to new javascript gradle pluign

* Fix CI working dir
  • Loading branch information
felipecsl committed Mar 24, 2020
1 parent b2ca602 commit b3f351d
Show file tree
Hide file tree
Showing 22 changed files with 85 additions and 152 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Android CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

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: Build with Gradle
run: ./gradlew check
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ local.properties
*.so
*.nes
.externalNativeBuild
.cxx
.cxx
node_modules
42 changes: 0 additions & 42 deletions .travis.yml

This file was deleted.

11 changes: 7 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.71'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-multiplatform'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
applicationId "com.felipecsl.knes"
minSdkVersion 16
targetSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
ndk {
Expand Down Expand Up @@ -52,7 +55,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
testImplementation 'junit:junit:4.12'
testImplementation 'com.google.truth:truth:0.42'
testImplementation 'com.google.truth:truth:1.0.1'
testImplementation 'org.mockito:mockito-core:1.10.19'
testImplementation "org.robolectric:robolectric:3.8"
}
6 changes: 2 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.android_gradle_plugin_version = '3.5.2'
ext.kotlin_version = '1.3.71'
ext.android_gradle_plugin_version = '4.0.0-beta01'

repositories {
mavenLocal()
Expand All @@ -16,8 +16,6 @@ buildscript {
}
dependencies {
classpath "com.android.tools.build:gradle:$android_gradle_plugin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.45"
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
31 changes: 13 additions & 18 deletions lib/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
apply plugin: 'kotlin-multiplatform'
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.71'
}

apply plugin: 'com.android.library'

android {
compileSdkVersion 28
compileSdkVersion 29

defaultConfig {
minSdkVersion 16
targetSdkVersion 28
targetSdkVersion 29
}
}

Expand All @@ -15,19 +18,11 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

afterEvaluate {
compileKotlinJs {
kotlinOptions.metaInfo = true
kotlinOptions.outputFile = "${project.buildDir.path}/js/${project.name}.js"
kotlinOptions.sourceMap = true
kotlinOptions.moduleKind = 'commonjs'
kotlinOptions.main = "call"
}
}

kotlin {
jvm()
js()
js {
browser {}
}
android()
androidNativeArm32()
androidNativeArm64()
Expand Down Expand Up @@ -59,22 +54,22 @@ kotlin {
implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
}
}
jvm().compilations.main.defaultSourceSet {
jvmMain {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}
}
js().compilations.main.defaultSourceSet {
jsMain {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
}
}
jvm().compilations.test.defaultSourceSet {
jvmTest {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.google.truth:truth:0.42'
implementation 'com.google.truth:truth:1.0.1'
implementation 'org.mockito:mockito-core:1.10.19'
implementation "org.robolectric:robolectric:3.8"
}
Expand Down
108 changes: 27 additions & 81 deletions web/build.gradle
Original file line number Diff line number Diff line change
@@ -1,88 +1,34 @@
apply plugin: 'kotlin-multiplatform'
apply plugin: 'org.jetbrains.kotlin.frontend'

kotlinFrontend {
downloadNodeJsVersion = "latest"

webpackBundle {
bundleName = "main"
contentPath = file('src/jsMain/web')
webpackConfigFile = file('webpack.config.js').absolutePath
sourceMapEnabled = true
mode = "development"
}

npm {
dependency "react"
dependency "core-js"
dependency "react-dom"
dependency "react-router-dom"
dependency "kotlin"
// This looks like an unofficial package but I couldn't find the actual Jetbrains one, only kotlinx-html
dependency "kotlinx-html-js"
dependency "@jetbrains/kotlin-react"
dependency "@jetbrains/kotlin-react-dom"
dependency "@jetbrains/kotlin-extensions"
dependency "@jetbrains/kotlin-react-router-dom"
}
plugins {
id 'org.jetbrains.kotlin.js' version '1.3.71'
}

kotlin {
sourceSets {
jsMain {
dependencies {
implementation project(':lib')
implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
// https://bintray.com/kotlin/kotlin-js-wrappers/kotlin-react
implementation "org.jetbrains:kotlin-react:16.9.0-pre.83-kotlin-$kotlin_version"
// https://bintray.com/kotlin/kotlin-js-wrappers/kotlin-react-dom
implementation "org.jetbrains:kotlin-react-dom:16.9.0-pre.83-kotlin-$kotlin_version"
// https://bintray.com/kotlin/kotlin-js-wrappers/kotlin-react-router-dom
implementation "org.jetbrains:kotlin-react-router-dom:4.3.1-pre.83-kotlin-$kotlin_version"
// https://github.com/Kotlin/kotlinx.html/releases
implementation "org.jetbrains.kotlinx:kotlinx-html-js:0.6.12"
}
target {
browser {
}
}

targets {
fromPreset(presets.js, 'js') {
configure([compilations.main, compilations.test]) {
tasks.getByName(compileKotlinTaskName).kotlinOptions {
metaInfo = true
outputFile = file("build/js/${project.name}.js")
sourceMap = true
moduleKind = 'commonjs'
}
}

configure(compilations.main) {
tasks.getByName(compileKotlinTaskName).kotlinOptions {
main = "call"
}
}
}
}
}

afterEvaluate {
tasks.getByName('karma-run-single') {
enabled false
}
}

task copyLibs(type: Copy) {
destinationDir buildDir

into("js") {
from project(':lib').file("build/js")
sourceSets["main"].dependencies {
implementation npm("react", "16.13.1")
implementation npm("core-js", "3.6.4")
implementation npm("react-dom", "16.13.1")
implementation npm("react-router-dom", "5.1.2")
// This looks like an unofficial package but I couldn't find the actual Jetbrains one, only kotlinx-html
implementation npm("kotlinx-html-js", "0.6.4")
implementation npm("@jetbrains/kotlin-react", "16.9.0-pre.91")
implementation npm("@jetbrains/kotlin-react-dom", "16.9.0-pre.91")
implementation npm("@jetbrains/kotlin-extensions", "1.0.1-pre.91")
implementation npm("@jetbrains/kotlin-react-router-dom", "4.3.1-pre.91")

implementation project(':lib')

implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
// https://bintray.com/kotlin/kotlin-js-wrappers/kotlin-react
implementation "org.jetbrains:kotlin-react:16.13.0-pre.94-kotlin-1.3.70"
// https://bintray.com/kotlin/kotlin-js-wrappers/kotlin-react-dom
implementation "org.jetbrains:kotlin-react-dom:16.13.0-pre.94-kotlin-1.3.70"
// https://bintray.com/kotlin/kotlin-js-wrappers/kotlin-react-router-dom
implementation "org.jetbrains:kotlin-react-router-dom:4.3.1-pre.94-kotlin-1.3.70"
// https://github.com/Kotlin/kotlinx.html/releases
implementation "org.jetbrains.kotlinx:kotlinx-html-js:0.7.1"
}
}

bundle {
dependsOn copyLibs
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
}
File renamed without changes.
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
fill="currentColor" class="octo-body"></path>
</svg>
</a>
<script type="text/javascript" src="main.bundle.js"></script>
<script type="text/javascript" src="web.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</body>
Expand Down
4 changes: 4 additions & 0 deletions web/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


0 comments on commit b3f351d

Please sign in to comment.