aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bintray.gradle24
-rw-r--r--build.gradle203
-rw-r--r--gradle.properties15
-rw-r--r--npm.dependencies2
-rw-r--r--pom.gradle33
-rw-r--r--src/main/kotlin/pl/treksoft/kvision/core/Types.kt29
-rw-r--r--webpack.config.d/jquery.js8
-rw-r--r--webpack.config.d/minify.js17
-rw-r--r--webpack.config.d/mode.js4
9 files changed, 201 insertions, 134 deletions
diff --git a/bintray.gradle b/bintray.gradle
new file mode 100644
index 00000000..45aa5f6c
--- /dev/null
+++ b/bintray.gradle
@@ -0,0 +1,24 @@
+bintray {
+ user = findProperty('buser')
+ key = findProperty('bkey')
+ pkg {
+ repo = 'kotlin'
+ name = "${project.name}"
+ licenses = ['MIT']
+ vcsUrl = "https://github.com/rjaros/kvision.git"
+ version {
+ name = "${project.version}"
+ desc = 'Object oriented Web UI framework for Kotlin/JS'
+ released = new Date()
+ vcsTag = project.version
+ }
+ }
+ filesSpec {
+ from "${project.buildDir}/libs/"
+ into "pl/treksoft/${project.name}/${project.version}"
+ }
+}
+
+bintrayUpload {
+ dependsOn "generatePomFileForMavenProjectPublication"
+}
diff --git a/build.gradle b/build.gradle
index 6dd1b1b5..0d5cc4ca 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,59 +1,111 @@
buildscript {
- ext.kotlin_version = '1.2.31'
- ext.coroutines_version = '0.22.5'
- ext.dokka_version = '0.9.16'
- ext.frontend_plugin_version = '0.0.29'
- ext.detekt_version = '1.0.0.RC6-4'
ext.production = (findProperty('prod') ?: 'false') == 'true'
ext.npmdeps = new File("npm.dependencies").getText()
repositories {
jcenter()
- maven { url = 'https://dl.bintray.com/kotlin/kotlin-eap' }
+ maven { url = "https://dl.bintray.com/kotlin/kotlin-eap" }
maven { url = "https://plugins.gradle.org/m2/" }
- maven { url = 'https://bintray.com/kotlin/kotlin-eap/dokka' }
+ maven { url = "https://bintray.com/kotlin/kotlin-eap/dokka" }
+ maven { url = "https://kotlin.bintray.com/kotlinx" }
}
dependencies {
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
- classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:${frontend_plugin_version}"
- classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${detekt_version}"
- classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
+ classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
+ classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:${frontendPluginVersion}"
+ classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${detektVersion}"
+ classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokkaVersion}"
+ classpath "org.jetbrains.kotlinx:kotlinx-gradle-serialization-plugin:${serializationVersion}"
+ classpath "io.spring.gradle:dependency-management-plugin:${dependencyManagementPluginVersion}"
}
}
plugins {
- id "maven-publish"
id "com.jfrog.bintray" version "1.7.3"
}
+allprojects {
+ apply plugin: 'com.jfrog.bintray'
+ apply plugin: 'maven'
+ apply plugin: 'maven-publish'
+ apply from: rootProject.file('pom.gradle')
+ apply from: rootProject.file('bintray.gradle')
+
+ repositories {
+ jcenter()
+ maven { url = 'https://kotlin.bintray.com/kotlinx' }
+ maven { url = 'https://dl.bintray.com/gbaldeck/kotlin' }
+ maven { url = 'https://dl.bintray.com/rjaros/kotlin' }
+ }
+
+ afterEvaluate {
+ task sourceJar(type: Jar, dependsOn: classes) {
+ classifier 'sources'
+ from sourceSets.main.kotlin
+ duplicatesStrategy = "exclude"
+ }
+ }
+
+ task emptyJar(type: Jar) {
+ classifier 'javadoc'
+ }
+
+ tasks.build.dependsOn(['sourceJar', 'emptyJar'])
+
+ publishing {
+ publications {
+ mavenProject(MavenPublication) {
+ from components.java
+ groupId project.group
+ artifactId project.name
+ version project.version
+
+ artifact sourceJar {
+ classifier 'sources'
+ }
+
+ artifact emptyJar {
+ classifier 'javadoc'
+ }
+
+ withPom(pom)
+ }
+ }
+ }
+
+ model {
+ tasks.generatePomFileForMavenProjectPublication {
+ destination = file("$buildDir/libs/${project.name}-${version}.pom")
+ }
+ }
+}
+
if (!project.gradle.startParameter.taskNames.contains("dokka")) {
- apply plugin: 'kotlin2js'
+ apply plugin: 'kotlin-platform-js'
} else {
apply plugin: 'kotlin'
}
apply plugin: 'org.jetbrains.kotlin.frontend'
-apply plugin: "io.gitlab.arturbosch.detekt"
+apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'org.jetbrains.dokka'
-
-group = 'pl.treksoft'
-version = '0.0.12'
-
-repositories {
- jcenter()
- maven { url = 'https://dl.bintray.com/gbaldeck/kotlin' }
- maven { url = 'https://dl.bintray.com/rjaros/kotlin' }
-}
+apply plugin: 'kotlinx-serialization'
dependencies {
if (!project.gradle.startParameter.taskNames.contains("dokka")) {
- compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
- compile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" // for now only compile configuration is supported
+ expectedBy project(':kvision-common')
+ compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinVersion"
+ compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutinesVersion"
+ compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion"
+ if (!project.gradle.startParameter.taskNames.contains("generatePomFileForMavenProjectPublication")) {
+ compile "org.jetbrains.kotlin:kotlin-test-js:$kotlinVersion"
+ }
+ testCompile "org.jetbrains.kotlin:kotlin-test-js:$kotlinVersion"
} else {
- compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
- compile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" // for now only compile configuration is supported
+ compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"
+ compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
+ compile "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion"
+ testCompile "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
}
- compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$coroutines_version"
compile "com.github.snabbdom:snabbdom-kotlin:0.1.1"
compile "pl.treksoft:navigo-kotlin:0.0.2"
compile "pl.treksoft:jquery-kotlin:0.0.3"
@@ -70,7 +122,6 @@ kotlinFrontend {
dependency("uglifyjs-webpack-plugin")
dependency("file-loader")
dependency("url-loader")
- dependency("expose-loader")
dependency("jquery", "3.2.1")
dependency("fecha", "2.3.2")
dependency("snabbdom", "0.7.1")
@@ -80,49 +131,22 @@ kotlinFrontend {
def (name, version) = line.tokenize(" ")
dependency(name, version)
}
- devDependency("karma", "2.0.0")
- devDependency("karma-qunit", "1.2.1")
- devDependency("karma-chrome-launcher")
- devDependency("karma-firefox-launcher")
- devDependency("karma-webpack", "2.0.9")
- devDependency("webpack", "3.11.0")
- devDependency("webpack-dev-server", "2.11.0")
+ devDependency("karma")
+ devDependency("qunit")
}
webpackBundle {
bundleName = "main"
contentPath = file('src/main/web')
- }
-
- karma {
- plugins = ["karma-chrome-launcher", "karma-firefox-launcher"]
-// browsers = [ "Chrome", "Firefox" ]
+ mode = production ? "production" : "development"
}
define "PRODUCTION", production
}
-task cleanLibs(type: Delete) {
- delete 'build/js', 'build/libs'
-}
-
-if (project.gradle.startParameter.taskNames.contains("jar")) {
- compileKotlin2Js.dependsOn 'cleanLibs'
-}
-
-jar {
- duplicatesStrategy = DuplicatesStrategy.EXCLUDE
- excludes = ["package.json"]
-}
-
-task sourcesJar(type: Jar, dependsOn: classes) {
- classifier = 'sources'
- from sourceSets.main.allSource
-}
-
detekt {
- version = "${detekt_version}"
+ version = "${detektVersion}"
profile("main") {
input = "$projectDir/src/main/kotlin"
config = "$projectDir/detekt.yml"
@@ -136,7 +160,19 @@ dokka {
outputFormat = 'html'
outputDirectory = "$buildDir/kdoc"
reportUndocumented = false
- impliedPlatforms = ["JS"]
+}
+
+task cleanLibs(type: Delete) {
+ delete 'build/js', 'build/libs'
+}
+
+if (project.gradle.startParameter.taskNames.contains("jar")) {
+ compileKotlin2Js.dependsOn 'cleanLibs'
+}
+
+jar {
+ duplicatesStrategy = DuplicatesStrategy.EXCLUDE
+ excludes = ["package.json"]
}
if (!project.gradle.startParameter.taskNames.contains("dokka")) {
@@ -174,48 +210,3 @@ if (!project.gradle.startParameter.taskNames.contains("dokka")) {
tasks.getByName("karma-start") { dependsOn(copyResources, copyResourcesForTests) }
}
}
-
-publishing {
- publications {
- maven(MavenPublication) {
- from components.java
- pom.withXml {
- asNode().dependencies.'*'.findAll() {
- it.artifactId.text() == 'kotlin-test-js'
- }.each() {
- it.scope*.value = 'test'
- }
- }
- }
- }
-}
-
-model {
- tasks.generatePomFileForMavenPublication {
- destination = file("$buildDir/libs/${project.name}-${version}.pom")
- }
-}
-
-bintray {
- user = findProperty('buser')
- key = findProperty('bkey')
- pkg {
- repo = 'kotlin'
- name = "${project.name}"
- licenses = ['MIT']
- vcsUrl = "https://github.com/rjaros/${project.name}.git"
- version {
- name = "${project.version}"
- desc = 'Object oriented Web UI framework for Kotlin/JS'
- released = new Date()
- }
- }
- filesSpec {
- from "${project.buildDir}/libs/"
- into "pl/treksoft/${project.name}/${project.version}"
- }
-}
-
-bintrayUpload {
- dependsOn "generatePomFileForMavenPublication"
-}
diff --git a/gradle.properties b/gradle.properties
index 4ac81290..073e9b1c 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,2 +1,13 @@
-#org.gradle.jvmargs=-XX:+UnlockCommercialFeatures -XX:+FlightRecorder
-#org.gradle.debug=true
+group=pl.treksoft
+version=0.0.12
+kotlinVersion=1.2.40
+javaVersion=1.8
+coroutinesVersion=0.22.5
+serializationVersion=0.4.2
+frontendPluginVersion=0.0.30
+dokkaVersion=0.9.16
+detektVersion=1.0.0.RC6-4
+junitVersion=4.12
+joobyVersion=1.3.0
+dependencyManagementPluginVersion=1.0.4.RELEASE
+jacksonModuleKotlinVersion=2.9.5
diff --git a/npm.dependencies b/npm.dependencies
index 4f4fe417..b557cd0f 100644
--- a/npm.dependencies
+++ b/npm.dependencies
@@ -5,7 +5,7 @@ ajax-bootstrap-select 1.4.3
bootstrap-datetime-picker 2.4.4
bootstrap-touchspin 3.1.1
font-awesome 4.7.0
-font-awesome-webpack 0.0.5-beta.2
+font-awesome-webpack github:jarecsni/font-awesome-webpack
jquery-resizable-dom 0.28.0
awesome-bootstrap-checkbox 0.3.7
trix 0.11.1
diff --git a/pom.gradle b/pom.gradle
new file mode 100644
index 00000000..ccda8308
--- /dev/null
+++ b/pom.gradle
@@ -0,0 +1,33 @@
+def pomConfig = {
+ licenses {
+ license {
+ name "MIT"
+ url "https://opensource.org/licenses/MIT"
+ distribution "repo"
+ }
+ }
+ developers {
+ developer {
+ id "rjaros"
+ name "Robert Jaros"
+ organization "Treksoft"
+ organizationUrl "http://www.treksoft.pl"
+ }
+ }
+
+ scm {
+ url "https://github.com/rjaros/kvision.git"
+ }
+}
+
+def withPom = { pom ->
+ pom.withXml {
+ def root = asNode()
+ root.appendNode('name', project.name)
+ root.appendNode('description', 'Object oriented Web UI framework for Kotlin/JS')
+ root.appendNode('url', 'https://github.com/rjaros/kvision')
+ root.children().last() + pomConfig
+ }
+}
+
+ext.withPom = withPom
diff --git a/src/main/kotlin/pl/treksoft/kvision/core/Types.kt b/src/main/kotlin/pl/treksoft/kvision/core/Types.kt
index 0817b3ae..1b4f011d 100644
--- a/src/main/kotlin/pl/treksoft/kvision/core/Types.kt
+++ b/src/main/kotlin/pl/treksoft/kvision/core/Types.kt
@@ -21,24 +21,25 @@
*/
package pl.treksoft.kvision.core
- /**
- * This type is used for accessing resources with CommonJS **require** function.
- *
- * e.g. require("./img/picture.png")
- */
+/**
+ * This type is used for accessing resources with CommonJS **require** function.
+ *
+ * e.g. require("./img/picture.png")
+ */
typealias ResString = String
- /**
- * Helper type used to define CSS style attributes.
- */
+/**
+ * Helper type used to define CSS style attributes.
+ */
typealias StringPair = Pair<String, String>
- /**
- * Helper type used to define CSS classes.
- */
+/**
+ * Helper type used to define CSS classes.
+ */
typealias StringBoolPair = Pair<String, Boolean>
- /**
- * This type is used for defining CSS dimensions (width, heights, margins, paddings, etc.).
- */
+/**
+ * This type is used for defining CSS dimensions (width, heights, margins, paddings, etc.).
+ */
typealias CssSize = Pair<Int, UNIT>
+
diff --git a/webpack.config.d/jquery.js b/webpack.config.d/jquery.js
index 8c942e79..40522595 100644
--- a/webpack.config.d/jquery.js
+++ b/webpack.config.d/jquery.js
@@ -2,11 +2,3 @@ config.plugins.push(new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery"
}));
-
-config.module.rules.push({
- test: require.resolve('jquery'),
- use: [{
- loader: 'expose-loader',
- options: 'jQuery'
- }]
-})
diff --git a/webpack.config.d/minify.js b/webpack.config.d/minify.js
index 3bc8e884..d85c861c 100644
--- a/webpack.config.d/minify.js
+++ b/webpack.config.d/minify.js
@@ -1,5 +1,16 @@
if (defined.PRODUCTION) {
- config.plugins.push(new webpack.optimize.UglifyJsPlugin({
- minimize: true
- }));
+ const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
+
+ config.optimization = {
+ minimizer: [
+ new UglifyJSPlugin({
+ uglifyOptions: {
+ compress: {
+ unused: false
+ }
+ }
+ })
+ ]
+ }
+
}
diff --git a/webpack.config.d/mode.js b/webpack.config.d/mode.js
new file mode 100644
index 00000000..c86e018e
--- /dev/null
+++ b/webpack.config.d/mode.js
@@ -0,0 +1,4 @@
+config.mode = "development"
+if (defined.PRODUCTION) {
+ config.mode = "production"
+}