~nik90/component-store/fix-debian-packaging

« back to all changes in this revision

Viewing changes to docs/contribute-community.rst

  • Committer: Stuart Langridge
  • Date: 2015-01-04 12:05:08 UTC
  • Revision ID: sil-launchpad@kryogenix.org-20150104120508-enrpvh0njrdl6vr9
Update documentation to describe the curated and community stores, and how to contribute to the community store. Also tweak a bug in ucs for searching curated components.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Contributing a component to the Community store
 
2
===============================================
 
3
 
 
4
To publish an Ubuntu SDK component to the Community store, you will need a `Launchpad account <https://help.launchpad.net/YourAccount/NewAccount>`_, and you will need to be familiar with `using bzr to push code to Launchpad <https://help.launchpad.net/Code/UploadingABranch>`_.
 
5
 
 
6
Community components can be pure QML, or they can be compiled binary components. 
 
7
 
 
8
Publishing a pure QML component
 
9
-------------------------------
 
10
 
 
11
Create a branch on Launchpad (in any project of your choice) which is named how you plan to name the component, with a top-level *qml* folder, and put your QML file and any required assets for your component in that qml folder. Then, submit the component to the community store with *ucs submit lp:~username/project/branch*, passing the name of the branch.
 
12
 
 
13
So, your branch should look like: ::
 
14
 
 
15
    qml/
 
16
        MyComponent.qml
 
17
        required_image.png
 
18
        included_script.js
 
19
 
 
20
If your component does not have any external assets, it is fine to have a branch with *qml/MyComponent.qml* and nothing else in it. Your branch may also contain any other files you choose outside the *qml* top-level folder; these files are not installed with your component, but may provide useful guidance, READMEs, or other code for people who want to make changes to the component and contribute them back to you.
 
21
 
 
22
The *branch name* is the name of the component itself; the QML filename is what names the QML Item that it provides. So, if you are Launchpad user *sil*, and you push your component to *lp:~sil/SomeProject/UsefulComponent*, and it contains *qml/RedRectangle.qml*, an app developer will use it like this: ::
 
23
 
 
24
    import QtQuick 2.0
 
25
    import ubuntu_component_store.sil.UsefulComponent 1.0
 
26
    ....
 
27
    MainView {
 
28
        RedRectangle {
 
29
            ....
 
30
        }
 
31
    }
 
32
 
 
33
Most components should have branch name and QML file name be the same thing.
 
34
 
 
35
Do not publish two unrelated QML components in one UCS component; publish them separately, so they can be used separately.
 
36
 
 
37
.. note: if you do not want to create a whole Launchpad project just for this component, you can push to a Launchpad "junk" branch: *lp:~username/+junk/ComponentName
 
38
 
 
39
Once your branch is created, publish it to the Community store with ::
 
40
 
 
41
    $ ucs submit lp:~username/project/ComponentName
 
42
    (submitting to community repository)
 
43
    Checking Launchpad branch lp:~username/project/ComponentName
 
44
    Checks passed OK
 
45
    Calculated package summary data
 
46
    Updating master record
 
47
    Component username/ComponentName updated successfully
 
48
 
 
49
It should then be visible to *ucs search*.
 
50
 
 
51
Publishing a compiled component
 
52
-------------------------------
 
53
 
 
54
Publishing a compied component is a little more complicated, for CPU architecture reasons. Your component must be `an Extension Plugin <http://doc.qt.io/qt-5/qtqml-tutorials-extending-qml-example.html#chapter-6-writing-an-extension-plugin>`_, "a plugin library to make it available to the QML engine as a new QML import module". Creating such a plugin is currently beyond the scope of this document. (We are hoping to provide an Ubuntu SDK IDE template for creating such components with the proper filesystem layout; before then, the "App with QML Extension Library" option creates an appropriate type of component.)
 
55
 
 
56
You *must* compile your component for three different architectures: ARM, x86, and amd64 (for Ubuntu phones, the desktop emulator, and Ubuntu desktops). Once you have compiled it as such, you will have three different *libMyComponent.so* files.
 
57
 
 
58
Assemble a Launchpad branch with a top-level *bin* folder, and in it put a folder for each architecture, named for the GNU architecture triplet, and then the *.so* file within. So: ::
 
59
 
 
60
    /bin
 
61
        /x86_64-linux-gnu
 
62
                         /libMyComponent.so
 
63
        /i386-linux-gnu
 
64
                         /libMyComponent.so
 
65
        /arm-linux-gnueabihf
 
66
                         /libMyComponent.so
 
67
 
 
68
Your branch may contain any other files of your choice outside the */bin* folder; in particular, it should contain the source code for the plugin so others can build it themselves if they choose!
 
69
 
 
70
The *branch name* is the name of the component itself; your component is expected to use `qmlRegisterType <http://doc.qt.io/qt-5/qqmlextensionplugin.html#details>`_ to provide QML Item types. So, if you are Launchpad user *sil*, and you push your component to *lp:~sil/SomeProject/SomeComponent*, and it registers a *Triangle* type, an app developer will use it like this: ::
 
71
 
 
72
    import QtQuick 2.0
 
73
    import ubuntu_component_store.sil.SomeComponent 1.0
 
74
    ....
 
75
    MainView {
 
76
        Triangle {
 
77
            ....
 
78
        }
 
79
    }
 
80
 
 
81
Do not publish two unrelated QML components in one UCS component; publish them separately, so they can be used separately.
 
82
 
 
83
.. note: if you do not want to create a whole Launchpad project just for this component, you can push to a Launchpad "junk" branch: *lp:~username/+junk/ComponentName
 
84
 
 
85
Once your branch is created, publish it to the Community store with ::
 
86
 
 
87
    $ ucs submit lp:~username/project/ComponentName
 
88
    (submitting to community repository)
 
89
    Checking Launchpad branch lp:~username/project/ComponentName
 
90
    Checks passed OK
 
91
    Calculated package summary data
 
92
    Updating master record
 
93
    Component username/ComponentName updated successfully
 
94
 
 
95
It should then be visible to *ucs search*.