Skip to content
Permalink
Browse files
  • Loading branch information
SilverNarcissus committed Nov 26, 2019
2 parents a8ff3ca + ed598fd commit 1602a9382040a7f8285f59dba5e4dd015d0f1705
Showing 28 changed files with 637 additions and 103 deletions.
@@ -1,30 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
* Copyright 2007-present the original author or authors.
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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
*
* 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.
* 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.
*/
import java.net.*;
import java.io.*;
import java.nio.channels.*;
import java.util.Properties;

public class MavenWrapperDownloader {

private static final String WRAPPER_VERSION = "0.5.5";
/**
* Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
*/
private static final String DEFAULT_DOWNLOAD_URL =
"https://repo1.maven.org/maven2/io/takari/maven-wrapper/0.5.3/maven-wrapper-0.5.3.jar";
private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
+ WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";

/**
* Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
@@ -45,37 +46,40 @@ public class MavenWrapperDownloader {
private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";

public static void main(String args[]) {
System.out.println("- Downloader started");
File baseDirectory = new File(args[0]);
System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());

// If the maven-wrapper.properties exists, read it and check if it contains a custom
// wrapperUrl parameter.
File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
String url = DEFAULT_DOWNLOAD_URL;
if (mavenWrapperPropertyFile.exists()) {
if(mavenWrapperPropertyFile.exists()) {
FileInputStream mavenWrapperPropertyFileInputStream = null;
try {
mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
Properties mavenWrapperProperties = new Properties();
mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
} catch (IOException e) {
System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
} finally {
try {
if (mavenWrapperPropertyFileInputStream != null) {
if(mavenWrapperPropertyFileInputStream != null) {
mavenWrapperPropertyFileInputStream.close();
}
} catch (IOException e) {
// Ignore ...
}
}
}
System.out.println("- Downloading from: " + url);

File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
if (!outputFile.getParentFile().exists()) {
if (!outputFile.getParentFile().mkdirs()) {
if(!outputFile.getParentFile().exists()) {
if(!outputFile.getParentFile().mkdirs()) {
System.out.println(
"- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath()
+ "'");
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
@@ -91,6 +95,16 @@ public static void main(String args[]) {
}

private static void downloadFileFromURL(String urlString, File destination) throws Exception {
if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
String username = System.getenv("MVNW_USERNAME");
char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
Authenticator.setDefault(new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
}
URL website = new URL(urlString);
ReadableByteChannel rbc;
rbc = Channels.newChannel(website.openStream());
@@ -100,4 +114,4 @@ private static void downloadFileFromURL(String urlString, File destination) thro
rbc.close();
}

}
}
@@ -91,9 +91,9 @@ matrix:

- os: windows
language: c
name: win-oraclejdk8
name: win-openjdk11
before_install:
- choco install jdk8 -params 'installdir=c:\\jdk8'
- choco install openjdk11 --version=11.0.4.111 -y
- wget --no-check-certificate https://www-eu.apache.org/dist/maven/maven-3/3.6.2/binaries/apache-maven-3.6.2-bin.zip
- /C/Progra~1/7-Zip/7z.exe x apache-maven-3.6.2-bin.zip -o/c/mvn362
- mkdir C:\hadoop\bin
@@ -120,9 +120,9 @@ matrix:
- wget --no-check-certificate https://github.com/cdarlint/winutils/raw/master/hadoop-2.7.3/bin/yarn.cmd -o C:\hadoop\bin

before_script:
- export "JAVA_HOME=/c/jdk8"
- export "PATH=/c/jdk8/bin:$PATH"
- export "PATH=/c/jdk8/jre/bin:$PATH"
- export "JAVA_HOME=/C/Program Files/OpenJDK/openjdk-11u-11.0.4_11"
- export "PATH=$JAVA_HOME/bin:$PATH"
- export "PATH=$JAVA_HOME/jre/bin:$PATH"
- export "MAVEN_HOME=/c/mvn362/apache-maven-3.6.2"
- export "M2_HOME=/c/mvn362/apache-maven-3.6.2"
- export "PATH=/c/mvn362/apache-maven-3.6.2/bin:$PATH"
@@ -133,7 +133,7 @@ matrix:
- mvn -version
# Output something every 10 minutes or Travis kills the job
- while sleep 540; do echo "=====[ $SECONDS seconds still running ]====="; done &
- mvn -B clean integration-test
- travis_wait 40 mvn -B clean integration-test
# Killing background sleep loop
- kill %1

@@ -217,6 +217,13 @@ The following classes are modified from Apache Hive, which is under Apache Licen

------------

The following class is copied from maven-wrapper (https://github.com/takari/maven-wrapper),
which is under Apache License 2.0:

./.mvn/wrapper/MavenWrapperDownloader.java

------------

The following class is modified from Apache commons-collections

./tsfile/src/main/java/org/apache/iotdb/tsfile/utils/Murmur128Hash.java
@@ -116,6 +116,11 @@
<artifactId>jfreechart</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>com.clearspring.analytics</groupId>
<artifactId>stream</artifactId>
<version>2.9.5</version>
</dependency>
</dependencies>
<build>
<plugins>
@@ -109,6 +109,7 @@ timestamp_precision=ms
# 1. SequenceStrategy: the system will choose the directory in sequence.
# 2. MaxDiskUsableSpaceFirstStrategy: the system will choose the directory whose disk has the maximum space.
# 3. MinFolderOccupiedSpaceFirstStrategy: the system will choose the directory whose folder has the minimum occupied space.
# 4. RandomOnDiskUsableSpaceStrategy: the system will randomly choose the directory based on usable space of disks. The more usable space, the greater the chance of being chosen;
# Set SequenceStrategy,MaxDiskUsableSpaceFirstStrategy and MinFolderOccupiedSpaceFirstStrategy to apply the corresponding strategy.
# If this property is unset, system will use MaxDiskUsableSpaceFirstStrategy as default strategy.
# For this property, fully-qualified class name (include package name) and simple class name are both acceptable.
@@ -22,30 +22,14 @@ echo ````````````````````````
echo Starting IoTDB
echo ````````````````````````

PATH %PATH%;%JAVA_HOME%\bin\

set PATH="%JAVA_HOME%\bin\";%PATH%
set "FULL_VERSION="
set "MAJOR_VERSION="
set "MINOR_VERSION="

if "%OS%" == "Windows_NT" setlocal

pushd %~dp0..
if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%cd%
popd

set IOTDB_CONF=%IOTDB_HOME%\conf
set IOTDB_LOGS=%IOTDB_HOME%\logs

IF EXIST "%IOTDB_CONF%\iotdb-env.bat" (
CALL "%IOTDB_CONF%\iotdb-env.bat"
) ELSE (
echo "can't find %IOTDB_CONF%\iotdb-env.bat"
)

if NOT DEFINED MAIN_CLASS set MAIN_CLASS=org.apache.iotdb.db.service.IoTDB
if NOT DEFINED JAVA_HOME goto :err

for /f tokens^=2-5^ delims^=.-_+^" %%j in ('%JAVA_HOME%\bin\java -fullversion 2^>^&1') do (
for /f tokens^=2-5^ delims^=.-_+^" %%j in ('java -fullversion 2^>^&1') do (
set "FULL_VERSION=%%j-%%k-%%l-%%m"
IF "%%j" == "1" (
set "MAJOR_VERSION=%%k"
@@ -65,6 +49,24 @@ IF NOT %JAVA_VERSION% == 8 (
)
)

if "%OS%" == "Windows_NT" setlocal

pushd %~dp0..
if NOT DEFINED IOTDB_HOME set IOTDB_HOME=%cd%
popd

set IOTDB_CONF=%IOTDB_HOME%\conf
set IOTDB_LOGS=%IOTDB_HOME%\logs

IF EXIST "%IOTDB_CONF%\iotdb-env.bat" (
CALL "%IOTDB_CONF%\iotdb-env.bat"
) ELSE (
echo "can't find %IOTDB_CONF%\iotdb-env.bat"
)

if NOT DEFINED MAIN_CLASS set MAIN_CLASS=org.apache.iotdb.db.service.IoTDB
if NOT DEFINED JAVA_HOME goto :err

@REM -----------------------------------------------------------------------------
@REM JVM Opts we'll use in legacy run or installation
set JAVA_OPTS=-ea^
@@ -78,7 +80,7 @@ set JAVA_OPTS=-ea^
set CLASSPATH="%IOTDB_HOME%\lib"

@REM For each jar in the IOTDB_HOME lib directory call append to build the CLASSPATH variable.
set CLASSPATH=%CLASSPATH%;"%IOTDB_HOME%\lib\*"
for %%i in ("%IOTDB_HOME%\lib\*.jar") do call :append "%%i"
set CLASSPATH=%CLASSPATH%;iotdb.IoTDB
goto okClasspath

@@ -104,4 +106,4 @@ pause

pause

ENDLOCAL
ENDLOCAL

0 comments on commit 1602a93

Please sign in to comment.