diff --git a/airbyte-config/init/build.gradle b/airbyte-config/init/build.gradle index 932740baea367..bd5555867c7e1 100644 --- a/airbyte-config/init/build.gradle +++ b/airbyte-config/init/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'java' + id 'java-library' } dependencies { diff --git a/airbyte-config/specs/build.gradle b/airbyte-config/specs/build.gradle index 91d1fd0921706..af43c2c4d7b7c 100644 --- a/airbyte-config/specs/build.gradle +++ b/airbyte-config/specs/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'java' + id 'java-library' } dependencies { diff --git a/build.gradle b/build.gradle index 15e48e3b357c0..d6ead338d8aa9 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,8 @@ plugins { id 'maven-publish' } +apply from: "$rootDir/publish-repositories.gradle" + repositories { mavenCentral() } @@ -167,6 +169,30 @@ def Task getDockerBuildTask(String artifactName, String projectDir, String build }) } +@SuppressWarnings('GroovyAssignabilityCheck') +def Task getPublishArtifactsTask(String buildVersion, Project subproject) { + // generate a unique task name based on the directory name. + return task ("publishArtifact-$subproject.name" { + apply plugin: 'maven-publish' + publishing { + repositories { + publications { + "$subproject.name"(MavenPublication) { + from subproject.components.java + + // use the subproject group and name with the assumption there are no identical subproject + // names, group names or subproject group/name combination. + groupId = "$subproject.group" + artifactId = "$subproject.name" + version = "$buildVersion" + repositories.add(rootProject.repositories.getByName('cloudrepo')) + } + } + } + } + }) +} + allprojects { apply plugin: 'com.bmuschko.docker-remote-api' @@ -460,32 +486,9 @@ catalog { } } -//// TODO: Davin will turn this back on. -//// Configure what subprojects to publish. -//String[] toPublish = [ -// ':airbyte-analytics', -// ':airbyte-api', -// ':airbyte-commons', -// ':airbyte-commons-docker', -// ':airbyte-config:init', -// ':airbyte-config:models', -// ':airbyte-config:persistence', -// ':airbyte-db:lib', -// ':airbyte-json-validation', -// ':airbyte-notification', -// ':airbyte-protocol:models', -// ':airbyte-scheduler:client', -// ':airbyte-scheduler:models', -// ':airbyte-scheduler:persistence', -// ':airbyte-server', -// ':airbyte-workers' -//] -//configure(subprojects.findAll { toPublish.contains(it.getPath()) }) { -// apply plugin: 'maven-publish' -// publishing { publications { - // This block is present so Gradle knows to publish a Maven jar. + // This block is present for dependency catalog publishing. maven(MavenPublication) { groupId = 'io.airbyte' artifactId = 'oss-catalog' @@ -495,17 +498,5 @@ publishing { // e.g. the subproject :airbyte-scheduler:models is imported at io.airbyte.airbyte-config:persistence:. } } - - repositories { - maven { - url 'https://airbyte.mycloudrepo.io/repositories/airbyte-public-jars' - credentials { - name 'cloudrepo' - username System.getenv('CLOUDREPO_USER') - password System.getenv('CLOUDREPO_PASSWORD') - } - } - - mavenLocal() - } + repositories.add(rootProject.repositories.getByName('cloudrepo')) } diff --git a/publish-repositories.gradle b/publish-repositories.gradle new file mode 100644 index 0000000000000..3496c5cce7524 --- /dev/null +++ b/publish-repositories.gradle @@ -0,0 +1,10 @@ +repositories { + maven { + name = 'cloudrepo' + url = 'https://airbyte.mycloudrepo.io/repositories/airbyte-public-jars' + credentials { + username System.getenv('CLOUDREPO_USER') + password System.getenv('CLOUDREPO_PASSWORD') + } + } +}