@bloomengine/engine 0.3.2 → 0.4.0

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 (47) hide show
  1. package/native/shared/build.rs +137 -6
  2. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/build.gradle +51 -0
  3. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/src/main/AndroidManifest.xml +20 -0
  4. package/native/third_party/JoltPhysics/Build/Android/PerformanceTest/src/main/cpp/CMakeLists.txt +20 -0
  5. package/native/third_party/JoltPhysics/Build/Android/UnitTests/build.gradle +51 -0
  6. package/native/third_party/JoltPhysics/Build/Android/UnitTests/src/main/AndroidManifest.xml +20 -0
  7. package/native/third_party/JoltPhysics/Build/Android/UnitTests/src/main/cpp/CMakeLists.txt +20 -0
  8. package/native/third_party/JoltPhysics/Build/Android/build.gradle +17 -0
  9. package/native/third_party/JoltPhysics/Build/Android/gradle/wrapper/gradle-wrapper.jar +0 -0
  10. package/native/third_party/JoltPhysics/Build/Android/gradle/wrapper/gradle-wrapper.properties +5 -0
  11. package/native/third_party/JoltPhysics/Build/Android/gradle.properties +21 -0
  12. package/native/third_party/JoltPhysics/Build/Android/gradlew +185 -0
  13. package/native/third_party/JoltPhysics/Build/Android/gradlew.bat +89 -0
  14. package/native/third_party/JoltPhysics/Build/Android/settings.gradle +10 -0
  15. package/native/third_party/JoltPhysics/Build/CMakeLists.txt +449 -0
  16. package/native/third_party/JoltPhysics/Build/README.md +250 -0
  17. package/native/third_party/JoltPhysics/Build/cmake_linux_clang_gcc.sh +28 -0
  18. package/native/third_party/JoltPhysics/Build/cmake_linux_emscripten.sh +19 -0
  19. package/native/third_party/JoltPhysics/Build/cmake_linux_mingw.sh +19 -0
  20. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl.bat +3 -0
  21. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_32bit.bat +3 -0
  22. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_arm.bat +3 -0
  23. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_arm_32bit.bat +4 -0
  24. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_cross_platform_deterministic.bat +3 -0
  25. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_double.bat +3 -0
  26. package/native/third_party/JoltPhysics/Build/cmake_vs2022_cl_no_object_stream.bat +3 -0
  27. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang.bat +10 -0
  28. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang_cross_platform_deterministic.bat +10 -0
  29. package/native/third_party/JoltPhysics/Build/cmake_vs2022_clang_double.bat +10 -0
  30. package/native/third_party/JoltPhysics/Build/cmake_vs2022_uwp.bat +5 -0
  31. package/native/third_party/JoltPhysics/Build/cmake_vs2022_uwp_arm.bat +5 -0
  32. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl.bat +3 -0
  33. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl_cross_platform_deterministic.bat +3 -0
  34. package/native/third_party/JoltPhysics/Build/cmake_vs2026_cl_double.bat +3 -0
  35. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang.bat +10 -0
  36. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang_cross_platform_deterministic.bat +10 -0
  37. package/native/third_party/JoltPhysics/Build/cmake_vs2026_clang_double.bat +10 -0
  38. package/native/third_party/JoltPhysics/Build/cmake_windows_mingw.sh +19 -0
  39. package/native/third_party/JoltPhysics/Build/cmake_xcode_ios.sh +4 -0
  40. package/native/third_party/JoltPhysics/Build/cmake_xcode_macos.sh +4 -0
  41. package/native/third_party/JoltPhysics/Build/iOS/JoltViewerInfo.plist +34 -0
  42. package/native/third_party/JoltPhysics/Build/iOS/SamplesInfo.plist +34 -0
  43. package/native/third_party/JoltPhysics/Build/iOS/UnitTestsInfo.plist +34 -0
  44. package/native/third_party/JoltPhysics/Build/macOS/icon.icns +0 -0
  45. package/native/third_party/JoltPhysics/Build/macos_install_vulkan_sdk.sh +13 -0
  46. package/native/third_party/JoltPhysics/Build/ubuntu24_install_vulkan_sdk.sh +4 -0
  47. package/package.json +2 -1
@@ -39,6 +39,28 @@ fn build_jolt() {
39
39
  .join("third_party")
40
40
  .join("bloom_jolt");
41
41
 
42
+ let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
43
+ let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
44
+
45
+ println!("cargo:rerun-if-env-changed=BLOOM_JOLT_PREBUILT_DIR");
46
+ println!("cargo:rerun-if-env-changed=BLOOM_JOLT_FROM_SOURCE");
47
+
48
+ // Prebuilt fast path — if `@bloomengine/jolt-prebuilt` is available
49
+ // (via env var or a node_modules sibling), link its archives and
50
+ // skip the multi-minute cmake build of JoltPhysics entirely. The
51
+ // env var BLOOM_JOLT_FROM_SOURCE=1 forces the cmake fallback even
52
+ // when prebuilts are present, useful for hacking on the C++ shim.
53
+ let from_source = std::env::var_os("BLOOM_JOLT_FROM_SOURCE").is_some();
54
+ if !from_source {
55
+ if let Some(prebuilt_dir) =
56
+ find_prebuilt_dir(&manifest_dir, &target_os, &target_arch)
57
+ {
58
+ link_prebuilt(&prebuilt_dir, &target_os);
59
+ emit_cxx_runtime_link(&target_os);
60
+ return;
61
+ }
62
+ }
63
+
42
64
  if !shim_dir.join("CMakeLists.txt").exists() {
43
65
  panic!(
44
66
  "bloom_jolt shim not found at {}; did the third_party submodules init?",
@@ -60,8 +82,6 @@ fn build_jolt() {
60
82
  // 2. The Jolt build is expensive and identical across every cargo target
61
83
  // hash — caching it once per profile lets `cargo clean` not nuke a
62
84
  // multi-minute compile.
63
- let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
64
- let target_arch = std::env::var("CARGO_CFG_TARGET_ARCH").unwrap_or_default();
65
85
  let dst = shim_dir
66
86
  .join("build")
67
87
  .join(format!("{}-{}", target_os, target_arch));
@@ -87,10 +107,121 @@ fn build_jolt() {
87
107
  println!("cargo:rustc-link-lib=static=bloom_jolt");
88
108
  println!("cargo:rustc-link-lib=static=Jolt");
89
109
 
90
- // C++ standard library — required because we're linking static archives
91
- // that pull in libc++ / libstdc++ symbols.
92
- let target = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
93
- match target.as_str() {
110
+ emit_cxx_runtime_link(&target_os);
111
+ }
112
+
113
+ /// Locate the `@bloomengine/jolt-prebuilt` package's lib dir for the
114
+ /// active build target. Returns `Some(dir)` only when both expected
115
+ /// archives are present — a half-shipped package falls through to the
116
+ /// cmake build instead of producing a confusing linker error.
117
+ ///
118
+ /// Resolution order:
119
+ /// 1. `BLOOM_JOLT_PREBUILT_DIR` env var — points at a directory
120
+ /// containing per-target subdirs (`<dir>/<os>-<arch>/lib*.a`).
121
+ /// Used for local spike testing and for CI matrix jobs that
122
+ /// stage archives outside `node_modules`.
123
+ /// 2. Walk up from `CARGO_MANIFEST_DIR` looking for any
124
+ /// `node_modules/@bloomengine/jolt-prebuilt/lib/<os>-<arch>/`.
125
+ /// Matches what npm's resolver does when `@bloomengine/engine`
126
+ /// depends on `@bloomengine/jolt-prebuilt` — the consumer's
127
+ /// install creates this directory next to the engine package.
128
+ #[cfg(feature = "jolt")]
129
+ fn find_prebuilt_dir(
130
+ manifest_dir: &std::path::Path,
131
+ target_os: &str,
132
+ target_arch: &str,
133
+ ) -> Option<std::path::PathBuf> {
134
+ // Map Rust's target_arch to the npm/Node convention used in this
135
+ // package's directory layout. Keep this in sync with the matrix in
136
+ // npm/jolt-prebuilt/README.md.
137
+ let arch_token = match target_arch {
138
+ "aarch64" => "arm64",
139
+ "x86_64" => "x64",
140
+ "arm" => "armv7",
141
+ other => other,
142
+ };
143
+ let target_token = format!("{}-{}", target_os, arch_token);
144
+
145
+ let candidates = std::iter::empty::<std::path::PathBuf>()
146
+ .chain(
147
+ std::env::var_os("BLOOM_JOLT_PREBUILT_DIR")
148
+ .map(|v| std::path::PathBuf::from(v).join(&target_token)),
149
+ )
150
+ .chain(walk_up_for_node_modules(manifest_dir).map(|nm| {
151
+ nm.join("@bloomengine")
152
+ .join("jolt-prebuilt")
153
+ .join("lib")
154
+ .join(&target_token)
155
+ }));
156
+
157
+ let (lib_prefix, lib_ext) = if target_os == "windows" {
158
+ ("", "lib")
159
+ } else {
160
+ ("lib", "a")
161
+ };
162
+
163
+ for dir in candidates {
164
+ let bloom_jolt = dir.join(format!("{}bloom_jolt.{}", lib_prefix, lib_ext));
165
+ let jolt = dir.join(format!("{}Jolt.{}", lib_prefix, lib_ext));
166
+ if bloom_jolt.exists() && jolt.exists() {
167
+ return Some(dir);
168
+ }
169
+ }
170
+ None
171
+ }
172
+
173
+ /// Iterator over every ancestor `node_modules/` reachable from
174
+ /// `start`. Yields each directory once, parent-first, so a closer
175
+ /// prebuilt installation wins over a higher one (matching node's
176
+ /// resolution algorithm).
177
+ #[cfg(feature = "jolt")]
178
+ fn walk_up_for_node_modules(
179
+ start: &std::path::Path,
180
+ ) -> impl Iterator<Item = std::path::PathBuf> + '_ {
181
+ let mut next: Option<&std::path::Path> = Some(start);
182
+ std::iter::from_fn(move || {
183
+ while let Some(cur) = next {
184
+ next = cur.parent();
185
+ let candidate = cur.join("node_modules");
186
+ if candidate.is_dir() {
187
+ return Some(candidate);
188
+ }
189
+ }
190
+ None
191
+ })
192
+ }
193
+
194
+ #[cfg(feature = "jolt")]
195
+ fn link_prebuilt(dir: &std::path::Path, target_os: &str) {
196
+ // Rerun if any archive in the prebuilt dir changes — covers the
197
+ // case where a new release of jolt-prebuilt drops in new bytes.
198
+ let (lib_prefix, lib_ext) = if target_os == "windows" {
199
+ ("", "lib")
200
+ } else {
201
+ ("lib", "a")
202
+ };
203
+ println!(
204
+ "cargo:rerun-if-changed={}",
205
+ dir.join(format!("{}bloom_jolt.{}", lib_prefix, lib_ext))
206
+ .display()
207
+ );
208
+ println!(
209
+ "cargo:rerun-if-changed={}",
210
+ dir.join(format!("{}Jolt.{}", lib_prefix, lib_ext)).display()
211
+ );
212
+
213
+ println!("cargo:rustc-link-search=native={}", dir.display());
214
+ println!("cargo:rustc-link-lib=static=bloom_jolt");
215
+ println!("cargo:rustc-link-lib=static=Jolt");
216
+ }
217
+
218
+ /// Emit the C++ standard library link directive that matches the
219
+ /// archives we just linked. Required because the static archives pull
220
+ /// in libc++ / libstdc++ symbols that the Rust toolchain doesn't
221
+ /// resolve on its own.
222
+ #[cfg(feature = "jolt")]
223
+ fn emit_cxx_runtime_link(target_os: &str) {
224
+ match target_os {
94
225
  "macos" | "ios" | "tvos" | "watchos" => {
95
226
  println!("cargo:rustc-link-lib=dylib=c++");
96
227
  }
@@ -0,0 +1,51 @@
1
+ plugins {
2
+ id 'com.android.application'
3
+ }
4
+
5
+ android {
6
+ compileSdk 33
7
+ ndkVersion "26.1.10909125"
8
+
9
+ defaultConfig {
10
+ applicationId "com.joltphysics.performancetest"
11
+ minSdk 21
12
+ targetSdk 33
13
+ versionCode 1
14
+ versionName "1.0"
15
+ ndk.abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64', 'x86'
16
+
17
+ externalNativeBuild {
18
+ cmake {
19
+ cppFlags '-std=c++17 -Wall -Werror -ffp-model=precise -ffp-contract=off -DJPH_PROFILE_ENABLED -DJPH_DEBUG_RENDERER'
20
+ arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static', '-DCROSS_PLATFORM_DETERMINISTIC=ON'
21
+ }
22
+ }
23
+ signingConfig signingConfigs.debug
24
+ }
25
+
26
+ buildTypes {
27
+ release {
28
+ minifyEnabled false
29
+ }
30
+ }
31
+
32
+ compileOptions {
33
+ sourceCompatibility JavaVersion.VERSION_1_8
34
+ targetCompatibility JavaVersion.VERSION_1_8
35
+ }
36
+
37
+ externalNativeBuild {
38
+ cmake {
39
+ path file('src/main/cpp/CMakeLists.txt')
40
+ version '3.22.1'
41
+ }
42
+ }
43
+
44
+ buildFeatures {
45
+ viewBinding true
46
+ }
47
+ namespace 'com.joltphysics.performancetest'
48
+ }
49
+
50
+ dependencies {
51
+ }
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
+
4
+ <application
5
+ android:allowBackup="true"
6
+ android:label="Jolt Physics Performance Test"
7
+ android:supportsRtl="false"
8
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
9
+ <activity
10
+ android:name="android.app.NativeActivity"
11
+ android:exported="true">
12
+ <meta-data android:name="android.app.lib_name" android:value="PerformanceTest"/>
13
+ <intent-filter>
14
+ <action android:name="android.intent.action.MAIN"/>
15
+ <category android:name="android.intent.category.LAUNCHER"/>
16
+ </intent-filter>
17
+ </activity>
18
+ </application>
19
+
20
+ </manifest>
@@ -0,0 +1,20 @@
1
+ cmake_minimum_required(VERSION 3.10.2)
2
+
3
+ project("JoltPhysicsPerformanceTest")
4
+
5
+ # Make sure we include the app glue sources
6
+ set(APP_GLUE_DIR ${ANDROID_NDK}/sources/android/native_app_glue)
7
+ include_directories(${APP_GLUE_DIR})
8
+
9
+ # Set repository root
10
+ set(PHYSICS_REPO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../")
11
+
12
+ # Make targets
13
+ include(${PHYSICS_REPO_ROOT}/Jolt/Jolt.cmake)
14
+ include(${PHYSICS_REPO_ROOT}/PerformanceTest/PerformanceTest.cmake)
15
+
16
+ # Link shared native library
17
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
18
+ add_library(PerformanceTest SHARED ${PERFORMANCE_TEST_SRC_FILES} ${APP_GLUE_DIR}/android_native_app_glue.c)
19
+ target_include_directories(PerformanceTest PUBLIC Jolt ${JOLT_PHYSICS_ROOT} ${PERFORMANCE_TEST_ROOT})
20
+ target_link_libraries(PerformanceTest Jolt android log)
@@ -0,0 +1,51 @@
1
+ plugins {
2
+ id 'com.android.application'
3
+ }
4
+
5
+ android {
6
+ compileSdk 33
7
+ ndkVersion "26.1.10909125"
8
+
9
+ defaultConfig {
10
+ applicationId "com.joltphysics.unittests"
11
+ minSdk 21
12
+ targetSdk 33
13
+ versionCode 1
14
+ versionName "1.0"
15
+ ndk.abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86_64', 'x86'
16
+
17
+ externalNativeBuild {
18
+ cmake {
19
+ cppFlags '-std=c++17 -Wall -Werror -ffp-contract=off -DJPH_PROFILE_ENABLED -DJPH_DEBUG_RENDERER'
20
+ arguments '-DANDROID_TOOLCHAIN=clang', '-DANDROID_STL=c++_static'
21
+ }
22
+ }
23
+ signingConfig signingConfigs.debug
24
+ }
25
+
26
+ buildTypes {
27
+ release {
28
+ minifyEnabled false
29
+ }
30
+ }
31
+
32
+ compileOptions {
33
+ sourceCompatibility JavaVersion.VERSION_1_8
34
+ targetCompatibility JavaVersion.VERSION_1_8
35
+ }
36
+
37
+ externalNativeBuild {
38
+ cmake {
39
+ path file('src/main/cpp/CMakeLists.txt')
40
+ version '3.22.1'
41
+ }
42
+ }
43
+
44
+ buildFeatures {
45
+ viewBinding true
46
+ }
47
+ namespace 'com.joltphysics.unittests'
48
+ }
49
+
50
+ dependencies {
51
+ }
@@ -0,0 +1,20 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
3
+
4
+ <application
5
+ android:allowBackup="true"
6
+ android:label="Jolt Physics Unit Tests"
7
+ android:supportsRtl="false"
8
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
9
+ <activity
10
+ android:name="android.app.NativeActivity"
11
+ android:exported="true">
12
+ <meta-data android:name="android.app.lib_name" android:value="UnitTests"/>
13
+ <intent-filter>
14
+ <action android:name="android.intent.action.MAIN"/>
15
+ <category android:name="android.intent.category.LAUNCHER"/>
16
+ </intent-filter>
17
+ </activity>
18
+ </application>
19
+
20
+ </manifest>
@@ -0,0 +1,20 @@
1
+ cmake_minimum_required(VERSION 3.10.2)
2
+
3
+ project("JoltPhysicsUnitTests")
4
+
5
+ # Make sure we include the app glue sources
6
+ set(APP_GLUE_DIR ${ANDROID_NDK}/sources/android/native_app_glue)
7
+ include_directories(${APP_GLUE_DIR})
8
+
9
+ # Set repository root
10
+ set(PHYSICS_REPO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../")
11
+
12
+ # Make targets
13
+ include(${PHYSICS_REPO_ROOT}/Jolt/Jolt.cmake)
14
+ include(${PHYSICS_REPO_ROOT}/UnitTests/UnitTests.cmake)
15
+
16
+ # Link shared native library
17
+ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -u ANativeActivity_onCreate")
18
+ add_library(UnitTests SHARED ${UNIT_TESTS_SRC_FILES} ${APP_GLUE_DIR}/android_native_app_glue.c)
19
+ target_include_directories(UnitTests PUBLIC Jolt ${JOLT_PHYSICS_ROOT} ${UNIT_TESTS_ROOT})
20
+ target_link_libraries(UnitTests Jolt android log)
@@ -0,0 +1,17 @@
1
+ // Top-level build file where you can add configuration options common to all sub-projects/modules.
2
+ buildscript {
3
+ repositories {
4
+ google()
5
+ mavenCentral()
6
+ }
7
+ dependencies {
8
+ classpath 'com.android.tools.build:gradle:8.7.2'
9
+
10
+ // NOTE: Do not place your application dependencies here; they belong
11
+ // in the individual module build.gradle files
12
+ }
13
+ }
14
+
15
+ task clean(type: Delete) {
16
+ delete rootProject.buildDir
17
+ }
@@ -0,0 +1,5 @@
1
+ distributionBase=GRADLE_USER_HOME
2
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
3
+ distributionPath=wrapper/dists
4
+ zipStorePath=wrapper/dists
5
+ zipStoreBase=GRADLE_USER_HOME
@@ -0,0 +1,21 @@
1
+ # Project-wide Gradle settings.
2
+ # IDE (e.g. Android Studio) users:
3
+ # Gradle settings configured through the IDE *will override*
4
+ # any settings specified in this file.
5
+ # For more details on how to configure your build environment visit
6
+ # http://www.gradle.org/docs/current/userguide/build_environment.html
7
+ # Specifies the JVM arguments used for the daemon process.
8
+ # The setting is particularly useful for tweaking memory settings.
9
+ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
10
+ # When configured, Gradle will run in incubating parallel mode.
11
+ # This option should only be used with decoupled projects. More details, visit
12
+ # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13
+ # org.gradle.parallel=true
14
+ # AndroidX package structure to make it clearer which packages are bundled with the
15
+ # Android operating system, and which are packaged with your app"s APK
16
+ # https://developer.android.com/topic/libraries/support-library/androidx-rn
17
+ android.useAndroidX=true
18
+ # Automatically convert third-party libraries to use AndroidX
19
+ android.enableJetifier=true
20
+ android.nonTransitiveRClass=false
21
+ android.nonFinalResIds=false
@@ -0,0 +1,185 @@
1
+ #!/usr/bin/env sh
2
+
3
+ #
4
+ # Copyright 2015 the original author or 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
+
19
+ ##############################################################################
20
+ ##
21
+ ## Gradle start up script for UN*X
22
+ ##
23
+ ##############################################################################
24
+
25
+ # Attempt to set APP_HOME
26
+ # Resolve links: $0 may be a link
27
+ PRG="$0"
28
+ # Need this for relative symlinks.
29
+ while [ -h "$PRG" ] ; do
30
+ ls=`ls -ld "$PRG"`
31
+ link=`expr "$ls" : '.*-> \(.*\)$'`
32
+ if expr "$link" : '/.*' > /dev/null; then
33
+ PRG="$link"
34
+ else
35
+ PRG=`dirname "$PRG"`"/$link"
36
+ fi
37
+ done
38
+ SAVED="`pwd`"
39
+ cd "`dirname \"$PRG\"`/" >/dev/null
40
+ APP_HOME="`pwd -P`"
41
+ cd "$SAVED" >/dev/null
42
+
43
+ APP_NAME="Gradle"
44
+ APP_BASE_NAME=`basename "$0"`
45
+
46
+ # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47
+ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48
+
49
+ # Use the maximum available, or set MAX_FD != -1 to use that value.
50
+ MAX_FD="maximum"
51
+
52
+ warn () {
53
+ echo "$*"
54
+ }
55
+
56
+ die () {
57
+ echo
58
+ echo "$*"
59
+ echo
60
+ exit 1
61
+ }
62
+
63
+ # OS specific support (must be 'true' or 'false').
64
+ cygwin=false
65
+ msys=false
66
+ darwin=false
67
+ nonstop=false
68
+ case "`uname`" in
69
+ CYGWIN* )
70
+ cygwin=true
71
+ ;;
72
+ Darwin* )
73
+ darwin=true
74
+ ;;
75
+ MINGW* )
76
+ msys=true
77
+ ;;
78
+ NONSTOP* )
79
+ nonstop=true
80
+ ;;
81
+ esac
82
+
83
+ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84
+
85
+
86
+ # Determine the Java command to use to start the JVM.
87
+ if [ -n "$JAVA_HOME" ] ; then
88
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89
+ # IBM's JDK on AIX uses strange locations for the executables
90
+ JAVACMD="$JAVA_HOME/jre/sh/java"
91
+ else
92
+ JAVACMD="$JAVA_HOME/bin/java"
93
+ fi
94
+ if [ ! -x "$JAVACMD" ] ; then
95
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96
+
97
+ Please set the JAVA_HOME variable in your environment to match the
98
+ location of your Java installation."
99
+ fi
100
+ else
101
+ JAVACMD="java"
102
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103
+
104
+ Please set the JAVA_HOME variable in your environment to match the
105
+ location of your Java installation."
106
+ fi
107
+
108
+ # Increase the maximum file descriptors if we can.
109
+ if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110
+ MAX_FD_LIMIT=`ulimit -H -n`
111
+ if [ $? -eq 0 ] ; then
112
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113
+ MAX_FD="$MAX_FD_LIMIT"
114
+ fi
115
+ ulimit -n $MAX_FD
116
+ if [ $? -ne 0 ] ; then
117
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
118
+ fi
119
+ else
120
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121
+ fi
122
+ fi
123
+
124
+ # For Darwin, add options to specify how the application appears in the dock
125
+ if $darwin; then
126
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127
+ fi
128
+
129
+ # For Cygwin or MSYS, switch paths to Windows format before running java
130
+ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133
+
134
+ JAVACMD=`cygpath --unix "$JAVACMD"`
135
+
136
+ # We build the pattern for arguments to be converted via cygpath
137
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138
+ SEP=""
139
+ for dir in $ROOTDIRSRAW ; do
140
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
141
+ SEP="|"
142
+ done
143
+ OURCYGPATTERN="(^($ROOTDIRS))"
144
+ # Add a user-defined pattern to the cygpath arguments
145
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147
+ fi
148
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
149
+ i=0
150
+ for arg in "$@" ; do
151
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153
+
154
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156
+ else
157
+ eval `echo args$i`="\"$arg\""
158
+ fi
159
+ i=`expr $i + 1`
160
+ done
161
+ case $i in
162
+ 0) set -- ;;
163
+ 1) set -- "$args0" ;;
164
+ 2) set -- "$args0" "$args1" ;;
165
+ 3) set -- "$args0" "$args1" "$args2" ;;
166
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172
+ esac
173
+ fi
174
+
175
+ # Escape application args
176
+ save () {
177
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178
+ echo " "
179
+ }
180
+ APP_ARGS=`save "$@"`
181
+
182
+ # Collect all arguments for the java command, following the shell quoting and substitution rules
183
+ eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184
+
185
+ exec "$JAVACMD" "$@"
@@ -0,0 +1,89 @@
1
+ @rem
2
+ @rem Copyright 2015 the original author or authors.
3
+ @rem
4
+ @rem Licensed under the Apache License, Version 2.0 (the "License");
5
+ @rem you may not use this file except in compliance with the License.
6
+ @rem You may obtain a copy of the License at
7
+ @rem
8
+ @rem https://www.apache.org/licenses/LICENSE-2.0
9
+ @rem
10
+ @rem Unless required by applicable law or agreed to in writing, software
11
+ @rem distributed under the License is distributed on an "AS IS" BASIS,
12
+ @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ @rem See the License for the specific language governing permissions and
14
+ @rem limitations under the License.
15
+ @rem
16
+
17
+ @if "%DEBUG%" == "" @echo off
18
+ @rem ##########################################################################
19
+ @rem
20
+ @rem Gradle startup script for Windows
21
+ @rem
22
+ @rem ##########################################################################
23
+
24
+ @rem Set local scope for the variables with windows NT shell
25
+ if "%OS%"=="Windows_NT" setlocal
26
+
27
+ set DIRNAME=%~dp0
28
+ if "%DIRNAME%" == "" set DIRNAME=.
29
+ set APP_BASE_NAME=%~n0
30
+ set APP_HOME=%DIRNAME%
31
+
32
+ @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33
+ for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34
+
35
+ @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36
+ set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37
+
38
+ @rem Find java.exe
39
+ if defined JAVA_HOME goto findJavaFromJavaHome
40
+
41
+ set JAVA_EXE=java.exe
42
+ %JAVA_EXE% -version >NUL 2>&1
43
+ if "%ERRORLEVEL%" == "0" goto execute
44
+
45
+ echo.
46
+ echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47
+ echo.
48
+ echo Please set the JAVA_HOME variable in your environment to match the
49
+ echo location of your Java installation.
50
+
51
+ goto fail
52
+
53
+ :findJavaFromJavaHome
54
+ set JAVA_HOME=%JAVA_HOME:"=%
55
+ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56
+
57
+ if exist "%JAVA_EXE%" goto execute
58
+
59
+ echo.
60
+ echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61
+ echo.
62
+ echo Please set the JAVA_HOME variable in your environment to match the
63
+ echo location of your Java installation.
64
+
65
+ goto fail
66
+
67
+ :execute
68
+ @rem Setup the command line
69
+
70
+ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71
+
72
+
73
+ @rem Execute Gradle
74
+ "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75
+
76
+ :end
77
+ @rem End local scope for the variables with windows NT shell
78
+ if "%ERRORLEVEL%"=="0" goto mainEnd
79
+
80
+ :fail
81
+ rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82
+ rem the _cmd.exe /c_ return code!
83
+ if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84
+ exit /b 1
85
+
86
+ :mainEnd
87
+ if "%OS%"=="Windows_NT" endlocal
88
+
89
+ :omega