@@ -106,27 +106,51 @@ allprojects {
106106 repositories {
107107 mavenLocal()
108108 }
109+
110+ tasks. withType(GenerateModuleMetadata ) {
111+ enabled = false
112+ }
113+
114+ tasks. withType(JavaCompile ) {
115+ options. encoding = ' UTF-8'
116+ }
109117}
110118
111- idea {
112- project {
113- jdkName sourceCompatibility
114- languageLevel sourceCompatibility
119+ profiles {
120+ profile(' sbom' ) {
121+ activation {
122+ property {
123+ key = ' sbom'
124+ value = true
125+ }
126+ }
127+ action {
128+ println ' SBOM generation is turned ON'
129+
130+ gradleProjects {
131+ subprojects {
132+ dirs([' subprojects' ]) {
133+ cyclonedxBom {
134+ includeConfigs = [' runtimeClasspath' ]
135+ projectType = ' library'
136+ outputName = " ${ project.name} -${ project.version} -cyclonedx" . toString()
137+ destination = file(' build/reports/cyclonedx' )
138+ includeLicenseText = false
139+ }
115140
116- ipr {
117- withXml { provider ->
118- def node = provider. asNode()
119- node. component. find { it. ' @name' == ' VcsDirectoryMappings' }?. mapping[0 ]. ' @vcs' = ' Git'
141+ publishing {
142+ publications {
143+ main(MavenPublication ) {
144+ artifact classifier : ' cyclonedx' , source : new File (cyclonedxBom. destination. get(), cyclonedxBom. outputName. get() + ' .xml' )
145+ artifact classifier : ' cyclonedx' , source : new File (cyclonedxBom. destination. get(), cyclonedxBom. outputName. get() + ' .json' )
146+ }
147+ }
148+ }
120149
121- def compilerConfiguration = node. component. find { it. ' @name' == ' CompilerConfiguration' }
122- compilerConfiguration. remove(compilerConfiguration. annotationProcessing)
123- compilerConfiguration. append(new XmlParser (). parseText("""
124- <annotationProcessing>
125- <profile default="true" name="Default" enabled="true">
126- <processorPath useClasspath="true" />
127- </profile>
128- </annotationProcessing>""" ))
150+ project. generatePomFileForMainPublication. dependsOn(cyclonedxBom)
151+ }
152+ }
129153 }
130154 }
131155 }
132- }
156+ }
0 commit comments