Skip to content

Commit

Permalink
Merge pull request #11 from CWTSLeiden/feature/gradle-build
Browse files Browse the repository at this point in the history
Use Gradle for building and publishing
  • Loading branch information
vtraag authored Nov 4, 2020
2 parents 05510ef + c758f30 commit 2c8fb73
Show file tree
Hide file tree
Showing 96 changed files with 6,134 additions and 3,404 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf

33 changes: 33 additions & 0 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This workflow will build a package using Gradle.
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: Build master branch

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Print version
run: gradle printVersion
- name: Build with Gradle
run: gradle build
- name: Generate sources jar with Gradle
run: gradle sourcesjar
- name: Generate JavaDoc jar with Gradle
run: gradle javadocjar
- name: Upload package as artifact
uses: actions/upload-artifact@v2
with:
name: Package
path: build/libs
29 changes: 29 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# This workflow will build a package using Gradle and then publish it to GitHub Packages and the Maven Central Repository.
# For more information see: https://github.com/actions/setup-java#publishing-using-gradle

name: Publish package

on:
release:
types: [created]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Java
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Gradle
run: gradle build
- name: Publish package to GitHub Packages and the Maven Central Repository
run: gradle publish
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GPG_SIGNING_PASSWORD: ${{ secrets.GPG_SIGNING_PASSWORD }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ test*
bin/
.classpath
.project
.settings
.settings/
.gradle/
43 changes: 29 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# networkanalysis

[![Build master branch](https://github.com/CWTSLeiden/networkanalysis/workflows/Build%20master%20branch/badge.svg?branch=master)](https://github.com/CWTSLeiden/networkanalysis/actions)
[![License: MIT](https://badgen.net/github/license/CWTSLeiden/networkanalysis?label=License&color=yellow)](https://github.com/CWTSLeiden/networkanalysis/blob/master/LICENSE)
[![Latest release](https://badgen.net/github/release/CWTSLeiden/networkanalysis?label=Release)](https://github.com/CWTSLeiden/networkanalysis/releases)
[![DOI](https://zenodo.org/badge/153760626.svg)](https://zenodo.org/badge/latestdoi/153760626)

## Introduction

This package provides algorithms and data structures for network analysis in `java`.
Expand All @@ -7,8 +14,6 @@ Only undirected networks are supported.

This package requires `java 1.8.0` or higher.

[![DOI](https://zenodo.org/badge/153760626.svg)](https://zenodo.org/badge/latestdoi/153760626)

## Usage

The latest version of this package is available as a pre-compiled `jar` file in the GitHub [release](https://github.com/CWTSLeiden/networkanalysis/releases/latest).
Expand All @@ -19,7 +24,7 @@ To run the clustering algorithms, the command-line tool `RunNetworkClustering` i
The tool can be run as follows:

```
java -cp networkanalysis.jar cwts.networkanalysis.run.RunNetworkClustering
java -cp networkanalysis-1.1.0.jar nl.cwts.networkanalysis.run.RunNetworkClustering
```

If no further arguments are provided, the following usage notice will be displayed:
Expand Down Expand Up @@ -83,7 +88,7 @@ To run the layout algorithm, the command-line tool `RunNetworkLayout` is provide
The tool can be run as follows:

```
java -cp networkanalysis.jar cwts.networkanalysis.run.RunNetworkLayout
java -cp networkanalysis-1.1.0.jar nl.cwts.networkanalysis.run.RunNetworkLayout
```

If no further arguments are provided, the following usage notice will be displayed:
Expand Down Expand Up @@ -182,7 +187,7 @@ Nodes must be represented by integer numbers starting from 0.
Assuming that the edge list has been saved in the file `network.txt`, the `RunNetworkClustering` tool can be run as follows:

```
java -cp networkanalysis.jar cwts.networkanalysis.run.RunNetworkClustering -r 0.2 -o clusters.txt network.txt
java -cp networkanalysis-1.1.0.jar nl.cwts.networkanalysis.run.RunNetworkClustering -r 0.2 -o clusters.txt network.txt
```

In this case, clusters are identified using the Leiden algorithm.
Expand All @@ -207,7 +212,7 @@ Cluster 1 includes nodes 3, 4, and 5.
The `RunNetworkLayout` tool can be run as follows:

```
java -cp networkanalysis.jar cwts.networkanalysis.run.RunNetworkLayout -o layout.txt network.txt
java -cp networkanalysis-1.1.0.jar nl.cwts.networkanalysis.run.RunNetworkLayout -o layout.txt network.txt
```

In this case, the default parameter values are used for the VOS layout technique.
Expand All @@ -230,25 +235,35 @@ Furthermore, edge weights can be provided by adding a third column to the file `

## Compilation

The source code can be compiled as follows:
You must have JDK 1.8+ installed to compile.
Having Gradle installed is optional as the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html) is also included in this repository.
On Windows, the source code can be compiled as follows:

```
javac -d build src/cwts/networkanalysis/*.java src/cwts/networkanalysis/run/*.java src/cwts/util/*.java
gradlew build
```

The compiled `class` files will be output to the directory `build`.
There are no external dependencies.
There are two `main` methods, one in the class `cwts.networkanalysis.run.RunNetworkClustering` and one in the class `cwts.networkanalysis.run.RunNetworkLayout`.
On Linux and MacOS, use the following command:

```
./gradlew build
```

The compiled `class` files will be output to the directory `build/classes`.
The compiled `jar` file will be output to the directory `build/libs`.
The compiled `javadoc` files will be output to the directory `build/docs`.

There are two `main` methods, one in the class `nl.cwts.networkanalysis.run.RunNetworkClustering` and one in the class `nl.cwts.networkanalysis.run.RunNetworkLayout`.
After the code has been compiled, the `RunNetworkClustering` tool can be run as follows:

```
java -cp build cwts.networkanalysis.run.RunNetworkClustering
java -cp build/libs/networkanalysis-<version>.jar nl.cwts.networkanalysis.run.RunNetworkClustering
```

The `RunNetworkLayout` tool can be run as follows:

```
java -cp build cwts.networkanalysis.run.RunNetworkLayout
java -cp build/libs/networkanalysis-<version>.jar nl.cwts.networkanalysis.run.RunNetworkLayout
```

The latest stable version of the code is available from the [`master`](https://github.com/CWTSLeiden/networkanalysis/tree/master) branch on GitHub.
Expand All @@ -272,4 +287,4 @@ At the moment, we have not yet set up any continuous integration, so please make
## License

This package is distributed under the MIT License.
Please refer to the [`LICENSE`](LICENSE) file for further details.
Please refer to the [`LICENSE`](LICENSE) file for further details.
93 changes: 93 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'com.palantir.git-version' version '0.12.3'
}

group = 'nl.cwts'
version = gitVersion()

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}

jar {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
}
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/CWTSLeiden/networkanalysis"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
maven {
name = "OSSRH"
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = "networkanalysis"
description = "Java package that provides data structures and algorithms for network analysis."
url = "https://github.com/CWTSLeiden/networkanalysis"
licenses {
license {
name = "MIT License"
url = "http://www.opensource.org/licenses/mit-license.php"
}
}
developers {
developer {
name = "Nees Jan van Eck"
email = "ecknjpvan@cwts.leidenuniv.nl"
url = "https://github.com/neesjanvaneck"
id = "neesjanvaneck"
}
developer {
name = "Vincent Traag"
email = "v.a.traag@cwts.leidenuniv.nl"
url = "https://github.com/vtraag"
id = "vtraag"
}
developer {
name = "Ludo Waltman"
email = "waltmanlr@cwts.leidenuniv.nl"
url = "https://github.com/ludowaltman"
id = "ludowaltman"
}
}
scm {
connection = "scm:git@github.com:CWTSLeiden/networkanalysis.git"
developerConnection = "scm:git@github.com:CWTSLeiden/networkanalysis.git"
url = "https://github.com/CWTSLeiden/networkanalysis"
}
}
}
}
}

signing {
required { gradle.taskGraph.hasTask("publish") }
def signingKey = System.getenv("GPG_SIGNING_KEY")
def signingPassword = System.getenv("GPG_SIGNING_PASSWORD")
useInMemoryPgpKeys(signingKey, signingPassword)
sign publishing.publications.mavenJava
}
57 changes: 28 additions & 29 deletions docs/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,41 @@
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_192) on Tue Oct 27 21:29:52 CET 2020 -->
<title>All Classes</title>
<meta name="date" content="2020-10-27">
<!-- Generated by javadoc -->
<title>All Classes (networkanalysis 1.1.0 API)</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script type="text/javascript" src="script.js"></script>
</head>
<body>
<h1 class="bar">All&nbsp;Classes</h1>
<div class="indexContainer">
<ul>
<li><a href="cwts/util/Arrays.html" title="class in cwts.util" target="classFrame">Arrays</a></li>
<li><a href="cwts/networkanalysis/Clustering.html" title="class in cwts.networkanalysis" target="classFrame">Clustering</a></li>
<li><a href="cwts/networkanalysis/ClusteringAlgorithm.html" title="interface in cwts.networkanalysis" target="classFrame"><span class="interfaceName">ClusteringAlgorithm</span></a></li>
<li><a href="cwts/networkanalysis/ComponentsAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">ComponentsAlgorithm</a></li>
<li><a href="cwts/networkanalysis/CPMClusteringAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">CPMClusteringAlgorithm</a></li>
<li><a href="cwts/util/DynamicDoubleArray.html" title="class in cwts.util" target="classFrame">DynamicDoubleArray</a></li>
<li><a href="cwts/util/DynamicIntArray.html" title="class in cwts.util" target="classFrame">DynamicIntArray</a></li>
<li><a href="cwts/networkanalysis/FastLocalMovingAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">FastLocalMovingAlgorithm</a></li>
<li><a href="cwts/util/FastMath.html" title="class in cwts.util" target="classFrame">FastMath</a></li>
<li><a href="cwts/networkanalysis/run/FileIO.html" title="class in cwts.networkanalysis.run" target="classFrame">FileIO</a></li>
<li><a href="cwts/networkanalysis/GradientDescentVOSLayoutAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">GradientDescentVOSLayoutAlgorithm</a></li>
<li><a href="cwts/networkanalysis/IncrementalClusteringAlgorithm.html" title="interface in cwts.networkanalysis" target="classFrame"><span class="interfaceName">IncrementalClusteringAlgorithm</span></a></li>
<li><a href="cwts/networkanalysis/IncrementalCPMClusteringAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">IncrementalCPMClusteringAlgorithm</a></li>
<li><a href="cwts/networkanalysis/IterativeCPMClusteringAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">IterativeCPMClusteringAlgorithm</a></li>
<li><a href="cwts/networkanalysis/Layout.html" title="class in cwts.networkanalysis" target="classFrame">Layout</a></li>
<li><a href="cwts/networkanalysis/LayoutAlgorithm.html" title="interface in cwts.networkanalysis" target="classFrame"><span class="interfaceName">LayoutAlgorithm</span></a></li>
<li><a href="cwts/networkanalysis/LeidenAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">LeidenAlgorithm</a></li>
<li><a href="cwts/networkanalysis/LocalMergingAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">LocalMergingAlgorithm</a></li>
<li><a href="cwts/networkanalysis/LouvainAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">LouvainAlgorithm</a></li>
<li><a href="cwts/networkanalysis/Network.html" title="class in cwts.networkanalysis" target="classFrame">Network</a></li>
<li><a href="cwts/networkanalysis/QualityClusteringAlgorithm.html" title="interface in cwts.networkanalysis" target="classFrame"><span class="interfaceName">QualityClusteringAlgorithm</span></a></li>
<li><a href="cwts/networkanalysis/QualityLayoutAlgorithm.html" title="interface in cwts.networkanalysis" target="classFrame"><span class="interfaceName">QualityLayoutAlgorithm</span></a></li>
<li><a href="cwts/networkanalysis/run/RunNetworkClustering.html" title="class in cwts.networkanalysis.run" target="classFrame">RunNetworkClustering</a></li>
<li><a href="cwts/networkanalysis/run/RunNetworkLayout.html" title="class in cwts.networkanalysis.run" target="classFrame">RunNetworkLayout</a></li>
<li><a href="cwts/networkanalysis/StandardLocalMovingAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">StandardLocalMovingAlgorithm</a></li>
<li><a href="cwts/networkanalysis/VOSLayoutAlgorithm.html" title="class in cwts.networkanalysis" target="classFrame">VOSLayoutAlgorithm</a></li>
<li><a href="nl/cwts/util/Arrays.html" title="class in nl.cwts.util" target="classFrame">Arrays</a></li>
<li><a href="nl/cwts/networkanalysis/Clustering.html" title="class in nl.cwts.networkanalysis" target="classFrame">Clustering</a></li>
<li><a href="nl/cwts/networkanalysis/ClusteringAlgorithm.html" title="interface in nl.cwts.networkanalysis" target="classFrame"><span class="interfaceName">ClusteringAlgorithm</span></a></li>
<li><a href="nl/cwts/networkanalysis/ComponentsAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">ComponentsAlgorithm</a></li>
<li><a href="nl/cwts/networkanalysis/CPMClusteringAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">CPMClusteringAlgorithm</a></li>
<li><a href="nl/cwts/util/DynamicDoubleArray.html" title="class in nl.cwts.util" target="classFrame">DynamicDoubleArray</a></li>
<li><a href="nl/cwts/util/DynamicIntArray.html" title="class in nl.cwts.util" target="classFrame">DynamicIntArray</a></li>
<li><a href="nl/cwts/networkanalysis/FastLocalMovingAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">FastLocalMovingAlgorithm</a></li>
<li><a href="nl/cwts/util/FastMath.html" title="class in nl.cwts.util" target="classFrame">FastMath</a></li>
<li><a href="nl/cwts/networkanalysis/run/FileIO.html" title="class in nl.cwts.networkanalysis.run" target="classFrame">FileIO</a></li>
<li><a href="nl/cwts/networkanalysis/GradientDescentVOSLayoutAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">GradientDescentVOSLayoutAlgorithm</a></li>
<li><a href="nl/cwts/networkanalysis/IncrementalClusteringAlgorithm.html" title="interface in nl.cwts.networkanalysis" target="classFrame"><span class="interfaceName">IncrementalClusteringAlgorithm</span></a></li>
<li><a href="nl/cwts/networkanalysis/IncrementalCPMClusteringAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">IncrementalCPMClusteringAlgorithm</a></li>
<li><a href="nl/cwts/networkanalysis/IterativeCPMClusteringAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">IterativeCPMClusteringAlgorithm</a></li>
<li><a href="nl/cwts/networkanalysis/Layout.html" title="class in nl.cwts.networkanalysis" target="classFrame">Layout</a></li>
<li><a href="nl/cwts/networkanalysis/LayoutAlgorithm.html" title="interface in nl.cwts.networkanalysis" target="classFrame"><span class="interfaceName">LayoutAlgorithm</span></a></li>
<li><a href="nl/cwts/networkanalysis/LeidenAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">LeidenAlgorithm</a></li>
<li><a href="nl/cwts/networkanalysis/LocalMergingAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">LocalMergingAlgorithm</a></li>
<li><a href="nl/cwts/networkanalysis/LouvainAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">LouvainAlgorithm</a></li>
<li><a href="nl/cwts/networkanalysis/Network.html" title="class in nl.cwts.networkanalysis" target="classFrame">Network</a></li>
<li><a href="nl/cwts/networkanalysis/QualityClusteringAlgorithm.html" title="interface in nl.cwts.networkanalysis" target="classFrame"><span class="interfaceName">QualityClusteringAlgorithm</span></a></li>
<li><a href="nl/cwts/networkanalysis/QualityLayoutAlgorithm.html" title="interface in nl.cwts.networkanalysis" target="classFrame"><span class="interfaceName">QualityLayoutAlgorithm</span></a></li>
<li><a href="nl/cwts/networkanalysis/run/RunNetworkClustering.html" title="class in nl.cwts.networkanalysis.run" target="classFrame">RunNetworkClustering</a></li>
<li><a href="nl/cwts/networkanalysis/run/RunNetworkLayout.html" title="class in nl.cwts.networkanalysis.run" target="classFrame">RunNetworkLayout</a></li>
<li><a href="nl/cwts/networkanalysis/StandardLocalMovingAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">StandardLocalMovingAlgorithm</a></li>
<li><a href="nl/cwts/networkanalysis/VOSLayoutAlgorithm.html" title="class in nl.cwts.networkanalysis" target="classFrame">VOSLayoutAlgorithm</a></li>
</ul>
</div>
</body>
Expand Down
Loading

0 comments on commit 2c8fb73

Please sign in to comment.