Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 2b7b4c3

Browse files
Feature/create maven artifacts (#108)
* added publications to many modules * added workflow to release packages to maven repo * improved module artifact generation * minor fixes * do not publish an "all" lilb * trasnfertype has default contenttype * use snapshot version to enable replacing * added better logging, and a CollectionUtils.isAnyOf() method * extracted blobstore api into a separate common lib * fixed custom processor dockerfile * bumped snapshot version Co-authored-by: beardyinc <[email protected]>
1 parent b61b2db commit 2b7b4c3

File tree

68 files changed

+413
-55
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+413
-55
lines changed

.github/workflows/publish.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# This workflow uses actions that are not certified by GitHub.
2+
# They are provided by a third-party and are governed by
3+
# separate terms of service, privacy policy, and support
4+
# documentation.
5+
6+
name: Publish package to GitHub Packages
7+
on:
8+
release:
9+
types: [created]
10+
jobs:
11+
publish:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-java@v2
19+
with:
20+
java-version: '11'
21+
distribution: 'adopt'
22+
- name: Validate Gradle wrapper
23+
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
24+
- name: Publish package
25+
run: gradle publishAllPublicationToGitHubPackagesRepository
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.gradle.kts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
plugins {
77
`java-library`
8+
`maven-publish`
89
}
910

1011
repositories {
@@ -30,7 +31,10 @@ subprojects {
3031
}
3132

3233
allprojects {
34+
apply(plugin = "maven-publish")
3335
pluginManager.withPlugin("java-library") {
36+
group = "com.microsoft"
37+
version = "0.0.1-SNAPSHOT.1"
3438
dependencies {
3539
api("org.jetbrains:annotations:${jetBrainsAnnotationsVersion}")
3640
api("com.fasterxml.jackson.core:jackson-core:${jacksonVersion}")
@@ -45,6 +49,19 @@ allprojects {
4549

4650
}
4751

52+
publishing {
53+
repositories {
54+
maven {
55+
name = "GitHubPackages"
56+
url = uri("https://maven.pkg.github.com/microsoft/data-appliance-gx")
57+
credentials {
58+
username = System.getenv("GITHUB_ACTOR")
59+
password = System.getenv("GITHUB_TOKEN")
60+
}
61+
}
62+
}
63+
}
64+
4865
}
4966

5067
tasks.withType<Test> {
@@ -61,4 +78,4 @@ allprojects {
6178

6279
val test by tasks.getting(Test::class) {
6380
useJUnitPlatform()
64-
}
81+
}

common/azure/build.gradle.kts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright (c) Microsoft Corporation.
3+
* All rights reserved.
4+
*/
5+
6+
plugins {
7+
`java-library`
8+
`java-test-fixtures`
9+
`maven-publish`
10+
}
11+
12+
val storageBlobVersion: String by project;
13+
14+
dependencies {
15+
api(project(":spi"))
16+
api(project(":common:util"))
17+
api("com.azure:azure-storage-blob:${storageBlobVersion}")
18+
19+
20+
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api:5.5.2")
21+
testFixturesRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2")
22+
}
23+
24+
publishing {
25+
publications {
26+
create<MavenPublication>("common.azure") {
27+
artifactId = "edc.common.azure"
28+
from(components["java"])
29+
}
30+
}
31+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
*/
66

7-
package com.microsoft.dagx.transfer.provision.azure.provider;
7+
package com.microsoft.dagx.common.azure;
88

99
import com.azure.storage.blob.models.BlobItem;
1010

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
*/
66

7-
package com.microsoft.dagx.transfer.provision.azure.provider;
7+
package com.microsoft.dagx.common.azure;
88

99
import com.azure.core.util.BinaryData;
1010
import com.azure.storage.blob.BlobServiceClient;

common/build.gradle.kts renamed to common/util/build.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
plugins {
77
`java-library`
88
`java-test-fixtures`
9+
`maven-publish`
910
}
1011

1112
val storageBlobVersion: String by project;
@@ -21,3 +22,11 @@ dependencies {
2122
testFixturesRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.5.2")
2223
}
2324

25+
publishing {
26+
publications {
27+
create<MavenPublication>("common.util") {
28+
artifactId = "edc.common.util"
29+
from(components["java"])
30+
}
31+
}
32+
}

common/src/main/java/com/microsoft/dagx/common/collection/CollectionUtil.java renamed to common/util/src/main/java/com/microsoft/dagx/common/collection/CollectionUtil.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
package com.microsoft.dagx.common.collection;
88

9+
import java.util.Arrays;
910
import java.util.Collection;
1011
import java.util.Map;
1112

@@ -27,4 +28,11 @@ private static <V, K> boolean isEmpty(Map<K, V> map) {
2728
return map == null || map.isEmpty();
2829
}
2930

31+
public static <T> boolean isAnyOf(T t, T... collection) {
32+
if (collection == null) {
33+
return false;
34+
}
35+
36+
return Arrays.asList(collection).contains(t);
37+
}
3038
}
File renamed without changes.

common/src/main/java/com/microsoft/dagx/common/settings/SettingsHelper.java renamed to common/util/src/main/java/com/microsoft/dagx/common/settings/SettingsHelper.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
package com.microsoft.dagx.common.settings;
88

99
import com.microsoft.dagx.common.string.StringUtils;
10+
import com.microsoft.dagx.spi.DagxException;
1011
import com.microsoft.dagx.spi.system.ServiceExtensionContext;
12+
import org.jetbrains.annotations.NotNull;
1113

1214
import java.util.UUID;
1315

@@ -25,4 +27,16 @@ public static synchronized String getConnectorId(ServiceExtensionContext context
2527
}
2628
return connectorId;
2729
}
30+
31+
/**
32+
* Convenience method to either get a particular setting or throw a {@link DagxException}
33+
*/
34+
@NotNull
35+
public static String getSettingOrThrow(ServiceExtensionContext serviceContext, String setting) {
36+
var value = serviceContext.getSetting(setting, null);
37+
if (value == null) {
38+
throw new DagxException("could not find setting " + setting + " or it was null");
39+
}
40+
return value;
41+
}
2842
}
File renamed without changes.

0 commit comments

Comments
 (0)