diff options
-rw-r--r-- | app/build.gradle | 149 |
1 files changed, 0 insertions, 149 deletions
diff --git a/app/build.gradle b/app/build.gradle index c8dbafe8..cfd37d04 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -489,157 +489,9 @@ subprojects { } } -def processFileInplace(file, Closure processText) { - def text = file.text - file.write(processText(text)) -} - -task copyIcsOpenVPNClasses(dependsOn: 'copyIcsOpenVPNFiles', type: Copy ) { - println "copyIcsOpenVPNClasses" -// from ('../ics-openvpn/main/') { -// include '**/LaunchVPN.java' -// include '**/OpenVPNSservice.java' -// include '**/VpnProfile.java' -// include '**/DisconnectVPN.java' -// include '**/VpnProfile.java' -// include '**/SeekBarTicks.java' -// include '**/core/**.java' -// include '**/activities/BaseActivity.java' -// include '**/APIVpnProfile.java' -// include '**/aidl/**/api/**.aidl' -// include '**/aidl/**/core/**.aidl' -// -// includeEmptyDirs = false -// -// filter { -// line -> line.replaceAll('de.blinkt.openvpn.R', 'se.leap.bitmaskclient.R') -// } -// filter { -// line -> line.replaceAll('de.blinkt.openvpn.BuildConfig', 'se.leap.bitmaskclient.BuildConfig') -// } -// filter { -// line -> line.replace('package de.blinkt.openvpn;', 'package de.blinkt.openvpn;\n\nimport se.leap.bitmaskclient.R;') -// } -// } into '.' -} - -task copyIcsOpenVPNXml(dependsOn: 'copyIcsOpenVPNFiles', type: Copy ) { - println "copyIcsOpenVPNXml" - from ('../ics-openvpn/main/') { - include '**/strings.xml' - include '**/refs.xml' - include '**/white_rect.xml' - include '**/plurals.xml' - includeEmptyDirs = false - - rename 'strings.xml', 'strings-icsopenvpn.xml' - rename 'plurals.xml', 'plurals-icsopenvpn.xml' - filter { - line -> line.replaceAll('.*name="app".*', '') - } - } into '.' -} - -task copyIcsOpenVPNImages(dependsOn: 'copyIcsOpenVPNFiles', type: Copy ) { - println "copyIcsOpenVPNImages" -// from ('../ics-openvpn/main/') { -// include '**/ic_filter*.png' -// include '**/ic_delete*.png' -// include '**/ic_share*.png' -// include '**/ic_close*.png' -// include '**/ic_edit*.png' -// include '**/ic_check*.png' -// include '**/ic_pause*.png' -// include '**/ic_play*.png' -// include '**/ic_content_copy_white_*.png' -// include '**/ic_add_circle_outline_white_*.png' -// include '**/ic_warning_black_*.png' -// include '**/ic_add_circle_outline_grey600_*.png' -// include '**/ic_archive_grey600_*.png' -// include '**/ic_receipt_white_*.png' -// include '**/ic_sort_white_*.png' -// include '**/ic_content_copy_white_*.png' -// include '**/ic_archive_white_*.png' -// include '**/ic_menu_archive*.png' -// include '**/vpn_item_settings*.png' -// include '**/ic_menu_log*.png' -// include '**/ic_menu_copy_holo_light*.png' -// -// includeEmptyDirs = false -// } into '.' -} - -// thanks to http://pleac.sourceforge.net/pleac_groovy/fileaccess.html -def removeDuplicatedStrings() { - println "removeDuplicatedStrings" - new File('.').eachFileRecurse { - if(it.name.equals('strings.xml') || it.name.equals('plurals.xml')) { - replaceDuplicatesForSource(it, it.name.substring(0, it.name.lastIndexOf('.'))) - } - } -} - -def replaceDuplicatesForSource(File it, String type) { - def ics_openvpn_file = file(it.absolutePath.replace(type+'.xml', type+'-icsopenvpn.xml')) - if(ics_openvpn_file.exists()) { - def ics_openvpn_strings_names = new XmlParser().parse(ics_openvpn_file) - def current_file = it - - ics_openvpn_strings_names.string.each { - processFileInplace(current_file) { text -> - text.replaceAll('.*name=\"' + it.attribute('name') + '\".*(\n)*.*string>.*\n+', '') - } - } - } -} - -task mergeUntranslatable(dependsOn: 'copyIcsOpenVPNFiles', type: Copy ) { - println "mergeUntranslatable" - from ('../ics-openvpn/main/') { - include '**/untranslatable.xml' - rename 'untranslatable.xml', 'untranslatable-icsopenvpn.xml' - } into '.' - def bitmask_untranslatable = file('src/main/res/values/untranslatable.xml') - def ics_openvpn_untranslatable = new File(bitmask_untranslatable.path.replace('untranslatable.xml', 'untranslatable-icsopenvpn.xml')) - ics_openvpn_untranslatable.createNewFile() - def string_continuation = false; - ics_openvpn_untranslatable.eachLine { text -> - if(text.contains('string name=')) { - if(!bitmask_untranslatable.text.contains(text)) - bitmask_untranslatable << text - if(text.contains('</string>')) - string_continuation = true - } - else if(string_continuation) { - bitmask_untranslatable << text - } - - if(text.contains('</string>')) { - string_continuation = false - bitmask_untranslatable << System.getProperty("line.separator") - } - } - - bitmask_untranslatable.write(bitmask_untranslatable.text.replaceAll("</resources>", "")) - bitmask_untranslatable << "</resources>" - - delete ics_openvpn_untranslatable -} - -task copyIcsOpenVPNFiles(dependsOn: 'updateIcsOpenVpn') { - println "copyIcsOpenVPNFiles" - - copyIcsOpenVPNClasses - copyIcsOpenVPNXml - copyIcsOpenVPNImages - //mergeUntranslatable.execute() - removeDuplicatedStrings() -} - task updateIcsOpenVpn( type: Exec ) { commandLine 'git', 'submodule', 'sync' commandLine 'git', 'submodule', 'update', '--init', '--recursive' - } def getTag() { @@ -647,7 +499,6 @@ def getTag() { return ("git describe --tags --exact-match "+ commit).execute().text.trim() } - task cleanNative( type: Delete ) { def shouldClean = getCurrentFlavorForBetaOrRelease() == "production" println "cleanNative: " + shouldClean |