Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions build-tools/build-infra/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ rootProject.name = 'build-infra'

// Use project's version catalog for centralized dependency management
dependencyResolutionManagement {
versionCatalogs {
libs {
from(files("../../gradle/libs.versions.toml"))
}
versionCatalogs {
libs {
from(files("../../gradle/libs.versions.toml"))
}
}
}
8 changes: 4 additions & 4 deletions build-tools/missing-doclet/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ rootProject.name = "missing-doclet"

// Use project's version catalog for centralized dependency management
dependencyResolutionManagement {
versionCatalogs {
libs {
from(files("../../gradle/libs.versions.toml"))
}
versionCatalogs {
libs {
from(files("../../gradle/libs.versions.toml"))
}
}
}
23 changes: 15 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ rootProject.ext.minJavaVersionDefault = JavaVersion.toVersion(libs.versions.java
rootProject.ext.minJavaVersionSolrJ = JavaVersion.toVersion(libs.versions.java.solrj.get())

// Check development mode for entire project (defaults to true if 'production' not provided and set to true)
rootProject.ext.development = !project.hasProperty('production') || project.findProperty('production') != 'true'
rootProject.ext.development =
!project.hasProperty('production') || project.findProperty('production') != 'true'

apply from: file('gradle/globals.gradle')

Expand All @@ -54,10 +55,10 @@ version = {

// On a release explicitly set release version in one go:
// -Dversion.release=x.y.z

// Jenkins can just set just a suffix, overriding SNAPSHOT, e.g. using build id:
// -Dversion.suffix=jenkins123

String versionSuffix = propertyOrDefault('version.suffix', 'SNAPSHOT')
String v = propertyOrDefault('version.release', "${baseVersion}-${versionSuffix}")
if (v.endsWith("-")) {
Expand All @@ -73,7 +74,7 @@ allprojects {

gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "1000"
options.compilerArgs << "-Xmaxerrs" << "1000"
}
}
}
Expand Down Expand Up @@ -105,13 +106,13 @@ ext {
buildYear = DateTimeFormatter.ofPattern("yyyy").format(tstamp)

// Allow definiting external tool locations using system props.
externalTool = { name ->
externalTool = {name ->
def resolved = propertyOrDefault("${name}.exe", name as String)
logger.info("External tool '${name}' resolved to: ${resolved}")
return resolved
}
luceneBaseVersionProvider = project.provider {

luceneBaseVersionProvider = project.provider {
def luceneVersion = libs.versions.apache.lucene.get()
def m = (luceneVersion =~ /^\d+\.\d+\.\d+\b/)
if (!m) {
Expand All @@ -123,7 +124,13 @@ ext {
}

// For testing code
vectorIncubatorJavaVersions = [ JavaVersion.VERSION_21, JavaVersion.VERSION_22, JavaVersion.VERSION_23, JavaVersion.VERSION_24, JavaVersion.VERSION_25 ] as Set
vectorIncubatorJavaVersions = [
JavaVersion.VERSION_21,
JavaVersion.VERSION_22,
JavaVersion.VERSION_23,
JavaVersion.VERSION_24,
JavaVersion.VERSION_25
] as Set

// Use gradle flag in root project for further referencing
withUiModule = gradle.ext.withUiModule
Expand Down
16 changes: 8 additions & 8 deletions gradle/conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@
*/

configure(allprojects) {
tasks.register("tidy").configure {
description "Applies formatters and cleanups to sources."
group "verification"
}
tasks.register("tidy").configure {
description "Applies formatters and cleanups to sources."
group "verification"
}
}

// Locate script-relative resource folder. This is context-sensitive so pass
// the right buildscript (top-level).
configure(rootProject) {
ext {
scriptResources = { buildscript ->
return file(buildscript.sourceFile.absolutePath.replaceAll('.gradle$', ""))
}
ext {
scriptResources = {buildscript ->
return file(buildscript.sourceFile.absolutePath.replaceAll('.gradle$', ""))
}
}
}
62 changes: 31 additions & 31 deletions gradle/develocity.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,49 @@
*/

// see globals.gradle
def isCIBuild = System.getenv().keySet().any { it ==~ /(?i)((JENKINS|HUDSON)(_\w+)?|CI)/ }
def isCIBuild = System.getenv().keySet().any {it ==~ /(?i)((JENKINS|HUDSON)(_\w+)?|CI)/}

// https://docs.gradle.com/enterprise/gradle-plugin/

develocity {
server = "https://develocity.apache.org"
projectId = "solr"
server = "https://develocity.apache.org"
projectId = "solr"

buildScan {
uploadInBackground = !isCIBuild
buildScan {
uploadInBackground = !isCIBuild

publishing.onlyIf { it.authenticated }
obfuscation {
ipAddresses { addresses -> addresses.collect { address -> "0.0.0.0"} }
}
publishing.onlyIf {it.authenticated}
obfuscation {
ipAddresses {addresses -> addresses.collect {address -> "0.0.0.0"}}
}

tag("JDK" + System.getProperty("java.version").find(/\d+/)) // major version
value("Java Vendor", System.getProperty("java.vendor"))
value("Java Version", System.getProperty("java.version"))
tag("JDK" + System.getProperty("java.version").find(/\d+/)) // major version
value("Java Vendor", System.getProperty("java.vendor"))
value("Java Version", System.getProperty("java.version"))

// Jenkins job name, less redundant "Solr" parts
String jenkinsJobName = System.getenv("JOB_NAME")
if (jenkinsJobName) { // looks like "Solr/Solr-Smoketest-9.5"
tag(jenkinsJobName.replaceAll(/Solr\W/,"")) // like "Smoketest-9.5"
}
// Jenkins job name, less redundant "Solr" parts
String jenkinsJobName = System.getenv("JOB_NAME")
if (jenkinsJobName) { // looks like "Solr/Solr-Smoketest-9.5"
tag(jenkinsJobName.replaceAll(/Solr\W/, "")) // like "Smoketest-9.5"
}

// https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
if (System.getenv("GITHUB_BASE_REF")) { // only exists for PRs
tag("PR")
}
String ghWorkflowName = System.getenv("GITHUB_WORKFLOW")
if (ghWorkflowName) {
tag(ghWorkflowName)
}
// https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
if (System.getenv("GITHUB_BASE_REF")) { // only exists for PRs
tag("PR")
}
String ghWorkflowName = System.getenv("GITHUB_WORKFLOW")
if (ghWorkflowName) {
tag(ghWorkflowName)
}
}
}

buildCache {
local {
enabled = !isCIBuild
}
local {
enabled = !isCIBuild
}

remote(develocity.buildCache) {
enabled = false
}
remote(develocity.buildCache) {
enabled = false
}
}
14 changes: 7 additions & 7 deletions gradle/documentation/changes-to-html.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ChangesToHtmlTask extends DefaultTask {

@OutputDirectory
final DirectoryProperty targetDir = project.objects.directoryProperty()
.fileProvider(project.providers.provider { project.file("${project.docroot}/changes") })
.fileProvider(project.providers.provider {project.file("${project.docroot}/changes")})

@InputFile
def script
Expand All @@ -63,8 +63,8 @@ class ChangesToHtmlTask extends DefaultTask {

// Check if Python is available
if (!pythonExists()) {
logger.warn("WARNING: Python is not installed, skipping creating Changes.html")
return
logger.warn("WARNING: Python is not installed, skipping creating Changes.html")
return
}

def result = project.exec {
Expand Down Expand Up @@ -101,11 +101,11 @@ class ChangesToHtmlTask extends DefaultTask {

def pythonExists() {
try {
def process = "python3 --version".execute()
process.waitFor()
return process.exitValue() == 0
def process = "python3 --version".execute()
process.waitFor()
return process.exitValue() == 0
} catch (Exception e) {
return false
return false
}
}
}
20 changes: 12 additions & 8 deletions gradle/documentation/documentation.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ configure(rootProject) {
}
}())

solrRefguideUrl = project.propertyOrDefault('solr.refguide.url', "https://solr.apache.org/guide/solr/${refguideUrlVersion}")
solrRefguideUrl =
project.propertyOrDefault('solr.refguide.url',
"https://solr.apache.org/guide/solr/${refguideUrlVersion}")
}

task documentation() {
Expand All @@ -65,27 +67,27 @@ configure(project(':solr:documentation')) {
group = 'documentation'
description = "Generate ${project.name.capitalize()} documentation"

dependsOn project.parent.subprojects.collect { prj ->
prj.tasks.matching { it.name == 'renderSiteJavadoc' }
dependsOn project.parent.subprojects.collect {prj ->
prj.tasks.matching {it.name == 'renderSiteJavadoc'}
}
dependsOn 'changesToHtml','copyDocumentationAssets',
'markdownToHtml','createDocumentationIndex'
dependsOn 'changesToHtml', 'copyDocumentationAssets',
'markdownToHtml', 'createDocumentationIndex'
}

task copyDocumentationAssets(type: Copy) {
includeEmptyDirs = false
from(project.assets)
into project.docroot
}

assemble {
dependsOn documentation
}

configurations {
site
}

artifacts {
site project.docroot, {
builtBy documentation
Expand All @@ -95,7 +97,9 @@ configure(project(':solr:documentation')) {
task documentationMinimal() {
group = 'documentation'
description = "Generate stub Solr documentation pointing to web page (that's part of Solr TGZ)"
dependsOn 'copyMiniDocumentationAssets', 'createMiniDocumentationIndex', 'copyChangesToHtmlForMiniSite'
dependsOn 'copyMiniDocumentationAssets',
'createMiniDocumentationIndex',
'copyChangesToHtmlForMiniSite'
}

task copyChangesToHtmlForMiniSite(type: Copy) {
Expand Down
40 changes: 21 additions & 19 deletions gradle/documentation/markdown.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ buildscript {
configure(project(':solr:documentation')) {
task markdownToHtml(type: Copy) {
dependsOn copyDocumentationAssets

filteringCharset = 'UTF-8'
includeEmptyDirs = false
into project.docroot
Expand Down Expand Up @@ -93,27 +93,28 @@ class MarkdownFilter extends FilterReader {
// converts it and provides result downstream as a StringReader
super(new StringReader(convert(reader.text)));
}

public static String convert(String markdownSource) {
// first replace LUCENE and SOLR issue numbers with a markdown link
markdownSource = markdownSource.replaceAll(/(?s)\b(LUCENE|SOLR)\-\d+\b/,
'[$0](https://issues.apache.org/jira/browse/$0)');
'[$0](https://issues.apache.org/jira/browse/$0)');

// convert the markdown
MutableDataSet options = new MutableDataSet();
options.setFrom(ParserEmulationProfile.MARKDOWN);
options.set(Parser.EXTENSIONS, [ AbbreviationExtension.create(), AutolinkExtension.create(), AttributesExtension.create() ]);
options.set(Parser.EXTENSIONS,
[AbbreviationExtension.create(), AutolinkExtension.create(), AttributesExtension.create()]);
options.set(HtmlRenderer.RENDER_HEADER_ID, true);
options.set(HtmlRenderer.MAX_TRAILING_BLANK_LINES, 0);
Document parsed = Parser.builder(options).build().parse(markdownSource);

StringBuilder html = new StringBuilder('<html>\n<head>\n');
CharSequence title = parsed.getFirstChildAny(Heading.class)?.getText();
CharSequence title = parsed.getFirstChildAny(Heading.class)?.getText();
if (title != null) {
html.append('<title>').append(Escaping.escapeHtml(title, false)).append('</title>\n');
}
html.append('<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n')
.append('</head>\n<body>\n');
.append('</head>\n<body>\n');
HtmlRenderer.builder(options).build().render(parsed, html);
html.append('</body>\n</html>\n');
return html;
Expand All @@ -132,21 +133,22 @@ class MarkdownTemplateTask extends DefaultTask {

@OutputFile
File outputFile

@Input
@Optional
final MapProperty<String,Object> binding = project.objects.mapProperty(String, Object)
final MapProperty<String, Object> binding = project.objects.mapProperty(String, Object)

/** adds a property "projectList" containing all subprojects with javadocs as markdown bullet list */
void withProjectList() {
binding.put('projectList', project.providers.provider{
def projects = productProject.subprojects.findAll{ it.tasks.findByName('renderSiteJavadoc')?.enabled }
.sort(false, Comparator.comparing{ (it.name != 'core') as Boolean }
.thenComparing(Comparator.comparing{ (! it.name.startsWith('solrj')) as Boolean })
.thenComparing(Comparator.comparing{ (it.name == 'test-framework') as Boolean })
.thenComparing(Comparator.comparing{ it.path }));
return projects.collect{ project ->
def text = "**[${project.relativeDocPath.replace('/','-')}](${project.relativeDocPath}/index.html):** ${project.description}"
binding.put('projectList', project.providers.provider {
def projects = productProject
.subprojects.findAll {it.tasks.findByName('renderSiteJavadoc')?.enabled}
.sort(false, Comparator.comparing {(it.name != 'core') as Boolean}
.thenComparing(Comparator.comparing {(!it.name.startsWith('solrj')) as Boolean})
.thenComparing(Comparator.comparing {(it.name == 'test-framework') as Boolean})
.thenComparing(Comparator.comparing {it.path}));
return projects.collect {project ->
def text = "**[${project.relativeDocPath.replace('/', '-')}](${project.relativeDocPath}/index.html):** ${project.description}"
if (project.name == 'core') {
text = text.concat(' {style="font-size:larger; margin-bottom:.5em"}')
}
Expand All @@ -159,7 +161,7 @@ class MarkdownTemplateTask extends DefaultTask {
void transform() {
def engine = new SimpleTemplateEngine();
def resolvedBinding = binding.get() + [
project : project
project: project
]
String markdown = templateFile.withReader('UTF-8') {
engine.createTemplate(it).make(resolvedBinding).toString();
Expand Down
Loading
Loading