Skip to content

Commit

Permalink
Merge branch 'master' into jmatsu-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jmatsu committed Jan 10, 2019
2 parents e474202 + 68df0e3 commit 7441072
Show file tree
Hide file tree
Showing 148 changed files with 1,787 additions and 746 deletions.
15 changes: 7 additions & 8 deletions .circleci/config.yml
@@ -1,5 +1,5 @@
cache_version_keys: &cache_version_keys
CACHE_VERSION_OF_PROJECT_DEPS: v1
CACHE_VERSION_OF_PROJECT_DEPS: v2
CACHE_VERSION_OF_DANGER_CACHE: v1

cache_keys:
Expand All @@ -8,13 +8,11 @@ cache_keys:
keys: &all_keys_of_gradle_cache
- *primary_key_of_gradle_cache
- gradle-cache-{{ checksum "~/CACHE_VERSION_OF_PROJECT_DEPS" }}-
- gradle-cache-
danger_cache:
primary: &primary_key_of_danger_cache danger-cache-{{ checksum "~/CACHE_VERSION_OF_DANGER_CACHE" }}-{{ checksum "~/danger_cache" }}
keys: &all_keys_of_danger_cache
- *primary_key_of_danger_cache
- danger-cache-{{ checksum "~/CACHE_VERSION_OF_DANGER_CACHE" }}-
- danger-cache-

docker_env:
android_defaults: &android_defaults
Expand Down Expand Up @@ -54,20 +52,19 @@ jobs:
- run: *init_bash
- restore_cache: &restore_gradle_cache
keys: *all_keys_of_gradle_cache
- run:
- run: &download_all_dependencies
name: Download Dependencies
command: ./gradlew androidDependencies
command: retry_command ./gradlew androidDependenciesExtra getDependencies
- save_cache: &save_gradle_cache
paths:
- ~/.android
- ~/.gradle
- .gradle
- ~/.m2
key: *primary_key_of_gradle_cache
- run:
name: Assemble apk
command: |
./gradlew assembleDebug # --offline # build with online-mode for now
./gradlew clean assembleDebug --offline
- store_artifacts:
path: frontend/android/build/outputs/apk
- run: *download_dpg
Expand Down Expand Up @@ -108,7 +105,9 @@ jobs:
- checkout
- run: *init_bash
- restore_cache: *restore_gradle_cache
- run: ./gradlew testDebugUnitTest lintDebug ktlint --continue
- run: *download_all_dependencies
- save_cache: *save_gradle_cache
- run: ./gradlew testDebugUnitTest lintDebug ktlint --continue --offline
- run:
name: Merge junit report files
command: |
Expand Down
22 changes: 22 additions & 0 deletions .circleci/scripts/retry_command
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -eu

: "${MAX_RETRY_COUNT:=3}"

retry() {
local retry=0

while let "$MAX_RETRY_COUNT > $retry"; do
let "retry=$retry+1"

"$@" && exit 0

sleep 3
done

echo "Failed to process : $@" 1>&2
exit 1
}

retry "$@"
3 changes: 2 additions & 1 deletion .idea/dictionaries/dic.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -4,6 +4,7 @@

You can download the binary built on master branch from [<img src="https://dply.me/t6sc7f/button/large" alt="Try it on your device via DeployGate">](https://dply.me/t6sc7f#install)

NOTE: Google Play Protect will show a warning dialog on some of devices when installing the current apk. The detailed specification of Google Play Protect is not public so we cannot address this matter. Please ignore the dialog for now. If you cannot install this apk without any error message, please disable Google Play Protect from Google Play Store's menus. Sorry for the inconvenience.

# Features

Expand All @@ -18,7 +19,7 @@ You can download the binary built on master branch from [<img src="https://dply.

# Contributing

We welcome any and all contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for more information
We always welcome any and all contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for more information

## Requirements

Expand Down
Binary file removed architecture.png
Binary file not shown.
24 changes: 22 additions & 2 deletions build.gradle
Expand Up @@ -5,8 +5,12 @@ import dependencies.Dep
apply from: file('gradle/dependencyGraph.gradle')

buildscript {
ext {
isCi = System.getenv("CI") == "true"
}
repositories {
google()
if (!isCi) { maven { url "https://maven-central-asia.storage-download.googleapis.com/repos/central/data/" } }
jcenter()
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
Expand All @@ -28,6 +32,7 @@ buildscript {
allprojects {
repositories {
google()
if (!isCi) { maven { url "https://maven-central-asia.storage-download.googleapis.com/repos/central/data/" } }
jcenter()
maven { url "https://kotlin.bintray.com/kotlinx" }
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
Expand Down Expand Up @@ -55,8 +60,16 @@ allprojects {
}

task ktlint(type: JavaExec, group: "verification") {
def parameters = ["--android", '--editorconfig', "${rootProject.projectDir}/.editorconfig", "--reporter=checkstyle,output=${buildDir}/ktlint/checkstyle.xml"]

if (!isCi) {
parameters += "--reporter=html,artifact=me.cassiano:ktlint-html-reporter:0.2.0,output=${buildDir}/ktlint/checkstyle.html"
}

parameters += ['src/main/**/*.kt', 'src/debug/**/*.kt', 'src/release/**/*.kt']

description = 'Check Kotlin code style.'
args "--android", '--editorconfig', "${rootProject.projectDir}/.editorconfig", "--reporter=html,artifact=me.cassiano:ktlint-html-reporter:0.2.0,output=${buildDir}/ktlint/checkstyle.html", "--reporter=checkstyle,output=${buildDir}/ktlint/checkstyle.xml", 'src/main/**/*.kt', 'src/debug/**/*.kt', 'src/release/**/*.kt'
args = parameters
// https://github.com/shyiko/ktlint/blob/5fe8d0e203275a1a3337dc9777b50ec2a34a58df/ktlint/src/main/kotlin/com/github/shyiko/ktlint/Main.kt
main = 'com.github.shyiko.ktlint.Main'
classpath = configurations.ktlint
Expand All @@ -68,6 +81,14 @@ allprojects {
main = "com.github.shyiko.ktlint.Main"
args "--android", '-F', 'src/main/**/*.kt', 'src/debug/**/*.kt', 'src/release/**/*.kt'
}

task androidDependenciesExtra(dependsOn: 'androidDependencies') {
description 'Download extra dependencies for the CI Gradle Cache'
doLast {
// androidDependencies do not touch some configurations
configurations.findAll { it.name.matches(/(ktlint|kapt|_internal_aapt2_binary|lintClassPath)/) && it.canBeResolved }.files
}
}
}
}
}
Expand All @@ -81,7 +102,6 @@ allprojects {
}
}
}

}

task clean(type: Delete) {
Expand Down
11 changes: 10 additions & 1 deletion buildSrc/src/main/java/dependencies/Dep.kt
Expand Up @@ -42,6 +42,7 @@ object Dep {
val design = "com.google.android.material:material:1.1.0-alpha02"
val coreKtx = "androidx.core:core-ktx:1.0.0-alpha1"
val preference = "androidx.preference:preference:1.0.0"
val browser = "androidx.browser:browser:1.0.0"

val lifecycleExtensions = "androidx.lifecycle:lifecycle-extensions:2.0.0"
val lifecycleLiveData = "androidx.lifecycle:lifecycle-livedata:2.0.0"
Expand Down Expand Up @@ -76,7 +77,8 @@ object Dep {
"org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$coroutinesVersion"
val coroutinesPlayServices =
"org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$coroutinesVersion"
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.8.1-rc13"
val serializationCommon = "org.jetbrains.kotlinx:kotlinx-serialization-runtime:0.9.1"
val serializationIos = "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:0.9.1"
}

object Firebase {
Expand Down Expand Up @@ -114,6 +116,7 @@ object Dep {
val version = "3.11.0"
val client = "com.squareup.okhttp3:okhttp:$version"
val loggingInterceptor = "com.squareup.okhttp3:logging-interceptor:$version"
val okio = "com.squareup.okio:okio:1.14.0"
}

val liveDataKtx = "com.shopify:livedata-ktx:2.0.1"
Expand Down Expand Up @@ -173,4 +176,10 @@ object Dep {
val picasso = "com.squareup.picasso:picasso:2.71828"
val picassoTransformation = "jp.wasabeef:picasso-transformations:2.2.1"
}

object Timber {
val common = "com.jakewharton.timber:timber-common:5.0.0-SNAPSHOT"
val jdk = "com.jakewharton.timber:timber-jdk:5.0.0-SNAPSHOT"
val android = "com.jakewharton.timber:timber-android:5.0.0-SNAPSHOT"
}
}
46 changes: 32 additions & 14 deletions data/api-impl/build.gradle
Expand Up @@ -25,8 +25,36 @@ kotlin {
sourceSets {
commonMain.dependencies {
api project(":data:api")
implementation Dep.Kotlin.stdlibCommon
implementation Dep.Ktor.clientCommon
implementation Dep.Kotlin.serialization
implementation Dep.Kotlin.serializationCommon
}
androidMain {
dependsOn commonMain
dependencies {
implementation Dep.Kotlin.stdlibJvm
implementation Dep.Ktor.clientAndroid
implementation Dep.Ktor.jsonJvm
implementation Dep.OkHttp.client
implementation Dep.Stetho.stetho
implementation Dep.Dagger.core
implementation Dep.Dagger.androidSupport
implementation Dep.OkHttp.loggingInterceptor
}
}
androidTest {
dependsOn androidMain
dependencies {
implementation Dep.Test.junit
implementation Dep.Test.slf4j
}
}
iOSMain {
dependsOn commonMain
dependencies {
implementation Dep.Ktor.clientIos
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:0.9.1"
}
}
}
}
Expand All @@ -45,20 +73,10 @@ android {
}

dependencies {

implementation Dep.Kotlin.stdlibJvm
implementation Dep.Ktor.clientAndroid
implementation Dep.Ktor.jsonJvm
implementation Dep.OkHttp.client
implementation Dep.Stetho.stetho
implementation Dep.Dagger.core
implementation Dep.Dagger.androidSupport
implementation Dep.OkHttp.loggingInterceptor
kapt Dep.Dagger.compiler
kapt Dep.Dagger.androidProcessor

testImplementation Dep.Test.junit
testImplementation Dep.Test.slf4j
}


configurations {
compileClasspath
}
@@ -0,0 +1,3 @@
package io.github.droidkaigi.confsched2019.data.api

internal expect fun apiEndpoint(): String
Expand Up @@ -19,5 +19,7 @@ data class SessionResponseImpl(
override val sessionType: String?,
@Optional override val message: SessionMessageResponseImpl? = null,
override val isPlenumSession: Boolean,
override val interpretationTarget: Boolean
override val interpretationTarget: Boolean,
override val videoUrl: String?,
override val slideUrl: String?
) : SessionResponse
@@ -0,0 +1,24 @@
package io.github.droidkaigi.confsched2019.data.api

import io.ktor.client.HttpClient
import io.ktor.client.engine.ios.Ios
import io.ktor.client.features.UserAgent
import platform.Foundation.NSBundle

// TODO: Replace with DI tools.
internal fun generateHttpClient(): HttpClient {
val version = NSBundle.mainBundle.objectForInfoDictionaryKey("CFBundleShortVersionString") as String
return HttpClient(Ios) {
install(UserAgent) {
agent = "official-app-2019/$version"
}
}
}

fun generateDroidKaigiApi(): DroidKaigiApi {
return KtorDroidKaigiApi(generateHttpClient(), apiEndpoint())
}

fun generateGoogleFormApi(): GoogleFormApi {
return KtorGoogleFormApi(generateHttpClient())
}
@@ -0,0 +1,5 @@
package io.github.droidkaigi.confsched2019.data.api

// TODO: Replace with code getting endpoint from iOS application build configurations.
// This is temporally implementation.
internal actual fun apiEndpoint(): String = "https://droidkaigi2019-dev.appspot.com/api"
@@ -0,0 +1,5 @@
package io.github.droidkaigi.confsched2019.data.api

import io.github.droidkaigi.confsched2019.api.BuildConfig

internal actual fun apiEndpoint(): String = BuildConfig.API_ENDPOINT
Expand Up @@ -37,7 +37,7 @@ internal abstract class ApiModule {
}

@JvmStatic @Provides @Named("apiEndpoint") fun apiEndpoint(): String {
return BuildConfig.API_ENDPOINT
return io.github.droidkaigi.confsched2019.data.api.apiEndpoint()
}
}
}
6 changes: 6 additions & 0 deletions data/api/build.gradle
Expand Up @@ -8,6 +8,12 @@ apply from: rootProject.file('gradle/android.gradle')
kotlin {
targets {
fromPreset(presets.android, 'android')
final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
? presets.iosArm64 : presets.iosX64

fromPreset(iOSTarget, 'iOS') {
compilations.main.outputKinds('FRAMEWORK')
}
}
sourceSets {
commonMain.dependencies {
Expand Down

This file was deleted.

Expand Up @@ -15,5 +15,7 @@ interface SessionResponse {
val message: SessionMessageResponse?
val isPlenumSession: Boolean
val sessionType: String?
val videoUrl: String?
val slideUrl: String?
val interpretationTarget: Boolean
}
2 changes: 1 addition & 1 deletion data/db-room/build.gradle
Expand Up @@ -14,7 +14,7 @@ dependencies {
api project(":ext:android-extension")

implementation Dep.Kotlin.stdlibJvm
implementation Dep.Kotlin.serialization
implementation Dep.Kotlin.serializationCommon
api Dep.Kotlin.coroutines
api Dep.AndroidX.Room.runtime
api Dep.AndroidX.Room.coroutine
Expand Down

0 comments on commit 7441072

Please sign in to comment.