Upgrade versions of dependencies. Upgrade tzdata, CLDR and UnicodeData

This commit is contained in:
Alexey Andreev 2017-06-18 22:33:27 +03:00
parent 40b29cdfa1
commit daa5384e97
12 changed files with 7368 additions and 135 deletions

View File

@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="teavm-tz-cache" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="org.teavm.classlib.impl.tz.TimeZoneCache" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="classlib/target/classes/org/teavm/classlib/impl/tz/cache" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="teavm-classlib" />
<envs />
<method />
</configuration>
</component>

View File

@ -23,16 +23,13 @@ import java.util.List;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Set;
import org.teavm.backend.javascript.spi.GeneratedBy;
import org.teavm.classlib.impl.Base46;
import org.teavm.classlib.impl.CharFlow;
import org.teavm.jso.JSBody;
import org.teavm.platform.metadata.MetadataProvider;
import org.teavm.platform.metadata.ResourceMap;
/**
*
* @author Alexey Andreev
*/
public final class DateTimeZoneProvider {
private static Map<String, DateTimeZone> cache = new HashMap<>();
@ -75,7 +72,14 @@ public final class DateTimeZoneProvider {
return ids.toArray(new String[ids.size()]);
}
@GeneratedBy(DateTimeZoneProviderGenerator.class)
private static native boolean timeZoneDetectionEnabled();
public static DateTimeZone detectTimezone() {
if (!timeZoneDetectionEnabled()) {
return null;
}
List<Score> zones = new ArrayList<>();
long time = System.currentTimeMillis();
int offset = -getNativeOffset(System.currentTimeMillis());
@ -123,11 +127,7 @@ public final class DateTimeZoneProvider {
scoreTable.remove(score);
continue;
}
List<Score> prevZones = zoneMap.get(prev);
if (prevZones == null) {
prevZones = new ArrayList<>();
zoneMap.put(prev, prevZones);
}
List<Score> prevZones = zoneMap.computeIfAbsent(prev, k -> new ArrayList<>());
prevZones.add(score);
if (timeInQueue.add(prev)) {
queue.add(prev);

View File

@ -0,0 +1,31 @@
/*
* Copyright 2017 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.classlib.impl.tz;
import java.io.IOException;
import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.backend.javascript.spi.Generator;
import org.teavm.backend.javascript.spi.GeneratorContext;
import org.teavm.model.MethodReference;
public class DateTimeZoneProviderGenerator implements Generator {
@Override
public void generate(GeneratorContext context, SourceWriter writer, MethodReference methodRef) throws IOException {
boolean autodetect = Boolean.parseBoolean(
context.getProperties().getProperty("java.util.TimeZone.autodetect", "false"));
writer.append("return " + Boolean.toString(autodetect) + ";");
}
}

View File

@ -29,7 +29,7 @@ import org.teavm.platform.metadata.MetadataGeneratorContext;
import org.teavm.platform.metadata.ResourceMap;
public class TimeZoneGenerator implements MetadataGenerator {
public static final String TIMEZONE_DB_VERSION = "2015d";
public static final String TIMEZONE_DB_VERSION = "2017b";
public static final String TIMEZONE_DB_PATH = "org/teavm/classlib/impl/tz/tzdata" + TIMEZONE_DB_VERSION + ".zip";
public static void compile(ZoneInfoCompiler compiler, ClassLoader classLoader) {

View File

@ -21,7 +21,6 @@ import org.teavm.classlib.impl.tz.DateTimeZone;
import org.teavm.classlib.impl.tz.DateTimeZoneProvider;
import org.teavm.classlib.impl.tz.FixedDateTimeZone;
import org.teavm.classlib.impl.unicode.CLDRHelper;
import org.teavm.classlib.java.lang.TThreadInterruptHandler;
/**
* {@code TimeZone} represents a time zone offset, taking into account
@ -153,9 +152,11 @@ public abstract class TTimeZone implements Serializable, Cloneable {
*/
public static TTimeZone getDefault() {
if (defaultTz == null) {
//defaultTz = new TIANATimeZone(DateTimeZoneProvider.detectTimezone());
defaultTz = new TIANATimeZone(DateTimeZoneProvider.detectTimezone());
if (defaultTz == null) {
defaultTz = TTimeZone.getTimeZone("UTC");
}
}
return (TTimeZone) defaultTz.clone();
}

View File

@ -135,7 +135,7 @@
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm-debug-all</artifactId>
<version>5.0.4</version>
<version>5.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>

View File

@ -30,7 +30,7 @@
<description>A sample application written in Kotlin and compiled by TeaVM</description>
<properties>
<kotlin.version>1.0.3</kotlin.version>
<kotlin.version>1.1.2-5</kotlin.version>
</properties>
<dependencies>

View File

@ -15,7 +15,7 @@
<properties>
<java.version>1.8</java.version>
<scala.version>2.11.7</scala.version>
<scala.version>2.12.2</scala.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>