@@ -48,13 +48,12 @@ esplugin.bundleSpec.from('config/discovery-ec2') {
4848}
4949
5050tasks. register(" writeTestJavaPolicy" ) {
51+ boolean inFips = buildParams. inFipsJvm
52+ inputs. property(" inFipsJvm" , inFips)
53+ final File javaPolicy = new File (layout. buildDirectory. asFile. get(), " tmp/java.policy" )
54+ outputs. file(javaPolicy)
5155 doLast {
52- final File tmp = file(" ${ buildDir} /tmp" )
53- if (tmp. exists() == false && tmp. mkdirs() == false ) {
54- throw new GradleException (" failed to create temporary directory [${ tmp} ]" )
55- }
56- final File javaPolicy = file(" ${ tmp} /java.policy" )
57- if (buildParams. inFipsJvm) {
56+ if (inFips) {
5857 javaPolicy. write(
5958 [
6059 " grant {" ,
@@ -97,9 +96,9 @@ tasks.withType(Test).configureEach {
9796 // this is needed to manipulate com.amazonaws.sdk.ec2MetadataServiceEndpointOverride system property
9897 // it is better rather disable security manager at all with `systemProperty 'tests.security.manager', 'false'`
9998 if (buildParams. inFipsJvm){
100- nonInputProperties. systemProperty ' java.security.policy' , " =file://${ buildDir } /tmp/java.policy"
99+ nonInputProperties. systemProperty ' java.security.policy' , " =file://${ layout.buildDirectory.asFile.get() } /tmp/java.policy"
101100 } else {
102- nonInputProperties. systemProperty ' java.security.policy' , " file://${ buildDir } /tmp/java.policy"
101+ nonInputProperties. systemProperty ' java.security.policy' , " file://${ layout.buildDirectory.asFile.get() } /tmp/java.policy"
103102 }
104103}
105104
0 commit comments