Introduce minimal Android support (#8)
No files matched your search
@@ -1,160 +1,93 @@
|
|||||||
# OGS applications (`mj`)
|
# OGS applications (`mj`)
|
||||||
|
|
||||||
Native SwiftUI applications using the Dialect v4 declarative reactive engine.
|
Native SwiftUI apps on the Dialect v4 declarative reactive engine (v2.0.0).
|
||||||
Version: `2.0.0`. Remote: `https://git.opengamestudio.org/mahjong/mahjong`.
|
Remote: `https://git.opengamestudio.org/mahjong/mahjong`.
|
||||||
|
|
||||||
## Current status
|
## Status
|
||||||
|
|
||||||
- `ogs-blue/` is the active minimal graphics example for macOS and iOS: a solid
|
- `ogs-blue/` — active minimal example (macOS + iOS): solid blue raylib background
|
||||||
blue raylib background with a SwiftUI overlay. It has no model/texture/shadow
|
under a SwiftUI overlay; no model/texture/shadow scene.
|
||||||
scene; rlgl still creates its default internal GPU resources.
|
- `ogs-mahjong/` — macOS scaffold + counter template; no gameplay.
|
||||||
- `ogs-mahjong/` contains the macOS Mahjong scaffold and counter-template logic;
|
- `ogs-chkgfx/` — companion graphics scaffold; targets lag shared-component changes.
|
||||||
Mahjong gameplay has not been implemented.
|
- `game/ver-mac` and the root `dialect.yml` layout are obsolete.
|
||||||
- `ogs-chkgfx/` is a companion graphics scaffold with macOS/iOS project files.
|
|
||||||
Older targets can lag behind shared-component changes; verify each target
|
|
||||||
separately before claiming it builds.
|
|
||||||
- The previous `game/ver-mac` and root `dialect.yml` layout is obsolete.
|
|
||||||
|
|
||||||
## Source layout
|
## Layout
|
||||||
|
|
||||||
- `<app>/dialect.yml`: per-application logic; generates
|
- `<app>/dialect.yml` → `<app>/ver-mac/src/dialect.swift` (Blue iOS links to it).
|
||||||
`<app>/ver-mac/src/dialect.swift`. Blue iOS links to its macOS generated file.
|
- `components/` — shared source of truth; app `src/` entries are relative symlinks:
|
||||||
- `components/`: shared source of truth. App `src/` files use relative symlinks;
|
edit the real files and keep symlink parity.
|
||||||
edit real component files and preserve symlink parity.
|
- `components/render/` — shared model/constants + mirrored `ios/`/`mac/` effects,
|
||||||
- `components/render/`: shared component/model/constants, plus mirrored `ios/`
|
helpers, views (`renderConstMac.swift` = native pixel format).
|
||||||
and `mac/` effects, helpers and native/SwiftUI views. macOS additionally has
|
- Single-header C: `raybri/raybri.h` (`RAYBRI_IMPLEMENTATION`) + `raybriConst.h` +
|
||||||
`renderConstMac.swift` for native pixel-format attributes.
|
`mac/raybriAux.h`; `egl/egl.h` (`EGL_IMPLEMENTATION`) + `eglConst.h`;
|
||||||
- `components/raybri/raybri.h`: declarations plus implementation gated by
|
`ogs-blue/ver-{mac,ios}/src/Blue.c` are the platform translation units.
|
||||||
`RAYBRI_IMPLEMENTATION`; clears blue, renders and shuts down rlgl.
|
- `history/gitjs/` — historical JS reference, outside the build.
|
||||||
- `components/raybri/raybriConst.h`: shared constants with an implementation macro.
|
|
||||||
`components/raybri/mac/raybriAux.h`: macOS OpenGL symbol loader.
|
|
||||||
- `components/egl/egl.h` and `eglConst.h`: EGL state/helpers and configuration,
|
|
||||||
using single-header implementation macros.
|
|
||||||
- `ogs-blue/ver-{mac,ios}/src/Blue.c`: platform C implementation translation units.
|
|
||||||
- `history/gitjs/`: historical JavaScript Mahjong reference, outside the build.
|
|
||||||
`ref/swiftraylib` links to the sibling renderer sample.
|
|
||||||
|
|
||||||
## Graphics ownership and platform differences
|
## GL rules
|
||||||
|
|
||||||
Every GPU operation requires its context current on the calling thread.
|
Never call raylib / `raybri_*` without making the view's GL context current on the
|
||||||
`rlLoadExtensions` also requires an existing current context; it precedes
|
calling thread; `rlLoadExtensions` needs a current context and precedes `rlglInit`.
|
||||||
`rlglInit`, not native context creation.
|
|
||||||
|
|
||||||
macOS uses `NSOpenGLView` (OpenGL 3.2 Core). `renderInit` makes its context
|
macOS: `NSOpenGLView` (3.2 Core); `renderInit` makes it current, enables VSync, loads
|
||||||
current, enables VSync, loads extensions with the C loader callback and starts
|
extensions via the C loader, starts raylib. Timer → `needsDisplay`; `draw(_:)` →
|
||||||
raylib. The timer requests `needsDisplay`; `draw(_:)` forwards to `renderDraw`,
|
`renderDraw` activates the context, renders, `flushBuffer`s.
|
||||||
which activates the context, renders and presents via `flushBuffer`.
|
|
||||||
|
|
||||||
Blue's SPM `RaylibBridge` target compiles `src/Blue.c`, exposes headers in
|
iOS: `RenderGLView.st` owns an `EGLState`; effects create EGL/ANGLE state and surface,
|
||||||
`src/raybri`, and links Homebrew raylib. It does NOT define
|
make it current, init raylib. Timer renders directly, `eglSwapBuffers` presents.
|
||||||
`RLGL_IMPLEMENTATION`: Homebrew headers omit the `external/glad.h` needed to
|
Resize → `renderRecreateSurface` (macOS no-op). Teardown: stop timer → activate
|
||||||
compile desktop rlgl locally. Swift imports `RaylibBridge`. `RAYLIB_PREFIX`
|
context → release rlgl → destroy EGL surface/context/display.
|
||||||
defaults to `/opt/homebrew`; build scripts detect `brew --prefix raylib`.
|
|
||||||
The installed raylib may produce a deployment-target linker warning.
|
|
||||||
|
|
||||||
On iOS, UIKit owns the view/layer and `RenderGLView.st` owns an `EGLState`.
|
Blue iOS bridges via `src/BlueBridgingHeader.h`; `Blue.c` compiles EGL helpers and rlgl
|
||||||
Swift effects create EGL/ANGLE state and surface, make the context current,
|
with their implementation macros once, uses raylib-iOS XCFramework headers but not its
|
||||||
and initialize raylib. Timer ticks call rendering directly; presentation uses
|
library, links/embeds ANGLE `libEGL` + `libGLESv2`. XcodeGen sets `PLATFORM_IOS`,
|
||||||
`eglSwapBuffers`. Pixel sizes come from view bounds and content scale.
|
`GRAPHICS_API_OPENGL_ES3`, `GL_GLEXT_PROTOTYPES`; min iOS 15.0. SPM target
|
||||||
Dialect's resize event triggers `renderRecreateSurface`; the macOS helper is
|
`RaylibBridge` compiles `src/Blue.c`, exposes `src/raybri` headers, links Homebrew
|
||||||
intentionally a no-op. Teardown must stop the timer, activate the context,
|
raylib but NOT `RLGL_IMPLEMENTATION` (headers lack `external/glad.h`).
|
||||||
release rlgl resources, then destroy EGL surface/context/display resources.
|
|
||||||
|
|
||||||
Blue iOS uses `src/BlueBridgingHeader.h` to expose C APIs to Swift. `Blue.c`
|
## Build
|
||||||
compiles EGL helpers and rlgl using their implementation macros exactly once.
|
|
||||||
It uses the raylib-iOS XCFramework headers but does not link its full raylib
|
|
||||||
library. The app links/embeds `libEGL` and `libGLESv2` (ANGLE's Metal backend).
|
|
||||||
The XcodeGen settings define `PLATFORM_IOS`, `GRAPHICS_API_OPENGL_ES3`, and
|
|
||||||
`GL_GLEXT_PROTOTYPES`. Minimum iOS is 15.0; portrait and both landscape
|
|
||||||
orientations are enabled in Blue's Info.plist.
|
|
||||||
|
|
||||||
## Build and prerequisites
|
Prereqs: `brew install raylib xcodegen`; siblings `../dialect` (`util/build-generator`)
|
||||||
|
and `../raylib-ios-xcframeworks` (raylib + libEGL/libGLESv2; presence checked only).
|
||||||
- macOS: `brew install raylib`.
|
|
||||||
- iOS project generation: `brew install xcodegen`; supply sibling
|
|
||||||
`../raylib-ios-xcframeworks` containing raylib/libEGL/libGLESv2 XCFrameworks.
|
|
||||||
`checkRaylibIOS` checks presence; it does not download them.
|
|
||||||
- Dialect: sibling `../dialect`, built with `(cd ../dialect && util/build-generator)`.
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
util/build-ogs-blue-mac
|
util/build-ogs-blue-mac
|
||||||
util/run-ogs-blue-mac
|
util/run-ogs-blue-mac
|
||||||
util/prepare-ogs-blue-ios
|
util/prepare-ogs-blue-ios
|
||||||
```
|
|
||||||
|
|
||||||
The corresponding macOS build/run scripts also exist for `ogs-chkgfx` and
|
|
||||||
`ogs-mahjong`; `prepare-ogs-chkgfx-ios` exists as well. Inspect their individual
|
|
||||||
configuration before assuming parity with Blue.
|
|
||||||
|
|
||||||
macOS build scripts generate Dialect, run `swift build`, and package resources
|
|
||||||
from `ver-mac/res/` into `ver-mac/.build/<App Name>.app`. iOS preparation checks
|
|
||||||
XCFrameworks, generates Dialect, stages ANGLE include/library symlinks in
|
|
||||||
`ver-ios/.build/`, then runs XcodeGen. Build Blue for Simulator with:
|
|
||||||
|
|
||||||
```sh
|
|
||||||
xcodebuild -project 'ogs-blue/ver-ios/OGS blue.xcodeproj' -scheme ogs-blue \
|
xcodebuild -project 'ogs-blue/ver-ios/OGS blue.xcodeproj' -scheme ogs-blue \
|
||||||
-sdk iphonesimulator -destination 'generic/platform=iOS Simulator' \
|
-sdk iphonesimulator -destination 'generic/platform=iOS Simulator' \
|
||||||
CODE_SIGNING_ALLOWED=NO build
|
CODE_SIGNING_ALLOWED=NO build
|
||||||
```
|
```
|
||||||
|
|
||||||
Audit dangling source symlinks after moves (SPM can silently skip them):
|
macOS scripts regenerate Dialect, `swift build`, then package `ver-mac/res/` into
|
||||||
|
`ver-mac/.build/<App Name>.app`. iOS also checks XCFrameworks, stages ANGLE symlinks in
|
||||||
|
`ver-ios/.build/`, then runs XcodeGen (same scripts for `ogs-chkgfx`/`ogs-mahjong`).
|
||||||
|
Dangling-symlink audit:
|
||||||
|
`find components ogs-blue ogs-chkgfx ogs-mahjong -type l ! -exec test -e {} \; -not -path '*/.build/*'`
|
||||||
|
|
||||||
```sh
|
## Dialect
|
||||||
find components ogs-blue ogs-chkgfx ogs-mahjong -type l ! -exec test -e {} \; -not -path '*/.build/*'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Editing the dialect
|
- Edit `<app>/dialect.yml` / `components/`, then `util/build-<app>-mac`; manual edits to
|
||||||
|
the generated `dialect.swift` are overwritten.
|
||||||
- Add/modify contexts and components in `<app>/dialect.yml`, then run
|
- `struct F` (field names) exists only in `dialect.swift`: a new field needs
|
||||||
`util/build-<app>-mac` to regenerate `dialect.swift`.
|
`static let <field> = "<field>"` hand-patched in ASCII order or `F.<field>` won't build.
|
||||||
- **Chicken-egg**: `struct F` (field-name constants) lives only in the
|
- Validate: `ruby -ryaml -e 'YAML.load_file("ogs-blue/dialect.yml")'`. Every should-label
|
||||||
generated `dialect.swift`. Adding a new field to a context in `<app>/dialect.yml`
|
(`1. Upon each ...`) MUST end with a colon — `components/yml/ymlFun.swift` blindly
|
||||||
requires hand-patching its `static let <field> = "<field>"` into `struct F`
|
`dropLast()`s it. Complaints inside `if:`/`then:` (unquoted `: `) are expected.
|
||||||
in `dialect.swift` (ASCII-alphabetical order) if you cannot regenerate first,
|
|
||||||
otherwise the build fails on `F.<field>` being unresolved.
|
|
||||||
- `dialect.swift` is generated — edits there are overwritten on the next
|
|
||||||
`util/build-<app>-mac`. Change the source (`<app>/dialect.yml` / `components/`) instead.
|
|
||||||
- **Validate `<app>/dialect.yml` after edits** (e.g. `ruby -ryaml -e 'YAML.load_file("ogs-blue/dialect.yml")'`).
|
|
||||||
Every should-branch label (`1. Upon each ...`) MUST end with a colon — the
|
|
||||||
parser (`components/yml/ymlFun.swift`) blindly `dropLast()`s it, so a missing
|
|
||||||
colon silently eats the label's last character in the generated `about`
|
|
||||||
comment. Note the file can never pass a *strict* YAML parser: condition and
|
|
||||||
reaction lines (under `if:` / `then:`) contain unquoted `: ` (e.g.
|
|
||||||
`c.countText = "Count: '\(c.count)'"`), which standard YAML rejects. So treat
|
|
||||||
a parser complaint pointing *inside* an `if:`/`then:` block as expected; any
|
|
||||||
complaint elsewhere (like a missing branch-label colon) is a real bug.
|
|
||||||
|
|
||||||
## Swift 6
|
|
||||||
|
|
||||||
The project currently builds in Swift 5 language mode
|
|
||||||
(`util/step/buildMac` has the Swift 6 flag commented out). Enabling
|
|
||||||
`-Xswiftc -swift-version -Xswiftc 6` fails today on the singleton/`@MainActor`
|
|
||||||
concurrency errors (`RootComponent.singleton`, `RootVM.shared` in
|
|
||||||
`components/root/`, `RenderComponent.singleton`, `RenderVM.shared` in
|
|
||||||
`components/render/`, and the `RootVM.shared!.countText = ...` /
|
|
||||||
`RenderVM.shared!.pixelSize = ...` oneliners in the generated `dialect.swift`).
|
|
||||||
Do not flip it on without addressing those.
|
|
||||||
|
|
||||||
## Conventions
|
## Conventions
|
||||||
|
|
||||||
- `game/ver-mac/.build/`, `build/`, `.DS_Store`, Xcode/Gradle artifacts are
|
- Mirror Swift/iOS into Android (naming, text, layout, styling); `OGS blue`, not `OGS Blue`.
|
||||||
git-ignored.
|
- Compose: named `MaterialTheme.typography` styles over `fontSize`; Blue's title is
|
||||||
- Prefer editing files in `components/` (the real files); the `src/` entries are
|
`headlineLarge` (SwiftUI `.largeTitle`).
|
||||||
symlinks.
|
- Kotlin: wildcard imports for multiple declarations from one package, including
|
||||||
- The generated UI callback plumbing is nonisolated; UI singletons are weak
|
generated ones; subpackages need separate imports.
|
||||||
(`RootComponent.singleton`, `RootVM.shared`, `RenderComponent.singleton`,
|
- `.build/`, `build/`, `.DS_Store`, Xcode/Gradle artifacts are git-ignored.
|
||||||
`RenderVM.shared`) and are accessed from the generated oneliners with
|
|
||||||
force-unwrap (`RootVM.shared!.countText = ...`, `RenderVM.shared!.pixelSize = ...`).
|
|
||||||
- Never call raylib / `raybri_*` without making the view's GL context current first
|
|
||||||
(see the GL context rule above).
|
|
||||||
|
|
||||||
## Source study documents
|
## Source studies
|
||||||
|
|
||||||
- Single-file source studies: follow [docs/file-summary.md](docs/file-summary.md).
|
Follow [docs/file-summary.md](docs/file-summary.md) (single-file) and
|
||||||
- Mirrored platform studies: follow [docs/mirror-summary.md](docs/mirror-summary.md).
|
[docs/mirror-summary.md](docs/mirror-summary.md) (mirrored platforms: one
|
||||||
Produce one self-contained downloadable HTML with aligned function starts,
|
self-contained HTML with aligned function starts, original line numbers, green/orange
|
||||||
original line numbers, green/orange number fills, counts/percentages and a
|
fills, counts, non-repetitive explanations). Example:
|
||||||
non-repetitive explanation column.
|
`docs/render-platform-comparison.html`; never substitute working-tree code for a
|
||||||
- Existing mirrored example: `docs/render-platform-comparison.html`, documenting
|
requested historical revision.
|
||||||
the revision named in its header. Never silently substitute working-tree code
|
|
||||||
for a requested historical revision.
|
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
|
## Targets
|
||||||
|
|
||||||
|
| № | Target | macOS | iOS/iPadOS | Android |
|
||||||
|
| 1 | ogs-blue | √ | √ | ? |
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
object BlueComponent {
|
||||||
|
val ctrl = DialectController(BlueContext())
|
||||||
|
|
||||||
|
init {
|
||||||
|
blueRegisterEffects(ctrl)
|
||||||
|
blueRegisterShoulds(ctrl)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setup() {
|
||||||
|
blueSet(F.didSetup, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.*
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.unit.dp
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun BlueView() {
|
||||||
|
Column(
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
|
modifier = Modifier.padding(40.dp)
|
||||||
|
) {
|
||||||
|
Box(contentAlignment = Alignment.Center) {
|
||||||
|
Text(
|
||||||
|
text = "Blue",
|
||||||
|
style = MaterialTheme.typography.headlineLarge,
|
||||||
|
color = Color.White,
|
||||||
|
modifier = Modifier.offset(x = 1.dp, y = 1.dp)
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
text = "Blue",
|
||||||
|
style = MaterialTheme.typography.headlineLarge,
|
||||||
|
color = Color.Black
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
fun otherPrintStderr(txt: String) {
|
||||||
|
System.err.println(txt)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun otherSetupConsoleLogging(
|
||||||
|
ctrl: DialectController,
|
||||||
|
prefix: String
|
||||||
|
) {
|
||||||
|
ctrl.registerCallback { c ->
|
||||||
|
val value = c.fieldAny(c.recentField)
|
||||||
|
val line = "ИГР $prefix k/v: '${c.recentField}'/'$value'"
|
||||||
|
otherPrintStderr(line)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.*
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application)
|
||||||
|
alias(libs.plugins.kotlin.android)
|
||||||
|
alias(libs.plugins.kotlin.compose)
|
||||||
|
}
|
||||||
|
|
||||||
|
android {
|
||||||
|
namespace = "org.opengamestudio"
|
||||||
|
compileSdk = 35
|
||||||
|
|
||||||
|
buildFeatures {
|
||||||
|
compose = true
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
defaultConfig {
|
||||||
|
applicationId = "org.opengamestudio.blue"
|
||||||
|
minSdk = 23
|
||||||
|
targetSdk = 35
|
||||||
|
versionCode = 1
|
||||||
|
versionName = "0.0.1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation(libs.androidx.core.ktx)
|
||||||
|
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||||
|
implementation(libs.androidx.activity.compose)
|
||||||
|
implementation(platform(libs.androidx.compose.bom))
|
||||||
|
implementation(libs.androidx.ui)
|
||||||
|
implementation(libs.androidx.ui.graphics)
|
||||||
|
implementation(libs.androidx.ui.tooling.preview)
|
||||||
|
implementation(libs.androidx.material3)
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
jvmTarget = JVM_1_8
|
||||||
|
}
|
||||||
|
sourceSets {
|
||||||
|
val main by getting {
|
||||||
|
dependencies {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||||
|
android:fullBackupContent="@xml/backup_rules"
|
||||||
|
android:icon="@mipmap/ic_launcher"
|
||||||
|
android:label="OGS blue"
|
||||||
|
android:roundIcon="@mipmap/ic_launcher_round"
|
||||||
|
android:supportsRtl="true"
|
||||||
|
android:theme="@style/Theme.MyApplication"
|
||||||
|
tools:targetApi="35">
|
||||||
|
<activity
|
||||||
|
android:name=".MainActivity"
|
||||||
|
android:exported="true"
|
||||||
|
android:label="OGS blue"
|
||||||
|
android:theme="@style/Theme.MyApplication"
|
||||||
|
>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
object ActivityDelegate {
|
||||||
|
val blue = BlueComponent
|
||||||
|
|
||||||
|
init {
|
||||||
|
otherSetupConsoleLogging(blue.ctrl, "Blue")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setup() {
|
||||||
|
blue.setup()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
import android.graphics.Color
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.activity.*
|
||||||
|
import androidx.activity.compose.setContent
|
||||||
|
import androidx.compose.foundation.background
|
||||||
|
import androidx.compose.foundation.layout.*
|
||||||
|
import androidx.compose.ui.*
|
||||||
|
import androidx.compose.ui.graphics.Color as ComposeColor
|
||||||
|
import org.opengamestudio.ui.theme.MyApplicationTheme
|
||||||
|
|
||||||
|
class MainActivity: ComponentActivity() {
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
ActivityDelegate.setup()
|
||||||
|
|
||||||
|
enableEdgeToEdge(
|
||||||
|
navigationBarStyle = SystemBarStyle.dark(Color.TRANSPARENT),
|
||||||
|
statusBarStyle = SystemBarStyle.dark(Color.TRANSPARENT)
|
||||||
|
)
|
||||||
|
setContent {
|
||||||
|
MyApplicationTheme {
|
||||||
|
Box(
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.background(ComposeColor.White)
|
||||||
|
) {
|
||||||
|
BlueView()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../../../../../components/blue/android/blue.kt
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../../../../../../components/blue/android/view/BlueView.kt
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
package org.opengamestudio
|
||||||
|
|
||||||
|
|
||||||
|
val DIALECT_CONTEXT_RECENT_FIELD_NONE = "none"
|
||||||
|
|
||||||
|
interface DialectContext {
|
||||||
|
/**
|
||||||
|
* Name of the field that has just been changed
|
||||||
|
*
|
||||||
|
* Allows should-functions (reducers) to react only to
|
||||||
|
* relevant changes and ignore other changes of DialectContext
|
||||||
|
*/
|
||||||
|
var recentField: String
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get field's value by its name
|
||||||
|
*/
|
||||||
|
fun <T> field(name: String): T
|
||||||
|
/**
|
||||||
|
* Erase type
|
||||||
|
*
|
||||||
|
* Used by DialectController to assign recent field's value
|
||||||
|
*/
|
||||||
|
fun fieldAny(name: String): Any {
|
||||||
|
return field(name)
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Create a copy of the DialectContext derivative
|
||||||
|
*
|
||||||
|
* Used by DialectController to treat all derived contexts as DialectContext
|
||||||
|
*/
|
||||||
|
fun selfCopy(): DialectContext
|
||||||
|
/**
|
||||||
|
* Set field's value by its name
|
||||||
|
*/
|
||||||
|
fun setField(name: String, value: Any?)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class DialectController(
|
||||||
|
var context: DialectContext
|
||||||
|
) {
|
||||||
|
internal var callbacks = mutableListOf<(c: DialectContext) -> Unit>()
|
||||||
|
internal var functions = mutableListOf<(c: DialectContext) -> DialectContext>()
|
||||||
|
var isProcessingQueue = false
|
||||||
|
internal var queue = mutableListOf<DialectContext>()
|
||||||
|
|
||||||
|
fun executeFunctions() {
|
||||||
|
val c = queue.removeAt(0)
|
||||||
|
// Keep SSOT: Only allow single field change per should-function
|
||||||
|
context.recentField = c.recentField
|
||||||
|
context.setField(c.recentField, c.fieldAny(c.recentField))
|
||||||
|
|
||||||
|
for (f in functions) {
|
||||||
|
val ctx = f(context.selfCopy())
|
||||||
|
if (ctx.recentField != DIALECT_CONTEXT_RECENT_FIELD_NONE) {
|
||||||
|
queue.add(ctx)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
reportContext()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun processQueue() {
|
||||||
|
// Prevent recursion.
|
||||||
|
if (isProcessingQueue) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isProcessingQueue = true
|
||||||
|
|
||||||
|
while (queue.size > 0) {
|
||||||
|
executeFunctions()
|
||||||
|
}
|
||||||
|
|
||||||
|
isProcessingQueue = false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun registerCallback(cb: (c: DialectContext) -> Unit) {
|
||||||
|
callbacks.add(cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun registerFieldCallback(
|
||||||
|
fieldName: String,
|
||||||
|
cb: (DialectContext) -> Unit
|
||||||
|
) {
|
||||||
|
callbacks.add({ c ->
|
||||||
|
if (c.recentField == fieldName) {
|
||||||
|
cb(c)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun registerFunction(f: (DialectContext) -> DialectContext) {
|
||||||
|
functions.add(f)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun reportContext() {
|
||||||
|
for (cb in callbacks) {
|
||||||
|
cb(context)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun set(fieldName: String, value: Any) {
|
||||||
|
var c = context.selfCopy()
|
||||||
|
c.setField(fieldName, value)
|
||||||
|
c.recentField = fieldName
|
||||||
|
queue.add(c)
|
||||||
|
processQueue()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Register several oneliner callbacks to a controller
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
fun registerOneliners(
|
||||||
|
ctrl: DialectController,
|
||||||
|
items: Array<Any>
|
||||||
|
) {
|
||||||
|
val halfCount = items.size / 2
|
||||||
|
for (i in 0..<halfCount) {
|
||||||
|
val field = items[i * 2] as String
|
||||||
|
val callback = items[i * 2 + 1] as (c: DialectContext) -> Unit
|
||||||
|
ctrl.registerFieldCallback(field, callback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Context field names for static type check
|
||||||
|
object F {
|
||||||
|
const val didLaunch = "didLaunch"
|
||||||
|
const val didSetup = "didSetup"
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
data class BlueContext(
|
||||||
|
var didLaunch: Boolean = false,
|
||||||
|
var didSetup: Boolean = false,
|
||||||
|
|
||||||
|
override var recentField: String = ""
|
||||||
|
) : DialectContext {
|
||||||
|
override fun <T> field(name: String): T {
|
||||||
|
if (name == "didLaunch") {
|
||||||
|
return didLaunch as T
|
||||||
|
}
|
||||||
|
else if (name == "didSetup") {
|
||||||
|
return didSetup as T
|
||||||
|
}
|
||||||
|
|
||||||
|
return "" as T
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun selfCopy(): DialectContext {
|
||||||
|
return this.copy()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setField(
|
||||||
|
name: String,
|
||||||
|
value: Any?
|
||||||
|
) {
|
||||||
|
if (name == "didLaunch") {
|
||||||
|
didLaunch = value as Boolean
|
||||||
|
}
|
||||||
|
else if (name == "didSetup") {
|
||||||
|
didSetup = value as Boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun blueSet(
|
||||||
|
key: String,
|
||||||
|
value: Any
|
||||||
|
) {
|
||||||
|
BlueComponent.ctrl.set(key, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun blueShouldResetDidLaunch(c: BlueContext): BlueContext {
|
||||||
|
val c = c
|
||||||
|
|
||||||
|
// 1. Only once during the first setup
|
||||||
|
if (
|
||||||
|
c.recentField == F.didSetup &&
|
||||||
|
c.didLaunch == false
|
||||||
|
) {
|
||||||
|
c.didLaunch = true
|
||||||
|
c.recentField = F.didLaunch
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
c.recentField = DIALECT_CONTEXT_RECENT_FIELD_NONE
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
fun blueRegisterShoulds(ctrl: DialectController) {
|
||||||
|
listOf(
|
||||||
|
::blueShouldResetDidLaunch,
|
||||||
|
|
||||||
|
).forEach { f ->
|
||||||
|
ctrl.registerFunction { c -> f(c as BlueContext) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun blueRegisterEffects(ctrl: DialectController) {
|
||||||
|
registerOneliners(ctrl, arrayOf(
|
||||||
|
F.didLaunch, { c: BlueContext -> print("Blue launched") },
|
||||||
|
|
||||||
|
))
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
../../../../../../../../../components/other/other.kt
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package org.opengamestudio.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
val Purple80 = Color(0xFFD0BCFF)
|
||||||
|
val PurpleGrey80 = Color(0xFFCCC2DC)
|
||||||
|
val Pink80 = Color(0xFFEFB8C8)
|
||||||
|
|
||||||
|
val Purple40 = Color(0xFF6650a4)
|
||||||
|
val PurpleGrey40 = Color(0xFF625b71)
|
||||||
|
val Pink40 = Color(0xFF7D5260)
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package org.opengamestudio.ui.theme
|
||||||
|
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.compose.material3.*
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.platform.LocalContext
|
||||||
|
|
||||||
|
private val DarkColorScheme = darkColorScheme(
|
||||||
|
primary = Purple80,
|
||||||
|
secondary = PurpleGrey80,
|
||||||
|
tertiary = Pink80
|
||||||
|
)
|
||||||
|
|
||||||
|
private val LightColorScheme = lightColorScheme(
|
||||||
|
primary = Purple40,
|
||||||
|
secondary = PurpleGrey40,
|
||||||
|
tertiary = Pink40
|
||||||
|
)
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun MyApplicationTheme(
|
||||||
|
darkTheme: Boolean = false,
|
||||||
|
dynamicColor: Boolean = false,
|
||||||
|
content: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
val colorScheme = when {
|
||||||
|
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ->
|
||||||
|
if (darkTheme) dynamicDarkColorScheme(LocalContext.current)
|
||||||
|
else dynamicLightColorScheme(LocalContext.current)
|
||||||
|
darkTheme -> DarkColorScheme
|
||||||
|
else -> LightColorScheme
|
||||||
|
}
|
||||||
|
|
||||||
|
MaterialTheme(
|
||||||
|
colorScheme = colorScheme,
|
||||||
|
typography = Typography,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package org.opengamestudio.ui.theme
|
||||||
|
|
||||||
|
import androidx.compose.material3.Typography
|
||||||
|
import androidx.compose.ui.text.TextStyle
|
||||||
|
import androidx.compose.ui.text.font.*
|
||||||
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
|
val Typography = Typography(
|
||||||
|
bodyLarge = TextStyle(
|
||||||
|
fontFamily = FontFamily.Default,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
fontSize = 16.sp,
|
||||||
|
lineHeight = 24.sp,
|
||||||
|
letterSpacing = 0.5.sp
|
||||||
|
)
|
||||||
|
)
|
||||||
|
After Width: | Height: | Size: 63 KiB |
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_artwork" />
|
||||||
|
<foreground android:drawable="@android:color/transparent" />
|
||||||
|
</adaptive-icon>
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<background android:drawable="@drawable/ic_launcher_artwork" />
|
||||||
|
<foreground android:drawable="@android:color/transparent" />
|
||||||
|
</adaptive-icon>
|
||||||
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">OGS blue</string>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<style name="Theme.MyApplication" parent="android:Theme.Material.NoActionBar">
|
||||||
|
<item name="android:windowBackground">#000000</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<full-backup-content>
|
||||||
|
</full-backup-content>
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<data-extraction-rules>
|
||||||
|
<cloud-backup>
|
||||||
|
<exclude domain="root" />
|
||||||
|
</cloud-backup>
|
||||||
|
<device-transfer>
|
||||||
|
<exclude domain="root" />
|
||||||
|
</device-transfer>
|
||||||
|
</data-extraction-rules>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
plugins {
|
||||||
|
alias(libs.plugins.android.application) apply false
|
||||||
|
alias(libs.plugins.android.library) apply false
|
||||||
|
alias(libs.plugins.kotlin.android) apply false
|
||||||
|
alias(libs.plugins.kotlin.compose) apply false
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
version: 4
|
||||||
|
|
||||||
|
output:
|
||||||
|
.build/dialect.swift:
|
||||||
|
type: swift
|
||||||
|
app/src/main/kotlin/org/opengamestudio/dialect.kt:
|
||||||
|
type: kotlin
|
||||||
|
|
||||||
|
BlueContext:
|
||||||
|
type: context
|
||||||
|
fields:
|
||||||
|
didLaunch: Bool
|
||||||
|
didSetup: Bool
|
||||||
|
|
||||||
|
BlueComponent:
|
||||||
|
type: component
|
||||||
|
oneliners:
|
||||||
|
- didLaunch: print("Blue launched")
|
||||||
|
shoulds:
|
||||||
|
didLaunch:
|
||||||
|
1. Only once during the first setup:
|
||||||
|
if:
|
||||||
|
c.recentField == F.didSetup &&
|
||||||
|
c.didLaunch == false
|
||||||
|
then:
|
||||||
|
c.didLaunch = true
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Use Compose for Android
|
||||||
|
android.useAndroidX=true
|
||||||
|
# Verbose build log
|
||||||
|
org.gradle.console=verbose
|
||||||
|
# Cache artifacts
|
||||||
|
org.gradle.caching=true
|
||||||
|
# JVM heap for Gradle and daemon
|
||||||
|
org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=1g
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
[versions]
|
||||||
|
activityCompose = "1.9.3"
|
||||||
|
agp = "8.7.3"
|
||||||
|
composeBom = "2024.12.01"
|
||||||
|
coreKtx = "1.15.0"
|
||||||
|
kotlin = "2.1.0"
|
||||||
|
lifecycleRuntimeKtx = "2.8.7"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activityCompose" }
|
||||||
|
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "composeBom" }
|
||||||
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
|
||||||
|
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
|
||||||
|
androidx-material3 = { group = "androidx.compose.material3", name = "material3" }
|
||||||
|
androidx-ui = { group = "androidx.compose.ui", name = "ui" }
|
||||||
|
androidx-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
|
||||||
|
androidx-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
||||||
|
androidx-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
android-application = { id = "com.android.application", version.ref = "agp" }
|
||||||
|
android-library = { id = "com.android.library", version.ref = "agp" }
|
||||||
|
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||||
|
kotlin-compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,251 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
#
|
||||||
|
# Copyright © 2015-2021 the original authors.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Gradle start up script for POSIX generated by Gradle.
|
||||||
|
#
|
||||||
|
# Important for running:
|
||||||
|
#
|
||||||
|
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||||
|
# noncompliant, but you have some other compliant shell such as ksh or
|
||||||
|
# bash, then to run this script, type that shell name before the whole
|
||||||
|
# command line, like:
|
||||||
|
#
|
||||||
|
# ksh Gradle
|
||||||
|
#
|
||||||
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
|
# requires all of these POSIX shell features:
|
||||||
|
# * functions;
|
||||||
|
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||||
|
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||||
|
# * compound commands having a testable exit status, especially «case»;
|
||||||
|
# * various built-in commands including «command», «set», and «ulimit».
|
||||||
|
#
|
||||||
|
# Important for patching:
|
||||||
|
#
|
||||||
|
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||||
|
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||||
|
#
|
||||||
|
# The "traditional" practice of packing multiple parameters into a
|
||||||
|
# space-separated string is a well documented source of bugs and security
|
||||||
|
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||||
|
# options in "$@", and eventually passing that to Java.
|
||||||
|
#
|
||||||
|
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||||
|
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||||
|
# see the in-line comments for details.
|
||||||
|
#
|
||||||
|
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||||
|
# Darwin, MinGW, and NonStop.
|
||||||
|
#
|
||||||
|
# (3) This script is generated from the Groovy template
|
||||||
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
|
# within the Gradle project.
|
||||||
|
#
|
||||||
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# Attempt to set APP_HOME
|
||||||
|
|
||||||
|
# Resolve links: $0 may be a link
|
||||||
|
app_path=$0
|
||||||
|
|
||||||
|
# Need this for daisy-chained symlinks.
|
||||||
|
while
|
||||||
|
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||||
|
[ -h "$app_path" ]
|
||||||
|
do
|
||||||
|
ls=$( ls -ld "$app_path" )
|
||||||
|
link=${ls#*' -> '}
|
||||||
|
case $link in #(
|
||||||
|
/*) app_path=$link ;; #(
|
||||||
|
*) app_path=$APP_HOME$link ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
|
MAX_FD=maximum
|
||||||
|
|
||||||
|
warn () {
|
||||||
|
echo "$*"
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
die () {
|
||||||
|
echo
|
||||||
|
echo "$*"
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
} >&2
|
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false').
|
||||||
|
cygwin=false
|
||||||
|
msys=false
|
||||||
|
darwin=false
|
||||||
|
nonstop=false
|
||||||
|
case "$( uname )" in #(
|
||||||
|
CYGWIN* ) cygwin=true ;; #(
|
||||||
|
Darwin* ) darwin=true ;; #(
|
||||||
|
MSYS* | MINGW* ) msys=true ;; #(
|
||||||
|
NONSTOP* ) nonstop=true ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||||
|
else
|
||||||
|
JAVACMD=$JAVA_HOME/bin/java
|
||||||
|
fi
|
||||||
|
if [ ! -x "$JAVACMD" ] ; then
|
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
JAVACMD=java
|
||||||
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
location of your Java installation."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can.
|
||||||
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
|
case $MAX_FD in #(
|
||||||
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
|
warn "Could not query maximum file descriptor limit"
|
||||||
|
esac
|
||||||
|
case $MAX_FD in #(
|
||||||
|
'' | soft) :;; #(
|
||||||
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
|
ulimit -n "$MAX_FD" ||
|
||||||
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command, stacking in reverse order:
|
||||||
|
# * args from the command line
|
||||||
|
# * the main class name
|
||||||
|
# * -classpath
|
||||||
|
# * -D...appname settings
|
||||||
|
# * --module-path (only if needed)
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||||
|
|
||||||
|
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||||
|
if "$cygwin" || "$msys" ; then
|
||||||
|
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||||
|
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||||
|
|
||||||
|
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||||
|
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
for arg do
|
||||||
|
if
|
||||||
|
case $arg in #(
|
||||||
|
-*) false ;; # don't mess with options #(
|
||||||
|
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||||
|
[ -e "$t" ] ;; #(
|
||||||
|
*) false ;;
|
||||||
|
esac
|
||||||
|
then
|
||||||
|
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||||
|
fi
|
||||||
|
# Roll the args list around exactly as many times as the number of
|
||||||
|
# args, so each arg winds up back in the position where it started, but
|
||||||
|
# possibly modified.
|
||||||
|
#
|
||||||
|
# NB: a `for` loop captures its iteration list before it begins, so
|
||||||
|
# changing the positional parameters here affects neither the number of
|
||||||
|
# iterations, nor the values presented in `arg`.
|
||||||
|
shift # remove old arg
|
||||||
|
set -- "$@" "$arg" # push replacement arg
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
|
set -- \
|
||||||
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
-classpath "$CLASSPATH" \
|
||||||
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Use "xargs" to parse quoted args.
|
||||||
|
#
|
||||||
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
#
|
||||||
|
# In Bash we could simply go:
|
||||||
|
#
|
||||||
|
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||||
|
# set -- "${ARGS[@]}" "$@"
|
||||||
|
#
|
||||||
|
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||||
|
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||||
|
# character that might be a shell metacharacter, then use eval to reverse
|
||||||
|
# that process (while maintaining the separation between arguments), and wrap
|
||||||
|
# the whole thing up as a single "set" statement.
|
||||||
|
#
|
||||||
|
# This will of course break if any of these variables contains a newline or
|
||||||
|
# an unmatched quote.
|
||||||
|
#
|
||||||
|
|
||||||
|
eval "set -- $(
|
||||||
|
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||||
|
xargs -n1 |
|
||||||
|
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||||
|
tr '\n' ' '
|
||||||
|
)" '"$@"'
|
||||||
|
|
||||||
|
exec "$JAVACMD" "$@"
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
google {
|
||||||
|
content {
|
||||||
|
includeGroupByRegex("com\\.android.*")
|
||||||
|
includeGroupByRegex("com\\.google.*")
|
||||||
|
includeGroupByRegex("androidx.*")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencyResolutionManagement {
|
||||||
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
|
repositories {
|
||||||
|
google()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rootProject.name = "OGS blue"
|
||||||
|
include("app")
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
<string>UIInterfaceOrientationPortrait</string>
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||