Skip to content

Commit c54fa41

Browse files
committed
Release ZomboidDoc v3.1.0
2 parents 8125822 + 6ee5612 commit c54fa41

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1943
-399
lines changed

.github/workflows/java-cd.yaml

+4-7
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ jobs:
200200
release_name: ${{ steps.read-tag.outputs.name }}
201201
prerelease: ${{ steps.read-tag.outputs.isPreRelease }}
202202
body_path: ./release_text.md
203-
draft: false
203+
draft: true
204204
# Upload distribution artifact to release
205205
- name: Upload distribution zip
206206
uses: actions/upload-release-asset@v1
@@ -221,11 +221,8 @@ jobs:
221221
asset_path: ./build/distributions/pz-zdoc-${{ steps.read-tag.outputs.name }}.tar
222222
asset_name: pz-zdoc-${{ steps.read-tag.outputs.name }}.tar
223223
asset_content_type: application/tar
224-
# Publish publication to Github packages with Maven
224+
# Publish to Sonatype repository
225225
- uses: burrunan/gradle-cache-action@v1
226-
name: Publish to Github packages
227-
env:
228-
GHP_USER: yooksi
229-
GHP_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
226+
name: Publish to Sonatype
230227
with:
231-
arguments: publishZdocPublicationToGitHubPackagesRepository
228+
arguments: publishToSonatypeAndCloseStagingRepository

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ local.properties
44
# Generated Lua
55
/media/
66

7+
# Temporary files
8+
serialize.lua
9+
710
### IntelliJ ###
811

912
# Project file-based format

.idea/GrepConsole.xml

+39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/help.xml .idea/runConfigurations/annotateLua.xml

+5-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/version.xml .idea/runConfigurations/compileLua.xml

+5-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations/luaDocJar.xml

-21
This file was deleted.

.idea/scopes/pz_java.xml

+3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ It is also possible to setup ZomboidDoc with Gradle without using ZomboidMod:
4444
```groovy
4545
// Github Packages repository credentials
4646
project.ext.cocoLabsRepo = 'pz-zdoc'
47-
apply from: 'https://git.io/JtydE'
47+
apply from: 'https://git.io/JmWv6'
4848
4949
dependencies {
5050
// https://github.com/orgs/cocolabs/packages?repo_name=pz-zdoc

build.gradle

+12-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ plugins {
88
// https://docs.gradle.org/current/userguide/maven_plugin.html
99
id 'maven-publish'
1010

11+
// https://docs.gradle.org/current/userguide/signing_plugin.html
12+
id 'signing'
13+
14+
// https://docs.gradle.org/current/userguide/signing_plugin.html
15+
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
16+
1117
// https://docs.gradle.org/current/userguide/jacoco_plugin.html
1218
id 'jacoco'
1319

@@ -21,10 +27,13 @@ plugins {
2127
id 'com.github.jk1.dependency-license-report' version '1.16'
2228
}
2329
apply from: 'setup.gradle'
30+
if (!CI) {
31+
apply from: 'zomboid.gradle'
32+
}
2433
apply from: 'spotless.gradle'
25-
apply from: 'distribution.gradle'
34+
apply from: 'publish.gradle'
2635

27-
group 'io.cocolabs'
36+
group 'io.github.cocolabs'
2837
version file('version.txt').readLines().get(0)
2938

3039
wrapper {
@@ -168,7 +177,7 @@ dependencies {
168177
zomboidRuntimeOnly fileTree(dir: gameDir, include: ['*.jar'])
169178

170179
// Project Zomboid classes
171-
zomboidImplementation files(zomboidClassesDir)
180+
zomboidImplementation files('lib/zomboid.jar')
172181
}
173182
}
174183

buildSrc/src/main/java/ZUnixStartScriptGenerator.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ public class ZUnixStartScriptGenerator implements ScriptGenerator {
5151

5252
public ZUnixStartScriptGenerator() {
5353
this.lineSeparator = TextUtil.getUnixLineSeparator();
54-
this.scriptTemplate = readScriptResourceFile("unixScriptTemplate.sh");
54+
this.scriptTemplate = readScriptResourceFile();
5555
this.bindingFactory = StartScriptTemplateBindingFactory.unix();
5656
}
5757

58-
private static String readScriptResourceFile(String filename) {
58+
private static String readScriptResourceFile() {
5959

60+
String filename = "unixScriptTemplate.sh";
6061
try (InputStream iStream = CL.getResourceAsStream(filename))
6162
{
6263
if (iStream == null) {

buildSrc/src/main/java/ZWindowsStartScriptGenerator.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ public class ZWindowsStartScriptGenerator implements ScriptGenerator {
5151

5252
public ZWindowsStartScriptGenerator() {
5353
this.lineSeparator = TextUtil.getWindowsLineSeparator();
54-
this.scriptTemplate = readScriptResourceFile("winScriptTemplate.bat");
54+
this.scriptTemplate = readScriptResourceFile();
5555
this.bindingFactory = StartScriptTemplateBindingFactory.windows();
5656
}
5757

58-
private static String readScriptResourceFile(String filename) {
58+
private static String readScriptResourceFile() {
5959

60+
String filename = "winScriptTemplate.bat";
6061
try (InputStream iStream = CL.getResourceAsStream(filename))
6162
{
6263
if (iStream == null) {

distribution.gradle

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
// set repository owner and name
2-
project.ext.set('repo.owner', 'cocolabs')
3-
project.ext.set('repo.name', 'pz-zdoc')
4-
51
// changelog.gradle
62
apply from: 'https://git.io/JqJiC'
73

gradle.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
orepo.owner=cocolabs
1+
# suppress inspection "UnusedProperty" for whole file
2+
repo.owner=cocolabs
23
repo.name=pz-zdoc

publish.gradle

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
// changelog.gradle
2+
apply from: 'https://git.io/JqJiC'
3+
4+
distributions.main.contents {
5+
it.from ('README.md', 'LICENSE.txt', 'CHANGELOG.md')
6+
// version.txt is used by version command
7+
it.from(projectDir) {
8+
it.include 'version.txt'
9+
}
10+
it.exclude {
11+
File file = it.file
12+
String filename = file.getName()
13+
/*
14+
* there is a bug that occurs when running distribution tasks on Github CI
15+
* where the distribution archive tries to add itself to archive
16+
* @see https://github.com/cocolabs/pz-zdoc/issues/21
17+
*/
18+
if (filename.startsWith(archivesBaseName) && filename.endsWithAny('.zip', '.tar')) {
19+
return true
20+
}
21+
if (!CI) {
22+
// exclude Project Zomboid classes
23+
if (file.toPath().startsWith(zomboidClassesDir.toPath())) {
24+
return true
25+
}
26+
// exclude Project Zomboid libraries
27+
if (file.toPath().startsWith(gameDir)) {
28+
return true
29+
}
30+
}
31+
return false
32+
}
33+
}
34+
// generate changelog BEFORE creating distribution
35+
[ 'assemble', 'assembleDist', 'installDist' ].forEach({
36+
tasks.named(it).configure({it.dependsOn('generateChangelog')})
37+
})
38+
// run distribution archive tasks AFTER generating changelog
39+
[ 'distTar', 'distZip' ].forEach({
40+
tasks.named(it).configure({it.mustRunAfter('generateChangelog')})
41+
})
42+
def cleanScripts = tasks.register('cleanScripts', Delete.class) {
43+
it.description('Delete build scripts directory.')
44+
it.group('zomboid')
45+
it.delete("$buildDir/scripts")
46+
}
47+
tasks.named('installDist').configure{
48+
it.dependsOn(cleanScripts)
49+
}
50+
51+
tasks.named('startScripts').configure {
52+
it.setWindowsStartScriptGenerator(new ZWindowsStartScriptGenerator())
53+
it.setUnixStartScriptGenerator(new ZUnixStartScriptGenerator())
54+
55+
// do not add provided files to classpath, they are not included in distribution
56+
it.classpath -= configurations.zomboidImplementation
57+
}
58+
59+
// include version information in jar
60+
jar.from 'version.txt'
61+
62+
task javadocJar(type: Jar) {
63+
archiveClassifier.set('javadoc')
64+
from javadoc
65+
}
66+
67+
task sourcesJar(type: Jar) {
68+
archiveClassifier.set('sources')
69+
from sourceSets.main.allSource
70+
}
71+
72+
artifacts {
73+
archives javadocJar, sourcesJar
74+
}
75+
76+
publishing {
77+
publications {
78+
//noinspection GroovyAssignabilityCheck
79+
mavenJava(MavenPublication) {
80+
pom {
81+
name = 'ZomboidDoc'
82+
description = 'ZomboidDoc is a Lua library compiler for Project Zomboid.'
83+
url = 'https://github.com/cocolabs/pz-zdoc'
84+
scm {
85+
connection = 'scm:git:git://github.com/cocolabs/pz-zdoc.git'
86+
developerConnection = 'scm:git:ssh://github.com:cocolabs/pz-zdoc.git'
87+
url = 'https://github.com/cocolabs/pz-zdoc'
88+
}
89+
licenses {
90+
license {
91+
name = 'GNU General Public License v3.0'
92+
url = 'https://www.gnu.org/licenses/gpl-3.0.en.html'
93+
}
94+
}
95+
developers {
96+
developer {
97+
id = 'yooks'
98+
name = 'Matthew Cain'
99+
100+
}
101+
}
102+
}
103+
}
104+
}
105+
}
106+
107+
signing {
108+
sign publishing.publications.mavenJava
109+
}
110+
111+
nexusPublishing {
112+
repositories {
113+
sonatype {
114+
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
115+
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
116+
}
117+
}
118+
}
119+
120+
task publishToSonatypeAndCloseStagingRepository {
121+
dependsOn = [ 'publishToSonatype', 'closeSonatypeStagingRepository' ]
122+
}

setup.gradle

+3-6
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,9 @@ def <T> void registerLocalProjectProperty(String name, Class<T> type, String env
121121
if (!CI) {
122122
// path to Project Zomboid installation directory
123123
registerLocalProjectProperty('gameDir', Path.class, 'PZ_DIR_PATH', true)
124+
125+
// path to IntelliJ IDEA installation directory
126+
registerLocalProjectProperty('ideaHome', Path.class, 'IDEA_HOME', true)
124127
}
125128
// Github repository token used to generate changelog
126129
registerLocalProjectProperty('cg.token', String.class, 'CHANGELOG_GITHUB_TOKEN', false)
127-
128-
// Username used to publish to Github packages with Maven
129-
registerLocalProjectProperty('ghp.user', String.class, 'GHP_USER', false)
130-
131-
// Token used to publish to Github packages with Maven
132-
registerLocalProjectProperty('ghp.token', String.class, 'GHP_TOKEN', false)

0 commit comments

Comments
 (0)