This is an automated email from the ASF dual-hosted git repository.
dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/master by this push:
new ff6a4e8 Change default from joda to jsr310... no sense promoting the
use of joda anymore
ff6a4e8 is described below
commit ff6a4e8317689928056ed18805a944057ae666ad
Author: Daniel Kulp <[email protected]>
AuthorDate: Thu Mar 28 11:13:46 2019 -0400
Change default from joda to jsr310... no sense promoting the use of joda
anymore
---
build.sh | 43 ++++++++++++++++++++++
.../avro/compiler/specific/ProtocolTask.java | 2 +-
.../avro/compiler/specific/SpecificCompiler.java | 12 +++---
.../compiler/specific/TestSpecificCompiler.java | 24 ++++++------
lang/java/integration-test/codegen-test/pom.xml | 20 +++++++++-
.../codegentest/TestLogicalTypesWithDefaults.java | 3 +-
.../avro/codegentest/TestNestedLogicalTypes.java | 3 +-
.../avro/codegentest/TestNullableLogicalTypes.java | 2 +-
.../apache/avro/codegentest}/CustomDecimal.java | 0
.../avro/codegentest}/CustomDecimalConversion.java | 0
.../org/apache/avro/mojo/AbstractAvroMojo.java | 7 ++--
.../src/test/resources/unit/protocol/pom-joda.xml | 1 +
.../src/test/resources/unit/schema/pom-joda.xml | 1 +
.../org/apache/avro/tool/SpecificCompilerTool.java | 8 ++--
14 files changed, 95 insertions(+), 31 deletions(-)
diff --git a/build.sh b/build.sh
index 80fd837..003a164 100755
--- a/build.sh
+++ b/build.sh
@@ -197,6 +197,49 @@ do
(cd lang/perl; ./build.sh clean)
;;
+ veryclean)
+ rm -rf build dist
+ (cd doc; ant clean)
+
+ (mvn -B clean)
+ rm -rf lang/java/*/userlogs/
+ rm -rf lang/java/*/dependency-reduced-pom.xml
+
+ (cd lang/py; ant clean)
+ rm -rf lang/py/userlogs/
+
+ (cd lang/py3; python3 setup.py clean)
+ rm -rf lang/py3/dist
+ rm -rf lang/py3/avro_python3.egg-info
+ rm -f lang/py3/avro/*.avsc
+ rm -f lang/py3/avro/VERSION.txt
+ rm -rf lang/py3/avro/__pycache__/
+ rm -f lang/py3/avro/tests/interop.avsc
+ rm -rf lang/py3/avro/tests/__pycache__/
+
+ (cd lang/c; ./build.sh clean)
+
+ (cd lang/c++; ./build.sh clean)
+
+ (cd lang/csharp; ./build.sh clean)
+
+ (cd lang/js; ./build.sh clean)
+
+ (cd lang/ruby; ./build.sh clean)
+
+ (cd lang/php; ./build.sh clean)
+
+ (cd lang/perl; ./build.sh clean)
+ rm -rf lang/c++/build
+ rm -rf lang/c++/test?.df
+ rm -rf lang/js/node_modules
+ rm -rf lang/perl/inc/
+ rm -rf lang/ruby/.gem/
+ rm -rf lang/ruby/Gemfile.lock
+ rm -rf lang/py/lib/ivy-2.2.0.jar
+ rm -rf lang/csharp/src/apache/ipc.test/bin/
+ rm -rf lang/csharp/src/apache/ipc.test/obj
+ ;;
docker)
if [[ $1 =~ ^--args ]]; then
diff --git
a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/ProtocolTask.java
b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/ProtocolTask.java
index 6d18f11..6e870ac 100644
---
a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/ProtocolTask.java
+++
b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/ProtocolTask.java
@@ -37,7 +37,7 @@ public class ProtocolTask extends Task {
private File src;
private File dest = new File(".");
private StringType stringType = StringType.CharSequence;
- private DateTimeLogicalTypeImplementation dateTimeLogicalTypeImplementation
= DateTimeLogicalTypeImplementation.JODA;
+ private DateTimeLogicalTypeImplementation dateTimeLogicalTypeImplementation
= DateTimeLogicalTypeImplementation.DEFAULT;
private final ArrayList<FileSet> filesets = new ArrayList<>();
diff --git
a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
index e44879d..3ea7893 100644
---
a/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
+++
b/lang/java/compiler/src/main/java/org/apache/avro/compiler/specific/SpecificCompiler.java
@@ -115,7 +115,7 @@ public class SpecificCompiler {
}
};
- public static final DateTimeLogicalTypeImplementation DEFAULT = JODA;
+ public static final DateTimeLogicalTypeImplementation DEFAULT = JSR310;
abstract void addLogicalTypeConversions(SpecificData specificData);
}
@@ -162,7 +162,7 @@ public class SpecificCompiler {
+ " * DO NOT EDIT DIRECTLY\n" + " */\n";
public SpecificCompiler(Protocol protocol) {
- this(protocol, DateTimeLogicalTypeImplementation.JODA);
+ this(protocol, DateTimeLogicalTypeImplementation.DEFAULT);
}
public SpecificCompiler(Protocol protocol, DateTimeLogicalTypeImplementation
dateTimeLogicalTypeImplementation) {
@@ -175,7 +175,7 @@ public class SpecificCompiler {
}
public SpecificCompiler(Schema schema) {
- this(schema, DateTimeLogicalTypeImplementation.JODA);
+ this(schema, DateTimeLogicalTypeImplementation.DEFAULT);
}
public SpecificCompiler(Schema schema, DateTimeLogicalTypeImplementation
dateTimeLogicalTypeImplementation) {
@@ -185,13 +185,13 @@ public class SpecificCompiler {
}
/**
- * Creates a specific compiler with the default (Joda) type for date/time
+ * Creates a specific compiler with the default (JSR310) type for date/time
* related logical types.
*
* @see #SpecificCompiler(DateTimeLogicalTypeImplementation)
*/
SpecificCompiler() {
- this(DateTimeLogicalTypeImplementation.JODA);
+ this(DateTimeLogicalTypeImplementation.DEFAULT);
}
/**
@@ -465,7 +465,7 @@ public class SpecificCompiler {
for (File src : srcFiles) {
Schema schema = parser.parse(src);
- SpecificCompiler compiler = new SpecificCompiler(schema,
DateTimeLogicalTypeImplementation.JODA);
+ SpecificCompiler compiler = new SpecificCompiler(schema,
DateTimeLogicalTypeImplementation.DEFAULT);
compiler.compileToDestination(src, dest);
}
}
diff --git
a/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
index deb0628..d6fb7f0 100644
---
a/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
+++
b/lang/java/compiler/src/test/java/org/apache/avro/compiler/specific/TestSpecificCompiler.java
@@ -127,7 +127,7 @@ public class TestSpecificCompiler {
}
private SpecificCompiler createCompiler() throws IOException {
- return createCompiler(JODA);
+ return createCompiler(JSR310);
}
private SpecificCompiler createCompiler(
@@ -338,7 +338,7 @@ public class TestSpecificCompiler {
@Test
public void testJavaTypeWithDecimalLogicalTypeEnabled() throws Exception {
- SpecificCompiler compiler = createCompiler();
+ SpecificCompiler compiler = createCompiler(JODA);
compiler.setEnableDecimalLogicalType(true);
Schema dateSchema =
LogicalTypes.date().addToSchema(Schema.create(Schema.Type.INT));
@@ -363,7 +363,7 @@ public class TestSpecificCompiler {
@Test
public void testJavaTypeWithDecimalLogicalTypeDisabled() throws Exception {
- SpecificCompiler compiler = createCompiler();
+ SpecificCompiler compiler = createCompiler(JODA);
compiler.setEnableDecimalLogicalType(false);
Schema dateSchema =
LogicalTypes.date().addToSchema(Schema.create(Schema.Type.INT));
@@ -405,7 +405,7 @@ public class TestSpecificCompiler {
@Test
public void testJavaUnbox() throws Exception {
- SpecificCompiler compiler = createCompiler();
+ SpecificCompiler compiler = createCompiler(JODA);
compiler.setEnableDecimalLogicalType(false);
Schema intSchema = Schema.create(Schema.Type.INT);
@@ -530,7 +530,7 @@ public class TestSpecificCompiler {
@Test
public void
testGetUsedConversionClassesForNullableLogicalTypesInNestedRecord() throws
Exception {
- SpecificCompiler compiler = createCompiler();
+ SpecificCompiler compiler = createCompiler(JODA);
final Schema schema = new Schema.Parser().parse(
"{\"type\":\"record\",\"name\":\"NestedLogicalTypesRecord\",\"namespace\":\"org.apache.avro.codegentest.testdata\",\"doc\":\"Test
nested types with logical types in generated Java
classes\",\"fields\":[{\"name\":\"nestedRecord\",\"type\":{\"type\":\"record\",\"name\":\"NestedRecord\",\"fields\":[{\"name\":\"nullableDateField\",\"type\":[\"null\",{\"type\":\"int\",\"logicalType\":\"date\"}]}]}}]}");
@@ -542,7 +542,7 @@ public class TestSpecificCompiler {
@Test
public void testGetUsedConversionClassesForNullableLogicalTypesInArray()
throws Exception {
- SpecificCompiler compiler = createCompiler();
+ SpecificCompiler compiler = createCompiler(JODA);
final Schema schema = new Schema.Parser().parse(
"{\"type\":\"record\",\"name\":\"NullableLogicalTypesArray\",\"namespace\":\"org.apache.avro.codegentest.testdata\",\"doc\":\"Test
nested types with logical types in generated Java
classes\",\"fields\":[{\"name\":\"arrayOfLogicalType\",\"type\":{\"type\":\"array\",\"items\":[\"null\",{\"type\":\"int\",\"logicalType\":\"date\"}]}}]}");
@@ -554,7 +554,7 @@ public class TestSpecificCompiler {
@Test
public void
testGetUsedConversionClassesForNullableLogicalTypesInArrayOfRecords() throws
Exception {
- SpecificCompiler compiler = createCompiler();
+ SpecificCompiler compiler = createCompiler(JODA);
final Schema schema = new Schema.Parser().parse(
"{\"type\":\"record\",\"name\":\"NestedLogicalTypesArray\",\"namespace\":\"org.apache.avro.codegentest.testdata\",\"doc\":\"Test
nested types with logical types in generated Java
classes\",\"fields\":[{\"name\":\"arrayOfRecords\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"RecordInArray\",\"fields\":[{\"name\":\"nullableDateField\",\"type\":[\"null\",{\"type\":\"int\",\"logicalType\":\"date\"}]}]}}}]}");
@@ -566,7 +566,7 @@ public class TestSpecificCompiler {
@Test
public void
testGetUsedConversionClassesForNullableLogicalTypesInUnionOfRecords() throws
Exception {
- SpecificCompiler compiler = createCompiler();
+ SpecificCompiler compiler = createCompiler(JODA);
final Schema schema = new Schema.Parser().parse(
"{\"type\":\"record\",\"name\":\"NestedLogicalTypesUnion\",\"namespace\":\"org.apache.avro.codegentest.testdata\",\"doc\":\"Test
nested types with logical types in generated Java
classes\",\"fields\":[{\"name\":\"unionOfRecords\",\"type\":[\"null\",{\"type\":\"record\",\"name\":\"RecordInUnion\",\"fields\":[{\"name\":\"nullableDateField\",\"type\":[\"null\",{\"type\":\"int\",\"logicalType\":\"date\"}]}]}]}]}");
@@ -578,7 +578,7 @@ public class TestSpecificCompiler {
@Test
public void
testGetUsedConversionClassesForNullableLogicalTypesInMapOfRecords() throws
Exception {
- SpecificCompiler compiler = createCompiler();
+ SpecificCompiler compiler = createCompiler(JODA);
final Schema schema = new Schema.Parser().parse(
"{\"type\":\"record\",\"name\":\"NestedLogicalTypesMap\",\"namespace\":\"org.apache.avro.codegentest.testdata\",\"doc\":\"Test
nested types with logical types in generated Java
classes\",\"fields\":[{\"name\":\"mapOfRecords\",\"type\":{\"type\":\"map\",\"values\":{\"type\":\"record\",\"name\":\"RecordInMap\",\"fields\":[{\"name\":\"nullableDateField\",\"type\":[\"null\",{\"type\":\"int\",\"logicalType\":\"date\"}]}]},\"avro.java.string\":\"String\"}}]}");
@@ -593,7 +593,7 @@ public class TestSpecificCompiler {
Schema logicalTypesWithMultipleFields = new Schema.Parser()
.parse(new
File("src/test/resources/logical_types_with_multiple_fields.avsc"));
assertCompilesWithJavaCompiler(new File(OUTPUT_DIR.getRoot(),
name.getMethodName()),
- new SpecificCompiler(logicalTypesWithMultipleFields).compile());
+ new SpecificCompiler(logicalTypesWithMultipleFields, JODA).compile());
}
@Test
@@ -614,7 +614,7 @@ public class TestSpecificCompiler {
@Test
public void testConversionInstanceWithDecimalLogicalTypeDisabled() throws
Exception {
- SpecificCompiler compiler = createCompiler();
+ SpecificCompiler compiler = createCompiler(JODA);
compiler.setEnableDecimalLogicalType(false);
Schema dateSchema =
LogicalTypes.date().addToSchema(Schema.create(Schema.Type.INT));
@@ -637,7 +637,7 @@ public class TestSpecificCompiler {
@Test
public void testConversionInstanceWithDecimalLogicalTypeEnabled() throws
Exception {
- SpecificCompiler compiler = createCompiler();
+ SpecificCompiler compiler = createCompiler(JODA);
compiler.setEnableDecimalLogicalType(true);
Schema dateSchema =
LogicalTypes.date().addToSchema(Schema.create(Schema.Type.INT));
diff --git a/lang/java/integration-test/codegen-test/pom.xml
b/lang/java/integration-test/codegen-test/pom.xml
index 5f59370..a381ba9 100644
--- a/lang/java/integration-test/codegen-test/pom.xml
+++ b/lang/java/integration-test/codegen-test/pom.xml
@@ -71,7 +71,25 @@
</dependency>
</dependencies>
</plugin>
-
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>3.0.0</version>
+ <executions>
+ <execution>
+ <id>add-test-source</id>
+ <phase>generate-test-sources</phase>
+ <goals>
+ <goal>add-test-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+
<source>${project.basedir}/target/generated-test-sources/java</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git
a/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestLogicalTypesWithDefaults.java
b/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestLogicalTypesWithDefaults.java
index 20305d6..ca564a9 100644
---
a/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestLogicalTypesWithDefaults.java
+++
b/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestLogicalTypesWithDefaults.java
@@ -18,8 +18,9 @@
package org.apache.avro.codegentest;
+import java.time.LocalDate;
+
import org.apache.avro.codegentest.testdata.LogicalTypesWithDefaults;
-import org.joda.time.LocalDate;
import org.junit.Assert;
import org.junit.Test;
diff --git
a/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNestedLogicalTypes.java
b/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNestedLogicalTypes.java
index e21e67d..7d1fe29 100644
---
a/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNestedLogicalTypes.java
+++
b/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNestedLogicalTypes.java
@@ -17,8 +17,9 @@
*/
package org.apache.avro.codegentest;
+import java.time.LocalDate;
+
import org.apache.avro.codegentest.testdata.*;
-import org.joda.time.LocalDate;
import org.junit.Test;
import java.util.Collections;
diff --git
a/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNullableLogicalTypes.java
b/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNullableLogicalTypes.java
index 3270abe..18308ac 100644
---
a/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNullableLogicalTypes.java
+++
b/lang/java/integration-test/codegen-test/src/test/java/org/apache/avro/codegentest/TestNullableLogicalTypes.java
@@ -18,8 +18,8 @@
package org.apache.avro.codegentest;
+import java.time.LocalDate;
import org.apache.avro.codegentest.testdata.NullableLogicalTypes;
-import org.joda.time.LocalDate;
import org.junit.Test;
import java.io.IOException;
diff --git
a/lang/java/integration-test/test-custom-conversions/src/main/java/org.apache.avro.codegentest/CustomDecimal.java
b/lang/java/integration-test/test-custom-conversions/src/main/java/org/apache/avro/codegentest/CustomDecimal.java
similarity index 100%
rename from
lang/java/integration-test/test-custom-conversions/src/main/java/org.apache.avro.codegentest/CustomDecimal.java
rename to
lang/java/integration-test/test-custom-conversions/src/main/java/org/apache/avro/codegentest/CustomDecimal.java
diff --git
a/lang/java/integration-test/test-custom-conversions/src/main/java/org.apache.avro.codegentest/CustomDecimalConversion.java
b/lang/java/integration-test/test-custom-conversions/src/main/java/org/apache/avro/codegentest/CustomDecimalConversion.java
similarity index 100%
rename from
lang/java/integration-test/test-custom-conversions/src/main/java/org.apache.avro.codegentest/CustomDecimalConversion.java
rename to
lang/java/integration-test/test-custom-conversions/src/main/java/org/apache/avro/codegentest/CustomDecimalConversion.java
diff --git
a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
index 44f7343..d385200 100644
---
a/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
+++
b/lang/java/maven-plugin/src/main/java/org/apache/avro/mojo/AbstractAvroMojo.java
@@ -164,12 +164,11 @@ public abstract class AbstractAvroMojo extends
AbstractMojo {
/**
* Determines which type of classes to generate for date/time related logical
- * types. Either 'joda' or 'jsr310'. Defaults to joda for backwards
- * compatibility reasons.
+ * types. Either 'joda' or 'jsr310'. Defaults to jsr310.
*
- * @parameter default-value="joda"
+ * @parameter default-value="jsr310"
*/
- protected String dateTimeLogicalTypeImplementation =
DateTimeLogicalTypeImplementation.JODA.name().toLowerCase();
+ protected String dateTimeLogicalTypeImplementation =
DateTimeLogicalTypeImplementation.JSR310.name().toLowerCase();
/**
* The current Maven project.
diff --git
a/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-joda.xml
b/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-joda.xml
index 0282e4d..6aa1372 100644
--- a/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-joda.xml
+++ b/lang/java/maven-plugin/src/test/resources/unit/protocol/pom-joda.xml
@@ -46,6 +46,7 @@
<configuration>
<sourceDirectory>${basedir}/src/test/avro</sourceDirectory>
<outputDirectory>${basedir}/target/test-harness/protocol-joda</outputDirectory>
+
<dateTimeLogicalTypeImplementation>joda</dateTimeLogicalTypeImplementation>
<project
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub"/>
</configuration>
</plugin>
diff --git a/lang/java/maven-plugin/src/test/resources/unit/schema/pom-joda.xml
b/lang/java/maven-plugin/src/test/resources/unit/schema/pom-joda.xml
index 2d433b0..90fab86 100644
--- a/lang/java/maven-plugin/src/test/resources/unit/schema/pom-joda.xml
+++ b/lang/java/maven-plugin/src/test/resources/unit/schema/pom-joda.xml
@@ -50,6 +50,7 @@
<import>${basedir}/src/test/avro/imports</import>
<import>${basedir}/src/test/avro/directImport/PrivacyDirectImport.avsc</import>
</imports>
+
<dateTimeLogicalTypeImplementation>joda</dateTimeLogicalTypeImplementation>
<project
implementation="org.apache.maven.plugin.testing.stubs.MavenProjectStub"/>
</configuration>
</plugin>
diff --git
a/lang/java/tools/src/main/java/org/apache/avro/tool/SpecificCompilerTool.java
b/lang/java/tools/src/main/java/org/apache/avro/tool/SpecificCompilerTool.java
index 711f961..c8e51a1 100644
---
a/lang/java/tools/src/main/java/org/apache/avro/tool/SpecificCompilerTool.java
+++
b/lang/java/tools/src/main/java/org/apache/avro/tool/SpecificCompilerTool.java
@@ -53,8 +53,8 @@ public class SpecificCompilerTool implements Tool {
System.err.println(" -string - use java.lang.String instead of Utf8");
System.err
.println(" -bigDecimal - use java.math.BigDecimal for " + "decimal
type instead of java.nio.ByteBuffer");
- System.err.println(" -dateTimeLogicalTypeImpl [joda|jsr310] - use either
"
- + "Joda time classes (default) or Java 8 native date/time classes
(JSR 310)");
+ System.err.println(" -dateTimeLogicalTypeImpl [jsr310|joda] - use either
"
+ + "Java 8 native date/time classes (JSR 310)(default) or Joda time
classes");
System.err.println(" -templateDir - directory with custom Velocity
templates");
return 1;
}
@@ -114,14 +114,14 @@ public class SpecificCompilerTool implements Tool {
for (File src : determineInputs(inputs, SCHEMA_FILTER)) {
Schema schema = parser.parse(src);
SpecificCompiler compiler = new SpecificCompiler(schema,
-
dateTimeLogicalTypeImplementation.orElse(DateTimeLogicalTypeImplementation.JODA));
+
dateTimeLogicalTypeImplementation.orElse(DateTimeLogicalTypeImplementation.DEFAULT));
executeCompiler(compiler, encoding, stringType, useLogicalDecimal,
templateDir, src, output);
}
} else if ("protocol".equals(method)) {
for (File src : determineInputs(inputs, PROTOCOL_FILTER)) {
Protocol protocol = Protocol.parse(src);
SpecificCompiler compiler = new SpecificCompiler(protocol,
-
dateTimeLogicalTypeImplementation.orElse(DateTimeLogicalTypeImplementation.JODA));
+
dateTimeLogicalTypeImplementation.orElse(DateTimeLogicalTypeImplementation.DEFAULT));
executeCompiler(compiler, encoding, stringType, useLogicalDecimal,
templateDir, src, output);
}
} else {