-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure publishing. Rename modules to
compiler
and annotations
.
- Loading branch information
Showing
22 changed files
with
308 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Publish snapshot | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
publish-snapshot: | ||
runs-on: macos-14 | ||
if: github.repository == 'IlyaGulya/anvil-utils' | ||
timeout-minutes: 25 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: gradle/wrapper-validation-action@v2 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
check-latest: true | ||
|
||
- name: Publish Release | ||
run: ./gradlew clean publish --no-build-cache --no-daemon --stacktrace | ||
env: | ||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | ||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
publish-release: | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'square/anvil' | ||
timeout-minutes: 25 | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: gradle/wrapper-validation-action@v2 | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
check-latest: true | ||
|
||
- name: Publish Release 1.9 | ||
run: ./gradlew clean publish --no-build-cache --no-daemon --stacktrace --no-parallel | ||
env: | ||
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | ||
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }} | ||
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: '' | ||
|
||
- name: Extract release notes | ||
id: release_notes | ||
uses: ffurrer2/extract-release-notes@v2 | ||
|
||
- name: Create release | ||
uses: softprops/action-gh-release@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v2 | ||
with: | ||
body: ${{ steps.release_notes.outputs.release_notes }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Change Log | ||
|
||
## [Unreleased] | ||
|
||
### Added | ||
|
||
### Changed | ||
|
||
### Deprecated | ||
|
||
### Removed | ||
|
||
### Fixed | ||
|
||
### Security | ||
|
||
### Custom Code Generator | ||
|
||
### Other Notes & Contributions | ||
|
||
## [0.1.0] - 2024-03-21 | ||
|
||
- Initial release. | ||
|
||
|
||
|
||
[Unreleased]: https://github.com/square/anvil/compare/v0.1.0...HEAD | ||
[0.1.0]: https://github.com/IlyaGulya/anvil-utils/releases/tag/v0.1.0 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
plugins { | ||
alias(libs.plugins.kotlinx.binaryCompatibility) | ||
id("conventions.library") | ||
id("conventions.publish") | ||
} | ||
|
||
publish { | ||
configurePom( | ||
artifactId = "annotations", | ||
pomName = "Anvil Utils Annotations", | ||
pomDescription = "Utility annotations used to generate code using anvil-utils", | ||
) | ||
} | ||
|
||
kotlin { | ||
explicitApi() | ||
} |
2 changes: 1 addition & 1 deletion
2
...otlin/me/gulya/anvil/utils/AssistedKey.kt → ...in/me/gulya/anvil/assisted/AssistedKey.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...anvil/utils/ContributesAssistedFactory.kt → ...il/assisted/ContributesAssistedFactory.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package me.gulya.anvil.utils | ||
package me.gulya.anvil.assisted | ||
|
||
import kotlin.reflect.KClass | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
plugins { | ||
`embedded-kotlin` | ||
`kotlin-dsl` | ||
`java-gradle-plugin` | ||
} | ||
|
||
dependencies { | ||
implementation(libs.plugin.kotlin.dokka) | ||
implementation(libs.plugin.kotlin.jvm) | ||
implementation(libs.plugin.mavenPublish) | ||
implementation(files(libs::class.java.superclass.protectionDomain.codeSource.location)) | ||
} | ||
|
||
gradlePlugin { | ||
plugins { | ||
register("publish") { | ||
id = "conventions.publish" | ||
implementationClass = "me.gulya.convention.PublishConventionPlugin" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
dependencyResolutionManagement { | ||
repositories { | ||
gradlePluginPortal() | ||
mavenCentral() | ||
} | ||
versionCatalogs { | ||
create("libs") { | ||
from(files("../../gradle/libs.versions.toml")) | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
build-logic/conventions/src/main/kotlin/me/gulya/convention/Libs.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package me.gulya.convention | ||
|
||
import org.gradle.accessors.dm.LibrariesForLibs | ||
import org.gradle.api.Project | ||
import org.gradle.kotlin.dsl.the | ||
|
||
val Project.libs | ||
get() = the<LibrariesForLibs>() |
70 changes: 70 additions & 0 deletions
70
build-logic/conventions/src/main/kotlin/me/gulya/convention/PublishConventionPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package me.gulya.convention | ||
|
||
import com.vanniktech.maven.publish.JavadocJar | ||
import com.vanniktech.maven.publish.KotlinJvm | ||
import com.vanniktech.maven.publish.MavenPublishBaseExtension | ||
import com.vanniktech.maven.publish.SonatypeHost | ||
import org.gradle.api.Plugin | ||
import org.gradle.api.Project | ||
import org.gradle.api.publish.PublishingExtension | ||
import org.gradle.api.publish.maven.MavenPublication | ||
import org.gradle.kotlin.dsl.the | ||
import javax.inject.Inject | ||
|
||
open class PublishConventionPlugin : Plugin<Project> { | ||
override fun apply(target: Project) { | ||
target.extensions.create("publish", PublishExtension::class.java) | ||
|
||
target.plugins.apply(target.libs.plugins.mavenPublish.get().pluginId) | ||
target.plugins.apply(target.libs.plugins.kotlin.dokka.get().pluginId) | ||
|
||
val mavenPublishing = target.extensions | ||
.getByType(MavenPublishBaseExtension::class.java) | ||
|
||
@Suppress("UnstableApiUsage") | ||
mavenPublishing.pomFromGradleProperties() | ||
mavenPublishing.signAllPublications() | ||
mavenPublishing.publishToMavenCentral(SonatypeHost.DEFAULT, automaticRelease = true) | ||
|
||
target.plugins.withId("org.jetbrains.kotlin.jvm") { | ||
mavenPublishing.configure( | ||
platform = KotlinJvm( | ||
javadocJar = JavadocJar.Dokka(DOKKA_HTML), | ||
sourcesJar = true, | ||
), | ||
) | ||
} | ||
|
||
// // Fixes issues like: | ||
// // Task 'generateMetadataFileForMavenPublication' uses this output of task 'dokkaJavadocJar' | ||
// // without declaring an explicit or implicit dependency. | ||
// target.tasks.withType(GenerateModuleMetadata::class.java).configureEach { | ||
// it.mustRunAfter(target.tasks.withType(Jar::class.java)) | ||
// } | ||
} | ||
|
||
companion object { | ||
internal const val DOKKA_HTML = "dokkaHtml" | ||
} | ||
} | ||
|
||
open class PublishExtension @Inject constructor( | ||
private val target: Project, | ||
) { | ||
fun configurePom( | ||
artifactId: String, | ||
pomName: String, | ||
pomDescription: String, | ||
) { | ||
target.the<PublishingExtension>() | ||
.publications.withType(MavenPublication::class.java) | ||
.configureEach { | ||
this.artifactId = artifactId | ||
|
||
pom { | ||
name.set(pomName) | ||
description.set(pomDescription) | ||
} | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
build-logic/conventions/src/main/kotlin/me/gulya/convention/conventions.library.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
plugins { | ||
kotlin("jvm") | ||
kotlin("kapt") | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(17) | ||
compilerOptions { | ||
optIn.add("com.squareup.anvil.annotations.ExperimentalAnvilApi") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Oops, something went wrong.