build.gradle 4.4 KB
Newer Older
1
plugins {
B
Bogdan Kobylynskyi 已提交
2 3
    id "java"
    id "idea"
4
    id "ivy-publish"
B
Bogdan Kobylynskyi 已提交
5
    id "jacoco"
6 7
    id "java-library"
    id "signing"
B
Bogdan Kobylynskyi 已提交
8
    id "maven-publish"
B
Bogdan Kobylynskyi 已提交
9
    id "org.sonarqube" version "3.0"
10 11
}

12
version = "4.1.2-SNAPSHOT"
13
group = "io.github.kobylynskyi"
14

15 16 17 18 19 20
repositories {
    mavenCentral()
    jcenter()
}

dependencies {
21
    implementation "org.freemarker:freemarker:2.3.30"
22
    implementation "com.graphql-java:graphql-java:15.0"
23
    implementation "com.fasterxml.jackson.core:jackson-databind:2.12.1"
24

25
    testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.0"
26
    testImplementation "org.junit.jupiter:junit-jupiter-params:5.7.0"
27
    testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.0"
28
    testImplementation "org.hamcrest:java-hamcrest:2.0.0.0"
29 30
}

B
Bogdan Kobylynskyi 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
test.useJUnitPlatform()

task codeCoverageReport(type: JacocoReport) {
    executionData fileTree(project.rootDir.absolutePath).include("build/jacoco/*.exec")

    sourceSets sourceSets.main

    reports {
        xml.enabled true
        xml.destination file("${buildDir}/reports/jacoco/report.xml")
        html.enabled false
        csv.enabled false
    }
}

46 47 48 49 50 51 52 53 54 55 56 57 58
test {
    testLogging {
        events "failed"

        showExceptions true
        exceptionFormat "full"
        showCauses true
        showStackTraces true

        showStandardStreams = false
    }
}

B
Bogdan Kobylynskyi 已提交
59 60
codeCoverageReport.dependsOn test

61 62
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
63

64 65 66
java {
    withJavadocJar()
    withSourcesJar()
67 68 69 70 71 72
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            artifactId "graphql-java-codegen"
73 74 75 76 77 78 79 80 81
            from components.java
            versionMapping {
                usage('java-api') {
                    fromResolutionOf('runtimeClasspath')
                }
                usage('java-runtime') {
                    fromResolutionResult()
                }
            }
82 83 84 85 86 87

            pom {
                name = "GraphQL Java CodeGen"
                description = "Java Code Generator based on GraphQL schema"
                url = "https://github.com/kobylynskyi/graphql-java-codegen"
                organization {
88
                    name = "io.github.kobylynskyi"
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
                    url = "https://github.com/kobylynskyi"
                }
                issueManagement {
                    system = "GitHub"
                    url = "https://github.com/kobylynskyi/graphql-java-codegen/issues"
                }
                licenses {
                    license {
                        name = "MIT License"
                        url = "https://github.com/kobylynskyi/graphql-java-codegen/blob/master/LICENSE"
                        distribution = "repo"
                    }
                }
                scm {
                    url = "https://github.com/kobylynskyi/graphql-java-codegen"
                    connection = "scm:git:git://github.com/kobylynskyi/graphql-java-codegen.git"
                    developerConnection = "scm:git:ssh://git@github.com:kobylynskyi/graphql-java-codegen.git"
                }
                developers {
                    developer {
                        id = "kobylynskyi"
                        name = "Bogdan Kobylynskyi"
                        email = "92bogdan@gmail.com"
                    }
                }
            }
        }
116 117 118 119 120 121 122 123 124 125 126
        ivy(IvyPublication) {
            from components.java
            versionMapping {
                usage('java-api') {
                    fromResolutionOf('runtimeClasspath')
                }
                usage('java-runtime') {
                    fromResolutionResult()
                }
            }
        }
127 128 129 130 131 132 133 134 135
    }
    repositories {
        maven {
            url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
            credentials {
                username sonatypeUsername
                password sonatypePassword
            }
        }
梦境迷离's avatar
梦境迷离 已提交
136 137 138 139 140 141 142 143
        ivy {
            url "${System.properties['user.home']}/.ivy2/local"
            patternLayout {
                artifact '[organisation]/[module]/[revision]/[ext]s/[artifact](-[classifier])(.[ext])'
                // for ci and local, must publish to ivy2 local, can be used for sbt plugin
                ivy '[organisation]/[module]/[revision]/[type]s/[artifact](.[ext])'
            }
        }
144 145
    }
}
146

B
Bogdan Kobylynskyi 已提交
147 148 149 150
if (project.hasProperty("signing.keyId")) {
    signing {
        sign publishing.publications.mavenJava
    }
151
}