Compare commits

...

279 Commits

Author SHA1 Message Date
4106fe27a9 Patch changelog 2023-03-12 13:00:21 +03:00
b7c0d808b7 Fix dokka publishing 2023-03-12 12:58:50 +03:00
e535fdc6f5 Fix publishing for gradle 8 2023-03-12 12:15:20 +03:00
d0079ba307 Make selective native targets... again 2023-02-26 22:03:57 +03:00
a6755e33f5 Fix repositories handling 2023-02-26 21:00:42 +03:00
185b5514c3 Roll back serialization version for compatibility 2023-02-18 18:56:15 +03:00
1e3018275d Customizeable jdk version 2023-02-12 11:32:46 +03:00
4bfd042f96 Kotlin 1.8.20-Beta 2023-02-11 14:28:45 +03:00
979e819c9a Update changelog 2023-02-03 19:30:32 +03:00
1b179e0b05 Easier dependency handling for kscience 2023-02-03 19:28:29 +03:00
a78a4f6118 Use kotlin 1.8.10 2023-02-03 14:11:03 +03:00
a26c7f6df0 Make target configuration optional 2023-02-03 13:15:17 +03:00
99e3e1ea85 Make signing optional 2023-02-03 13:12:10 +03:00
b4fb5c515a Move to manual target configuration 2023-02-03 13:00:11 +03:00
54e862681f Show only modules with a readme extension in main readme 2023-01-12 11:20:03 +03:00
e2a342751d 1.8.0 2022-12-31 12:32:53 +03:00
6de53f5c0a
Merge remote-tracking branch 'space/dev' into dev 2022-11-23 12:28:17 +03:00
a46ca7ddb8
1.8.0-Beta 2022-11-18 11:55:36 +03:00
SPC-code
26a31ed771
Merge pull request #50 from SciProgCentre/commandertvis/fix-ios
Fix a wrong iOS target
2022-11-06 15:09:55 +03:00
Iaroslav Postovalov
680719ac56
Fix a wrong iOS target 2022-11-06 13:05:36 +04:00
c9440e7fc9
Merge remote-tracking branch 'space/dev' into dev 2022-11-02 18:34:40 +03:00
0e06801d5f
Update versions 2022-11-02 18:34:17 +03:00
Iaroslav Postovalov
b4b66a101d Support two more Apple targets 2022-10-22 23:42:30 +04:00
8b14d5bed5
Update sonatype repo 2022-10-22 18:46:30 +03:00
b541fde58a
Revert back to single maven repo structure 2022-10-05 12:14:33 +03:00
a27c1953b3
Move to Kotlin 1.7.20 2022-10-04 20:41:20 +03:00
8a2c0b6e7d
Move to Kotlin 1.7.20 2022-10-04 18:42:21 +03:00
5d3eeaeeee
Move to Kotlin 1.7.20 2022-10-04 14:00:47 +03:00
5dacf9c9d6
Remove old plugins make native configurable inside kscience block. 2022-09-04 20:46:25 +03:00
b4f494e58a
Revert native plugin configuration 2022-08-24 19:02:19 +03:00
8df651bead
Warn on native plugin usage 2022-08-24 18:53:21 +03:00
c77f74c94b
Github org and project switch places 2022-08-24 18:42:36 +03:00
362d7a4042
Remove jdk-release 2022-08-24 18:24:02 +03:00
187b8e8076
Add public dev flag 2022-08-23 16:55:08 +03:00
aafcb06a1e
manual pom config 2022-08-23 16:31:44 +03:00
5d0324bc7b
Universal native configuration 2022-08-20 19:42:19 +03:00
f6e27eebdd
Migrate to new package and Kotlin 1.7.20-Beta 2022-07-29 14:46:22 +03:00
1c80eeb2c7
Try to catch project version 2022-07-10 13:39:35 +03:00
3565a03d57
Update deploy script 2022-07-10 12:58:51 +03:00
adfd6641cc
Update deploy script 2022-07-10 12:42:14 +03:00
a5618726bf update publishing script 2022-07-10 09:01:20 +00:00
Alexander Nozik
7d130dbecb
Merge pull request #47 from mipt-npm/dev
0.11.8 up versions
2022-07-10 11:55:28 +03:00
0f1e42ab36 Merge SCI-MR-159: add deploy script 2022-07-10 08:49:01 +00:00
be1767f090
0.11.8 up versions 2022-07-10 11:46:20 +03:00
c236320855 Merge MIPT-NPM-MR-26: 0.11.8-kotlin-1.7.10 2022-07-10 08:36:03 +00:00
97b0aa9d02
0.11.8 up versions 2022-07-10 10:25:52 +03:00
64b15356e7
Up version 2022-06-14 19:22:49 +03:00
Alexander Nozik
2665d208b1
Merge pull request #46 from mipt-npm/dev
Fix coroutines issue
2022-06-12 14:47:33 +03:00
f283d4d454
Fix coroutines issue 2022-06-12 14:46:28 +03:00
Alexander Nozik
39c7ac024f
Merge pull request #45 from mipt-npm/dev
0.11.6
2022-06-12 11:19:29 +03:00
89bc45cd1c
patch changelog 2022-06-12 11:18:02 +03:00
0ba70aba5c
0.11.6. Remove atomicfu from the plugin 2022-06-12 11:15:11 +03:00
0bea2d34a5
roll back atomicfu to 0.17.2 2022-06-12 10:44:03 +03:00
af891a2149
remove kotlin-jvm plugin from build 2022-06-10 20:18:00 +03:00
Alexander Nozik
53c399d542
Merge pull request #44 from mipt-npm/dev
0.11.5-kotlin-1.7.0
2022-06-09 19:44:46 +03:00
8ba91f805e
Patch changelog 2022-06-09 19:44:30 +03:00
19f3d1ba5d
Update versions 2022-06-09 19:41:46 +03:00
90880fc10f
To Kotlin 1.7.0 2022-06-09 19:38:15 +03:00
eed0f274c7
Fix explicit api application 2022-05-17 10:13:17 +03:00
e3ecfb54c9
Remove context receivers by default. 2022-05-15 12:59:49 +03:00
6526a486f9
Explicit API relaxation 2022-04-19 10:44:44 +03:00
07bde0e593
Merge remote-tracking branch 'origin/dev' into dev 2022-04-13 16:47:13 +03:00
368ed94c52
0.11.4 2022-04-13 16:47:00 +03:00
Alexander Nozik
277ab651f8
Merge pull request #43 from mipt-npm/dev
Update publish.yml
2022-04-12 12:12:27 +03:00
Alexander Nozik
a9b35eb466
Update publish.yml 2022-04-12 12:12:11 +03:00
Alexander Nozik
3d843210ea
Merge pull request #42 from mipt-npm/dev
0.11.3
2022-04-12 10:52:59 +03:00
Alexander Nozik
6d5a29567d
Merge branch 'master' into dev 2022-04-12 10:52:49 +03:00
6e9ef8326b
Merge remote-tracking branch 'origin/master' into dev 2022-04-12 10:51:56 +03:00
027a00a486
0.11.3 2022-04-10 10:48:02 +03:00
96dff3f3ee
Merge remote-tracking branch 'origin/dev' into dev 2022-04-10 09:56:07 +03:00
Alexander Nozik
4891b1f469
Merge pull request #40 from mipt-npm/commandertvis/ga
Write GitHub Actions scripts
2022-03-16 11:31:43 +03:00
Iaroslav Postovalov
b150fd5fd3
Use standard workflow actions for Java, Gradle 2022-03-16 02:31:44 +07:00
Alexander Nozik
e9c6174645
Merge pull request #41 from mipt-npm/dev
Dev
2022-03-15 13:06:15 +03:00
e1a11452d2
Update release task generation 2022-03-15 13:03:32 +03:00
Iaroslav Postovalov
22e6657e79
Write GitHub Actions scripts 2022-03-10 22:34:02 +07:00
Iaroslav Postovalov
66564457ff Merge branch 'master' into commandertvis/ga 2022-03-10 22:18:48 +07:00
Iaroslav Postovalov
e8a301b4d1
Create publish.yml 2022-03-10 22:17:00 +07:00
526faf33eb
separate release tasks 2022-03-08 23:22:03 +03:00
Alexander Nozik
69676b8521
Merge pull request #39 from mipt-npm/commandertvis/ios
Rework registration of release tasks
2022-03-08 21:49:40 +03:00
Iaroslav Postovalov
572cbce67f Rework registration of release tasks 2022-03-09 00:51:00 +07:00
Alexander Nozik
778e4875d2
Merge pull request #38 from mipt-npm/commandertvis/ios
Fix suffix removal for release task
2022-03-08 12:09:04 +03:00
Iaroslav Postovalov
25c1c45818 Fix suffix removal for release task 2022-03-08 16:04:18 +07:00
Alexander Nozik
acb13abc6e
Merge pull request #37 from mipt-npm/commandertvis/ios
Update Gradle, make multiple release tasks for each platform instead of passing a property
2022-03-08 10:14:47 +03:00
Iaroslav Postovalov
137299b615 Do not store release tasks 2022-03-07 20:53:12 +07:00
iliamikulik
dd5a9f75c4 add iosX64 and iosArm64 targets to native targets 2022-03-07 20:44:38 +07:00
Iaroslav Postovalov
74b38c62ef Update Gradle, make multiple release tasks for each platform instead of passing a property 2022-03-07 20:44:28 +07:00
Alexander Nozik
63600f9ebb
Merge pull request #35 from mipt-npm/commandertvis/versions
Upgrade versions in the catalog
2022-01-25 14:03:05 +03:00
Iaroslav Postovalov
1ee0e7ab41 Upgrade versions in the catalog 2022-01-24 17:14:21 +07:00
7a9cf427f7
0.11.1-kotlin-1.6.10 2022-01-23 15:51:34 +03:00
63106cd3aa
0.11.0-kotlin-1.6.10 2022-01-23 14:37:19 +03:00
dae2dfcde7
0.10.9-kotlin-1.6.10 2021-12-29 11:18:41 +03:00
820664a74b Add blank jupyter integration 2021-12-19 11:43:13 +03:00
7d16d0f5c7
pre-0.10.8 2021-12-12 12:23:29 +03:00
Iaroslav Postovalov
0ba835925e Update the version catalog 2021-11-27 01:26:29 +07:00
Alexander Nozik
59c2a13e4b
Merge pull request #33 from mipt-npm/dev
0.10.7
2021-11-16 12:31:41 +03:00
b5270617fc 0.10.7 with kotlin 1.6 and indy lambdas 2021-11-16 12:19:03 +03:00
5b88c2c5ad 0.10.6 with kotlin 1.6-RC2 2021-11-04 12:59:13 +03:00
Alexander Nozik
d911842922
Merge pull request #31 from mipt-npm/dev
Fix duplicating native dependency
2021-10-11 14:41:52 +03:00
e007ac9c7a Fix duplicating native dependency 2021-10-11 14:25:02 +03:00
Alexander Nozik
a915d2256d
Merge pull request #30 from mipt-npm/dev
Dev
2021-09-28 12:15:54 +03:00
54274f0c0d Return sonatype publication for the plugin 2021-09-28 12:15:13 +03:00
1c37a165c2 patch CHANGELOG.md 2021-09-28 12:12:28 +03:00
931d69ec1d 0.10.4 2021-09-28 12:12:03 +03:00
680bd9ed33 Fix language settings 2021-09-27 20:18:38 +03:00
0415ed30d5 Language version 1.6 2021-09-20 21:49:05 +03:00
8410e7e498 Fix optin 2021-09-20 20:24:44 +03:00
138ee1cfea fix import 2021-09-14 14:05:52 +03:00
db9b4dec50 Fix plugin resolution 2021-09-13 22:49:41 +03:00
878405ac6a Replace useJupyter with jupyterLibrary 2021-09-12 22:06:08 +03:00
6fa4b264a2 Fix inner use of version catalog 2021-09-12 19:32:35 +03:00
Alexander Nozik
f67f1bf4f0
Merge pull request #26 from mipt-npm/commandertvis/version-catalog
Publish a version catalog
2021-09-12 11:12:38 +03:00
Alexander Nozik
e586d20c91
Merge branch 'dev' into commandertvis/version-catalog 2021-09-12 11:12:27 +03:00
dd3d95dba4 version update 2021-09-12 11:10:50 +03:00
Alexander Nozik
2a6c88636b
Merge pull request #25 from mipt-npm/commandertvis/dokka-task
Make all `AbstractDokkaTask` depend on `generateReadme`
2021-09-12 10:31:30 +03:00
Alexander Nozik
c8edc513f1
Merge pull request #28 from mipt-npm/commandertvis/fix-publish
Refactor: explicit API, publishing extension, code style
2021-09-12 10:09:32 +03:00
Iaroslav Postovalov
02d2971b79 Refactor: explicit API, publishing extension, code style 2021-08-25 21:04:59 +07:00
Iaroslav Postovalov
dc2ff2efb3 Publish a version catalog 2021-08-17 22:04:56 +07:00
Iaroslav Postovalov
4f49e24d61 Make all AbstractDokkaTask depend on generateReadme 2021-08-07 09:43:11 +07:00
Alexander Nozik
c227258e09
Merge pull request #24 from mipt-npm/commandertvis/version-catalog
Fix typo
2021-08-06 10:36:43 +03:00
Iaroslav Postovalov
3fa500f451 Fix typo 2021-08-06 14:28:00 +07:00
Iaroslav Postovalov
852158c665 Fix dependencies of release task 2021-08-06 13:51:09 +07:00
Alexander Nozik
b751e79a8a
Merge pull request #23 from mipt-npm/commandertvis/version-catalog
Use version catalog
2021-08-06 09:34:45 +03:00
Iaroslav Postovalov
970b9ad581 Use version catalog 2021-08-06 09:41:29 +07:00
Alexander Nozik
bb573291dd
Update README.md
Add maven central badge
2021-07-21 13:17:50 +03:00
Alexander Nozik
4768874bb5
Merge pull request #20 from mipt-npm/dev
0.10.2
2021-07-21 13:15:48 +03:00
100f7cd55f 0.10.2 2021-07-21 13:01:29 +03:00
Alexander Nozik
252a633583
Merge pull request #19 from mipt-npm/commandertvis/fix-release
Fix dependencies of release task
2021-07-21 12:31:22 +03:00
Iaroslav Postovalov
b70037385c Fix dependencies of release task 2021-07-21 03:46:04 +07:00
f11d47aee5 versions update 2021-07-15 12:14:42 +03:00
4eeb81cdbb versions update 2021-07-14 12:25:20 +03:00
2ad0630b7b versions update 2021-07-14 12:05:49 +03:00
Alexander Nozik
8fe085c4bd
Merge pull request #16 from mipt-npm/dev
0.10.0
2021-06-19 14:12:34 +03:00
663f2ea630 update readme 2021-06-19 14:10:40 +03:00
35e01abf93 v0.10.0 2021-06-19 14:09:57 +03:00
Alexander Nozik
000bc1e986
Merge pull request #15 from mipt-npm/commandertvis/property
Publish a function to add dynamic readme properties
2021-06-19 10:52:34 +03:00
Iaroslav Postovalov
19a604f3b3 Publish a function to add dynamic readme properties 2021-06-15 03:25:35 +07:00
670a4ca71e Fix publishing for js 2021-06-04 19:02:25 +03:00
329bfa5881 Fix publishing for js 2021-06-04 18:50:20 +03:00
24af07eb7b Update kotlin to 1.5.10 2021-06-04 18:22:34 +03:00
5cd86474de Update kotlin to 1.5.10 2021-06-04 18:21:12 +03:00
ddbb128692 Fix snapshot detection 2021-05-21 16:11:48 +03:00
357e4c03be bump version 2021-05-21 10:11:58 +03:00
e44bf118dc Fix dependency loading 2021-05-21 10:05:46 +03:00
e0d331d4d4 Fix publication task dependency 2021-05-19 15:24:24 +03:00
c5b8c688a2 API validation disabled for dev versions 2021-05-18 15:07:50 +03:00
023ca7b80c adjust release publishing 2021-05-18 12:16:33 +03:00
5ff90436f5 update coroutines version 2021-05-14 20:10:07 +03:00
ba4548b3d7 Fix publishing for generic plugins 2021-05-14 12:53:57 +03:00
a221951197 0.9.6 2021-05-08 13:57:46 +03:00
Alexander Nozik
dad49b0c66
Merge pull request #14 from mipt-npm/dev
Dev
2021-04-26 19:19:52 +03:00
239a5c09f1 0.9.5 2021-04-26 19:17:11 +03:00
3c3de0f2bf Fix jvm-default bug 2021-04-14 18:25:37 +03:00
9cd2eff18e Fix jvm-default bug 2021-04-14 18:18:53 +03:00
60f5d15ba1 Disable API validation for snapshots 2021-04-11 09:44:42 +03:00
6d324b6e0d Removed unnecessary afterEvaluate for compatibility with gradle 7.0 2021-04-10 15:11:39 +03:00
470c79637d Kotlin 1.5 2021-04-07 11:13:23 +03:00
Alexander Nozik
ac4b34c054
Merge pull request #13 from mipt-npm/dev
0.9.3
2021-03-24 16:21:33 +03:00
a15399b9f9 Fix publication setup. Update changelog plugin 2021-03-24 13:28:09 +03:00
Alexander Nozik
6eda59f413
Merge pull request #12 from CommanderTvis/dev
Upgrade dependencies
2021-03-23 08:12:07 +03:00
Iaroslav Postovalov
3f6ba90d7f
Upgrade dependencies 2021-03-23 02:46:59 +07:00
5d58767aa8 Fix publication setup. Update changelog plugin 2021-03-08 22:00:06 +03:00
757b609d26 Publishing flag 2021-03-07 15:18:37 +03:00
Alexander Nozik
b2ede48c3e
Merge pull request #11 from mipt-npm/dev
0.9.0
2021-03-07 09:59:50 +03:00
4b90233286 bump release 2021-03-07 09:55:54 +03:00
eacdb132ed change publishing properties name 2021-03-07 09:22:48 +03:00
fd046394a4 Add system properties to avoid publishing 2021-03-07 09:16:21 +03:00
8dcf45b8d5 Change publishing scheme 2021-03-06 20:50:17 +03:00
d673eb84ae Fix imports 2021-03-03 21:19:59 +03:00
76fd9dfa57 Css support 2021-03-03 21:10:52 +03:00
7971335558 Patch CHANGELOG.md 2021-03-03 20:01:46 +03:00
bef27d1f6a Versions update and revise release tasks 2021-03-03 19:54:59 +03:00
8efae2ca4d Fix native and node hmpp 2021-02-23 16:53:15 +03:00
1cc83e8803 Adaptive native targets. 2021-02-23 14:30:39 +03:00
48bf26e26a Proper Jar import 2021-02-23 13:28:16 +03:00
133736f00f Fix plugin loading order for publishing 2021-02-23 13:22:41 +03:00
9c12501a57 Fix plugin loading order for publishing 2021-02-23 10:43:15 +03:00
a871db0c15 Fix readme again 2021-02-22 21:50:29 +03:00
a6c7287bb1 update changelog 2021-02-22 21:01:38 +03:00
4c656a3f61 Move maven-publish to configuration phase 2021-02-22 20:35:12 +03:00
a7f4c541f4 Fix readme properties in root project readme 2021-02-22 20:34:13 +03:00
7d666cb6c7 Add features mnemonic to root project readme 2021-02-22 20:11:42 +03:00
Alexander Nozik
3bae601c68
Merge pull request #8 from mipt-npm/dev
0.8.0
2021-02-21 21:58:48 +03:00
e54da4c7cd patch changelog 2021-02-21 20:16:25 +03:00
1dfdc7f76f Fix publishing plugin reference 2021-02-21 20:14:01 +03:00
ab259a5fb6 Version 0.8.0 2021-02-21 16:06:25 +03:00
7a2d5c40f1 fix readme 2021-02-21 12:12:34 +03:00
5d20e54ea4 Change package name and fix javadoc and sources publishing 2021-02-21 12:11:54 +03:00
c37ff35b4c Use optional in-memory signing 2021-02-19 22:33:34 +03:00
d8dc65da79 Use file signing 2021-02-19 21:25:05 +03:00
371a38f9c3 Update serialization to 1.1.0 2021-02-17 10:14:16 +03:00
3b368a3125 Fix sonatype publishing 2021-02-16 22:58:16 +03:00
Alexander Nozik
cf1f5bf969
Merge pull request #7 from mipt-npm/dev
Dev
2021-02-16 18:55:27 +03:00
e0b9fe2306 Add README.md 2021-02-16 18:31:43 +03:00
fdf88327b4 Sonatype publication 2021-02-16 18:19:22 +03:00
Alexander Nozik
cac1570e77
Merge pull request #6 from mipt-npm/dev
0.7.6
2021-02-06 16:25:33 +03:00
1fa05926af 0.7.6; Update versions 2021-02-06 16:23:01 +03:00
b6e56dc1a0 JVM-IR 2021-02-03 20:18:31 +03:00
b3dfe75154 0.7.5; Update versions 2021-02-03 20:13:22 +03:00
f1fa7e96b5 update yamlkt version 2021-01-30 19:51:05 +03:00
d64fc838fe update changelog 2021-01-30 17:21:57 +03:00
705a5815b6 update changelog 2021-01-30 17:19:37 +03:00
ca8ec1f89f Suppress API validation for experimental modules 2021-01-30 17:17:39 +03:00
3bb6f63748 Fix publishing with missing github repository 2021-01-27 22:16:56 +03:00
cdb3651b58 1.4.30-RC 2021-01-18 22:12:47 +03:00
8330a74457 1.4.30-RC 2021-01-18 22:06:13 +03:00
82436148f3 Fix circular dependency in native source sets. 2021-01-18 22:05:52 +03:00
Alexander Nozik
03977e4751
Merge pull request #5 from mipt-npm/dev
Dev
2020-12-28 09:44:14 +03:00
a9d0ddc4e5 Update versions 2020-12-16 14:14:51 +03:00
261be8938b Fix process JS resources 2020-11-27 22:50:15 +03:00
3108f16dea Move copy dependencies to platform configuration 2020-11-27 22:42:44 +03:00
1b7a2038ed Move enums to top level 2020-11-27 21:00:24 +03:00
83ab554955 Remove useDokka 2020-11-27 20:26:58 +03:00
3416598434 Refactor and fix publications for non-mpp 2020-11-27 15:10:15 +03:00
f418a101bf minor fix 2020-11-27 10:49:39 +03:00
fcdfa3fd6e Merge remote-tracking branch 'origin/dev' into dev 2020-11-26 13:44:50 +03:00
f56f1be429 cleanup 2020-11-26 13:44:36 +03:00
8c038fb2e1 Merge branch 'kotlin-1.4.20' into dev
# Conflicts:
#	gradle/wrapper/gradle-wrapper.properties
#	src/main/kotlin/ru/mipt/npm/gradle/KScienceJSPlugin.kt
#	src/main/kotlin/ru/mipt/npm/gradle/KScienceMPPlugin.kt
#	src/main/kotlin/ru/mipt/npm/gradle/common.kt
2020-11-26 13:12:26 +03:00
aa2ba8caf0 Removed unused JS distribution execution 2020-11-26 13:12:02 +03:00
Alexander Nozik
fc8f03e47e
Merge pull request #4 from mipt-npm/kotlin-1.4.20
Kotlin 1.4.20
2020-11-25 22:20:47 +03:00
be571a9028 Fix dependency configuration 2020-11-25 15:25:46 +03:00
723a959a0b Fix dependency configuration 2020-11-25 14:26:08 +03:00
f456be46d4 Centralized logic for all plugins 2020-11-25 12:16:09 +03:00
152578aaf7 Bump version 2020-10-20 09:56:01 +03:00
f44a0aaa3e Update kotlin to 1.4.20-M2
Update serialization to 1.0.0
2020-10-20 08:38:40 +03:00
2fc4bb1f3d Fix JS resource copy 2020-10-02 19:07:10 +03:00
774596bbf6 Remove node to a separate plugin 2020-09-30 20:43:02 +03:00
96bfd55219 Add plugable json serialization 2020-09-28 11:47:08 +03:00
6dfd71c1fe Bump versions 2020-09-27 19:40:05 +03:00
f4e13a9979 Native deployment update 2020-09-27 17:45:40 +03:00
981687ee5e Readme template update 2020-09-25 09:55:01 +03:00
b8635df01c Add Readme generator 2020-09-22 16:21:09 +03:00
25784a6916 fix typo 2020-09-14 22:25:52 +03:00
f5cdad2093 Update versions and add Base Plugin 2020-09-10 11:38:57 +03:00
57ca6e57af Add linux native target on windows 2020-09-09 12:33:29 +03:00
0959cdee15 back to "safe" 1.4 2020-09-09 11:43:05 +03:00
b6c984db84 Safe extension resolution.
Executables for native.
2020-09-09 11:40:49 +03:00
385fbb2ac4 kotlin to 1.4.20-dev 2020-09-09 10:18:00 +03:00
b428387116 Add automatic publishing to bintray 2020-09-07 13:32:25 +03:00
fc7ae90476 Serialization version to implementation 2020-09-06 13:35:06 +03:00
65ab0e75d3 Plugin ids update. 2020-09-05 14:17:04 +03:00
4dbc21e5c0 dev release 2020-09-02 12:09:48 +03:00
a066953872 Add application clause to the Extension 2020-09-01 20:21:41 +03:00
02cd531800 Remove JVM ir 2020-08-31 12:40:13 +03:00
6464d9d926 Migrate to kScience and kotlin 1.4 2020-08-20 10:02:28 +03:00
589ac77c2b Add jvm resource copy 2020-07-06 09:52:54 +03:00
615b06eb8c Space publishing 2020-07-05 14:39:35 +03:00
7a282fa207 Fix JVM version 2020-05-05 22:20:45 +03:00
9e37d6f752 Fix for https://youtrack.jetbrains.com/issue/KT-38230. Breakin change on the API. 2020-05-04 19:57:27 +03:00
f2a5d0715c Switch to JUnit5 2020-04-07 12:49:40 +03:00
796b40b74f Kotlin to 1.3.71. Remove inline classes flag 2020-03-25 19:19:39 +03:00
b659d0312a Fix JS distribution name 2020-03-16 20:56:23 +03:00
bf3252dbd6 JavaFX dependency builder 2020-03-16 15:22:16 +03:00
9e8b21d327 New publishing mechanics. Kotlin to 1.3.70 2020-03-14 14:42:11 +03:00
50020082a8 New deploy model 2020-03-09 13:06:40 +03:00
e00642bb34 Adjust js distribution name and move task to configuraition time. 2019-12-30 17:02:12 +03:00
99fdcfe60d Fix JVM/JS library dependency extensions 2019-12-17 20:22:43 +03:00
c700515d3f Remove project extension and replace library loading by extensions helpers. 2019-12-17 16:51:32 +03:00
8145386650 Remove project extension and replace library loading by extensions helpers. 2019-12-17 15:31:33 +03:00
7dba150ee0 Fix module generation for MPP deploy 2019-12-10 15:33:19 +03:00
b62807b345 Version upgrade 2019-12-01 19:59:29 +03:00
8bf94544b0 Fixed compilation versions for plugin and JVM target 2019-11-20 12:25:02 +03:00
1728ba7585 Fixed compilation versions for plugin and JVM target 2019-11-20 10:41:37 +03:00
cca2fdae8e roll back to junit4
remove io plugin magick
2019-11-19 22:30:50 +03:00
8071d33c44 kotlin 1.3.60, gradle 6, junit5 2019-11-17 21:41:23 +03:00
af1e79ddba Fixed deploy to bintray and dokka configuration 2019-11-01 22:57:53 +03:00
1f03951cff Updated dokka plugin 2019-11-01 22:06:41 +03:00
7b45e253b4 Removed afterEvaluate from libraries definition 2019-10-09 18:32:07 +03:00
b7b42b18f2 Bump version to 0.2.0 2019-10-04 18:38:39 +03:00
06f683ea5d Removed artifactory mentions 2019-10-04 18:38:15 +03:00
72d0d3fac6 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	src/main/kotlin/scientifik/common.kt
2019-10-04 17:52:01 +03:00
b1f16f2513 added DataForge repository 2019-10-04 17:50:48 +03:00
01d61a236e Versions update 2019-10-03 15:27:28 +03:00
c7c9872f16 Bump serialization version to 0.13.0 2019-09-14 19:42:12 +03:00
9719c350d1 version 0.1.7 2019-09-14 19:05:04 +03:00
29ab02e9dc Fixed extension handling of kotlin features 2019-09-14 19:02:50 +03:00
321180dc97 Added experimental features 2019-09-12 09:42:08 +03:00
09d3b0e973 Fixed wrong stdlib dependency. 2019-09-10 21:22:58 +03:00
4805d3aba7 0.1.6 updated kotlin and libraries versions 2019-08-24 15:01:16 +03:00
6e1d8cd800 0.1.5. Refactored dokka and extension logic 2019-08-09 11:51:30 +03:00
38 changed files with 2697 additions and 793 deletions

21
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: Gradle build
on:
push:
branches: [ dev, master ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2.5.0
with:
java-version: 11
distribution: liberica
- uses: gradle/gradle-build-action@v2
with:
arguments: build

24
.github/workflows/publish.yml vendored Normal file
View File

@ -0,0 +1,24 @@
name: Gradle publish
on:
workflow_dispatch:
release:
types: [ created ]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2.5.0
with:
java-version: 11
distribution: liberica
- uses: gradle/gradle-build-action@v2
with:
arguments: |
publishAllPublicationsToSpaceRepository
-Ppublishing.space.user=${{ secrets.SPACE_APP_ID }}
-Ppublishing.space.token=${{ secrets.SPACE_APP_SECRET }}

43
.space.kts Normal file
View File

@ -0,0 +1,43 @@
import kotlin.io.path.readText
job("Build") {
gradlew("openjdk:11", "build")
}
job("Publish"){
startOn {
gitPush { enabled = false }
}
container("openjdk:11") {
env["SPACE_USER"] = Secrets("space_user")
env["SPACE_TOKEN"] = Secrets("space_token")
kotlinScript { api ->
val spaceUser = System.getenv("SPACE_USER")
val spaceToken = System.getenv("SPACE_TOKEN")
// write version to the build directory
api.gradlew("version")
//read version from build file
val version = java.nio.file.Path.of("build/project-version.txt").readText()
api.space().projects.automation.deployments.start(
project = api.projectIdentifier(),
targetIdentifier = TargetIdentifier.Key("gradle-tools"),
version = version,
// automatically update deployment status based on a status of a job
syncWithAutomationJob = true
)
try {
api.gradlew(
"publishAllPublicationsToSpaceRepository",
"-Ppublishing.space.user=\"$spaceUser\"",
"-Ppublishing.space.token=\"$spaceToken\"",
)
} catch (ex: Exception) {
println("Publish failed")
}
}
}
}

250
CHANGELOG.md Normal file
View File

@ -0,0 +1,250 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
### Changed
### Deprecated
### Removed
### Fixed
### Security
## 0.14.4-kotlin-1.8.20-RC - 2023-03-12
### Added
- Easier dependency handling in `kscience` block
- Customizable base jdk version
### Changed
- MPP does not use JVM and JS(IR) targets anymore. They could be turned manually via `js()`, `jvm()` or `fullStack()`
- Signing is not applied if signingId is not provided
### Removed
- FX plugins
- Unnecessary library shortcuts (html and datetime)
- deploy/release tasks
### Fixed
- Gradle 8 compatibility
- Dokka publication
- issues with test sourcesets
## 0.13.4-kotlin-1.8.0 - 2022-12-31
### Added
- Public `isInDevelopment` project flag
### Changed
- Require manual pom config for publications
- Kotlin 1.8.0
- Versions update
- Project group changed to `space.kscience`
- Moved `yarn.lock` to `gradle` directory
### Deprecated
- FX configuration
### Removed
- Xjdk-release flag because it is broken until https://youtrack.jetbrains.com/issue/KT-52823
- Use CSS loader in JS by default
## 0.11.6-kotlin-1.7.0
### Changed
- Coroutines tests are applied only when explicit `useCoroutines` is used.
### Removed
- Atomicfu support inside the plugin
### Fixed
- Rollback coroutines to 1.6.1
## 0.11.5-kotlin-1.7.0
### Added
- Coroutine tests as default dependency for tests
- Context receiver flag
### Changed
- Separate release tasks for each target
- Kotlin 1.7.0
- Ktor 2.0.1
- ExplicitAPI does not override existing value
### Removed
- Ktor specific artifacts from version catalog
### Fixed
- Moved signing out of sonatype block
## 0.11.1-kotlin-1.6.10
### Added
- Default templates for README and ARTIFACT
### Changed
- Replaced Groovy templates by FreeMarker
### Fixed
- JS publication sources jar
## 0.10.9-kotlin-1.6.10
### Added
- html builders for readme
### Changed
- Kotlin 1.6.0
- Use indy lambdas by default #32
- Change version scheme to `<version>-kotlin-<kotlin version>`
### Fixed
- remove `nativeMain` dependency from `nativeTest`
## 0.10.4
### Changed
- Kotlin 1.6
### Fixed
- Some issues with opt-ins
## 0.10.2
### Added
- Experimental automatic JS project bundling in MPP
### Changed
- Remove vcs requirement for Space publication
## 0.10.0
### Added
- Lazy readme properties
- BOM for kotlin-wrappers on JS
- Jupyter loader
### Changed
- API validation disabled for dev versions
- Kotlin plugins are propagated downstream
### Removed
- bson support
## 0.9.5
### Added
- Disable API validation for snapshots
- `-Xjvm-default=all` on JVM
### Changed
- `publication.platform` changed to `publishing.platform`
- Dokka version to `1.4.30`
- `useDateTime` in extension
- Kotlin 1.5
### Removed
- Publish plugin. Use MavenPublish instead
### Fixed
- Removed unnecessary `afterEvaluate` for compatibility with gradle 7.0
## 0.9.0
### Added
- Skip sonatype publishing for dev versions
### Changed
- Publishing repositories are explicit and defined in the top level project
- Paths to publishing properties now use dot notation like `publishing.github.user`
### Deprecated
- Publishing plugin
### Removed
- Bintray publishing
## 0.8.4
### Added
- Adaptive support for host OS in native
- CSS support for JS targets
### Changed
- Kotlin 1.4.31
- Coroutines 1.4.3
### Fixed
- Plugin loading order for publishing
- Release task
- Readme generation for multi-module project
## 0.8.1
### Added
- Ktor version to versions
- Add sonatype publishing
- Per-platform release publishing
### Changed
- Kotlin to 1.4.30 stable.
- Added intermediate jsCommon main/test sourcesSet for node plugin.
- Plugin names changed to `ru.mipt.npm` package.
- Common plugin id changed to `common`
- Plugins group changed to `ru.mipt.npm` with `gradle` prefix
### Removed
- kaml
### Fixed
- Fix publishing load order for sonatype
- Fix root project readme
## 0.7.4
### Added
- Changelog plugin automatically applied to `project`.
- Feature matrix and Readme generation task for a `project` plugin.
- Add `binary-compatibility-validator` to the `project` plugin.
- Separate `yamlKt` serialization target
- Moved all logic to a common plugin, leaving only proxies for platform plugins
- Suppress API validation for modules with maturity below DEVELOPMENT
### Changed
- Remove node plugin. Node binaries should be turned on manually.
- Use default webpack distribution path.
- `ru.mipt.npm.base` -> `ru.mipt.npm.project`.
- Move publishing out of general extension and apply it to project plugin instead.
- Platform plugins are now simple references to common plugin
- FX configuration moved to extension
- Moved internals to internals
- Kotlin 1.4.30-RC
### Deprecated
- Support of `kaml` and `snake-yaml` in favor of `yamlKt`
- Publish plugin
### Removed
- `useDokka` method. Documentation jar should be added manually if needed.
## 0.6.0
### Added
- Migrate to kotlin 1.4.0
- Separate Native (current platform) and nodeJs plugins.
- Add `application()` toggle in plugin configuration to produce binaries on JS and applicaion plugin on jvm.
- Add `publish` to expose publishing configuration.
## 0.5.2
### Added
- Copy resources for jvm modules and jvm source sets in mpp.

28
README.md Normal file
View File

@ -0,0 +1,28 @@
[![Maven Central](https://img.shields.io/maven-central/v/space.kscience.gradle.project/space.kscience.gradle.project.gradle.plugin.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22space.kscience.gradle.project%22%20AND%20a:%22space.kscience.gradle.project.gradle.plugin%22)
# KScience build tools
A collection of gradle plugins for building and publish in *kscience* and *dataforge* projects.
## space.kscience.gradle.common
A primary plugin. When used with kotlin-jvm, kotlin-js or kotlin-mulitplatform configures the project for appropriate target.
## space.kscience.gradle.project
Root project tool including JetBrains changelog plugin an kotlin binary compatibility validator tool.
## space.kscience.gradle.mpp
`= kotlin("multiplatform") + space.kscience.gradle.common`
Includes JVM-IR and JS-IR-Browser targets.
## space.kscience.gradle.jvm
`= kotlin("jvm") + space.kscience.gradle.common`
## space.kscience.gradle.js
`= kotlin("js") + space.kscience.gradle.common`
## space.kscience.gradle.native
add default native targets to `space.kscience.gradle.mpp`
## space.kscience.gradle.node
add node target to `space.kscience.gradle.mpp`

View File

@ -1,80 +1,142 @@
import java.util.*
plugins {
`java-gradle-plugin`
`kotlin-dsl`
`maven-publish`
id("com.jfrog.bintray") version "1.8.4"
signing
`version-catalog`
alias(libs.plugins.changelog)
alias(libs.plugins.dokka)
}
group = "scientifik"
version = "0.1.4"
group = "space.kscience"
version = libs.versions.tools.get()
description = "Build tools for kotlin for science projects"
changelog.version.set(project.version.toString())
repositories {
mavenCentral()
gradlePluginPortal()
jcenter()
maven("https://kotlin.bintray.com/kotlinx")
maven("https://dl.bintray.com/kotlin/kotlin-eap")
maven("https://repo.kotlin.link")
}
val kotlinVersion = "1.3.50-eap-5"
kotlin.explicitApiWarning()
// Add plugins used in buildSrc as dependencies, also we should specify version only here
dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
implementation("org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.1.0")
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.12.9")
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.9.18")
api(libs.kotlin.gradle)
implementation(libs.binary.compatibility.validator)
implementation(libs.changelog.gradle)
implementation(libs.dokka.gradle)
implementation(libs.kotlin.jupyter.gradle)
implementation(libs.kotlin.serialization)
implementation(libs.kotlinx.html)
implementation("org.tomlj:tomlj:1.1.0")
// // nexus publishing plugin
// implementation("io.github.gradle-nexus:publish-plugin:1.1.0")
implementation("org.freemarker:freemarker:2.3.31")
testImplementation(kotlin("test"))
}
tasks.test {
useJUnitPlatform()
}
//declaring exported plugins
gradlePlugin {
plugins {
create("scientifik-publish") {
id = "scientifik.publish"
description = "The publication plugin for bintray and artifactory"
implementationClass = "scientifik.ScientifikPublishPlugin"
create("project") {
id = "space.kscience.gradle.project"
description = "The root plugin for multi-module project infrastructure"
implementationClass = "space.kscience.gradle.KScienceProjectPlugin"
}
create("scientifik-mpp") {
id = "scientifik.mpp"
create("mpp") {
id = "space.kscience.gradle.mpp"
description = "Pre-configured multiplatform project"
implementationClass = "scientifik.ScientifikMPPlugin"
implementationClass = "space.kscience.gradle.KScienceMPPlugin"
}
create("scientifik-jvm") {
id = "scientifik.jvm"
create("jvm") {
id = "space.kscience.gradle.jvm"
description = "Pre-configured JVM project"
implementationClass = "scientifik.ScientifikJVMPlugin"
implementationClass = "space.kscience.gradle.KScienceJVMPlugin"
}
create("scientifik-js") {
id = "scientifik.js"
create("js") {
id = "space.kscience.gradle.js"
description = "Pre-configured JS project"
implementationClass = "scientifik.ScientifikJSPlugin"
implementationClass = "space.kscience.gradle.KScienceJSPlugin"
}
}
}
create("scientifik-atomic") {
id = "scientifik.atomic"
description = "Add kotlin atomic plugin to any flafor"
implementationClass = "scientifik.ScientifikAtomicPlugin"
tasks.create("version") {
group = "publishing"
val versionFile = project.buildDir.resolve("project-version.txt")
outputs.file(versionFile)
doLast {
versionFile.createNewFile()
versionFile.writeText(project.version.toString())
println(project.version)
}
}
//publishing version catalog
catalog.versionCatalog {
from(files("gradle/libs.versions.toml"))
}
//publishing the artifact
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.named("main").get().allSource)
}
val javadocsJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
archiveClassifier.set("javadoc")
from(tasks.dokkaHtml)
}
val emptyJavadocJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
archiveBaseName.set("empty")
archiveClassifier.set("javadoc")
}
val emptySourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
archiveBaseName.set("empty")
}
publishing {
repositories {
maven("https://bintray.com/mipt-npm/scientifik")
}
val vcs = "https://github.com/mipt-npm/scientifik-gradle-tools"
val vcs = "https://github.com/mipt-npm/gradle-tools"
// Process each publication we have in this project
publications.filterIsInstance<MavenPublication>().forEach { publication ->
publications {
create<MavenPublication>("catalog") {
from(components["versionCatalog"])
artifactId = "version-catalog"
@Suppress("UnstableApiUsage")
publication.pom {
pom {
name.set("version-catalog")
}
}
withType<MavenPublication> {
// thanks @vladimirsitnikv for the fix
artifact(if (name == "catalog") emptySourcesJar else sourcesJar)
artifact(if (name == "catalog") emptyJavadocJar else javadocsJar)
pom {
name.set(project.name)
description.set(project.description)
url.set(vcs)
@ -82,53 +144,86 @@ publishing {
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("MIPT-NPM")
name.set("MIPT nuclear physics methods laboratory")
organization.set("MIPT")
organizationUrl.set("http://npm.mipt.ru")
organizationUrl.set("https://npm.mipt.ru")
}
}
}
scm {
url.set(vcs)
tag.set(project.version.toString())
}
}
}
}
bintray {
user = project.findProperty("bintrayUser") as? String ?: System.getenv("BINTRAY_USER")
key = project.findProperty("bintrayApiKey") as? String? ?: System.getenv("BINTRAY_API_KEY")
publish = true
override = true // for multi-platform Kotlin/Native publishing
val spaceRepo = "https://maven.pkg.jetbrains.space/spc/p/sci/maven"
val spaceUser: String? = findProperty("publishing.space.user") as? String
val spaceToken: String? = findProperty("publishing.space.token") as? String
// We have to use delegateClosureOf because bintray supports only dynamic groovy syntax
// this is a problem of this plugin
pkg.apply {
userOrg = "mipt-npm"
repo = if (project.version.toString().contains("dev")) "dev" else "scientifik"
name = project.name
issueTrackerUrl = "$vcs/issues"
setLicenses("Apache-2.0")
vcsUrl = vcs
version.apply {
name = project.version.toString()
vcsTag = project.version.toString()
released = Date().toString()
if (spaceUser != null && spaceToken != null) {
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
repositories.maven {
name = "space"
url = uri(spaceRepo)
credentials {
username = spaceUser
password = spaceToken
}
}
}
//workaround bintray bug
project.afterEvaluate {
setPublications(*project.extensions.findByType<PublishingExtension>()!!.publications.names.toTypedArray())
val sonatypeUser: String? = project.findProperty("publishing.sonatype.user") as? String
val sonatypePassword: String? = project.findProperty("publishing.sonatype.password") as? String
if (sonatypeUser != null && sonatypePassword != null) {
val sonatypeRepo: String = if (project.version.toString().contains("dev")) {
"https://oss.sonatype.org/content/repositories/snapshots"
} else {
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
}
repositories.maven {
name = "sonatype"
url = uri(sonatypeRepo)
credentials {
username = sonatypeUser
password = sonatypePassword
}
}
signing {
//useGpgCmd()
sign(publications)
}
}
}
kotlin {
jvmToolchain {
languageVersion.set(JavaLanguageVersion.of(11))
}
}
tasks.processResources.configure {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
from("gradle/libs.versions.toml")
}
// Workaround for https://github.com/gradle/gradle/issues/15568
tasks.withType<AbstractPublishToMaven>().configureEach {
mustRunAfter(tasks.withType<Sign>())
}

1
gradle.properties Normal file
View File

@ -0,0 +1 @@
kotlin.code.style=official

116
gradle/libs.versions.toml Normal file
View File

@ -0,0 +1,116 @@
[versions]
tools = "0.14.4-kotlin-1.8.20-RC"
kotlin = "1.8.20-RC"
atomicfu = "0.19.0"
binary-compatibility-validator = "0.12.1"
changelog = "2.0.0"
dokka = "1.7.20"
kotlin-jupyter = "0.11.0-317"
kotlinx-benchmark = "0.4.7"
kotlinx-cli = "0.3.5"
kotlinx-coroutines = "1.6.4"
kotlinx-datetime = "0.4.0"
kotlinx-html = "0.8.0"
kotlinx-knit = "0.4.0"
kotlinx-nodejs = "0.0.7"
kotlinx-serialization = "1.4.1"
ktor = "2.2.3"
xmlutil = "0.84.3"
yamlkt = "0.12.0"
jsBom = "1.0.0-pre.509"
junit = "5.9.2"
compose = "1.3.0"
logback = "1.4.5"
[libraries]
atomicfu-gradle = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }
atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu" }
binary-compatibility-validator = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version.ref = "binary-compatibility-validator" }
changelog-gradle = { module = "org.jetbrains.intellij.plugins:gradle-changelog-plugin", version.ref = "changelog" }
dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
kotlin-jupyter-gradle = { module = "org.jetbrains.kotlin:kotlin-jupyter-api-gradle-plugin", version.ref = "kotlin-jupyter" }
kotlinx-benchmark-runtime = { module = "org.jetbrains.kotlinx:kotlinx-benchmark-runtime", version.ref = "kotlinx-benchmark" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-debug = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-debug", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-reactive = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactive", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-reactor = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-reactor", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-rx2 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx2", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-rx3 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-rx3", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-javafx = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-javafx", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-swing = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-jdk8 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-guava = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-guava", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-slf4j = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-slf4j", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinx-coroutines" }
kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli", version.ref = "kotlinx-cli" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
kotlinx-html = { module = "org.jetbrains.kotlinx:kotlinx-html", version.ref = "kotlinx-html" }
kotlinx-knit = { module = "org.jetbrains.kotlinx:kotlinx-knit", version.ref = "kotlinx-knit" }
kotlinx-nodejs = { module = "org.jetbrains.kotlinx:kotlinx-nodejs", version.ref = "kotlinx-nodejs" }
kotlinx-serialization-cbor = { module = "org.jetbrains.kotlinx:kotlinx-serialization-cbor", version.ref = "kotlinx-serialization" }
kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" }
kotlinx-serialization-hocon = { module = "org.jetbrains.kotlinx:kotlinx-serialization-hocon", version.ref = "kotlinx-serialization" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" }
kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serialization-protobuf", version.ref = "kotlinx-serialization" }
kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlinx-serialization" }
ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" }
xmlutil-core = { module = "io.github.pdvrieze.xmlutil:core", version.ref = "xmlutil" }
xmlutil-ktor = { module = "io.github.pdvrieze.xmlutil:ktor", version.ref = "xmlutil" }
xmlutil-serialization = { module = "io.github.pdvrieze.xmlutil:serialization", version.ref = "xmlutil" }
yamlkt = { module = "net.mamoe.yamlkt:yamlkt", version.ref = "yamlkt" }
logback-classic = {module = "ch.qos.logback:logback-classic", version.ref = "logback"}
[plugins]
changelog = { id = "org.jetbrains.changelog", version.ref = "changelog" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
compose = {id = "org.jetbrains.compose", version.ref = "compose"}
gradle-common = { id = "space.kscience.gradle.common", version.ref = "tools" }
gradle-project = { id = "space.kscience.gradle.project", version.ref = "tools" }
gradle-mpp = { id = "space.kscience.gradle.mpp", version.ref = "tools" }
gradle-jvm = { id = "space.kscience.gradle.jvm", version.ref = "tools" }
gradle-js = { id = "space.kscience.gradle.js", version.ref = "tools" }
gradle-native = { id = "space.kscience.gradle.native", version.ref = "tools" }
gradle-node = { id = "space.kscience.gradle.node", version.ref = "tools" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-android-extensions = { id = "org.jetbrains.kotlin.android.extensions", version.ref = "kotlin" }
kotlin-js = { id = "org.jetbrains.kotlin.js", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-native-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
kotlin-plugin-allopen = { id = "org.jetbrains.kotlin.plugin.allopen", version.ref = "kotlin" }
kotlin-plugin-jpa = { id = "org.jetbrains.kotlin.plugin.jpa", version.ref = "kotlin" }
kotlin-plugin-lombok = { id = "org.jetbrains.kotlin.plugin.lombok", version.ref = "kotlin" }
kotlin-plugin-noarg = { id = "org.jetbrains.kotlin.plugin.noarg", version.ref = "kotlin" }
kotlin-plugin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" }
kotlin-plugin-scripting = { id = "org.jetbrains.kotlin.plugin.scripting", version.ref = "kotlin" }
kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlin-plugin-spring = { id = "org.jetbrains.kotlin.plugin.spring", version.ref = "kotlin" }
kotlin-jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlin-jupyter" }
kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark" }

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

234
gradlew vendored Executable file
View File

@ -0,0 +1,234 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

89
gradlew.bat vendored Normal file
View File

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@ -1,2 +0,0 @@
rootProject.name = 'gradle-tools'

1
settings.gradle.kts Normal file
View File

@ -0,0 +1 @@
rootProject.name = "gradle-tools"

View File

@ -1,9 +0,0 @@
/**
* Build constants
*/
object Scientifik {
const val ioVersion = "0.1.13"
const val coroutinesVersion = "1.2.2"
const val atomicfuVersion = "0.12.9"
const val serializationVersion = "0.11.1"
}

View File

@ -1,68 +0,0 @@
package scientifik
import Scientifik
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
class ScientifikAtomicPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
plugins.apply("kotlinx-atomicfu")
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
project.configure<KotlinMultiplatformExtension> {
sourceSets.invoke {
val commonMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:atomicfu-common:${Scientifik.atomicfuVersion}")
}
}
val jvmMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:atomicfu:${Scientifik.atomicfuVersion}")
}
}
val jsMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:atomicfu-common-js:${Scientifik.atomicfuVersion}")
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
//TODO add native clause
}
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
configure<KotlinJvmProjectExtension> {
sourceSets["main"].apply {
dependencies {
implementation("org.jetbrains.kotlinx:atomicfu:${Scientifik.atomicfuVersion}")
}
}
}
}
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
configure<KotlinJsProjectExtension> {
sourceSets["main"].apply {
dependencies {
implementation("org.jetbrains.kotlinx:atomicfu-js:${Scientifik.atomicfuVersion}")
}
}
}
}
}
}
}

View File

@ -1,17 +0,0 @@
package scientifik
import org.gradle.api.Project
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.findByType
open class ScientifikExtension {
var githubProject: String? = null
var vcs: String? = null
var bintrayRepo: String? = null
var kdoc: Boolean = true
var serialization = false
var io = false
}
internal val Project.scientifik: ScientifikExtension
get() = extensions.findByType() ?: extensions.create("scientifik")

View File

@ -1,77 +0,0 @@
package scientifik
import Scientifik
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.Copy
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
import java.io.File
open class ScientifikJSPlugin : Plugin<Project> {
override fun apply(project: Project) {
val extension = project.scientifik
with(project) {
plugins.apply("org.jetbrains.kotlin.js")
plugins.apply("kotlinx-serialization")
plugins.apply("kotlinx-atomicfu")
repositories.applyRepos()
configure<KotlinJsProjectExtension> {
target {
browser()
}
sourceSets["main"].apply {
languageSettings.applySettings()
dependencies {
api(kotlin("stdlib-jdk8"))
afterEvaluate {
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
}
if (extension.io) {
api("org.jetbrains.kotlinx:kotlinx-io-js:${Scientifik.ioVersion}")
}
}
}
}
}
tasks.apply {
val browserWebpack by getting(KotlinWebpack::class) {
afterEvaluate {
val destination = listOf(archiveBaseName, archiveAppendix, archiveVersion, archiveClassifier)
.filter { it != null && it.isNotBlank() }
.joinToString("-")
destinationDirectory = destinationDirectory?.resolve(destination)
}
archiveFileName = "main.bundle.js"
}
afterEvaluate {
val installJsDist by creating(Copy::class) {
group = "distribution"
dependsOn(browserWebpack)
from(fileTree("src/main/web"))
into(browserWebpack.destinationDirectory!!)
doLast{
val indexFile = File(browserWebpack.destinationDirectory!!,"index.html")
if(indexFile.exists()){
println("Run JS distribution at: ${indexFile.canonicalPath}")
}
}
}
findByName("assemble")?.dependsOn(installJsDist)
}
}
}
}
}

View File

@ -1,48 +0,0 @@
package scientifik
import Scientifik
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
open class ScientifikJVMPlugin : Plugin<Project> {
override fun apply(project: Project) {
val extension = project.scientifik
with(project) {
plugins.apply("org.jetbrains.kotlin.jvm")
plugins.apply("kotlinx-serialization")
repositories.applyRepos()
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
}
}
configure<KotlinJvmProjectExtension> {
sourceSets["main"].apply {
languageSettings.applySettings()
dependencies {
api(kotlin("stdlib-jdk8"))
afterEvaluate {
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
}
if (extension.io) {
api("org.jetbrains.kotlinx:kotlinx-io-jvm:${Scientifik.ioVersion}")
}
}
}
}
}
}
}
}

View File

@ -1,134 +0,0 @@
package scientifik
import Scientifik
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.Copy
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
import java.io.File
open class ScientifikMPPlugin : Plugin<Project> {
override fun apply(project: Project) {
val extension = project.scientifik
project.plugins.apply("org.jetbrains.kotlin.multiplatform")
project.plugins.apply("kotlinx-serialization")
project.repositories.applyRepos()
project.configure<KotlinMultiplatformExtension> {
jvm {
compilations.all {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js {
browser {}
}
sourceSets.invoke {
val commonMain by getting {
dependencies {
api(kotlin("stdlib"))
project.afterEvaluate {
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:${Scientifik.serializationVersion}")
}
if(extension.io){
api("org.jetbrains.kotlinx:kotlinx-io:${Scientifik.ioVersion}")
}
}
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jvmMain by getting {
dependencies {
api(kotlin("stdlib-jdk8"))
project.afterEvaluate {
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:${Scientifik.serializationVersion}")
}
if (extension.io) {
api("org.jetbrains.kotlinx:kotlinx-io-jvm:${Scientifik.ioVersion}")
}
}
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
}
}
val jsMain by getting {
dependencies {
api(kotlin("stdlib-js"))
project.afterEvaluate {
if (extension.serialization) {
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:${Scientifik.serializationVersion}")
}
if (extension.io) {
api("org.jetbrains.kotlinx:kotlinx-io-js:${Scientifik.ioVersion}")
}
}
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
}
targets.all {
sourceSets.all {
languageSettings.applySettings()
}
}
}
project.tasks.apply {
val jsBrowserWebpack by getting(KotlinWebpack::class) {
archiveClassifier = "js"
project.afterEvaluate {
val destination = listOf(archiveBaseName, archiveAppendix, archiveVersion, archiveClassifier)
.filter { it != null && it.isNotBlank() }
.joinToString("-")
destinationDirectory = destinationDirectory?.resolve(destination)
}
archiveFileName = "main.bundle.js"
}
project.afterEvaluate {
val installJsDist by creating(Copy::class) {
group = "distribution"
dependsOn(jsBrowserWebpack)
from(project.fileTree("src/jsMain/web"))
into(jsBrowserWebpack.destinationDirectory!!)
doLast{
val indexFile = File(jsBrowserWebpack.destinationDirectory!!,"index.html")
if(indexFile.exists()){
println("Run JS distribution at: ${indexFile.canonicalPath}")
}
}
}
findByName("assemble")?.dependsOn(installJsDist)
}
}
}
}

View File

@ -1,40 +0,0 @@
package scientifik
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.*
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
class ScientifikNativePlugin : Plugin<Project> {
override fun apply(target: Project) {
target.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
target.configure<KotlinMultiplatformExtension> {
linuxX64()
mingwX64()
sourceSets.apply {
val commonMain by getting {}
val native by creating {
dependsOn(commonMain)
dependencies {
//TODO add stdlib here
target.afterEvaluate {
//TODO add optional libraries here
}
}
}
mingwX64().compilations["main"].defaultSourceSet {
dependsOn(native)
}
linuxX64().compilations["main"].defaultSourceSet {
dependsOn(native)
}
}
}
}
}
}

View File

@ -1,293 +0,0 @@
package scientifik
import com.jfrog.bintray.gradle.BintrayExtension
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
import groovy.lang.GroovyObject
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.plugins.JavaBasePlugin
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.internal.artifact.FileBasedMavenArtifact
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.*
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
import org.jfrog.gradle.plugin.artifactory.dsl.PublisherConfig
import org.jfrog.gradle.plugin.artifactory.dsl.ResolverConfig
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask
// recursively search up the project chain for configuration
private val Project.bintrayRepo: String?
get() = extensions.findByType<ScientifikExtension>()?.bintrayRepo
?: parent?.bintrayRepo
?: (findProperty("bintrayRepo") as? String)
private val Project.githubProject: String?
get() = extensions.findByType<ScientifikExtension>()?.githubProject
?: parent?.githubProject
?: (findProperty("githubProject") as? String)
private val Project.vcs: String?
get() = extensions.findByType<ScientifikExtension>()?.vcs
?: parent?.vcs
?: (findProperty("vcs") as? String)
?: githubProject?.let { "https://github.com/mipt-npm/$it" }
open class ScientifikPublishPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.plugins.apply("maven-publish")
val extension = project.scientifik
project.afterEvaluate {
if (extension.kdoc) {
project.plugins.apply("org.jetbrains.dokka")
}
val bintrayRepo = if (project.version.toString().contains("dev")) {
"dev"
} else {
project.bintrayRepo
}
val vcs = project.vcs
if (vcs == null) {
project.logger.warn("[${project.name}] Missing deployment configuration. Skipping publish.")
return@afterEvaluate
}
project.plugins.apply("com.jfrog.bintray")
project.plugins.apply("com.jfrog.artifactory")
project.configure<PublishingExtension> {
// Process each publication we have in this project
publications.filterIsInstance<MavenPublication>().forEach { publication ->
@Suppress("UnstableApiUsage")
publication.pom {
name.set(project.name)
description.set(project.description)
url.set(vcs)
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("MIPT-NPM")
name.set("MIPT nuclear physics methods laboratory")
organization.set("MIPT")
organizationUrl.set("http://npm.mipt.ru")
}
}
scm {
url.set(vcs)
}
}
}
val githubUser: String? by project
val githubToken: String? by project
val githubProject = project.githubProject
if (githubProject != null && githubUser != null && githubToken != null) {
repositories {
val repository = maven {
name = "github"
url = uri("https://maven.pkg.github.com/mipt-npm/$githubProject/")
credentials {
username = githubUser
password = githubToken
}
}
val githubPublishTasks = publications.filterIsInstance<MavenPublication>().map { publication ->
tasks.register<PublishToMavenRepository>("publish${publication.name.capitalize()}ToGithub") {
group = "publishing"
this.publication = publication
this.repository = repository
}
}
tasks.register<PublishToMavenRepository>("publishToGithub") {
group = "publishing"
dependsOn(githubPublishTasks)
}
}
}
}
if (extension.kdoc) {
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
jdkVersion = 8
kotlinTasks {
// dokka fails to retrieve sources from MPP-tasks so we only define the jvm task
listOf(tasks.getByPath("compileKotlinJvm"))
}
sourceRoot {
// assuming only single source dir
path = sourceSets["commonMain"].kotlin.srcDirs.first().toString()
platforms = listOf("Common")
}
// although the JVM sources are now taken from the task,
// we still define the jvm source root to get the JVM marker in the generated html
sourceRoot {
// assuming only single source dir
path = sourceSets["jvmMain"].kotlin.srcDirs.first().toString()
platforms = listOf("JVM")
}
}
val kdocJar by tasks.registering(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
dependsOn(dokka)
archiveClassifier.set("javadoc")
from("$buildDir/javadoc")
}
configure<PublishingExtension> {
targets.all {
val publication = publications.findByName(name) as MavenPublication
// Patch publications with fake javadoc
publication.artifact(kdocJar.get())
}
tasks.filter { it is ArtifactoryTask || it is BintrayUploadTask }.forEach {
it.doFirst {
publications.filterIsInstance<MavenPublication>()
.forEach { publication ->
val moduleFile =
buildDir.resolve("publications/${publication.name}/module.json")
if (moduleFile.exists()) {
publication.artifact(object : FileBasedMavenArtifact(moduleFile) {
override fun getDefaultExtension() = "module"
})
}
}
}
}
}
}
extensions.findByType<KotlinJvmProjectExtension>()?.apply {
val sourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets["main"].kotlin.srcDirs.first())
}
val dokka by tasks.getting(DokkaTask::class) {
outputFormat = "html"
outputDirectory = "$buildDir/javadoc"
jdkVersion = 8
}
val kdocJar by tasks.registering(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
dependsOn(dokka)
archiveClassifier.set("javadoc")
from("$buildDir/javadoc")
}
configure<PublishingExtension> {
publications {
register("jvm", MavenPublication::class) {
from(components["java"])
artifact(sourcesJar.get())
artifact(kdocJar.get())
}
}
}
}
}
project.configure<ArtifactoryPluginConvention> {
val artifactoryUser: String? by project
val artifactoryPassword: String? by project
val artifactoryContextUrl = "http://npm.mipt.ru:8081/artifactory"
setContextUrl(artifactoryContextUrl)//The base Artifactory URL if not overridden by the publisher/resolver
publish(delegateClosureOf<PublisherConfig> {
repository(delegateClosureOf<GroovyObject> {
setProperty("repoKey", "gradle-dev-local")
setProperty("username", artifactoryUser)
setProperty("password", artifactoryPassword)
})
defaults(delegateClosureOf<GroovyObject> {
invokeMethod("publications", arrayOf("jvm", "js", "kotlinMultiplatform", "metadata"))
})
})
resolve(delegateClosureOf<ResolverConfig> {
repository(delegateClosureOf<GroovyObject> {
setProperty("repoKey", "gradle-dev")
setProperty("username", artifactoryUser)
setProperty("password", artifactoryPassword)
})
})
}
if (bintrayRepo == null) {
project.logger.warn("[${project.name}] Bintray repository not defined")
} else {
project.configure<PublishingExtension> {
repositories {
maven("https://bintray.com/mipt-npm/$bintrayRepo")
}
}
project.configure<BintrayExtension> {
user = project.findProperty("bintrayUser") as? String?
key = project.findProperty("bintrayApiKey") as? String?
publish = true
override = true
// We have to use delegateClosureOf because bintray supports only dynamic groovy syntax
// this is a problem of this plugin
pkg.apply {
userOrg = "mipt-npm"
repo = bintrayRepo
name = project.name
issueTrackerUrl = "$vcs/issues"
setLicenses("Apache-2.0")
vcsUrl = vcs
version.apply {
name = project.version.toString()
vcsTag = project.version.toString()
released = java.util.Date().toString()
}
}
//workaround bintray bug
setPublications(*project.extensions.findByType<PublishingExtension>()!!.publications.names.toTypedArray())
}
}
}
}
}

View File

@ -1,20 +0,0 @@
package scientifik
import org.gradle.api.artifacts.dsl.RepositoryHandler
import org.gradle.kotlin.dsl.maven
import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder
internal fun LanguageSettingsBuilder.applySettings(): Unit {
progressiveMode = true
enableLanguageFeature("InlineClasses")
useExperimentalAnnotation("kotlin.ExperimentalUnsignedType")
}
internal fun RepositoryHandler.applyRepos(): Unit{
mavenCentral()
jcenter()
maven("https://dl.bintray.com/kotlin/kotlin-eap")
maven("https://kotlin.bintray.com/kotlinx")
maven("https://dl.bintray.com/mipt-npm/scientifik")
maven("https://dl.bintray.com/mipt-npm/dev")
}

View File

@ -0,0 +1,548 @@
package space.kscience.gradle
import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.plugins.ApplicationPlugin
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Copy
import org.gradle.api.tasks.testing.Test
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.*
import org.gradle.language.jvm.tasks.ProcessResources
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBrowserDsl
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmTargetDsl
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask
import space.kscience.gradle.internal.defaultKotlinJvmArgs
import space.kscience.gradle.internal.fromJsDependencies
import space.kscience.gradle.internal.useCommonDependency
public enum class DependencyConfiguration {
API,
IMPLEMENTATION,
COMPILE_ONLY,
}
public enum class DependencySourceSet(public val setName: String, public val suffix: String) {
MAIN("main", "Main"),
TEST("test", "Test")
}
/**
* Check if this project version has a development tag (`development` property to true, "dev" in the middle or "SNAPSHOT" in the end).
*/
public val Project.isInDevelopment: Boolean
get() = findProperty("development") == true
|| "dev" in version.toString()
|| version.toString().endsWith("SNAPSHOT")
private const val defaultJdkVersion = 11
public open class KScienceExtension(public val project: Project) {
public val jdkVersionProperty: Property<Int> = project.objects.property<Int>().apply {
set(defaultJdkVersion)
}
public var jdkVersion: Int by jdkVersionProperty
/**
* Use coroutines-core with default version or [version]
*/
public fun useCoroutines(
version: String = KScienceVersions.coroutinesVersion,
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
configuration: DependencyConfiguration = DependencyConfiguration.API,
) {
project.useCommonDependency(
"org.jetbrains.kotlinx:kotlinx-coroutines-core:$version",
dependencySourceSet = sourceSet,
dependencyConfiguration = configuration
)
project.useCommonDependency(
"org.jetbrains.kotlinx:kotlinx-coroutines-test:$version",
dependencySourceSet = DependencySourceSet.TEST,
dependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
)
}
/**
* Use core serialization library and configure targets
*/
public fun useSerialization(
version: String = KScienceVersions.serializationVersion,
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
configuration: DependencyConfiguration = DependencyConfiguration.API,
block: SerializationTargets.() -> Unit = {},
): Unit = project.run {
plugins.apply("org.jetbrains.kotlin.plugin.serialization")
val artifactName = if (version.startsWith("0")) {
"kotlinx-serialization-runtime"
} else {
"kotlinx-serialization-core"
}
useCommonDependency(
"org.jetbrains.kotlinx:$artifactName:$version",
dependencySourceSet = sourceSet,
dependencyConfiguration = configuration
)
SerializationTargets(sourceSet, configuration).block()
}
public fun useKtor(version: String = KScienceVersions.ktorVersion): Unit = with(project) {
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
configure<KotlinMultiplatformExtension> {
sourceSets.findByName("commonMain")?.apply {
dependencies {
api(platform("io.ktor:ktor-bom:$version"))
}
}
}
}
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
configure<KotlinJvmProjectExtension> {
sourceSets.findByName("main")?.apply {
dependencies {
api(platform("io.ktor:ktor-bom:$version"))
}
}
}
}
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
configure<KotlinJsProjectExtension> {
sourceSets.findByName("main")?.apply {
dependencies {
api(platform("io.ktor:ktor-bom:$version"))
}
}
}
}
}
/**
* Apply jupyter plugin and add entry point for the jupyter library.
* If left empty applies a plugin without declaring library producers
*/
public fun jupyterLibrary(vararg pluginClasses: String) {
project.plugins.apply("org.jetbrains.kotlin.jupyter.api")
project.tasks.named("processJupyterApiResources", JupyterApiResourcesTask::class.java) {
libraryProducers = pluginClasses.toList()
}
}
/**
* Apply common dependencies for different kind of targets
*/
public fun dependencies(sourceSet: String? = null, dependencyBlock: KotlinDependencyHandler.() -> Unit) {
project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
project.configure<KotlinJvmProjectExtension> {
sourceSets.getByName(sourceSet ?: "main") {
dependencies(dependencyBlock)
}
}
}
project.pluginManager.withPlugin("org.jetbrains.kotlin.js") {
project.configure<KotlinJsProjectExtension> {
sourceSets.getByName(sourceSet ?: "main") {
dependencies(dependencyBlock)
}
}
}
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
project.configure<KotlinMultiplatformExtension> {
sourceSets.getByName(sourceSet ?: "commonMain") {
dependencies(dependencyBlock)
}
}
}
}
public fun testDependencies(sourceSet: String? = null, dependencyBlock: KotlinDependencyHandler.() -> Unit) {
project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
project.configure<KotlinJvmProjectExtension> {
sourceSets.getByName(sourceSet ?: "test") {
dependencies(dependencyBlock)
}
}
}
project.pluginManager.withPlugin("org.jetbrains.kotlin.js") {
project.configure<KotlinJsProjectExtension> {
sourceSets.getByName(sourceSet ?: "test") {
dependencies(dependencyBlock)
}
}
}
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
project.configure<KotlinMultiplatformExtension> {
sourceSets.getByName(sourceSet ?: "commonTest") {
dependencies(dependencyBlock)
}
}
}
}
public class DefaultSourceSet(public val key: String)
public fun dependencies(
defaultSourceSet: DefaultSourceSet,
dependencyBlock: KotlinDependencyHandler.() -> Unit,
): Unit = dependencies(defaultSourceSet.key, dependencyBlock)
/**
* Mark this module as an application module. JVM application should be enabled separately
*/
public fun application() {
project.extensions.findByType<KotlinProjectExtension>()?.apply {
explicitApi = null
}
project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
project.apply<ApplicationPlugin>()
}
project.extensions.findByType<KotlinJsProjectExtension>()?.apply {
js(IR) {
binaries.executable()
}
}
project.extensions.findByType<KotlinMultiplatformExtension>()?.apply {
targets.withType<KotlinJsTargetDsl> {
binaries.executable()
}
targets.withType<KotlinNativeTarget> {
binaries.executable()
}
targets.withType<KotlinWasmTargetDsl> {
binaries.executable()
}
}
}
/**
* Add context receivers to this project and all subprojects
*/
public fun useContextReceivers() {
project.tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + "-Xcontext-receivers"
}
}
}
public operator fun DefaultSourceSet.invoke(dependencyBlock: KotlinDependencyHandler.() -> Unit) {
dependencies(this, dependencyBlock)
}
public val commonMain: DefaultSourceSet get() = DefaultSourceSet("commonMain")
public val commonTest: DefaultSourceSet get() = DefaultSourceSet("commonTest")
public val jvmMain: DefaultSourceSet get() = DefaultSourceSet("jvmMain")
public val jvmTest: DefaultSourceSet get() = DefaultSourceSet("jvmTest")
public val jsMain: DefaultSourceSet get() = DefaultSourceSet("jsMain")
public val jsTest: DefaultSourceSet get() = DefaultSourceSet("jsTest")
public val nativeMain: DefaultSourceSet get() = DefaultSourceSet("nativeMain")
public val nativeTest: DefaultSourceSet get() = DefaultSourceSet("nativeTest")
public val wasmMain: DefaultSourceSet get() = DefaultSourceSet("wasmMain")
public val wasmTest: DefaultSourceSet get() = DefaultSourceSet("wasmTest")
}
public enum class KotlinNativePreset {
linuxX64,
mingwX64,
macosX64,
macosArm64,
iosX64,
iosArm64,
iosSimulatorArm64,
}
public data class KScienceNativeTarget(
val preset: KotlinNativePreset,
val targetName: String = preset.name,
val targetConfiguration: KotlinNativeTarget.() -> Unit = { },
) {
public companion object {
public val linuxX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.linuxX64)
public val mingwX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.mingwX64)
public val macosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64)
public val macosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.macosX64)
public val iosX64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosX64)
public val iosArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosArm64)
public val iosSimulatorArm64: KScienceNativeTarget = KScienceNativeTarget(KotlinNativePreset.iosSimulatorArm64)
}
}
public class KScienceNativeConfiguration {
internal companion object {
private fun defaultNativeTargets(): Map<KotlinNativePreset, KScienceNativeTarget> {
val hostOs = System.getProperty("os.name")
return when {
hostOs.startsWith("Windows") -> listOf(
KScienceNativeTarget.linuxX64,
KScienceNativeTarget.mingwX64
)
hostOs == "Mac OS X" -> listOf(
KScienceNativeTarget.macosX64,
KScienceNativeTarget.macosArm64,
KScienceNativeTarget.iosX64,
KScienceNativeTarget.iosArm64,
KScienceNativeTarget.iosSimulatorArm64,
)
hostOs == "Linux" -> listOf(KScienceNativeTarget.linuxX64)
else -> {
emptyList()
}
}.associateBy { it.preset }
}
}
internal var targets: Map<KotlinNativePreset, KScienceNativeTarget> = defaultNativeTargets()
/**
* Replace all targets
*/
public fun setTargets(vararg target: KScienceNativeTarget) {
targets = target.associateBy { it.preset }
}
/**
* Add a native target
*/
public fun target(target: KScienceNativeTarget) {
targets += target.preset to target
}
public fun target(
preset: KotlinNativePreset,
targetName: String = preset.name,
targetConfiguration: KotlinNativeTarget.() -> Unit = { },
): Unit = target(KScienceNativeTarget(preset, targetName, targetConfiguration))
}
public open class KScienceMppExtension(project: Project) : KScienceExtension(project) {
/**
* Enable jvm target
*/
public fun jvm(block: KotlinJvmTarget.() -> Unit = {}) {
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
project.configure<KotlinMultiplatformExtension> {
jvm {
compilations.all {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + defaultKotlinJvmArgs
}
}
block()
}
sourceSets {
getByName("jvmTest") {
dependencies {
implementation(kotlin("test-junit5"))
implementation("org.junit.jupiter:junit-jupiter:${KScienceVersions.junit}")
}
}
}
jvmToolchain {
languageVersion.set(jdkVersionProperty.map { JavaLanguageVersion.of(it) })
}
}
project.tasks.withType<Test> {
useJUnitPlatform()
}
}
}
/**
* Enable JS-IR (browser) target.
*/
public fun js(block: KotlinJsTargetDsl.() -> Unit = {}) {
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
project.configure<KotlinMultiplatformExtension> {
js(IR) {
browser()
block()
}
sourceSets {
getByName("jsTest") {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
(project.tasks.findByName("jsProcessResources") as? Copy)?.apply {
fromJsDependencies("jsRuntimeClasspath")
}
}
}
@OptIn(ExperimentalWasmDsl::class)
public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) {
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
project.configure<KotlinMultiplatformExtension> {
wasm {
browser()
block()
}
}
}
}
public fun jvmAndJs() {
jvm()
js()
}
/**
* Jvm and Js source sets including copy of Js bundle into JVM resources
*/
public fun fullStack(
bundleName: String = "js/bundle.js",
jvmConfig: KotlinJvmTarget.() -> Unit = {},
jsConfig: KotlinJsTargetDsl.() -> Unit = {},
browserConfig: KotlinJsBrowserDsl.() -> Unit = {},
) {
js {
binaries.executable()
browser {
webpackTask {
outputFileName = bundleName
}
browserConfig()
}
jsConfig()
}
jvm {
val processResourcesTaskName =
compilations[org.jetbrains.kotlin.gradle.plugin.KotlinCompilation.MAIN_COMPILATION_NAME]
.processResourcesTaskName
val jsBrowserDistribution = project.tasks.getByName("jsBrowserDistribution")
project.tasks.getByName<ProcessResources>(processResourcesTaskName) {
duplicatesStrategy = DuplicatesStrategy.WARN
dependsOn(jsBrowserDistribution)
from(jsBrowserDistribution)
}
jvmConfig()
}
}
/**
* Enable all supported native targets
*/
public fun native(block: KScienceNativeConfiguration.() -> Unit = {}): Unit = with(project) {
val nativeConfiguration = KScienceNativeConfiguration().apply(block)
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
configure<KotlinMultiplatformExtension> {
val nativeTargets: List<KotlinNativeTarget> =
nativeConfiguration.targets.values.map { nativeTarget ->
when (nativeTarget.preset) {
KotlinNativePreset.linuxX64 -> linuxX64(
nativeTarget.targetName,
nativeTarget.targetConfiguration
)
KotlinNativePreset.mingwX64 -> mingwX64(
nativeTarget.targetName,
nativeTarget.targetConfiguration
)
KotlinNativePreset.macosX64 -> macosX64(
nativeTarget.targetName,
nativeTarget.targetConfiguration
)
KotlinNativePreset.macosArm64 -> macosArm64(
nativeTarget.targetName,
nativeTarget.targetConfiguration
)
KotlinNativePreset.iosX64 -> iosX64(
nativeTarget.targetName,
nativeTarget.targetConfiguration
)
KotlinNativePreset.iosArm64 -> iosArm64(
nativeTarget.targetName,
nativeTarget.targetConfiguration
)
KotlinNativePreset.iosSimulatorArm64 -> iosSimulatorArm64(
nativeTarget.targetName,
nativeTarget.targetConfiguration
)
// else -> {
// logger.error("Native preset ${nativeTarget.preset} not recognised.")
// null
// }
}
}
sourceSets {
val commonMain by getting
val commonTest by getting
val nativeMain by creating {
dependsOn(commonMain)
}
val nativeTest by creating {
//should NOT depend on nativeMain because automatic dependency by plugin
dependsOn(commonTest)
}
configure(nativeTargets) {
compilations["main"]?.apply {
configure(kotlinSourceSets) {
dependsOn(nativeMain)
}
}
compilations["test"]?.apply {
configure(kotlinSourceSets) {
dependsOn(nativeTest)
}
}
}
}
}
}
}
}
internal inline fun <reified T : KScienceExtension> Project.registerKScienceExtension(constructor: (Project) -> T): T {
extensions.findByType<T>()?.let { return it }
return constructor(this).also {
extensions.add("kscience", it)
}
}

View File

@ -0,0 +1,56 @@
package space.kscience.gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.Copy
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import space.kscience.gradle.internal.applySettings
import space.kscience.gradle.internal.fromJsDependencies
public open class KScienceJSPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = project.run {
if (!plugins.hasPlugin("org.jetbrains.kotlin.js")) {
plugins.apply("org.jetbrains.kotlin.js")
} else {
logger.info("Kotlin JS plugin is already present")
}
registerKScienceExtension(::KScienceExtension)
//logger.info("Applying KScience configuration for JS project")
configure<KotlinJsProjectExtension> {
js(IR) { browser { } }
sourceSets.all {
languageSettings.applySettings()
}
sourceSets["main"].apply {
dependencies {
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
}
}
sourceSets["test"].apply {
dependencies {
implementation(kotlin("test-js"))
}
}
if (explicitApi == null) explicitApiWarning()
}
(tasks.findByName("processResources") as? Copy)?.apply {
fromJsDependencies("runtimeClasspath")
}
// apply dokka for all projects
if (!plugins.hasPlugin("org.jetbrains.dokka")) {
apply<DokkaPlugin>()
}
}
}

View File

@ -0,0 +1,61 @@
package space.kscience.gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.testing.Test
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.withType
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import space.kscience.gradle.internal.applySettings
import space.kscience.gradle.internal.defaultKotlinJvmArgs
public open class KScienceJVMPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = project.run {
if (!plugins.hasPlugin("org.jetbrains.kotlin.jvm")) {
plugins.apply("org.jetbrains.kotlin.jvm")
} else {
logger.info("Kotlin JVM plugin is already present")
}
val extension = registerKScienceExtension(::KScienceExtension)
//logger.info("Applying KScience configuration for JVM project")
configure<KotlinJvmProjectExtension> {
sourceSets.all {
languageSettings.applySettings()
}
sourceSets["test"].apply {
dependencies {
implementation(kotlin("test-junit5"))
implementation("org.junit.jupiter:junit-jupiter:${KScienceVersions.junit}")
}
}
if (explicitApi == null) explicitApiWarning()
jvmToolchain {
languageVersion.set(extension.jdkVersionProperty.map { JavaLanguageVersion.of(it) })
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + defaultKotlinJvmArgs
}
}
tasks.withType<Test> {
useJUnitPlatform()
}
// apply dokka for all projects
if (!plugins.hasPlugin("org.jetbrains.dokka")) {
apply<DokkaPlugin>()
}
}
}

View File

@ -0,0 +1,54 @@
package space.kscience.gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.hasPlugin
import org.gradle.kotlin.dsl.invoke
import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
import space.kscience.gradle.internal.applySettings
public open class KScienceMPPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = project.run {
if (!plugins.hasPlugin(KotlinMultiplatformPlugin::class)) {
//apply<KotlinMultiplatformPlugin>() for some reason it does not work
plugins.apply("org.jetbrains.kotlin.multiplatform")
} else {
logger.info("Kotlin MPP plugin is already present")
}
registerKScienceExtension(::KScienceMppExtension)
configure<KotlinMultiplatformExtension> {
sourceSets {
getByName("commonMain"){
dependencies {
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
}
}
getByName("commonTest"){
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
}
sourceSets.all {
languageSettings.applySettings()
}
if (explicitApi == null) explicitApiWarning()
}
// apply dokka for all projects
if (!plugins.hasPlugin("org.jetbrains.dokka")) {
apply<DokkaPlugin>()
}
}
}

View File

@ -0,0 +1,262 @@
package space.kscience.gradle
import kotlinx.validation.ApiValidationExtension
import kotlinx.validation.BinaryCompatibilityValidatorPlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.publish.maven.MavenPom
import org.gradle.api.publish.maven.tasks.AbstractPublishToMaven
import org.gradle.kotlin.dsl.*
import org.gradle.plugins.signing.Sign
import org.jetbrains.changelog.ChangelogPlugin
import org.jetbrains.changelog.ChangelogPluginExtension
import org.jetbrains.dokka.gradle.AbstractDokkaTask
import org.jetbrains.dokka.gradle.DokkaPlugin
import space.kscience.gradle.internal.*
/**
* Simplifies adding repositories for Maven publishing, responds for releasing tasks for projects.
*/
public class KSciencePublishingExtension(public val project: Project) {
private var isVcsInitialized = false
/**
* Configures Git repository (sources) for the publication.
*
* @param vcsUrl URL of the repository's web interface.
* @param connectionUrl URL of the Git repository.
* @param developerConnectionUrl URL of the Git repository for developers.
*/
public fun pom(
vcsUrl: String,
connectionUrl: String? = null,
developerConnectionUrl: String? = connectionUrl,
connectionPrefix: String = "scm:git:",
pomConfig: MavenPom.() -> Unit,
) {
if (!isVcsInitialized) {
project.setupPublication {
url.set(vcsUrl)
scm {
url.set(vcsUrl)
connectionUrl?.let { connection.set("$connectionPrefix$it") }
developerConnectionUrl?.let { developerConnection.set("$connectionPrefix$it") }
}
pomConfig()
}
isVcsInitialized = true
}
}
/**
* Adds GitHub as VCS and adds GitHub Packages Maven repository to publishing.
*
* @param githubProject the GitHub project.
* @param githubOrg the GitHub user or organization.
* @param deploy publish packages in the `deploy` task to the GitHub repository.
*/
public fun github(
githubOrg: String,
githubProject: String,
deploy: Boolean = project.requestPropertyOrNull("publishing.github") == "true",
) {
if (deploy) {
try {
project.addGithubPublishing(githubOrg, githubProject)
} catch (t: Throwable) {
project.logger.error("Failed to set up github publication", t)
}
}
}
/**
* Adds Space Packages Maven repository to publishing.
*
* @param spaceRepo the repository URL.
* @param deploy publish packages in the `deploy` task to the Space repository.
*/
public fun space(
spaceRepo: String,
) {
project.addSpacePublishing(spaceRepo)
}
/**
* Adds Sonatype Maven repository to publishing.
*
* @param addToRelease publish packages in the `release` task to the Sonatype repository.
*/
public fun sonatype() {
require(isVcsInitialized) { "The project vcs is not set up use 'pom' method to do so" }
project.addSonatypePublishing()
}
}
/**
* Applies third-party plugins (Dokka, Changelog, binary compatibility validator); configures Maven publishing, README
* generation.
*/
public open class KScienceProjectPlugin : Plugin<Project> {
override fun apply(target: Project): Unit = target.run {
apply<ChangelogPlugin>()
apply<DokkaPlugin>()
apply<BinaryCompatibilityValidatorPlugin>()
allprojects{
repositories{
mavenCentral()
maven("https://repo.kotlin.link")
maven("https://maven.pkg.jetbrains.space/spc/p/sci/dev")
}
// Workaround for https://github.com/gradle/gradle/issues/15568
tasks.withType<AbstractPublishToMaven>().configureEach {
mustRunAfter(tasks.withType<Sign>())
}
}
afterEvaluate {
if (isInDevelopment) {
configure<ApiValidationExtension> {
validationDisabled = true
}
} else {
configure<ChangelogPluginExtension> {
version.set(project.version.toString())
}
}
}
val rootReadmeExtension = KScienceReadmeExtension(this)
val ksciencePublish = KSciencePublishingExtension(this)
extensions.add("ksciencePublish", ksciencePublish)
extensions.add("readme", rootReadmeExtension)
//Add readme generators to individual subprojects
subprojects {
val readmeExtension = KScienceReadmeExtension(this)
extensions.add("readme", readmeExtension)
@Suppress("UNUSED_VARIABLE")
val generateReadme by tasks.creating {
group = "documentation"
description = "Generate a README file if stub is present"
if (readmeExtension.readmeTemplate.exists()) {
inputs.file(readmeExtension.readmeTemplate)
}
readmeExtension.inputFiles.forEach {
if (it.exists()) {
inputs.file(it)
}
}
val readmeFile = this@subprojects.file("README.md")
outputs.file(readmeFile)
doLast {
val readmeString = readmeExtension.readmeString()
if (readmeString != null) {
readmeFile.writeText(readmeString)
}
}
}
// tasks.withType<AbstractDokkaTask> {
// dependsOn(generateReadme)
// }
}
val generateReadme by tasks.creating {
group = "documentation"
description = "Generate a README file and a feature matrix if stub is present"
subprojects {
tasks.findByName("generateReadme")?.let {
dependsOn(it)
}
}
if (rootReadmeExtension.readmeTemplate.exists()) {
inputs.file(rootReadmeExtension.readmeTemplate)
}
rootReadmeExtension.inputFiles.forEach {
if (it.exists()) {
inputs.file(it)
}
}
val readmeFile = project.file("README.md")
outputs.file(readmeFile)
doLast {
// val projects = subprojects.associate {
// val normalizedPath = it.path.replaceFirst(":","").replace(":","/")
// it.path.replace(":","/") to it.extensions.findByType<KScienceReadmeExtension>()
// }
if (rootReadmeExtension.readmeTemplate.exists()) {
val modulesString = buildString {
subprojects.forEach { subproject ->
// val name = subproject.name
subproject.extensions.findByType<KScienceReadmeExtension>()?.let { ext ->
val path = subproject.path.replaceFirst(":", "").replace(":", "/")
appendLine("\n### [$path]($path)")
appendLine("> ${ext.description}")
appendLine(">\n> **Maturity**: ${ext.maturity}")
val featureString = ext.featuresString(itemPrefix = "> - ", pathPrefix = "$path/")
if (featureString.isNotBlank()) {
appendLine(">\n> **Features:**")
appendLine(featureString)
}
}
}
}
rootReadmeExtension.property("modules", modulesString)
rootReadmeExtension.readmeString()?.let {
readmeFile.writeText(it)
}
}
}
}
tasks.withType<AbstractDokkaTask> {
dependsOn(generateReadme)
}
tasks.create("version") {
group = "publishing"
val versionFile = project.buildDir.resolve("project-version.txt")
outputs.file(versionFile)
doLast {
versionFile.createNewFile()
versionFile.writeText(project.version.toString())
println(project.version)
}
}
// Disable API validation for snapshots
if (isInDevelopment) {
extensions.findByType<ApiValidationExtension>()?.apply {
validationDisabled = true
logger.warn("API validation is disabled for snapshot or dev version")
}
}
plugins.withType(org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin::class.java) {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension>().lockFileDirectory =
rootDir.resolve("gradle")
}
}
public companion object {
public const val DEPLOY_GROUP: String = "deploy"
}
}

View File

@ -0,0 +1,180 @@
package space.kscience.gradle
import freemarker.cache.StringTemplateLoader
import freemarker.template.Configuration
import freemarker.template.Template
import freemarker.template.TemplateNotFoundException
import kotlinx.html.TagConsumer
import kotlinx.html.div
import kotlinx.html.stream.createHTML
import kotlinx.validation.ApiValidationExtension
import org.gradle.api.Project
import org.gradle.kotlin.dsl.findByType
import java.io.File
import java.io.StringWriter
import kotlin.collections.component1
import kotlin.collections.component2
import kotlin.collections.set
public enum class Maturity {
PROTOTYPE,
EXPERIMENTAL,
DEVELOPMENT,
STABLE,
DEPRECATED
}
private fun Template.processToString(args: Map<String, Any?>): String {
val writer = StringWriter()
process(args, writer)
return writer.toString()
}
public class KScienceReadmeExtension(public val project: Project) {
public var description: String = project.description ?: ""
public var maturity: Maturity = Maturity.EXPERIMENTAL
set(value) {
field = value
val projectName = project.name
if (value == Maturity.EXPERIMENTAL || value == Maturity.PROTOTYPE) {
project.rootProject.run {
plugins.withId("org.jetbrains.kotlinx.binary-compatibility-validator") {
extensions.findByType<ApiValidationExtension>()?.apply {
project.logger.warn("$value project $projectName is excluded from API validation")
ignoredProjects.add(projectName)
}
}
}
}
}
/**
* If true, use default templates provided by plugin if override is not defined
*/
public var useDefaultReadmeTemplate: Boolean = true
/**
* Use this template file if it is provided, otherwise use default template
*/
public var readmeTemplate: File = project.file("docs/README-TEMPLATE.md")
set(value) {
field = value
if (value.exists()) {
fmLoader.putTemplate("readme", value.readText())
}
}
private val fmLoader = StringTemplateLoader().apply {
putTemplate(
"artifact",
this@KScienceReadmeExtension.javaClass.getResource("/templates/ARTIFACT-TEMPLATE.md")!!.readText()
)
if (readmeTemplate.exists()) {
putTemplate("readme", readmeTemplate.readText())
} else if (useDefaultReadmeTemplate) {
putTemplate(
"readme",
this@KScienceReadmeExtension.javaClass.getResource("/templates/README-TEMPLATE.md")!!.readText()
)
}
}
private val fmCfg = Configuration(Configuration.VERSION_2_3_31).apply {
defaultEncoding = "UTF-8"
templateLoader = fmLoader
}
public data class Feature(val id: String, val description: String, val ref: String?, val name: String = id)
public val features: MutableList<Feature> = ArrayList()
public fun feature(id: String, ref: String? = null, name: String = id, description: () -> String) {
features += Feature(id, description(), ref, name)
}
public fun featureWithHtml(
id: String,
ref: String? = null,
name: String = id,
htmlBuilder: TagConsumer<String>.() -> Unit,
) {
val text = createHTML().apply {
div("readme-feature") {
htmlBuilder()
}
}.finalize()
features += Feature(id, text, ref, name)
}
private val properties: MutableMap<String, () -> Any?> = mutableMapOf(
"name" to { project.name },
"group" to { project.group },
"version" to { project.version },
"description" to { project.description ?: "" },
"features" to { featuresString() },
"published" to { project.plugins.findPlugin("maven-publish") != null },
"artifact" to {
val projectProperties = mapOf(
"name" to project.name,
"group" to project.group,
"version" to project.version
)
fmCfg.getTemplate("artifact").processToString(projectProperties)
}
)
public fun getPropertyValues(): Map<String, Any?> = properties.mapValues { (_, value) -> value() }
public fun property(key: String, value: Any?) {
properties[key] = { value }
}
public fun property(key: String, value: () -> Any?) {
properties[key] = value
}
public fun propertyByTemplate(key: String, templateString: String) {
//need to freeze it, otherwise values could change
val actual = getPropertyValues()
fmLoader.putTemplate(key, templateString)
val template = fmCfg.getTemplate(key)
properties[key] = { template.processToString(actual) }
}
/**
* Files that are use in readme generation
*/
internal val inputFiles = ArrayList<File>()
public fun propertyByTemplate(key: String, templateFile: File) {
//need to freeze it, otherwise values could change
val actual = getPropertyValues()
fmLoader.putTemplate(key, templateFile.readText())
val template: Template = fmCfg.getTemplate(key)
properties[key] = { template.processToString(actual) }
inputFiles += templateFile
}
/**
* Generate a markdown string listing features
*/
internal fun featuresString(itemPrefix: String = " - ", pathPrefix: String = ""): String = buildString {
features.forEach {
appendLine("$itemPrefix[${it.name}]($pathPrefix${it.ref ?: "#"}) : ${it.description}")
}
}
/**
* Generate a readme string from the template
*/
public fun readmeString(): String? = try {
fmCfg.getTemplate("readme").processToString(getPropertyValues())
} catch (ex: TemplateNotFoundException) {
project.logger.warn("Template with name ${ex.templateName} not found in ${project.name}")
null
}
}

View File

@ -0,0 +1,30 @@
package space.kscience.gradle
import org.tomlj.Toml
/**
* Build constants
*/
public object KScienceVersions {
private val toml by lazy {
Toml.parse(javaClass.getResource("/libs.versions.toml")!!.readText())
}
public val kotlinVersion: String get() = toml.getString("versions.kotlin")!!
public val kotlinxNodeVersion: String get() = toml.getString("versions.kotlinx-nodejs")!!
public val coroutinesVersion: String get() = toml.getString("versions.kotlinx-coroutines")!!
public val serializationVersion: String get() = toml.getString("versions.kotlinx-serialization")!!
public val atomicVersion: String get() = toml.getString("versions.atomicfu")!!
public val ktorVersion: String get() = toml.getString("versions.ktor")!!
public val htmlVersion: String get() = toml.getString("versions.kotlinx-html")!!
public val dateTimeVersion: String get() = toml.getString("versions.kotlinx-datetime")!!
public val jsBom: String get() = toml.getString("versions.jsBom")!!
internal val junit: String get() = toml.getString("versions.junit")!!
public object Serialization {
public val xmlVersion: String get() = toml.getString("versions.xmlutil")!!
public val yamlKtVersion: String get() = toml.getString("versions.yamlkt")!!
}
}

View File

@ -0,0 +1,49 @@
package space.kscience.gradle
import org.gradle.api.Project
import space.kscience.gradle.internal.useCommonDependency
public class SerializationTargets(
public val sourceSet: DependencySourceSet,
public val configuration: DependencyConfiguration,
) {
public fun Project.json(
version: String = KScienceVersions.serializationVersion,
): Unit = useCommonDependency(
"org.jetbrains.kotlinx:kotlinx-serialization-json:$version",
dependencySourceSet = sourceSet,
dependencyConfiguration = configuration,
)
public fun Project.cbor(
version: String = KScienceVersions.serializationVersion,
): Unit = useCommonDependency(
"org.jetbrains.kotlinx:kotlinx-serialization-cbor:$version",
dependencySourceSet = sourceSet,
dependencyConfiguration = configuration,
)
public fun Project.protobuf(
version: String = KScienceVersions.serializationVersion,
): Unit = useCommonDependency(
"org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$version",
dependencySourceSet = sourceSet,
dependencyConfiguration = configuration,
)
public fun Project.xml(
version: String = KScienceVersions.Serialization.xmlVersion,
): Unit = useCommonDependency(
"io.github.pdvrieze.xmlutil:serialization:$version",
dependencySourceSet = sourceSet,
dependencyConfiguration = configuration,
)
public fun Project.yamlKt(
version: String = KScienceVersions.Serialization.yamlKtVersion,
): Unit = useCommonDependency(
"net.mamoe.yamlkt:yamlkt:$version",
dependencySourceSet = sourceSet,
dependencyConfiguration = configuration,
)
}

View File

@ -0,0 +1,54 @@
package space.kscience.gradle.internal
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.tasks.Copy
import org.gradle.kotlin.dsl.get
import org.jetbrains.kotlin.gradle.plugin.LanguageSettingsBuilder
import space.kscience.gradle.KScienceVersions
internal val defaultKotlinJvmArgs: List<String> =
listOf("-Xjvm-default=all", "-Xlambdas=indy"/* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/)
internal fun resolveKotlinVersion(): KotlinVersion {
val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-")
return KotlinVersion(major.toInt(), minor.toInt(), patch.toInt())
}
internal fun LanguageSettingsBuilder.applySettings(
kotlinVersion: KotlinVersion = resolveKotlinVersion(),
) {
val versionString = "${kotlinVersion.major}.${kotlinVersion.minor}"
languageVersion = versionString
apiVersion = versionString
progressiveMode = true
optIn("kotlin.RequiresOptIn")
optIn("kotlin.ExperimentalUnsignedTypes")
optIn("kotlin.ExperimentalStdlibApi")
optIn("kotlin.time.ExperimentalTime")
optIn("kotlin.contracts.ExperimentalContracts")
optIn("kotlin.js.ExperimentalJsExport")
}
internal fun Copy.fromJsDependencies(configurationName: String) = project.run {
val configuration = configurations[configurationName]
?: error("Configuration with name $configurationName could not be resolved.")
val projectDeps = configuration.allDependencies.filterIsInstance<ProjectDependency>().map {
it.dependencyProject
}
projectDeps.forEach { dep ->
dep.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
dep.tasks.findByName("jsProcessResources")?.let { task ->
dependsOn(task)
from(task)
}
}
dep.pluginManager.withPlugin("org.jetbrains.kotlin.js") {
dep.tasks.findByName("processResources")?.let { task ->
dependsOn(task)
from(task)
}
}
}
}

View File

@ -0,0 +1,119 @@
package space.kscience.gradle.internal
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.invoke
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import space.kscience.gradle.DependencyConfiguration
import space.kscience.gradle.DependencySourceSet
internal fun Project.useDependency(
vararg pairs: Pair<String, String>,
dependencySourceSet: DependencySourceSet = DependencySourceSet.MAIN,
dependencyConfiguration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
) {
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
configure<KotlinMultiplatformExtension> {
sourceSets {
pairs.forEach { (target, dep) ->
val name = target + dependencySourceSet.suffix
findByName(name)?.apply {
dependencies {
when (dependencyConfiguration) {
DependencyConfiguration.API -> api(dep)
DependencyConfiguration.IMPLEMENTATION -> implementation(dep)
DependencyConfiguration.COMPILE_ONLY -> compileOnly(dep)
}
}
}
}
}
}
}
pairs.find { it.first == "jvm" }?.let { dep ->
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
configure<KotlinJvmProjectExtension> {
sourceSets.findByName(dependencySourceSet.setName)?.apply {
dependencies.apply {
val configurationName = when (dependencyConfiguration) {
DependencyConfiguration.API -> apiConfigurationName
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
}
add(configurationName, dep.second)
}
}
}
}
}
pairs.find { it.first == "js" }?.let { dep ->
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
configure<KotlinJsProjectExtension> {
sourceSets.findByName(dependencySourceSet.setName)?.apply {
dependencies.apply {
val configurationName = when (dependencyConfiguration) {
DependencyConfiguration.API -> apiConfigurationName
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
}
add(configurationName, dep.second)
}
}
}
}
}
}
internal fun Project.useCommonDependency(
dep: String,
dependencySourceSet: DependencySourceSet = DependencySourceSet.MAIN,
dependencyConfiguration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
): Unit = pluginManager.run {
withPlugin("org.jetbrains.kotlin.multiplatform") {
configure<KotlinMultiplatformExtension> {
sourceSets.findByName("common${dependencySourceSet.suffix}")?.apply {
dependencies {
when (dependencyConfiguration) {
DependencyConfiguration.API -> api(dep)
DependencyConfiguration.IMPLEMENTATION -> implementation(dep)
DependencyConfiguration.COMPILE_ONLY -> compileOnly(dep)
}
}
}
}
}
withPlugin("org.jetbrains.kotlin.jvm") {
configure<KotlinJvmProjectExtension> {
sourceSets.findByName(dependencySourceSet.setName)?.apply {
dependencies.apply {
val configurationName = when (dependencyConfiguration) {
DependencyConfiguration.API -> apiConfigurationName
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
}
add(configurationName, dep)
}
}
}
}
withPlugin("org.jetbrains.kotlin.js") {
configure<KotlinJsProjectExtension> {
sourceSets.findByName(dependencySourceSet.setName)?.apply {
dependencies.apply {
val configurationName = when (dependencyConfiguration) {
DependencyConfiguration.API -> apiConfigurationName
DependencyConfiguration.IMPLEMENTATION -> implementationConfigurationName
DependencyConfiguration.COMPILE_ONLY -> compileOnlyConfigurationName
}
add(configurationName, dep)
}
}
}
}
}

View File

@ -0,0 +1,218 @@
package space.kscience.gradle.internal
import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPom
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.*
import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.util.targets
import space.kscience.gradle.isInDevelopment
internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String
?: System.getenv(propertyName)
internal fun Project.requestProperty(propertyName: String): String = requestPropertyOrNull(propertyName)
?: error("Property $propertyName not defined")
internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit = {}) = allprojects {
plugins.withId("maven-publish") {
configure<PublishingExtension> {
plugins.withId("org.jetbrains.kotlin.js") {
val kotlin: KotlinJsProjectExtension = extensions.findByType()!!
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
kotlin.sourceSets.forEach {
from(it.kotlin)
}
}
publications.create<MavenPublication>("js") {
kotlin.targets.flatMap { it.components }.forEach {
from(it)
}
artifact(sourcesJar)
}
}
plugins.withId("org.jetbrains.kotlin.jvm") {
val kotlin = extensions.findByType<KotlinJvmProjectExtension>()!!
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
kotlin.sourceSets.forEach {
from(it.kotlin)
}
}
publications.create<MavenPublication>("jvm") {
kotlin.target.components.forEach {
from(it)
}
artifact(sourcesJar)
}
}
// Process each publication we have in this project
publications.withType<MavenPublication> {
pom {
name.set(project.name)
description.set(project.description ?: project.name)
scm {
tag.set(project.version.toString())
}
mavenPomConfiguration()
}
}
plugins.withId("org.jetbrains.dokka") {
val dokkaJar by tasks.creating(Jar::class) {
group = "documentation"
archiveClassifier.set("javadoc")
from(tasks.findByName("dokkaHtml"))
}
publications.withType<MavenPublication> {
artifact(dokkaJar)
}
}
if (requestPropertyOrNull("publishing.signing.id") != null || requestPropertyOrNull("signing.gnupg.keyName") != null) {
if (!plugins.hasPlugin("signing")) {
apply<SigningPlugin>()
}
extensions.configure<SigningExtension>("signing") {
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
if (!signingId.isNullOrBlank()) {
val signingKey: String = requestProperty("publishing.signing.key")
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
// if key is provided, use it
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
} // else use agent signing
sign(publications)
}
} else {
logger.warn("Signing information is not provided. Skipping artefact signing.")
}
}
}
}
internal fun Project.addGithubPublishing(
githubOrg: String,
githubProject: String,
) {
if (requestPropertyOrNull("publishing.enabled") != "true") {
logger.info("Skipping github publishing because publishing is disabled")
return
}
if (requestPropertyOrNull("publishing.github") != "false") {
logger.info("Skipping github publishing because `publishing.github != true`")
return
}
val githubUser: String = requestProperty("publishing.github.user")
val githubToken: String = requestProperty("publishing.github.token")
allprojects {
plugins.withId("maven-publish") {
configure<PublishingExtension> {
logger.info("Adding github publishing to project [${project.name}]")
repositories.maven {
name = "github"
url = uri("https://maven.pkg.github.com/$githubOrg/$githubProject/")
credentials {
username = githubUser
password = githubToken
}
}
}
}
}
}
internal fun Project.addSpacePublishing(spaceRepo: String) {
if (requestPropertyOrNull("publishing.enabled") != "true") {
logger.info("Skipping space publishing because publishing is disabled")
return
}
if (requestPropertyOrNull("publishing.space") == "false") {
logger.info("Skipping space publishing because `publishing.space == false`")
return
}
val spaceUser: String = requestProperty("publishing.space.user")
val spaceToken: String = requestProperty("publishing.space.token")
allprojects {
plugins.withId("maven-publish") {
configure<PublishingExtension> {
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
repositories.maven {
name = "space"
url = uri(spaceRepo)
credentials {
username = spaceUser
password = spaceToken
}
}
}
}
}
}
internal fun Project.addSonatypePublishing() {
if (requestPropertyOrNull("publishing.enabled") != "true") {
logger.info("Skipping sonatype publishing because publishing is disabled")
return
}
if (isInDevelopment) {
logger.info("Sonatype publishing skipped for development version")
return
}
if (requestPropertyOrNull("publishing.sonatype") == "false") {
logger.info("Skipping sonatype publishing because `publishing.sonatype == false`")
return
}
val sonatypeUser: String = requestProperty("publishing.sonatype.user")
val sonatypePassword: String = requestProperty("publishing.sonatype.password")
allprojects {
plugins.withId("maven-publish") {
configure<PublishingExtension> {
repositories.maven {
val sonatypeRepo = "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
name = "sonatype"
url = uri(sonatypeRepo)
credentials {
username = sonatypeUser
password = sonatypePassword
}
}
}
}
}
}

View File

@ -0,0 +1,24 @@
package space.kscience.gradle
import org.gradle.api.publish.maven.MavenPom
public fun MavenPom.useApache2Licence(){
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
}
public fun MavenPom.useSPCTeam(){
developers {
developer {
id.set("SPC")
name.set("Scientific programming centre")
organization.set("MIPT")
organizationUrl.set("https://sciprog.center/")
}
}
}

View File

@ -0,0 +1,26 @@
## Artifact:
The Maven coordinates of this project are `${group}:${name}:${version}`.
**Gradle Groovy:**
```groovy
repositories {
maven { url 'https://repo.kotlin.link' }
mavenCentral()
}
dependencies {
implementation '${group}:${name}:${version}'
}
```
**Gradle Kotlin DSL:**
```kotlin
repositories {
maven("https://repo.kotlin.link")
mavenCentral()
}
dependencies {
implementation("${group}:${name}:${version}")
}
```

View File

@ -0,0 +1,15 @@
# Module ${name}
${description}
<#if features?has_content>
## Features
${features}
</#if>
<#if published>
## Usage
${artifact}
</#if>

View File

@ -0,0 +1,9 @@
import org.junit.jupiter.api.Test
import space.kscience.gradle.KScienceVersions
class TestPlugins {
@Test
fun testVersions() {
println(KScienceVersions.coroutinesVersion)
}
}