Skip to content

Commit

Permalink
issue #21 - make the lib multiplatform
Browse files Browse the repository at this point in the history
- split to common/jvm/js
- left all code in jvm at the moment
- add build scripts
  • Loading branch information
oshai committed Dec 29, 2017
1 parent 4609e59 commit 6ca193e
Show file tree
Hide file tree
Showing 21 changed files with 192 additions and 114 deletions.
130 changes: 18 additions & 112 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,130 +1,36 @@
group 'MicroUtils'
version '1.5.0'

buildscript {
ext.kotlin_version = '1.2.10'
apply from: 'versions.gradle'

repositories {
mavenCentral()
}

dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

plugins {
id "com.jfrog.bintray" version "1.7"
}

group 'MicroUtils'
version '1.4.8'




apply plugin: 'kotlin'
// Apply the java plugin to add support for Java
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'maven-publish'
sourceCompatibility = 1.6
apply plugin: "maven"
apply plugin: "maven-publish"

repositories {
mavenCentral()
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.slf4j:slf4j-api:1.7.25"
testCompile "org.slf4j:slf4j-log4j12:1.7.25"
testCompile "log4j:log4j:1.2.17"
testCompile "org.mockito:mockito-all:1.10.19"
testCompile 'junit:junit:4.12'
}

//https://github.com/bintray/gradle-bintray-plugin
bintray {
user = 'oshai'
key = 'my_key' //https://bintray.com/profile/edit
publications = ['MyPublication']
pkg {
repo = 'kotlin-logging'
name = 'kotlin-logging'
userOrg = 'microutils'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/MicroUtils/kotlin-logging'
version {
name = '1.4.8'
desc = "kotlin-logging 1.4.8 - Lightweight logging framework for Kotlin"
released = new Date()
publishing {
publications {
jvm(MavenPublication) {
artifactId 'kotlin-logging-jvm'
from findProject("kotlin-logging-jvm").components.java
}
}
}

// kotlin compiler compatibility options
compileKotlin {
kotlinOptions {
apiVersion = "1.0"
languageVersion = "1.0"
}
}

// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar, javadocJar
}

def pomConfig = {
name "kotlin-logging"
description "kotlin-logging $version - Lightweight logging framework for Kotlin"
url "https://github.com/MicroUtils/kotlin-logging"

scm {
url "http://github.com/MicroUtils/kotlin-logging/tree/master"
connection "scm:git:git://github.com/MicroUtils/kotlin-logging.git"
developerConnection "scm:git:ssh://github.com:MicroUtils/kotlin-logging.git"
}
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
js(MavenPublication) {
artifactId 'kotlin-logging-js'
from findProject("kotlin-logging-js").components.java
}
}
developers {
developer {
name "Ohad Shai"
email "[email protected]"
organization "github"
organizationUrl "http://www.github.com"
}
}
}

publishing {
publications {
MyPublication(MavenPublication) {
pom.withXml {
def root = asNode()
root.appendNode('description', "kotlin-logging $version - Lightweight logging framework for Kotlin")
root.children().last() + pomConfig
}
from components.java
groupId 'io.github.microutils'
artifactId 'kotlin-logging'
version version

artifact sourcesJar
artifact javadocJar
common(MavenPublication) {
artifactId 'kotlin-logging-common'
from findProject("kotlin-logging-common").components.java
}
}
}


9 changes: 9 additions & 0 deletions kotlin-logging-common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apply plugin: 'kotlin-platform-common'

repositories {
mavenCentral()
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlin_version"
}
28 changes: 28 additions & 0 deletions kotlin-logging-js/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apply plugin: 'kotlin-platform-js'

repositories {
mavenCentral()
jcenter()
}

sourceSets {
main {
kotlin {
srcDirs = ['src', '../klogging.common/src']
}
}
}

dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
expectedBy project(':kotlin-logging-common')
}

def target = "${projectDir}/build/classes/main"

compileKotlin2Js {
kotlinOptions.metaInfo = true
kotlinOptions.outputFile = "$target/klogging.js"
kotlinOptions.sourceMap = true
kotlinOptions.moduleKind = 'umd'
}
130 changes: 130 additions & 0 deletions kotlin-logging-jvm/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
buildscript {
ext.kotlin_version = '1.2.10'

repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

plugins {
id "com.jfrog.bintray" version "1.7"
}

group 'MicroUtils'
version '1.4.8'




apply plugin: 'kotlin-platform-jvm'

apply plugin: 'maven'
apply plugin: 'maven-publish'
sourceCompatibility = 1.6

repositories {
mavenCentral()
}

dependencies {
expectedBy project(':kotlin-logging-common')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile "org.slf4j:slf4j-api:1.7.25"
testCompile "org.slf4j:slf4j-log4j12:1.7.25"
testCompile "log4j:log4j:1.2.17"
testCompile "org.mockito:mockito-all:1.10.19"
testCompile 'junit:junit:4.12'
}

//https://github.com/bintray/gradle-bintray-plugin
bintray {
user = 'oshai'
key = 'my_key' //https://bintray.com/profile/edit
publications = ['MyPublication']
pkg {
repo = 'kotlin-logging'
name = 'kotlin-logging'
userOrg = 'microutils'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/MicroUtils/kotlin-logging'
version {
name = '1.4.8'
desc = "kotlin-logging 1.4.8 - Lightweight logging framework for Kotlin"
released = new Date()
}
}
}

// kotlin compiler compatibility options
compileKotlin {
kotlinOptions {
apiVersion = "1.0"
languageVersion = "1.0"
}
}

// custom tasks for creating source/javadoc jars
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

// add javadoc/source jar tasks as artifacts
artifacts {
archives sourcesJar, javadocJar
}

def pomConfig = {
name "kotlin-logging"
description "kotlin-logging $version - Lightweight logging framework for Kotlin"
url "https://github.com/MicroUtils/kotlin-logging"

scm {
url "http://github.com/MicroUtils/kotlin-logging/tree/master"
connection "scm:git:git://github.com/MicroUtils/kotlin-logging.git"
developerConnection "scm:git:ssh://github.com:MicroUtils/kotlin-logging.git"
}
licenses {
license {
name "The Apache Software License, Version 2.0"
url "http://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
developers {
developer {
name "Ohad Shai"
email "[email protected]"
organization "github"
organizationUrl "http://www.github.com"
}
}
}

publishing {
publications {
MyPublication(MavenPublication) {
pom.withXml {
def root = asNode()
root.appendNode('description', "kotlin-logging $version - Lightweight logging framework for Kotlin")
root.children().last() + pomConfig
}
from components.java
groupId 'io.github.microutils'
artifactId 'kotlin-logging'
version version

artifact sourcesJar
artifact javadocJar
}
}
}


2 changes: 2 additions & 0 deletions kotlin-logging-jvm/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = 'kotlin-logging'

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
rootProject.name = 'kotlin-logging'

include ':kotlin-logging-jvm'
include ':kotlin-logging-js'
include ':kotlin-logging-common'
2 changes: 2 additions & 0 deletions versions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ext.kotlin_version='1.2.10'
ext.sl4j_version='1.7.25'

0 comments on commit 6ca193e

Please sign in to comment.