Skip to content

Commit

Permalink
Merge branch '1.1.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
graemerocher committed May 25, 2019
2 parents d37a086 + a9e5c3d commit b4b3bd2
Show file tree
Hide file tree
Showing 69 changed files with 2,004 additions and 290 deletions.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,18 @@

If you are interested in contributing to Micronaut and are looking for issues to work on, take a look at the issues tagged with [help wanted](https://github.com/micronaut-projects/micronaut-core/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+help+wanted%22).

## JDK Setup

Micronaut currently requires JDK 8

## IDE Setup

Micronaut can be imported into IntelliJ IDEA by opening the `build.gradle` file.

## Docker Setup

Micronaut tests currently require docker to be installed.

## Running Tests

To run the tests use `./gradlew check`.
Expand Down
21 changes: 21 additions & 0 deletions benchmarks/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
plugins {
id "me.champeau.gradle.jmh" version "0.4.8"
}

dependencies {
annotationProcessor project(":inject-java")
annotationProcessor project(":validation")
compile project(":inject")
compile project(":validation")
compile project(":runtime")


jmh 'org.openjdk.jmh:jmh-core:1.21'
jmh 'org.openjdk.jmh:jmh-generator-annprocess:1.21'
}
jmh {
duplicateClassesStrategy = 'warn'
warmupIterations = 2
iterations = 4
fork = 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package io.micronaut.core.annotation;

public class AnnotationValueBenchmark {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package io.micronaut.core.convert;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;

import java.net.URI;

@State(Scope.Benchmark)
public class ConversionServiceBenchmark {

ConversionService conversionService;

@Setup
public void prepare() {
conversionService = ConversionService.SHARED;
}

@Benchmark
public void convertCacheHit() {
conversionService.convert("10", Integer.class);
}

@Benchmark
public void convertCacheMiss() {
conversionService.convert(URI.create("http://test.com"), Integer.class);
}

public static void main(String[] args) throws RunnerException {
Options opt = new OptionsBuilder()
.include(".*" + ConversionServiceBenchmark.class.getSimpleName() + ".*")
.warmupIterations(3)
.measurementIterations(5)
.forks(1)
// .jvmArgs("-agentpath:/Applications/YourKit-Java-Profiler-2018.04.app/Contents/Resources/bin/mac/libyjpagent.jnilib")
.build();

new Runner(opt).run();
}
}
24 changes: 12 additions & 12 deletions bom/profiles.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
base=1.1.3.BUILD-SNAPSHOT
configuration=1.1.2
service=1.1.2
kafka=1.1.2
grpc=1.1.2
cli=1.1.2
profile=1.1.2
federation=1.1.2
function=1.1.2
function-aws=1.1.2
function-aws-alexa=1.1.2
rabbitmq=1.1.2
base=1.1.3
configuration=1.1.3
service=1.1.3
kafka=1.1.3
grpc=1.1.3
cli=1.1.3
profile=1.1.3
federation=1.1.3
function=1.1.3
function-aws=1.1.3
function-aws-alexa=1.1.3
rabbitmq=1.1.3
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ subprojects { Project subproject ->

if (
!subproject.name.startsWith('test-') &&
!subproject.toString().contains('build-projects')
!subproject.toString().contains('build-projects') &&
!subproject.toString().contains('benchmarks')
) {

apply from: "${rootProject.rootDir}/gradle/publishing.gradle"
Expand Down
17 changes: 7 additions & 10 deletions cli/src/main/groovy/io/micronaut/cli/MicronautCli.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import io.micronaut.cli.profile.ExecutionContext
import io.micronaut.cli.profile.Profile
import io.micronaut.cli.profile.ProfileRepository
import io.micronaut.cli.profile.ProjectContext
import io.micronaut.cli.profile.ResetableCommand
import io.micronaut.cli.profile.commands.ArgumentCompletingCommand
import io.micronaut.cli.profile.commands.CommandRegistry
import io.micronaut.cli.profile.commands.CommonOptionsMixin
Expand Down Expand Up @@ -236,7 +237,9 @@ class MicronautCli {
while (pr.hasSubcommand()) { pr = pr.subcommand() } // most specific subcommand
Command command = pr.commandSpec().userObject() as Command
int result = executeCommand(command, pr) ? 0 : 1
command.reset()
if (command instanceof ResetableCommand) {
command.reset()
}
return result
} else if (parseResult.unmatched()) {
return getBaseUsage()
Expand All @@ -250,7 +253,9 @@ class MicronautCli {
while (pr.hasSubcommand()) { pr = pr.subcommand() } // most specific subcommand
Command command = pr.commandSpec().userObject() as Command
boolean result = executeCommand(command, pr)
command.reset()
if (command instanceof ResetableCommand) {
command.reset()
}
return result
}] as Profile

Expand Down Expand Up @@ -649,10 +654,6 @@ class MicronautCli {
return false
}

@Override
void reset() {

}
}

@Canonical
Expand All @@ -667,10 +668,6 @@ class MicronautCli {
return true
}

@Override
void reset() {

}
}

private static String[] splitCommandLine(String commandLine) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,9 @@ abstract class AbstractProfile implements Profile {
while (parseResult.hasSubcommand()) { parseResult = parseResult.subcommand() }
Command cmd = parseResult.commandSpec().userObject() as Command
boolean result = cmd.handle(context)
cmd.reset()
if (cmd instanceof ResetableCommand) {
cmd.reset()
}
return result
}

Expand Down
4 changes: 0 additions & 4 deletions cli/src/main/groovy/io/micronaut/cli/profile/Command.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,4 @@ interface Command extends Named {
*/
boolean handle(ExecutionContext executionContext)

/**
* Resets the command state
*/
void reset()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.micronaut.cli.profile;

interface ResetableCommand extends Command {

/**
* Resets the command state
*/
void reset()
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import io.micronaut.cli.profile.OneOfFeatureGroup
import io.micronaut.cli.profile.Profile
import io.micronaut.cli.profile.ProfileRepository
import io.micronaut.cli.profile.ProfileRepositoryAware
import io.micronaut.cli.profile.ResetableCommand
import io.micronaut.cli.util.NameUtils
import io.micronaut.cli.util.VersionInfo
import picocli.CommandLine.Command
Expand All @@ -49,7 +50,7 @@ import java.nio.file.attribute.BasicFileAttributes
*/
@CompileStatic
@Command()
abstract class AbstractCreateCommand extends ArgumentCompletingCommand implements ProfileRepositoryAware {
abstract class AbstractCreateCommand extends ArgumentCompletingCommand implements ProfileRepositoryAware, ResetableCommand {
public static final String ENCODING = System.getProperty("file.encoding") ?: "UTF-8"

protected static final String APPLICATION_YML = "application.yml"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package io.micronaut.cli.profile.commands

import groovy.transform.CompileStatic
import io.micronaut.cli.profile.Command
import io.micronaut.cli.profile.ResetableCommand
import jline.console.completer.ArgumentCompleter
import jline.console.completer.Completer
import picocli.AutoComplete
Expand Down Expand Up @@ -52,8 +53,4 @@ abstract class ArgumentCompletingCommand implements Command, Completer {
return new PicocliCompleter(commandSpec).complete(buffer, cursor, candidates)
}

@Override
void reset() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import io.micronaut.cli.profile.ProfileRepository
import io.micronaut.cli.profile.ProfileRepositoryAware
import io.micronaut.cli.profile.ProjectContext
import io.micronaut.cli.profile.ProjectContextAware
import io.micronaut.cli.profile.ResetableCommand
import picocli.CommandLine
import picocli.CommandLine.Model.CommandSpec

Expand Down Expand Up @@ -51,7 +52,7 @@ class HelpCommand implements ProfileCommand, ProjectContextAware, ProfileReposit

@CommandLine.Parameters(paramLabel = "COMMAND",
description = "The COMMAND to display the usage help message for.")
private String[] commands = new String[0];
private String[] commands = new String[0]

private CommandLine self
private PrintStream out
Expand Down Expand Up @@ -111,8 +112,4 @@ class HelpCommand implements ProfileCommand, ProjectContextAware, ProfileReposit
run()
}

@Override
void reset() {

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import io.micronaut.cli.profile.ExecutionContext
import io.micronaut.cli.profile.Profile
import io.micronaut.cli.profile.ProfileRepository
import io.micronaut.cli.profile.ProfileRepositoryAware
import io.micronaut.cli.profile.ResetableCommand
import picocli.CommandLine
import picocli.CommandLine.Model.CommandSpec

Expand Down Expand Up @@ -62,8 +63,4 @@ class ListProfilesCommand implements Command, ProfileRepositoryAware {
return true
}

@Override
void reset() {

}
}
Loading

0 comments on commit b4b3bd2

Please sign in to comment.