Skip to content

opensha/opensha

Repository files navigation

OpenSHA

Primary OpenSHA code repository

Build Status

Build Status Test Status Server Status
This tests for compile errors on the master branch This runs our standard test suite on the master branch This runs every 6 hours and tests that our server at opensha.usc.edu is accessible and web services are working

Compilation and project configuration

This repository contains OpenSHA code and model implementations. This project is intended for the core APIs and stable models. Exploratory code or one-off tests should instead go in our development sandbox, opensha-dev, which has this project as a dependency.

Requirements

Other dependencies are managed with Gradle, which does not require a separate installation. Gradle is clever about finding Java, but some users may have to explicitly define a JAVA_HOME environment variable.

Cloning in a terminal

To clone this project in a terminal (simplest and quickest for most users):

cd ~/git # create this directory or navigate an alternative directory of your choosing
git clone https://github.com/opensha/opensha.git

Building in a terminal with Gradle

OpenSHA uses Gradle to handle the build process from dependency management to compilation. You should compile OpenSHA from your lowest level project, opensha-dev for the example above.

cd opensha
./gradlew assemble

This will build all source files in opensha. It will also build a jar file for each project, not including any dependencies. You can build a "fat jar" which includes dependent libraries as follows:

cd opensha
./gradlew fatJar

Developing & building OpenSHA with Eclipse

Most active OpenSHA development is done through Eclipse. You will need the Eclipse IDE for Java Developers.

NOTE: The following instructions assume that you have already cloned the OpenSHA projects on a terminal, though you can clone them through Eclipse. If you chose to go this route, be sure to leave the "Import all existing Eclipse projects after clone finishes" check-box UNSELECTED, as this feature will cause issues with gradle.

Once you have eclipse installed and running, do the following:

  • File > Import
  • Select Gradle > Existing Gradle Project and hit Next
  • Browse to the location of opensha under Project root directory
  • Hit Finish

You can either use Eclipse's built in Git tools, or the Git command line client to pull/push changes. Any time any of the .gradle files are modified, or you see many unexpected compilation errors, right click on the project within eclipse and select Gradle > Refresh Gradle Project.

Repository history

OpenSHA has been in active development since the early 2000's. It was originally in CVS version control, and was ported to this SVN repository circa 2008. In 2017, it was migrated to GitHub and split into a number of sub-projects. History from the SVN repository was not retained, but it is archived here. The main codebase, which was re-unified into this repository in 2021, was previously stored in the now-archived opensha-commons, opensha-core, opensha-ucerf3, and opensha-apps.

A development sandbox, with which we're more relaxed with write-permissions, can be found here. Otherwise, outside contributions should come in the form of pull requests on this repository.