2019-08-07 12:39:35 +02:00
|
|
|
import java.util.regex.Matcher
|
|
|
|
import java.util.regex.Pattern
|
|
|
|
|
|
|
|
Pattern PLUGIN_NAME_PATTERN = Pattern.compile("(sonar-.*-plugin)(.*)")
|
|
|
|
|
|
|
|
|
2018-06-21 09:28:15 +02:00
|
|
|
/**
|
|
|
|
* This module is building the zip file containing the static web site
|
|
|
|
*/
|
|
|
|
|
|
|
|
sonarqube {
|
|
|
|
skipProject = true
|
|
|
|
}
|
|
|
|
|
2018-07-06 11:06:57 +02:00
|
|
|
group = 'com.sonarsource.sonarqube'
|
2018-06-28 16:12:32 +02:00
|
|
|
|
2019-08-07 12:39:35 +02:00
|
|
|
configurations {
|
2019-11-06 17:01:34 +01:00
|
|
|
bundledPlugin {
|
|
|
|
transitive = false
|
|
|
|
}
|
2019-08-07 12:39:35 +02:00
|
|
|
}
|
|
|
|
|
2019-11-06 17:01:34 +01:00
|
|
|
// loads the bundled_plugins.gradle of each edition
|
|
|
|
// (they will all add there own bundled plugins to the bundledPlugin dependency configuration)
|
|
|
|
apply from: new File(rootDir, 'sonar-application/bundled_plugins.gradle')
|
|
|
|
File closeSourceDir = new File(rootDir, 'private');
|
|
|
|
if (closeSourceDir.exists()) {
|
|
|
|
apply from: new File(closeSourceDir, 'edition-developer/bundled_plugins.gradle')
|
|
|
|
apply from: new File(closeSourceDir, 'edition-enterprise/bundled_plugins.gradle')
|
|
|
|
apply from: new File(closeSourceDir, 'edition-datacenter/bundled_plugins.gradle')
|
2019-08-07 12:39:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
task extractAnalyzerDocFiles {
|
|
|
|
doLast {
|
2019-11-06 17:01:34 +01:00
|
|
|
configurations.bundledPlugin.files.each {
|
2019-08-07 12:39:35 +02:00
|
|
|
File file = it
|
|
|
|
copy {
|
2020-09-08 12:51:53 +02:00
|
|
|
from(zipTree(file).matching { include 'static/documentation.md', 'META-INF/MANIFEST.MF' }) {
|
2019-08-07 12:39:35 +02:00
|
|
|
eachFile { fcd ->
|
2020-09-08 12:51:53 +02:00
|
|
|
if (fcd.getName().endsWith('.md')) {
|
|
|
|
fcd.relativePath = new RelativePath(true, 'documentation' + '.md')
|
|
|
|
} else {
|
|
|
|
fcd.relativePath = new RelativePath(true, 'MANIFEST' + '.MF')
|
2019-08-07 12:39:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
includeEmptyDirs = false
|
|
|
|
}
|
2020-09-08 12:51:53 +02:00
|
|
|
Matcher m = PLUGIN_NAME_PATTERN.matcher(file.getName())
|
|
|
|
if (m.find()) {
|
|
|
|
into "$buildDir/tmp/plugin-documentation/" + m.group(1)
|
|
|
|
}
|
|
|
|
|
2019-08-07 12:39:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-29 09:47:37 +02:00
|
|
|
task yarn_run(type: Exec) {
|
2019-06-11 10:01:07 +02:00
|
|
|
def docsVersion = version.split("[.-]").take(2).join('.')
|
|
|
|
inputs.property('version', docsVersion)
|
2021-11-16 15:00:40 +01:00
|
|
|
inputs.file(rootProject.file('build.gradle'));
|
2018-06-21 09:28:15 +02:00
|
|
|
inputs.dir('src').withPathSensitivity(PathSensitivity.RELATIVE)
|
2021-11-23 15:05:26 +01:00
|
|
|
['build.gradle', 'gatsby-config.js', 'gatsby-node.js', 'package.json', 'yarn.lock', 'tsconfig.json'].each {
|
2018-08-21 17:16:06 +02:00
|
|
|
inputs.file(it).withPathSensitivity(PathSensitivity.RELATIVE)
|
|
|
|
}
|
2018-06-21 09:28:15 +02:00
|
|
|
outputs.dir('public')
|
|
|
|
outputs.cacheIf { true }
|
2021-09-29 09:47:37 +02:00
|
|
|
|
2022-06-30 08:43:11 +02:00
|
|
|
environment += [ GATSBY_DOCS_VERSION: docsVersion, GATSBY_TELEMETRY_DISABLED: 1 ]
|
2021-10-01 09:57:26 +02:00
|
|
|
commandLine osAdaptiveCommand(['npm', 'run', 'build'])
|
2018-06-21 09:28:15 +02:00
|
|
|
}
|
2021-11-23 15:05:26 +01:00
|
|
|
yarn_run.dependsOn(extractAnalyzerDocFiles)
|
2021-09-29 09:47:37 +02:00
|
|
|
build.dependsOn(yarn_run)
|
|
|
|
|
2019-06-25 16:13:16 +02:00
|
|
|
// To clean outputs outside of "build" directory:
|
|
|
|
clean.dependsOn(cleanYarn_run)
|
2018-06-21 09:28:15 +02:00
|
|
|
|
2021-10-06 17:33:48 +02:00
|
|
|
task "yarn_check-ci"(type: Exec) {
|
2021-01-18 11:52:49 +01:00
|
|
|
// Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
|
|
|
|
['config', 'src'].each {
|
|
|
|
inputs.dir(it)
|
|
|
|
}
|
|
|
|
['package.json', 'yarn.lock', 'tsconfig.json'].each {
|
|
|
|
inputs.file(it)
|
|
|
|
}
|
|
|
|
|
2021-10-01 09:57:26 +02:00
|
|
|
commandLine osAdaptiveCommand(['npm', 'run', 'check-ci'])
|
2021-01-18 11:52:49 +01:00
|
|
|
}
|
|
|
|
|
2021-10-06 17:33:48 +02:00
|
|
|
task "yarn_validate-ci"(type: Exec) {
|
2019-05-15 17:21:37 +02:00
|
|
|
// Note that outputs are not relocatable, because contain absolute paths, and that's why inputs are not relativized
|
|
|
|
['config', 'src'].each {
|
|
|
|
inputs.dir(it)
|
|
|
|
}
|
|
|
|
['package.json', 'yarn.lock', 'tsconfig.json', '.eslintrc'].each {
|
|
|
|
inputs.file(it)
|
|
|
|
}
|
|
|
|
outputs.cacheIf { true }
|
2019-05-16 14:54:03 +02:00
|
|
|
|
2021-10-01 09:57:26 +02:00
|
|
|
commandLine osAdaptiveCommand(['npm', 'run', 'validate-ci'])
|
2018-08-29 10:25:32 +02:00
|
|
|
}
|
|
|
|
|
2018-06-21 09:28:15 +02:00
|
|
|
task zip(type: Zip) {
|
2018-10-15 18:07:26 +02:00
|
|
|
def archiveDir = "$version"
|
2018-06-21 09:28:15 +02:00
|
|
|
duplicatesStrategy DuplicatesStrategy.EXCLUDE
|
|
|
|
baseName "sonar-docs"
|
|
|
|
|
|
|
|
into("${archiveDir}") {
|
|
|
|
from tasks.getByName('yarn_run').outputs
|
|
|
|
}
|
|
|
|
}
|
|
|
|
zip.dependsOn yarn_run
|
2021-11-23 15:05:26 +01:00
|
|
|
assemble.dependsOn zip
|
2018-06-21 09:28:15 +02:00
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
docs(MavenPublication) {
|
|
|
|
artifactId 'sonar-docs'
|
|
|
|
artifact zip
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
artifactory {
|
|
|
|
publish {
|
|
|
|
repository {
|
|
|
|
repoKey = System.getenv('ARTIFACTORY_DEPLOY_REPO_PRIVATE')
|
2021-04-28 09:17:43 +02:00
|
|
|
username = System.getenv('ARTIFACTORY_DEPLOY_USERNAME') ?: project.properties.artifactoryUsername
|
|
|
|
password = System.getenv('ARTIFACTORY_DEPLOY_PASSWORD') ?: project.properties.artifactoryPaswword
|
2020-04-02 12:12:28 +02:00
|
|
|
}
|
|
|
|
defaults {
|
|
|
|
properties = [
|
|
|
|
'build.name' : 'sonar-enterprise',
|
|
|
|
'build.number' : System.getenv('BUILD_NUMBER'),
|
|
|
|
'pr.branch.target': System.getenv('GITHUB_BASE_BRANCH'),
|
|
|
|
'pr.number' : System.getenv('PULL_REQUEST'),
|
|
|
|
'vcs.branch' : System.getenv('GITHUB_BRANCH'),
|
|
|
|
'vcs.revision' : System.getenv('GIT_SHA1'),
|
|
|
|
'version' : version
|
|
|
|
]
|
|
|
|
publishPom = true
|
|
|
|
publishIvy = false
|
2018-06-21 09:28:15 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
artifactoryPublish {
|
|
|
|
skip = false
|
|
|
|
publishPom = false
|
|
|
|
publications(publishing.publications.docs)
|
|
|
|
}
|
2020-01-06 14:49:40 +01:00
|
|
|
|
|
|
|
def sources = fileTree(dir: "src") + fileTree(dir: "config") + fileTree(dir: "plugins") + file("gatsby-config.js") + file("gatsby-node.js")
|
|
|
|
|
|
|
|
task licenseCheckWeb(type: com.hierynomus.gradle.license.tasks.LicenseCheck) {
|
|
|
|
source = sources
|
|
|
|
}
|
|
|
|
licenseMain.dependsOn licenseCheckWeb
|
|
|
|
|
|
|
|
task licenseFormatWeb(type: com.hierynomus.gradle.license.tasks.LicenseFormat) {
|
|
|
|
source = sources
|
|
|
|
}
|
|
|
|
licenseFormat.dependsOn licenseFormatWeb
|