Skip to content

Commit

Permalink
Merge pull request #6 from steakteam/refactoring
Browse files Browse the repository at this point in the history
chore: add semantic-release, fix buildscript
  • Loading branch information
entrypointkr authored Jul 1, 2020
2 parents 61b82bb + 28f8112 commit fa882e7
Show file tree
Hide file tree
Showing 14 changed files with 5,305 additions and 41 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
Expand Down Expand Up @@ -101,6 +102,7 @@ hs_err_pid*
### Gradle template
.gradle
/build/
buildSrc/build

# Ignore Gradle GUI config
gradle-app.setting
Expand All @@ -114,3 +116,4 @@ gradle-app.setting
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

node_modules
6 changes: 0 additions & 6 deletions .idea/discord.xml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/misc.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

36 changes: 14 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
apply plugin: 'java'
import kr.entree.chprotocol.build.VersionTask

plugins {
id 'java'
id 'kr.entree.spigradle.base' version '1.3.1'
id 'chprotocol-publish'
}

group = 'com.github.entrypointkr'
version = '1.0.3'
version = VersionTask.readVersion(project)

sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/groups/public/'
}
maven {
name = 'sk89q'
url = 'http://maven.sk89q.com/repo'
}
maven {
name = 'protocollib'
url = 'https://repo.dmulloy2.net/nexus/repository/public/'
}
spigot()
enginehub()
protocolLib()
}

dependencies {
compileOnly('com.sk89q:commandhelper:3.3.4-SNAPSHOT') {
exclude module: 'spigot-api'
}
compileOnly(group: 'com.comphenix.protocol', name: 'ProtocolLib-API', version: '4.4.0') {
exclude module: 'cglib-nodep'
}
compileOnly spigot()
compileOnly commandhelper()
compileOnly protocolLib()
testImplementation group: 'junit', name: 'junit', version: '4.12'
compileOnly 'org.spigotmc:spigot-api:1.13.1-R0.1-SNAPSHOT'
}
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'
}
Empty file added buildSrc/settings.gradle
Empty file.
5 changes: 5 additions & 0 deletions buildSrc/src/main/groovy/chprotocol-publish.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
plugins {
id 'groovy'
}

task setVersion(type: kr.entree.chprotocol.build.VersionTask)
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package kr.entree.chprotocol.build

import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.options.Option

/**
* Created by JunHyung Lim on 2020-07-02
*/
class VersionTask extends DefaultTask {
static File getVersionFile(Project project) {
return new File("${project.projectDir}/version.txt")
}

static String readVersion(Project project) {
return getVersionFile(project).text
}

@Input
@Option(option = "build-version", description = "Configure the version of CHProtocol.")
def version = project.objects.property(String)

@TaskAction
def execute() {
getVersionFile(project).text = version
}
}
2 changes: 0 additions & 2 deletions gradle.properties

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.4.1-all.zip
67 changes: 67 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"devDependencies": {
"@commitlint/cli": "^9.0.1",
"@commitlint/config-conventional": "^9.0.1",
"@semantic-release/changelog": "^5.0.1",
"@semantic-release/git": "^9.0.0",
"@semantic-release/github": "^7.0.7",
"gradle-semantic-release-plugin": "^1.4.1",
"husky": "^4.2.5",
"semantic-release": "^17.1.1",
"@semantic-release/exec": "^5.0.0"
},
"scripts": {
"semantic-release": "semantic-release"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
],
"rules": {
"body-max-line-length": [
0
]
}
},
"release": {
"repositoryUrl": "https://github.com/steakteam/CHProtocol.git",
"branches": [
"master"
],
"tagFormat": "v${version}",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/exec",
{
"prepareCmd": "./gradlew setVersion --build-version ${nextRelease.version}",
"publishCmd": "./gradlew assemble"
}
],
[
"@semantic-release/git",
{
"assets": [
"version.txt",
"CHANGELOG.md"
]
}
],
[
"@semantic-release/github",
{
"assets": [
"build/libs/*.jar"
]
}
]
]
}
}
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.3
Loading

0 comments on commit fa882e7

Please sign in to comment.