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

fix: check undefined handlebar vars in strict mode #185

Merged
merged 2 commits into from
Aug 15, 2023
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
5 changes: 5 additions & 0 deletions .changes/fix-handlebars-strict.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-mobile": patch
---

Fix template failing to be rendered due to missing variables on strict mode.
12 changes: 6 additions & 6 deletions templates/platforms/android-studio/app/build.gradle.kts.hbs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id("com.android.application")
id("rust")
{{~#each android-app-plugins}}
id("{{this}}"){{/each}}
{{#if android-app-plugins}}{{~#each android-app-plugins}}
id("{{this}}"){{/each}}{{/if}}
}

android {
Expand Down Expand Up @@ -50,8 +50,8 @@ rust {
}

dependencies {
{{~#each android-app-dependencies-platform}}
implementation(platform("{{this}}")){{/each}}
{{~#each android-app-dependencies}}
implementation("{{this}}"){{/each}}
{{#if android-app-dependencies-platform}}{{~#each android-app-dependencies-platform}}
implementation(platform("{{this}}")){{/each}}{{/if}}
{{#if android-app-dependencies}}{{~#each android-app-dependencies}}
implementation("{{this}}"){{/each}}{{/if}}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
{{~#each android-app-permissions}}
<uses-permission android:name="{{this}}" />{{/each}}
{{#if android-app-permissions}}{{~#each android-app-permissions}}
<uses-permission android:name="{{this}}" />{{/each}}{{/if}}
<application android:hasCode="{{has-code}}" android:supportsRtl="true" android:icon="@mipmap/ic_launcher"
android:label="@string/app_name" android:theme="@style/AppTheme">
<activity android:configChanges="orientation|keyboardHidden" android:exported="true"
Expand Down
4 changes: 2 additions & 2 deletions templates/platforms/android-studio/build.gradle.kts.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ buildscript {
}
dependencies {
classpath("com.android.tools.build:gradle:8.0.0")
{{~#each android-project-dependencies}}
classpath("{{this}}"){{/each}}
{{#if android-project-dependencies}}{{~#each android-project-dependencies}}
classpath("{{this}}"){{/each}}{{/if}}
}
}

Expand Down
4 changes: 2 additions & 2 deletions templates/platforms/android-studio/settings.gradle.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
include ':app'
{{~#each asset-packs}}
include ':{{this}}'{{/each}}
{{#if asset-packs}}{{~#each asset-packs}}
include ':{{this}}'{{/each}}{{/if}}
12 changes: 6 additions & 6 deletions templates/platforms/xcode/Podfile.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

target '{{app.name}}_iOS' do
platform :ios, '{{apple.ios-version}}'
{{#each ios-pod-options}}{{this}}{{/each}}
{{#if ios-pod-options}}{{#each ios-pod-options}}{{this}}{{/each}}{{/if}}

# Pods for {{app.name}}_iOS
{{~#each ios-pods}}
pod '{{this.name}}'{{#if this.version}}, '{{this.version}}'{{/if}}{{/each}}
{{#if ios-pods}}{{~#each ios-pods}}
pod '{{this.name}}'{{#if this.version}}, '{{this.version}}'{{/if}}{{/each}}{{/if}}
end

target '{{app.name}}_macOS' do
platform :osx, '{{apple.macos-version}}'
{{#each macos-pod-options}}{{this}}{{/each}}
{{#if macos-pod-options}}{{#each macos-pod-options}}{{this}}{{/each}}{{/if}}

# Pods for {{app.name}}_macOS
{{~#each macos-pods}}
pod '{{this.name}}'{{#if this.version}}, '{{this.version}}'{{/if}}{{/each}}
{{#if macos-pods}}{{~#each macos-pods}}
pod '{{this.name}}'{{#if this.version}}, '{{this.version}}'{{/if}}{{/each}}{{/if}}
end
34 changes: 17 additions & 17 deletions templates/platforms/xcode/project.yml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ targets:
- path: {{app.asset-dir}}
buildPhase: resources
type: folder
{{~#each asset-catalogs}}
- {{prefix-path this}}{{/each}}
{{~#each ios-additional-targets}}
- path: {{prefix-path this}}{{/each}}
{{#if asset-catalogs}}{{~#each asset-catalogs}}
- {{prefix-path this}}{{/each}}{{/if}}
{{#if ios-additional-targets}}{{~#each ios-additional-targets}}
- path: {{prefix-path this}}{{/each}}{{/if}}
info:
path: {{app.name}}_iOS/Info.plist
properties:
Expand All @@ -55,8 +55,8 @@ targets:
- UIInterfaceOrientationLandscapeRight
CFBundleShortVersionString: {{apple.bundle-version-short}}
CFBundleVersion: {{apple.bundle-version}}
{{~#each apple.plist-pairs}}
{{this.key}}: {{this.value}}{{/each}}
{{#if apple.plist-pairs}}{{~#each apple.plist-pairs}}
{{this.key}}: {{this.value}}{{/each}}{{/if}}
scheme:
environmentVariables:
RUST_BACKTRACE: full
Expand All @@ -70,31 +70,31 @@ targets:
base:
ENABLE_BITCODE: {{apple.enable-bitcode}}
ARCHS: [{{join ios-valid-archs}}]
VALID_ARCHS: {{~#each ios-valid-archs}} {{this}} {{/each}}
VALID_ARCHS: {{#if ios-valid-archs}}{{~#each ios-valid-archs}} {{this}} {{/each}}{{/if}}
LIBRARY_SEARCH_PATHS[sdk=iphoneos*]: $(inherited) $(PROJECT_DIR)/Sources/aarch64-apple-ios/$(CONFIGURATION)
LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]: $(inherited) "{{prefix-path "target/"}}{{ios-sim-arch}}/$(CONFIGURATION)"
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES: true
groups: [app]
dependencies:
- framework: lib{{#if app.lib-name}}{{app.lib-name}}{{else}}{{snake-case app.name}}{{/if}}.a
embed: false
{{~#each ios-libraries}}
{{#if ios-libraries}}{{~#each ios-libraries}}
- framework: {{this}}
embed: false{{/each}}
{{~#each ios-vendor-frameworks}}
- framework: {{prefix-path this}}{{/each}}
{{~#each ios-vendor-sdks}}
- sdk: {{prefix-path this}}{{/each}}
embed: false{{/each}}{{/if}}
{{#if ios-vendor-frameworks}}{{~#each ios-vendor-frameworks}}
- framework: {{prefix-path this}}{{/each}}{{/if}}
{{#if ios-vendor-sdks}}{{~#each ios-vendor-sdks}}
- sdk: {{prefix-path this}}{{/each}}{{/if}}
- sdk: CoreGraphics.framework
- sdk: Metal.framework
- sdk: MetalKit.framework
- sdk: QuartzCore.framework
- sdk: Security.framework
- sdk: UIKit.framework
{{~#each ios-frameworks}}
- sdk: {{this}}.framework{{/each}}
{{#if ios-frameworks}}{{~#each ios-frameworks}}
- sdk: {{this}}.framework{{/each}}{{/if}}
preBuildScripts:
{{~#each ios-pre-build-scripts}}{{#if this.path}}
{{#if ios-pre-build-scripts}}{{~#each ios-pre-build-scripts}}{{#if this.path}}
- path {{this.path}}{{/if}}{{#if this.script}}
- script: {{this.script}}{{/if}}{{#if this.name}}
name: {{this.name}}{{/if}}{{#if this.input-files}}
Expand All @@ -111,7 +111,7 @@ targets:
runOnlyWhenInstalling: {{this.run-only-when-installing}}{{/if}}{{#if this.based-on-dependency-analysis}}
basedOnDependencyAnalysis: {{this.based-on-dependency-analysis}}{{/if}}{{#if this.discovered-dependency-file}}
discoveredDependencyFile: {{this.discovered-dependency-file}}{{/if}}
{{~/each}}
{{~/each}}{{/if}}
- script: |-
CARGO_APPLE=`which cargo-apple`
${CARGO_APPLE} xcode-script -v --platform ${PLATFORM_DISPLAY_NAME:?} --sdk-root ${SDKROOT:?} --framework-search-paths "${FRAMEWORK_SEARCH_PATHS:?}" --header-search-paths "${HEADER_SEARCH_PATHS:?}" --gcc-preprocessor-definitions "${GCC_PREPROCESSOR_DEFINITIONS:?}" --configuration ${CONFIGURATION:?} ${FORCE_COLOR} ${ARCHS:?} ${FEATURES}
Expand Down