Skip to content

Commit 9ad077d

Browse files
committed
docs: move quick-start to common docs
1 parent ed47211 commit 9ad077d

File tree

3 files changed

+8
-145
lines changed

3 files changed

+8
-145
lines changed

docs/docs/features/features.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Basic c++ knowledge is necessary.
2020

2121
### Code generation
2222

23-
Follow the documentation for the [code generation](/docs/start/first_steps) in general and [CLI](/docs/cli/generate) or the [Studio](/docs/studio/intro) tools.
23+
Follow the documentation for the [code generation](/docs/guide/intro) in general and [CLI](/docs/cli/generate) or the [Studio](/docs/studio/intro) tools.
2424
Or try first the [quick start guide](../quickstart/index.md) which shows how to prepare api and generate code out of it.
2525

2626
:::tip

docs/docs/intro.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ sidebar_position: 1
44

55
# Template C++ 14
66

7-
This is the documentation for the _cpp14_ template for the [ApiGear](/docs/start/first_steps) code generator.
7+
This is the documentation for the _cpp14_ template for the [ApiGear](/docs/guide/intro) code generator.
88

99
It is split in several parts:
1010

docs/docs/quickstart/index.md

Lines changed: 6 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,25 @@
11
---
22
sidebar_position: 2
33
---
4+
import QuickStartCommon from "@site/docs/_quickstart_common.md"
45

56
# Quick-Start
67

78
The Quick-Start guide explains how in a few steps you get from an API definition to a functional c++ example.
89

910
Steps one and two are universal for other technologies. In the step two you will choose a concrete _cpp14_ template.
10-
For more general information about first steps with ApiGear [First Steps](/docs/start/first_steps)
11+
For more general information about first steps with ApiGear [First Steps](/docs/guide/intro)
1112

1213
The quick start enables only basic features: the [api](features/api.md) generation and simple [stub](features/stubs.md) implementation.
1314
For all available features check the [overview](features/features.md).
1415

15-
## 1. Install the code generator
16+
<QuickStartCommon />
1617

17-
Get the [ApiGear Studio](https://github.com/apigear-io/studio/releases) or [ApiGear CLI](https://github.com/apigear-io/cli/releases). For more information check the [ApiGear documentation](/docs/start/install).
18+
## 5. Use the generated cpp project
1819

19-
## 2. Get the template
20+
### Project folder structure
2021

21-
There are several options to get the template. Installation via the _Studio_ or the _CLI_. Alternatively it is possible to clone or download from github.
22-
23-
### Installation via CLI
24-
25-
When using the _CLI_ only the highlighted line is imported. You can always check whether the installation was successful via the `template list` command.
26-
27-
```bash
28-
$ apigear template list
29-
list of templates from registry and cache
30-
name | installed | registry | url
31-
apigear-io/template-cpp14 | false | true | https://github.com/apigear-io/template-cpp14.git
32-
...
33-
# highlight-next-line
34-
$ apigear template install apigear-io/template-cpp14
35-
$ apigear template list
36-
list of templates from registry and cache
37-
name | installed | registry | url
38-
apigear-io/template-cpp14 | true | true | https://github.com/apigear-io/template-cpp14.git
39-
...
40-
```
41-
42-
### Installation via Studio
43-
44-
From within the studio the installation is really simple.
45-
46-
1. Open an existing project or create an new one
47-
2. Go to the `Templates` tab
48-
3. Click `Install` on the `apigear-io/template-cpp14` entry
49-
50-
### Clone from github
51-
52-
In case you want to check or modify the source code of the template, it is easier to clone or download the repository. The repository does not need to be part of the project, but can be stored anywhere on the computer.
53-
54-
```bash
55-
$ git clone https://github.com/apigear-io/template-cpp14.git
56-
```
57-
58-
You can then point the solution file to use your template from its directory by providing relative path from the solution file.
59-
60-
## 3. Set up project
61-
62-
For a project we usually need two files. The solution which specifies what `APIs` and which template to use for it. And at least one `API` module file.
63-
Both should ideally be in a folder called `apigear` next to each other.
64-
65-
Alternatively, you can also use the _Studio_ to create a new project and modify the two example files.
66-
67-
### Solution file
68-
69-
Create a [solution](/docs/start/first_steps#create-a-solution) file.
70-
The example below specifies
71-
72-
- module files in _line 8_, here the `helloworld.module.yaml` module with `Hello` API
73-
- the output directory for generated files in _line 9_
74-
- a template used to generate the code in _line 10_, here the `apigear-ui/template-cpp14` template. This can also be a path to a local copy of the template.
75-
- the enabled features of the template in _line 13_, here the `stubs` feature, a simple implementation of interfaces. For all available features check the [overview](features/features.md).
76-
77-
```yaml title="helloworld.solution.yaml" showLineNumbers
78-
schema: "apigear.solution/1.0"
79-
name: hello_world_example
80-
version: "0.1.0"
81-
82-
targets:
83-
- name: cpp_hello_world
84-
inputs:
85-
- helloworld.module.yaml
86-
output: ../cpp_hello_world
87-
template: apigear-io/template-cpp14
88-
force: true
89-
features:
90-
- stubs
91-
```
92-
93-
:::tip Targets
94-
You can extend this solution file with other targets, each for the different technology with different template. The `module.yaml` is technology independent and may be used for any template.
95-
:::
96-
97-
:::note
98-
Set the force parameter to true if you want to always override all the generated files. With option set to false some files, like implementation (stub feature) won't be updated. All the API files are always updated.
99-
:::
100-
101-
### API module file
102-
103-
Use your favorite text editor to create the `helloworld.module.yaml` with the example content:
104-
105-
```yaml title="helloworld.module.yaml" showLineNumbers
106-
schema: apigear.module/1.0
107-
name: io.world
108-
version: "1.0.0"
109-
110-
interfaces:
111-
- name: Hello
112-
properties:
113-
- { name: last, type: Message }
114-
operations:
115-
- name: say
116-
params:
117-
- { name: msg, type: Message }
118-
- { name: when, type: When }
119-
return:
120-
type: int
121-
signals:
122-
- name: justSaid
123-
params:
124-
- { name: msg, type: Message }
125-
enums:
126-
- name: When
127-
members:
128-
- { name: Now, value: 0 }
129-
- { name: Soon, value: 1 }
130-
- { name: Never, value: 2 }
131-
structs:
132-
- name: Message
133-
fields:
134-
- { name: content, type: string }
135-
```
136-
137-
## 4. Generate code
138-
139-
With the output directory set as in example, both _ApiGear_ files reside in an `apigear` subfolder next to the _cpp_ generated files.
22+
With the output directory set as in the example, both _ApiGear_ files reside in an `apigear` subfolder next to the _cpp_ generated files.
14023
In this case the folder structure should look similar to this
14124

14225
```bash
@@ -161,26 +44,6 @@ Using the solution file from the previous paragraph the code will be generated i
16144
With subfolder for each module, here `io_world` as the name of module (defined in line 2 of `helloworld.module.yaml`).
16245
It contains both features generated: a basic api and a stub implementation.
16346

164-
### Generate via CLI
165-
166-
The following snippet shows how the CLI can be run.
167-
168-
```bash
169-
$ apigear generate solution apigear/helloworld.solution.yaml
170-
10:52:20 INF generated 21 files in 30ms. (20 write, 0 skip, 1 copy) topic=gen
171-
```
172-
173-
- `generate` tells the CLI that it should generate code
174-
- `solution` specifies that we want to run a solution file
175-
176-
### Generate via Studio
177-
178-
1. Open the project
179-
2. Go to the `Solutions` tab
180-
3. Click `Run` on the `helloworld.solution.yaml` entry
181-
182-
## 5. Use the generated cpp project.
183-
18447
The generated code provides cpp _C++_ implementations. The following paragraphs show how you can use it.
18548
You can start your project loading the top level CMakeLists.txt in `cpp_hello_world` folder.
18649

0 commit comments

Comments
 (0)