From f7e7a6bfadfd025d8569a8c02a8ee1b2e85c4372 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Tue, 1 Dec 2015 09:40:54 -0500 Subject: [PATCH 1/2] compile against compact3 profile --- .../main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 42098a59510..25b1ed3faf9 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -295,6 +295,9 @@ class BuildPlugin implements Plugin { */ // don't even think about passing args with -J-xxx, oracle will ask you to submit a bug report :) options.compilerArgs << '-Werror' << '-Xlint:all,-path' << '-Xdoclint:all' << '-Xdoclint:-missing' + // compile with compact 3 profile by default + // NOTE: this is just a compile time check: does not replace testing with a compact3 JRE + options.compilerArgs << '-profile' << 'compact3' options.encoding = 'UTF-8' } } From fcb6f44acf92431a39e503e61261506b528bf20d Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Tue, 1 Dec 2015 11:04:46 -0800 Subject: [PATCH 2/2] Build: Add ability to specify the compact profile for javac --- .../main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 25b1ed3faf9..b8902e8fa12 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -283,6 +283,7 @@ class BuildPlugin implements Plugin { /** Adds compiler settings to the project */ static void configureCompile(Project project) { + project.ext.compactProfile = 'compact3' project.afterEvaluate { // fail on all javac warnings project.tasks.withType(JavaCompile) { @@ -297,7 +298,9 @@ class BuildPlugin implements Plugin { options.compilerArgs << '-Werror' << '-Xlint:all,-path' << '-Xdoclint:all' << '-Xdoclint:-missing' // compile with compact 3 profile by default // NOTE: this is just a compile time check: does not replace testing with a compact3 JRE - options.compilerArgs << '-profile' << 'compact3' + if (project.compactProfile != 'full') { + options.compilerArgs << '-profile' << project.compactProfile + } options.encoding = 'UTF-8' } }