Skip to content

Commit

Permalink
Updated version to 2.0.12
Browse files Browse the repository at this point in the history
+ Important changes in ad filters usage statistics collection
+ Adguard add-on now respects private/incognito mode and does not collect filters usage stats for such tabs
+ Added subscribe.adblockplus.org links support
+ Added French language
+ Added Italian language
+ Added Indonesian language
+ Added Spanish language
+ Added Slovakian language
+ Build changes: different names for dev/beta/release, different IDs for Firefox beta and release builds
* Some minor fixes
  • Loading branch information
ameshkov committed Jul 1, 2015
1 parent 71d0232 commit e9b04a2
Show file tree
Hide file tree
Showing 64 changed files with 3,975 additions and 1,309 deletions.
36 changes: 22 additions & 14 deletions Compiler/build.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,28 @@ mvn package;

cd deploy;

version="2.0.11"
version="2.0.12"

if [ "$env" = release ]; then

echo "Creating release builds..."

destPath=../../Build/Release

#chrome release zip for chrome.store
options="--version=$version --name=main --browser=chrome --pack=zip --update-filters=true"
options="--version=$version --dest=$destPath --name=main --browser=chrome --pack=zip --update-filters=true"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#opera release crx for addons.opera.com
options="--version=$version --name=opera --browser=chrome --pack=crx --local-script-rules=true"
options="--version=$version --dest=$destPath --name=opera --browser=chrome --pack=crx --local-script-rules=true"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#firefox release xpi for amo
options="--version=$version --name=firefox --browser=firefox --pack=xpi --local-script-rules=true"
options="--version=$version --dest=$destPath --name=firefox --browser=firefox --pack=xpi --extensionId=adguardadblocker@adguard.com --local-script-rules=true"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#safari release for extensions.apple.com
options="--version=$version --name=Adguard --browser=safari --extension-id=com.adguard.safari --update-url=https://chrome.adtidy.org/safari/updates.xml"
options="--version=$version --dest=$destPath --name=Adguard --browser=safari --extensionId=com.adguard.safari --update-url=https://chrome.adtidy.org/safari/updates.xml"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

echo "Release builds created"
Expand All @@ -34,24 +36,27 @@ elif [ "$env" = beta ]; then

echo "Creating beta builds..."

destPath=../../Build/Beta
branch=beta

#chrome beta zip
options="--version=$version --name=main --browser=chrome --pack=zip --update-filters=true"
options="--version=$version --branch=$branch --dest=$destPath --name=main --browser=chrome --pack=zip --update-filters=true"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#chrome beta crx
options="--version=$version --name=main --browser=chrome --pack=crx --update-url=https://chrome.adtidy.org/updates.xml"
options="--version=$version --branch=$branch --dest=$destPath --name=main --browser=chrome --pack=crx --update-url=https://chrome.adtidy.org/updates.xml"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#firefox beta xpi
options="--version=$version --name=main --browser=firefox --pack=xpi --update-url=https://chrome.adtidy.org/updates.rdf"
options="--version=$version --branch=$branch --dest=$destPath --name=main --browser=firefox --pack=xpi --extensionId=adguardadblockerbeta@adguard.com --update-url=https://chrome.adtidy.org/updates.rdf"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#firefox beta legacy xpi
options="--version=$version --name=legacy --browser=firefox_legacy --pack=xpi --update-url=https://chrome.adtidy.org/legacy.rdf"
options="--version=$version --branch=legacy --dest=$destPath --name=legacy --browser=firefox_legacy --pack=xpi --extensionId=adguardadblockerlegacy@adguard.com --update-url=https://chrome.adtidy.org/updates.rdf"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#safari beta
options="--version=$version --name=AdguardBeta --browser=safari --extension-id=com.adguard.safaribeta --update-url=https://chrome.adtidy.org/safari/updates.xml"
options="--version=$version --branch=$branch --dest=$destPath --name=AdguardBeta --browser=safari --extensionId=com.adguard.safaribeta --update-url=https://chrome.adtidy.org/safari/updates.xml"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

echo "Beta builds created"
Expand All @@ -60,20 +65,23 @@ else

echo "Creating dev builds..."

destPath=../../Build/Dev
branch=dev

#chrome
options="--version=$version --name=chrome --browser=chrome"
options="--version=$version --branch=$branch --dest=$destPath --name=chrome --browser=chrome"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#firefox
options="--version=$version --name=firefox --browser=firefox"
options="--version=$version --branch=$branch --dest=$destPath --name=firefox --browser=firefox --extensionId=adguardadblockerdev@adguard.com"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#firefox legacy
options="--version=$version --name=firefox-legacy --browser=firefox_legacy"
options="--version=$version --branch=$branch-Legacy --dest=$destPath --name=firefox-legacy --browser=firefox_legacy --extensionId=adguardadblockerlegacydev@adguard.com"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#safari
options="--version=$version --name=safari --browser=safari --extension-id=com.adguard.safari"
options="--version=$version --branch=$branch --dest=$destPath --name=AdguardDev --browser=safari --extensionId=com.adguard.safaridev"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

echo "Dev builds created"
Expand Down
6 changes: 3 additions & 3 deletions Compiler/src/main/java/com/adguard/compiler/FilterUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ public class FilterUtils {

private static Logger log = Logger.getLogger(FilterUtils.class);

private final static String GROUPS_METADATA_DOWNLOAD_URL = "https://adtidy.org/get-groups.html";
private final static String FILTERS_METADATA_DOWNLOAD_URL = "https://adtidy.org/get-filters.html";
private final static String FILTER_DOWNLOAD_URL = "https://chrome.adtidy.org/getfilter.html?filterid=%s&key=4DDBE80A3DA94D819A00523252FB6380";
private final static String GROUPS_METADATA_DOWNLOAD_URL = "http://adtidy.org/get-groups.html";
private final static String FILTERS_METADATA_DOWNLOAD_URL = "http://adtidy.org/get-filters.html";
private final static String FILTER_DOWNLOAD_URL = "http://chrome.adtidy.org/getfilter.html?filterid=%s&key=4DDBE80A3DA94D819A00523252FB6380";

private final static int ENGLISH_FILTER_ID = 2;
private final static String USER_AGENT_SAFARI = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_4) AppleWebKit/537.78.2 (KHTML, like Gecko) Version/7.0.6 Safari/537.78.2";
Expand Down
19 changes: 16 additions & 3 deletions Compiler/src/main/java/com/adguard/compiler/LocaleUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,20 @@ public class LocaleUtils {

public enum SupportedLocales {

EN("en"), RU("ru"), DE("de"), TR("tr"), UK("uk"), PL("pl"), PT_BR("pt_BR"), PT_PT("pt_PT"), KO("ko"), zh_CN("zh_CN");
EN("en"), // English
RU("ru"), // Russian
DE("de"), // German
TR("tr"), // Turkish
UK("uk"), // Ukrainian
PL("pl"), // Polish
PT_BR("pt_BR"), // Portuguese (Brazil)
PT_PT("pt_PT"), // Portuguese (Portugal)
KO("ko"), // Korean
zh_CN("zh_CN"), // Chinese (China)
SR("sr"), // Serbian
FR("fr"), // French
SK("sk"), // Slovak
HY("hy"); // Armenian

private String code;

Expand Down Expand Up @@ -78,7 +91,7 @@ public static void convertFromChromeToFirefoxLocales(File chromeLocalesDir) thro
}
}

public static void writeLocalesToFirefoxInstallRdf(File dest) throws IOException {
public static void writeLocalesToFirefoxInstallRdf(File dest, String extensionNamePostfix) throws IOException {
// <em:localized>
// <Description>
// <em:locale>en</em:locale>
Expand All @@ -95,7 +108,7 @@ public static void writeLocalesToFirefoxInstallRdf(File dest) throws IOException
for (SupportedLocales locale : SupportedLocales.values()) {
File localeFile = new File(dest, "locale/" + locale.code.replace("_", "-") + ".properties");
String[] messages = StringUtils.split(FileUtils.readFileToString(localeFile), System.lineSeparator());
String name = findMessage(messages, "name");
String name = findMessage(messages, "name") + extensionNamePostfix;
String description = findMessage(messages, "description");
sb.append("<em:localized>").append(System.lineSeparator());
sb.append("\t<Description>").append(System.lineSeparator());
Expand Down
30 changes: 23 additions & 7 deletions Compiler/src/main/java/com/adguard/compiler/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package com.adguard.compiler;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;

import javax.net.ssl.*;
Expand Down Expand Up @@ -59,6 +60,9 @@ public static void main(String[] args) throws Exception {
//version
String version = getParamValue(args, "--version", null);

//build branch
String branch = getParamValue(args, "--branch", null);

//browser
String configBrowser = getParamValue(args, "--browser", null);
Browser browser = Browser.getByName(configBrowser);
Expand All @@ -73,7 +77,7 @@ public static void main(String[] args) throws Exception {
String updateUrl = getParamValue(args, "--update-url", null);

//safari extension id
String extensionId = getParamValue(args, "--extension-id", null);
String extensionId = getParamValue(args, "--extensionId", null);

//pack method
String packMethod = getParamValue(args, "--pack", null);
Expand All @@ -94,7 +98,7 @@ public static void main(String[] args) throws Exception {

Map<Integer, List<String>> filtersScriptRules = FilterUtils.getScriptRules(source);

File buildResult = createBuild(source, dest, useLocalScriptRules, filtersScriptRules, extensionId, updateUrl, browser, version);
File buildResult = createBuild(source, dest, useLocalScriptRules, filtersScriptRules, extensionId, updateUrl, browser, version, branch);

if (browser == Browser.SAFARI && updateFilters) {
FilterUtils.loadEnglishFilterForSafari(new File(buildResult, "filters"));
Expand Down Expand Up @@ -160,7 +164,12 @@ private static boolean validateParameters(String sourcePath, String buildName, S
}

if (extensionId == null && browser == Browser.SAFARI) {
log.error("Set --extension-id for Safari build");
log.error("Set --extensionId for Safari build");
return false;
}

if (extensionId == null && (browser == Browser.FIREFOX || browser == Browser.FIREFOX_LEGACY)) {
log.error("Set --extensionId for Safari build");
return false;
}

Expand All @@ -182,14 +191,15 @@ private static boolean validateParameters(String sourcePath, String buildName, S
* All extension stores have their own update channels so
* we shouldn't add update channel to the manifest.
* @param browser Browser type
* @param version If true - this is release build
* @param version Build version
* @param branch Build branch
* @return Path to build result
* @throws Exception
*/
private static File createBuild(File source, File dest,
boolean useLocalScriptRules,
Map<Integer, List<String>> filtersScriptRules,
String extensionId, String updateUrl, Browser browser, String version) throws Exception {
String extensionId, String updateUrl, Browser browser, String version, String branch) throws Exception {

if (dest.exists()) {
log.debug("Removed previous build: " + dest.getName());
Expand All @@ -199,9 +209,15 @@ private static File createBuild(File source, File dest,
FileUtil.copyFiles(source, dest, browser);

SettingUtils.writeLocalScriptRulesToFile(dest, useLocalScriptRules, filtersScriptRules);
SettingUtils.updateManifestFile(dest, browser, version, extensionId, updateUrl);

String extensionNamePostfix = "";
if (StringUtils.isNotEmpty(branch)) {
extensionNamePostfix = " (" + StringUtils.capitalize(branch) + ")";
}

SettingUtils.updateManifestFile(dest, browser, version, extensionId, updateUrl, extensionNamePostfix);
if (browser == Browser.FIREFOX || browser == Browser.FIREFOX_LEGACY) {
LocaleUtils.writeLocalesToFirefoxInstallRdf(dest);
LocaleUtils.writeLocalesToFirefoxInstallRdf(dest, extensionNamePostfix);
}

return dest;
Expand Down
18 changes: 9 additions & 9 deletions Compiler/src/main/java/com/adguard/compiler/SettingUtils.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/**
* This file is part of Adguard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
*
* <p/>
* Adguard Browser Extension is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* <p/>
* Adguard Browser Extension is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* <p/>
* You should have received a copy of the GNU Lesser General Public License
* along with Adguard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/
Expand Down Expand Up @@ -60,18 +60,13 @@ public class SettingUtils {
"var USE_DEFAULT_SCRIPT_RULES = exports.USE_DEFAULT_SCRIPT_RULES = %s;\r\n" +
"var DEFAULT_SCRIPT_RULES = exports.DEFAULT_SCRIPT_RULES = Object.create(null);\r\n%s";

private final static String CHROMIUM_UPDATE_URL = "https://chrome.adtidy.org/updates.xml";
private final static String FIREFOX_UPDATE_URL = "https://chrome.adtidy.org/updates.rdf";
private final static String FIREFOX_LEGACY_UPDATE_URL = "https://chrome.adtidy.org/legacy.rdf";
private final static String SAFARI_UPDATE_URL = "https://chrome.adtidy.org/safari/updates.xml";

public static void writeLocalScriptRulesToFile(File dest, boolean useLocalScriptRules, Map<Integer, List<String>> filtersScriptRules) throws IOException {
String scriptRules = getScriptRulesText(filtersScriptRules);
String settings = String.format(LOCAL_SCRIPT_RULES_FILE_TEMPLATE, useLocalScriptRules, scriptRules);
FileUtils.writeStringToFile(getLocalScriptRulesFile(dest), settings);
}

public static void updateManifestFile(File dest, Browser browser, String version, String extensionId, String updateUrl) throws IOException {
public static void updateManifestFile(File dest, Browser browser, String version, String extensionId, String updateUrl, String extensionNamePostfix) throws IOException {

switch (browser) {
case CHROMIUM:
Expand All @@ -83,6 +78,7 @@ public static void updateManifestFile(File dest, Browser browser, String version
content = content + "\t\"update_url\": \"" + updateUrl + "\"\r\n}";
}
content = StringUtils.replace(content, "${version}", version);
content = StringUtils.replace(content, "${extensionNamePostfix}", extensionNamePostfix);
FileUtils.writeStringToFile(manifestFile, content);
break;
case SAFARI:
Expand All @@ -91,6 +87,7 @@ public static void updateManifestFile(File dest, Browser browser, String version
contentInfoPlist = StringUtils.replace(contentInfoPlist, "${extensionId}", extensionId);
contentInfoPlist = StringUtils.replace(contentInfoPlist, "${version}", version);
contentInfoPlist = StringUtils.replace(contentInfoPlist, "${updateURL}", updateUrl != null ? updateUrl : "");
contentInfoPlist = StringUtils.replace(contentInfoPlist, "${extensionNamePostfix}", extensionNamePostfix);
FileUtils.writeStringToFile(infoPlistFile, contentInfoPlist);
break;
case FIREFOX:
Expand All @@ -105,11 +102,14 @@ public static void updateManifestFile(File dest, Browser browser, String version
}
contentRdf = StringUtils.replace(contentRdf, "${updateUrl}", updateUrl);
contentRdf = StringUtils.replace(contentRdf, "${version}", version);
contentRdf = StringUtils.replace(contentRdf, "${extensionId}", extensionId);
FileUtils.writeStringToFile(installRdf, contentRdf);
//write version
File packageJson = new File(dest, "package.json");
String contentPackageJson = FileUtils.readFileToString(packageJson);
contentPackageJson = StringUtils.replace(contentPackageJson, "${version}", version);
contentPackageJson = StringUtils.replace(contentPackageJson, "${extensionId}", extensionId);
contentPackageJson = StringUtils.replace(contentPackageJson, "${extensionNamePostfix}", extensionNamePostfix);
FileUtils.writeStringToFile(packageJson, contentPackageJson);
break;
}
Expand Down
6 changes: 3 additions & 3 deletions Extension/_locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"message": "Auswahlmodus"
},
"assistant_select_element_ext": {
"message": "Klicken Sie auf ein Element auf der Seite oder "
"message": "Klicken Sie&nbsp; auf ein&nbsp;Element&nbsp;oder "
},
"assistant_select_element_cancel": {
"message": "brechen Sie Auswahlmodus ab"
Expand Down Expand Up @@ -180,7 +180,7 @@
"message": "Adguard filtert die Webseite aus der wei\u00dfen Liste nicht."
},
"options_whitelist_inverse": {
"message": "Invert whitelist<span class='sp-table-row-info'>Unblock ads everywhere <i>except<\/i> the whitelist<\/span>"
"message": "Von Whitelist entfernen<span class='sp-table-row-info'>Anzeigen \u00fcberall entsperren <i>au\u00dfer<\/i> Whitelist<\/span>"
},
"options_whitelist_add_domain": {
"message": "Website hinzuf\u00fcgen "
Expand Down Expand Up @@ -666,7 +666,7 @@
"message": "In neuem Tab \u00f6ffnen"
},
"filtering_log_in_whitelist": {
"message": "Site is whitelisted"
"message": "Die Site ist in der Whitelist"
},
"abp_subscribe_confirm_enable": {
"message": "Adguard: wollen Sie $1 Abonnement aktivieren?"
Expand Down
Loading

0 comments on commit e9b04a2

Please sign in to comment.