Skip to content

Commit

Permalink
Merge branch 'master' into katbohm-patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
penmetsaa committed Oct 28, 2022
2 parents 72e724d + 8a0b8c4 commit 8b103b0
Show file tree
Hide file tree
Showing 83 changed files with 24,675 additions and 24,600 deletions.
5 changes: 5 additions & 0 deletions README.md
Expand Up @@ -57,6 +57,11 @@ delay after the GitHub release.

Last demo update: v8.12.56.

Note: Eventhough the library (main branch/[maven release](https://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber/8.12.56/))
is at v8.12.57, because of some deployment issues, we were unable to update the
Java demo with the new binary version. We will soon fix this. Meantime, please
use JS demo.

If this number is lower than the [latest release's version
number](https://github.com/google/libphonenumber/releases), we are between
releases and the demo may be at either version.
Expand Down
13 changes: 4 additions & 9 deletions cpp/README
Expand Up @@ -87,18 +87,13 @@ Requirements:
so you might need to download and install it manually.

Find and download the Debian packages for your system. For example:
http://packages.ubuntu.com/utopic/libre2-1
http://packages.ubuntu.com/utopic/libre2-dev
https://packages.ubuntu.com/search?keywords=libre2-9
https://packages.ubuntu.com/search?keywords=libre2-dev

You need to download both the libre2-dev and libre2-1 packages.
Once downloaded, install them with:
$ sudo dpkg -i libre2*.deb

If you want to install it from source, it's available via Mercurial at:
https://re2.googlecode.com/hg
however precise instructions on building and installing are outside the
scope of this document.

- ICU
Installation:
$ sudo apt-get install libicu-dev
Expand Down Expand Up @@ -127,7 +122,7 @@ Requirements:
- Windows Win32 synchronization API.

If you access libphonenumber from a single thread, you don't need one of
these solution.
these solutions.

You can install it very easily on a Debian-based GNU/Linux distribution:
$ sudo apt-get install libboost-dev libboost-thread-dev libboost-system-dev
Expand All @@ -145,7 +140,7 @@ Requirements:
Installation:
- Official [installation guide](https://abseil.io/docs/cpp/tools/cmake-installs).
Something that we followed in Linux system.
$ git clone https://github.com/abseil/abseil-cpp.git --branch 273292d --single-branch
$ git clone https://github.com/abseil/abseil-cpp.git
$ cd abseil-cpp
$ cmake . -DCMAKE_INSTALL_PREFIX="$HOME/lpn-deps" -DCMAKE_POSITION_INDEPENDENT_CODE=ON
$ cmake --build . --target install
Expand Down
23,545 changes: 11,773 additions & 11,772 deletions cpp/src/phonenumbers/lite_metadata.cc

Large diffs are not rendered by default.

25,192 changes: 12,596 additions & 12,596 deletions cpp/src/phonenumbers/metadata.cc

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cpp/src/phonenumbers/regexp_adapter_re2.cc
Expand Up @@ -129,7 +129,7 @@ class RE2RegExp : public RegExp {
matched_string, NULL, NULL, NULL, NULL, NULL);
} else {
return DispatchRE2Call(RE2::PartialMatchN, input_string, utf8_regexp_,
matched_string, NULL, NULL), NULL, NULL, NULL);
matched_string, NULL, NULL, NULL, NULL, NULL);
}
}

Expand Down
2 changes: 1 addition & 1 deletion cpp/src/phonenumbers/test_metadata.cc
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#include "phonenumbers/metadata.h"
#include "phonenumbers/test_metadata.h"

namespace i18n {
namespace phonenumbers {
Expand Down
8 changes: 4 additions & 4 deletions java/carrier/pom.xml
Expand Up @@ -3,14 +3,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>carrier</artifactId>
<version>1.183-SNAPSHOT</version>
<version>1.184-SNAPSHOT</version>
<packaging>jar</packaging>
<url>https://github.com/google/libphonenumber/</url>

<parent>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>libphonenumber-parent</artifactId>
<version>8.12.57-SNAPSHOT</version>
<version>8.12.58-SNAPSHOT</version>
</parent>

<build>
Expand Down Expand Up @@ -55,12 +55,12 @@
<dependency>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>libphonenumber</artifactId>
<version>8.12.57-SNAPSHOT</version>
<version>8.12.58-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>prefixmapper</artifactId>
<version>2.193-SNAPSHOT</version>
<version>2.194-SNAPSHOT</version>
</dependency>
</dependencies>

Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified java/carrier/src/com/google/i18n/phonenumbers/carrier/data/27_en
Binary file not shown.
Binary file modified java/carrier/src/com/google/i18n/phonenumbers/carrier/data/34_en
Binary file not shown.
Binary file modified java/carrier/src/com/google/i18n/phonenumbers/carrier/data/47_en
Binary file not shown.
Binary file modified java/carrier/src/com/google/i18n/phonenumbers/carrier/data/594_en
Binary file not shown.
Binary file modified java/carrier/src/com/google/i18n/phonenumbers/carrier/data/65_en
Binary file not shown.
Binary file not shown.
Binary file added java/demo/.readme_res/App_Engine_Run_Config.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 31 additions & 2 deletions java/demo/README.md
@@ -1,4 +1,6 @@
## Prerequisite:
# Running the demo

## 1. Install Google Cloud SDK

### Linux

Expand All @@ -16,6 +18,33 @@

`$ gcloud components install app-engine-java`

## How to regenerate the WAR, deploy and run in appengine?
## 2. Add IDE Plugin

### Intellij

Install [Cloud Code Plugin for Intellij](https://plugins.jetbrains.com/plugin/8079-cloud-code)

_If you have worked with the App Engine Plugin before,
please [migrate](https://cloud.google.com/code/docs/intellij/migrate)._

### Eclipse

Install [Cloud Code Plugin for Eclipse](https://marketplace.eclipse.org/content/google-cloud-tools-eclipse)

### Visual Studio Code

Install [Cloud Code Plugin for Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=GoogleCloudTools.cloudcode&ssr=false#overview)

## 3. Run

Most IDEs should autodetect your configuration after installing the plugin (and
restart)

![App Engine Run Config](.readme_res/App_Engine_Run_Config.png)

## (Optional) Run Natively

This is _not recommended_ with an IDE as you have to manage updating your
artifacts yourself, it does not support live reload

`$ mvn appengine:run`
96 changes: 61 additions & 35 deletions java/demo/pom.xml
Expand Up @@ -3,13 +3,13 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>demo</artifactId>
<version>8.12.57-SNAPSHOT</version>
<version>8.12.58-SNAPSHOT</version>
<packaging>war</packaging>
<url>https://github.com/google/libphonenumber/</url>
<parent>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>libphonenumber-parent</artifactId>
<version>8.12.57-SNAPSHOT</version>
<version>8.12.58-SNAPSHOT</version>
</parent>

<properties>
Expand All @@ -20,7 +20,9 @@
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<archiveClasses>true</archiveClasses>
<soy.root>src/main/resources/com/google/phonenumbers/demo</soy.root>
<soy.root>${project.basedir}/src/main/resources/com/google/phonenumbers/demo</soy.root>
<soy.srcs>${soy.root}/input_form.soy,${soy.root}/result.soy,${soy.root}/result_error.soy,${soy.root}/result_file.soy</soy.srcs>
<soy.output.dir>${project.build.directory}/${project.build.finalName}/WEB-INF/lib/</soy.output.dir>
<soy.package>com.google.phonenumbers.demo.template</soy.package>
</properties>

Expand All @@ -36,9 +38,9 @@
<version>2022-07-20</version>
</dependency>
<dependency>
<artifactId>appengine-api-1.0-sdk</artifactId>
<groupId>com.google.appengine</groupId>
<version>2.0.8</version>
<artifactId>appengine-maven-plugin</artifactId>
<groupId>com.google.cloud.tools</groupId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Expand All @@ -65,50 +67,24 @@
<dependency>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>libphonenumber</artifactId>
<version>8.12.57-SNAPSHOT</version>
<version>8.12.58-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>geocoder</artifactId>
<version>2.193-SNAPSHOT</version>
<version>2.194-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.googlecode.libphonenumber</groupId>
<artifactId>carrier</artifactId>
<version>1.183-SNAPSHOT</version>
<version>1.184-SNAPSHOT</version>
</dependency>
</dependencies>

<build>
<!-- for hot reload of the web application-->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>com.google.template.soy.SoyParseInfoGenerator</mainClass>
<arguments>
<argument>--generateInvocationBuilders</argument>
<argument>--javaPackage</argument>
<argument>${soy.package}</argument>
<argument>--javaClassNameSource</argument>
<argument>filename</argument>
<argument>--srcs</argument>
<argument>${soy.root}/input_form.soy,${soy.root}/result.soy,${soy.root}/result_error.soy,${soy.root}/result_file.soy</argument>
<argument>--outputDirectory</argument>
<argument>src/main/java/com/google/phonenumbers/demo/template/</argument>
</arguments>
</configuration>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
Expand All @@ -124,6 +100,56 @@
</configuration>
<groupId>org.apache.maven.plugins</groupId>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<!-- soy-parser generates template classes in
com.google.phonenumbers.demo.template package and isn't tied to a
build lifecycle, i.e. it needs to be run manually with
"mvn exec:java@soy-parser" -->
<id>soy-parser</id>
<goals>
<goal>java</goal>
</goals>
<configuration>
<mainClass>com.google.template.soy.SoyParseInfoGenerator</mainClass>
<arguments>
<argument>--generateInvocationBuilders</argument>
<argument>--javaPackage</argument>
<argument>${soy.package}</argument>
<argument>--javaClassNameSource</argument>
<argument>filename</argument>
<argument>--srcs</argument>
<argument>${soy.srcs}</argument>
<argument>--outputDirectory</argument>
<argument>${project.basedir}/src/main/java/com/google/phonenumbers/demo/template/</argument>
</arguments>
</configuration>
</execution>
<execution>
<!-- soy-compiler compiles templates so that we can use SoySauce
instead of Tofu and it's tied to the build lifecycle (it's part of
install phase). -->
<id>soy-compiler</id>
<goals>
<goal>java</goal>
</goals>
<phase>install</phase>
<configuration>
<mainClass>com.google.template.soy.SoyToJbcSrcCompiler</mainClass>
<arguments>
<argument>--srcs</argument>
<argument>${soy.srcs}</argument>
<argument>--output</argument>
<argument>${soy.output.dir}/soy-templates.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
Expand Down
Expand Up @@ -30,7 +30,6 @@ public class ErrorRenderer extends LibPhoneNumberRenderer<Error> {

public ErrorRenderer(
String phoneNumber, String defaultCountry, Locale geocodingLocale, String error) {
super("result_error.soy", "com.google.phonenumbers.demo.error");
this.phoneNumber = phoneNumber;
this.defaultCountry = defaultCountry;
this.geocodingLocale = geocodingLocale;
Expand Down
Expand Up @@ -23,10 +23,6 @@

public class InputFormRenderer extends LibPhoneNumberRenderer<InputForm> {

public InputFormRenderer() {
super("input_form.soy", "com.google.phonenumbers.demo.inputForm");
}

@Override
public String genHtml() {
return super.render(
Expand Down
Expand Up @@ -18,32 +18,15 @@

package com.google.phonenumbers.demo.render;

import com.google.template.soy.SoyFileSet;
import com.google.template.soy.data.SoyTemplate;
import com.google.template.soy.tofu.SoyTofu;
import java.net.URL;
import com.google.template.soy.jbcsrc.api.SoySauce;
import com.google.template.soy.jbcsrc.api.SoySauceBuilder;

public abstract class LibPhoneNumberRenderer<T extends SoyTemplate> {
private final String template;
private final String namespace;

public LibPhoneNumberRenderer(String template, String namespace) {
this.template = template;
this.namespace = namespace;
}

private URL getResource() {
return LibPhoneNumberRenderer.class.getResource("../" + template);
}

String render(T soyTemplate) {
SoyFileSet sfs = SoyFileSet.builder().add(getResource()).build();
SoyTofu tofu = sfs.compileToTofu();
// For convenience, create another SoyTofu object that has a
// namespace specified, so you can pass partial template names to
// the newRenderer() method.
SoyTofu simpleTofu = tofu.forNamespace(namespace);
return simpleTofu.newRenderer(soyTemplate).render();
SoySauce soySauce = new SoySauceBuilder().build();
return soySauce.newRenderer(soyTemplate).renderHtml().get().toString();
}

public abstract String genHtml();
Expand Down
Expand Up @@ -31,7 +31,6 @@ public class ResultFileRenderer extends LibPhoneNumberRenderer<File> {
private final PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();

public ResultFileRenderer(String defaultCountry, String fileContents) {
super("result_file.soy", "com.google.phonenumbers.demo.file");
this.fileContents = fileContents;
this.defaultCountry = defaultCountry;
}
Expand Down
Expand Up @@ -43,7 +43,6 @@ public class ResultRenderer extends LibPhoneNumberRenderer<SingleNumber> {

public ResultRenderer(
String phoneNumber, String defaultCountry, Locale geocodingLocale, PhoneNumber number) {
super("result.soy", "com.google.phonenumbers.demo.singleNumber");
this.phoneNumber = phoneNumber;
this.defaultCountry = defaultCountry;
this.geocodingLocale = geocodingLocale;
Expand Down
7 changes: 4 additions & 3 deletions java/demo/src/main/webapp/WEB-INF/web.xml
Expand Up @@ -19,7 +19,8 @@
<servlet-name>Input</servlet-name>
<url-pattern>/inputform</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>Input</welcome-file>
</welcome-file-list>
<servlet-mapping>
<servlet-name>Input</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

0 comments on commit 8b103b0

Please sign in to comment.