2017-04-02 10:06:52 +02:00
plugins {
2021-03-20 21:18:56 +01:00
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.github.kt3k.coveralls' version '2.11.0' // Coverage
2017-04-02 10:06:52 +02:00
}
2023-05-01 13:24:10 +02:00
def majorJavaVersion = JavaVersion . current ( ) . getMajorVersion ( ) as int
if ( majorJavaVersion < 11 ) {
2023-05-01 13:07:15 +02:00
sourceCompatibility = 1.8
2023-05-01 13:24:10 +02:00
} else {
sourceCompatibility = 11
}
2021-02-13 14:25:42 +01:00
2018-06-10 21:04:03 +02:00
group 'de.inetsoftware'
archivesBaseName = 'jwebassembly-compiler'
2021-03-20 21:18:56 +01:00
version = '0.4'
2018-05-20 12:51:03 +02:00
2017-04-02 10:06:52 +02:00
repositories {
2021-02-17 15:01:19 +01:00
mavenCentral ( )
2019-02-23 21:56:11 +01:00
maven { url 'https://jitpack.io' } // for snapshot of the API
2017-04-02 10:06:52 +02:00
}
dependencies {
2019-08-11 14:44:24 +02:00
// "compileOnly" will not add as dependency. this is different to "compile".
2018-08-24 18:11:39 +02:00
compileOnly 'com.google.code.findbugs:jsr305:3.0.1'
2019-08-11 14:44:24 +02:00
//compileOnly 'de.inetsoftware:jwebassembly-api:+'
2023-05-01 13:07:15 +02:00
compileOnly 'com.github.i-net-software:jwebassembly-api:1500d4af1e' // jitpack snapshot currently not working 'com.github.i-net-software:jwebassembly-api:master-SNAPSHOT'
2019-08-11 14:44:24 +02:00
2021-07-10 22:32:08 +02:00
testImplementation 'com.google.code.findbugs:jsr305:3.0.1'
2019-02-23 21:56:11 +01:00
//testCompile 'de.inetsoftware:jwebassembly-api:+'
2023-05-01 13:07:15 +02:00
testImplementation 'com.github.i-net-software:jwebassembly-api:1500d4af1e' // jitpack snapshot currently not working 'com.github.i-net-software:jwebassembly-api:master-SNAPSHOT'
2021-07-10 22:32:08 +02:00
testImplementation 'junit:junit:+'
2023-01-20 21:43:06 +01:00
testImplementation 'org.mockito:mockito-core:4.+'
2021-07-10 22:32:08 +02:00
testImplementation 'org.apache.commons:commons-compress:1.2'
testImplementation 'com.google.code.gson:gson:+'
2017-04-02 10:06:52 +02:00
}
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'src'
}
}
test {
java {
srcDir 'test'
2023-05-01 13:24:10 +02:00
if ( majorJavaVersion > = 11 ) {
srcDir 'test11'
}
2017-04-02 10:06:52 +02:00
}
resources {
srcDir 'test'
}
}
}
2020-03-15 16:02:12 +01:00
compileJava . options . encoding = 'UTF-8'
2021-03-20 21:18:56 +01:00
compileJava . options . compilerArgs + = [ '-Xlint:all' , '-Xlint:-serial' , '-Xlint:-fallthrough' ]
2020-03-15 16:02:12 +01:00
compileTestJava . options . encoding = 'UTF-8'
javadoc . options . encoding = 'UTF-8'
2019-12-23 22:07:22 +01:00
2019-02-28 21:27:10 +01:00
jar {
manifest {
2021-03-20 21:18:56 +01:00
attributes ( 'Specification-Title' : 'JWebAssembly-Compiler' ,
'Specification-Vendor' : 'i-net software' ,
'Specification-Version' : version ,
'Implementation-Title' : 'JWebAssembly-Compiler' ,
2019-02-28 21:27:10 +01:00
'Implementation-Vendor' : 'i-net software' ,
'Implementation-Version' : version )
}
}
2018-06-10 21:04:03 +02:00
task sourcesJar ( type: Jar , dependsOn: classes ) {
2023-02-26 22:33:19 +01:00
archiveClassifier = 'sources'
2018-06-10 21:04:03 +02:00
from sourceSets . main . java
}
task javadocJar ( type: Jar , dependsOn: javadoc ) {
2023-02-26 22:33:19 +01:00
archiveClassifier = 'javadoc'
2018-06-10 21:04:03 +02:00
from javadoc . destinationDir
}
build {
dependsOn sourcesJar
dependsOn javadocJar
}
artifacts {
archives sourcesJar
archives javadocJar
}
2017-04-04 21:30:12 +02:00
test {
2019-12-23 22:07:22 +01:00
systemProperty "file.encoding" , "UTF-8"
2022-08-01 20:02:59 +02:00
enableAssertions = true
2019-01-20 11:31:12 +01:00
testLogging {
showStandardStreams = true
showStackTraces = true
exceptionFormat = 'full'
events 'passed' , 'skipped' , 'failed'
}
2017-04-04 21:30:12 +02:00
}
2018-05-20 12:51:03 +02:00
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Coverage
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
apply plugin: 'jacoco'
jacocoTestReport {
tasks . coveralls . dependsOn it
reports {
2023-02-26 22:33:19 +01:00
xml . required = true // coveralls plugin depends on xml format report
html . required = true
2018-05-20 12:51:03 +02:00
}
}
check . dependsOn tasks . coveralls
2018-08-24 18:11:39 +02:00
2021-03-20 21:18:56 +01:00
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Deploy to Sonatype
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
2018-08-24 18:11:39 +02:00
publishing {
publications {
2021-03-20 21:18:56 +01:00
JWebAssembly ( MavenPublication ) {
2018-08-24 18:11:39 +02:00
from components . java
artifact sourcesJar
artifact javadocJar
artifactId archivesBaseName
2021-03-20 21:18:56 +01:00
pom {
name = 'JWebAssembly-Compiler'
description = 'A Java to WebAssembly compiler.'
url = 'https://github.com/i-net-software/JWebAssembly'
developers {
developer {
id = 'Horcrux7'
name = 'Volker Berlin'
email = 'vberlin@inetsoftware.de'
organization = 'i-net software'
organizationUrl = 'https://www.inetsoftware.de'
}
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
connection = 'scm:git:git@github.com:i-net-software/JWebAssembly.git'
developerConnection = 'scm:git:git@github.com:i-net-software/JWebAssembly.git'
url = 'https://github.com/i-net-software/JWebAssembly'
}
2018-08-24 18:11:39 +02:00
}
}
}
2021-03-20 21:18:56 +01:00
repositories {
maven {
url 'https://oss.sonatype.org/service/local/staging/deploy/maven2'
if ( project . hasProperty ( "ossrhUsername" ) ) {
credentials {
username ossrhUsername
password ossrhPassword
}
}
}
}
}
signing {
if ( project . hasProperty ( "signing.keyId" ) ) {
sign publishing . publications . JWebAssembly
// does not create sha256 and sha512 checksums
System . setProperty ( 'org.gradle.internal.publish.checksums.insecure' , 'true' )
}
2018-08-24 18:11:39 +02:00
}