-
-
Notifications
You must be signed in to change notification settings - Fork 15
Developer Guide
This part of the wiki talks about daily developer guidelines to work on MapLibre-Java.
Open MapLibre-Java as it is on IntelliJ Idea. If you want to use Visual Studio Code or any other editor, use an appropriate Gradle Plugin to get you started.
The following utility libraries are hosted here:
- services-geojson
- services-turf
This repository has one root gradle projects. All the libraries are configured to be gradle sub-projects.
To see all the sub-projects, run the following:
./gradlew projectsTo see all the sub-projects from gradle
To build both of the libraries, run:
./gradlew clean buildTo build a specific library such as services-geojson, run
./gradlew :services-geojson:buildTo run unit test of the libraries, run:
./gradlew testTo build a specific library such as services-geojson, run
./gradlew :services-geojson:testTo test out Maven publishing without actually publishing to maven, we can use a local publish.
To get started with that, the first thing we will need is a PGP key-pair. MapLibre-Java uses Gradle as build-system. Gradle's Signing Plugin requires artifact signature before publishing to anywhere.
To get started, install gpg in your machine. If you are on OSX, use brew
brew install gpgIf you are on Linux, use any of the following:
# for apt users (Ubuntu, Debian, Mint, and Kali)
sudo apt-get install gnupg
# for yum users (CentOS, Fedora, or RHEL)
sudo yum install gnupgAfter installation, give it a quick version check
You will see something like the following
$ gpg --version
gpg (GnuPG) 2.3.8
libgcrypt 1.10.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GNU GPL-3.0-or-later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /Users/pswagata/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
AEAD: EAX, OCB
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2Now, we move to create a key pair locally
gpg --gen-keyThis will create a public and private key pair. Go through the whole process and ensure you provide a strong passphrase. It will ask for your name and email too.
After creation of the key-pair, run the following command to list the available key-pairs. You will see something like the following:
$ gpg --list-secret-keys --keyid-format short
/Users/pswagata/.gnupg/pubring.kbx
----------------------------------
sec ed25519/69938690 2022-12-05 [SC] [expires: 2024-12-04]
E0DB98C067844BB435153D88F56EFE4569938690
uid [ultimate] Swagata Prateek <[email protected]>
ssb cv25519/1E89EA3B 2022-12-05 [E] [expires: 2024-12-04]According to Gradle documentation, to configure the Signatory Credentials, we will require the following:
The last 8 symbols of the keyId. If we look above, we listed all our available keys with gpg --list-secret-keys --keyid-format short command.
In this example, the key id is 69938690 taken from ed25519/69938690 part of the text.
Nothing special to write here. This is the passphrase you provided when you created the key pair.
This is the absolute path to the secret key ring file containing your private key. Since gpg 2.1, we need to export the keys with the follwoing command
gpg --keyring /Users/pswagata/.gnupg/pubring.kbx --export-secret-keys -o ~/.gnupg/secring.gpg This will translate the .kbx file to a .gpg file that Gradle signing plugin understands.
There are many ways to go about it. To know all the ways available, please check Gradle Signatory Credentials documentation.
We recommend creating a local.properties file in the root of the maplibre-java project. In the local.properties file, write the following content
signing.keyId=<KeyID>
signing.password=<Your Pass>
signing.secretKeyRingFile=<Secret KeyRing File>You are all set to run a local publish. To summarize a local publish does the following:
- Builds your artifact
- Creates a Maven pom file based on the project
- Publishes a Gradle Module
- Publishes the publish ready artifact to local Maven.
Run the following:
./gradlew :<project-name>:publishToMavenLocal --infoFor example, for services-geojson gradle sub-project, the command will be
./gradlew :services-geojson:publishToMavenLocal --infoNow, to see the path of your local maven repo, run the following:
mvn help:effective-settingsIt is usually under ~/.m2/repository/ path. You can visit it to check generated maven artifacts.