Skip to content

Commit

Permalink
Merge branch 'master' into pr-2222
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskleeh committed Oct 29, 2019
2 parents 660c70a + 0b8dc8e commit 1b79e93
Show file tree
Hide file tree
Showing 543 changed files with 16,759 additions and 2,903 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1030,6 +1030,7 @@ public void visitSuperBeanDefinitionFactory(String beanName) {
@Override
public void visitSetterValue(
Object declaringType,
Object returnType,
AnnotationMetadata annotationMetadata,
boolean requiresReflection,
Object fieldType,
Expand All @@ -1038,13 +1039,14 @@ public void visitSetterValue(
Map<String, Object> genericTypes,
boolean isOptional) {
deferredInjectionPoints.add(() -> proxyBeanDefinitionWriter.visitSetterValue(
declaringType, annotationMetadata, requiresReflection, fieldType, fieldName, setterName, genericTypes, isOptional
declaringType, returnType, annotationMetadata, requiresReflection, fieldType, fieldName, setterName, genericTypes, isOptional
));
}

@Override
public void visitSetterValue(
Object declaringType,
Object returnType,
AnnotationMetadata setterMetadata,
boolean requiresReflection,
Object valueType,
Expand All @@ -1055,6 +1057,7 @@ public void visitSetterValue(
deferredInjectionPoints.add(() ->
proxyBeanDefinitionWriter.visitSetterValue(
declaringType,
returnType,
setterMetadata,
requiresReflection,
valueType,
Expand Down
1 change: 0 additions & 1 deletion bom/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ publishing {
xml.children().last() + {
def mkp = delegate

mkp.packaging "pom"
mkp.properties {
for(dep in dependencyVersions) {
def v = dep.value.version
Expand Down
38 changes: 19 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -260,25 +260,25 @@ ext {
group:'io.micronaut.configuration',
name:'micronaut-micrometer-core',
modules:[
'micrometer-registry-appoptics',
'micrometer-registry-atlas',
'micrometer-registry-azure-monitor',
'micrometer-registry-cloudwatch',
'micrometer-registry-datadog',
'micrometer-registry-dynatrace',
'micrometer-registry-elastic',
'micrometer-registry-ganglia',
'micrometer-registry-graphite',
'micrometer-registry-humio',
'micrometer-registry-influx',
'micrometer-registry-jmx',
'micrometer-registry-kairos',
'micrometer-registry-new-relic',
'micrometer-registry-prometheus',
'micrometer-registry-signalfx',
'micrometer-registry-stackdriver',
'micrometer-registry-statsd',
'micrometer-registry-wavefront']
'micronaut-micrometer-registry-appoptics',
'micronaut-micrometer-registry-atlas',
'micronaut-micrometer-registry-azure-monitor',
'micronaut-micrometer-registry-cloudwatch',
'micronaut-micrometer-registry-datadog',
'micronaut-micrometer-registry-dynatrace',
'micronaut-micrometer-registry-elastic',
'micronaut-micrometer-registry-ganglia',
'micronaut-micrometer-registry-graphite',
'micronaut-micrometer-registry-humio',
'micronaut-micrometer-registry-influx',
'micronaut-micrometer-registry-jmx',
'micronaut-micrometer-registry-kairos',
'micronaut-micrometer-registry-new-relic',
'micronaut-micrometer-registry-prometheus',
'micronaut-micrometer-registry-signalfx',
'micronaut-micrometer-registry-stackdriver',
'micronaut-micrometer-registry-statsd',
'micronaut-micrometer-registry-wavefront']
],
'micronaut.spring': [
version:micronautSpringVersion,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,17 @@ class DependencyVersions implements DependencyManagement {
@CompileDynamic
void addDependencyManagement(GPathResult pom) {
pom.dependencyManagement.dependencies.dependency.each { dep ->
addDependency(dep.groupId.text(), dep.artifactId.text(), dep.version.text())
String version = dep.version.text()
if (version.startsWith('${')) {
String property = version[2..-2]
def child = pom.getProperty("properties").children().find {
it.name() == property
}
if (child) {
version = child.text()
}
}
addDependency(dep.groupId.text(), dep.artifactId.text(), version)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package io.micronaut.cli.io.support

import io.micronaut.cli.profile.Feature
import io.micronaut.cli.profile.Profile
import io.micronaut.cli.profile.ProfileRepository
import org.eclipse.aether.graph.Dependency
import org.eclipse.aether.graph.Exclusion
import org.eclipse.aether.util.graph.selector.ExclusionDependencySelector
Expand All @@ -30,7 +31,7 @@ abstract class BuildTokens {
this.appname = appname
}

abstract Map getTokens(Profile profile, List<Feature> features)
abstract Map getTokens(ProfileRepository profileRepository, Profile profile, List<Feature> features)

protected List<Dependency> materializeDependencies(Profile profile, List<Feature> features) {
List<Dependency> profileDependencies = profile.dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package io.micronaut.cli.io.support
import groovy.transform.InheritConstructors
import io.micronaut.cli.profile.Feature
import io.micronaut.cli.profile.Profile
import io.micronaut.cli.profile.ProfileRepository
import io.micronaut.cli.profile.repository.MavenProfileRepository
import io.micronaut.cli.util.VersionInfo
import org.eclipse.aether.graph.Dependency
Expand All @@ -29,7 +30,7 @@ import org.eclipse.aether.graph.Dependency
@InheritConstructors
class GradleBuildTokens extends BuildTokens {

Map getTokens(Profile profile, List<Feature> features) {
Map getTokens(ProfileRepository profileRepository, Profile profile, List<Feature> features) {
Map tokens = [:]
tokens.put("testFramework", testFramework)
tokens.put("sourceLanguage", sourceLanguage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import groovy.transform.InheritConstructors
import groovy.xml.MarkupBuilder
import io.micronaut.cli.profile.Feature
import io.micronaut.cli.profile.Profile
import io.micronaut.cli.profile.ProfileRepository
import io.micronaut.cli.profile.repository.MavenProfileRepository
import io.micronaut.cli.util.VersionInfo
import org.eclipse.aether.artifact.Artifact
import org.eclipse.aether.graph.Dependency
import org.eclipse.aether.graph.Exclusion

Expand All @@ -47,7 +49,7 @@ class MavenBuildTokens extends BuildTokens {
}

@Override
Map getTokens(Profile profile, List<Feature> features) {
Map getTokens(ProfileRepository profileRepository, Profile profile, List<Feature> features) {
Map tokens = [:]
tokens.put("testFramework", testFramework)
tokens.put("sourceLanguage", sourceLanguage)
Expand Down Expand Up @@ -143,14 +145,21 @@ class MavenBuildTokens extends BuildTokens {
annotationProcessorPathsXml."$methodToCall" {
groupId(artifact.groupId)
artifactId(artifact.artifactId)
def artifactVersion = artifact.version
if (!artifactVersion || artifactVersion == 'BOM') {
def resolvedVersion = profileRepository.findVersion(artifact.artifactId)
if (resolvedVersion ) {
artifactVersion = resolvedVersion
}
}
if (artifact.groupId.startsWith("io.micronaut")) {
if (!artifact.version || artifact.version == 'BOM') {
if (!artifactVersion || artifactVersion == 'BOM') {
version("\${micronaut.version}")
} else {
version(artifact.version)
version(artifactVersion)
}
} else {
version(artifact.version)
version(artifactVersion)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ package io.micronaut.cli.profile

import io.micronaut.cli.io.support.Resource
import org.eclipse.aether.artifact.Artifact
import org.eclipse.aether.graph.Dependency

import javax.annotation.Nullable

/**
*
Expand Down Expand Up @@ -70,4 +73,11 @@ interface ProfileRepository {
* @return The {@link Artifact} that resolves to the profile
*/
Artifact getProfileArtifact(String profileName)

/**
* Finds the version for the given artifact ID.
* @return the version
*/
@Nullable String findVersion(String artifactId);

}
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ abstract class AbstractCreateCommand extends ArgumentCompletingCommand implement
return
}

Map tokens = buildTokens.getTokens(profile, features)
Map tokens = buildTokens.getTokens(profileRepository, profile, features)

if (tokens == null) {
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import io.micronaut.cli.profile.ProjectContext
import io.micronaut.cli.profile.ProjectContextAware
import org.eclipse.aether.artifact.Artifact
import org.eclipse.aether.artifact.DefaultArtifact
import org.eclipse.aether.graph.Dependency

/**
* A repository that loads profiles from JAR files
Expand All @@ -48,6 +49,11 @@ abstract class AbstractJarProfileRepository implements ProfileRepository {
return profilesByName[profileName]
}

@Override
String findVersion(String artifactId) {
return null
}

@Override
Profile getProfile(String profileName, Boolean parentProfile) {
return getProfile(profileName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ class MavenProfileRepository extends AbstractJarProfileRepository {
this([DEFAULT_REPO])
}

@Override
@CompileDynamic
String findVersion(String artifactId) {
return profileDependencyVersions.find(artifactId)?.version
}

@Override
Profile getProfile(String profileName, Boolean parentProfile) {
String profileShortName = profileName
Expand Down
13 changes: 12 additions & 1 deletion cli/src/main/resources/unixStartScript.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,19 @@ save () {
echo " "
}
APP_ARGS=\$(save "\$@")
JAVA_ADD_OPENS="\$(java --add-opens 2>&1)"
if [ -z "\${JAVA_ADD_OPENS##*Unrecognized*}" ] ; then
JAVA_MODULES_UNSUPPORTED=true
else
JAVA_OPTS="\$JAVA_OPTS -Dgroovy.jaxb=jaxb"
JAVA_OPTS="\$JAVA_OPTS --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.annotation=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.lang.module=ALL-UNNAMED --add-opens=java.base/java.lang.ref=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.math=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.net.spi=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/java.nio.channels=ALL-UNNAMED --add-opens=java.base/java.nio.channels.spi=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.nio.charset.spi=ALL-UNNAMED --add-opens=java.base/java.nio.file=ALL-UNNAMED --add-opens=java.base/java.nio.file.attribute=ALL-UNNAMED --add-opens=java.base/java.nio.file.spi=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.security.acl=ALL-UNNAMED --add-opens=java.base/java.security.cert=ALL-UNNAMED --add-opens=java.base/java.security.interfaces=ALL-UNNAMED --add-opens=java.base/java.security.spec=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.base/java.text.spi=ALL-UNNAMED --add-opens=java.base/java.time=ALL-UNNAMED --add-opens=java.base/java.time.chrono=ALL-UNNAMED --add-opens=java.base/java.time.format=ALL-UNNAMED --add-opens=java.base/java.time.temporal=ALL-UNNAMED --add-opens=java.base/java.time.zone=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.locks=ALL-UNNAMED --add-opens=java.base/java.util.function=ALL-UNNAMED --add-opens=java.base/java.util.jar=ALL-UNNAMED --add-opens=java.base/java.util.regex=ALL-UNNAMED --add-opens=java.base/java.util.spi=ALL-UNNAMED --add-opens=java.base/java.util.stream=ALL-UNNAMED --add-opens=java.base/java.util.zip=ALL-UNNAMED --add-opens=java.datatransfer/java.awt.datatransfer=ALL-UNNAMED --add-opens=java.desktop/java.applet=ALL-UNNAMED --add-opens=java.desktop/java.awt=ALL-UNNAMED --add-opens=java.desktop/java.awt.color=ALL-UNNAMED --add-opens=java.desktop/java.awt.desktop=ALL-UNNAMED --add-opens=java.desktop/java.awt.dnd=ALL-UNNAMED --add-opens=java.desktop/java.awt.dnd.peer=ALL-UNNAMED --add-opens=java.desktop/java.awt.event=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED --add-opens=java.desktop/java.awt.geom=ALL-UNNAMED --add-opens=java.desktop/java.awt.im=ALL-UNNAMED --add-opens=java.desktop/java.awt.im.spi=ALL-UNNAMED --add-opens=java.desktop/java.awt.image=ALL-UNNAMED --add-opens=java.desktop/java.awt.image.renderable=ALL-UNNAMED --add-opens=java.desktop/java.awt.peer=ALL-UNNAMED --add-opens=java.desktop/java.awt.print=ALL-UNNAMED --add-opens=java.desktop/java.beans=ALL-UNNAMED --add-opens=java.desktop/java.beans.beancontext=ALL-UNNAMED --add-opens=java.instrument/java.lang.instrument=ALL-UNNAMED --add-opens=java.logging/java.util.logging=ALL-UNNAMED --add-opens=java.management/java.lang.management=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.rmi/java.rmi=ALL-UNNAMED --add-opens=java.rmi/java.rmi.activation=ALL-UNNAMED --add-opens=java.rmi/java.rmi.dgc=ALL-UNNAMED --add-opens=java.rmi/java.rmi.registry=ALL-UNNAMED --add-opens=java.rmi/java.rmi.server=ALL-UNNAMED --add-opens=java.sql/java.sql=ALL-UNNAMED --add-opens=java.desktop/javax.swing=ALL-UNNAMED --add-opens=java.desktop/javax.swing.border=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED --add-opens=java.desktop/sun.awt=ALL-UNNAMED --add-opens=java.base/sun.nio.fs=ALL-UNNAMED --add-opens=java.desktop/sun.java2d=ALL-UNNAMED --add-opens=java.desktop/sun.font=ALL-UNNAMED"
# sun.awt.windows just on windows platforms
if [ \$msys = 'true' ] || [ \$cygwin = 'true' ]; then
JAVA_OPTS="\$JAVA_OPTS --add-opens=java.desktop/sun.awt.windows=ALL-UNNAMED"
fi
fi

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- \$DEFAULT_JVM_OPTS \$JAVA_OPTS \$${optsEnvironmentVar} <% if ( appNameSystemProperty ) { %>"\"-D${appNameSystemProperty}=\$APP_BASE_NAME\"" <% } %>-classpath "\"\$CLASSPATH\"" ${mainClassName} "\$APP_ARGS"

exec "\$JAVACMD" "\$@"
exec "\$JAVACMD" "\$@"
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public T next() {
*/
public static <T> Set<T> setOf(T... objects) {
if (objects == null || objects.length == 0) {
return Collections.emptySet();
return new HashSet<>(0);
}
return new HashSet<>(Arrays.asList(objects));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,12 @@ public interface PropertyResolver extends ValueResolver<String> {
* @return The properties
*/
default @Nonnull Map<String, Object> getProperties(@Nonnull String name) {
return getProperties(name, StringConvention.RAW);
return getProperties(name, null);
}

/**
* Return all the properties under the given key.
* Return all the properties under the given key. By default Micronaut stores keys in keb-case, such that normalized lookups
* are more efficient. You can obtain the raw key values by passing in {@link StringConvention#RAW}.
*
* @param name The name
* @param keyFormat The key format to use for the keys. Default is kebab-case.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package io.micronaut.function.client.aws;

//tag::import[]
import io.micronaut.context.ApplicationContext;
import io.micronaut.function.client.FunctionClient;
import javax.inject.Named;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
//end::rxImport[]
//end::import[]

import io.micronaut.runtime.server.EmbeddedServer;
//tag::rxImport[]
import io.reactivex.Single;

public class LocalFunctionInvokeJavaSpec {

//tag::invokeLocalFunction[]
@Test
public void testInvokingALocalFunction() {
Sum sum = new Sum();
sum.setA(5);
sum.setB(10);

EmbeddedServer server = ApplicationContext.run(EmbeddedServer.class);
MathClient mathClient = server.getApplicationContext().getBean(MathClient.class);

assertEquals(Long.valueOf(Integer.MAX_VALUE), mathClient.max());
assertEquals(2, mathClient.rnd(1.6f));
assertEquals(15, mathClient.sum(sum));

}
//end::invokeLocalFunction[]

//tag::invokeRxLocalFunction[]
@Test
public void testInvokingALocalFunctionRX() {
Sum sum = new Sum();
sum.setA(5);
sum.setB(10);

EmbeddedServer server = ApplicationContext.run(EmbeddedServer.class);
RxMathClient mathClient = server.getApplicationContext().getBean(RxMathClient.class);

assertEquals(Long.valueOf(Integer.MAX_VALUE), mathClient.max().blockingGet());
assertEquals(2, mathClient.rnd(1.6f).blockingGet().longValue());
assertEquals(15, mathClient.sum(sum).blockingGet().longValue());

}
//end::invokeRxLocalFunction[]

//tag::beginFunctionClient[]
@FunctionClient
interface MathClient {
//end::beginFunctionClient[]

//tag::functionMax[]
Long max(); //<1>
//end::functionMax[]

//tag::functionRnd[]
@Named("round")
int rnd(float value);
//end::functionRnd[]

long sum(Sum sum);
//tag::endFunctionClient[]
}
//end::endFunctionClient[]


//tag::rxFunctionClient[]
@FunctionClient
interface RxMathClient {
Single<Long> max();

@Named("round")
Single<Integer> rnd(float value);

Single<Long> sum(Sum sum);
}
//end::rxFunctionClient[]
}
Loading

0 comments on commit 1b79e93

Please sign in to comment.