Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup logic to publish the Godot Android library to MavenCentral #59146

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

m4gr3d
Copy link
Contributor

@m4gr3d m4gr3d commented Mar 14, 2022

This PR follows the instructions from https://getstream.io/blog/publishing-libraries-to-mavencentral-2021/ to setup the logic to publish the Godot Engine Android Library to MavenCentral.

MavenCentral is a repository provided by the Maven community which contains a large number of commonly used libraries.
It's an important tool for java and Android developers as it simplifies the resolution and fetching process for a project's dependencies by build tools like Gradle.

The updated logic will enable to push (automatically) the generated Godot Android Library to MavenCentral so that users can access it by adding a single line to their gradle build file:

dependencies {
    ...
    implementation 'io.github.m4gr3d:godot:<versions>'
    ...
}

Publishing To MavenCentral

  • This requires a sonatype account and a GPG key to sign the generated library.
  • Provide values for the variables defined in publish-root.gradle. This can either be done via environment variables, or through the local.properties file (that file is not and should not be added to git).
  • Generate the Godot Android Library via the usual build process.
  • Run the following commands to push the generated library to MavenCentral:
    • cd platform/android/java
    • ./gradlew :lib:publishReleasePublicationToSonatypeRepository
  • Follow these steps to review the uploaded binary and release it publicly on MavenCentral.

Notes & TODOs

  • I'm using my own sonatype credentials at the moment to publish the library. Eventually, we would want to switch to Godot's own set of credentials.
  • Automatic publishing is blocked by above todo. Once we have a set of credentials for Godot, we can automate the publishing of the Godot Android Library by leveraging github workflows as described here.
  • Update internal logic (e.g: Android template logic) to leverage the published library via gradle
  • Update Android related documentation accordingly.

Part of godotengine/godot-docs#4018
Implements godotengine/godot-proposals#4230

@m4gr3d m4gr3d added enhancement platform:android cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.4 labels Mar 14, 2022
@m4gr3d m4gr3d requested a review from a team as a code owner March 14, 2022 17:46
@m4gr3d m4gr3d requested a review from akien-mga March 14, 2022 17:51
@m4gr3d m4gr3d force-pushed the setup_mavencentral_publishing branch from 6034cd5 to b722da2 Compare March 14, 2022 18:07
@Calinou Calinou added this to the 4.0 milestone Mar 14, 2022
@m4gr3d m4gr3d force-pushed the setup_mavencentral_publishing branch 3 times, most recently from fa08027 to 3f2b6bf Compare March 14, 2022 18:54
@akien-mga akien-mga merged commit 5c7971d into godotengine:master Mar 16, 2022
@m4gr3d m4gr3d deleted the setup_mavencentral_publishing branch March 16, 2022 16:39
@akien-mga
Copy link
Member

Cherry-picked for 3.5.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Mar 17, 2022
@akien-mga
Copy link
Member

Cherry-picked for 3.4.4.

@hannojg
Copy link

hannojg commented Jun 16, 2022

@m4gr3d Hey, thanks for providing this! Is the "export" mono-compatible, meaning we can use it for games using mono scripts?

@m4gr3d
Copy link
Contributor Author

m4gr3d commented Jun 19, 2022

@m4gr3d Hey, thanks for providing this! Is the "export" mono-compatible, meaning we can use it for games using mono scripts?

@hannojg The dependency under io.github.m4gr3d:godot:<versions> is not mono-compatible. Though this is only because the Godot Android library I generate and upload doesn't have mono-enabled.

The sonatype upload script is agnostic, so if a Godot Android library with mono enabled is generated instead, it can be uploaded similarly.

Once we have an official Godot sonatype account (io.github.m4gr3d is my personal account), it makes sense to include the mono library as part of the offered dependencies.

cc @akien-mga

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants