Skip to content

Commit

Permalink
迁移至 Maven Central
Browse files Browse the repository at this point in the history
gradle 升级至 6.8.2
  • Loading branch information
RationalityFrontline committed Feb 12, 2021
1 parent 6b53d97 commit 713d660
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 77 deletions.
33 changes: 11 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# JCTP [![JCenter Version](https://img.shields.io/bintray/v/rationalityfrontline/jctp/jctp?label=JCenter)](https://bintray.com/rationalityfrontline/jctp/jctp) ![platform](https://img.shields.io/badge/platform-windows%7Clinux-green) [![Apache License 2.0](https://img.shields.io/github/license/rationalityfrontline/jctp)](https://github.com/RationalityFrontline/jctp/blob/master/LICENSE)
# JCTP
[![Maven Central](https://img.shields.io/maven-central/v/org.rationalityfrontline/jctp.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22org.rationalityfrontline%22%20AND%20a:%22jctp%22) ![platform](https://img.shields.io/badge/platform-windows%7Clinux-green) [![Apache License 2.0](https://img.shields.io/github/license/rationalityfrontline/jctp)](https://github.com/RationalityFrontline/jctp/blob/master/LICENSE)

基于 [SWIG](http://www.swig.org/) 实现的对[上期技术](http://www.sfit.com.cn/) CTP 的封装。当前封装版本为 6.3.19,支持 64 位的 Windows 及 Linux 操作系统,动态链接库已被包含至 jar 包内,并在类加载时自动 loadLibrary,只需添加 jar 包即可直接使用。

Expand Down Expand Up @@ -28,36 +29,25 @@ sudo dpkg-reconfigure locales

## Download

**Gradle:**
**Gradle Kotlin DSL:**

首先将 JCenter 添加至仓库中:

```groovy
```kotlin
repositories {
jcenter()
}
```
```groovy
// Groovy DSL
dependencies {
implementation 'org.rationalityfrontline:jctp:6.3.19-1.0'
mavenCentral()
}
```
```kotlin
// Kotlin DSL

dependencies {
implementation("org.rationalityfrontline:jctp:6.3.19-1.0")
implementation("org.rationalityfrontline:jctp:6.3.19-1.0.0")
}
```

**Maven:**

```xml
<dependency>
<groupId>org.rationalityfrontline</groupId>
<artifactId>jctp</artifactId>
<version>6.3.19-1.0</version>
<type>pom</type>
<groupId>org.rationalityfrontline</groupId>
<artifactId>jctp</artifactId>
<version>6.3.19-1.0.0</version>
</dependency>
```
**Jar:**
Expand All @@ -66,9 +56,8 @@ dependencies {

使用 Jar 包前请先添加 [native-lib-loader](https://github.com/scijava/native-lib-loader) 依赖:
```kotlin
// Kotlin DSL
dependencies {
implementation("org.scijava:native-lib-loader:2.3.4")
implementation("org.scijava:native-lib-loader:2.3.5")
}
```

Expand Down
90 changes: 36 additions & 54 deletions java/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
import com.jfrog.bintray.gradle.BintrayExtension.PackageConfig
import com.jfrog.bintray.gradle.BintrayExtension.VersionConfig
import java.util.Date
import org.gradle.internal.os.OperatingSystem

plugins {
`java-library`
`maven-publish`
id("org.javamodularity.moduleplugin") version "1.7.0"
id("com.jfrog.bintray") version "1.8.5"
signing
}

group = "org.rationalityfrontline"
version = "6.3.19-1.0"

repositories {
jcenter()
mavenCentral()
}

dependencies {
implementation("org.scijava:native-lib-loader:2.3.4")
implementation("org.scijava:native-lib-loader:2.3.5")
}

java {
modularity.inferModulePath.set(true)
withJavadocJar()
withSourcesJar()
}

tasks {
Expand Down Expand Up @@ -53,30 +52,21 @@ tasks {
encoding = "UTF-8"
}
}
register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
dependsOn(javadoc)
from(getByName<Javadoc>("javadoc").destinationDir)
}
register<Jar>("sourcesJar") {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
}

group = "org.rationalityfrontline"
version = "6.3.19-1.0.0"
val NAME = project.name
val DESC = "Java wrapper for CTP"
val GITHUB_REPO = "RationalityFrontline/jctp"

publishing {
publications {
create<MavenPublication>("mavenPublish") {
create<MavenPublication>("maven") {
from(components["java"])
artifact(tasks["sourcesJar"])
artifact(tasks["javadocJar"])
pom {
name.set(NAME)
description.set("$NAME $version - $DESC")
description.set(DESC)
url.set("https://github.com/$GITHUB_REPO")
licenses {
license {
Expand All @@ -88,44 +78,36 @@ publishing {
developer {
name.set("RationalityFrontline")
email.set("[email protected]")
organization.set("RationalityFrontline")
organizationUrl.set("https://github.com/RationalityFrontline")
}
}
scm {
url.set("https://github.com/$GITHUB_REPO")
connection.set("scm:git:git://github.com/$GITHUB_REPO.git")
developerConnection.set("scm:git:ssh://github.com:$GITHUB_REPO.git")
url.set("https://github.com/$GITHUB_REPO/tree/master")
}
}
}
}
}

bintray {
fun env(propertyName: String): String {
return if (project.hasProperty(propertyName)) {
project.property(propertyName) as String
} else "Unknown"
repositories {
fun env(propertyName: String): String {
return if (project.hasProperty(propertyName)) {
project.property(propertyName) as String
} else "Unknown"
}
maven {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl
credentials {
username = env("ossrhUsername")
password = env("ossrhPassword")
}
}
}
}

user = env("BINTRAY_USER")
key = env("BINTRAY_KEY")
publish = true
override = true
setPublications("mavenPublish")
pkg(closureOf<PackageConfig>{
repo = NAME
name = NAME
desc = DESC
setLabels("java", "ctp", "quant", "futures")
setLicenses("Apache-2.0")
publicDownloadNumbers = true
githubRepo = GITHUB_REPO
vcsUrl = "https://github.com/$githubRepo"
websiteUrl = vcsUrl
issueTrackerUrl = "$vcsUrl/issues"
version(closureOf<VersionConfig> {
name = "${project.version}"
desc = "JCTP - $DESC"
released = "${Date()}"
vcsTag = name
})
})
signing {
sign(publishing.publications["maven"])
}
2 changes: 1 addition & 1 deletion java/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 713d660

Please sign in to comment.