|
| 1 | +buildscript { |
| 2 | + project.ext['CERN_VM'] = System.getProperty('CERN_TECHNET_VM') ?: System.getenv('CERN_TECHNET_VM') ?: project.hasProperty('CERN_TECHNET_VM') ?: false |
| 3 | + project.ext['DEPLOYMENT'] = System.getProperty('DEPLOYMENT') ?: false |
| 4 | + |
| 5 | + repositories { |
| 6 | + if (project['CERN_VM']) { |
| 7 | + maven { url 'http://artifactory.cern.ch/ds-jcenter' } |
| 8 | + maven { url 'http://artifactory.cern.ch/development' } |
| 9 | + maven { url 'http://artifactory.cern.ch/gradle-plugins' } |
| 10 | + } else { |
| 11 | + gradlePluginPortal() |
| 12 | + } |
| 13 | + } |
| 14 | + |
| 15 | + dependencies { |
| 16 | + classpath 'com.github.jk1:gradle-license-report:1.5' |
| 17 | + classpath 'io.github.gradle-nexus:publish-plugin:1.0.0' |
| 18 | + classpath 'biz.aQute.bnd:biz.aQute.bnd.gradle:5.1.2' // OSGi |
| 19 | + classpath 'biz.aQute.bnd:biz.aQute.bndlib:5.1.2' // OSGi |
| 20 | + } |
| 21 | +} |
| 22 | + |
| 23 | +apply plugin: 'java' |
| 24 | +apply plugin: 'jacoco' |
| 25 | +apply plugin: 'idea' |
| 26 | +apply plugin: 'eclipse' |
| 27 | +apply plugin: 'biz.aQute.bnd.builder' // OSGi |
| 28 | + |
| 29 | +group = project['POM.groupId'] |
| 30 | + |
| 31 | +repositories { |
| 32 | + if (project['CERN_VM']) { |
| 33 | + maven { url 'http://artifactory.cern.ch/ds-jcenter' } |
| 34 | + maven { url 'http://artifactory.cern.ch/development' } |
| 35 | + } else { |
| 36 | + mavenCentral() |
| 37 | + } |
| 38 | +} |
| 39 | + |
| 40 | +dependencies { |
| 41 | + implementation group: 'org.tensorics', name: 'tensorics-core', version: '0.29.0' |
| 42 | + implementation group: 'com.google.code.gson', name:'gson', version: '2.9.1' |
| 43 | + |
| 44 | + testCompile group: 'junit', name: 'junit', version: '4.12' |
| 45 | + testCompile group: 'org.assertj', name: 'assertj-core', version: '3.17.2' |
| 46 | + testCompile group: 'org.mockito', name: 'mockito-core', version: '2.23.0' |
| 47 | +} |
| 48 | + |
| 49 | +wrapper { |
| 50 | + gradleVersion = '5.4.1' |
| 51 | + distributionType = Wrapper.DistributionType.ALL |
| 52 | +} |
| 53 | + |
| 54 | +jar { |
| 55 | + // OSGi |
| 56 | + bnd([ |
| 57 | + 'Bundle-Vendor' : 'ossgang', |
| 58 | + '-exportcontents': '*', |
| 59 | + '-buildpath' : '' // no dependencies |
| 60 | + ]) |
| 61 | +} |
| 62 | + |
| 63 | +test { |
| 64 | + testLogging { |
| 65 | + events "passed", "skipped", "failed" |
| 66 | + exceptionFormat "full" |
| 67 | + } |
| 68 | +} |
| 69 | + |
| 70 | +jacoco { |
| 71 | + toolVersion = "0.8.3" |
| 72 | +} |
| 73 | + |
| 74 | +jacocoTestReport { |
| 75 | + reports { |
| 76 | + xml.enabled true |
| 77 | + xml.destination file("$buildDir/reports/jacoco/report.xml") |
| 78 | + html.enabled true |
| 79 | + csv.enabled false |
| 80 | + } |
| 81 | +} |
| 82 | + |
| 83 | +javadoc { options.encoding = "UTF-8" } |
| 84 | + |
| 85 | +if (!project.tasks.findByName("javadocJar")) { |
| 86 | + task javadocJar(type: Jar) { |
| 87 | + classifier = 'javadoc' |
| 88 | + from javadoc |
| 89 | + } |
| 90 | +} |
| 91 | + |
| 92 | +if (!project.tasks.findByName("sourcesJar")) { |
| 93 | + task sourcesJar(type: Jar) { |
| 94 | + classifier = 'sources' |
| 95 | + from sourceSets.main.allSource |
| 96 | + } |
| 97 | +} |
| 98 | + |
| 99 | +eclipse { |
| 100 | + classpath { |
| 101 | + downloadJavadoc = true |
| 102 | + downloadSources = true |
| 103 | + } |
| 104 | +} |
| 105 | + |
| 106 | +idea { |
| 107 | + module { |
| 108 | + downloadJavadoc = true |
| 109 | + downloadSources = true |
| 110 | + } |
| 111 | +} |
| 112 | + |
| 113 | +if (!project['CERN_VM']) { |
| 114 | + println 'Applying licensing report' |
| 115 | + apply plugin: 'com.github.jk1.dependency-license-report' |
| 116 | + |
| 117 | + licenseReport { |
| 118 | + renderers = [this.class.classLoader.loadClass('com.github.jk1.license.render.InventoryHtmlReportRenderer').newInstance()] |
| 119 | + filters = [this.class.classLoader.loadClass('com.github.jk1.license.filter.LicenseBundleNormalizer').newInstance()] |
| 120 | + } |
| 121 | +} |
| 122 | + |
| 123 | +if (project['DEPLOYMENT']) { |
| 124 | + println 'Applying deployment scripts' |
| 125 | + apply from: 'https://raw.githubusercontent.com/ossgang/gradle-scripts/master/deployment/deploy-to-maven-central.gradle' |
| 126 | +} |
0 commit comments