Skip to content

Packages

Felix Hellman edited this page Jun 20, 2021 · 4 revisions

Packages

Structure

Gop requires you to follow a specific structure, mostly due to gd script being very path dependent

manifets.yaml
pkg:
  author-dependency

This structure also needs to be reflected in the manifest.yaml file

project:
  package:
    name: dependency
    author: author
    version: version
  repository:
  - path: https://gop.shrimpray.com

Installing Packages

Public Packages - Quickstart Guide

Installing public packages is quite easy

gop init
gop add --dependency=felix-hellman/awesome --version=0.0.1
gop install

Updating Public Packages

To check for and install new versions of your current dependencies, you can do the following

gop update  
gop install

Private Packages

Private packages does not support versions but works as long as your package follow the same structure as for public packages

Here is an example of how to specify that a dependency is private and should be downloaded via Github

project:
  dependencies:
  - name: author/package-name
    access: "private"

You also need to be logged in with additional scope in order to get access to the private repository

gop login --repo

Install works as usual

gop install

Mixing and matching

Gop allows you to use a mixture of private and public dependencies

Both Private and Public dependencies can have their own dependencies that will be automatically installed during the install phase

Version Missmatch

Gop does not allow the same package of different versions

I.e. Gop will not complete install if you depend on dependencies A,B:

  • A depends on C (Version 1.0.0)
  • B depends on C (Version 0.8.0)

Everything will be fine however if if you depend on dependencies A,B:

  • A depends on C (Version 1.0.0)
  • B depends on C (Version 1.0.0)

Publishing packages

Public Package - Quickstart Guide

gop login
gop init --author=username --name=package-name --version=0.0.1
mkdir -p pkg/username-package-name
echo "extends Node2D" > ./pkg/username-package-name/HelloWorld.gd
echo "func _ready():" >> ./pkg/username-package-name/HelloWorld.gd
echo "	print("Hello world!") >> ./pkg/username-package-name/HelloWorld.gd
gop generate-key-pair #Assuming you don't have any related keys
gop upload-key --key-file=./public-key.pem
gop package --key-file=./private-key.pem

Private Github Package - Quickstart Guide

Private Github Packages Does not Support Versioning

Make a private repository in Github and follow the project structure needed for gop to work, your code need to be in the main branch as the github default specifies. I.e. Not Master.

That's it.

Private packages is a work in progress and you will be able to select branch later.