콘텐츠로 이동

nsgo.yaml

모든 빌드가 읽는 프로젝트 파일: 대상, 빌드 플래그와 태그, 최소 시스템 버전, 아이콘, 실행 화면.

name: Hello
id: dev.example.hello # the bundle ID; without it, dev.nsgo. and the name's letters and digits
version: 0.1.0
build_number: 1 # CFBundleVersion and Android's versionCode; else from version
# copyright: © 2026 Example # the Windows executable's details and installer, and the macOS About panel
# appearance: dark # light or dark whatever the system's
# i18n: { dir: locales, source: en } # the app's catalogs and the language they are written in
icon:
apple: assets/AppIcon.icon # macOS, iOS and watchOS, or an .icns for macOS
windows: assets/IconWindows.png # optional Windows artwork
linux: assets/IconLinux.png # optional Linux artwork
png: assets/Icon.png # every other target
tvos: assets/AppIconTV.brandassets # the Apple TV's layered icon and top shelf art, or a wide PNG
watchos: assets/AppIconWatch.icon # the Apple Watch's own, drawn in circles, or a square PNG
android:
png: assets/IconAndroid.png # optional bitmap; valid without adaptive layers
foreground: assets/IconForeground.png # Android's adaptive icon: 432 px, the logo within the center 264 px
background: "#1F1F1F" # a color or a square PNG
monochrome: assets/IconMonochrome.png # optional: the shape Android 13's themed icons tint
dev:
target: native # native, web, ios, ios_simulator, tvos, tvos_simulator, watchos, watchos_simulator, android, harmonyos or miniprogram_<platform>
hot_reload: true # false builds once, watching no files
# icon: { png: assets/Icon-dev.png } # replaces icon's files in dev's builds; defaults to assets/*-dev.*
build:
output: dist
tags: [] # Go build tags every build, test and check of the app takes, such as timetzdata
ldflags: [] # the app's own linker flags, such as -X main.releaseDate=2026-11-17
open: false # true opens the output directory after building
installers: true # false leaves out the disk image, the Windows installer and the Linux packages
jobs: 0 # how many targets build at once; 0 is half the CPUs, 1 one after another
targets: [macos_arm64, macos_x64, windows_arm64, windows_x64, linux_arm64, linux_x64, ios, ios_simulator, tvos, tvos_simulator, watchos, watchos_simulator, android_arm64, web]
# apple: { sign_in_with_apple: true } # the Sign in with Apple entitlement, for iOS, tvOS and Mac App Store builds
# apple: { purchases: true } # StoreKit's library, which in-app purchases go through, in macOS, iOS and tvOS packages
# apple: { privacy: { accessed_apis: { NSPrivacyAccessedAPICategoryDiskSpace: [E174.1] }, tracking: false } } # add required-reason APIs and tracking declarations to PrivacyInfo.xcprivacy
# apple: { requires_full_screen: false } # let an iPad run the app in Split View, Slide Over and Stage Manager, in all four orientations
# apple: { orientations: [portrait, landscape_left] } # the orientations a full-screen app takes on an iPad
# apple: { multiple_scenes: true } # let an iPad open more than one window of the app, each showing the main view with its own state
# apple: { info: { UIBackgroundModes: [audio] } } # background playback for iOS Picture in Picture
# android: { permissions: [REQUEST_INSTALL_PACKAGES] } # manifest permissions beyond the runtime's
# android: { recording: true } # the microphone service microphone.RecordWAV records in, with RECORD_AUDIO, the foreground-service permissions and POST_NOTIFICATIONS, which RecordWAV asks for so its notification shows from Android 13; a refusal still records
# android: { uses_cleartext_traffic: true } # allow plain HTTP to any host in the APK and App Bundle
# android: { background_downloads: true } # dataSync foreground service for cx.Download
# android: { background_motion: true } # explicit finite motion shortService; streams also need a notification title
# android: { loopback_cleartext: true } # allow plain HTTP to loopback in the APK and App Bundle
# commands: [{ name: hello-cli, package: ./cmd/hello-cli }] # command-line programs the desktop packages ship beside the app: see Commands
# windows: { command_line: true } # add <name>.com, a console companion that forwards arguments and streams to <name>.exe; not in store builds
# windows: { path: true } # the installer puts the app's folder on the user's Path, so consoles find its commands
# windows: { publisher: Example Ltd } # the company the Windows executable's details, its installer and the uninstall entry name; else windows.store.publisher_name
# linux: { maintainer: "Jane Doe <jane@example.com>" } # the Linux packages' maintainer, else the app's name
# linux: { categories: [Office, Dictionary] } # the freedesktop menu categories of the app's desktop entry, at least one a main category such as Office, Utility or Game, else menus file it under Other; your own start with X-
# linux: { share: packaging/share } # files the .deb and Arch package install under /usr/share and the AppImage in its usr/share, such as metainfo/<id>.metainfo.xml or bash-completion/completions/<command>
# linux: { depends: { deb: [gstreamer1.0-plugins-good], arch: [gst-plugins-good] }, recommends: { deb: [gstreamer1.0-libav], arch: ["gst-libav: H.264 and AAC video"] } } # packages the .deb and Arch package also depend on and recommend, after GTK 4 and WebKitGTK 6, each as dpkg or pacman writes it
# release: { github: me/hello } # the GitHub repository the install scripts and updates install from, else the Git remote origin's; tag_prefix: v by default
# updates: { key: <public key> } # how the app updates, by platform and channel: see Updates
# store: { dir: store } # store listings directory (YAML and Markdown per language)
# miniprogram: { appid: { wechat: wx0123456789abcdef, alipay: "2021000000000000" }, custom_navigation: false } # the mini programs'

targets나 nsgo build -target, nsgo check -target에 아키텍처 없는 OS 이름만 쓰면 해당 OS의 아키텍처들을 뜻합니다(windows는 windows_arm64와 windows_x64, android는 x86_64 빌드에 NDK가 필요하므로 android_arm64만 포함). macos와 all에서 제외되는 macos_universal은 두 macOS 아키텍처를 모두 빌드해 라이브러리와 위젯까지 하나의 앱으로 합칩니다. Steam 채널은 유니버설 앱 번들을 사용하며, 인스톨러 빌드는 이를 하나의 디스크 이미지로 묶고 직접(direct) 채널에서는 하나의 Sparkle 피드를 생성합니다. nsgo test -target에도 테스트를 실행할 아키텍처 이름을 지정할 수 있습니다. 데스크톱 OS는 현재 머신의 아키텍처에서, Android는 arm64에서 실행되므로 x64 Windows 머신에서는 windows_x64로 windows 타겟을 실행할 수 있으며, 실행할 수 없는 아키텍처를 지정하면 올바른 이름과 함께 거부됩니다.

-target, -version, -output 같은 플래그는 지정한 필드의 값을 대체합니다. 전체 목록은 -h로 확인할 수 있습니다.

build.ldflags에는 -X main.releaseDate=2026-11-17이나 -X 'main.channel=beta builds'처럼 go build의 -ldflags 형식으로 앱 고유의 링커 플래그를 적습니다. 이는 모든 타겟에서 dev와 리로드, -embed를 포함한 build, -target을 포함한 test 등 앱을 링크하는 모든 빌드에 적용됩니다. build와 test의 -ldflags는 기존 설정을 덮어쓰지 않고 뒤에 추가되며 여러 번 반복할 수 있습니다. 사용자 플래그는 도구 자체의 -X 플래그보다 앞에 오고 링커는 변수당 마지막 값을 유지하므로 core.App의 이름, ID, 버전은 nsgo.yaml의 값으로 유지됩니다. 도구가 go에 자체 -ldflags를 전달할 때 GOFLAGS 안의 값은 대체되므로 링커 플래그는 여기에 적어야 합니다. 반면 디렉터리 뒤에 오는 헤드리스 test의 -ldflags는 go test의 플래그로서 전체를 대체합니다.

앱을 위해 실행되는 모든 go 명령(dev와 리로드, -embed 포함 build, -target 포함 test, check)은 모든 타겟에서 build.tags를 사용합니다. dev의 nsgodev나 타겟 테스트의 nsgotest 같은 NSGo 자체 태그와 GOFLAGS의 -tags 값은 대체되지 않고 여기에 합쳐지며, 나머지 GOFLAGS도 그대로 적용됩니다.

모든 빌드는 시작 시 --nsgo-fps 같은 NSGo 자체 플래그도 받습니다(실행 및 디버깅). nsgo dev에서는 열려 있는 모든 창에서 Command/Control+R로 리로드할 수 있으며, 다른 창에서 앱 함수가 계속 실행 중이라면 메인 뷰가 닫힌 뒤에도 동작합니다.

apple.info.LSMinimumSystemVersion은 macOS 패키지의 최소 지원 버전을 높이고, apple.info.MinimumOSVersion은 선택된 iOS, tvOS, watchOS 패키지의 최소 버전을 높입니다. "14.2"나 "18.0"처럼 1~3개의 숫자 부분으로 이루어진 따옴표로 감싼 버전 문자열을 쓰세요. 런타임 하한은 macOS 13.0(Go 1.27), iOS 15.0, tvOS 17.0, watchOS 26.0이며 이보다 낮거나 형식이 잘못된 값은 실패합니다. 모바일 키는 선택된 모든 모바일 타겟의 하한을 충족해야 합니다. App Clip은 별도의 app_clip.minimum을 사용합니다. 이 값들은 패키지 메타데이터, 애셋 컴파일, 서명 프로젝트, 앱 링커에 전달되며, 임베드된 iOS 프레임워크에도 적용됩니다(Mac Catalyst는 Go의 macOS 13 런타임을 위해 최소 16.0).

icon.windows와 icon.linux는 각 앱 패키지, 인스톨러 아트워크, 스토어 로고에 쓰일 정사각형 PNG를 지정합니다. 기본값은 assets/IconWindows.png와 assets/IconLinux.png이고, 없으면 icon.png로 폴백합니다. dev.icon도 동일한 설정과 -dev 기본 파일을 받습니다. icon.android.png는 어댑티브 레이어가 설정되지 않았을 때도 독립적으로 Android 비트맵을 선택합니다. 그 외의 타겟은 공용 icon.png 폴백을 유지합니다.

Apple TV 아이콘은 정사각형이 아니라 레이어가 있는 카드입니다. tvos는 Xcode의 .brandassets(App Icon 스택과 탑 셸프 이미지 포함) 또는 1280×768 같은 가로가 넓은 이미지를 받으며, 넓은 이미지를 주면 도구가 가장자리 색상 위에 카드에 맞춰 그리고 탑 셸프 이미지 가운데에 배치합니다. 둘 다 없으면 카드 높이의 4분의 3 크기로 PNG를 배치합니다. Apple Watch는 아이콘을 원형으로 마스킹하므로 watchos는 watchOS의 원형에 맞춰 그린 .icon이나 정사각형 PNG를 받으며, 없으면 apple 다음 png를 사용합니다. 두 설정 모두 apple, png와 마찬가지로 assets/AppIconTV.* 및 assets/AppIconWatch.*로 폴백합니다.

Android에서는 icon.android.foreground와 background가 어댑티브 런처 아이콘을 만드므로, 런처가 png를 자체 배경판 위에 축소하는 대신 원하는 모양으로 마스킹하고 움직일 수 있습니다. 각 레이어는 108 dp 정사각형(432 px로 스케일된 PNG)이며, 런처는 중앙 72 dp(288 px)를 보여 주고 중앙 66 dp(264 px) 바깥을 잘라내는 모양으로 마스킹할 수 있으므로, 로고는 그 원 안에 두고 배경은 정사각형 전체를 채우세요. background는 PNG 또는 "#1F1F1F" 같은 색상입니다. monochrome은 알파 채널만 사용하는 도형으로, Android 13 이상에서 사용자가 테마 아이콘을 켤 때 색조가 입혀지며, 없으면 기존 색상을 유지합니다. 패키지는 NSGo가 지원하는 가장 오래된 버전인 Android 9 이상에서 어떤 런처도 어댑티브 아이콘보다 우선 선택하지 않는 일반 비트맵 아이콘으로 icon.android.png(없으면 icon.png)를 함께 보관하며, png가 없으면 도구가 배경 위에 전경을 합성해 생성합니다. 어댑티브 레이어가 없으면 런처는 Android 비트맵이나 공용 png를 표시합니다.

iOS와 Android 12 이상에서 불투명 배경, 가운데 정렬된 PNG 또는 둘 다를 표시하려면 launch_screen을 설정하세요. 이미지 경로는 nsgo.yaml 기준 상대 경로입니다. 이미지는 128×128 포인트 또는 dp 안에 비율을 유지해 맞춰집니다. 가장 긴 변이 최소 512픽셀인 투명 PNG를 사용하면 고밀도 화면에서도 선명하게 보입니다.

launch_screen:
background: "#F5F1EA"
image: assets/Launch.png
dark:
background: "#201C26"
image: assets/LaunchDark.png

appearance로 고정하지 않는 한 시스템이 화면 모드를 선택합니다. dark 아래의 필드를 생략하면 대응하는 기본값을 재사용하고, 배경이나 이미지를 생략하면 플랫폼 기본값을 유지합니다. 임베드된 앱은 호스트로부터 실행 화면을 상속받습니다.

android.uses_cleartext_traffic: true는 APK와 App Bundle이 모든 호스트에 대해 평문 HTTP를 사용하도록 매니페스트 플래그와 네트워크 보안 정책을 설정합니다. 이 옵션을 켜지 않은 상태에서 android.loopback_cleartext: true를 설정하면 앱 자체가 서빙하는 비디오처럼 localhost, 127.0.0.1, ::1에 한해 평문 HTTP를 허용합니다. 루프백 전용 정책은 다른 호스트에 대한 평문 통신을 차단하며, 두 설정이 모두 true면 전체 호스트 허용이 우선합니다. 임베드되는 AAR의 경우에는 호스트 앱의 Android 네트워크 보안 정책을 구성하세요.

core.Native에서 커스텀 View를 사용하려면 앱의 nsgo.yaml에 미리 컴파일된 Android 클래스를 나열하세요.

android:
classes: [java/BadgeView.jar, java/Helpers.dex]

절대 경로가 아니면 nsgo.yaml 기준 상대 경로입니다. 각 경로는 .dex 파일이나 D8이 생성한 루트 classes.dex, classes2.dex 및 후속 샤드를 담은 JAR를 가리킵니다. 해당 파일들은 D8에서 --min-api 28 옵션으로 준비하세요. arm64에서는 NSGo가 Go만으로 이 사전 컴파일된 파일들로부터 APK나 App Bundle을 빌드합니다. Android 개발 세션은 나열된 파일이 변경되면 다시 빌드합니다. 임베드되는 AAR의 경우에는 호스트의 Android 빌드가 Java 의존성을 제공합니다. D8 문서

Android 네이티브 예제는 공개 Context 생성자를 가진 클래스를 등록하고 Go prop으로 설정하는 방법을 보여 줍니다.