Fix db/ci.node not being added to build scan tags
This commit is contained in:
parent
f81124c511
commit
1cac1d5bc9
|
@ -47,11 +47,10 @@ gradleEnterprise {
|
||||||
uploadInBackground = !settings.ext.isCiEnvironment
|
uploadInBackground = !settings.ext.isCiEnvironment
|
||||||
|
|
||||||
tag "JDK ${JavaVersion.current().toString()}"
|
tag "JDK ${JavaVersion.current().toString()}"
|
||||||
String db = rootProject.hasProperty( 'db' ) ? rootProject.properties.db : 'h2'
|
tag extensions.db
|
||||||
tag db
|
value 'database', extensions.db
|
||||||
value 'database', db
|
if ( extensions.hasProperty( 'ci.node' ) ) {
|
||||||
if ( rootProject.hasProperty( 'ci.node' ) ) {
|
tag extensions.property( 'ci.node' )
|
||||||
tag rootProject.property('ci.node')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,9 @@
|
||||||
package org.hibernate.orm.env;
|
package org.hibernate.orm.env;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.gradle.StartParameter;
|
||||||
import org.gradle.api.Plugin;
|
import org.gradle.api.Plugin;
|
||||||
import org.gradle.api.initialization.Settings;
|
import org.gradle.api.initialization.Settings;
|
||||||
|
|
||||||
|
@ -11,5 +15,24 @@ public class EnvironmentSettingsPlugin implements Plugin<Settings> {
|
||||||
@Override
|
@Override
|
||||||
public void apply(Settings settings) {
|
public void apply(Settings settings) {
|
||||||
settings.getExtensions().add( JpaVersion.EXT_KEY, JpaVersion.from( settings ) );
|
settings.getExtensions().add( JpaVersion.EXT_KEY, JpaVersion.from( settings ) );
|
||||||
|
settings.getExtensions().add( "db", Objects.requireNonNullElse( getP( settings, "db" ), "h2" ) );
|
||||||
|
String ciNode = getP( settings, "ci.node" );
|
||||||
|
if ( ciNode != null ) {
|
||||||
|
settings.getExtensions().add( "ci.node", ciNode );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getP(Settings settings, String key) {
|
||||||
|
StartParameter startParameter = settings.getStartParameter();
|
||||||
|
// the `-P` settings passed at command-line
|
||||||
|
final Map<String, String> projectProperties = startParameter.getProjectProperties();
|
||||||
|
final String projectProperty = projectProperties.get( key );
|
||||||
|
if ( projectProperty != null && !projectProperty.isEmpty() ) {
|
||||||
|
return projectProperty;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue