updated build files

pull/11/head
Stefan Feuerhahn 7 years ago
parent fafbec0786
commit 59eee5cbc0

@ -1,52 +1,30 @@
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath group: "org.asciidoctor", name: "asciidoctorj-pdf", version: "1.5.0-alpha.16"
classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:4.0.0"
}
}
plugins { plugins {
id "org.asciidoctor.convert" version "1.5.6" id("biz.aQute.bnd.builder") version "4.1.0"
id "net.saliman.cobertura" version "2.5.1" id("com.diffplug.gradle.spotless") version "3.19.0" apply false
id("io.codearte.nexus-staging") version "0.20.0"
} }
apply plugin: "org.asciidoctor.convert"
apply from: "configuration.gradle" apply from: "configuration.gradle"
asciidoctor {
backends = ["pdf", "html5"]
attributes "stylesheet": "openmuc-asciidoc.css",
"toc2": "left",
"sampleSrc": file("src/sample/java"),
"source-highlighter": "coderay",
"pdf-stylesdir": "./",
"pdf-style": "pdf"
resources {
from("$sourceDir") {
include "images/**"
}
}
}
configure(allprojects) { configure(allprojects) {
version = cfgVersion version = cfgVersion
} }
nexusStaging {
packageGroup = cfgGroup
username = cfgRepositoryUser
password = cfgRepositoryPass
stagingProfileId = cfgStagingProfileId
}
configure(javaProjects) { configure(javaProjects) {
apply plugin: "java" apply plugin: "java"
apply plugin: "eclipse" apply plugin: "eclipse"
apply plugin: "osgi"
apply plugin: "maven" apply plugin: "maven"
apply plugin: "signing" apply plugin: "signing"
apply plugin: "biz.aQute.bnd.builder" apply plugin: "biz.aQute.bnd.builder"
apply plugin: 'net.saliman.cobertura' apply plugin: "com.diffplug.gradle.spotless"
uploadArchives.enabled = false uploadArchives.enabled = false
@ -54,7 +32,7 @@ configure(javaProjects) {
if (!project.properties.containsKey('cfgJavaVersion')) { if (!project.properties.containsKey('cfgJavaVersion')) {
project.ext { project.ext {
cfgJavaVersion = '1.7' cfgJavaVersion = '1.8'
} }
} }
@ -67,7 +45,6 @@ configure(javaProjects) {
} }
sourceSets { sourceSets {
sample
itest { itest {
compileClasspath += sourceSets.main.runtimeClasspath compileClasspath += sourceSets.main.runtimeClasspath
} }
@ -83,20 +60,20 @@ configure(javaProjects) {
version = project.version.replace("-", ".") version = project.version.replace("-", ".")
} }
} }
cobertura {
dependencies { spotless {
testCompile 'org.slf4j:slf4j-simple:1.6.1' java {
} googleJavaFormat()
coverageFormats = ['html', 'xml']
coverageIgnoreTrivial = false
coverageIgnores = ['org.slf4j.Logger.*']
coverageExcludes = ['.*\\.app\\..*', '.*\\.cli-app\\..*', '.*\\.sample\\..*']
coverageReportDir = new File("$buildDir/reports/cobertura")
coverageTestTasks {
project.tasks.withType(Test).matching { it.name == 'test' }
} }
}
tasks.withType(JavaCompile) {
doFirst {
if (sourceCompatibility == '1.7' && System.env.JDK7_HOME != null) {
options.fork = true
options.bootstrapClasspath = files("$System.env.JDK7_HOME/jre/lib/rt.jar")
}
}
} }
task jarAll(type: Copy) { task jarAll(type: Copy) {
@ -121,7 +98,6 @@ configure(javaProjects) {
} }
} }
build.dependsOn { asciidoctor }
build.dependsOn { jarAll } build.dependsOn { jarAll }
eclipse.pathVariables([GRADLE_USER_HOME: file(gradle.gradleUserHomeDir)]) eclipse.pathVariables([GRADLE_USER_HOME: file(gradle.gradleUserHomeDir)])
@ -185,11 +161,10 @@ configure(repositoryProjects) {
} }
pom.project { pom.project {
//additional pom information can be found in subproject build.gradle files //additional pom information can be found in subproject build.gradle files
packaging "jar" packaging "jar"
url "http://www.openmuc.org/" url "http://www.beanit.com/"
scm { scm {
url "none" url "none"
@ -198,8 +173,8 @@ configure(repositoryProjects) {
developers { developers {
developer { developer {
id "openmuc" id "beanit"
name "OpenMUC Team" name "Beanit GmbH"
} }
} }
} }
@ -229,46 +204,9 @@ task javadocAll(type: Javadoc) {
}) })
} }
task writeSettings {
doLast {
Writer out = new OutputStreamWriter(new FileOutputStream("build/settings.gradle"))
out.write("include ")
boolean first = true
for (Project myproject : distributionProjects) {
if (!myproject.getProjectDir().equals(getProjectDir())) {
if (first == true) {
first = false
} else {
out.write ", "
}
out.write '"' + myproject.name + '"'
}
}
out.write "\n\n"
for (Project myproject : distributionProjects) {
if (myproject.getProjectDir().equals(getProjectDir())) {
continue
}
println myproject.name
out.write 'project(":' + myproject.name + '").projectDir = file("' + myproject.getProjectDir().toString().substring((int) (getProjectDir().toString().size() + 1)) + '")\n'
}
out.close()
}
}
task buildDistProjects {
dependsOn(distributionProjects.build)
}
tasks.withType(Tar) { tasks.withType(Tar) {
dependsOn(writeSettings)
dependsOn(distributionProjects.build) dependsOn(distributionProjects.build)
dependsOn(javadocAll) dependsOn(javadocAll)
dependsOn(asciidoctor)
compression = Compression.GZIP compression = Compression.GZIP
@ -279,7 +217,3 @@ task(tar, type: Tar) {
archiveName = project.name + "-" + project.version + ".tgz" archiveName = project.name + "-" + project.version + ".tgz"
} }
task(tarFull, type: Tar) {
dependsOn(tar)
archiveName = project.name + "-" + project.version + "_full.tgz"
}

@ -2,7 +2,7 @@ project.ext {
cfgVersion = "1.7.1-SNAPSHOT" cfgVersion = "1.7.1-SNAPSHOT"
cfgGroup = "org.openmuc" cfgGroup = "com.beanit"
cfgCopyDependencies = true cfgCopyDependencies = true
@ -10,6 +10,8 @@ project.ext {
cfgSignPom = true cfgSignPom = true
cfgJavaVersion = "1.7"
cfgRepository = project.properties.sonatypeRepository cfgRepository = project.properties.sonatypeRepository
cfgSnapshotRepository = project.properties.sonatypeSnapshotRepository cfgSnapshotRepository = project.properties.sonatypeSnapshotRepository
@ -18,6 +20,8 @@ project.ext {
cfgRepositoryPass = project.properties.sonatypePass cfgRepositoryPass = project.properties.sonatypePass
cfgStagingProfileId = project.properties.sonatypeStagingProfileId
javaProjects = allprojects javaProjects = allprojects
distributionProjects = javaProjects distributionProjects = javaProjects
@ -33,9 +37,10 @@ tasks.withType(Tar) {
from("./") { from("./") {
include "build.gradle" include "build.gradle"
include "configuration.gradle" include "configuration.gradle"
include "license/**" include "settings.gradle"
include "doc/CHANGELOG.txt" include "LICENSE.txt"
include "run-scripts/**" include "doc/**"
include "bin/**"
include "gradle/wrapper/**" include "gradle/wrapper/**"
include "gradlew" include "gradlew"
include "gradlew.bat" include "gradlew.bat"
@ -44,20 +49,6 @@ tasks.withType(Tar) {
include "asn1/**" include "asn1/**"
} }
if (name.equals("tar")) {
exclude "**/dependencies/**/src"
}
}
into(project.name + "/doc/user-guide/") {
from("./build/asciidoc/html5/") {
include "**"
}
from("./build/asciidoc/pdf/") {
include "*.pdf"
}
} }
into(project.name + "/doc/") { into(project.name + "/doc/") {
@ -73,30 +64,28 @@ tasks.withType(Tar) {
apply plugin: "java" apply plugin: "java"
apply plugin: "eclipse" apply plugin: "eclipse"
apply plugin: "osgi"
apply plugin: "maven" apply plugin: "maven"
apply plugin: "signing" apply plugin: "signing"
def projectName = 'OpenIEC61850' def projectName = "OpenIEC61850"
dependencies { dependencies {
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25' compile group: "org.slf4j", name: "slf4j-api", version: "1.7.25"
compile group: 'com.beanit', name: 'jasn1', version: '1.11.0' compile group: "com.beanit", name: "jasn1", version: "1.11.0"
compile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.3' compile group: "ch.qos.logback", name: "logback-classic", version: "1.2.3"
compile group: 'com.toedter', name: 'jcalendar', version: '1.4' compile group: "com.toedter", name: "jcalendar", version: "1.4"
} }
jar { jar {
manifest { bnd("Bundle-Name": "OpenIEC61850",
name = projectName "Bundle-SymbolicName": "com.beanit.openiec61850",
instruction 'Export-Package', '!*.internal.*,*' "-exportcontents": "!*.internal.*,*",
instruction 'Import-Package', 'org.openmuc.jasn1.*,javax.net,*;resolution:=optional' "Import-Package": "com.beanit.jasn1.*,javax.net,*;resolution:=optional")
}
} }
sourceSets { sourceSets {
main { main {
java.srcDirs = ['src/main/java', 'src/main/java-gen'] java.srcDirs = ["src/main/java", "src/main/java-gen"]
} }
} }
@ -104,16 +93,14 @@ uploadArchives {
repositories { repositories {
mavenDeployer { mavenDeployer {
pom.project { pom.project {
name projectName name "OpenIEC61850"
packaging 'jar' description "OpenIEC61850 is a Java library implementing the IEC 61850 MMS communication standard for clients and servers."
description 'OpenIEC61850 is a library implementing the IEC 61850 MMS communication standard (client and server).'
url 'http://www.openmuc.org/'
licenses { licenses {
license { license {
name 'Apache License, Version 2.0' name "Apache License, Version 2.0"
url 'http://www.apache.org/licenses/LICENSE-2.0' url "http://www.apache.org/licenses/LICENSE-2.0"
distribution 'repo' distribution "repo"
} }
} }

@ -126,8 +126,7 @@ public final class DataSet implements Iterable<FcModelNode> {
int slash = dataSetReference.indexOf('/'); int slash = dataSetReference.indexOf('/');
String domainID = dataSetReference.substring(0, slash); String domainID = dataSetReference.substring(0, slash);
String itemID = String itemID = dataSetReference.substring(slash + 1).replace('.', '$');
dataSetReference.substring(slash + 1).replace('.', '$');
ObjectName.DomainSpecific domainSpecificObjectName = new ObjectName.DomainSpecific(); ObjectName.DomainSpecific domainSpecificObjectName = new ObjectName.DomainSpecific();
domainSpecificObjectName.setDomainID(new Identifier(domainID.getBytes())); domainSpecificObjectName.setDomainID(new Identifier(domainID.getBytes()));

@ -45,7 +45,6 @@ import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import javax.naming.ConfigurationException;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -112,8 +111,8 @@ public class ClientServerITest extends Thread implements ServerEventListener, Cl
@Test @Test
public void testClientServerCom() public void testClientServerCom()
throws IOException, ServiceError, javax.naming.ConfigurationException, throws IOException, ServiceError, javax.naming.ConfigurationException, SclParseException,
SclParseException, InterruptedException { InterruptedException {
clientSap.setTSelRemote(new byte[] {0, 1}); clientSap.setTSelRemote(new byte[] {0, 1});
clientSap.setTSelLocal(new byte[] {0, 0}); clientSap.setTSelLocal(new byte[] {0, 0});

@ -33,7 +33,6 @@ import java.net.InetAddress;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import javax.naming.ConfigurationException;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -100,8 +99,8 @@ public class ClientServerITest2 extends Thread implements ServerEventListener, C
@Test @Test
public void testClientServerCom() public void testClientServerCom()
throws IOException, ServiceError, javax.naming.ConfigurationException, throws IOException, ServiceError, javax.naming.ConfigurationException, SclParseException,
SclParseException, InterruptedException { InterruptedException {
clientSap.setTSelRemote(new byte[] {0, 1}); clientSap.setTSelRemote(new byte[] {0, 1});
clientSap.setTSelLocal(new byte[] {0, 0}); clientSap.setTSelLocal(new byte[] {0, 0});

@ -33,7 +33,6 @@ import com.beanit.openiec61850.ServiceError;
import com.beanit.openiec61850.Urcb; import com.beanit.openiec61850.Urcb;
import java.io.IOException; import java.io.IOException;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.junit.After; import org.junit.After;
@ -59,8 +58,7 @@ public class ReportingTest implements ClientEventListener {
private int reportCounter = 0; private int reportCounter = 0;
@Before @Before
public void startServerAndClient() public void startServerAndClient() throws SclParseException, IOException, ServiceError {
throws SclParseException, IOException, ServiceError {
startServer(); startServer();
startClient(); startClient();
} }

Loading…
Cancel
Save