Skip to content

Commit

Permalink
Merge pull request #4 from agorapulse/chore/kordamp
Browse files Browse the repository at this point in the history
using Kordamp
  • Loading branch information
musketyr committed Feb 17, 2021
2 parents 851a0b3 + 1402f37 commit 6e230ca
Show file tree
Hide file tree
Showing 17 changed files with 400 additions and 117 deletions.
53 changes: 39 additions & 14 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
#
# SPDX-License-Identifier: Apache-2.0
#
# Copyright 2020-2021 Agorapulse.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: Check

on: [push, pull_request]
Expand All @@ -8,21 +26,28 @@ jobs:
env:
GRADLE_OPTS: "-Xmx6g -Xms4g"
CI: true
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v1

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: eskatos/gradle-command-action@v1
with:
arguments: check --stacktrace
- uses: actions/cache@v1
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- uses: eskatos/gradle-command-action@v1
with:
arguments: check coveralls --stacktrace
- name: Show Reports
uses: actions/upload-artifact@v1
if: failure()
with:
name: reports
path: build/reports/
221 changes: 137 additions & 84 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,110 +1,163 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2020-2021 Agorapulse.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
plugins {
id "io.spring.dependency-management" version "1.0.6.RELEASE"
id "groovy"
id "maven"
id "jacoco"
id "checkstyle"
id "codenarc"
id 'com.github.kt3k.coveralls' version '2.8.4'
id "maven-publish"
id "com.jfrog.bintray" version "1.8.4"
id 'org.kordamp.gradle.groovy-project'
id 'org.kordamp.gradle.bintray'
id 'org.kordamp.gradle.checkstyle'
id 'org.kordamp.gradle.codenarc'
id 'org.kordamp.gradle.coveralls'
}

repositories {
mavenLocal()
mavenCentral()
maven { url "https://jcenter.bintray.com" }
}
if (!project.hasProperty('bintrayUsername')) ext.bintrayUsername = '**UNDEFINED**'
if (!project.hasProperty('bintrayApiKey')) ext.bintrayApiKey = '**UNDEFINED**'

config {
release = (rootProject.findProperty('release') ?: false).toBoolean()

info {
name = 'Micronaut Segment'
vendor = 'Agorapulse'
description = 'Micronaut integration for Segment'

dependencyManagement {
imports {
mavenBom 'io.micronaut:micronaut-bom:1.2.10'
links {
website = "https://github.com/" + slug
issueTracker = "https://github.com/" + slug + "/issues"
scm = "https://github.com/" + slug + ".git"
}

people {
person {
id = 'musketyr'
name = 'Vladimir Orany'
roles = ['developer']
}
}

repositories {
repository {
name = 'localRelease'
url = "" + project.rootProject.buildDir + "/repos/local/release"
}
repository {
name = 'localSnapshot'
url = "" + project.rootProject.buildDir + "/repos/local/snapshot"
}
}
}
}

dependencies {
annotationProcessor "io.micronaut:micronaut-inject-java"
licensing {
licenses {
license {
id = 'Apache-2.0'
}
}
}

compile "io.micronaut:micronaut-runtime-groovy"
compile "io.micronaut:micronaut-validation"
compile "com.segment.analytics.java:analytics:2.1.1"
publishing {
signing = false
releasesRepository = 'localRelease'
snapshotsRepository = 'localSnapshot'
}

compileOnly "io.micronaut:micronaut-inject-groovy"
bintray {
credentials {
username = bintrayUsername
password = bintrayApiKey
}
// TODO: replace
userOrg = 'agorapulse'
repo = 'libs'
name = 'micronaut-segment'
publish = true
}

runtime "ch.qos.logback:logback-classic:1.2.3"
quality {
checkstyle {
toolVersion = '8.27'
}

testCompile("org.spockframework:spock-core") {
exclude group: "org.codehaus.groovy", module: "groovy-all"
codenarc {
toolVersion = '1.5'
}
}
testCompile "io.micronaut.test:micronaut-test-spock:1.1.0"
testCompile "io.micronaut:micronaut-inject-groovy"
testCompile 'net.bytebuddy:byte-buddy:1.10.1'
testCompile 'org.objenesis:objenesis:3.0.1'
}

tasks.withType(GroovyCompile) {
groovyOptions.forkOptions.jvmArgs.add('-Dgroovy.parameters=true')
}
coverage {
coveralls {
enabled = true
}
}

checkstyle {
toolVersion = '8.23'
}
docs {
groovydoc {
aggregate {
enabled = false
}
}
}

codenarc {
toolVersion = '1.4'
}

// publishing
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://dl.bintray.com/agorapulse/libs" }
maven { url "https://repo.spring.io/release" }
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
license {
exclude '**/*.json'
exclude '***.yml'
}
}

artifacts {
archives sourcesJar, javadocJar
}
subprojects { subproject ->
if (subproject.name == 'guide') return

publishing {
publications {
groovyMaven(MavenPublication) {
from components.java
apply plugin: 'groovy'

artifact sourcesJar {
classifier "sources"
}
dependencies {
// add your global dependencies
}

artifact javadocJar {
classifier "javadoc"
}
}
// useful for Micronaut
tasks.withType(GroovyCompile) {
groovyOptions.forkOptions.jvmArgs.add('-Dgroovy.parameters=true')
}

// useful for Micronaut
tasks.withType(JavaCompile){
options.encoding = "UTF-8"
options.compilerArgs.add('-parameters')
}

// location independent tests (useful for stable CI builds)
tasks.withType(Test){
systemProperty 'user.timezone', 'UTC'
systemProperty 'user.language', 'en'
}
}

// set bintrayUser & bintrayKey in gradle.properties
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['groovyMaven']
publish = true

final String projectName = project.name
final String projectDescription = project.description

pkg {
websiteUrl = 'https://github.com/agorapulse/micronaut-segmen'
issueTrackerUrl = 'https://github.com/agorapulse/micronaut-segment/issues'
vcsUrl = 'https://github.com/agorapulse/micronaut-segment.git'

repo = 'libs' // or your repo name
userOrg = 'agorapulse'
name = projectName // somehow project.* doesn't work in this closure
desc = projectDescription
licenses = ['Apache-2.0']
// useful for IntelliJ
task cleanOut(type: Delete) {
delete file('out')
}
// dryRun = true // whether to run this as dry-run, without deploying

clean.dependsOn cleanOut
}

check.dependsOn('aggregateCheckstyle', 'aggregateCodenarc', 'aggregateAllTestReports', 'coveralls')
5 changes: 5 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
group = com.agorapulse
version = 0.2.0-SNAPSHOT

slug = agorapulse/micronaut-segment

kordampPluginVersion=0.43.0
micronautVersion = 1.2.8
15 changes: 15 additions & 0 deletions gradle/LICENSE_HEADER
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
SPDX-License-Identifier: Apache-2.0

Copyright 2020-${copyrightYear} Agorapulse.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip
40 changes: 40 additions & 0 deletions libs/micronaut-segment/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2020-2021 Agorapulse.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
dependencies {
annotationProcessor platform("io.micronaut:micronaut-bom:$micronautVersion")
annotationProcessor "io.micronaut:micronaut-inject-java"

compile platform("io.micronaut:micronaut-bom:$micronautVersion")
compile "io.micronaut:micronaut-runtime-groovy"
compile "io.micronaut:micronaut-validation"
compile "com.segment.analytics.java:analytics:2.1.1"

compileOnly "io.micronaut:micronaut-inject-groovy"

runtime "ch.qos.logback:logback-classic:1.2.3"


testCompile platform("io.micronaut:micronaut-bom:$micronautVersion")
testCompile("org.spockframework:spock-core") {
exclude group: "org.codehaus.groovy", module: "groovy-all"
}
testCompile "io.micronaut.test:micronaut-test-spock:1.1.0"
testCompile "io.micronaut:micronaut-inject-groovy"
testCompile 'net.bytebuddy:byte-buddy:1.10.1'
testCompile 'org.objenesis:objenesis:3.0.1'
}
File renamed without changes.
Loading

0 comments on commit 6e230ca

Please sign in to comment.