|
| 1 | +/* |
| 2 | + * Copyright 2024 Flamingock (https://www.flamingock.io) |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | +package io.flamingock.gradle |
| 17 | + |
| 18 | +/** |
| 19 | + * Extension for configuring Flamingock in a Gradle project. |
| 20 | + * |
| 21 | + * Usage: |
| 22 | + * ``` |
| 23 | + * flamingock { |
| 24 | + * community() |
| 25 | + * sql() |
| 26 | + * mongodb() |
| 27 | + * dynamodb() |
| 28 | + * couchbase() |
| 29 | + * mongock() |
| 30 | + * springboot() |
| 31 | + * graalvm() |
| 32 | + * } |
| 33 | + * ``` |
| 34 | + */ |
| 35 | +open class FlamingockExtension { |
| 36 | + |
| 37 | + internal var isCloudEnabled: Boolean = false |
| 38 | + private set |
| 39 | + |
| 40 | + internal var isCommunityEnabled: Boolean = false |
| 41 | + private set |
| 42 | + |
| 43 | + internal var isMongockEnabled: Boolean = false |
| 44 | + private set |
| 45 | + |
| 46 | + internal var isSpringbootEnabled: Boolean = false |
| 47 | + private set |
| 48 | + |
| 49 | + internal var isGraalvmEnabled: Boolean = false |
| 50 | + private set |
| 51 | + |
| 52 | + internal var isSqlEnabled: Boolean = false |
| 53 | + private set |
| 54 | + |
| 55 | + internal var isMongodbEnabled: Boolean = false |
| 56 | + private set |
| 57 | + |
| 58 | + internal var isDynamodbEnabled: Boolean = false |
| 59 | + private set |
| 60 | + |
| 61 | + internal var isCouchbaseEnabled: Boolean = false |
| 62 | + private set |
| 63 | + |
| 64 | + /** |
| 65 | + * Enables the Cloud edition of Flamingock. |
| 66 | + * |
| 67 | + * This is the default edition. If neither [cloud] nor [community] is called, |
| 68 | + * cloud is activated automatically. |
| 69 | + * |
| 70 | + * Adds: |
| 71 | + * - `implementation("io.flamingock:flamingock-cloud")` |
| 72 | + */ |
| 73 | + fun cloud() { |
| 74 | + isCloudEnabled = true |
| 75 | + } |
| 76 | + |
| 77 | + /** |
| 78 | + * Enables the Community edition of Flamingock. |
| 79 | + * |
| 80 | + * Adds: |
| 81 | + * - `implementation("io.flamingock:flamingock-community")` |
| 82 | + */ |
| 83 | + fun community() { |
| 84 | + isCommunityEnabled = true |
| 85 | + } |
| 86 | + |
| 87 | + /** |
| 88 | + * Enables Mongock compatibility for migrating from Mongock to Flamingock. |
| 89 | + * |
| 90 | + * Adds: |
| 91 | + * - `implementation("io.flamingock:mongock-support")` |
| 92 | + * - `annotationProcessor("io.flamingock:mongock-support")` |
| 93 | + */ |
| 94 | + fun mongock() { |
| 95 | + isMongockEnabled = true |
| 96 | + } |
| 97 | + |
| 98 | + /** |
| 99 | + * Enables Spring Boot integration. |
| 100 | + * |
| 101 | + * Adds: |
| 102 | + * - `implementation("io.flamingock:flamingock-springboot-integration")` |
| 103 | + * |
| 104 | + * Also switches test support from `flamingock-test-support` to |
| 105 | + * `flamingock-springboot-test-support` (which transitively includes the basic one). |
| 106 | + */ |
| 107 | + fun springboot() { |
| 108 | + isSpringbootEnabled = true |
| 109 | + } |
| 110 | + |
| 111 | + /** |
| 112 | + * Enables GraalVM native image support. |
| 113 | + * |
| 114 | + * Adds: |
| 115 | + * - `implementation("io.flamingock:flamingock-graalvm")` |
| 116 | + */ |
| 117 | + fun graalvm() { |
| 118 | + isGraalvmEnabled = true |
| 119 | + } |
| 120 | + |
| 121 | + /** |
| 122 | + * Enables SQL support. |
| 123 | + * |
| 124 | + * Adds: |
| 125 | + * - `implementation("io.flamingock:flamingock-sql-template")` |
| 126 | + * - `implementation("io.flamingock:flamingock-sql-targetsystem")` |
| 127 | + */ |
| 128 | + fun sql() { |
| 129 | + isSqlEnabled = true |
| 130 | + } |
| 131 | + |
| 132 | + /** |
| 133 | + * Enables MongoDB support. |
| 134 | + * |
| 135 | + * Adds: |
| 136 | + * - `implementation("io.flamingock:flamingock-mongodb-sync-template")` |
| 137 | + * - `implementation("io.flamingock:flamingock-mongodb-sync-targetsystem")` |
| 138 | + * |
| 139 | + * If [springboot] is also enabled, additionally adds: |
| 140 | + * - `implementation("io.flamingock:flamingock-mongodb-springdata-targetsystem")` |
| 141 | + */ |
| 142 | + fun mongodb() { |
| 143 | + isMongodbEnabled = true |
| 144 | + } |
| 145 | + |
| 146 | + /** |
| 147 | + * Enables DynamoDB support. |
| 148 | + * |
| 149 | + * Adds: |
| 150 | + * - `implementation("io.flamingock:flamingock-dynamodb-targetsystem")` |
| 151 | + */ |
| 152 | + fun dynamodb() { |
| 153 | + isDynamodbEnabled = true |
| 154 | + } |
| 155 | + |
| 156 | + /** |
| 157 | + * Enables Couchbase support. |
| 158 | + * |
| 159 | + * Adds: |
| 160 | + * - `implementation("io.flamingock:flamingock-couchbase-targetsystem")` |
| 161 | + */ |
| 162 | + fun couchbase() { |
| 163 | + isCouchbaseEnabled = true |
| 164 | + } |
| 165 | +} |
0 commit comments