Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: native add command to add native source files to the project #5806

Merged
merged 2 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions docs/man_pages/project/configuration/native/native-add-java.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<% if (isJekyll) { %>---
title: ns native add java
position: 2
---<% } %>

# ns native add java

### Description

Adds a newly generated Java file, which includes a class with the specified name, placing it in the appropriate directory.

### Commands

Usage | Synopsis
------|-------
Java | `$ ns native add java <Java class name>`

### Arguments

* `<Java class name>` is the fully qualified name of the `Class` to create, e.g. `org.nativescript.SomeClass`

<% if(isHtml) { %>

### Related Commands

Command | Description
----------|----------
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
<% } %>
34 changes: 34 additions & 0 deletions docs/man_pages/project/configuration/native/native-add-kotlin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<% if (isJekyll) { %>---
title: ns native add kotlin
position: 3
---<% } %>

# ns native add kotlin

### Description

Adds a newly generated Kotlin file, which includes a class with the specified name, placing it in the appropriate directory.

Kotlin usage requires that the `useKotlin` property is set in `gradle.properties`, the command will set this to `true`.

### Commands

Usage | Synopsis
------|-------
Kotlin | `$ ns native add kotlin <Kotlin class name>`

### Arguments

* `<Kotlin class name>` is the fully qualified name of the `Class` to create, e.g. `org.nativescript.SomeClass`

<% if(isHtml) { %>

### Related Commands

Command | Description
----------|----------
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
<% } %>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<% if (isJekyll) { %>---
title: ns native add objective-c
position: 4
---<% } %>

# ns native add objective-c

### Description

Adds newly generated Objective-C files, which include an interface with the specified name, placing them in the appropriate directory.

Objective-C usage requires that the `module.modulemap` is modified to include the header file, the command will set this entry.

### Commands

Usage | Synopsis
------|-------
Objective-C | `$ ns native add objective-c <Objective-C interface name>`

### Arguments

* `<Objective-C interface name>` is the name of the `interface` to create, e.g. `SomeInterface`

<% if(isHtml) { %>

### Related Commands

Command | Description
----------|----------
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
<% } %>
32 changes: 32 additions & 0 deletions docs/man_pages/project/configuration/native/native-add-swift.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<% if (isJekyll) { %>---
title: ns native add swift
position: 5
---<% } %>

# ns native add swift

### Description

Adds a newly generated Swift file, which includes a class with the specified name, placing it in the appropriate directory.

### Commands

Usage | Synopsis
------|-------
Swift | `$ ns native add swift <Swift class name>`

### Arguments

* `<Swift class name>` is the name of the `Class` to create, e.g. `SomeClass`

<% if(isHtml) { %>

### Related Commands

Command | Description
----------|----------
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
<% } %>
31 changes: 31 additions & 0 deletions docs/man_pages/project/configuration/native/native-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<% if (isJekyll) { %>---
title: ns native add
position: 1
---<% } %>

# ns native add

### Description

Commands to add native files to the application placing them in the correct directory.

### Commands

Usage | Synopsis
------|-------
Swift | `$ ns native add swift <Swift class name>`
Objective-C | `$ ns native add objective-c <Objective-C interface name>`
Java | `$ ns native add java <Java class name>`
Kotlin | `$ ns native add kotlin <Kotlin class name>`

<% if(isHtml) { %>

### Related Commands

Command | Description
----------|----------
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
<% } %>
31 changes: 31 additions & 0 deletions docs/man_pages/project/configuration/native/native.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<% if (isJekyll) { %>---
title: ns native
position: 1
---<% } %>

# ns native

### Description

Commands to add native files to the application placing them in the correct directory.

### Commands

Usage | Synopsis
------|-------
Swift | `$ ns native add swift <Swift class name>`
Objective-C | `$ ns native add objective-c <Objective-C interface name>`
Java | `$ ns native add java <Java class name>`
Kotlin | `$ ns native add kotlin <Kotlin class name>`

<% if(isHtml) { %>

### Related Commands

Command | Description
----------|----------
[native add swift](native-add-swift.html) | Generates and adds a Swift file containing a class of the given name.
[native add objective-c](native-add-objective-c.html) | Generates and adds Objective-C files containing an interface of the given name.
[native add java](native-add-java.html) | Generates and adds a Java file containing a class of the given name.
[native add kotlin](native-add-kotlin.html) | Generates and adds a Kotlin file containing a class of the given name.
<% } %>
11 changes: 10 additions & 1 deletion lib/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,5 +458,14 @@ injector.require("keyCommandHelper", "./helpers/key-command-helper");

injector.requireCommand("start", "./commands/start");
injector.require("startService", "./services/start-service");

injector.requireCommand(
[
"native|add",
"native|add|java",
"native|add|kotlin",
"native|add|swift",
"native|add|objective-c",
],
"./commands/native-add"
);
require("./key-commands/bootstrap");
Loading