Skip to content
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

Commit 8b8fe34

Browse files
shrutimantrismantri-moveworksmgabelle
authored
feat: add google calendar insert event task (#2)
Co-authored-by: Shruti Mantri <smantri@moveworks.ai> Co-authored-by: Mathieu Gabelle <54168385+mgabelle@users.noreply.github.com>
1 parent 04beaa6 commit 8b8fe34

File tree

19 files changed

+548
-336
lines changed

19 files changed

+548
-336
lines changed

build.gradle

Lines changed: 158 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -14,122 +14,167 @@ plugins {
1414

1515
def isBuildSnapshot = version.toString().endsWith("-SNAPSHOT")
1616

17-
repositories {
18-
mavenLocal()
19-
mavenCentral()
20-
if (isBuildSnapshot) {
21-
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
17+
allprojects {
18+
repositories {
19+
mavenLocal()
20+
mavenCentral()
21+
if (isBuildSnapshot) {
22+
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots/" }
23+
}
24+
}
25+
}
26+
27+
subprojects {
28+
group "io.kestra.plugin"
29+
sourceCompatibility = 21
30+
targetCompatibility = 21
31+
32+
apply plugin: "java-library"
33+
apply plugin: "idea"
34+
35+
dependencies {
36+
// Platform
37+
annotationProcessor enforcedPlatform("io.kestra:platform:$kestraVersion")
38+
implementation enforcedPlatform("io.kestra:platform:$kestraVersion")
39+
api enforcedPlatform("io.kestra:platform:$kestraVersion")
40+
41+
// Lombok
42+
annotationProcessor "org.projectlombok:lombok"
43+
compileOnly "org.projectlombok:lombok"
44+
45+
// Micronaut
46+
compileOnly "io.micronaut:micronaut-http"
47+
compileOnly "io.micronaut.reactor:micronaut-reactor"
48+
49+
// Kestra
50+
annotationProcessor group: "io.kestra", name: "processor", version: kestraVersion
51+
compileOnly group: "io.kestra", name: "core", version: kestraVersion
52+
53+
// Logs
54+
compileOnly'org.slf4j:slf4j-api'
2255
}
2356
}
2457

2558
sourceCompatibility = 21
2659
targetCompatibility = 21
2760

2861
group "io.kestra.plugin"
29-
description 'Plugin template for Kestra'
62+
description 'Apache Camel plugin for Kestra'
3063

3164
tasks.withType(JavaCompile) {
3265
options.encoding = "UTF-8"
3366
options.compilerArgs.add("-parameters")
3467
}
3568

36-
dependencies {
37-
// Platform
38-
annotationProcessor enforcedPlatform("io.kestra:platform:$kestraVersion")
39-
implementation enforcedPlatform("io.kestra:platform:$kestraVersion")
40-
api enforcedPlatform("io.kestra:platform:$kestraVersion")
41-
42-
// lombok
43-
annotationProcessor "org.projectlombok:lombok"
44-
compileOnly "org.projectlombok:lombok"
45-
46-
// kestra
47-
annotationProcessor group: "io.kestra", name: "processor", version: kestraVersion
48-
compileOnly group: "io.kestra", name: "core", version: kestraVersion
49-
compileOnly group: "io.kestra", name: "script", version: kestraVersion
50-
}
51-
5269

5370
/**********************************************************************************************************************\
5471
* Test
5572
**********************************************************************************************************************/
56-
test {
57-
useJUnitPlatform()
58-
}
73+
subprojects {
74+
apply plugin: "com.adarshr.test-logger"
5975

60-
testlogger {
61-
theme "mocha-parallel"
62-
showExceptions true
63-
showFullStackTraces true
64-
showStandardStreams true
65-
showPassedStandardStreams false
66-
showSkippedStandardStreams true
67-
}
76+
test {
77+
useJUnitPlatform()
6878

69-
dependencies {
70-
// Platform
71-
testAnnotationProcessor enforcedPlatform("io.kestra:platform:$kestraVersion")
72-
testImplementation enforcedPlatform("io.kestra:platform:$kestraVersion")
73-
74-
// lombok
75-
testAnnotationProcessor "org.projectlombok:lombok"
76-
testCompileOnly 'org.projectlombok:lombok'
77-
78-
// micronaut
79-
testAnnotationProcessor "io.micronaut:micronaut-inject-java"
80-
testAnnotationProcessor "io.micronaut.validation:micronaut-validation-processor"
81-
testImplementation "io.micronaut.test:micronaut-test-junit5"
82-
testImplementation "io.micronaut:micronaut-jackson-databind"
83-
84-
// test deps needed only for to have a runner
85-
testAnnotationProcessor group: "io.kestra", name: "processor", version: kestraVersion
86-
testImplementation group: "io.kestra", name: "core", version: kestraVersion
87-
testImplementation group: "io.kestra", name: "tests", version: kestraVersion
88-
testImplementation group: "io.kestra", name: "script", version: kestraVersion
89-
testImplementation group: "io.kestra", name: "repository-memory", version: kestraVersion
90-
testImplementation group: "io.kestra", name: "runner-memory", version: kestraVersion
91-
testImplementation group: "io.kestra", name: "storage-local", version: kestraVersion
92-
93-
// test
94-
testImplementation "org.junit.jupiter:junit-jupiter-engine"
95-
testImplementation "org.hamcrest:hamcrest"
96-
testImplementation "org.hamcrest:hamcrest-library"
79+
// configure en_US default locale for tests
80+
systemProperty 'user.language', 'en'
81+
systemProperty 'user.country', 'US'
82+
}
83+
84+
testlogger {
85+
theme "mocha-parallel"
86+
showExceptions true
87+
showFullStackTraces true
88+
showStandardStreams true
89+
showPassedStandardStreams false
90+
showSkippedStandardStreams true
91+
}
92+
93+
dependencies {
94+
// Platform
95+
testAnnotationProcessor enforcedPlatform("io.kestra:platform:$kestraVersion")
96+
testImplementation enforcedPlatform("io.kestra:platform:$kestraVersion")
97+
98+
// lombok
99+
testAnnotationProcessor "org.projectlombok:lombok"
100+
testCompileOnly 'org.projectlombok:lombok'
101+
102+
// micronaut
103+
testAnnotationProcessor "io.micronaut:micronaut-inject-java"
104+
testAnnotationProcessor "io.micronaut.validation:micronaut-validation-processor"
105+
testImplementation "io.micronaut.test:micronaut-test-junit5"
106+
testImplementation "io.micronaut:micronaut-jackson-databind"
107+
testImplementation "io.micronaut.reactor:micronaut-reactor"
108+
109+
// test deps needed only for to have a runner
110+
testAnnotationProcessor group: "io.kestra", name: "processor", version: kestraVersion
111+
testImplementation group: "io.kestra", name: "core", version: kestraVersion
112+
testImplementation group: "io.kestra", name: "tests", version: kestraVersion
113+
testImplementation group: "io.kestra", name: "repository-memory", version: kestraVersion
114+
testImplementation group: "io.kestra", name: "runner-memory", version: kestraVersion
115+
testImplementation group: "io.kestra", name: "storage-local", version: kestraVersion
116+
117+
// test
118+
testImplementation "org.junit.jupiter:junit-jupiter-engine"
119+
testImplementation "org.junit.jupiter:junit-jupiter-params"
120+
testImplementation "org.hamcrest:hamcrest"
121+
testImplementation "org.hamcrest:hamcrest-library"
122+
123+
testImplementation group: 'com.h2database', name: 'h2'
124+
testImplementation group: 'commons-codec', name: 'commons-codec', version: '1.17.1'
125+
}
97126
}
98127

99128
/**********************************************************************************************************************\
100129
* Allure Reports
101130
**********************************************************************************************************************/
102-
dependencies {
103-
testImplementation enforcedPlatform("io.kestra:platform:$kestraVersion")
104-
testImplementation "io.qameta.allure:allure-junit5"
105-
}
131+
subprojects {
132+
dependencies {
133+
testImplementation enforcedPlatform("io.kestra:platform:$kestraVersion")
134+
testImplementation "io.qameta.allure:allure-junit5"
135+
}
106136

107-
configurations {
108-
agent {
109-
canBeResolved = true
110-
canBeConsumed = true
137+
configurations {
138+
agent {
139+
canBeResolved = true
140+
canBeConsumed = true
141+
}
111142
}
112-
}
143+
113144

114145
dependencies {
115146
agent "org.aspectj:aspectjweaver:1.9.23"
116147
}
117148

118-
test {
119-
jvmArgs = [ "-javaagent:${configurations.agent.singleFile}" ]
149+
test {
150+
jvmArgs = [ "-javaagent:${configurations.agent.singleFile}" ]
151+
}
120152
}
121153

122154
/**********************************************************************************************************************\
123155
* Jacoco
124156
**********************************************************************************************************************/
125-
test {
126-
finalizedBy jacocoTestReport
157+
/*subprojects {
158+
apply plugin: 'jacoco'
159+
160+
test {
161+
finalizedBy jacocoTestReport
162+
}
127163
}
128164
129-
jacocoTestReport {
130-
dependsOn test
165+
dependencies {
166+
jacocoAggregation subprojects
167+
}
168+
169+
tasks.named('testCodeCoverageReport') {
170+
dependsOn = subprojects.test
131171
}
132172
173+
tasks.named('check') {
174+
dependsOn tasks.named('testCodeCoverageReport', JacocoReport)
175+
}*/
176+
177+
133178
/**********************************************************************************************************************\
134179
* Publish
135180
**********************************************************************************************************************/
@@ -144,40 +189,51 @@ nexusPublishing {
144189
}
145190
}
146191

147-
tasks.withType(GenerateModuleMetadata).configureEach {
148-
// Suppression this validation error as we want to enforce the Kestra platform
149-
suppressedValidationErrors.add('enforced-platform')
192+
github {
193+
user 'kestra-io'
194+
repository 'plugin-camel'
195+
license 'Apache'
150196
}
151197

152-
jar {
153-
manifest {
154-
attributes(
155-
"X-Kestra-Name": project.name,
156-
"X-Kestra-Title": "Template",
157-
"X-Kestra-Group": project.group + ".templates",
158-
"X-Kestra-Description": project.description,
159-
"X-Kestra-Version": project.version
160-
)
198+
199+
subprojects { Project subproject ->
200+
apply plugin: "com.adarshr.test-logger"
201+
apply plugin: "com.github.johnrengelman.shadow"
202+
apply plugin: "maven-publish"
203+
apply plugin: "signing"
204+
apply plugin: 'ru.vyarus.github-info'
205+
apply plugin: 'ru.vyarus.java-lib'
206+
207+
github {
208+
user 'kestra-io'
209+
repository 'plugin-camel'
210+
license 'Apache'
161211
}
162-
}
163212

164-
maven.pom {
165-
developers {
166-
developer {
167-
id = "tchiotludo"
168-
name = "Ludovic Dehon"
213+
if (subproject.name != "plugin-camel") {
214+
shadowJar {
215+
dependsOn(":plugin-camel:shadowJar")
169216
}
170217
}
171-
}
172218

173-
shadowJar {
174-
archiveClassifier.set(null)
175-
mergeServiceFiles()
176-
}
219+
maven.pom {
220+
developers {
221+
developer {
222+
id = "tchiotludo"
223+
name = "Ludovic Dehon"
224+
}
225+
}
226+
}
177227

178-
github {
179-
user 'kestra-io'
180-
license 'Apache'
228+
shadowJar {
229+
archiveClassifier.set(null)
230+
mergeServiceFiles()
231+
}
232+
233+
tasks.withType(GenerateModuleMetadata).configureEach {
234+
// Suppression this validation error as we want to enforce the Kestra platform
235+
suppressedValidationErrors.add('enforced-platform')
236+
}
181237
}
182238

183239
/**********************************************************************************************************************\

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
version=0.18.0-SNAPSHOT
2-
kestraVersion=[0.18,)
1+
version=0.20.0-SNAPSHOT
2+
kestraVersion=[0.20,)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
project.description = 'Connect to Google Calendar using Kestra\'s Apache Camel plugin.'
2+
3+
jar {
4+
manifest {
5+
attributes(
6+
"X-Kestra-Name": project.name,
7+
"X-Kestra-Title": "Google Calendar",
8+
"X-Kestra-Group": project.group + ".camel.googlecalendar",
9+
"X-Kestra-Description": project.description,
10+
"X-Kestra-Version": project.version
11+
)
12+
}
13+
}
14+
15+
dependencies {
16+
implementation("org.apache.camel:camel-google-calendar:4.8.1")
17+
implementation("org.apache.camel:camel-core:4.8.1")
18+
implementation("com.google.oauth-client:google-oauth-client-jetty:1.36.0")
19+
implementation("com.google.apis:google-api-services-calendar:v3-rev411-1.25.0")
20+
implementation("com.google.api-client:google-api-client-gson:2.7.0")
21+
implementation project(':plugin-camel')
22+
23+
testImplementation project(':plugin-camel').sourceSets.test.output
24+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package io.kestra.plugin.camel.googlecalendar;
2+
3+
import lombok.*;
4+
import lombok.experimental.SuperBuilder;
5+
import io.kestra.core.exceptions.IllegalVariableEvaluationException;
6+
import io.kestra.core.models.tasks.Task;
7+
import io.kestra.core.runners.RunContext;
8+
import org.apache.camel.component.google.calendar.GoogleCalendarComponent;
9+
10+
import java.io.IOException;
11+
12+
@SuperBuilder
13+
@ToString
14+
@EqualsAndHashCode
15+
@Getter
16+
@NoArgsConstructor
17+
public abstract class AbstractTask extends Task implements GoogleCalendarInterface {
18+
protected String clientId;
19+
protected String clientSecret;
20+
protected String refreshToken;
21+
protected String serviceAccount;
22+
protected String delegate;
23+
24+
public GoogleCalendarComponent calendarComponent(RunContext runContext) throws IllegalVariableEvaluationException, IOException {
25+
return GoogleCalendarComponentService.component(runContext, this);
26+
}
27+
}

0 commit comments

Comments
 (0)