Change install strings and additional flags to objects

This commit is contained in:
Timo Ley 2021-09-06 16:43:50 +02:00
parent 515abf1c17
commit eb1bccc998
7 changed files with 82 additions and 33 deletions

View file

@ -24,21 +24,7 @@ or [files](schema/file.md).
than any relation or file, which has this flag set, also has to be installed.
- `optional` This flag specifies, that the related addon or file is optional for this addon. If the addon gets installed,
the user should be able to choose, whether he wants to install the relation or file with this flag, or not. This flag
can be used in combination with the following additional flags.
### Additional flags
These are flags, which can be used in combination with the `optional` flag.
- `require <addon id>` This flag specifies, that the relation or file requires the addon `<addon id>` to be installed.
- `companion <addon id>` This flag specifies, that the relation or file requires the addon `<addon id>` to be installed
and has to be installed, if the addon `<addon id>` is installed. In contrast to `require`, this is a two-way dependency.
- `exclude <addon id>` This flag specifies, that the relation or file can't be installed together with the addon `<addon id>`.
With all these flags, `<addon id>` has to be an addon, which is defined as a [relation](schema/relation.md).
As long as there is just one addon with the id `<addon id>` defined as a relation, the namespace may be omitted
here, even if it is defined with a namespace in the relation section. Otherwise, it is required, to also
specify the namespace here.
can be used in combination with the [conditions](schema/conditions.md) property.
### Relation specific

View file

@ -1,26 +1,31 @@
# File installing
## Install steps
## Install commands
### move
`move [location]`
args:
- `[location]`
`move` is simplest install step of all. It just moves the selected file to
the given location.
### extract
`extract [location]`
args:
- `[location]`
`extract` can be used with zip files, to extract the contents of the zip file
to the given location.
### rename
`rename [new name]`
args:
- `[new name]`
`rename` renames the selected file to the new given filename.
### execute
`execute [location] [arguments]`
args:
- `[location]`
- `[jar arguments]`
`execute` can be used with an executable jar file. The jar file will be executed with the given arguments and
the given location as working directory. A client should inform the user before just executing the file and
@ -28,7 +33,6 @@ ask them for permission to do so and/or it should execute the jar in a closed en
to prevent malicous code from running.
### launch
`launch`
`launch` can be used to mark the selected file as the launch file for a specific side. Files having this
install step can only have the `client` or the `server` flag, not both. If the file is client-sided, it
@ -40,7 +44,8 @@ side, which has this install step, except all of them are marked as `optional`,
implicitly marked as incompatible.
### select
`select [filename]`
args:
- `[filename]`
`select` is used to select the file with the given file name for other installation steps.
The file name can also be a relative path, if the file is not directly in the Minecraft directory.

29
docs/schema/conditions.md Normal file
View file

@ -0,0 +1,29 @@
# Conditions Object
```json
{
"require": ["some-addon"],
"companion": ["another-addon"],
"exclude": ["incompatible-addon"]
}
```
## Optional properties
All addons in the arrays are specified as addon IDs or namespaced addon IDs. They all need to be specified
as optional relations in this version.
### require
This is an array of addons, which are required for this relation or file.
### companion
This is an array of addons, which have to be installed together with this
relation or file. In contrast to `require`, this is a two-way dependency, which means, that if this
file or relation is installed, the addons in the array also have to be installed and if one of the
addons in the array are installed, this relation or file also have to be installed.
### exclude
This is an array of addons, which can't be installed together with this relation or file.

View file

@ -5,10 +5,9 @@
"id": "modfile",
"url": "https://example.com/mymod.jar",
"flags": [],
"install": [
"move mods"
],
"sha1": "somesha1checksum"
"install": [],
"sha1": "somesha1checksum",
"conditions": {}
}
```
@ -28,8 +27,8 @@ This is an [URL](../url.md), which points to the actual file.
### install
This is an array of [install steps](../install.md). They describe how the file should be installed to the game.
The order in the array corresponds to the order in which the install steps should be applied.
This is an array of [install objects](install.md). They describe how the file should be installed to the game.
The order in the array corresponds to the order in which the installation steps should be applied.
## Optional properties
@ -42,3 +41,7 @@ associated version, which are applicable for files.
### sha1
This is the sha1 checksum of the file. Although the checksum is optional, it is recommended to use it.
### conditions
This is a [conditions object](conditions.md). It can only be used, if the [optional flag](../flags.md) was set.

20
docs/schema/install.md Normal file
View file

@ -0,0 +1,20 @@
# Install Object
```json
{
"command": "move",
"args": ["./mods"]
}
```
## Required properties
### command
This is the [install command](../install.md), which should be used at this installation step.
## Optional properties
### args
This is an array of arguments for the [install command](../install.md). Each of them takes other arguments.

View file

@ -4,7 +4,8 @@
{
"id": "namespace:othermod",
"version": "[1.0,)",
"flags": []
"flags": [],
"conditions": {}
}
```
@ -25,3 +26,7 @@ This is a [maven version range](https://maven.apache.org/enforcer/enforcer-rules
This is an array of [flags](../flags.md) for this relation. If this property is not present in a relation object, the relation
will have the flags which are set as default for relations or, if no default was set, it will inherit the flags
which are applicable for relations from the associated version.
### conditions
This is a [conditions object](conditions.md). It can only be used, if the [optional flag](../flags.md) was set.

View file

@ -4,7 +4,7 @@
{
"id": "asrepo",
"type": "api",
"link": "https://addonscript.net/repo"
"url": "https://addonscript.net/repo"
}
```
@ -16,9 +16,10 @@ This is the ID of the repository. It has to be unique to the AddonScript file.
### type
This is the type of the repository. Possible values are `api` or `maven`.
This is the type of the repository. Possible values are [`api`](../repository/api/README.md) or [`maven`](../repository/maven.md).
### link
### url
This is the base URL of the repository. While other URLs in AddonScript can have different schemes,
the base URL has to be a http(s) URL.
the base URL has to be a http(s) URL. If it is a maven repository the scheme can also be `file`, where
it points to a directory, which contains the maven repository.