Skip to content

Commit

Permalink
Update example app config files for Android & Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
JaffaKetchup committed Jan 6, 2025
1 parent 2b763f3 commit 7326b1c
Show file tree
Hide file tree
Showing 15 changed files with 78 additions and 73 deletions.
10 changes: 5 additions & 5 deletions example/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "7c6b7e9ca485f7eaaed913c6bb50f4be6da47e30"
revision: "3e493a3e4d0a5c99fa7da51faae354e95a9a1abe"
channel: "beta"

project_type: app
Expand All @@ -13,11 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: 7c6b7e9ca485f7eaaed913c6bb50f4be6da47e30
base_revision: 7c6b7e9ca485f7eaaed913c6bb50f4be6da47e30
create_revision: 3e493a3e4d0a5c99fa7da51faae354e95a9a1abe
base_revision: 3e493a3e4d0a5c99fa7da51faae354e95a9a1abe
- platform: android
create_revision: 7c6b7e9ca485f7eaaed913c6bb50f4be6da47e30
base_revision: 7c6b7e9ca485f7eaaed913c6bb50f4be6da47e30
create_revision: 3e493a3e4d0a5c99fa7da51faae354e95a9a1abe
base_revision: 3e493a3e4d0a5c99fa7da51faae354e95a9a1abe

# User provided section

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id "com.android.application"
id "kotlin-android"
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
id("dev.flutter.flutter-gradle-plugin")
}

android {
Expand All @@ -17,7 +17,7 @@ android {
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
jvmTarget = JavaVersion.VERSION_1_8.toString()
}

defaultConfig {
Expand All @@ -30,7 +30,9 @@ android {

buildTypes {
release {
signingConfig = signingConfigs.debug
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
}
Expand Down
18 changes: 0 additions & 18 deletions example/android/build.gradle

This file was deleted.

21 changes: 21 additions & 0 deletions example/android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
allprojects {
repositories {
google()
mavenCentral()
}
}

val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
rootProject.layout.buildDirectory.value(newBuildDir)

subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}

tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
2 changes: 1 addition & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
25 changes: 0 additions & 25 deletions example/android/settings.gradle

This file was deleted.

25 changes: 25 additions & 0 deletions example/android/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pluginManagement {
val flutterSdkPath = run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.7.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
}

include(":app")
5 changes: 2 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: fmtc_example
description: The example application for 'flutter_map_tile_caching', showcasing
it's functionality and use-cases.
name: fmtc_demo
description: The demo app for 'flutter_map_tile_caching', showcasing its functionality and use-cases.
publish_to: "none"
version: 10.0.0

Expand Down
10 changes: 8 additions & 2 deletions example/windows/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Project-level configuration.
cmake_minimum_required(VERSION 3.14)
project(example LANGUAGES CXX)
project(fmtc_demo LANGUAGES CXX)

# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "example")
set(BINARY_NAME "fmtc_demo")

# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
Expand Down Expand Up @@ -87,6 +87,12 @@ if(PLUGIN_BUNDLED_LIBRARIES)
COMPONENT Runtime)
endif()

# Copy the native assets provided by the build.dart from all packages.
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/")
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)

# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
Expand Down
4 changes: 2 additions & 2 deletions example/windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ BEGIN
VALUE "FileDescription", "FMTC Demo" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "FMTC Demo" "\0"
VALUE "LegalCopyright", "Copyright (C) 2023 JaffaKetchup. All rights reserved." "\0"
VALUE "OriginalFilename", "example.exe" "\0"
VALUE "LegalCopyright", "Copyright (C) 2025 JaffaKetchup. All rights reserved." "\0"
VALUE "OriginalFilename", "fmtc_demo.exe" "\0"
VALUE "ProductName", "FMTC Demo" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"
END
Expand Down
6 changes: 0 additions & 6 deletions example/windows/runner/runner.exe.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
<application>
<!-- Windows 10 and Windows 11 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
<!-- Windows 8.1 -->
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
<!-- Windows 8 -->
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
<!-- Windows 7 -->
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
</application>
</compatibility>
</assembly>
4 changes: 2 additions & 2 deletions example/windows/runner/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) {
if (utf16_string == nullptr) {
return std::string();
}
int target_length = ::WideCharToMultiByte(
unsigned int target_length = ::WideCharToMultiByte(
CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
-1, nullptr, 0, nullptr, nullptr)
-1; // remove the trailing null character
int input_length = (int)wcslen(utf16_string);
std::string utf8_string;
if (target_length <= 0 || target_length > utf8_string.max_size()) {
if (target_length == 0 || target_length > utf8_string.max_size()) {
return utf8_string;
}
utf8_string.resize(target_length);
Expand Down
7 changes: 4 additions & 3 deletions windowsApplicationInstallerSetup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#define MyAppPublisher "JaffaKetchup Development"
#define MyAppURL "https://github.com/JaffaKetchup/flutter_map_tile_caching"
#define MyAppSupportURL "https://github.com/JaffaKetchup/flutter_map_tile_caching/issues"
#define MyAppExeName "example.exe"
#define MyAppAssocName "Map Cache Store"
#define MyAppExeName "fmtc_demo.exe"
#define MyAppAssocName "FMTC Archive"
#define MyAppAssocExt ".fmtc"
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt

Expand Down Expand Up @@ -63,12 +63,13 @@ Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked

; Specify all files within 'build/windows/runner/Release' except 'example.exe'
; Specify all files within 'build/windows/runner/Release' except 'fmtc_demo.exe'
[Files]
Source: "example\build\windows\x64\runner\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "example\build\windows\x64\runner\Release\flutter_windows.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "example\build\windows\x64\runner\Release\objectbox_flutter_libs_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "example\build\windows\x64\runner\Release\objectbox.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "example\build\windows\x64\runner\Release\share_plus_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "example\build\windows\x64\runner\Release\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs

[Registry]
Expand Down

0 comments on commit 7326b1c

Please sign in to comment.