Skip to content
/ titan Public
forked from titan-data/titan

Commit

Permalink
Initial OSS Release (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek Smart authored and mcred committed Oct 31, 2019
1 parent 3af1f7d commit fecec27
Show file tree
Hide file tree
Showing 111 changed files with 5,625 additions and 7 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# OS Generated files
.DS_Store

# IntelliJ files
/.idea
/titan.iml

# Generated files
target
bin
coverage
/titan
/titan*.zip
releases

# Development files
/notes
/.env

# Jenkins
.gradle
117 changes: 117 additions & 0 deletions .mvn/wrapper/MavenWrapperDownloader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/*
* Copyright 2007-present the original author or authors.
*
* 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.
*/
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://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
* use instead of the default one.
*/
private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
".mvn/wrapper/maven-wrapper.properties";

/**
* Path where the maven-wrapper.jar will be saved to.
*/
private static final String MAVEN_WRAPPER_JAR_PATH =
".mvn/wrapper/maven-wrapper.jar";

/**
* Name of the property which should be used to override the default download url for the wrapper.
*/
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()) {
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) {
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()) {
System.out.println(
"- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
}
}
System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
try {
downloadFileFromURL(url, outputFile);
System.out.println("Done");
System.exit(0);
} catch (Throwable e) {
System.out.println("- Error downloading");
e.printStackTrace();
System.exit(1);
}
}

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());
FileOutputStream fos = new FileOutputStream(destination);
fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
fos.close();
rbc.close();
}

}
Binary file added .mvn/wrapper/maven-wrapper.jar
Binary file not shown.
2 changes: 2 additions & 0 deletions .mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.1/apache-maven-3.6.1-bin.zip
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
23 changes: 19 additions & 4 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,32 @@ For general information about contributing changes, see the

## How it Works

Describe the internal mechanisms necessary for developers to understand how
to get started making changes.
Titan is written with Kotlin for JVM and binaries are compiled using GraalVM.

## Requirements
* openjdk 1.8.0_212 (see notes for GraalVM)
* [GraalVM](https://www.graalvm.org/)

###Setting up GraalVM
* [Install GraalVM](https://www.graalvm.org/docs/getting-started/#install-graalvm)
* Set JAVA_HOME to be the openjdk include with GraalVM
* Add the GraalVM bin directory to your PATH

## Building
```bash
./mvnw clean install
java -jar ./target/titan-VERSION-jar-with-dependencies.jar
```

Describe how to build the project.
Once the jar is created, native binaries can be built with the following scripts.
```bash
./scripts/build-osx.sh
./scripts/build-linux.sh

## Testing

Describe how to test the project.

## Releasing

Describe how to generate new releases.
The version for the CLI is maintained with the `VERSION` file. Bump the version in this file and then run `./scripts/compile-maven.sh` to update the version in the POM.xml file and build a new versioned jar. Currently, an OSX binary release file needs to be committed to a proper release directory. If you are on OSX, run `./scripts/build-osx.sh` to create this file. CI/CD will handle the rest of the builds.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM oracle/graalvm-ce:19.0.0
RUN gu install native-image
RUN yum install zip -y
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# About this Project
# Titan
## Your Code. Your Environment. Your Data.
## <a id="getting-started"></a> Getting Started

Describe the project for users.
### <a id="requirements"></a> Requirements
Before downloading Titan, be sure that you have the appropriate Docker Desktop Client installed and running for your operating system.
* [Docker Desktop Client](https://www.docker.com/products/docker-desktop)

## Contributing
### <a id="installation"></a> Installation
The available downloads are listed on the [releases](https://github.com/titan-data/titan/releases) tab. Please download the proper package for your operating system and architecture.

Titan is distributed as a binary with accompanying docker image. Install Titan by unzipping the downloaded release and moving the binary to a directory included in your system's PATH and running the following command from your CLI:
```bash
titan install
```

## <a id="contribute"></a>Contributing

This project follows the Titan community best practices:

Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.3.0
2 changes: 2 additions & 0 deletions config/jni-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[
]
2 changes: 2 additions & 0 deletions config/proxy-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[
]
Loading

0 comments on commit fecec27

Please sign in to comment.