diff --git a/changelog/@unreleased/pr-1470.v2.yml b/changelog/@unreleased/pr-1470.v2.yml new file mode 100644 index 000000000..17d666b67 --- /dev/null +++ b/changelog/@unreleased/pr-1470.v2.yml @@ -0,0 +1,5 @@ +type: improvement +improvement: + description: Create api project for schema lock file + links: + - https://github.com/palantir/sls-packaging/pull/1470 diff --git a/gradle-sls-packaging-api/build.gradle b/gradle-sls-packaging-api/build.gradle new file mode 100644 index 000000000..dd794cdf6 --- /dev/null +++ b/gradle-sls-packaging-api/build.gradle @@ -0,0 +1,10 @@ +apply plugin: 'com.palantir.external-publish-jar' +apply plugin: 'org.inferred.processors' + +dependencies { + implementation 'com.fasterxml.jackson.core:jackson-databind' + implementation 'com.palantir.safe-logging:preconditions' + + compileOnly 'org.immutables:value::annotations' + annotationProcessor 'org.immutables:value' +} diff --git a/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/SchemaMigration.java b/gradle-sls-packaging-api/src/main/java/com/palantir/gradle/dist/SchemaMigration.java similarity index 100% rename from gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/SchemaMigration.java rename to gradle-sls-packaging-api/src/main/java/com/palantir/gradle/dist/SchemaMigration.java diff --git a/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/SchemaVersionLockFile.java b/gradle-sls-packaging-api/src/main/java/com/palantir/gradle/dist/SchemaVersionLockFile.java similarity index 95% rename from gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/SchemaVersionLockFile.java rename to gradle-sls-packaging-api/src/main/java/com/palantir/gradle/dist/SchemaVersionLockFile.java index 0f3c865b5..d2f708304 100644 --- a/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/SchemaVersionLockFile.java +++ b/gradle-sls-packaging-api/src/main/java/com/palantir/gradle/dist/SchemaVersionLockFile.java @@ -16,6 +16,7 @@ package com.palantir.gradle.dist; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.palantir.logsafe.Preconditions; @@ -37,6 +38,7 @@ default String getComment() { return COMMENT; } + @JsonProperty("schemaMigrations") List getSchemaMigrations(); @Value.Default diff --git a/gradle-sls-packaging/build.gradle b/gradle-sls-packaging/build.gradle index 5c130b4e5..a1095c8a5 100644 --- a/gradle-sls-packaging/build.gradle +++ b/gradle-sls-packaging/build.gradle @@ -12,6 +12,7 @@ dependencies { api gradleApi() api project(':gradle-recommended-product-dependencies') + api project(':gradle-sls-packaging-api') api 'com.google.guava:guava' api 'com.fasterxml.jackson.core:jackson-databind' api 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' diff --git a/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/ObjectMappers.java b/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/ObjectMappers.java index 298e18d3d..9a43eb5c2 100644 --- a/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/ObjectMappers.java +++ b/gradle-sls-packaging/src/main/java/com/palantir/gradle/dist/ObjectMappers.java @@ -37,12 +37,7 @@ public final class ObjectMappers { .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) .registerModule(new GuavaModule()); - private static final ObjectMapper ymlMapper = new ObjectMapper(new YAMLFactory()) - .setSerializationInclusion(JsonInclude.Include.NON_NULL) - .setPropertyNamingStrategy(PropertyNamingStrategies.KEBAB_CASE) - .enable(SerializationFeature.INDENT_OUTPUT) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .registerModule(new GuavaModule()); + private static final ObjectMapper ymlMapper = new ObjectMapper(new YAMLFactory()).registerModule(new GuavaModule()); public static void writeProductDependencyManifest(ProductDependencyManifest pdm, File outputFile) { try { diff --git a/settings.gradle b/settings.gradle index b8ffcc998..e234ebe74 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,3 +1,4 @@ rootProject.name = 'sls-packaging' include 'gradle-sls-packaging' +include 'gradle-sls-packaging-api' include 'gradle-recommended-product-dependencies'