Skip to content

Commit

Permalink
Merge branch 'master' into security_ldap
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskleeh committed Sep 14, 2018
2 parents 4f1c155 + 7d4605c commit 87beb99
Show file tree
Hide file tree
Showing 437 changed files with 11,727 additions and 1,429 deletions.
15 changes: 0 additions & 15 deletions .circleci/config.yml

This file was deleted.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ bin/
.project
*/test/
*/META-INF/
src/main/docs/guide/appendix/propertyReference.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
@Internal
final class AdapterIntroduction implements MethodInterceptor<Object, Object> {

private final ExecutionHandle<Object> executionHandle;
private final ExecutionHandle<?, ?> executionHandle;

/**
* Default constructor.
Expand All @@ -48,7 +48,7 @@ final class AdapterIntroduction implements MethodInterceptor<Object, Object> {
* @param method The target method
*/
AdapterIntroduction(BeanContext beanContext, ExecutableMethod<?, ?> method) {
Class beanType = method.getValue(Adapter.class, ADAPTED_BEAN, Class.class).orElse(null);
Class<?> beanType = method.getValue(Adapter.class, ADAPTED_BEAN, Class.class).orElse(null);
String beanMethod = method.getValue(Adapter.class, ADAPTED_METHOD, String.class).orElse(null);
String beanQualifier = method.getValue(Adapter.class, ADAPTED_QUALIFIER, String.class).orElse(null);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public void write(ConfigurationMetadataBuilder<?> metadataBuilder, ClassWriterOu
if (cm == null || cm == EMPTY) continue;

if (entry.getValue() != null) {
writeFragmentLink(w, cm.getType());
w.newLine();
w.append(".Configuration Properties for api:").append(cm.getType()).append("[]");
w.newLine();
Expand Down Expand Up @@ -115,22 +116,30 @@ public void write(ConfigurationMetadataBuilder<?> metadataBuilder, ClassWriterOu
w.newLine();
w.append("|===");
w.newLine();
w.append("<<<");
}

}
}
}


}


}

private void writeFragmentLink(BufferedWriter w, String type) throws IOException {
w.newLine();
w.append("++++");
w.newLine();
w.append("<a id=\"");
w.append(type);
w.append("\" href=\"#");
w.append(type);
w.append("\">&#128279;</a>");
w.newLine();
w.append("++++");
}

private <T> Predicate<T> distinctByKey(
Function<? super T, ?> ke) {

Map<Object, Boolean> seen = new ConcurrentHashMap<>();
return t -> seen.putIfAbsent(ke.apply(t), Boolean.TRUE) == null;
}
Expand Down
183 changes: 129 additions & 54 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,56 @@ ext {

}

task testReportsAggregate {
group 'verification'
doLast() {
int totalFailures = 0
int totalErrors = 0
int totalSkipped = 0
int totalTests = 0
int itemPad = 13
int titlePad = 35
String separator = " | "
subprojects.each { subproject ->
if ( subproject.tasks.find { Task task -> task.name == 'test' } ) {
if (new File("${subproject.buildDir}/test-results/test").exists()) {
int failures = 0
int errors = 0
int skipped = 0
int tests = 0
new File("${subproject.buildDir}/test-results/test").eachFile() { file ->
if ( file.name.endsWith('.xml') ) {
def testsuite = new XmlSlurper().parseText(file.text)
failures += "${testsuite['@failures']}" as int
errors += "${testsuite['@errors']}" as int
skipped += "${testsuite['@skipped']}" as int
tests += "${testsuite['@tests']}" as int
}
}
totalFailures += failures
totalErrors += errors
totalSkipped += skipped
totalTests += tests
String subprojectStr = "${subproject.name}".padRight(titlePad)
String testStr = "tests: $tests".padRight(itemPad)
String skippedStr = "skipped: $skipped".padRight(itemPad)
String errorsStr = "errors: $errors".padRight(itemPad)
String failuresStr = "failures: $failures".padRight(itemPad)
logger.quiet("${subprojectStr}${separator}${testStr}${separator}${skippedStr}${separator}${errorsStr}${separator}${failuresStr}")
}
}
}
String title = "All Tests".padRight(titlePad)
String testStr = "tests: $totalTests".padRight(itemPad)
String skippedStr = "skipped: $totalSkipped".padRight(itemPad)
String errorsStr = "errors: $totalErrors".padRight(itemPad)
String failuresStr = "failures: $totalFailures".padRight(itemPad)
int itemsSize = [totalTests, totalSkipped, totalErrors, totalFailures].size()
logger.quiet("="* ((itemPad * itemsSize) + titlePad + (separator.length() * itemsSize)))
logger.quiet("${title}${separator}${testStr}${separator}${skippedStr}${separator}${errorsStr}${separator}${failuresStr}")
}
}

subprojects { Project subproject ->

version project.projectVersion
Expand Down Expand Up @@ -294,6 +344,7 @@ subprojects { Project subproject ->

reports.html.enabled = !System.getenv("TRAVIS")
reports.junitXml.enabled = !System.getenv("TRAVIS")

}

tasks.withType(Checkstyle) {
Expand Down Expand Up @@ -352,13 +403,90 @@ subprojects { Project subproject ->
}

task moveConfigProps() {
group 'documentation'
doLast {
ant.mkdir(dir:"${rootProject.buildDir}/config-props")
ant.move(file: "${subproject.buildDir}/classes/java/main/META-INF/config-properties.adoc", tofile:"${rootProject.buildDir}/config-props/${subproject.name}-config-properties.adoc", failonerror:false, quiet:true)
}
}

jar.dependsOn(moveConfigProps)
task javaDocAtReplacement(type: io.micronaut.docs.JavaDocAtValueReplacementTask, dependsOn: moveConfigProps) {
adocFile = new File("${rootProject.buildDir}/config-props/${subproject.name}-config-properties.adoc")
rootProjectDir = rootProject.projectDir
}

task replaceAtLink(dependsOn: moveConfigProps) {
group 'documentation'

doLast {
File file = new File("${rootProject.buildDir}/config-props/${subproject.name}-config-properties.adoc")
if ( file.exists()) {
def atLinkReplacer = { String str ->
String newLine = str.substring(0, str.indexOf('{@link io.micronaut.'))
String sub = "api:"+str.substring(str.indexOf('{@link io.micronaut.') + '{@link io.micronaut.'.length())
newLine += sub.substring(0, sub.indexOf('}')) + '[]'
newLine += sub.substring(sub.indexOf('}') + '}'.length())
newLine
}

List<String> lines = file.readLines()
List<String> outputLines = []
for (String line : lines) {
String proccessedLine = line
while (proccessedLine.contains('{@link io.micronaut.')) {
proccessedLine = atLinkReplacer(proccessedLine)
}
outputLines << proccessedLine
}
file.text = outputLines.join('\n')
}
}
}
task createDocsGeneratedFolders {
group 'documentation'

doLast {
if(!new File("${rootProject.buildDir}/generated").exists()) {
new File("${rootProject.buildDir}/generated").mkdir()
}
if(!new File("${rootProject.buildDir}/generated/configurationProperties").exists()) {
new File("${rootProject.buildDir}/generated/configurationProperties").mkdir()
}
}
}
task processConfigProps(dependsOn: [replaceAtLink, javaDocAtReplacement, createDocsGeneratedFolders]) {
group 'documentation'
ext {
individualConfigPropsFolder = "${rootProject.buildDir}/generated/configurationProperties"
}
doLast {

def f = new File("${rootProject.buildDir}/config-props/${subproject.name}-config-properties.adoc")
if (f.exists()) {
def lines = f.readLines()
def separator = "<<<"
List<String> accumulator = []
String configurationPropertyName = ''
for (String line : lines) {

if (line.startsWith('<a id="')) {
String sub = line.substring(line.indexOf('id="') + 'id="'.length())
sub = sub.substring(0, sub.indexOf('"'))
configurationPropertyName = sub
}
if (line == separator) {
File outputfile = new File("${individualConfigPropsFolder}/${configurationPropertyName}.adoc")
outputfile.createNewFile()
outputfile.text = accumulator.join('\n')
accumulator = []
configurationPropertyName = null
} else {
accumulator << line
}
}
}
}
}

groovydoc {
classpath += project.configurations.documentation
Expand Down Expand Up @@ -387,59 +515,6 @@ allprojects {
apply from: rootProject.file('gradle/license.gradle')
}

task aggregateReports {
group 'verification'
doLast() {
def html = "<!DOCTYPE html><html><head><meta charset='UTF-8'><title>Micronaut reports</title></head><body><img src='http://micronaut.io/images/micronautlogo.svg' alt='Micronaut'/><ul>"
subprojects.each { subproject ->
if ( subproject.tasks.find { Task task -> task.name == 'test' } ) {
def link = ''
if (new File("${subproject.buildDir}/reports/checkstyle").exists()) {
mkdir("${rootProject.buildDir}/reports/${subproject.name}/checkstyle")
copy {
from "${subproject.buildDir}/reports/checkstyle"
into "${rootProject.buildDir}/reports/${subproject.name}/checkstyle"
}
link += " <a href='${subproject.name}/checkstyle/index.html'>checkstyle</a>"
}
if (new File("${subproject.buildDir}/test-results/test").exists()) {
int failures = 0
int errors = 0
int skipped = 0
int tests = 0
new File("${subproject.buildDir}/test-results/test").eachFile() { file ->
if ( file.name.endsWith('.xml') ) {
def testsuite = new XmlSlurper().parseText(file.text)
failures += "${testsuite['@failures']}" as int
errors += "${testsuite['@errors']}" as int
skipped += "${testsuite['@skipped']}" as int
tests += "${testsuite['@tests']}" as int
}
}
link += " tests: ${tests} skipped: ${skipped} <span style='${errors ? 'color: red;' : ''}'>errors: ${errors}</span> <span style='${failures ? 'color: red;' : ''}'>failures: ${failures}</span>"
}
if (new File("${subproject.buildDir}/reports/tests/test").exists()) {
mkdir("${rootProject.buildDir}/reports/${subproject.name}/test")
copy {
from "${subproject.buildDir}/reports/tests/test"
into "${rootProject.buildDir}/reports/${subproject.name}/test"
}
link += " <a href='${subproject.name}/test/index.html'>test</a>"
}


if (link) {
html += "<li><b>${subproject.name}</b> $link</li>"
}
}
}
html += "</ul></body></html>"
File f = new File("${rootProject.buildDir}/reports/index.html")
f.text = html
}
}


sdkman {
api = "https://vendors.sdkman.io"
consumerKey = System.getenv("GVM_SDKVENDOR_KEY") ?: project.hasProperty("gvmSdkvendorKey") ? project.gvmSdkvendorKey : ''
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/groovy/io/micronaut/docs/ApiMacro.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class ApiMacro extends InlineMacroProcessor {
type: ':link',
target: "${baseUri}/${target.replace('.','/')}.html${methodRef}${propRef}".toString()
] as Map<String, Object>
options.target = options.target.replaceAll('\\$', '.')

if (attributes.text) {
shortName = attributes.text
Expand Down
31 changes: 31 additions & 0 deletions buildSrc/src/main/groovy/io/micronaut/docs/AtValue.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package io.micronaut.docs;

public class AtValue {

private String type;
private String fieldName;

public AtValue() {}


public AtValue(String type, String fieldName) {
this.type = type;
this.fieldName = fieldName;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type != null ? type.replaceAll(" " , "") : type;
}

public String getFieldName() {
return fieldName;
}

public void setFieldName(String fieldName) {
this.fieldName = fieldName != null ? fieldName.replaceAll(" " , "") : fieldName;
}
}
Loading

0 comments on commit 87beb99

Please sign in to comment.