From: Ben Soares Date: Mon, 13 Jan 2020 17:12:40 +0000 (+0000) Subject: JAL-3210 gradle eclipse now uses/inserts utils/eclipse/JalviewCodeStyle.xml into... X-Git-Tag: Release_2_11_4_0~45^2~18^2~38 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=a3b8fa7024e7034866f6fe6c18c53177fa31c414;p=jalview.git JAL-3210 gradle eclipse now uses/inserts utils/eclipse/JalviewCodeStyle.xml into the org.eclipse.jdt.core.prefs --- diff --git a/build.gradle b/build.gradle index 5190968..e6a9c34 100644 --- a/build.gradle +++ b/build.gradle @@ -528,6 +528,7 @@ eclipse { javaRuntimeName = eclipse_java_runtime_name // add in jalview project specific properties/preferences into eclipse core preferences + // and also the codestyle XML file file { withProperties { props -> def jalview_prefs = new Properties() @@ -539,6 +540,22 @@ eclipse { props.putAt(t, v) } } + // codestyle file -- overrides previous formatter prefs + def csFile = file("${jalviewDirAbsolutePath}/${eclipse_codestyle_file}") + if (csFile.exists()) { + XmlParser parser = new XmlParser() + def profiles = parser.parse(csFile) + def profile = profiles.'profile'.find { p -> (p.'@kind' == "CodeFormatterProfile" && p.'@name' == "Jalview") } + if (profile != null) { + profile.'setting'.each { s -> + def id = s.'@id' + def value = s.'@value' + if (id != null && value != null) { + props.putAt(id, value) + } + } + } + } } } diff --git a/gradle.properties b/gradle.properties index fda866e..42391fe 100644 --- a/gradle.properties +++ b/gradle.properties @@ -143,6 +143,7 @@ bamboo_planKey = bamboo_getdown_channel_suffix = /latest/artifact/shared/getdown-channel eclipse_extra_jdt_prefs_file = .settings/org.eclipse.jdt.core.jalview.prefs +eclipse_codestyle_file = utils/eclipse/JalviewCodeStyle.xml eclipse_project_name = jalview eclipse_bin_dir = bin eclipse_debug = false