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

Fix project's group configuration #46

Merged
merged 1 commit into from
May 1, 2024

Conversation

tom93
Copy link
Contributor

@tom93 tom93 commented Apr 4, 2024

The configuration was incorrect. The JitPack build still worked, but publishing to the Maven local repository using
./gradlew publishToMavenLocal was broken (incorrect paths and metadata), and composite builds didn't get automatic dependency substitution: building other apps against a local version of Commons using ./gradlew --include-build=../Commons ... didn't work, and using includeBuild("../Commons") in /settings.gradle.kts only worked with a manual substitution directive[1].

Also move project identity values out of gradle/libs.versions.toml.

[1] https://github.com/FossifyOrg/Gallery/blob/692a5d08b30e7d4d374f53d7371781d05b482dc9/settings.gradle.kts#L26

What is it?

  • Bugfix
  • Feature
  • Codebase improvement

Description of the changes in your PR

  • Fix the Maven groupId (it should be "org.fossify", not "org.fossify.commons").

  • Set the Gradle project group. This allows automatic dependency substitution in composite builds (--include-build=../Commons). Also set the Gradle project version for consistency.

  • Use defaults for MavenPublication. (It's no longer necessary to explicitly set the Maven groupId/artifactId/version because they default to the Gradle project group/name/version. This also fixes the artifactId, which was previously "release" but should be "commons".)

  • Avoid using libs.versions.toml for project identity. (That file is normally used for dependencies. Using it to set the project's own name and version is unusual. Also, it's confusing to have the "samples" project's appId and versionCode mixed together with the library things.)

  • Move android.namespace declaration up (it's more logical and matches the official examples).

  • Tweak the include() call in settings.gradle.kts (reorder so that "commons" is first because it's more important than "samples", and make colons consistent).

Fixes the following issue(s)

Acknowledgement

The configuration was incorrect. The JitPack build still worked, but
publishing to the Maven local repository using
`./gradlew publishToMavenLocal` was broken (incorrect paths and
metadata), and composite builds didn't get automatic dependency
substitution: building other apps against a local version of Commons
using `./gradlew --include-build=../Commons ...` didn't work, and
using `includeBuild("../Commons")` in <app>/settings.gradle.kts only
worked with a manual substitution directive[1].

Also move project identity values out of gradle/libs.versions.toml.

Detailed changes:

- Fix the Maven groupId (it should be "org.fossify", not
  "org.fossify.commons").

- Set the Gradle project group. This allows automatic dependency
  substitution in composite builds (`--include-build=../Commons`).
  Also set the Gradle project version for consistency.

- Use defaults for MavenPublication. (It's no longer necessary to
  explicitly set the Maven groupId/artifactId/version because they
  default to the Gradle project group/name/version. This also fixes
  the artifactId, which was previously "release" but should be
  "commons".)

- Avoid using libs.versions.toml for project identity. (That file is
  normally used for dependencies. Using it to set the project's own
  name and version is unusual. Also, it's confusing to have the
  "samples" project's appId and versionCode mixed together with the
  library things.)

- Move android.namespace declaration up (it's more logical and matches
  the official examples).

- Tweak the include() call in settings.gradle.kts (reorder so that
  "commons" is first because it's more important than "samples", and
  make colons consistent).

Fixes FossifyOrg/General-Discussion#150.

[1] https://github.com/FossifyOrg/Gallery/blob/692a5d08b30e7d4d374f53d7371781d05b482dc9/settings.gradle.kts#L26
@naveensingh naveensingh merged commit 75f2281 into FossifyOrg:master May 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Commons: incorrect MavenPublication configuration
2 participants