Skip to content

Commit 2f2d1e0

Browse files
authored
feat: native add command to add native source files to the project (#5806)
1 parent 6509773 commit 2f2d1e0

File tree

8 files changed

+592
-1
lines changed

8 files changed

+592
-1
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<% if (isJekyll) { %>---
2+
title: ns native add java
3+
position: 2
4+
---<% } %>
5+
6+
# ns native add java
7+
8+
### Description
9+
10+
Adds a newly generated Java file, which includes a class with the specified name, placing it in the appropriate directory.
11+
12+
### Commands
13+
14+
Usage | Synopsis
15+
------|-------
16+
Java | `$ ns native add java <Java class name>`
17+
18+
### Arguments
19+
20+
* `<Java class name>` is the fully qualified name of the `Class` to create, e.g. `org.nativescript.SomeClass`
21+
22+
<% if(isHtml) { %>
23+
24+
### Related Commands
25+
26+
Command | Description
27+
----------|----------
28+
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
29+
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
30+
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
31+
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
32+
<% } %>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<% if (isJekyll) { %>---
2+
title: ns native add kotlin
3+
position: 3
4+
---<% } %>
5+
6+
# ns native add kotlin
7+
8+
### Description
9+
10+
Adds a newly generated Kotlin file, which includes a class with the specified name, placing it in the appropriate directory.
11+
12+
Kotlin usage requires that the `useKotlin` property is set in `gradle.properties`, the command will set this to `true`.
13+
14+
### Commands
15+
16+
Usage | Synopsis
17+
------|-------
18+
Kotlin | `$ ns native add kotlin <Kotlin class name>`
19+
20+
### Arguments
21+
22+
* `<Kotlin class name>` is the fully qualified name of the `Class` to create, e.g. `org.nativescript.SomeClass`
23+
24+
<% if(isHtml) { %>
25+
26+
### Related Commands
27+
28+
Command | Description
29+
----------|----------
30+
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
31+
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
32+
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
33+
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
34+
<% } %>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<% if (isJekyll) { %>---
2+
title: ns native add objective-c
3+
position: 4
4+
---<% } %>
5+
6+
# ns native add objective-c
7+
8+
### Description
9+
10+
Adds newly generated Objective-C files, which include an interface with the specified name, placing them in the appropriate directory.
11+
12+
Objective-C usage requires that the `module.modulemap` is modified to include the header file, the command will set this entry.
13+
14+
### Commands
15+
16+
Usage | Synopsis
17+
------|-------
18+
Objective-C | `$ ns native add objective-c <Objective-C interface name>`
19+
20+
### Arguments
21+
22+
* `<Objective-C interface name>` is the name of the `interface` to create, e.g. `SomeInterface`
23+
24+
<% if(isHtml) { %>
25+
26+
### Related Commands
27+
28+
Command | Description
29+
----------|----------
30+
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
31+
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
32+
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
33+
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
34+
<% } %>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<% if (isJekyll) { %>---
2+
title: ns native add swift
3+
position: 5
4+
---<% } %>
5+
6+
# ns native add swift
7+
8+
### Description
9+
10+
Adds a newly generated Swift file, which includes a class with the specified name, placing it in the appropriate directory.
11+
12+
### Commands
13+
14+
Usage | Synopsis
15+
------|-------
16+
Swift | `$ ns native add swift <Swift class name>`
17+
18+
### Arguments
19+
20+
* `<Swift class name>` is the name of the `Class` to create, e.g. `SomeClass`
21+
22+
<% if(isHtml) { %>
23+
24+
### Related Commands
25+
26+
Command | Description
27+
----------|----------
28+
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
29+
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
30+
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
31+
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
32+
<% } %>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<% if (isJekyll) { %>---
2+
title: ns native add
3+
position: 1
4+
---<% } %>
5+
6+
# ns native add
7+
8+
### Description
9+
10+
Commands to add native files to the application placing them in the correct directory.
11+
12+
### Commands
13+
14+
Usage | Synopsis
15+
------|-------
16+
Swift | `$ ns native add swift <Swift class name>`
17+
Objective-C | `$ ns native add objective-c <Objective-C interface name>`
18+
Java | `$ ns native add java <Java class name>`
19+
Kotlin | `$ ns native add kotlin <Kotlin class name>`
20+
21+
<% if(isHtml) { %>
22+
23+
### Related Commands
24+
25+
Command | Description
26+
----------|----------
27+
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
28+
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
29+
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
30+
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
31+
<% } %>
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<% if (isJekyll) { %>---
2+
title: ns native
3+
position: 1
4+
---<% } %>
5+
6+
# ns native
7+
8+
### Description
9+
10+
Commands to add native files to the application placing them in the correct directory.
11+
12+
### Commands
13+
14+
Usage | Synopsis
15+
------|-------
16+
Swift | `$ ns native add swift <Swift class name>`
17+
Objective-C | `$ ns native add objective-c <Objective-C interface name>`
18+
Java | `$ ns native add java <Java class name>`
19+
Kotlin | `$ ns native add kotlin <Kotlin class name>`
20+
21+
<% if(isHtml) { %>
22+
23+
### Related Commands
24+
25+
Command | Description
26+
----------|----------
27+
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
28+
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
29+
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
30+
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
31+
<% } %>

lib/bootstrap.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,5 +458,14 @@ injector.require("keyCommandHelper", "./helpers/key-command-helper");
458458

459459
injector.requireCommand("start", "./commands/start");
460460
injector.require("startService", "./services/start-service");
461-
461+
injector.requireCommand(
462+
[
463+
"native|add",
464+
"native|add|java",
465+
"native|add|kotlin",
466+
"native|add|swift",
467+
"native|add|objective-c",
468+
],
469+
"./commands/native-add"
470+
);
462471
require("./key-commands/bootstrap");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy