Merge branch 'stable-3.4' into 'master'

* stable-3.4:
  fix: cannot build 'gerrit-3.2' on MacOS
  Load fonts directly from Gerrit instead of 3rd party domains

Change-Id: I44e5fab908d4d338727097503cd64378c6b607c8
diff --git a/BUILD b/BUILD
index 057d3d2..8966d6b 100644
--- a/BUILD
+++ b/BUILD
@@ -7,7 +7,7 @@
     srcs = glob(["src/main/java/**/*.java"]),
     manifest_entries = [
         "Gerrit-PluginName: gitiles",
-        "Gerrit-Module: com.googlesource.gerrit.plugins.gitiles.Module",
+        "Gerrit-Module: com.googlesource.gerrit.plugins.gitiles.PluginModule",
         "Gerrit-HttpModule: com.googlesource.gerrit.plugins.gitiles.HttpModule",
         # Gitiles uses /repo to access a repo, so the default plugin layout would
         # disallow repos named "static" or "Documentation". Paths starting with +
diff --git a/src/main/java/com/googlesource/gerrit/plugins/gitiles/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/gitiles/HttpModule.java
index f1c34c6..a2d5c94 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/gitiles/HttpModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/gitiles/HttpModule.java
@@ -17,6 +17,7 @@
 import com.google.common.flogger.FluentLogger;
 import com.google.gerrit.server.CurrentUser;
 import com.google.gerrit.server.config.SitePaths;
+import com.google.gitiles.BranchRedirectFilter;
 import com.google.gitiles.GitilesAccess;
 import com.google.gitiles.GitilesServlet;
 import com.google.gitiles.GitilesUrls;
@@ -108,7 +109,17 @@
       GitilesUrls urls,
       GitilesAccess.Factory accessFactory,
       RepositoryResolver<HttpServletRequest> resolver) {
-    return new GitilesServlet(cfg, null, urls, accessFactory, resolver, null, null, null, null);
+    return new GitilesServlet(
+        cfg,
+        null,
+        urls,
+        accessFactory,
+        resolver,
+        null,
+        null,
+        null,
+        null,
+        new BranchRedirectFilter());
   }
 
   @Provides
diff --git a/src/main/java/com/googlesource/gerrit/plugins/gitiles/Module.java b/src/main/java/com/googlesource/gerrit/plugins/gitiles/PluginModule.java
similarity index 97%
rename from src/main/java/com/googlesource/gerrit/plugins/gitiles/Module.java
rename to src/main/java/com/googlesource/gerrit/plugins/gitiles/PluginModule.java
index 02f7eb7..5aab4cd 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/gitiles/Module.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/gitiles/PluginModule.java
@@ -47,11 +47,11 @@
 import org.eclipse.jgit.lib.Config;
 import org.eclipse.jgit.transport.resolver.RepositoryResolver;
 
-class Module extends LifecycleModule {
+class PluginModule extends LifecycleModule {
   private final boolean noWebLinks;
 
   @Inject
-  Module(PluginConfigFactory configFactory) {
+  PluginModule(PluginConfigFactory configFactory) {
     Config config = configFactory.getGlobalPluginConfig("gitiles");
     this.noWebLinks = config.getBoolean("gerrit", null, "noWebLinks", false);
   }
diff --git a/src/test/java/com/googlesource/gerrit/plugins/gitiles/ListProjectsAccessTest.java b/src/test/java/com/googlesource/gerrit/plugins/gitiles/ListProjectsAccessTest.java
index 839bd26..d8dee32 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/gitiles/ListProjectsAccessTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/gitiles/ListProjectsAccessTest.java
@@ -34,7 +34,7 @@
 import org.junit.After;
 import org.junit.Test;
 
-@TestPlugin(name = "gitiles", sysModule = "com.googlesource.gerrit.plugins.gitiles.Module")
+@TestPlugin(name = "gitiles", sysModule = "com.googlesource.gerrit.plugins.gitiles.PluginModule")
 public class ListProjectsAccessTest extends LightweightPluginDaemonTest {
   @ConfigSuite.Default
   public static Config defaultConfig() {
diff --git a/src/test/java/com/googlesource/gerrit/plugins/gitiles/RepositoryResolverAccessTest.java b/src/test/java/com/googlesource/gerrit/plugins/gitiles/RepositoryResolverAccessTest.java
index dc0e89d..110837f 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/gitiles/RepositoryResolverAccessTest.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/gitiles/RepositoryResolverAccessTest.java
@@ -35,7 +35,7 @@
 import org.junit.After;
 import org.junit.Test;
 
-@TestPlugin(name = "gitiles", sysModule = "com.googlesource.gerrit.plugins.gitiles.Module")
+@TestPlugin(name = "gitiles", sysModule = "com.googlesource.gerrit.plugins.gitiles.PluginModule")
 public class RepositoryResolverAccessTest extends LightweightPluginDaemonTest {
   @ConfigSuite.Default
   public static Config defaultConfig() {