create-du-app 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +5 -2
  2. package/package.json +1 -1
  3. package/src/generate.js +15 -2
  4. package/src/index.js +7 -1
  5. package/templates/mobile/expo/.env.example +2 -2
  6. package/templates/mobile/expo/README.md +31 -3
  7. package/templates/mobile/expo/_package.json +13 -15
  8. package/templates/mobile/expo/app.json +10 -2
  9. package/templates/mobile/expo/index.js +2 -0
  10. package/templates/mobile/expo/src/app/app-provider.tsx +7 -3
  11. package/templates/mobile/expo/src/app/config/translation.ts +7 -3
  12. package/templates/mobile/expo/src/assets/i18n/en.json +19 -3
  13. package/templates/mobile/expo/src/assets/i18n/fr.json +19 -3
  14. package/templates/mobile/expo/src/core/components/forms/date-time-picker.modal.tsx +116 -0
  15. package/templates/mobile/expo/src/core/components/forms/hf-date-time.tsx +2 -10
  16. package/templates/mobile/expo/src/core/components/forms/hf-time-picker.tsx +2 -3
  17. package/templates/mobile/expo/src/core/components/screen/screen-container/screen-container.tsx +25 -29
  18. package/templates/mobile/expo/src/core/components/ui/app-image/app-image.tsx +16 -19
  19. package/templates/mobile/expo/src/core/components/ui/app-image/app-image.type.ts +6 -6
  20. package/templates/mobile/expo/src/core/components/ui/avatar-image/avatar-image.tsx +1 -1
  21. package/templates/mobile/expo/src/core/components/ui/image-slider/image-slider.tsx +3 -3
  22. package/templates/mobile/expo/src/core/components/ui/screen/screen-gradient.tsx +1 -1
  23. package/templates/mobile/expo/src/core/components/ui/skeleton/skeleton.tsx +1 -1
  24. package/templates/mobile/expo/src/core/services/api.service.ts +3 -3
  25. package/templates/mobile/expo/src/core/services/device-id.service.ts +16 -2
  26. package/templates/mobile/expo/src/core/utils/device-locale.util.ts +10 -8
  27. package/templates/mobile/expo/src/core/utils/image-picker.util.ts +37 -58
  28. package/templates/mobile/expo/src/core/utils/query-persister.util.ts +16 -21
  29. package/templates/mobile/expo/src/modules/home/home.screen.tsx +97 -20
  30. package/templates/mobile/rn/.bundle/config +2 -0
  31. package/templates/mobile/rn/.watchmanconfig +1 -0
  32. package/templates/mobile/rn/Gemfile +17 -0
  33. package/templates/mobile/rn/README.md +34 -2
  34. package/templates/mobile/rn/_package.json +2 -0
  35. package/templates/mobile/rn/android/app/build.gradle +126 -0
  36. package/templates/mobile/rn/android/app/debug.keystore +0 -0
  37. package/templates/mobile/rn/android/app/proguard-rules.pro +10 -0
  38. package/templates/mobile/rn/android/app/src/main/AndroidManifest.xml +27 -0
  39. package/templates/mobile/rn/android/app/src/main/java/com/dumobile/MainActivity.kt +22 -0
  40. package/templates/mobile/rn/android/app/src/main/java/com/dumobile/MainApplication.kt +27 -0
  41. package/templates/mobile/rn/android/app/src/main/res/drawable/rn_edit_text_material.xml +37 -0
  42. package/templates/mobile/rn/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  43. package/templates/mobile/rn/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  44. package/templates/mobile/rn/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  45. package/templates/mobile/rn/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  46. package/templates/mobile/rn/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  47. package/templates/mobile/rn/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  48. package/templates/mobile/rn/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  49. package/templates/mobile/rn/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  50. package/templates/mobile/rn/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  51. package/templates/mobile/rn/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  52. package/templates/mobile/rn/android/app/src/main/res/values/strings.xml +3 -0
  53. package/templates/mobile/rn/android/app/src/main/res/values/styles.xml +9 -0
  54. package/templates/mobile/rn/android/build.gradle +21 -0
  55. package/templates/mobile/rn/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  56. package/templates/mobile/rn/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  57. package/templates/mobile/rn/android/gradle.properties +44 -0
  58. package/templates/mobile/rn/android/gradlew +248 -0
  59. package/templates/mobile/rn/android/gradlew.bat +98 -0
  60. package/templates/mobile/rn/android/settings.gradle +21 -0
  61. package/templates/mobile/rn/app.json +1 -1
  62. package/templates/mobile/rn/index.js +2 -0
  63. package/templates/mobile/rn/ios/.xcode.env +11 -0
  64. package/templates/mobile/rn/ios/DuMobile/AppDelegate.swift +48 -0
  65. package/templates/mobile/rn/ios/DuMobile/Images.xcassets/AppIcon.appiconset/Contents.json +53 -0
  66. package/templates/mobile/rn/ios/DuMobile/Images.xcassets/Contents.json +6 -0
  67. package/templates/mobile/rn/ios/DuMobile/Info.plist +59 -0
  68. package/templates/mobile/rn/ios/DuMobile/LaunchScreen.storyboard +47 -0
  69. package/templates/mobile/rn/ios/DuMobile/PrivacyInfo.xcprivacy +37 -0
  70. package/templates/mobile/rn/ios/DuMobile.xcodeproj/project.pbxproj +475 -0
  71. package/templates/mobile/rn/ios/DuMobile.xcodeproj/xcshareddata/xcschemes/DuMobile.xcscheme +88 -0
  72. package/templates/mobile/rn/ios/Podfile +34 -0
  73. package/templates/mobile/rn/src/app/app-provider.tsx +19 -14
  74. package/templates/mobile/rn/src/app/config/translation.ts +3 -0
  75. package/templates/mobile/rn/src/assets/i18n/en.json +13 -3
  76. package/templates/mobile/rn/src/assets/i18n/fr.json +13 -3
  77. package/templates/mobile/rn/src/modules/home/home.screen.tsx +53 -19
@@ -0,0 +1,126 @@
1
+ apply plugin: "com.android.application"
2
+ apply plugin: "org.jetbrains.kotlin.android"
3
+ apply plugin: "com.facebook.react"
4
+
5
+ /**
6
+ * This is the configuration block to customize your React Native Android app.
7
+ * By default you don't need to apply any configuration, just uncomment the lines you need.
8
+ */
9
+ react {
10
+ // --- pnpm monorepo: resolve RN packages from the repo-root node_modules via Node ---
11
+ def rnPackageJson = ['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()
12
+ def rnDir = new File(rnPackageJson).getParentFile()
13
+ reactNativeDir = rnDir
14
+ cliFile = new File(rnDir, "cli.js")
15
+ codegenDir = new File(['node', '--print', "require.resolve('@react-native/codegen/package.json')"].execute(null, rootDir).text.trim()).getParentFile()
16
+
17
+ /* Folders */
18
+ // The root of your project, i.e. where "package.json" lives. Default is '../..'
19
+ // root = file("../../")
20
+ // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
21
+ // reactNativeDir = file("../../node_modules/react-native")
22
+ // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
23
+ // codegenDir = file("../../node_modules/@react-native/codegen")
24
+ // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
25
+ // cliFile = file("../../node_modules/react-native/cli.js")
26
+
27
+ /* Variants */
28
+ // The list of variants to that are debuggable. For those we're going to
29
+ // skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
30
+ // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
31
+ // debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
32
+
33
+ /* Bundling */
34
+ // A list containing the node command and its flags. Default is just 'node'.
35
+ // nodeExecutableAndArgs = ["node"]
36
+ //
37
+ // The command to run when bundling. By default is 'bundle'
38
+ // bundleCommand = "ram-bundle"
39
+ //
40
+ // The path to the CLI configuration file. Default is empty.
41
+ // bundleConfig = file(../rn-cli.config.js)
42
+ //
43
+ // The name of the generated asset file containing your JS bundle
44
+ // bundleAssetName = "MyApplication.android.bundle"
45
+ //
46
+ // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
47
+ // entryFile = file("../js/MyApplication.android.js")
48
+ //
49
+ // A list of extra flags to pass to the 'bundle' commands.
50
+ // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
51
+ // extraPackagerArgs = []
52
+
53
+ /* Hermes Commands */
54
+ // The hermes compiler command to run. By default it is 'hermesc'
55
+ // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
56
+ //
57
+ // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
58
+ // hermesFlags = ["-O", "-output-source-map"]
59
+
60
+ /* Autolinking */
61
+ autolinkLibrariesWithApp()
62
+ }
63
+
64
+ /**
65
+ * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
66
+ */
67
+ def enableProguardInReleaseBuilds = false
68
+
69
+ /**
70
+ * The preferred build flavor of JavaScriptCore (JSC)
71
+ *
72
+ * For example, to use the international variant, you can use:
73
+ * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
74
+ *
75
+ * The international variant includes ICU i18n library and necessary data
76
+ * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
77
+ * give correct results when using with locales other than en-US. Note that
78
+ * this variant is about 6MiB larger per architecture than default.
79
+ */
80
+ def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
81
+
82
+ android {
83
+ ndkVersion rootProject.ext.ndkVersion
84
+ buildToolsVersion rootProject.ext.buildToolsVersion
85
+ compileSdk rootProject.ext.compileSdkVersion
86
+
87
+ namespace "com.dumobile"
88
+ defaultConfig {
89
+ applicationId "com.dumobile"
90
+ minSdkVersion rootProject.ext.minSdkVersion
91
+ targetSdkVersion rootProject.ext.targetSdkVersion
92
+ versionCode 1
93
+ versionName "1.0"
94
+ }
95
+ signingConfigs {
96
+ debug {
97
+ storeFile file('debug.keystore')
98
+ storePassword 'android'
99
+ keyAlias 'androiddebugkey'
100
+ keyPassword 'android'
101
+ }
102
+ }
103
+ buildTypes {
104
+ debug {
105
+ signingConfig signingConfigs.debug
106
+ }
107
+ release {
108
+ // Caution! In production, you need to generate your own keystore file.
109
+ // see https://reactnative.dev/docs/signed-apk-android.
110
+ signingConfig signingConfigs.debug
111
+ minifyEnabled enableProguardInReleaseBuilds
112
+ proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
113
+ }
114
+ }
115
+ }
116
+
117
+ dependencies {
118
+ // The version of react-native is set by the React Native Gradle Plugin
119
+ implementation("com.facebook.react:react-android")
120
+
121
+ if (hermesEnabled.toBoolean()) {
122
+ implementation("com.facebook.react:hermes-android")
123
+ } else {
124
+ implementation jscFlavor
125
+ }
126
+ }
@@ -0,0 +1,10 @@
1
+ # Add project specific ProGuard rules here.
2
+ # By default, the flags in this file are appended to flags specified
3
+ # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
4
+ # You can edit the include path and order by changing the proguardFiles
5
+ # directive in build.gradle.
6
+ #
7
+ # For more details, see
8
+ # http://developer.android.com/guide/developing/tools/proguard.html
9
+
10
+ # Add any project specific keep options here:
@@ -0,0 +1,27 @@
1
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
2
+
3
+ <uses-permission android:name="android.permission.INTERNET" />
4
+
5
+ <application
6
+ android:name=".MainApplication"
7
+ android:label="@string/app_name"
8
+ android:icon="@mipmap/ic_launcher"
9
+ android:roundIcon="@mipmap/ic_launcher_round"
10
+ android:allowBackup="false"
11
+ android:theme="@style/AppTheme"
12
+ android:usesCleartextTraffic="${usesCleartextTraffic}"
13
+ android:supportsRtl="true">
14
+ <activity
15
+ android:name=".MainActivity"
16
+ android:label="@string/app_name"
17
+ android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
18
+ android:launchMode="singleTask"
19
+ android:windowSoftInputMode="adjustResize"
20
+ android:exported="true">
21
+ <intent-filter>
22
+ <action android:name="android.intent.action.MAIN" />
23
+ <category android:name="android.intent.category.LAUNCHER" />
24
+ </intent-filter>
25
+ </activity>
26
+ </application>
27
+ </manifest>
@@ -0,0 +1,22 @@
1
+ package com.dumobile
2
+
3
+ import com.facebook.react.ReactActivity
4
+ import com.facebook.react.ReactActivityDelegate
5
+ import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6
+ import com.facebook.react.defaults.DefaultReactActivityDelegate
7
+
8
+ class MainActivity : ReactActivity() {
9
+
10
+ /**
11
+ * Returns the name of the main component registered from JavaScript. This is used to schedule
12
+ * rendering of the component.
13
+ */
14
+ override fun getMainComponentName(): String = "DuMobile"
15
+
16
+ /**
17
+ * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18
+ * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19
+ */
20
+ override fun createReactActivityDelegate(): ReactActivityDelegate =
21
+ DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22
+ }
@@ -0,0 +1,27 @@
1
+ package com.dumobile
2
+
3
+ import android.app.Application
4
+ import com.facebook.react.PackageList
5
+ import com.facebook.react.ReactApplication
6
+ import com.facebook.react.ReactHost
7
+ import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
8
+ import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
9
+
10
+ class MainApplication : Application(), ReactApplication {
11
+
12
+ override val reactHost: ReactHost by lazy {
13
+ getDefaultReactHost(
14
+ context = applicationContext,
15
+ packageList =
16
+ PackageList(this).packages.apply {
17
+ // Packages that cannot be autolinked yet can be added manually here, for example:
18
+ // add(MyReactNativePackage())
19
+ },
20
+ )
21
+ }
22
+
23
+ override fun onCreate() {
24
+ super.onCreate()
25
+ loadReactNative(this)
26
+ }
27
+ }
@@ -0,0 +1,37 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Copyright (C) 2014 The Android Open Source Project
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ -->
16
+ <inset xmlns:android="http://schemas.android.com/apk/res/android"
17
+ android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
18
+ android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
19
+ android:insetTop="@dimen/abc_edit_text_inset_top_material"
20
+ android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
21
+ >
22
+
23
+ <selector>
24
+ <!--
25
+ This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
26
+ The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
27
+ NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
28
+
29
+ <item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
30
+
31
+ For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
32
+ -->
33
+ <item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
34
+ <item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
35
+ </selector>
36
+
37
+ </inset>
@@ -0,0 +1,3 @@
1
+ <resources>
2
+ <string name="app_name">DuMobile</string>
3
+ </resources>
@@ -0,0 +1,9 @@
1
+ <resources>
2
+
3
+ <!-- Base application theme. -->
4
+ <style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
5
+ <!-- Customize your theme here. -->
6
+ <item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
7
+ </style>
8
+
9
+ </resources>
@@ -0,0 +1,21 @@
1
+ buildscript {
2
+ ext {
3
+ buildToolsVersion = "36.0.0"
4
+ minSdkVersion = 24
5
+ compileSdkVersion = 36
6
+ targetSdkVersion = 36
7
+ ndkVersion = "27.1.12297006"
8
+ kotlinVersion = "2.1.20"
9
+ }
10
+ repositories {
11
+ google()
12
+ mavenCentral()
13
+ }
14
+ dependencies {
15
+ classpath("com.android.tools.build:gradle")
16
+ classpath("com.facebook.react:react-native-gradle-plugin")
17
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
18
+ }
19
+ }
20
+
21
+ apply plugin: "com.facebook.react.rootproject"
@@ -0,0 +1,7 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionPath=wrapper/dists
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
4
+ networkTimeout=10000
5
+ validateDistributionUrl=true
6
+ zipStoreBase=GRADLE_USER_HOME
7
+ zipStorePath=wrapper/dists
@@ -0,0 +1,44 @@
1
+ # Project-wide Gradle settings.
2
+
3
+ # IDE (e.g. Android Studio) users:
4
+ # Gradle settings configured through the IDE *will override*
5
+ # any settings specified in this file.
6
+
7
+ # For more details on how to configure your build environment visit
8
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
9
+
10
+ # Specifies the JVM arguments used for the daemon process.
11
+ # The setting is particularly useful for tweaking memory settings.
12
+ # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13
+ org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14
+
15
+ # When configured, Gradle will run in incubating parallel mode.
16
+ # This option should only be used with decoupled projects. More details, visit
17
+ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18
+ # org.gradle.parallel=true
19
+
20
+ # AndroidX package structure to make it clearer which packages are bundled with the
21
+ # Android operating system, and which are packaged with your app's APK
22
+ # https://developer.android.com/topic/libraries/support-library/androidx-rn
23
+ android.useAndroidX=true
24
+
25
+ # Use this property to specify which architecture you want to build.
26
+ # You can also override it from the CLI using
27
+ # ./gradlew <task> -PreactNativeArchitectures=x86_64
28
+ reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
29
+
30
+ # Use this property to enable support to the new architecture.
31
+ # This will allow you to use TurboModules and the Fabric render in
32
+ # your application. You should enable this flag either if you want
33
+ # to write custom TurboModules/Fabric components OR use libraries that
34
+ # are providing them.
35
+ newArchEnabled=true
36
+
37
+ # Use this property to enable or disable the Hermes JS engine.
38
+ # If set to false, you will be using JSC instead.
39
+ hermesEnabled=true
40
+
41
+ # Use this property to enable edge-to-edge display support.
42
+ # This allows your app to draw behind system bars for an immersive UI.
43
+ # Note: Only works with ReactActivity and should not be used with custom Activity.
44
+ edgeToEdgeEnabled=false
@@ -0,0 +1,248 @@
1
+ #!/bin/sh
2
+
3
+ #
4
+ # Copyright © 2015 the original authors.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # https://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+ # SPDX-License-Identifier: Apache-2.0
19
+ #
20
+
21
+ ##############################################################################
22
+ #
23
+ # Gradle start up script for POSIX generated by Gradle.
24
+ #
25
+ # Important for running:
26
+ #
27
+ # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28
+ # noncompliant, but you have some other compliant shell such as ksh or
29
+ # bash, then to run this script, type that shell name before the whole
30
+ # command line, like:
31
+ #
32
+ # ksh Gradle
33
+ #
34
+ # Busybox and similar reduced shells will NOT work, because this script
35
+ # requires all of these POSIX shell features:
36
+ # * functions;
37
+ # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38
+ # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39
+ # * compound commands having a testable exit status, especially «case»;
40
+ # * various built-in commands including «command», «set», and «ulimit».
41
+ #
42
+ # Important for patching:
43
+ #
44
+ # (2) This script targets any POSIX shell, so it avoids extensions provided
45
+ # by Bash, Ksh, etc; in particular arrays are avoided.
46
+ #
47
+ # The "traditional" practice of packing multiple parameters into a
48
+ # space-separated string is a well documented source of bugs and security
49
+ # problems, so this is (mostly) avoided, by progressively accumulating
50
+ # options in "$@", and eventually passing that to Java.
51
+ #
52
+ # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53
+ # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54
+ # see the in-line comments for details.
55
+ #
56
+ # There are tweaks for specific operating systems such as AIX, CygWin,
57
+ # Darwin, MinGW, and NonStop.
58
+ #
59
+ # (3) This script is generated from the Groovy template
60
+ # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61
+ # within the Gradle project.
62
+ #
63
+ # You can find Gradle at https://github.com/gradle/gradle/.
64
+ #
65
+ ##############################################################################
66
+
67
+ # Attempt to set APP_HOME
68
+
69
+ # Resolve links: $0 may be a link
70
+ app_path=$0
71
+
72
+ # Need this for daisy-chained symlinks.
73
+ while
74
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75
+ [ -h "$app_path" ]
76
+ do
77
+ ls=$( ls -ld "$app_path" )
78
+ link=${ls#*' -> '}
79
+ case $link in #(
80
+ /*) app_path=$link ;; #(
81
+ *) app_path=$APP_HOME$link ;;
82
+ esac
83
+ done
84
+
85
+ # This is normally unused
86
+ # shellcheck disable=SC2034
87
+ APP_BASE_NAME=${0##*/}
88
+ # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89
+ APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
90
+
91
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
92
+ MAX_FD=maximum
93
+
94
+ warn () {
95
+ echo "$*"
96
+ } >&2
97
+
98
+ die () {
99
+ echo
100
+ echo "$*"
101
+ echo
102
+ exit 1
103
+ } >&2
104
+
105
+ # OS specific support (must be 'true' or 'false').
106
+ cygwin=false
107
+ msys=false
108
+ darwin=false
109
+ nonstop=false
110
+ case "$( uname )" in #(
111
+ CYGWIN* ) cygwin=true ;; #(
112
+ Darwin* ) darwin=true ;; #(
113
+ MSYS* | MINGW* ) msys=true ;; #(
114
+ NONSTOP* ) nonstop=true ;;
115
+ esac
116
+
117
+
118
+
119
+ # Determine the Java command to use to start the JVM.
120
+ if [ -n "$JAVA_HOME" ] ; then
121
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
122
+ # IBM's JDK on AIX uses strange locations for the executables
123
+ JAVACMD=$JAVA_HOME/jre/sh/java
124
+ else
125
+ JAVACMD=$JAVA_HOME/bin/java
126
+ fi
127
+ if [ ! -x "$JAVACMD" ] ; then
128
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
129
+
130
+ Please set the JAVA_HOME variable in your environment to match the
131
+ location of your Java installation."
132
+ fi
133
+ else
134
+ JAVACMD=java
135
+ if ! command -v java >/dev/null 2>&1
136
+ then
137
+ die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
138
+
139
+ Please set the JAVA_HOME variable in your environment to match the
140
+ location of your Java installation."
141
+ fi
142
+ fi
143
+
144
+ # Increase the maximum file descriptors if we can.
145
+ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
146
+ case $MAX_FD in #(
147
+ max*)
148
+ # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
149
+ # shellcheck disable=SC2039,SC3045
150
+ MAX_FD=$( ulimit -H -n ) ||
151
+ warn "Could not query maximum file descriptor limit"
152
+ esac
153
+ case $MAX_FD in #(
154
+ '' | soft) :;; #(
155
+ *)
156
+ # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
157
+ # shellcheck disable=SC2039,SC3045
158
+ ulimit -n "$MAX_FD" ||
159
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
160
+ esac
161
+ fi
162
+
163
+ # Collect all arguments for the java command, stacking in reverse order:
164
+ # * args from the command line
165
+ # * the main class name
166
+ # * -classpath
167
+ # * -D...appname settings
168
+ # * --module-path (only if needed)
169
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
170
+
171
+ # For Cygwin or MSYS, switch paths to Windows format before running java
172
+ if "$cygwin" || "$msys" ; then
173
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
174
+
175
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
176
+
177
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
178
+ for arg do
179
+ if
180
+ case $arg in #(
181
+ -*) false ;; # don't mess with options #(
182
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
183
+ [ -e "$t" ] ;; #(
184
+ *) false ;;
185
+ esac
186
+ then
187
+ arg=$( cygpath --path --ignore --mixed "$arg" )
188
+ fi
189
+ # Roll the args list around exactly as many times as the number of
190
+ # args, so each arg winds up back in the position where it started, but
191
+ # possibly modified.
192
+ #
193
+ # NB: a `for` loop captures its iteration list before it begins, so
194
+ # changing the positional parameters here affects neither the number of
195
+ # iterations, nor the values presented in `arg`.
196
+ shift # remove old arg
197
+ set -- "$@" "$arg" # push replacement arg
198
+ done
199
+ fi
200
+
201
+
202
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
203
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
204
+
205
+ # Collect all arguments for the java command:
206
+ # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
207
+ # and any embedded shellness will be escaped.
208
+ # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
209
+ # treated as '${Hostname}' itself on the command line.
210
+
211
+ set -- \
212
+ "-Dorg.gradle.appname=$APP_BASE_NAME" \
213
+ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
214
+ "$@"
215
+
216
+ # Stop when "xargs" is not available.
217
+ if ! command -v xargs >/dev/null 2>&1
218
+ then
219
+ die "xargs is not available"
220
+ fi
221
+
222
+ # Use "xargs" to parse quoted args.
223
+ #
224
+ # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
225
+ #
226
+ # In Bash we could simply go:
227
+ #
228
+ # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
229
+ # set -- "${ARGS[@]}" "$@"
230
+ #
231
+ # but POSIX shell has neither arrays nor command substitution, so instead we
232
+ # post-process each arg (as a line of input to sed) to backslash-escape any
233
+ # character that might be a shell metacharacter, then use eval to reverse
234
+ # that process (while maintaining the separation between arguments), and wrap
235
+ # the whole thing up as a single "set" statement.
236
+ #
237
+ # This will of course break if any of these variables contains a newline or
238
+ # an unmatched quote.
239
+ #
240
+
241
+ eval "set -- $(
242
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
243
+ xargs -n1 |
244
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
245
+ tr '\n' ' '
246
+ )" '"$@"'
247
+
248
+ exec "$JAVACMD" "$@"