Skip to content

Commit

Permalink
Shade prettier4j in smithy-syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdowling committed Jun 19, 2023
1 parent 5299dbb commit f774d59
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ subprojects {
apply plugin: "signing"
apply plugin: "com.github.johnrengelman.shadow"

// This is a little hacky, but currently needed to build a shadowed CLI JAR with the same customizations
// as other JARs.
if (project.name != "smithy-cli") {
// This is a little hacky, but currently needed to build a shadowed CLI JAR and smithy-syntax JAR with the same
// customizations as other JARs.
if (project.name != "smithy-cli" && project.name != "smithy-syntax") {
tasks.shadowJar.enabled = false
}

Expand Down
2 changes: 1 addition & 1 deletion smithy-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
implementation project(":smithy-model")
implementation project(":smithy-build")
implementation project(":smithy-diff")
implementation project(":smithy-syntax")
implementation project(path: ':smithy-syntax', configuration: 'shadow')

// This is needed to ensure the above dependencies are added to the runtime image.
shadow project(":smithy-model")
Expand Down
25 changes: 24 additions & 1 deletion smithy-syntax/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
Expand All @@ -24,4 +24,27 @@ dependencies {
api project(":smithy-utils")
api project(":smithy-model")
implementation "com.opencastsoftware:prettier4j:0.1.1"

// This is needed to export these as dependencies since we aren't shading them.
shadow project(":smithy-model")
shadow project(":smithy-utils")
}

shadowJar {
// Replace the normal JAR with the shaded JAR. We don't want to publish a JAR that isn't shaded.
archiveClassifier = ''

mergeServiceFiles()

// Shade and relocate prettier4j.
relocate('com.opencastsoftware.prettier4j', 'software.amazon.smithy.syntax.shaded.prettier4j')

// Despite the "shadow" configuration under dependencies, we unfortunately need to also list here that
// smithy-model and smithy-utils aren't shaded. These are normal dependencies that we want consumers to resolve.
dependencies {
exclude(project(':smithy-utils'))
exclude(project(':smithy-model'))
}
}

tasks['jar'].finalizedBy(tasks['shadowJar'])

0 comments on commit f774d59

Please sign in to comment.