-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
181 lines (147 loc) · 6.82 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
plugins {
id("build-logic.published-kotlin-jvm")
id("code-generation.generate")
alias(libs.plugins.nexus.publish)
}
version = "1.1.0"
group = "com.tegonal.minimalist"
description = "Library which helps to setup and prioritise parameterized tests"
dependencies {
api(libs.junit.jupiter.params)
implementation(libs.kbox)
testImplementation(kotlin("test"))
testImplementation(libs.atrium.fluent)
}
val generationFolder: ConfigurableFileCollection = project.files("src/main/generated/kotlin")
val generationFolderJava: ConfigurableFileCollection = project.files("src/main/generated/java")
val generationTestFolder: ConfigurableFileCollection = project.files("src/test/generated/kotlin")
val generationTestFolderJava: ConfigurableFileCollection = project.files("src/test/generated/java")
kotlin {
sourceSets {
main {
kotlin.srcDir(generationFolder)
}
test {
kotlin.srcDir(generationTestFolder)
}
}
}
java {
sourceSets {
main {
java.srcDir(generationFolderJava)
}
test {
java {
srcDir(generationTestFolderJava)
srcDir(project.files("src/test/java"))
}
}
}
}
nexusPublishing {
repositories {
sonatype()
}
}
/*
Release & deploy a commit
--------------------------------
1. update main:
export MNLMST_PREVIOUS_VERSION=1.1.0
export MNLMST_VERSION=1.2.0
find ./ -name "*.md" | xargs perl -0777 -i \
-pe "s@$MNLMST_PREVIOUS_VERSION@$MNLMST_VERSION@g;" \
-pe "s@tree/main@tree/v$MNLMST_VERSION@g;" \
-pe "s@latest#/kdoc@$MNLMST_VERSION/kdoc@g;"
perl -0777 -i \
-pe "s@$MNLMST_PREVIOUS_VERSION@$MNLMST_VERSION@g;" \
-pe "s/version = \"${MNLMST_VERSION}-SNAPSHOT\"/version = \"$MNLMST_VERSION\"/;" \
./build.gradle.kts
perl -0777 -i \
-pe 's/(<!-- for main -->\n)\n([\S\s]*?)(\n<!-- for release -->\n)<!--\n([\S\s]*?)-->\n(\n# <img)/$1<!--\n$2-->$3\n$4\n$5/;' \
-pe 's/(---\n❗ You are taking[^-]*?---)/<!$1>/;' \
./README.md
git commit -a -m "v$MNLMST_VERSION"
check changes (CONTRIBUTING.md, build.gradle.kts, README.md)
git push
2. prepare release on github
a) git tag "v$MNLMST_VERSION"
b) git push origin "v$MNLMST_VERSION"
c) Log in to github and create draft for the release
The tag is required for dokka in order that the externalLinkDocumentation and source-mapping works
3. update github pages:
Assumes you have a minimalist-gh-pages folder on the same level as minimalist where the gh-pages branch is checked out
Either use the following commands or the manual steps below (assuming MNLMST_PREVIOUS_VERSION and MNLMST_VERSION
is already set from commands above)
Increment MNLMST_GH_PAGES_VERSIONS_JS_VERSION and MNLMST_GH_PAGES_VERSIONS_JS_VERSION__NEXT
export MNLMST_GH_PAGES_LOGO_CSS_VERSION="1.3"
export MNLMST_GH_PAGES_ALERT_CSS_VERSION="1.1"
export MNLMST_GH_PAGES_VERSIONS_JS_VERSION="1.3.0"
export MNLMST_GH_PAGES_VERSIONS_JS_VERSION_NEXT="1.4.0"
gr dokkaHtml
cd ../minimalist-gh-pages
git add . && git commit -m "dokka generation for v$MNLMST_VERSION"
perl -0777 -i \
-pe "s@$MNLMST_PREVIOUS_VERSION@$MNLMST_VERSION@g;" \
./index.html
perl -0777 -i \
-pe "s@$MNLMST_PREVIOUS_VERSION@$MNLMST_VERSION@g;" \
./latest/index.html
perl -0777 -i \
-pe "s/(\s+)\"$MNLMST_PREVIOUS_VERSION\",/\$1\"$MNLMST_VERSION\",\$1\"$MNLMST_PREVIOUS_VERSION\",/;" \
./scripts/versions.js
find "./$MNLMST_VERSION" -name "*.html" | xargs perl -0777 -i \
-pe "s@<script.*src=\"https://unpkg\.com.*</script>@@;" \
-pe "s@(<div class=\"library-name\">[\S\s]+?)Minimalist@\$1<span>Minimalist</span>@;" \
-pe "s@\"((?:\.\./+)*)styles/logo-styles.css\" rel=\"Stylesheet\">@\"../../\${1}styles/logo-styles.css?v=$MNLMST_GH_PAGES_LOGO_CSS_VERSION\" rel=\"Stylesheet\">\n<link href=\"../../\${1}styles/alert.css?v=$MNLMST_GH_PAGES_ALERT_CSS_VERSION\" rel=\"Stylesheet\">\n<script id=\"versions-script\" type=\"text/javascript\" src=\"\../../\${1}scripts/versions.js?v=$MNLMST_GH_PAGES_VERSIONS_JS_VERSION\" data-version=\"$MNLMST_VERSION\" async=\"async\"></script>@g;" \
-pe "s@((?:\.\./+)*)images/logo-icon.svg\"([^>]+)>@../../\${1}images/logo-icon.svg\"\$2>\n<meta name=\"og:image\" content=\"../../\${1}images/logo_social.png\"/>@g;" \
-pe "s@(<a class=\"library-name--link\" href=\"(?:\.\./+)*)index.html\">@\$1../../index.html\" title=\"Back to Overview Code Documentation of Minimalist\">@g;" \
-pe "s@<html@<html lang=\"en\"@g;" \
-pe "s@<head>@<head>\n<meta name=\"keywords\" content=\"Kotlin, junit, junit-jupiter, test, Testing, parameterized tests, minimal test set\">\n<meta name=\"author\" content=\"Tegonal Genossenschaft\">\n<meta name=\"copyright\" content=\"Tegonal Genossenschaft\">@g;" \
-pe "s@<title>([^<]+)</title>@<title>\$1 - Minimalist $MNLMST_VERSION</title>\n<meta name=\"description\" content=\"Code documentation of Minimalist $MNLMST_VERSION: \$1\">@g;" \
-pe "s@(<code class=\"runnablesample[^>]+>)[\S\s]+?//sampleStart[\n\s]*([\S\s]+?)\s+//sampleEnd[\n\s]*\}@\${1}\${2}@g;"
find "./" -name "*.html" | xargs perl -0777 -i \
-pe "s@(scripts/versions\.js\?v\=)$MNLMST_GH_PAGES_VERSIONS_JS_VERSION@\${1}$MNLMST_GH_PAGES_VERSIONS_JS_VERSION_NEXT@g;"
cp "./$MNLMST_PREVIOUS_VERSION/index.html" "./$MNLMST_VERSION/index.html"
perl -0777 -i \
-pe "s/$MNLMST_PREVIOUS_VERSION/$MNLMST_VERSION/g;" \
-pe "s@Released .*</p>@Released $(LC_ALL=en_GB date '+%b %d, %Y')</p>@;" \
"./$MNLMST_VERSION/index.html"
git add . && git commit -m "v$MNLMST_VERSION"
check changes
git push
cd ../minimalist
3. deploy to maven central:
(assumes you have an alias named gr pointing to ./gradlew)
a) echo "enter the sonatype user token"
read SONATYPE_PW
b) java -version 2>&1 | grep "version \"11" && ORG_GRADLE_PROJECT_sonatypePassword="$SONATYPE_PW" CI=true gr clean publishToSonatype
c) Log into https://oss.sonatype.org/#stagingRepositories
d) check if staging repo is ok
e) close repo
f) release repo
4. publish release on github
1) Log in to github and publish draft
Prepare next dev cycle
-----------------------
1. update main:
export MNLMST_VERSION=1.1.0
export MNLMST_NEXT_VERSION=1.2.0
find ./ -name "*.md" | xargs perl -0777 -i \
-pe "s@tree/v$MNLMST_VERSION@tree/main@g;" \
-pe "s@$MNLMST_VERSION/kdoc@latest#/kdoc@g;" \
-pe "s/add \\\`\@since $MNLMST_VERSION\\\` \(adapt to current/add \\\`\@since $MNLMST_NEXT_VERSION\\\` \(adapt to current/g;"
perl -0777 -i \
-pe "s/rootProject.version = \"$MNLMST_VERSION\"/rootProject.version = \"${MNLMST_NEXT_VERSION}-SNAPSHOT\"/;" \
-pe "s/MNLMST_VERSION=$MNLMST_VERSION/MNLMST_VERSION=$MNLMST_NEXT_VERSION/;" \
./build.gradle.kts
perl -0777 -i \
-pe 's/(<!-- for main -->\n)<!--\n([\S\s]*?)-->(\n<!-- for release -->)\n([\S\s]*?)\n(\n# <img)/$1\n$2$3\n<!--$4-->\n$5/;' \
-pe 's/<!(---\n❗ You are taking[^-]*?---)>/$1/;' \
-pe "s@(latest version: \[README of v$MNLMST_VERSION\].*tree/)main/@\$1v$MNLMST_VERSION/@;" \
./README.md
git commit -a -m "prepare dev cycle of $MNLMST_NEXT_VERSION"
check changes
git push
*/