Skip to content

Commit

Permalink
Merge pull request #11 from rmanet/core-less-one
Browse files Browse the repository at this point in the history
WRIMS-core-to-devops
  • Loading branch information
rma-tom authored Feb 19, 2024
2 parents c48251b + ab3524f commit 8315276
Show file tree
Hide file tree
Showing 265 changed files with 44,219 additions and 43,635 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/Java_CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Java CI

on:
pull_request:
branches:
- wrims-devops
push:
branches:
- wrims-devops

jobs:
build:

runs-on: windows-2022

steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'temurin'
cache: 'gradle'

- name: Build with Gradle
run: ./gradlew build

- name: Upload jars
uses: actions/[email protected]
with:
name: jars result
path: ./wrims-core/build/libs/*.jar
52 changes: 43 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,46 @@
/.tgitconfig
/build.properties
/debug.log
/feature.xml
bin
/3rd_party/
**/target
tmp
**/\.~lock*

**/.gradle
**/gradle/license-plugin/
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.idea
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

mil.army.usace.hec-dependencies/.gradle/
### Mac OS ###
.DS_Store

mil.army.usace.hec-dependencies/build/
gradle.properties
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
The "wrims_v2" directory here contains files and directories from the WRIMS project as it existed before the DevOps revisions were started.
All other files and folders at the root level in this branch and its descendants are structured to support GitHub-style CI/CD builds with Gradle.

Directories here:
- .github/workflow -- home to the GitHub workflows that build WRIMS components on the GitHub site
- buildSrc -- Holds build configuration information common to all subprojects. For specifics, see Gradle documentation https://docs.gradle.org/current/userguide/organizing_gradle_projects.html#sec:build_sources
- gradle -- configurations for the gradle build, most significantly the file "libs.version.toml" which sets the version numbers for the libraries that will be retrieved from Maven Central or other artifact repositories at build time
- wrims-core -- the gradle sub-project that produces the equivalent of the previous WRIMSv2.jar file
- wrims_v2 -- see above

The remaining files at this level are set up to support a mult-project gradle build as described at https://docs.gradle.org/current/userguide/intro_multi_project_builds.html

Files were moved (rather than copied) from wrims_v2/wrims_v2/src to new locations in wrims-core/src so that their git histories would be preserved. Source files for non-java program components were left in their original folders, and will be moved as the project goes forward. A [README file in wrims_v2/wrims_v2/src](./wrims_v2/wrims_v2/src/README.md) lists the groups of files that were moved and left behind.

The jar that's built from this branch (wrims-core) of the project does not contain the
antler classes. To run wrims using this jar, you'll need to include the antler runtime (v 3.5.2)
in addition to the wrims-core jar to replace the old WRIMSv2.jar.

22 changes: 22 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// This is the root build.gradle, which defines a few project-wide properties.
// Notably, this project sets the version of all projects, as well as the group name.

plugins {
id "com.palantir.git-version" version "3.0.0"
id 'base'
}

// This utilizes Git Tag based versioning to set the version of the project based on the current Git Branch or Tag.
// If a tag is checked out, the version will be the name of the most recent tag on this commit.
// Otherwise, the version will be branchname-SNAPSHOT.
def versionLabel(gitInfo) {
def branch = gitInfo.branchName // all branches are snapshots, only tags get released
def tag = gitInfo.lastTag
// tag is returned as is. Branch may need cleanup
return branch == null ? tag : branch.replace("/","-") + "-SNAPSHOT"
}

allprojects {
group = 'gov.ca.dwr'
version = versionLabel(versionDetails())
}
6 changes: 6 additions & 0 deletions buildSrc/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# buildSrc

The `buildSrc` directory contains a set of template Gradle files that can be pulled in to other builds like plugins.
This allows autoconfiguring many components of the build with a single line in the `build.gradle` file, and avoids
copying and pasting a lot of boilerplate code. The single location of all of the logic also makes it much easier to
update for the entire library, such as updating the version of Java.
3 changes: 3 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
plugins {
id 'groovy-gradle-plugin'
}
12 changes: 12 additions & 0 deletions buildSrc/src/main/groovy/library.deps-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// This file provides a set of defaults for defining the `repositories` block for subprojects within this build.
// This ensures that all subprojects use the same repositories and credentials.

// Define a standard set of repositories, a specific library may need to customize this list and add or remove some items
repositories {
maven {
// The HEC Public repository where a lot of base dependencies are stored like hec-monolith
url 'https://www.hec.usace.army.mil/nexus/repository/maven-public'
}
// The primary public Maven repository, Maven Central where most 3rd party dependencies can be found
mavenCentral()
}
28 changes: 28 additions & 0 deletions buildSrc/src/main/groovy/library.java-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// This file defines the default configurations for the Java plugin, such as configuring the Java version to target
// and setting up a few common dependencies.

plugins {
id 'java-library'
}

compileJava {
// Configure the Java release that you wish to target. Note that this does not necessarily directly correlate
// to the version of Java you have installed. This format requires at least Java 9, but will work with any release
// after that. Specifying the release with the `options.release` format enables compiling targeting a previous JDK
// when only a more recent JDK is available (for example, compile for Java 11 with Java 17 or 21).
sourceCompatibility = '1.8'
targetCompatibility = '1.8'

// This is the preferred method to specify the Java version. There is also the sourceCompatibility property, but
// Gradle recommends the options.release property instead. There is also the Java Toolchains system, but that
// does not appear to support cross compiling (target 11 with JDK 17); it instead expects to find exactly the matching
// JDK for the target version. (This limits it to compiling for Java 11 with Java 11, and targeting Java 11 with
// Java 17 doesn't work.)
}

java {
// When building a library, ensure that a Sources and Javadoc jar are included as well; this makes sure
// that IDEs are able to automatically download and use the sources and javadoc for your library.
// withSourcesJar()
// withJavadocJar()
}
23 changes: 23 additions & 0 deletions buildSrc/src/main/groovy/library.publishing-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// This file defines the default configurations for publishing a subproject to HEC Nexus. Note that each subproject
// still requires a `publishing` block to actually specify the component that will be published.

plugins {
id 'maven-publish'
}

publishing {
// Publish to HEC's Maven-public by targeting the appropriate maven-snapshots or maven-releases repo based on the
// version of the library being deployed.
repositories {
maven {
credentials {
username = project.hasProperty('nexusUser') ? "$nexusUser" : "noUserSpecified"
password = project.hasProperty('nexusPassword') ? "$nexusPassword" : "noPasswordSpecified"
}
def baseUrl = "https://www.hec.usace.army.mil/nexus/repository"
afterEvaluate {
url = version.toString().endsWith("SNAPSHOT") ? "$baseUrl/maven-snapshots/" : "$baseUrl/maven-releases/"
}
}
}
}
28 changes: 28 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[versions]
hec-monolith = "3.3.22"
hec-nucleus-metadata = "2.0.1"
guava = "11.0.2"
commons-io = "2.1"
xstream = "1.4.3"
javatuples = "1.2"
java-object-diff = "0.95"
kryo = "2.24.0"
jep = "3.8.2"
libtensorflow = "1.14.0"
testng = "6.3"

[libraries]
hec-monolith = { module = "mil.army.usace.hec:hec-monolith", version.ref = "hec-monolith" }
hec-nucleus-metadata = { module = "mil.army.usace.hec:hec-nucleus-metadata", version.ref = "hec-nucleus-metadata" }
antlr = "org.antlr:antlr:3.5.2"
guava = { module = "com.google.guava:guava", version.ref = "guava" }
commons-io = { module = "commons-io:commons-io", version.ref = "commons-io" }
xstream = { module = "com.thoughtworks.xstream:xstream", version.ref = "xstream" }
javatuples = { module = "org.javatuples:javatuples", version.ref = "javatuples" }
java-object-diff = { module = "de.danielbechler:java-object-diff", version.ref = "java-object-diff" }
kryo = { module = "com.esotericsoftware.kryo:kryo", version.ref = "kryo" }
jep = { module = "black.ninia:jep", version.ref = "jep" }
libtensorflow = { module = "org.tensorflow:libtensorflow", version.ref = "libtensorflow" }
testng = { module = "org.testng:testng", version.ref = "testng" }

[bundles]
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 8315276

Please sign in to comment.