You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2023/09/19 09:27:49 UTC
[logging-parent] 07/07: Add `bootstrap` profile
This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-parent.git
commit a30ed931d9cbe9387333d3ddf0c5d0ccaca65342
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Tue Sep 19 11:22:37 2023 +0200
Add `bootstrap` profile
---
.asf.yaml | 2 +-
README.adoc | 49 +-------
.asf.yaml => antora-playbook.yaml | 34 ++---
pom.xml | 140 ++++++++++++++++++++-
src/antora/antora.tmpl.yml | 44 +++++++
src/antora/antora.yml | 44 +++++++
src/antora/modules/ROOT/nav.adoc | 19 +++
src/antora/modules/ROOT/pages/index.adoc | 75 +++++++++++
...ies-adoc-profile.xml => add-antora-profile.xml} | 2 +-
...-adoc-profile.xml => add-bootstrap-profile.xml} | 2 +-
src/changelog/.changelog.adoc.ftl | 2 +-
src/changelog/.index.adoc.ftl | 2 +-
12 files changed, 339 insertions(+), 76 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
index 59882d5..1d51505 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -20,7 +20,7 @@
github:
description: Parent project internally used in Maven-based projects of the Apache Logging Services
- homepage: https://logging.apache.org
+ homepage: https://logging.apache.org/logging-parent
labels:
- apache
- java
diff --git a/README.adoc b/README.adoc
index c40821a..5307275 100644
--- a/README.adoc
+++ b/README.adoc
@@ -28,54 +28,7 @@ You can build using `./mvnw verify` command.
== Usage
-You can use this project as follows:
-
-. Add `org.apache.logging:logging-parent` as a `parent` to your `pom.xml`
-.. Check if `./mvnw verify` succeeds, otherwise make necessary changes
-. Copy and adapt following files:
-.. xref:src/changelog/.10.x.x/.release-notes.adoc.ftl[] (adapt the folder name to match your project; `.2.x.x`, `.3.x.x`, etc.)
-.. xref:src/changelog/.changelog.adoc.ftl[]
-.. xref:src/changelog/.index.adoc.ftl[]
-.. xref:.github/workflows/build.yaml[]
-.. xref:.github/generate-email.sh[]
-.. xref:LICENSE.txt[]
-.. xref:NOTICE.txt[]
-.. xref:README.adoc[] (you can reuse _Distribution_, _Support_, _Security_, and _License_ sections as is)
-.. xref:RELEASE-NOTES.adoc[]
-.. xref:RELEASING.adoc[]
-.. xref:.mvn/jvm.config[] (run `mvn wrapper:wrapper` beforehand)
-
-== Features
-
-This project aims to deliver the following features.
-
-=== Parent POM
-
-The provided parent POM features the following conveniences:
-
-* https://creadur.apache.org/rat[`apache-rat-plugin`] integration for license preamble verification
-* https://github.com/apache/logging-log4j-tools/tree/main/log4j-changelog-maven-plugin[`log4j-changelog-maven-plugin`] integration for changelog and release note management
-* https://maven.apache.org/enforcer/maven-enforcer-plugin/[`maven-enforcer-plugin`] checks
-* https://github.com/diffplug/spotless/tree/main/plugin-maven[`spotless-maven-plugin`] integration for code formatting
-
-=== Reusable GitHub Actions workflows
-
-The provided reusable GitHub Actions workflows feature the following conveniences:
-
-xref:.github/workflows/build-reusable.yaml[`build-reusable.yaml`]::
-* Compiles against Java 8 bytecode using the specified Java compiler version
-* Verifies reproducibility
-* Automatically merges verified `dependabot` PRs
-
-xref:.github/workflows/deploy-snapshot-reusable.yaml[`deploy-snapshot-reusable.yaml`]::
-* Deploys SNAPSHOT artifacts
-
-xref:.github/workflows/deploy-release-reusable.yaml[`deploy-release-reusable.yaml`]::
-* Deploys release artifacts
-* Generates the release notes
-* Generates the distribution ZIP containing Git-tracked sources, release notes, binary attachments, `NOTICE.txt`, etc.
-* Generates the release vote & announcement emails
-* Uploads the distribution ZIP and emails to SVN
+See https://logging.apache.org/logging-parent[the website].
== Distribution
diff --git a/.asf.yaml b/antora-playbook.yaml
similarity index 62%
copy from .asf.yaml
copy to antora-playbook.yaml
index 59882d5..a575df0 100644
--- a/.asf.yaml
+++ b/antora-playbook.yaml
@@ -14,24 +14,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
-
-# `.asf.yaml` documentation: https://cwiki.apache.org/confluence/display/INFRA/Git+-+.asf.yaml+features
-
-github:
-
- description: Parent project internally used in Maven-based projects of the Apache Logging Services
- homepage: https://logging.apache.org
- labels:
- - apache
- - java
- - log4j
- - log4j2
- - logging
-
- features:
- issues: true
-
- # Prevent force pushes to primary branches
- protected_branches:
- main:
- required_signatures: true
+site:
+ title: Logging Parent
+ url: "https://logging.apache.org/parent"
+ start_page: "logging-parent::index.adoc"
+content:
+ sources:
+ - url: ./
+ branches: HEAD
+ start_path: target/generated-sources/antora
+ui:
+ bundle:
+ url: "https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable"
+ snapshot: true
diff --git a/pom.xml b/pom.xml
index 4d9a11f..b018ed5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
<version>${revision}</version>
<packaging>pom</packaging>
- <name>Apache Logging Services parent project</name>
+ <name>Apache Logging Parent</name>
<!-- `description` should ideally match the entry in `.asf.yaml` -->
<description>Parent project internally used in Maven-based projects of the Apache Logging Services</description>
<url>https://logging.apache.org/</url>
@@ -147,6 +147,12 @@
<version>${spotless-maven-plugin.version}</version>
</plugin>
+ <plugin>
+ <groupId>com.github.genthaler</groupId>
+ <artifactId>beanshell-maven-plugin</artifactId>
+ <version>${beanshell-maven-plugin.version}</version>
+ </plugin>
+
<plugin>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-changelog-maven-plugin</artifactId>
@@ -611,7 +617,6 @@
<plugin>
<groupId>com.github.genthaler</groupId>
<artifactId>beanshell-maven-plugin</artifactId>
- <version>${beanshell-maven-plugin.version}</version>
<configuration>
<script><![CDATA[import java.io.*;
import java.nio.file.*;
@@ -1014,6 +1019,137 @@
</profile>
+ <!-- Bootstraps the current project by downloading reference support files; `NOTICE.txt`, `.asf.yaml`, `.java-version`, etc. -->
+ <profile>
+
+ <id>bootstrap</id>
+
+ <build>
+
+ <defaultGoal>enforcer:enforce bsh:run</defaultGoal>
+
+ <plugins>
+
+ <!-- Enforce properties required by the BSH -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <configuration>
+ <rules>
+ <requireProperty>
+ <property>repositoryName</property>
+ <message>You must set a `repositoryName` property (e.g., `logging-log4j-tools`)</message>
+ </requireProperty>
+ <requireProperty>
+ <property>projectName</property>
+ <message>You must set a `projectName` property (e.g., `log4j-tools`)</message>
+ </requireProperty>
+ </rules>
+ <fail>true</fail>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>com.github.genthaler</groupId>
+ <artifactId>beanshell-maven-plugin</artifactId>
+ <configuration>
+ <script><![CDATA[import java.io.*;
+ import java.nio.file.*;
+ import java.nio.file.attribute.*;
+ import java.util.*;
+ import java.util.function.*;
+ import java.util.stream.*;
+ import java.util.zip.*;
+
+ import org.eclipse.jgit.dircache.*;
+ import org.eclipse.jgit.lib.Repository;
+ import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
+
+ download(String relativePath) {
+ System.out.format("Downloading `%s`%n", new Object[]{relativePath});
+ try {
+
+ // Create the target file
+ Path dstPath = new File(relativePath).toPath();
+ Files.createDirectories(dstPath.getParent(), /* required for BSH method resolution: */ new FileAttribute[0]);
+
+ // Download the source file
+ String srcUrl = "https://raw.githubusercontent.com/apache/logging-parent/main/" + relativePath;
+ InputStream srcStream = new URL(srcUrl).openStream();
+ try {
+ Files.copy(srcStream, dstPath, new CopyOption[]{StandardCopyOption.REPLACE_EXISTING});
+ } finally {
+ srcStream.close();
+ }
+
+ } catch (Exception error) {
+ // Supplement diagnostics
+ error.printStackTrace(System.err);
+ throw error;
+ }
+ }
+
+ download(String relativePath, String[] substitutions) {
+ download(relativePath);
+ try {
+ Path path = new File(relativePath).toPath();
+ String content = Files.readString(path, StandardCharsets.UTF_8);
+ int substitutionCount = substitutions.length / 2;
+ for (int i = 0; i < substitutionCount; i += 2) {
+ String from = substitutions[i];
+ String to = substitutions[i + 1];
+ System.out.format(" Replacing `%s` with `%s`%n", new Object[]{from, to}):
+ content = content.replaceAll(from, to);
+ }
+ System.out.println(" Writing replaced content"):
+ Files.writeString(path, content, StandardCharsets.UTF_8, new OpenOption[]{StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING});
+ } catch (Exception error) {
+ // Supplement diagnostics
+ error.printStackTrace(System.err);
+ throw error;
+ }
+ }
+
+ download(".github/workflows/build.yml", new String[] {
+ "'apache/logging-parent'", "apache/${repositoryName}",
+ "project-name: logging-parent", "project-name: ${projectName}"
+ });
+ download(".github/dependabot.yaml");
+ download("generate-email.sh");
+ download(".mvn/wrapper/maven-wrapper.properties");
+ download(".mvn/jvm.config");
+ download("src/antora/modules/ROOT/pages/index.adoc");
+ download("src/antora/modules/ROOT/nav.adoc");
+ download("src/antora/antora.tmpl.yml");
+ download("src/antora/antora.yml");
+ download("src/changelog/.changelog.adoc.ftl");
+ download("src/changelog/.index.adoc.ftl");
+ download(".asf.yaml");
+ download(".editorconfig");
+ download(".gitattributes");
+ download(".gitignore");
+ download(".java-version");
+ download(".antora-playbook.yaml");
+ download("LICENSE.txt");
+ download("mvnw");
+ download("mvnw.cmd");
+ download("NOTICE.txt");
+ download("RELEASE-NOTES.adoc");
+ download("RELEASING.adoc", new String[] {
+ ":repository-name: logging-parent", ":repository-name: ${repositoryName}",
+ ":project-name: logging-parent", ":project-name: ${projectName}"
+ });
+
+ ]]></script>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+ </build>
+
+ </profile>
+
</profiles>
</project>
diff --git a/src/antora/antora.tmpl.yml b/src/antora/antora.tmpl.yml
new file mode 100644
index 0000000..30a6833
--- /dev/null
+++ b/src/antora/antora.tmpl.yml
@@ -0,0 +1,44 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# ██ ██ █████ ██████ ███ ██ ██ ███ ██ ██████ ██
+# ██ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██ ██ ██
+# ██ █ ██ ███████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██
+# ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
+# ███ ███ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██████ ██
+#
+# IF THIS FILE IS CALLED `antora.yaml`, DO NOT EDIT IT!
+# ALWAYS EDIT `antora.tmpl.adoc`!
+#
+# `antora.yaml` is generated from `antora.tmpl.yaml` by Maven.
+# Hence, you must always
+#
+# 1. Edit `antora.tmpl.yaml`
+# 2. Run `./mvnw generate-resources`
+# 3. Commit both `antora.tmpl.yaml` and `antora.yaml`
+
+name: logging-parent
+title: Logging Parent
+version: 10.x
+start_page: index.adoc
+asciidoc:
+ attributes:
+ project-scm-url: "${scm.url}"
+ project-version: "${project.version}"
+ project-name: "${project.name}"
+nav:
+ - modules/ROOT/nav.adoc
diff --git a/src/antora/antora.yml b/src/antora/antora.yml
new file mode 100644
index 0000000..e6a7e0e
--- /dev/null
+++ b/src/antora/antora.yml
@@ -0,0 +1,44 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to you under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# ██ ██ █████ ██████ ███ ██ ██ ███ ██ ██████ ██
+# ██ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██ ██ ██
+# ██ █ ██ ███████ ██████ ██ ██ ██ ██ ██ ██ ██ ██ ███ ██
+# ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
+# ███ ███ ██ ██ ██ ██ ██ ████ ██ ██ ████ ██████ ██
+#
+# IF THIS FILE IS CALLED `antora.yaml`, DO NOT EDIT IT!
+# ALWAYS EDIT `antora.tmpl.adoc`!
+#
+# `antora.yaml` is generated from `antora.tmpl.yaml` by Maven.
+# Hence, you must always
+#
+# 1. Edit `antora.tmpl.yaml`
+# 2. Run `./mvnw generate-resources`
+# 3. Commit both `antora.tmpl.yaml` and `antora.yaml`
+
+name: logging-parent
+title: Logging Parent
+version: 10.x
+start_page: index.adoc
+asciidoc:
+ attributes:
+ project-scm-url: "https://github.com/apache/logging-parent"
+ project-version: "10.1.0-SNAPSHOT"
+ project-name: "Apache Logging Parent"
+nav:
+ - modules/ROOT/nav.adoc
diff --git a/src/antora/modules/ROOT/nav.adoc b/src/antora/modules/ROOT/nav.adoc
new file mode 100644
index 0000000..1cbb229
--- /dev/null
+++ b/src/antora/modules/ROOT/nav.adoc
@@ -0,0 +1,19 @@
+////
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+////
+* xref:index.adoc[Basics]
+* xref:release-notes/index.adoc[]
+* {project-scm-url}[Source code repository]
diff --git a/src/antora/modules/ROOT/pages/index.adoc b/src/antora/modules/ROOT/pages/index.adoc
new file mode 100644
index 0000000..0128f77
--- /dev/null
+++ b/src/antora/modules/ROOT/pages/index.adoc
@@ -0,0 +1,75 @@
+////
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+////
+
+:log4j-url: https://logging.apache.org/log4j/2.x
+:log4j-api-url: {log4j-url}/manual/api-separation.html
+
+= Logging Parent
+
+{project-name} is the parent project **internally** used in Maven-based projects of https://logging.apache.org[the Apache Logging Services].
+
+== Features
+
+This project aims to deliver the following features.
+
+=== Parent POM
+
+The provided parent POM features the following conveniences:
+
+* https://creadur.apache.org/rat[`apache-rat-plugin`] integration for license preamble verification
+* https://github.com/apache/logging-log4j-tools/tree/main/log4j-changelog-maven-plugin[`log4j-changelog-maven-plugin`] integration for changelog and release note management
+* https://maven.apache.org/enforcer/maven-enforcer-plugin/[`maven-enforcer-plugin`] checks
+* https://github.com/diffplug/spotless/tree/main/plugin-maven[`spotless-maven-plugin`] integration for code formatting
+* https://antora.org/[Antora]-based site generation
+
+=== Reusable GitHub Actions workflows
+
+The provided reusable GitHub Actions workflows feature the following conveniences:
+
+`build-reusable.yaml`::
+* Compiles against Java 8 bytecode using the specified Java compiler version
+* Verifies reproducibility
+* Automatically merges verified `dependabot` PRs
+
+`deploy-snapshot-reusable.yaml`::
+* Deploys SNAPSHOT artifacts
+
+`deploy-release-reusable.yaml`::
+* Deploys release artifacts
+* Generates the release notes
+* Generates the distribution ZIP containing Git-tracked sources, release notes, binary attachments, `NOTICE.txt`, etc.
+* Generates the release vote & announcement emails
+* Uploads the distribution ZIP and emails to SVN
+
+== Usage
+
+You can use this project as follows:
+
+. Add `org.apache.logging:logging-parent` as a `parent` to your `pom.xml`
+.. Check if `./mvnw verify` succeeds, otherwise make necessary changes
+. Bootstrap the support files (`.gitignore`, `.github/workflows/build.yaml`, etc.) using
++
+[source,bash]
+----
+./mvnw -N -P boostrap \
+ -DrepositoryName=... \ # <1>
+ -DprojectName=... # <2>
+----
+<1> The name of the repository (e.g., `logging-log4j-tools`)
+<2> The name of the project (e.g., `log4j-tools`)
++
+and adapt them their content as you see fit
diff --git a/src/changelog/.10.x.x/add-maven-properties-adoc-profile.xml b/src/changelog/.10.x.x/add-antora-profile.xml
similarity index 62%
copy from src/changelog/.10.x.x/add-maven-properties-adoc-profile.xml
copy to src/changelog/.10.x.x/add-antora-profile.xml
index 8ad2478..aa2c0f5 100644
--- a/src/changelog/.10.x.x/add-maven-properties-adoc-profile.xml
+++ b/src/changelog/.10.x.x/add-antora-profile.xml
@@ -4,5 +4,5 @@
xsi:schemaLocation="http://logging.apache.org/log4j/changelog https://logging.apache.org/log4j/changelog-0.1.1.xsd"
type="added">
<author id="github:vy"/>
- <description format="asciidoc">Added `maven-properties-adoc` profile that populates `src/site/asciidoc/maven-properties.adoc` from `src/site/asciidoc/maven-properties.tmpl.adoc`, if present</description>
+ <description format="asciidoc">Added `antora` and `antora-tmpl-yml` profiles to generate Antora-based websites from `src/antora`</description>
</entry>
diff --git a/src/changelog/.10.x.x/add-maven-properties-adoc-profile.xml b/src/changelog/.10.x.x/add-bootstrap-profile.xml
similarity index 62%
rename from src/changelog/.10.x.x/add-maven-properties-adoc-profile.xml
rename to src/changelog/.10.x.x/add-bootstrap-profile.xml
index 8ad2478..7f2a5f5 100644
--- a/src/changelog/.10.x.x/add-maven-properties-adoc-profile.xml
+++ b/src/changelog/.10.x.x/add-bootstrap-profile.xml
@@ -4,5 +4,5 @@
xsi:schemaLocation="http://logging.apache.org/log4j/changelog https://logging.apache.org/log4j/changelog-0.1.1.xsd"
type="added">
<author id="github:vy"/>
- <description format="asciidoc">Added `maven-properties-adoc` profile that populates `src/site/asciidoc/maven-properties.adoc` from `src/site/asciidoc/maven-properties.tmpl.adoc`, if present</description>
+ <description format="asciidoc">Added `bootstrap` profile to download support files from `logging-parent`</description>
</entry>
diff --git a/src/changelog/.changelog.adoc.ftl b/src/changelog/.changelog.adoc.ftl
index 64aeea7..5c8e30c 100644
--- a/src/changelog/.changelog.adoc.ftl
+++ b/src/changelog/.changelog.adoc.ftl
@@ -14,7 +14,7 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
-<#if entriesByType?size gt 0>== Changes
+<#if entriesByType?size gt 0>
<#list entriesByType as entryType, entries>
=== ${entryType?capitalize}
diff --git a/src/changelog/.index.adoc.ftl b/src/changelog/.index.adoc.ftl
index 95c61fb..46b3907 100644
--- a/src/changelog/.index.adoc.ftl
+++ b/src/changelog/.index.adoc.ftl
@@ -18,5 +18,5 @@
= Release Notes
<#list releases as release>
-* xref:${release.version}.adoc[${release.version}]<#if release.date?has_content> (${release.date})</#if>
+include::${release.version}.adoc[${release.version}]
</#list>