@@ -5,154 +5,50 @@ plugins {
55 id ' com.github.jk1.dependency-license-report' version ' 1.12'
66}
77
8- apply from : " https://raw.githubusercontent.com/fortify-ps/gradle-helpers/master/version-helper.gradle"
9-
108group ' com.fortify.ssc.parser.owasp.dependencycheck'
119
12- apply plugin : ' java'
13- sourceCompatibility = 1.8
14-
1510ext {
16- versionRegex = ' (\\ d+)(\\ .\\ d+)*'
17- jacksonVersion = " 2.8.4"
11+ gradleHelpersLocation = " https://raw.githubusercontent.com/fortify-ps/gradle-helpers/master"
1812}
1913
20- licenseReport {
21- configurations = [' compileExport' ]
22- excludeOwnGroup = true
23- }
14+ apply from : " ${ gradleHelpersLocation} /repo-helper.gradle"
15+ apply from : " ${ gradleHelpersLocation} /junit-helper.gradle"
16+ apply from : " ${ gradleHelpersLocation} /version-helper.gradle"
2417
2518// Project and plugin version based on SCM information
2619version = getProjectVersionAsBetaOrRelease(true )
27- def downloadContainerName = getProjectVersionAsBetaOrRelease(false )
28- def sscPluginVersion = getProjectVersionAsPlainVersionNumber()
29-
30- repositories {
31- mavenCentral()
32- // repository with fortify artifacts
33- maven { url " http://dl.bintray.com/fortify/maven-public" }
34- // repository with fortify-ps releases
35- mavenLocal()
36- maven { url " https://dl.bintray.com/fortify-ps/maven" }
37- // repository with fortify-ps snapshots
38- maven { url " https://oss.jfrog.org/artifactory/oss-snapshot-local" }
20+ ext {
21+ sscParserPluginVersion = getProjectVersionAsPlainVersionNumber()
22+ bintrayDownloadContainerName = getProjectVersionAsBetaOrRelease(false )
23+ projectLicense = ' MIT'
3924}
4025
41- configurations {
42- compileExport
43- compile. extendsFrom (compileExport)
44- }
26+ apply from : " ${ gradleHelpersLocation} /ssc-parser-plugin-helper.gradle"
27+ apply from : " ${ gradleHelpersLocation} /dependency-sources-licenses-helper.gradle"
28+ apply from : " ${ gradleHelpersLocation} /bintray-binaries-helper.gradle"
29+
30+ apply plugin : ' java'
31+ sourceCompatibility = 1.8
4532
4633configurations. all {
4734 // Don't cache modules that may change (i.e. snapshots)
4835 resolutionStrategy. cacheChangingModulesFor 0 , ' seconds'
4936}
5037
51- test {
52- useJUnitPlatform()
53- }
54-
5538dependencies {
56- // dependencies provided by plugin runtime
57- compile ' com.fortify.plugin:plugin-api:1.0.1'
58- compile ' org.slf4j:slf4j-api:1.7.21'
59-
6039 compileExport(group : ' com.fortify.ssc.parser.util' , name : ' fortify-ssc-parser-util' , version :' 1.1.0-SNAPSHOT' , changing : true ) { transitive = true }
61-
62- // testImplementation 'org.junit.platform:junit-jupiter-api:5.3.1'
63-
64- testImplementation(group : ' org.junit.jupiter' , name : ' junit-jupiter-api' , version : ' 5.3.1' )
65- testImplementation(group : ' org.junit.platform' , name : ' junit-platform-launcher' , version : " 1.1.0" )
66- testRuntimeOnly(group : ' org.junit.jupiter' , name :' junit-jupiter-engine' , version : ' 5.3.1' )
67- testRuntimeOnly(group : ' org.slf4j' , name : ' slf4j-simple' , version : ' 1.6.1' )
68- }
69-
70- jar {
71- doFirst {
72- // check if version matches requirements
73- if (! sscPluginVersion. matches(versionRegex)) {
74- throw new InvalidUserDataException (" Plugin version '$sscPluginVersion ' does not match '$versionRegex '" )
75- }
76- }
77- // replace version placeholders in plugin.xml
78- filesMatching(' plugin.xml' ) {
79- filter {
80- it. replaceAll(' <!--VERSION-->.*?<!--/VERSION-->' , sscPluginVersion)
81- }
82- }
83- // include files from compileExport dependencies
84- from { configurations. compileExport. collect { it. isDirectory() ? it : zipTree(it). matching { exclude ' META-INF/*' } } }
8540}
8641
8742bintray {
88- user = System . getenv(' BINTRAY_USER' )
89- key = System . getenv(' BINTRAY_KEY' )
90- publish = true
91- pkg {
92- repo = ' binaries'
93- name = ' fortify-ssc-parser-owasp-dependency-check'
94- licenses = [' MIT' ]
95- vcsUrl = ' https://github.com/fortify-ps/fortify-ssc-parser-owasp-dependency-check.git'
96- userOrg = ' fortify-ps'
97- version {
98- name = downloadContainerName
99- vcsTag = downloadContainerName
100- }
101- }
10243 filesSpec {
103- from(" build/libs" ) {
44+ from(" build/libs" ) { // Plugin jar
10445 include " *.jar"
10546 }
106- from(" build/dist" ) {
47+ from(" build/dist" ) { // Dependency sources and licenses
10748 include " *.zip"
10849 }
10950 into ' .'
11051 }
11152}
112- _bintrayRecordingCopy. dependsOn ' build' , ' packageLicenseReport' , ' packageDependencySources'
113-
114- task packageLicenseReport (type : Zip ) {
115- dependsOn ' generateLicenseReport'
116- archiveFileName = " ${ rootProject.name} -${ project.version} -licenseReport.zip"
117- destinationDirectory = file(" $buildDir /dist" )
118-
119- from licenseReport. outputDir
120- }
121-
122- task downloadDependencySources {
123- inputs. files configurations. compileExport
124- outputs. dir " ${ buildDir} /dependencySources"
125- doLast {
126- def componentIds = configurations. runtime. incoming. resolutionResult. allDependencies. collect { it. selected. id }
127- ArtifactResolutionResult result = dependencies. createArtifactResolutionQuery()
128- .forComponents(componentIds)
129- .withArtifacts(JvmLibrary , SourcesArtifact )
130- .execute()
131- def sourceArtifacts = []
132- result. resolvedComponents. each { ComponentArtifactsResult component ->
133- Set<ArtifactResult > sources = component. getArtifacts(SourcesArtifact )
134- println " Found ${ sources.size()} sources for ${ component.id} "
135- sources. each { ArtifactResult ar ->
136- if (ar instanceof ResolvedArtifactResult ) {
137- sourceArtifacts << ar. file
138- }
139- }
140- }
141-
142- copy {
143- from configurations. runtime
144- from sourceArtifacts
145- into " ${ buildDir} /dependencySources"
146- }
147- }
148- }
149-
150- task packageDependencySources (type : Zip ) {
151- dependsOn ' downloadDependencySources'
152- archiveFileName = " ${ rootProject.name} -${ project.version} -dependencySources.zip"
153- destinationDirectory = file(" $buildDir /dist" )
154-
155- from " ${ buildDir} /dependencySources"
156- }
157-
53+ _bintrayRecordingCopy. dependsOn ' build' , ' packageDependencySourcesAndLicenses'
15854
0 commit comments