|
1 | | -// Define used (gradle) plugins |
2 | | -plugins { |
3 | | - id 'base' |
4 | | - id 'org.jetbrains.kotlin.jvm' version '2.0.21' apply false |
5 | | - id 'org.jetbrains.kotlin.plugin.serialization' version '2.0.21' apply false |
6 | | - id 'com.github.gmazzo.buildconfig' version '4.1.2' apply false |
7 | | -} |
8 | | - |
9 | | -// Define the group for all built artifacts |
10 | | -allprojects { |
11 | | - group = 'com.vector.ocs.plugins' |
12 | | -} |
13 | | - |
14 | | -// Declare all used repositories |
15 | | -subprojects { |
16 | | - repositories { |
17 | | - mavenCentral() |
18 | | - // Repository for Vector artifacts like OCS Core or Domain Plugins |
19 | | - maven { |
20 | | - // Adjust path here to find maven repository if necessary |
21 | | - url "../../" + property('ocsRepo') |
22 | | - } |
23 | | - // Local publishing for quick development processes |
24 | | - mavenLocal() |
25 | | - } |
26 | | -} |
27 | | - |
28 | | -//----------- |
29 | | -// PUBLISHING |
30 | | -// ---------- |
31 | | - |
32 | | -enum PublishMode { |
33 | | - NORMAL, SNAPSHOT, LOCKED |
34 | | -} |
35 | | - |
36 | | -// Provided PublishMode parameter (string) from command line call is evaluated |
37 | | -// and the PublishMode object is set accordingly |
38 | | -PublishMode evalPublishMode() { |
39 | | - String key = 'publishMode' |
40 | | - if (!rootProject.hasProperty(key)) { |
41 | | - return PublishMode.LOCKED |
42 | | - } |
43 | | - String value = rootProject.property(key) |
44 | | - switch (value) { |
45 | | - case 'normal': return PublishMode.NORMAL |
46 | | - case 'snapshot': return PublishMode.SNAPSHOT |
47 | | - default: return PublishMode.LOCKED |
48 | | - } |
49 | | -} |
50 | | - |
51 | | -long currentTimeMillis = System.currentTimeMillis() |
52 | | - |
53 | | -// For Snapshot publishing a timestamp is added onto the version of the published artifact (plugin) |
54 | | -rootProject.ext.publishVersion = { Project project -> |
55 | | - String result = project.version |
56 | | - if (evalPublishMode() == PublishMode.SNAPSHOT) { |
57 | | - result = result + '-' + currentTimeMillis |
58 | | - } |
59 | | - return result |
60 | | -} |
| 1 | +// Define used (gradle) plugins |
| 2 | +plugins { |
| 3 | + id 'base' |
| 4 | + id 'org.jetbrains.kotlin.jvm' version '2.1.21' apply false |
| 5 | + id "org.jetbrains.kotlin.plugin.sam.with.receiver" version "2.0.21" |
| 6 | + id 'org.jetbrains.kotlin.plugin.serialization' version '2.1.21' apply false |
| 7 | + id 'com.github.gmazzo.buildconfig' version '4.1.2' apply false |
| 8 | + id "com.vector.cfg.pai.automation-build-gradle" version "1.+" apply false |
| 9 | +} |
| 10 | + |
| 11 | +// Define the group for all built artifacts |
| 12 | +allprojects { |
| 13 | + group = 'com.vector.ocs.plugins' |
| 14 | +} |
| 15 | + |
| 16 | +// Declare all used repositories |
| 17 | +subprojects { |
| 18 | + repositories { |
| 19 | + mavenCentral() |
| 20 | + // Repository for Vector artifacts like OCS Core or Domain Plugins |
| 21 | + maven { |
| 22 | + // Adjust path here to find maven repository if necessary |
| 23 | + url "../../" + property('ocsRepo') |
| 24 | + } |
| 25 | + // Local publishing for quick development processes |
| 26 | + mavenLocal() |
| 27 | + } |
| 28 | +} |
| 29 | + |
| 30 | +//----------- |
| 31 | +// PUBLISHING |
| 32 | +// ---------- |
| 33 | + |
| 34 | +enum PublishMode { |
| 35 | + NORMAL, SNAPSHOT, LOCKED |
| 36 | +} |
| 37 | + |
| 38 | +// Provided PublishMode parameter (string) from command line call is evaluated |
| 39 | +// and the PublishMode object is set accordingly |
| 40 | +PublishMode evalPublishMode() { |
| 41 | + String key = 'publishMode' |
| 42 | + if (!rootProject.hasProperty(key)) { |
| 43 | + return PublishMode.LOCKED |
| 44 | + } |
| 45 | + String value = rootProject.property(key) |
| 46 | + switch (value) { |
| 47 | + case 'normal': return PublishMode.NORMAL |
| 48 | + case 'snapshot': return PublishMode.SNAPSHOT |
| 49 | + default: return PublishMode.LOCKED |
| 50 | + } |
| 51 | +} |
| 52 | + |
| 53 | +long currentTimeMillis = System.currentTimeMillis() |
| 54 | + |
| 55 | +// For Snapshot publishing a timestamp is added onto the version of the published artifact (plugin) |
| 56 | +rootProject.ext.publishVersion = { Project project -> |
| 57 | + String result = project.version |
| 58 | + if (evalPublishMode() == PublishMode.SNAPSHOT) { |
| 59 | + result = result + '-' + currentTimeMillis |
| 60 | + } |
| 61 | + return result |
| 62 | +} |
0 commit comments