Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRESOLVER-604] Make config properties metadata available #574

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
28 changes: 28 additions & 0 deletions maven-resolver-tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,39 @@
<arguments>
<argument>${basedir}/..</argument>
<argument>${basedir}/../src/site/markdown/configuration.md</argument>
<argument>${basedir}/target/maven-resolver.properties</argument>
<argument>${basedir}/target/maven-resolver.yaml</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>attach</id>
<goals>
<goal>attach-artifact</goal>
</goals>
<phase>verify</phase>
<configuration>
<artifacts>
<artifact>
<type>properties</type>
<file>${basedir}/target/maven-resolver.properties</file>
</artifact>
<artifact>
<type>yaml</type>
<file>${basedir}/target/maven-resolver.yaml</file>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public class CollectConfiguration {
public static void main(String[] args) throws Exception {
Path start = Paths.get(args.length > 0 ? args[0] : ".");
Path output = Paths.get(args.length > 1 ? args[1] : "output");
Path props = Paths.get(args.length > 2 ? args[2] : "props");
Path yaml = Paths.get(args.length > 3 ? args[3] : "yaml");

TreeMap<String, ConfigurationKey> discoveredKeys = new TreeMap<>();
Files.walk(start)
Expand Down Expand Up @@ -115,6 +117,12 @@ public static void main(String[] args) throws Exception {
try (BufferedWriter fileWriter = Files.newBufferedWriter(output)) {
velocityEngine.getTemplate("page.vm").merge(context, fileWriter);
}
try (BufferedWriter fileWriter = Files.newBufferedWriter(props)) {
velocityEngine.getTemplate("props.vm").merge(context, fileWriter);
}
try (BufferedWriter fileWriter = Files.newBufferedWriter(yaml)) {
velocityEngine.getTemplate("yaml.vm").merge(context, fileWriter);
}
}

private static JavaType<?> parse(Path path) {
Expand Down
48 changes: 48 additions & 0 deletions maven-resolver-tools/src/main/resources/props.vm
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
##
## 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.
##
#[[#
# 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.
#]]#
props.count = ${keys.size()}
#foreach($key in $keys)
props.${foreach.count}.key = ${key.key}
props.${foreach.count}.configurationType = ${key.configurationType}
props.${foreach.count}.description = ${key.description}
props.${foreach.count}.defaultValue = ${key.defaultValue}
#if( !${key.since.empty} )
props.${foreach.count}.since = ${key.since}
#end
props.${foreach.count}.supportRepoIdSuffix = ${key.supportRepoIdSuffix}
props.${foreach.count}.configurationSource = ${key.configurationSource}
#end
48 changes: 48 additions & 0 deletions maven-resolver-tools/src/main/resources/yaml.vm
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
##
## 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.
##
#[[#
# 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.
#]]#
props:
#foreach($key in $keys)
- key: ${key.key}
configurationType: ${key.configurationType}
description: "${key.description.replaceAll('"', '\\"')}"
defaultValue: ${key.defaultValue}
#if( !${key.since.empty} )
since: ${key.since}
#end
supportRepoIdSuffix: ${key.supportRepoIdSuffix}
configurationSource: ${key.configurationSource}
#end