Skip to content

Commit

Permalink
add kotlin supported module.
Browse files Browse the repository at this point in the history
  • Loading branch information
yangchengdong committed Jan 22, 2019
1 parent 61e95fd commit 17d1318
Show file tree
Hide file tree
Showing 13 changed files with 217 additions and 3 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

ext.kotlin_version = '1.3.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// micro-module
classpath 'com.eastwood.tools.plugins:micro-module:1.2.1'
classpath 'com.eastwood.tools.plugins:micro-module:1.3.1'

// auto-inject
classpath 'com.eastwood.tools.plugins:auto-inject:1.0.3'
Expand Down
1 change: 1 addition & 0 deletions kotlin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
81 changes: 81 additions & 0 deletions kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apply plugin: 'com.android.library'
apply plugin: 'mis'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 27

defaultConfig {
minSdkVersion 14
targetSdkVersion 27
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

mis {
publications {
main {
groupId 'com.eastwood.demo'
artifactId 'kotlin-sdk'
// version '1.0.0-SNAPSHOT' // 初次配置时不设置,发布至maven时设置

dependencies {
// 只支持 compileOnly 和 implementation

// compileOnly 'com.google.code.gson:gson:2.8.1'
// or
// implementation 'com.google.code.gson:gson:2.8.1'

// compileOnly misPublication('com.eastwood.demo:module-main-sdk')
}
}
}

repositories {
// maven {
// url "http://******"
// credentials {
// username '******'
// password '******'
// }
// }

maven {
url "http://10.10.9.201:8081/repository/android-dev/"
credentials {
username 'admin'
password 'admin123'
}
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
21 changes: 21 additions & 0 deletions kotlin/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.eastwood.demo.kotlin;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.eastwood.demo.kotlin.test", appContext.getPackageName());
}
}
2 changes: 2 additions & 0 deletions kotlin/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.eastwood.demo.kotlin" />
14 changes: 14 additions & 0 deletions kotlin/src/main/java/com/eastwood/demo/kotlin/KotlinService.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.eastwood.demo.kotlin

/**
*
* @author eastwood
* createDate: 2019-01-21
*/
class KotlinService : IKotlin {

override fun test() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}

}
14 changes: 14 additions & 0 deletions kotlin/src/main/mis/com/eastwood/demo/kotlin/IKotlin.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.eastwood.demo.kotlin

/**
*
* @author eastwood
* createDate: 2019-01-21
*/
interface IKotlin {

var javaObject:JavaObject

fun test()

}
10 changes: 10 additions & 0 deletions kotlin/src/main/mis/com/eastwood/demo/kotlin/IKotlin1.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.eastwood.demo.kotlin

/**
*
* @author eastwood
* createDate: 2019-01-21
*/
interface IKotlin1 {
fun test()
}
24 changes: 24 additions & 0 deletions kotlin/src/main/mis/com/eastwood/demo/kotlin/JavaObject.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.eastwood.demo.kotlin;

/**
* @author eastwood
* createDate: 2019-01-21
*/
public class JavaObject implements IKotlin {

@Override
public JavaObject getJavaObject() {
return null;
}

@Override
public void setJavaObject(JavaObject javaObject) {

}

@Override
public void test() {

}

}
3 changes: 3 additions & 0 deletions kotlin/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">kotlin</string>
</resources>
17 changes: 17 additions & 0 deletions kotlin/src/test/java/com/eastwood/demo/kotlin/ExampleUnitTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.eastwood.demo.kotlin;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
includeBuild './mis-plugin'
include ':mis-core'

include ':app', ':library', ':micro-module'
include ':app', ':library', ':micro-module', ':kotlin'

0 comments on commit 17d1318

Please sign in to comment.