From 9a0c65ed2eff10c315288fde38164b0d7e80732e Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Thu, 28 Jun 2018 16:54:08 -0700 Subject: [PATCH] Refactor API for clarity and future changes --- .gitignore | 2 + docs/api/ImportAll.hx | 129 +- extraParams.hxml | 2 +- haxelib.json | 3 +- lime/Assets.hx | 4 - lime/graphics/ConsoleRenderContext.hx | 137 - lime/graphics/console/IndexBuffer.hx | 29 - lime/graphics/console/PointerUtil.hx | 34 - lime/graphics/console/Primitive.hx | 29 - lime/graphics/console/RenderState.hx | 50 - lime/graphics/console/Shader.hx | 25 - lime/graphics/console/Texture.hx | 34 - lime/graphics/console/TextureAddressMode.hx | 10 - lime/graphics/console/TextureData.hx | 41 - lime/graphics/console/TextureFilter.hx | 10 - lime/graphics/console/TextureFormat.hx | 9 - lime/graphics/console/VertexBuffer.hx | 34 - lime/graphics/console/VertexDecl.hx | 12 - lime/graphics/console/VertexOutput.hx | 35 - lime/media/fmod/FMODChannel.hx | 54 - lime/media/fmod/FMODMode.hx | 16 - lime/media/fmod/FMODSound.hx | 36 - lime/project/ApplicationData.hx | 14 - lime/project/Architecture.hx | 16 - lime/project/Asset.hx | 146 -- lime/project/AssetEncoding.hx | 9 - lime/project/AssetType.hx | 15 - lime/project/CLICommand.hx | 20 - lime/project/Command.hx | 18 - lime/project/ConfigData.hx | 655 ----- lime/project/Dependency.hx | 31 - lime/project/HXProject.hx | 1572 ------------ lime/project/Haxelib.hx | 43 - lime/project/Icon.hx | 33 - lime/project/Keystore.hx | 40 - lime/project/Library.hx | 49 - lime/project/MetaData.hx | 15 - lime/project/ModuleData.hx | 57 - lime/project/NDLL.hx | 40 - lime/project/NDLLType.hx | 10 - lime/project/Orientation.hx | 11 - lime/project/Platform.hx | 28 - lime/project/PlatformTarget.hx | 177 -- lime/project/PlatformType.hx | 11 - lime/project/ProjectXMLParser.hx | 2286 ----------------- lime/project/SplashScreen.hx | 32 - lime/project/Version.hx | 403 --- lime/project/WindowData.hx | 36 - lime/text/GlyphPosition.hx | 37 - lime/text/TextDirection.hx | 70 - lime/text/TextLayout.hx | 252 -- lime/text/TextScript.hx | 162 -- lime/tools/helpers/AIRHelper.hx | 342 --- lime/tools/helpers/AndroidHelper.hx | 472 ---- lime/tools/helpers/AntHelper.hx | 46 - lime/tools/helpers/ArrayHelper.hx | 163 -- lime/tools/helpers/AssetHelper.hx | 685 ----- lime/tools/helpers/BlackBerryHelper.hx | 447 ---- lime/tools/helpers/CLIHelper.hx | 110 - lime/tools/helpers/CPPHelper.hx | 330 --- lime/tools/helpers/CSHelper.hx | 301 --- lime/tools/helpers/CommandHelper.hx | 56 - lime/tools/helpers/CompatibilityHelper.hx | 45 - lime/tools/helpers/ConfigHelper.hx | 384 --- lime/tools/helpers/CordovaHelper.hx | 357 --- lime/tools/helpers/DeploymentHelper.hx | 44 - lime/tools/helpers/ElectronHelper.hx | 31 - lime/tools/helpers/FileHelper.hx | 595 ----- lime/tools/helpers/FlashHelper.hx | 1054 -------- lime/tools/helpers/GUID.hx | 67 - lime/tools/helpers/HTML5Helper.hx | 269 -- lime/tools/helpers/HaxelibHelper.hx | 518 ---- lime/tools/helpers/IOSHelper.hx | 513 ---- lime/tools/helpers/IconHelper.hx | 450 ---- lime/tools/helpers/ImageHelper.hx | 144 -- lime/tools/helpers/JavaHelper.hx | 17 - lime/tools/helpers/LogHelper.hx | 221 -- lime/tools/helpers/ModuleHelper.hx | 725 ------ lime/tools/helpers/NekoHelper.hx | 84 - lime/tools/helpers/NodeJSHelper.hx | 61 - lime/tools/helpers/ObjectHelper.hx | 155 -- lime/tools/helpers/PathHelper.hx | 748 ------ lime/tools/helpers/PlatformHelper.hx | 129 - lime/tools/helpers/ProcessHelper.hx | 521 ---- lime/tools/helpers/StringHelper.hx | 442 ---- lime/tools/helpers/StringMapHelper.hx | 51 - lime/tools/helpers/TVOSHelper.hx | 453 ---- lime/tools/helpers/TizenHelper.hx | 229 -- lime/tools/helpers/WatchHelper.hx | 117 - lime/tools/helpers/WebOSHelper.hx | 78 - lime/tools/helpers/ZipHelper.hx | 125 - lime/tools/platforms/AIRPlatform.hx | 353 --- lime/tools/platforms/AndroidPlatform.hx | 481 ---- lime/tools/platforms/BlackBerryPlatform.hx | 383 --- lime/tools/platforms/EmscriptenPlatform.hx | 374 --- lime/tools/platforms/FirefoxPlatform.hx | 95 - lime/tools/platforms/FlashPlatform.hx | 295 --- lime/tools/platforms/HTML5Platform.hx | 487 ---- lime/tools/platforms/IOSPlatform.hx | 775 ------ lime/tools/platforms/LinuxPlatform.hx | 457 ---- lime/tools/platforms/MacPlatform.hx | 425 --- lime/tools/platforms/TVOSPlatform.hx | 649 ----- lime/tools/platforms/TizenPlatform.hx | 232 -- lime/tools/platforms/WebOSPlatform.hx | 205 -- lime/tools/platforms/WindowsPlatform.hx | 870 ------- lime/vm/NekoVM.hx | 21 - {cs => src/cs}/ndll/NDLLFunction.hx | 0 {haxe => src/haxe}/Timer.hx | 0 {haxe => src/haxe}/io/Bytes.hx | 4 +- .../_internal/backend}/air/AIRApplication.hx | 4 +- .../lime/_internal/backend}/air/AIRWindow.hx | 19 +- .../backend}/flash/FlashApplication.hx | 8 +- .../backend}/flash/FlashAudioSource.hx | 4 +- .../backend}/flash/FlashHTTPRequest.hx | 2 +- .../_internal/backend}/flash/FlashMouse.hx | 2 +- .../_internal/backend}/flash/FlashWindow.hx | 20 +- .../backend}/html5/HTML5Application.hx | 11 +- .../backend}/html5/HTML5AudioSource.hx | 4 +- .../backend}/html5/HTML5HTTPRequest.hx | 10 +- .../_internal/backend}/html5/HTML5Mouse.hx | 6 +- .../backend/html5/HTML5OpenGLRenderContext.hx | 4 +- .../_internal/backend}/html5/HTML5Window.hx | 25 +- .../_internal/backend}/kha/KhaApplication.hx | 10 +- .../_internal/backend}/kha/KhaRenderer.hx | 2 +- .../backend}/native/NativeApplication.hx | 52 +- .../backend}/native/NativeAudioSource.hx | 6 +- .../_internal/backend}/native/NativeCFFI.hx | 4 +- .../backend}/native/NativeHTTPRequest.hx | 2 +- .../_internal/backend}/native/NativeMouse.hx | 8 +- .../native/NativeOpenGLRenderContext.hx | 10 +- .../_internal/backend}/native/NativeWindow.hx | 28 +- .../lime/_internal}/format/BMP.hx | 2 +- .../lime/_internal/format}/Deflate.hx | 6 +- .../lime/_internal/format}/GZip.hx | 6 +- .../lime/_internal}/format/JPEG.hx | 8 +- .../lime/_internal/format}/LZMA.hx | 6 +- .../lime/_internal}/format/PNG.hx | 10 +- .../lime/_internal/format}/Zlib.hx | 6 +- .../_internal/graphics}/ImageCanvasUtil.hx | 3 +- .../lime/_internal/graphics}/ImageDataUtil.hx | 15 +- .../lime/_internal/macros}/AssetsMacro.hx | 39 +- .../lime/_internal/macros}/CFFIMacro.hx | 2 +- .../lime/_internal/macros/DefineMacro.hx | 37 +- .../lime/_internal/macros}/EventMacro.hx | 2 +- .../_internal/macros}/HTTPRequestMacro.hx | 2 +- .../lime/_internal}/unifill/CodePoint.hx | 2 +- .../lime/_internal}/unifill/CodePointIter.hx | 2 +- .../lime/_internal}/unifill/Exception.hx | 2 +- .../_internal}/unifill/InternalEncoding.hx | 2 +- .../unifill/InternalEncodingBackwardIter.hx | 2 +- .../unifill/InternalEncodingIter.hx | 2 +- .../lime/_internal}/unifill/Unicode.hx | 2 +- .../lime/_internal}/unifill/Unifill.hx | 2 +- .../lime/_internal}/unifill/Utf16.hx | 2 +- .../lime/_internal}/unifill/Utf32.hx | 2 +- .../lime/_internal}/unifill/Utf8.hx | 2 +- {lime => src/lime}/app/Application.hx | 35 +- {lime => src/lime}/app/Config.hx | 0 {lime => src/lime}/app/Event.hx | 4 +- {lime => src/lime}/app/Future.hx | 6 +- {lime => src/lime}/app/IModule.hx | 1 + {lime => src/lime}/app/Module.hx | 37 +- {lime => src/lime}/app/Promise.hx | 0 .../lime}/graphics/CairoRenderContext.hx | 0 .../lime}/graphics/CanvasRenderContext.hx | 0 .../lime}/graphics/DOMRenderContext.hx | 0 .../lime}/graphics/FlashRenderContext.hx | 0 {lime => src/lime}/graphics/Image.hx | 98 +- {lime => src/lime}/graphics/ImageBuffer.hx | 2 +- {lime => src/lime}/graphics/ImageChannel.hx | 0 src/lime/graphics/ImageFileFormat.hx | 10 + {lime => src/lime}/graphics/ImageType.hx | 0 .../lime/graphics/OpenGLES2RenderContext.hx | 4 +- .../lime/graphics/OpenGLES3RenderContext.hx | 4 +- .../lime/graphics/OpenGLRenderContext.hx | 6 +- {lime => src/lime}/graphics/PixelFormat.hx | 0 {lime => src/lime}/graphics/RenderContext.hx | 7 +- .../lime}/graphics/RenderContextType.hx | 0 .../lime}/graphics/WebGL2RenderContext.hx | 6 +- .../lime}/graphics/WebGLRenderContext.hx | 6 +- {lime => src/lime}/graphics/cairo/Cairo.hx | 4 +- .../lime}/graphics/cairo/CairoAntialias.hx | 0 .../lime}/graphics/cairo/CairoContent.hx | 0 .../lime}/graphics/cairo/CairoExtend.hx | 0 .../lime}/graphics/cairo/CairoFTFontFace.hx | 4 +- .../lime}/graphics/cairo/CairoFillRule.hx | 0 .../lime}/graphics/cairo/CairoFilter.hx | 0 .../lime}/graphics/cairo/CairoFontFace.hx | 4 +- .../lime}/graphics/cairo/CairoFontOptions.hx | 252 +- .../lime}/graphics/cairo/CairoFormat.hx | 0 .../lime}/graphics/cairo/CairoGlyph.hx | 0 .../lime}/graphics/cairo/CairoHintMetrics.hx | 0 .../lime}/graphics/cairo/CairoHintStyle.hx | 0 .../lime}/graphics/cairo/CairoImageSurface.hx | 4 +- .../lime}/graphics/cairo/CairoLineCap.hx | 0 .../lime}/graphics/cairo/CairoLineJoin.hx | 0 .../lime}/graphics/cairo/CairoOperator.hx | 0 .../lime}/graphics/cairo/CairoPattern.hx | 4 +- .../lime}/graphics/cairo/CairoStatus.hx | 0 .../graphics/cairo/CairoSubpixelOrder.hx | 0 .../lime}/graphics/cairo/CairoSurface.hx | 4 +- {lime => src/lime}/graphics/opengl/GL.hx | 6 +- .../lime}/graphics/opengl/GLActiveInfo.hx | 0 .../lime}/graphics/opengl/GLBuffer.hx | 0 .../graphics/opengl/GLContextAttributes.hx | 0 .../lime}/graphics/opengl/GLFramebuffer.hx | 0 .../lime}/graphics/opengl/GLProgram.hx | 0 {lime => src/lime}/graphics/opengl/GLQuery.hx | 0 .../lime}/graphics/opengl/GLRenderbuffer.hx | 0 .../lime}/graphics/opengl/GLSampler.hx | 0 .../lime}/graphics/opengl/GLShader.hx | 0 .../opengl/GLShaderPrecisionFormat.hx | 0 {lime => src/lime}/graphics/opengl/GLSync.hx | 4 +- .../lime}/graphics/opengl/GLTexture.hx | 0 .../graphics/opengl/GLTransformFeedback.hx | 0 .../graphics/opengl/GLUniformLocation.hx | 0 .../graphics/opengl/GLVertexArrayObject.hx | 0 .../opengl/ext/AMD_compressed_3DC_texture.hx | 0 .../opengl/ext/AMD_compressed_ATC_texture.hx | 0 .../opengl/ext/AMD_performance_monitor.hx | 0 .../opengl/ext/AMD_program_binary_Z400.hx | 0 .../opengl/ext/ANGLE_framebuffer_blit.hx | 0 .../ext/ANGLE_framebuffer_multisample.hx | 0 .../opengl/ext/ANGLE_instanced_arrays.hx | 0 .../ext/ANGLE_pack_reverse_row_order.hx | 0 .../ext/ANGLE_texture_compression_dxt3.hx | 0 .../ext/ANGLE_texture_compression_dxt5.hx | 0 .../opengl/ext/ANGLE_texture_usage.hx | 0 .../ext/ANGLE_translated_shader_source.hx | 0 .../opengl/ext/APPLE_copy_texture_levels.hx | 0 .../ext/APPLE_framebuffer_multisample.hx | 0 .../graphics/opengl/ext/APPLE_rgb_422.hx | 0 .../lime}/graphics/opengl/ext/APPLE_sync.hx | 0 .../ext/APPLE_texture_format_BGRA8888.hx | 0 .../opengl/ext/APPLE_texture_max_level.hx | 0 .../opengl/ext/ARM_mali_program_binary.hx | 0 .../opengl/ext/ARM_mali_shader_binary.hx | 0 .../lime}/graphics/opengl/ext/ARM_rgba8.hx | 0 .../graphics/opengl/ext/DMP_shader_binary.hx | 0 .../lime}/graphics/opengl/ext/EXT_bgra.hx | 0 .../graphics/opengl/ext/EXT_blend_minmax.hx | 0 .../opengl/ext/EXT_color_buffer_float.hx | 0 .../opengl/ext/EXT_color_buffer_half_float.hx | 0 .../graphics/opengl/ext/EXT_debug_label.hx | 0 .../graphics/opengl/ext/EXT_debug_marker.hx | 0 .../opengl/ext/EXT_discard_framebuffer.hx | 0 .../opengl/ext/EXT_disjoint_timer_query.hx | 0 .../graphics/opengl/ext/EXT_frag_depth.hx | 0 .../opengl/ext/EXT_map_buffer_range.hx | 0 .../opengl/ext/EXT_multi_draw_arrays.hx | 0 .../ext/EXT_multisampled_render_to_texture.hx | 0 .../opengl/ext/EXT_multiview_draw_buffers.hx | 0 .../opengl/ext/EXT_occlusion_query_boolean.hx | 0 .../opengl/ext/EXT_packed_depth_stencil.hx | 0 .../opengl/ext/EXT_read_format_bgra.hx | 0 .../graphics/opengl/ext/EXT_robustness.hx | 0 .../lime}/graphics/opengl/ext/EXT_sRGB.hx | 0 .../opengl/ext/EXT_separate_shader_objects.hx | 0 .../ext/EXT_shader_framebuffer_fetch.hx | 0 .../opengl/ext/EXT_shader_texture_lod.hx | 0 .../opengl/ext/EXT_shadow_samplers.hx | 0 .../ext/EXT_texture_compression_dxt1.hx | 0 .../ext/EXT_texture_compression_s3tc.hx | 0 .../ext/EXT_texture_filter_anisotropic.hx | 0 .../opengl/ext/EXT_texture_format_BGRA8888.hx | 0 .../graphics/opengl/ext/EXT_texture_rg.hx | 0 .../opengl/ext/EXT_texture_storage.hx | 0 .../ext/EXT_texture_type_2_10_10_10_REV.hx | 0 .../opengl/ext/EXT_unpack_subimage.hx | 0 .../opengl/ext/FJ_shader_binary_GCCSO.hx | 0 .../ext/IMG_multisampled_render_to_texture.hx | 0 .../graphics/opengl/ext/IMG_program_binary.hx | 0 .../graphics/opengl/ext/IMG_read_format.hx | 0 .../graphics/opengl/ext/IMG_shader_binary.hx | 0 .../ext/IMG_texture_compression_pvrtc.hx | 0 .../lime}/graphics/opengl/ext/KHR_debug.hx | 0 .../ext/KHR_texture_compression_astc_ldr.hx | 0 .../graphics/opengl/ext/NV_coverage_sample.hx | 0 .../graphics/opengl/ext/NV_depth_nonlinear.hx | 0 .../graphics/opengl/ext/NV_draw_buffers.hx | 0 .../opengl/ext/NV_fbo_color_attachments.hx | 0 .../lime}/graphics/opengl/ext/NV_fence.hx | 0 .../graphics/opengl/ext/NV_read_buffer.hx | 0 .../opengl/ext/NV_read_buffer_front.hx | 0 .../graphics/opengl/ext/NV_read_depth.hx | 0 .../opengl/ext/NV_read_depth_stencil.hx | 0 .../graphics/opengl/ext/NV_read_stencil.hx | 0 .../ext/NV_texture_compression_s3tc_update.hx | 0 .../opengl/ext/NV_texture_npot_2D_mipmap.hx | 0 .../graphics/opengl/ext/OES_EGL_image.hx | 0 .../opengl/ext/OES_EGL_image_external.hx | 0 .../ext/OES_compressed_ETC1_RGB8_texture.hx | 0 .../ext/OES_compressed_paletted_texture.hx | 0 .../lime}/graphics/opengl/ext/OES_depth24.hx | 0 .../lime}/graphics/opengl/ext/OES_depth32.hx | 0 .../graphics/opengl/ext/OES_depth_texture.hx | 0 .../opengl/ext/OES_element_index_uint.hx | 0 .../opengl/ext/OES_get_program_binary.hx | 0 .../graphics/opengl/ext/OES_mapbuffer.hx | 0 .../opengl/ext/OES_packed_depth_stencil.hx | 0 .../opengl/ext/OES_required_internalformat.hx | 0 .../graphics/opengl/ext/OES_rgb8_rgba8.hx | 0 .../opengl/ext/OES_standard_derivatives.hx | 0 .../lime}/graphics/opengl/ext/OES_stencil1.hx | 0 .../lime}/graphics/opengl/ext/OES_stencil4.hx | 0 .../opengl/ext/OES_surfaceless_context.hx | 0 .../graphics/opengl/ext/OES_texture_3D.hx | 0 .../graphics/opengl/ext/OES_texture_float.hx | 0 .../opengl/ext/OES_texture_float_linear.hx | 0 .../opengl/ext/OES_texture_half_float.hx | 0 .../ext/OES_texture_half_float_linear.hx | 0 .../graphics/opengl/ext/OES_texture_npot.hx | 0 .../opengl/ext/OES_vertex_array_object.hx | 0 .../opengl/ext/OES_vertex_half_float.hx | 0 .../opengl/ext/OES_vertex_type_10_10_10_2.hx | 0 .../graphics/opengl/ext/QCOM_alpha_test.hx | 0 .../opengl/ext/QCOM_binning_control.hx | 0 .../opengl/ext/QCOM_driver_control.hx | 0 .../graphics/opengl/ext/QCOM_extended_get.hx | 0 .../graphics/opengl/ext/QCOM_extended_get2.hx | 0 .../opengl/ext/QCOM_perfmon_global_mode.hx | 0 .../opengl/ext/QCOM_tiled_rendering.hx | 0 .../opengl/ext/QCOM_writeonly_rendering.hx | 0 .../graphics/opengl/ext/VIV_shader_binary.hx | 0 .../opengl/ext/WEBGL_color_buffer_float.hx | 0 .../ext/WEBGL_compressed_texture_atc.hx | 0 .../ext/WEBGL_compressed_texture_etc.hx | 0 .../ext/WEBGL_compressed_texture_etc1.hx | 0 .../ext/WEBGL_compressed_texture_pvrtc.hx | 0 .../ext/WEBGL_compressed_texture_s3tc.hx | 0 .../opengl/ext/WEBGL_debug_renderer_info.hx | 0 .../opengl/ext/WEBGL_debug_shaders.hx | 0 .../opengl/ext/WEBGL_depth_texture.hx | 0 .../graphics/opengl/ext/WEBGL_draw_buffers.hx | 0 .../graphics/opengl/ext/WEBGL_lose_context.hx | 0 {lime/math/color => src/lime/math}/ARGB.hx | 2 +- {lime/math/color => src/lime/math}/BGRA.hx | 2 +- {lime => src/lime}/math/ColorMatrix.hx | 0 {lime => src/lime}/math/Matrix3.hx | 0 {lime => src/lime}/math/Matrix4.hx | 0 {lime/math/color => src/lime/math}/RGBA.hx | 4 +- {lime => src/lime}/math/Rectangle.hx | 0 {lime => src/lime}/math/Vector2.hx | 0 {lime => src/lime}/math/Vector4.hx | 0 {lime => src/lime}/media/ALAudioContext.hx | 0 {lime => src/lime}/media/ALCAudioContext.hx | 0 {lime => src/lime}/media/AudioBuffer.hx | 70 +- {lime => src/lime}/media/AudioContext.hx | 0 {lime => src/lime}/media/AudioManager.hx | 9 +- {lime => src/lime}/media/AudioSource.hx | 40 +- {lime => src/lime}/media/FlashAudioContext.hx | 0 {lime => src/lime}/media/HTML5AudioContext.hx | 0 {lime => src/lime}/media/WebAudioContext.hx | 0 {lime => src/lime}/media/howlerjs/Howl.hx | 0 {lime => src/lime}/media/howlerjs/Howler.hx | 0 {lime => src/lime}/media/openal/AL.hx | 4 +- .../media/openal/ALAuxiliaryEffectSlot.hx | 0 {lime => src/lime}/media/openal/ALBuffer.hx | 0 {lime => src/lime}/media/openal/ALC.hx | 4 +- {lime => src/lime}/media/openal/ALContext.hx | 0 {lime => src/lime}/media/openal/ALDevice.hx | 0 {lime => src/lime}/media/openal/ALEffect.hx | 0 {lime => src/lime}/media/openal/ALFilter.hx | 0 {lime => src/lime}/media/openal/ALSource.hx | 0 .../lime/media}/vorbis/Vorbis.hx | 2 +- .../lime/media}/vorbis/VorbisComment.hx | 2 +- .../lime/media}/vorbis/VorbisFile.hx | 6 +- .../lime/media}/vorbis/VorbisInfo.hx | 2 +- {lime => src/lime}/net/HTTPRequest.hx | 20 +- {lime => src/lime}/net/HTTPRequestHeader.hx | 0 {lime => src/lime}/net/HTTPRequestMethod.hx | 0 {lime => src/lime}/net/URIParser.hx | 0 {lime => src/lime}/net/curl/CURL.hx | 10 +- {lime => src/lime}/net/curl/CURLCode.hx | 0 {lime => src/lime}/net/curl/CURLInfo.hx | 0 {lime => src/lime}/net/curl/CURLMulti.hx | 8 +- {lime => src/lime}/net/curl/CURLMultiCode.hx | 0 .../lime}/net/curl/CURLMultiMessage.hx | 0 .../lime}/net/curl/CURLMultiOption.hx | 0 {lime => src/lime}/net/curl/CURLOption.hx | 0 {lime => src/lime}/net/curl/CURLVersion.hx | 0 {lime => src/lime}/net/oauth/OAuthClient.hx | 94 +- {lime => src/lime}/net/oauth/OAuthConsumer.hx | 36 +- {lime => src/lime}/net/oauth/OAuthRequest.hx | 246 +- .../lime}/net/oauth/OAuthSignatureMethod.hx | 16 +- {lime => src/lime}/net/oauth/OAuthToken.hx | 0 {lime => src/lime}/net/oauth/OAuthVersion.hx | 16 +- {lime => src/lime}/system/BackgroundWorker.hx | 6 +- {lime => src/lime}/system/CFFI.hx | 2 +- {lime => src/lime}/system/CFFIPointer.hx | 4 +- {lime => src/lime}/system/Clipboard.hx | 8 +- {lime => src/lime}/system/Display.hx | 0 {lime => src/lime}/system/DisplayMode.hx | 0 {lime => src/lime}/system/Endian.hx | 0 {lime => src/lime}/system/FileWatcher.hx | 28 +- {lime => src/lime}/system/JNI.hx | 10 +- {lime => src/lime}/system/Locale.hx | 0 {lime => src/lime}/system/Sensor.hx | 0 {lime => src/lime}/system/SensorType.hx | 0 {lime => src/lime}/system/System.hx | 4 +- {lime => src/lime}/system/ThreadPool.hx | 10 +- {lime => src/lime}/text/Font.hx | 7 +- {lime => src/lime}/text/Glyph.hx | 0 {lime => src/lime}/text/GlyphMetrics.hx | 0 {lime => src/lime}/text/UTF8String.hx | 4 +- {lime => src/lime}/text/harfbuzz/HB.hx | 4 +- {lime => src/lime}/ui/FileDialog.hx | 4 +- {lime => src/lime}/ui/FileDialogType.hx | 0 {lime => src/lime}/ui/Gamepad.hx | 4 +- {lime => src/lime}/ui/GamepadAxis.hx | 0 {lime => src/lime}/ui/GamepadButton.hx | 0 {lime => src/lime}/ui/Haptic.hx | 4 +- {lime => src/lime}/ui/Joystick.hx | 4 +- {lime => src/lime}/ui/JoystickHatPosition.hx | 0 {lime => src/lime}/ui/KeyCode.hx | 4 +- {lime => src/lime}/ui/KeyModifier.hx | 0 {lime => src/lime}/ui/Mouse.hx | 6 +- {lime => src/lime}/ui/MouseCursor.hx | 0 {lime => src/lime}/ui/ScanCode.hx | 4 +- {lime => src/lime}/ui/Touch.hx | 0 {lime => src/lime}/ui/Window.hx | 109 +- {lime => src/lime}/utils/ArrayBuffer.hx | 0 {lime => src/lime}/utils/ArrayBufferView.hx | 0 {lime => src/lime}/utils/AssetCache.hx | 2 +- {lime => src/lime}/utils/AssetLibrary.hx | 0 {lime => src/lime}/utils/AssetManifest.hx | 0 {lime => src/lime}/utils/AssetType.hx | 0 {lime => src/lime}/utils/Assets.hx | 0 {lime => src/lime}/utils/BytePointer.hx | 0 {lime => src/lime}/utils/Bytes.hx | 62 +- src/lime/utils/CompressionAlgorithm.hx | 11 + {lime => src/lime}/utils/DataPointer.hx | 4 +- {lime => src/lime}/utils/DataView.hx | 0 {lime => src/lime}/utils/Float32Array.hx | 0 {lime => src/lime}/utils/Float64Array.hx | 0 {lime => src/lime}/utils/GLUtils.hx | 0 {lime => src/lime}/utils/Int16Array.hx | 0 {lime => src/lime}/utils/Int32Array.hx | 256 +- {lime => src/lime}/utils/Int8Array.hx | 0 {lime => src/lime}/utils/Log.hx | 51 +- src/lime/utils/LogLevel.hx | 18 + {lime => src/lime}/utils/ObjectPool.hx | 10 +- .../lime}/utils/PackedAssetLibrary.hx | 46 +- {lime/app => src/lime/utils}/Preloader.hx | 3 +- {lime => src/lime}/utils/Resource.hx | 0 {lime => src/lime}/utils/UInt16Array.hx | 0 {lime => src/lime}/utils/UInt32Array.hx | 0 {lime => src/lime}/utils/UInt8Array.hx | 256 +- {lime => src/lime}/utils/UInt8ClampedArray.hx | 0 templates/haxe/ApplicationMain.hx | 2 +- tools/utils/JavaExternGenerator.hx | 2 +- 451 files changed, 1207 insertions(+), 25962 deletions(-) delete mode 100644 lime/Assets.hx delete mode 100644 lime/graphics/ConsoleRenderContext.hx delete mode 100644 lime/graphics/console/IndexBuffer.hx delete mode 100644 lime/graphics/console/PointerUtil.hx delete mode 100644 lime/graphics/console/Primitive.hx delete mode 100644 lime/graphics/console/RenderState.hx delete mode 100644 lime/graphics/console/Shader.hx delete mode 100644 lime/graphics/console/Texture.hx delete mode 100644 lime/graphics/console/TextureAddressMode.hx delete mode 100644 lime/graphics/console/TextureData.hx delete mode 100644 lime/graphics/console/TextureFilter.hx delete mode 100644 lime/graphics/console/TextureFormat.hx delete mode 100644 lime/graphics/console/VertexBuffer.hx delete mode 100644 lime/graphics/console/VertexDecl.hx delete mode 100644 lime/graphics/console/VertexOutput.hx delete mode 100644 lime/media/fmod/FMODChannel.hx delete mode 100644 lime/media/fmod/FMODMode.hx delete mode 100644 lime/media/fmod/FMODSound.hx delete mode 100644 lime/project/ApplicationData.hx delete mode 100644 lime/project/Architecture.hx delete mode 100644 lime/project/Asset.hx delete mode 100644 lime/project/AssetEncoding.hx delete mode 100644 lime/project/AssetType.hx delete mode 100644 lime/project/CLICommand.hx delete mode 100644 lime/project/Command.hx delete mode 100644 lime/project/ConfigData.hx delete mode 100644 lime/project/Dependency.hx delete mode 100644 lime/project/HXProject.hx delete mode 100644 lime/project/Haxelib.hx delete mode 100644 lime/project/Icon.hx delete mode 100644 lime/project/Keystore.hx delete mode 100644 lime/project/Library.hx delete mode 100644 lime/project/MetaData.hx delete mode 100644 lime/project/ModuleData.hx delete mode 100644 lime/project/NDLL.hx delete mode 100644 lime/project/NDLLType.hx delete mode 100644 lime/project/Orientation.hx delete mode 100644 lime/project/Platform.hx delete mode 100644 lime/project/PlatformTarget.hx delete mode 100644 lime/project/PlatformType.hx delete mode 100644 lime/project/ProjectXMLParser.hx delete mode 100644 lime/project/SplashScreen.hx delete mode 100644 lime/project/Version.hx delete mode 100644 lime/project/WindowData.hx delete mode 100644 lime/text/GlyphPosition.hx delete mode 100644 lime/text/TextDirection.hx delete mode 100644 lime/text/TextLayout.hx delete mode 100644 lime/text/TextScript.hx delete mode 100644 lime/tools/helpers/AIRHelper.hx delete mode 100644 lime/tools/helpers/AndroidHelper.hx delete mode 100644 lime/tools/helpers/AntHelper.hx delete mode 100644 lime/tools/helpers/ArrayHelper.hx delete mode 100644 lime/tools/helpers/AssetHelper.hx delete mode 100644 lime/tools/helpers/BlackBerryHelper.hx delete mode 100644 lime/tools/helpers/CLIHelper.hx delete mode 100644 lime/tools/helpers/CPPHelper.hx delete mode 100644 lime/tools/helpers/CSHelper.hx delete mode 100644 lime/tools/helpers/CommandHelper.hx delete mode 100644 lime/tools/helpers/CompatibilityHelper.hx delete mode 100644 lime/tools/helpers/ConfigHelper.hx delete mode 100644 lime/tools/helpers/CordovaHelper.hx delete mode 100644 lime/tools/helpers/DeploymentHelper.hx delete mode 100644 lime/tools/helpers/ElectronHelper.hx delete mode 100644 lime/tools/helpers/FileHelper.hx delete mode 100644 lime/tools/helpers/FlashHelper.hx delete mode 100644 lime/tools/helpers/GUID.hx delete mode 100644 lime/tools/helpers/HTML5Helper.hx delete mode 100644 lime/tools/helpers/HaxelibHelper.hx delete mode 100644 lime/tools/helpers/IOSHelper.hx delete mode 100644 lime/tools/helpers/IconHelper.hx delete mode 100644 lime/tools/helpers/ImageHelper.hx delete mode 100644 lime/tools/helpers/JavaHelper.hx delete mode 100644 lime/tools/helpers/LogHelper.hx delete mode 100644 lime/tools/helpers/ModuleHelper.hx delete mode 100644 lime/tools/helpers/NekoHelper.hx delete mode 100644 lime/tools/helpers/NodeJSHelper.hx delete mode 100644 lime/tools/helpers/ObjectHelper.hx delete mode 100644 lime/tools/helpers/PathHelper.hx delete mode 100644 lime/tools/helpers/PlatformHelper.hx delete mode 100644 lime/tools/helpers/ProcessHelper.hx delete mode 100644 lime/tools/helpers/StringHelper.hx delete mode 100644 lime/tools/helpers/StringMapHelper.hx delete mode 100644 lime/tools/helpers/TVOSHelper.hx delete mode 100644 lime/tools/helpers/TizenHelper.hx delete mode 100644 lime/tools/helpers/WatchHelper.hx delete mode 100644 lime/tools/helpers/WebOSHelper.hx delete mode 100644 lime/tools/helpers/ZipHelper.hx delete mode 100644 lime/tools/platforms/AIRPlatform.hx delete mode 100644 lime/tools/platforms/AndroidPlatform.hx delete mode 100644 lime/tools/platforms/BlackBerryPlatform.hx delete mode 100644 lime/tools/platforms/EmscriptenPlatform.hx delete mode 100644 lime/tools/platforms/FirefoxPlatform.hx delete mode 100644 lime/tools/platforms/FlashPlatform.hx delete mode 100644 lime/tools/platforms/HTML5Platform.hx delete mode 100644 lime/tools/platforms/IOSPlatform.hx delete mode 100644 lime/tools/platforms/LinuxPlatform.hx delete mode 100644 lime/tools/platforms/MacPlatform.hx delete mode 100644 lime/tools/platforms/TVOSPlatform.hx delete mode 100644 lime/tools/platforms/TizenPlatform.hx delete mode 100644 lime/tools/platforms/WebOSPlatform.hx delete mode 100644 lime/tools/platforms/WindowsPlatform.hx delete mode 100644 lime/vm/NekoVM.hx rename {cs => src/cs}/ndll/NDLLFunction.hx (100%) rename {haxe => src/haxe}/Timer.hx (100%) rename {haxe => src/haxe}/io/Bytes.hx (99%) rename {lime/_backend => src/lime/_internal/backend}/air/AIRApplication.hx (89%) rename {lime/_backend => src/lime/_internal/backend}/air/AIRWindow.hx (97%) rename {lime/_backend => src/lime/_internal/backend}/flash/FlashApplication.hx (87%) rename {lime/_backend => src/lime/_internal/backend}/flash/FlashAudioSource.hx (98%) rename {lime/_backend => src/lime/_internal/backend}/flash/FlashHTTPRequest.hx (99%) rename {lime/_backend => src/lime/_internal/backend}/flash/FlashMouse.hx (97%) rename {lime/_backend => src/lime/_internal/backend}/flash/FlashWindow.hx (95%) rename {lime/_backend => src/lime/_internal/backend}/html5/HTML5Application.hx (98%) rename {lime/_backend => src/lime/_internal/backend}/html5/HTML5AudioSource.hx (99%) rename {lime/_backend => src/lime/_internal/backend}/html5/HTML5HTTPRequest.hx (99%) rename {lime/_backend => src/lime/_internal/backend}/html5/HTML5Mouse.hx (91%) rename lime/_backend/html5/HTML5GLRenderContext.hx => src/lime/_internal/backend/html5/HTML5OpenGLRenderContext.hx (99%) rename {lime/_backend => src/lime/_internal/backend}/html5/HTML5Window.hx (97%) rename {lime/_backend => src/lime/_internal/backend}/kha/KhaApplication.hx (98%) rename {lime/_backend => src/lime/_internal/backend}/kha/KhaRenderer.hx (95%) rename {lime/_backend => src/lime/_internal/backend}/native/NativeApplication.hx (94%) rename {lime/_backend => src/lime/_internal/backend}/native/NativeAudioSource.hx (99%) rename {lime/_backend => src/lime/_internal/backend}/native/NativeCFFI.hx (99%) rename {lime/_backend => src/lime/_internal/backend}/native/NativeHTTPRequest.hx (99%) rename {lime/_backend => src/lime/_internal/backend}/native/NativeMouse.hx (93%) rename lime/_backend/native/NativeGLRenderContext.hx => src/lime/_internal/backend/native/NativeOpenGLRenderContext.hx (99%) rename {lime/_backend => src/lime/_internal/backend}/native/NativeWindow.hx (95%) rename {lime/graphics => src/lime/_internal}/format/BMP.hx (99%) rename {lime/utils/compress => src/lime/_internal/format}/Deflate.hx (93%) rename {lime/utils/compress => src/lime/_internal/format}/GZip.hx (90%) rename {lime/graphics => src/lime/_internal}/format/JPEG.hx (95%) rename {lime/utils/compress => src/lime/_internal/format}/LZMA.hx (91%) rename {lime/graphics => src/lime/_internal}/format/PNG.hx (94%) rename {lime/utils/compress => src/lime/_internal/format}/Zlib.hx (93%) rename {lime/graphics/utils => src/lime/_internal/graphics}/ImageCanvasUtil.hx (99%) rename {lime/graphics/utils => src/lime/_internal/graphics}/ImageDataUtil.hx (99%) rename {lime/_macros => src/lime/_internal/macros}/AssetsMacro.hx (92%) rename {lime/_macros => src/lime/_internal/macros}/CFFIMacro.hx (99%) rename lime/Lib.hx => src/lime/_internal/macros/DefineMacro.hx (54%) rename {lime/_macros => src/lime/_internal/macros}/EventMacro.hx (98%) rename {lime/_macros => src/lime/_internal/macros}/HTTPRequestMacro.hx (99%) rename {lime/text => src/lime/_internal}/unifill/CodePoint.hx (97%) mode change 100755 => 100644 rename {lime/text => src/lime/_internal}/unifill/CodePointIter.hx (94%) mode change 100755 => 100644 rename {lime/text => src/lime/_internal}/unifill/Exception.hx (96%) mode change 100755 => 100644 rename {lime/text => src/lime/_internal}/unifill/InternalEncoding.hx (99%) mode change 100755 => 100644 rename {lime/text => src/lime/_internal}/unifill/InternalEncodingBackwardIter.hx (94%) mode change 100755 => 100644 rename {lime/text => src/lime/_internal}/unifill/InternalEncodingIter.hx (94%) mode change 100755 => 100644 rename {lime/text => src/lime/_internal}/unifill/Unicode.hx (97%) mode change 100755 => 100644 rename {lime/text => src/lime/_internal}/unifill/Unifill.hx (99%) mode change 100755 => 100644 rename {lime/text => src/lime/_internal}/unifill/Utf16.hx (99%) mode change 100755 => 100644 rename {lime/text => src/lime/_internal}/unifill/Utf32.hx (99%) mode change 100755 => 100644 rename {lime/text => src/lime/_internal}/unifill/Utf8.hx (99%) mode change 100755 => 100644 rename {lime => src/lime}/app/Application.hx (85%) rename {lime => src/lime}/app/Config.hx (100%) rename {lime => src/lime}/app/Event.hx (97%) rename {lime => src/lime}/app/Future.hx (96%) rename {lime => src/lime}/app/IModule.hx (93%) rename {lime => src/lime}/app/Module.hx (96%) rename {lime => src/lime}/app/Promise.hx (100%) rename {lime => src/lime}/graphics/CairoRenderContext.hx (100%) rename {lime => src/lime}/graphics/CanvasRenderContext.hx (100%) rename {lime => src/lime}/graphics/DOMRenderContext.hx (100%) rename {lime => src/lime}/graphics/FlashRenderContext.hx (100%) rename {lime => src/lime}/graphics/Image.hx (94%) rename {lime => src/lime}/graphics/ImageBuffer.hx (98%) rename {lime => src/lime}/graphics/ImageChannel.hx (100%) create mode 100644 src/lime/graphics/ImageFileFormat.hx rename {lime => src/lime}/graphics/ImageType.hx (100%) rename lime/graphics/GLES2RenderContext.hx => src/lime/graphics/OpenGLES2RenderContext.hx (97%) rename lime/graphics/GLES3RenderContext.hx => src/lime/graphics/OpenGLES3RenderContext.hx (99%) rename lime/graphics/GLRenderContext.hx => src/lime/graphics/OpenGLRenderContext.hx (99%) rename {lime => src/lime}/graphics/PixelFormat.hx (100%) rename {lime => src/lime}/graphics/RenderContext.hx (72%) rename {lime => src/lime}/graphics/RenderContextType.hx (100%) rename {lime => src/lime}/graphics/WebGL2RenderContext.hx (99%) rename {lime => src/lime}/graphics/WebGLRenderContext.hx (97%) rename {lime => src/lime}/graphics/cairo/Cairo.hx (99%) rename {lime => src/lime}/graphics/cairo/CairoAntialias.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoContent.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoExtend.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoFTFontFace.hx (84%) rename {lime => src/lime}/graphics/cairo/CairoFillRule.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoFilter.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoFontFace.hx (78%) rename {lime => src/lime}/graphics/cairo/CairoFontOptions.hx (92%) rename {lime => src/lime}/graphics/cairo/CairoFormat.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoGlyph.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoHintMetrics.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoHintStyle.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoImageSurface.hx (95%) rename {lime => src/lime}/graphics/cairo/CairoLineCap.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoLineJoin.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoOperator.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoPattern.hx (97%) rename {lime => src/lime}/graphics/cairo/CairoStatus.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoSubpixelOrder.hx (100%) rename {lime => src/lime}/graphics/cairo/CairoSurface.hx (73%) rename {lime => src/lime}/graphics/opengl/GL.hx (99%) rename {lime => src/lime}/graphics/opengl/GLActiveInfo.hx (100%) rename {lime => src/lime}/graphics/opengl/GLBuffer.hx (100%) rename {lime => src/lime}/graphics/opengl/GLContextAttributes.hx (100%) rename {lime => src/lime}/graphics/opengl/GLFramebuffer.hx (100%) rename {lime => src/lime}/graphics/opengl/GLProgram.hx (100%) rename {lime => src/lime}/graphics/opengl/GLQuery.hx (100%) rename {lime => src/lime}/graphics/opengl/GLRenderbuffer.hx (100%) rename {lime => src/lime}/graphics/opengl/GLSampler.hx (100%) rename {lime => src/lime}/graphics/opengl/GLShader.hx (100%) rename {lime => src/lime}/graphics/opengl/GLShaderPrecisionFormat.hx (100%) rename {lime => src/lime}/graphics/opengl/GLSync.hx (72%) rename {lime => src/lime}/graphics/opengl/GLTexture.hx (100%) rename {lime => src/lime}/graphics/opengl/GLTransformFeedback.hx (100%) rename {lime => src/lime}/graphics/opengl/GLUniformLocation.hx (100%) rename {lime => src/lime}/graphics/opengl/GLVertexArrayObject.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/AMD_compressed_3DC_texture.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/AMD_compressed_ATC_texture.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/AMD_performance_monitor.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/AMD_program_binary_Z400.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ANGLE_framebuffer_blit.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ANGLE_framebuffer_multisample.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ANGLE_instanced_arrays.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ANGLE_pack_reverse_row_order.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ANGLE_texture_compression_dxt3.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ANGLE_texture_compression_dxt5.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ANGLE_texture_usage.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ANGLE_translated_shader_source.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/APPLE_copy_texture_levels.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/APPLE_framebuffer_multisample.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/APPLE_rgb_422.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/APPLE_sync.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/APPLE_texture_format_BGRA8888.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/APPLE_texture_max_level.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ARM_mali_program_binary.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ARM_mali_shader_binary.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/ARM_rgba8.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/DMP_shader_binary.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_bgra.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_blend_minmax.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_color_buffer_float.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_color_buffer_half_float.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_debug_label.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_debug_marker.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_discard_framebuffer.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_disjoint_timer_query.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_frag_depth.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_map_buffer_range.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_multi_draw_arrays.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_multisampled_render_to_texture.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_multiview_draw_buffers.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_occlusion_query_boolean.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_packed_depth_stencil.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_read_format_bgra.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_robustness.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_sRGB.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_separate_shader_objects.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_shader_framebuffer_fetch.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_shader_texture_lod.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_shadow_samplers.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_texture_compression_dxt1.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_texture_compression_s3tc.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_texture_filter_anisotropic.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_texture_format_BGRA8888.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_texture_rg.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_texture_storage.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_texture_type_2_10_10_10_REV.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/EXT_unpack_subimage.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/FJ_shader_binary_GCCSO.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/IMG_multisampled_render_to_texture.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/IMG_program_binary.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/IMG_read_format.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/IMG_shader_binary.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/IMG_texture_compression_pvrtc.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/KHR_debug.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/KHR_texture_compression_astc_ldr.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_coverage_sample.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_depth_nonlinear.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_draw_buffers.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_fbo_color_attachments.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_fence.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_read_buffer.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_read_buffer_front.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_read_depth.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_read_depth_stencil.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_read_stencil.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_texture_compression_s3tc_update.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/NV_texture_npot_2D_mipmap.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_EGL_image.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_EGL_image_external.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_compressed_ETC1_RGB8_texture.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_compressed_paletted_texture.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_depth24.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_depth32.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_depth_texture.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_element_index_uint.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_get_program_binary.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_mapbuffer.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_packed_depth_stencil.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_required_internalformat.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_rgb8_rgba8.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_standard_derivatives.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_stencil1.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_stencil4.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_surfaceless_context.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_texture_3D.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_texture_float.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_texture_float_linear.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_texture_half_float.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_texture_half_float_linear.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_texture_npot.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_vertex_array_object.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_vertex_half_float.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/OES_vertex_type_10_10_10_2.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/QCOM_alpha_test.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/QCOM_binning_control.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/QCOM_driver_control.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/QCOM_extended_get.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/QCOM_extended_get2.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/QCOM_perfmon_global_mode.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/QCOM_tiled_rendering.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/QCOM_writeonly_rendering.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/VIV_shader_binary.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_color_buffer_float.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_compressed_texture_atc.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_compressed_texture_etc.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_compressed_texture_etc1.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_compressed_texture_pvrtc.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_compressed_texture_s3tc.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_debug_renderer_info.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_debug_shaders.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_depth_texture.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_draw_buffers.hx (100%) rename {lime => src/lime}/graphics/opengl/ext/WEBGL_lose_context.hx (100%) rename {lime/math/color => src/lime/math}/ARGB.hx (99%) rename {lime/math/color => src/lime/math}/BGRA.hx (99%) rename {lime => src/lime}/math/ColorMatrix.hx (100%) rename {lime => src/lime}/math/Matrix3.hx (100%) rename {lime => src/lime}/math/Matrix4.hx (100%) rename {lime/math/color => src/lime/math}/RGBA.hx (98%) rename {lime => src/lime}/math/Rectangle.hx (100%) rename {lime => src/lime}/math/Vector2.hx (100%) rename {lime => src/lime}/math/Vector4.hx (100%) rename {lime => src/lime}/media/ALAudioContext.hx (100%) rename {lime => src/lime}/media/ALCAudioContext.hx (100%) rename {lime => src/lime}/media/AudioBuffer.hx (84%) rename {lime => src/lime}/media/AudioContext.hx (100%) rename {lime => src/lime}/media/AudioManager.hx (94%) rename {lime => src/lime}/media/AudioSource.hx (66%) rename {lime => src/lime}/media/FlashAudioContext.hx (100%) rename {lime => src/lime}/media/HTML5AudioContext.hx (100%) rename {lime => src/lime}/media/WebAudioContext.hx (100%) rename {lime => src/lime}/media/howlerjs/Howl.hx (100%) rename {lime => src/lime}/media/howlerjs/Howler.hx (100%) rename {lime => src/lime}/media/openal/AL.hx (99%) rename {lime => src/lime}/media/openal/ALAuxiliaryEffectSlot.hx (100%) rename {lime => src/lime}/media/openal/ALBuffer.hx (100%) rename {lime => src/lime}/media/openal/ALC.hx (98%) rename {lime => src/lime}/media/openal/ALContext.hx (100%) rename {lime => src/lime}/media/openal/ALDevice.hx (100%) rename {lime => src/lime}/media/openal/ALEffect.hx (100%) rename {lime => src/lime}/media/openal/ALFilter.hx (100%) rename {lime => src/lime}/media/openal/ALSource.hx (100%) rename {lime/media/codecs => src/lime/media}/vorbis/Vorbis.hx (94%) rename {lime/media/codecs => src/lime/media}/vorbis/VorbisComment.hx (80%) rename {lime/media/codecs => src/lime/media}/vorbis/VorbisFile.hx (98%) rename {lime/media/codecs => src/lime/media}/vorbis/VorbisInfo.hx (88%) rename {lime => src/lime}/net/HTTPRequest.hx (86%) rename {lime => src/lime}/net/HTTPRequestHeader.hx (100%) rename {lime => src/lime}/net/HTTPRequestMethod.hx (100%) rename {lime => src/lime}/net/URIParser.hx (100%) rename {lime => src/lime}/net/curl/CURL.hx (96%) rename {lime => src/lime}/net/curl/CURLCode.hx (100%) rename {lime => src/lime}/net/curl/CURLInfo.hx (100%) rename {lime => src/lime}/net/curl/CURLMulti.hx (91%) rename {lime => src/lime}/net/curl/CURLMultiCode.hx (100%) rename {lime => src/lime}/net/curl/CURLMultiMessage.hx (100%) rename {lime => src/lime}/net/curl/CURLMultiOption.hx (100%) rename {lime => src/lime}/net/curl/CURLOption.hx (100%) rename {lime => src/lime}/net/curl/CURLVersion.hx (100%) rename {lime => src/lime}/net/oauth/OAuthClient.hx (96%) rename {lime => src/lime}/net/oauth/OAuthConsumer.hx (91%) rename {lime => src/lime}/net/oauth/OAuthRequest.hx (95%) rename {lime => src/lime}/net/oauth/OAuthSignatureMethod.hx (94%) rename {lime => src/lime}/net/oauth/OAuthToken.hx (100%) rename {lime => src/lime}/net/oauth/OAuthVersion.hx (91%) rename {lime => src/lime}/system/BackgroundWorker.hx (94%) rename {lime => src/lime}/system/CFFI.hx (99%) rename {lime => src/lime}/system/CFFIPointer.hx (95%) rename {lime => src/lime}/system/Clipboard.hx (88%) rename {lime => src/lime}/system/Display.hx (100%) rename {lime => src/lime}/system/DisplayMode.hx (100%) rename {lime => src/lime}/system/Endian.hx (100%) rename {lime => src/lime}/system/FileWatcher.hx (82%) rename {lime => src/lime}/system/JNI.hx (96%) rename {lime => src/lime}/system/Locale.hx (100%) rename {lime => src/lime}/system/Sensor.hx (100%) rename {lime => src/lime}/system/SensorType.hx (100%) rename {lime => src/lime}/system/System.hx (99%) rename {lime => src/lime}/system/ThreadPool.hx (93%) rename {lime => src/lime}/text/Font.hx (98%) rename {lime => src/lime}/text/Glyph.hx (100%) rename {lime => src/lime}/text/GlyphMetrics.hx (100%) rename {lime => src/lime}/text/UTF8String.hx (99%) rename {lime => src/lime}/text/harfbuzz/HB.hx (72%) rename {lime => src/lime}/ui/FileDialog.hx (98%) rename {lime => src/lime}/ui/FileDialogType.hx (100%) rename {lime => src/lime}/ui/Gamepad.hx (95%) rename {lime => src/lime}/ui/GamepadAxis.hx (100%) rename {lime => src/lime}/ui/GamepadButton.hx (100%) rename {lime => src/lime}/ui/Haptic.hx (88%) rename {lime => src/lime}/ui/Joystick.hx (97%) rename {lime => src/lime}/ui/JoystickHatPosition.hx (100%) rename {lime => src/lime}/ui/KeyCode.hx (98%) rename {lime => src/lime}/ui/KeyModifier.hx (100%) rename {lime => src/lime}/ui/Mouse.hx (78%) rename {lime => src/lime}/ui/MouseCursor.hx (100%) rename {lime => src/lime}/ui/ScanCode.hx (98%) rename {lime => src/lime}/ui/Touch.hx (100%) rename {lime => src/lime}/ui/Window.hx (94%) rename {lime => src/lime}/utils/ArrayBuffer.hx (100%) rename {lime => src/lime}/utils/ArrayBufferView.hx (100%) rename {lime => src/lime}/utils/AssetCache.hx (98%) rename {lime => src/lime}/utils/AssetLibrary.hx (100%) rename {lime => src/lime}/utils/AssetManifest.hx (100%) rename {lime => src/lime}/utils/AssetType.hx (100%) rename {lime => src/lime}/utils/Assets.hx (100%) rename {lime => src/lime}/utils/BytePointer.hx (100%) rename {lime => src/lime}/utils/Bytes.hx (68%) create mode 100644 src/lime/utils/CompressionAlgorithm.hx rename {lime => src/lime}/utils/DataPointer.hx (99%) rename {lime => src/lime}/utils/DataView.hx (100%) rename {lime => src/lime}/utils/Float32Array.hx (100%) rename {lime => src/lime}/utils/Float64Array.hx (100%) rename {lime => src/lime}/utils/GLUtils.hx (100%) rename {lime => src/lime}/utils/Int16Array.hx (100%) rename {lime => src/lime}/utils/Int32Array.hx (97%) rename {lime => src/lime}/utils/Int8Array.hx (100%) rename {lime => src/lime}/utils/Log.hx (57%) create mode 100644 src/lime/utils/LogLevel.hx rename {lime => src/lime}/utils/ObjectPool.hx (94%) rename {lime => src/lime}/utils/PackedAssetLibrary.hx (89%) rename {lime/app => src/lime/utils}/Preloader.hx (99%) rename {lime => src/lime}/utils/Resource.hx (100%) rename {lime => src/lime}/utils/UInt16Array.hx (100%) rename {lime => src/lime}/utils/UInt32Array.hx (100%) rename {lime => src/lime}/utils/UInt8Array.hx (97%) rename {lime => src/lime}/utils/UInt8ClampedArray.hx (100%) diff --git a/.gitignore b/.gitignore index e40f3ed76..a1c3ab8a9 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,8 @@ haxedoc.xml docs/api/*.xml docs/api/xml docs/api/pages* +docs/.sass-cache +docs/_site legacy/ndll/*/lime* legacy/ndll/*/liblime* legacy/project/all_objs diff --git a/docs/api/ImportAll.hx b/docs/api/ImportAll.hx index c5f315992..b515bf77b 100644 --- a/docs/api/ImportAll.hx +++ b/docs/api/ImportAll.hx @@ -7,7 +7,6 @@ import lime.app.Event; import lime.app.Future; import lime.app.IModule; import lime.app.Module; -import lime.app.Preloader; import lime.app.Promise; import lime.graphics.cairo.Cairo; import lime.graphics.cairo.CairoAntialias; @@ -29,15 +28,10 @@ import lime.graphics.cairo.CairoPattern; import lime.graphics.cairo.CairoStatus; import lime.graphics.cairo.CairoSubpixelOrder; import lime.graphics.cairo.CairoSurface; -import lime.graphics.format.BMP; -import lime.graphics.format.JPEG; -import lime.graphics.format.PNG; import lime.graphics.opengl.GL; import lime.graphics.opengl.GLActiveInfo; import lime.graphics.opengl.GLBuffer; import lime.graphics.opengl.GLContextAttributes; -import lime.graphics.opengl.GLES2Context; -import lime.graphics.opengl.GLES3Context; import lime.graphics.opengl.GLFramebuffer; import lime.graphics.opengl.GLProgram; import lime.graphics.opengl.GLQuery; @@ -50,44 +44,47 @@ import lime.graphics.opengl.GLTexture; import lime.graphics.opengl.GLTransformFeedback; import lime.graphics.opengl.GLUniformLocation; import lime.graphics.opengl.GLVertexArrayObject; -import lime.graphics.opengl.WebGL2Context; -import lime.graphics.opengl.WebGLContext; -import lime.graphics.utils.ImageCanvasUtil; -import lime.graphics.utils.ImageDataUtil; import lime.graphics.CairoRenderContext; import lime.graphics.CanvasRenderContext; import lime.graphics.DOMRenderContext; import lime.graphics.FlashRenderContext; -import lime.graphics.GLRenderContext; import lime.graphics.Image; import lime.graphics.ImageBuffer; import lime.graphics.ImageChannel; +import lime.graphics.ImageFileFormat; import lime.graphics.ImageType; +import lime.graphics.OpenGLES2RenderContext; +import lime.graphics.OpenGLES3RenderContext; +import lime.graphics.OpenGLRenderContext; import lime.graphics.PixelFormat; import lime.graphics.RenderContext; -import lime.graphics.Renderer; -import lime.graphics.RendererType; -import lime.math.color.ARGB; -import lime.math.color.BGRA; -import lime.math.color.RGBA; +import lime.graphics.RenderContextType; +import lime.graphics.WebGL2RenderContext; +import lime.graphics.WebGLRenderContext; +import lime.math.ARGB; +import lime.math.BGRA; import lime.math.ColorMatrix; import lime.math.Matrix3; import lime.math.Matrix4; import lime.math.Rectangle; +import lime.math.RGBA; import lime.math.Vector2; import lime.math.Vector4; -import lime.media.codecs.vorbis.Vorbis; -import lime.media.codecs.vorbis.VorbisComment; -import lime.media.codecs.vorbis.VorbisFile; -import lime.media.codecs.vorbis.VorbisInfo; import lime.media.howlerjs.Howl; import lime.media.howlerjs.Howler; import lime.media.openal.AL; +import lime.media.openal.ALAuxiliaryEffectSlot; import lime.media.openal.ALBuffer; import lime.media.openal.ALC; import lime.media.openal.ALContext; import lime.media.openal.ALDevice; +import lime.media.openal.ALEffect; +import lime.media.openal.ALFilter; import lime.media.openal.ALSource; +import lime.media.vorbis.Vorbis; +import lime.media.vorbis.VorbisComment; +import lime.media.vorbis.VorbisFile; +import lime.media.vorbis.VorbisInfo; import lime.media.ALAudioContext; import lime.media.ALCAudioContext; import lime.media.AudioBuffer; @@ -116,32 +113,6 @@ import lime.net.HTTPRequest; import lime.net.HTTPRequestHeader; import lime.net.HTTPRequestMethod; import lime.net.URIParser; -#if (windows || mac || linux || neko) -import lime.project.ApplicationData; -import lime.project.Architecture; -import lime.project.Asset; -import lime.project.AssetEncoding; -import lime.project.AssetType; -import lime.project.Command; -import lime.project.ConfigData; -import lime.project.Dependency; -import lime.project.HXProject; -import lime.project.Haxelib; -import lime.project.Icon; -import lime.project.Keystore; -import lime.project.Library; -import lime.project.MetaData; -import lime.project.ModuleData; -import lime.project.NDLL; -import lime.project.NDLLType; -import lime.project.Orientation; -import lime.project.Platform; -import lime.project.PlatformTarget; -import lime.project.PlatformType; -import lime.project.ProjectXMLParser; -import lime.project.SplashScreen; -import lime.project.WindowData; -#end import lime.system.BackgroundWorker; import lime.system.CFFI; import lime.system.CFFIPointer; @@ -149,65 +120,18 @@ import lime.system.Clipboard; import lime.system.Display; import lime.system.DisplayMode; import lime.system.Endian; +import lime.system.FileWatcher; import lime.system.JNI; import lime.system.Locale; import lime.system.Sensor; import lime.system.SensorType; import lime.system.System; import lime.system.ThreadPool; +// TODO: Harfbuzz import lime.text.Font; import lime.text.Glyph; import lime.text.GlyphMetrics; -import lime.text.GlyphPosition; -import lime.text.TextDirection; -import lime.text.TextLayout; -import lime.text.TextScript; -#if (windows || mac || linux || neko) -import lime.tools.helpers.AIRHelper; -import lime.tools.helpers.AndroidHelper; -import lime.tools.helpers.AntHelper; -import lime.tools.helpers.ArrayHelper; -import lime.tools.helpers.AssetHelper; -import lime.tools.helpers.BlackBerryHelper; -import lime.tools.helpers.CLIHelper; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.CSHelper; -import lime.tools.helpers.CompatibilityHelper; -import lime.tools.helpers.CordovaHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.FlashHelper; -import lime.tools.helpers.HTML5Helper; -import lime.tools.helpers.IOSHelper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.ImageHelper; -import lime.tools.helpers.JavaHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.ModuleHelper; -import lime.tools.helpers.NekoHelper; -import lime.tools.helpers.NodeJSHelper; -import lime.tools.helpers.ObjectHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.StringHelper; -import lime.tools.helpers.StringMapHelper; -import lime.tools.helpers.TizenHelper; -import lime.tools.helpers.WebOSHelper; -import lime.tools.helpers.ZipHelper; -import lime.tools.platforms.AndroidPlatform; -import lime.tools.platforms.BlackBerryPlatform; -import lime.tools.platforms.EmscriptenPlatform; -import lime.tools.platforms.FirefoxPlatform; -import lime.tools.platforms.FlashPlatform; -import lime.tools.platforms.HTML5Platform; -import lime.tools.platforms.IOSPlatform; -import lime.tools.platforms.LinuxPlatform; -import lime.tools.platforms.MacPlatform; -import lime.tools.platforms.TizenPlatform; -import lime.tools.platforms.TVOSPlatform; -import lime.tools.platforms.WebOSPlatform; -import lime.tools.platforms.WindowsPlatform; -#end +import lime.text.UTF8String; import lime.ui.FileDialog; import lime.ui.FileDialogType; import lime.ui.Gamepad; @@ -223,10 +147,6 @@ import lime.ui.MouseCursor; import lime.ui.ScanCode; import lime.ui.Touch; import lime.ui.Window; -import lime.utils.compress.Deflate; -import lime.utils.compress.GZip; -import lime.utils.compress.LZMA; -import lime.utils.compress.Zlib; import lime.utils.ArrayBuffer; import lime.utils.ArrayBufferView; import lime.utils.AssetCache; @@ -236,18 +156,21 @@ import lime.utils.Assets; import lime.utils.AssetType; import lime.utils.BytePointer; import lime.utils.Bytes; +import lime.utils.CompressionAlgorithm; import lime.utils.DataPointer; import lime.utils.DataView; import lime.utils.Float32Array; import lime.utils.Float64Array; -import lime.utils.GLUtils; import lime.utils.Int16Array; import lime.utils.Int32Array; import lime.utils.Int8Array; import lime.utils.Log; +import lime.utils.LogLevel; import lime.utils.ObjectPool; +import lime.utils.PackedAssetLibrary; +import lime.utils.Preloader; +import lime.utils.Resource; import lime.utils.UInt16Array; import lime.utils.UInt32Array; import lime.utils.UInt8Array; -import lime.utils.UInt8ClampedArray; -//import lime.vm.NekoVM; \ No newline at end of file +import lime.utils.UInt8ClampedArray; \ No newline at end of file diff --git a/extraParams.hxml b/extraParams.hxml index 090eb6eae..8fa3d6a3d 100644 --- a/extraParams.hxml +++ b/extraParams.hxml @@ -1 +1 @@ ---macro lime.Lib.extraParams() \ No newline at end of file +--macro lime._internal.macros.DefineMacro.run() \ No newline at end of file diff --git a/haxelib.json b/haxelib.json index 442fbc541..cf6d35e48 100644 --- a/haxelib.json +++ b/haxelib.json @@ -6,5 +6,6 @@ "description": "A foundational Haxe framework for cross-platform development", "version": "7.0.0", "releasenote": "", - "contributors": [ "singmajesty" ] + "contributors": [ "singmajesty" ], + "classPath": "src" } \ No newline at end of file diff --git a/lime/Assets.hx b/lime/Assets.hx deleted file mode 100644 index ae0c78e4e..000000000 --- a/lime/Assets.hx +++ /dev/null @@ -1,4 +0,0 @@ -package lime; - - -typedef Assets = lime.utils.Assets; \ No newline at end of file diff --git a/lime/graphics/ConsoleRenderContext.hx b/lime/graphics/ConsoleRenderContext.hx deleted file mode 100644 index f3eb4cc81..000000000 --- a/lime/graphics/ConsoleRenderContext.hx +++ /dev/null @@ -1,137 +0,0 @@ -package lime.graphics; #if lime_console - - -import cpp.Float32; -import cpp.UInt8; -import cpp.UInt16; -import cpp.UInt32; -import cpp.Pointer; -import lime.ConsoleIncludePaths; -import lime.graphics.console.IndexBuffer; -import lime.graphics.console.Shader; -import lime.graphics.console.Primitive; -import lime.graphics.console.RenderState; -import lime.graphics.console.Texture; -import lime.graphics.console.TextureAddressMode; -import lime.graphics.console.TextureFilter; -import lime.graphics.console.TextureFormat; -import lime.graphics.console.VertexBuffer; -import lime.graphics.console.VertexDecl; -import lime.math.Matrix4; -import lime.utils.Float32Array; - - -@:include("ConsoleRenderContext.h") -@:native("cpp::Struct") -extern class ConsoleRenderContext { - - @:native("ConsoleRenderContext()") - public static var singleton:ConsoleRenderContext; - - public var width (get, never):Int; - public var height (get, never):Int; - - public function createIndexBuffer (count:Int):IndexBuffer; - public function createVertexBuffer (decl:VertexDecl, count:Int):VertexBuffer; - public function createTexture (format:TextureFormat, width:Int, height:Int, data:Pointer):Texture; - - public function transientIndexBuffer (count:Int):IndexBuffer; - public function transientVertexBuffer (decl:VertexDecl, count:Int):VertexBuffer; - - public function destroyIndexBuffer (ib:IndexBuffer):Void; - public function destroyVertexBuffer (vb:VertexBuffer):Void; - public function destroyTexture (tex:Texture):Void; - - public function lookupShader (name:String):Shader; - - @:overload(function(r:UInt8, g:UInt8, b:UInt8, a:UInt8):Void{}) - @:overload(function(r:UInt8, g:UInt8, b:UInt8, a:UInt8, depth:Float32):Void{}) - public function clear ( - r:UInt8, g:UInt8, b:UInt8, a:UInt8, - depth:Float32 /* = 1.0 */, - stencil:UInt8 /* = 0 */ - ):Void; - - public function bindShader (shader:Shader):Void; - - @:overload(function(x:UInt16, y:UInt16, width:UInt16, height:UInt16):Void{}) - @:overload(function(x:UInt16, y:UInt16, width:UInt16, height:UInt16, nearPlane:Float32):Void{}) - public function setViewport ( - x:UInt16, y:UInt16, width:UInt16, height:UInt16, - nearPlane:Float32 /* = 0.0 */, - farPlane:Float32 /* = 1.0 */ - ):Void; - - public function setRasterizerState (state:RasterizerState):Void; - public function setDepthStencilState (state:DepthStencilState):Void; - public function setBlendState (state:BlendState):Void; - - public function setPixelShaderConstantF (startRegister:Int, vec4:Pointer, vec4count:Int):Void; - public function setVertexShaderConstantF (startRegister:Int, vec4:Pointer, vec4count:Int):Void; - - public function setVertexSource (vb:VertexBuffer):Void; - public function setIndexSource (ib:IndexBuffer):Void; - - public function setTexture (sampler:Int, texture:Texture):Void; - public function setTextureFilter (sampler:Int, min:TextureFilter, mag:TextureFilter):Void; - public function setTextureAddressMode (sampler:Int, u:TextureAddressMode, v:TextureAddressMode):Void; - - public function draw (primitive:Primitive, startVertex:UInt32, primitiveCount:UInt32):Void; - public function drawIndexed (primitive:Primitive, vertexCount:UInt32, startIndex:UInt32, primitiveCount:UInt32):Void; - - public function debugReadFrameBuffer (dest:Pointer, width:Int, height:Int):Void; - - private function get_width ():Int; - private function get_height ():Int; - -} - - -#else - - -import lime.graphics.console.Shader; -import lime.graphics.console.Primitive; -import lime.graphics.console.IndexBuffer; -import lime.graphics.console.VertexBuffer; - - -class ConsoleRenderContext { - - - public function new () { - - - - } - - - public var width (get, never):Int; - public var height (get, never):Int; - - public function createIndexBuffer (indices, count:Int):IndexBuffer { return new IndexBuffer (); } - public function createVertexBuffer (decl, count:Int):VertexBuffer { return new VertexBuffer (); } - public function lookupShader (name:String):Shader { return new Shader (); } - - public function clear (r:Int, g:Int, b:Int, a:Int, depth:Float = 1.0, stencil:Int = 0):Void {} - - public function bindShader (shader:Shader):Void {} - - public function setViewport (x, y, width, height, nearPlane = 0.0, farPlane = 1.0):Void {} - - public function setVertexShaderConstantF (startRegister, vec4, vec4count):Void {} - - public function setVertexSource (vb:VertexBuffer):Void {} - public function setIndexSource (ib:IndexBuffer):Void {} - - public function draw (primitive, startVertex, primitiveCount):Void {} - public function drawIndexed (primitive, vertexCount, startIndex, primitiveCount):Void {} - - private function get_width ():Int { return 0; } - private function get_height ():Int { return 0; } - - -} - - -#end diff --git a/lime/graphics/console/IndexBuffer.hx b/lime/graphics/console/IndexBuffer.hx deleted file mode 100644 index d47f5949d..000000000 --- a/lime/graphics/console/IndexBuffer.hx +++ /dev/null @@ -1,29 +0,0 @@ -package lime.graphics.console; #if lime_console - - -import cpp.Pointer; -import cpp.UInt16; -import lime.ConsoleIncludePaths; - - -@:include("ConsoleIndexBuffer.h") -@:native("cpp::Struct") -extern class IndexBuffer { - - public function lock ():Pointer; - public function unlock ():Void; - -} - - -#else - - -class IndexBuffer { - - public function new () {} - -} - - -#end diff --git a/lime/graphics/console/PointerUtil.hx b/lime/graphics/console/PointerUtil.hx deleted file mode 100644 index 131303d93..000000000 --- a/lime/graphics/console/PointerUtil.hx +++ /dev/null @@ -1,34 +0,0 @@ -package lime.graphics.console; #if lime_console - - -import cpp.Float32; -import cpp.Pointer; -import lime.math.Matrix4; -import lime.utils.Float32Array; - - -class PointerUtil { - - public static inline function fromMatrix (m:Matrix4):Pointer { - - var array:Float32Array = m; - var bytePtr = Pointer.arrayElem (array.buffer.getData (), 0); - return untyped __cpp__ ("(float *){0}", bytePtr.raw); - - } - -} - - -#else - - -class PointerUtil { - - public static function fromMatrix (m:Matrix4):Int { return 0; } - -} - - -#end - diff --git a/lime/graphics/console/Primitive.hx b/lime/graphics/console/Primitive.hx deleted file mode 100644 index bddc73f5e..000000000 --- a/lime/graphics/console/Primitive.hx +++ /dev/null @@ -1,29 +0,0 @@ -package lime.graphics.console; #if lime_console - - -@:enum abstract Primitive (cpp.UInt32) { - - var Point = 0; - var Line = 1; - var LineStrip = 2; - var Triangle = 3; - var TriangleStrip = 4; - -} - - -#else - - -enum Primitive { - - Point; - Line; - LineStrip; - Triangle; - TriangleStrip; - -} - - -#end diff --git a/lime/graphics/console/RenderState.hx b/lime/graphics/console/RenderState.hx deleted file mode 100644 index acf1af5ae..000000000 --- a/lime/graphics/console/RenderState.hx +++ /dev/null @@ -1,50 +0,0 @@ -package lime.graphics.console; - - -@:enum abstract RasterizerState(Int) { - - var CULLNONE_WIREFRAME = 0; - var CULLCW_WIREFRAME = 1; - var CULLCCW_WIREFRAME = 2; - var CULLNONE_SOLID = 3; - var CULLCW_SOLID = 4; - var CULLCCW_SOLID = 5; - -} - - -@:enum abstract DepthStencilState(Int) { - - var DEPTHTESTOFF_DEPTHWRITEOFF_STENCILOFF = 0; - var DEPTHTESTON_DEPTHWRITEON_DEPTHLESS_STENCILOFF = 1; - var DEPTHTESTON_DEPTHWRITEOFF_DEPTHLESS_STENCILOFF = 2; - var DEPTHTESTOFF_DEPTHWRITEON_DEPTHLESS_STENCILOFF = 3; - var DEPTHTESTON_DEPTHWRITEON_DEPTHALWAYS_STENCILOFF = 4; - -} - - -@:enum abstract BlendState(Int) { - - var NONE_A = 0; - var NONE_RGB = 1; - var NONE_RGBA = 2; - var SRCALPHA_INVSRCALPHA_ONE_ZERO_RGB = 3; - var SRCALPHA_INVSRCALPHA_ONE_ZERO_RGBA = 4; - var SRCALPHA_INVSRCALPHA_SRCALPHA_INVSRCALPHA_RGBA = 5; - var SRCALPHA_INVSRCALPHA_INVDESTALPHA_ONE_RGBA = 6; - var ZERO_INVSRCCOLOR_ONE_ZERO_RGBA = 7; - var ZERO_SRCCOLOR_ONE_ZERO_RGBA = 8; - var SRCALPHA_ONE_ONE_ZERO_RGB = 9; - var SRCALPHA_ONE_ONE_ZERO_RGBA = 10; - var SRCALPHA_ONE_ONE_ONE_RGBA = 11; - var DESTCOLOR_INVSRCALPHA_ONE_ZERO_RGB = 12; - var DESTCOLOR_INVSRCALPHA_ONE_ZERO_RGBA = 13; - var DESTCOLOR_SRCCOLOR_ONE_ZERO_RGB = 14; - var DESTCOLOR_SRCCOLOR_ONE_ZERO_RGBA = 15; - var ONE_ONE_ONE_ZERO_RGBA = 16; - var ONE_ONE_ONE_ONE_RGBA = 17; - var ONE_ZERO_ONE_ZERO_RGBA = 18; - var ZERO_ONE_ZERO_ONE = 19; - -} diff --git a/lime/graphics/console/Shader.hx b/lime/graphics/console/Shader.hx deleted file mode 100644 index 57282d7e1..000000000 --- a/lime/graphics/console/Shader.hx +++ /dev/null @@ -1,25 +0,0 @@ -package lime.graphics.console; #if lime_console - - -import lime.ConsoleIncludePaths; - - -@:include("ConsoleShader.h") -@:native("cpp::Struct") -extern class Shader { - - -} - - -#else - - -class Shader { - - public function new () {} - -} - - -#end diff --git a/lime/graphics/console/Texture.hx b/lime/graphics/console/Texture.hx deleted file mode 100644 index 461b5e476..000000000 --- a/lime/graphics/console/Texture.hx +++ /dev/null @@ -1,34 +0,0 @@ -package lime.graphics.console; #if lime_console - - -import cpp.UInt8; -import cpp.Pointer; -import lime.ConsoleIncludePaths; - - -@:include("ConsoleTexture.h") -@:native("cpp::Struct") -extern class Texture { - - // valid returns true if this represents a non-zero handle to a texture. - public var valid (get, never):Bool; - - public function update (data:TextureData):Void; - public function updateFromRGBA (data:Pointer):Void; - - private function get_valid ():Bool; - -} - - -#else - - -class Texture { - - public function new () {} - -} - - -#end diff --git a/lime/graphics/console/TextureAddressMode.hx b/lime/graphics/console/TextureAddressMode.hx deleted file mode 100644 index 072eea398..000000000 --- a/lime/graphics/console/TextureAddressMode.hx +++ /dev/null @@ -1,10 +0,0 @@ -package lime.graphics.console; - - -@:enum abstract TextureAddressMode(Int) { - - var Clamp = 0; - var Wrap = 1; - -} - diff --git a/lime/graphics/console/TextureData.hx b/lime/graphics/console/TextureData.hx deleted file mode 100644 index ed91cb07b..000000000 --- a/lime/graphics/console/TextureData.hx +++ /dev/null @@ -1,41 +0,0 @@ -package lime.graphics.console; #if lime_console - - -import cpp.Pointer; -import cpp.UInt8; -import lime.ConsoleIncludePaths; - - -@:include("ConsoleTextureData.h") -@:native("cpp::Struct") -extern class TextureData { - - - // valid returns true if this represents a non-zero handle to texture data. - public var valid (get, never):Bool; - - public var width (get, never):Int; - public var height (get, never):Int; - - - // fromFile loads texture data from the named file. - @:native("lime::ConsoleTextureData::fromFile") - public static function fromFile (name:String):TextureData; - - // decode does any decompression or whatever is necessary to output lime's - // standard RGBA. - public function decode (dest:Pointer, destSize:Int):Void; - - // release releases the texture data. - public function release ():Void; - - - private function get_valid ():Bool; - private function get_width ():Int; - private function get_height ():Int; - - -} - - -#end diff --git a/lime/graphics/console/TextureFilter.hx b/lime/graphics/console/TextureFilter.hx deleted file mode 100644 index 5e0bf9643..000000000 --- a/lime/graphics/console/TextureFilter.hx +++ /dev/null @@ -1,10 +0,0 @@ -package lime.graphics.console; - - -@:enum abstract TextureFilter(Int) { - - var Nearest = 0; - var Linear = 1; - -} - diff --git a/lime/graphics/console/TextureFormat.hx b/lime/graphics/console/TextureFormat.hx deleted file mode 100644 index 44fde2f54..000000000 --- a/lime/graphics/console/TextureFormat.hx +++ /dev/null @@ -1,9 +0,0 @@ -package lime.graphics.console; - - -@:enum abstract TextureFormat(Int) { - - var ARGB = 0; - -} - diff --git a/lime/graphics/console/VertexBuffer.hx b/lime/graphics/console/VertexBuffer.hx deleted file mode 100644 index 7fa6af84b..000000000 --- a/lime/graphics/console/VertexBuffer.hx +++ /dev/null @@ -1,34 +0,0 @@ -package lime.graphics.console; #if lime_console - - -import lime.graphics.console.VertexOutput; -import lime.ConsoleIncludePaths; - - -@:include("ConsoleVertexBuffer.h") -@:native("cpp::Struct") -extern class VertexBuffer { - - public function lock ():VertexOutput; - public function unlock ():Void; - -} - - -#else - - -import lime.graphics.console.VertexOutput; - - -class VertexBuffer { - - public function new () {} - - public function lock ():VertexOutput { return new VertexOutput (); } - public function unlock ():Void {} - -} - - -#end diff --git a/lime/graphics/console/VertexDecl.hx b/lime/graphics/console/VertexDecl.hx deleted file mode 100644 index 8877cd2bf..000000000 --- a/lime/graphics/console/VertexDecl.hx +++ /dev/null @@ -1,12 +0,0 @@ -package lime.graphics.console; - - -@:enum abstract VertexDecl(Int) { - - var Position = 0; // xyz [3]f32 - var PositionTexcoord = 5; // xyz [3]f32, uv [2]f32 - var PositionColor = 13; // xyz [3]f32, rgba [4]u8 - var PositionTexcoordColor = 4; // xyz [3]f32, uv [2]f32, rgba [4]u8 - -} - diff --git a/lime/graphics/console/VertexOutput.hx b/lime/graphics/console/VertexOutput.hx deleted file mode 100644 index f8861ae21..000000000 --- a/lime/graphics/console/VertexOutput.hx +++ /dev/null @@ -1,35 +0,0 @@ -package lime.graphics.console; #if lime_console - - -import cpp.Float32; -import cpp.UInt8; -import lime.ConsoleIncludePaths; - - -@:include("ConsoleVertexOutput.h") -@:native("cpp::Struct") -extern class VertexOutput { - - public function vec2 (x:Float32, y:Float32):Void; - public function vec3 (x:Float32, y:Float32, z:Float32):Void; - public function color (r:UInt8, g:UInt8, b:UInt8, a:UInt8):Void; - -} - - -#else - - -class VertexOutput { - - public function new () {} - - public function vec2 (x, y):Void {} - public function vec3 (x, y, z):Void {} - public function color (r, g, b, a):Void {} - -} - - -#end - diff --git a/lime/media/fmod/FMODChannel.hx b/lime/media/fmod/FMODChannel.hx deleted file mode 100644 index c779d3fed..000000000 --- a/lime/media/fmod/FMODChannel.hx +++ /dev/null @@ -1,54 +0,0 @@ -package lime.media.fmod; -#if lime_console - - -import lime.ConsoleIncludePaths; - - -@:include("ConsoleFmodChannel.h") -@:native("cpp::Struct") -extern class FMODChannel { - - - // valid is true if this represents a valid handle to a channel. - public var valid (get, never):Bool; - - - // pause sets channel to a paused state. - public function pause ():Void; - - // resume sets channel to an unpaused state. - public function resume ():Void; - - // stop stops the channel from playing, making it available for another - // sound to use. - public function stop ():Void; - - - // getLoopCount retrieves the current loop count for the channel. - public function getLoopCount ():Int; - - // setLoopCount sets the channel to loop count times before stopping. - public function setLoopCount (count:Int):Void; - - // getVolume retrieves the current linear volume level of the channel. - public function getVolume ():cpp.Float32; - - // setVolume sets the channel's linear volume level. - public function setVolume (volume:cpp.Float32):Void; - - - // INVALID represents an invalid channel handle - public static var INVALID (get, never):FMODChannel; - - - private function get_valid ():Bool; - - @:native("lime::ConsoleFmodChannel") - private static function get_INVALID ():FMODChannel; - - -} - - -#end diff --git a/lime/media/fmod/FMODMode.hx b/lime/media/fmod/FMODMode.hx deleted file mode 100644 index ef4890dda..000000000 --- a/lime/media/fmod/FMODMode.hx +++ /dev/null @@ -1,16 +0,0 @@ -package lime.media.fmod; -#if lime_console - - -import lime.ConsoleIncludePaths; - - -@:enum abstract FMODMode(Int) { - - var LOOP_OFF = 0x00000001; - var LOOP_NORMAL = 0x00000002; - -} - - -#end diff --git a/lime/media/fmod/FMODSound.hx b/lime/media/fmod/FMODSound.hx deleted file mode 100644 index 5d7d014ee..000000000 --- a/lime/media/fmod/FMODSound.hx +++ /dev/null @@ -1,36 +0,0 @@ -package lime.media.fmod; -#if lime_console - - -import lime.ConsoleIncludePaths; - - -@:include("ConsoleFmodSound.h") -@:native("cpp::Struct") -extern class FMODSound { - - - // valid returns true if this represents a valid handle to a sound. - public var valid (get, never):Bool; - - - // fromFile creates a sound from the named file. - @:native("lime::ConsoleFmodSound::fromFile") - public static function fromFile (name:String, mode:FMODMode):FMODSound; - - - // play plays the sound and returns the channel it was assigned. - public function play ():FMODChannel; - - - // release releases the sound. - public function release ():Void; - - - private function get_valid ():Bool; - - -} - - -#end diff --git a/lime/project/ApplicationData.hx b/lime/project/ApplicationData.hx deleted file mode 100644 index 5dbd44d8c..000000000 --- a/lime/project/ApplicationData.hx +++ /dev/null @@ -1,14 +0,0 @@ -package lime.project; - - -typedef ApplicationData = { - - @:optional var file:String; - @:optional var init:String; - @:optional var main:String; - @:optional var path:String; - @:optional var preloader:String; - @:optional var swfVersion:Float; - @:optional var url:String; - -} \ No newline at end of file diff --git a/lime/project/Architecture.hx b/lime/project/Architecture.hx deleted file mode 100644 index 357dfe79e..000000000 --- a/lime/project/Architecture.hx +++ /dev/null @@ -1,16 +0,0 @@ -package lime.project; - - -enum Architecture { - - ARMV5; - ARMV6; - ARMV7; - ARMV7S; - ARM64; - X86; - X64; - MIPS; - MIPSEL; - -} \ No newline at end of file diff --git a/lime/project/Asset.hx b/lime/project/Asset.hx deleted file mode 100644 index 17abadeb0..000000000 --- a/lime/project/Asset.hx +++ /dev/null @@ -1,146 +0,0 @@ -package lime.project; - - -import haxe.io.Path; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.ObjectHelper; -import lime.tools.helpers.StringHelper; -import lime.tools.helpers.PathHelper; -import lime.project.AssetType; -import sys.FileSystem; - -@:access(lime.tools.helpers.FileHelper) - - -class Asset { - - - public var data:Dynamic; - public var embed:Null; - public var encoding:AssetEncoding; - public var flatName:String; - public var format:String; - public var glyphs:String; - public var id:String; - public var library:String; - //public var path:String; - //public var rename:String; - public var resourceName:String; - public var sourcePath:String; - public var targetPath:String; - public var type:AssetType; - - - public function new (path:String = "", rename:String = "", type:AssetType = null, embed:Null = null, setDefaults:Bool = true) { - - if (!setDefaults) return; - - this.embed = embed; - sourcePath = PathHelper.standardize (path); - - if (rename == "") { - - targetPath = path; - - } else { - - targetPath = rename; - - } - - id = targetPath; - resourceName = targetPath; - flatName = StringHelper.getFlatName (targetPath); - format = Path.extension (path).toLowerCase (); - glyphs = "32-255"; - - if (type == null) { - - var extension = Path.extension (path); - if (extension != null) extension = extension.toLowerCase (); - - if (FileHelper.knownExtensions.exists (extension)) { - - this.type = FileHelper.knownExtensions.get (extension); - - } else { - - switch (extension) { - - case "bundle": - - this.type = AssetType.MANIFEST; - - case "ogg", "m4a": - - if (FileSystem.exists (path)) { - - var stat = FileSystem.stat (path); - - //if (stat.size > 1024 * 128) { - if (stat.size > 1024 * 1024) { - - this.type = AssetType.MUSIC; - - } else { - - this.type = AssetType.SOUND; - - } - - } else { - - this.type = AssetType.SOUND; - - } - - default: - - if (path != "" && FileHelper.isText (path)) { - - this.type = AssetType.TEXT; - - } else { - - this.type = AssetType.BINARY; - - } - - } - - } - - } else { - - this.type = type; - - } - - } - - - public function clone ():Asset { - - var asset = new Asset ("", "", null, null, false); - - asset.data = data; - asset.embed = embed; - asset.encoding = encoding; - asset.flatName = flatName; - asset.format = format; - asset.glyphs = glyphs; - asset.id = id; - asset.library = library; - asset.resourceName = resourceName; - asset.sourcePath = sourcePath; - asset.targetPath = targetPath; - asset.type = type; - - //ObjectHelper.copyFields (this, asset); - - return asset; - - } - - -} diff --git a/lime/project/AssetEncoding.hx b/lime/project/AssetEncoding.hx deleted file mode 100644 index b23c5a698..000000000 --- a/lime/project/AssetEncoding.hx +++ /dev/null @@ -1,9 +0,0 @@ -package lime.project; - - -enum AssetEncoding { - - NONE; - BASE64; - -} \ No newline at end of file diff --git a/lime/project/AssetType.hx b/lime/project/AssetType.hx deleted file mode 100644 index 77e478f28..000000000 --- a/lime/project/AssetType.hx +++ /dev/null @@ -1,15 +0,0 @@ -package lime.project; - -enum AssetType { - - BINARY; - FONT; - IMAGE; - MANIFEST; - MOVIE_CLIP; - MUSIC; - SOUND; - TEMPLATE; - TEXT; - -} \ No newline at end of file diff --git a/lime/project/CLICommand.hx b/lime/project/CLICommand.hx deleted file mode 100644 index 83411388f..000000000 --- a/lime/project/CLICommand.hx +++ /dev/null @@ -1,20 +0,0 @@ -package lime.project; - - -//"Command-Line Interface Command" -class CLICommand { - - - public var command:String; - public var args:Array; - - - public function new (command:String, args:Array = null) { - - this.command = command; - this.args = args != null ? args : new Array (); - - } - - -} diff --git a/lime/project/Command.hx b/lime/project/Command.hx deleted file mode 100644 index 248fb8079..000000000 --- a/lime/project/Command.hx +++ /dev/null @@ -1,18 +0,0 @@ -package lime.project; - - -enum Command { - - BUILD; - CLEAN; - CONFIG; - DEPLOY; - DISPLAY; - UPDATE; - RUN; - TEST; - TRACE; - PUBLISH; - REBUILD; - -} \ No newline at end of file diff --git a/lime/project/ConfigData.hx b/lime/project/ConfigData.hx deleted file mode 100644 index 990ebab4a..000000000 --- a/lime/project/ConfigData.hx +++ /dev/null @@ -1,655 +0,0 @@ -package lime.project; - - -import haxe.xml.Fast; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.ObjectHelper; - - -abstract ConfigData(Dynamic) to Dynamic from Dynamic { - - - public function new () { - - this = { }; - - } - - - private function addBucket (bucket:String, parent:Dynamic):Dynamic { - - if (!Reflect.hasField (parent, bucket)) { - - log ("config data > adding a bucketType " + bucket); - Reflect.setField (parent, bucket, { }); - - } - - return Reflect.field (parent, bucket); - - } - - - public function clone ():ConfigData { - - return ObjectHelper.deepCopy (this); - - } - - - public function exists (id:String):Bool { - - var tree = id.split ('.'); - - if (tree.length <= 1) { - - return Reflect.hasField (this, id); - - } - - var current = this; - - for (leaf in tree) { - - if (Reflect.hasField (current, leaf)) { - - current = Reflect.field (current, leaf); - - } else { - - return false; - - } - - } - - return true; - - } - - - public function get (id:String):ConfigData { - - var tree = id.split ('.'); - - if (tree.length <= 1) { - - return Reflect.field (this, id); - - } - - var current = this; - - for (leaf in tree) { - - current = Reflect.field (current, leaf); - - if (current == null) { - - return null; - - } - - } - - return current; - - } - - - public function getArray (id:String, defaultValue:Array = null):Array { - - var tree = id.split ('.'); - var array:Array = null; - - if (tree.length <= 1) { - - array = Reflect.field (this, id + "___array"); - - if (array == null && Reflect.hasField (this, id)) { - - array = [ Reflect.field (this, id) ]; - - } - - } else { - - var current = this; - var field = tree.pop (); - - for (leaf in tree) { - - current = Reflect.field (current, leaf); - - if (current == null) { - - break; - - } - - } - - if (current != null) { - - array = Reflect.field (current, field + "___array"); - - if (array == null && Reflect.hasField (current, field)) { - - array = [ Reflect.field (current, field) ]; - - } - - } - - } - - if (array != null) { - - return array; - - } - - if (defaultValue == null) { - - defaultValue = []; - - } - - return defaultValue; - - } - - - public function getArrayString (id:String, childField:String = null, defaultValue:Array = null):Array { - - var array = getArray (id); - - if (array.length > 0) { - - var value = []; - - if (childField == null) { - - for (item in array) { - - value.push (Std.string (item)); - - } - - } else { - - for (item in array) { - - value.push (Std.string (Reflect.field (item, childField))); - - } - - } - - return value; - - } - - if (defaultValue == null) { - - defaultValue = []; - - } - - return defaultValue; - - } - - - public function getBool (id:String, defaultValue:Bool = true):Bool { - - if (exists (id)) { - - return get (id) == "true"; - - } - - return defaultValue; - - } - - - public function getInt (id:String, defaultValue:Int = 0):Int { - - if (exists (id)) { - - return Std.parseInt (Std.string (get (id))); - - } - - return defaultValue; - - } - - - public function getFloat (id:String, defaultValue:Float = 0):Float { - - if (exists (id)) { - - return Std.parseFloat (Std.string (get (id))); - - } - - return defaultValue; - - } - - - public function getString (id:String, defaultValue:String = ""):String { - - if (exists (id)) { - - return Std.string (get (id)); - - } - - return defaultValue; - - } - - - private function log (v:Dynamic):Void { - - if (LogHelper.verbose) { - - //LogHelper.println (v); - - } - - } - - - public function merge (other:ConfigData):Void { - - if (other != null) { - - mergeValues (other, this); - - } - - } - - - private function mergeValues (source:T, destination:T):Void { - - for (field in Reflect.fields (source)) { - - if (StringTools.endsWith (field, "___array")) { - - continue; - - } - - var doCopy = true; - var exists = Reflect.hasField (destination, field); - var typeDest = null; - - if (exists) { - - var valueSource = Reflect.field (source, field); - var valueDest = Reflect.field (destination, field); - var typeSource = Type.typeof(valueSource).getName (); - typeDest = Type.typeof (valueDest).getName (); - - //if trying to copy a non object over an object, don't - if (typeSource != "TObject" && typeDest == "TObject") { - - doCopy = false; - - //if (LogHelper.verbose) { - // - //LogHelper.println (field + " not merged by preference"); - // - //} - - } - - if (doCopy && Reflect.field (source, field) != Reflect.field (destination, field) && typeSource != "TObject") { - - if (!Reflect.hasField (destination, field + "___array")) { - - Reflect.setField (destination, field + "___array", [ ObjectHelper.deepCopy (Reflect.field (destination, field)) ]); - - } - - var array:Array = Reflect.field (destination, field + "___array"); - - if (Reflect.hasField (source, field + "___array")) { - - array = array.concat (Reflect.field (source, field + "___array")); - Reflect.setField (destination, field + "___array", array); - - } else { - - array.push (Reflect.field (source, field)); - - } - - Reflect.setField (destination, field, Reflect.field (source, field)); - doCopy = false; - - } - - } - - if (doCopy) { - - if (typeDest == "TObject") { - - mergeValues (Reflect.field (source, field), Reflect.field (destination, field)); - - } else { - - Reflect.setField (destination, field, Reflect.field (source, field)); - - if (Reflect.hasField (source, field + "___array")) { - - Reflect.setField (destination, field + "___array", Reflect.field (source, field + "___array")); - - } - - } - - } - - } - - } - - - public function parse (elem:Fast, substitute:String->String = null):Void { - - var bucket = this; - var bucketType = ""; - - if (StringTools.startsWith (elem.name, "config:")) { - - var items = elem.name.split(':'); - bucketType = items[1]; - - } - - if (elem.has.type) { - - bucketType = elem.att.type; - - } - - if (bucketType != "") { - - bucket = addBucket (bucketType, this); - - } - - parseAttributes (elem, bucket, substitute); - parseChildren (elem, bucket, 0, substitute); - - log ("> current config : " + this); - - } - - - private function parseAttributes (elem:Fast, bucket:Dynamic, substitute:String->String = null):Void { - - for (attrName in elem.x.attributes ()) { - - if (attrName != "type") { - - var attrValue = elem.x.get (attrName); - if (substitute != null) attrValue = substitute (attrValue); - setNode (bucket, attrName, attrValue); - - } - - } - - } - - - private function parseChildren (elem:Fast, bucket:Dynamic, depth:Int = 0, substitute:String->String = null):Void { - - for (child in elem.elements) { - - if (child.name != "config") { - - // log("config data > child : " + child.name); - - var d = depth + 1; - - var hasChildren = child.x.elements ().hasNext (); - var hasAttributes = child.x.attributes ().hasNext (); - - if (Reflect.hasField (bucket, child.name)) { - - if (!Reflect.hasField (bucket, child.name + "___array")) { - - Reflect.setField (bucket, child.name + "___array", [ ObjectHelper.deepCopy (Reflect.field (bucket, child.name)) ]); - - } - - var array:Array = Reflect.field (bucket, child.name + "___array"); - var arrayBucket = { }; - array.push (arrayBucket); - - if (hasAttributes) { - - parseAttributes (child, arrayBucket, substitute); - - } - - if (hasChildren) { - - parseChildren (child, arrayBucket, d, substitute); - - } - - if (!hasChildren && !hasAttributes) { - - parseValue (child, arrayBucket, substitute); - - } - - } - - if (!hasChildren && !hasAttributes) { - - parseValue (child, bucket, substitute); - - } else { - - var childBucket = addBucket (child.name, bucket); - - if (hasAttributes) { - - parseAttributes (child, childBucket, substitute); - - } - - if (hasChildren) { - - parseChildren (child, childBucket, d, substitute); - - } - - } - - } - } - - } - - - private function parseValue (elem:Fast, bucket:Dynamic, substitute:String->String = null):Void { - - if (elem.innerHTML != "") { - - var value = elem.innerHTML; - if (substitute != null) value = substitute (value); - setNode (bucket, elem.name, value); - - } - - } - - - public function push (id:String, value:Dynamic):Void { - - var tree = id.split ('.'); - - if (tree.length <= 1) { - - if (Reflect.hasField (this, id)) { - - if (!Reflect.hasField (this, id + "___array")) { - - Reflect.setField (this, id + "___array", Reflect.hasField (this, id) ? [ ObjectHelper.deepCopy (Reflect.field (this, id)) ] : []); - - } - - var array:Array = Reflect.field (this, id + "___array"); - array.push (value); - - } - - Reflect.setField (this, id, value); - return; - - } - - var current = this; - var field = tree.pop (); - - for (leaf in tree) { - - if (!Reflect.hasField (current, leaf)) { - - Reflect.setField (current, leaf, {}); - current = Reflect.field (current, leaf); - - } else { - - current = Reflect.field (current, leaf); - - if (current == null) { - - return; - - } - - } - - } - - if (Reflect.hasField (current, field)) { - - if (!Reflect.hasField (current, field + "___array")) { - - Reflect.setField (current, field + "___array", Reflect.hasField (current, field) ? [ ObjectHelper.deepCopy (Reflect.field (current, field)) ] : []); - - } - - var array:Array = Reflect.field (current, field + "___array"); - array.push (value); - - } - - Reflect.setField (current, field, value); - - } - - - public function set (id:String, value:Dynamic):Void { - - var tree = id.split ('.'); - - if (tree.length <= 1) { - - Reflect.setField (this, id, value); - return; - - } - - var current = this; - var field = tree.pop (); - - for (leaf in tree) { - - if (!Reflect.hasField (current, leaf)) { - - Reflect.setField (current, leaf, {}); - current = Reflect.field (current, leaf); - - } else { - - current = Reflect.field (current, leaf); - - if (current == null) { - - return; - - } - - } - - } - - Reflect.setField (current, field, value); - - } - - - private function setNode (bucket:Dynamic, node:String, value:Dynamic):Void { - - // log("config data > setting a node " + node + " to " + value + " on " + bucket); - - var doCopy = true; - var exists = Reflect.hasField (bucket, node); - - if (exists) { - - var valueDest = Reflect.field (bucket, node); - var typeSource = Type.typeof (value).getName (); - var typeDest = Type.typeof (valueDest).getName (); - - // trace (node + " / existed in dest as " + typeDest + " / " + typeSource ); - - if (typeSource != "TObject" && typeDest == "TObject") { - - doCopy = false; - log (node + " not merged by preference over object"); - - } - - if (doCopy) { - - if (typeSource != "TObject") { - - if (!Reflect.hasField (bucket, node + "___array")) { - - Reflect.setField (bucket, node + "___array", [ ObjectHelper.deepCopy (Reflect.field (bucket, node)) ]); - - } - - cast (Reflect.field (bucket, node + "___array"), Array).push (value); - - } - - Reflect.setField (bucket, node, value); - - } - - } else { - - Reflect.setField (bucket, node, value); - - } - - } - - -} \ No newline at end of file diff --git a/lime/project/Dependency.hx b/lime/project/Dependency.hx deleted file mode 100644 index 42efd4a0a..000000000 --- a/lime/project/Dependency.hx +++ /dev/null @@ -1,31 +0,0 @@ -package lime.project; - - -class Dependency { - - - // TODO: Is "forceLoad" the best name? Implement "whole-archive" on GCC - - public var forceLoad:Bool; - public var name:String; - public var path:String; - - - public function new (name:String, path:String) { - - this.name = name; - this.path = path; - - } - - - public function clone ():Dependency { - - var dependency = new Dependency (name, path); - dependency.forceLoad = forceLoad; - return dependency; - - } - - -} \ No newline at end of file diff --git a/lime/project/HXProject.hx b/lime/project/HXProject.hx deleted file mode 100644 index 0fcf990e0..000000000 --- a/lime/project/HXProject.hx +++ /dev/null @@ -1,1572 +0,0 @@ -package lime.project; - - -import haxe.io.Path; -import haxe.Json; -import haxe.Serializer; -import haxe.Unserializer; -import lime.tools.helpers.ArrayHelper; -import lime.tools.helpers.CompatibilityHelper; -import lime.tools.helpers.HaxelibHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.ObjectHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.StringHelper; -import lime.tools.helpers.StringMapHelper; -import lime.project.AssetType; -import sys.FileSystem; -import sys.io.File; - -#if lime -import haxe.io.Eof; -import haxe.xml.Fast; -import lime.text.Font; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.ProcessHelper; -import sys.io.Process; -@:access(lime.text.Font) -#end - - -class HXProject { - - - public var app:ApplicationData; - public var architectures:Array; - public var assets:Array; - public var command:String; - public var config:ConfigData; - public var debug:Bool; - public var defines:Map; - public var dependencies:Array; - public var environment:Map; - public var haxedefs:Map; - public var haxeflags:Array; - public var haxelibs:Array; - public var host (get_host, null):Platform; - public var icons:Array; - public var javaPaths:Array; - public var keystore:Keystore; - public var libraries:Array; - public var libraryHandlers:Map; - public var meta:MetaData; - public var modules:Map; - public var ndlls:Array; - public var platformType:PlatformType; - public var postBuildCallbacks:Array; - public var preBuildCallbacks:Array; - public var samplePaths:Array; - public var sources:Array; - public var splashScreens:Array; - public var target:Platform; - public var targetFlags:Map; - public var targetHandlers:Map; - public var templateContext (get_templateContext, null):Dynamic; - public var templatePaths:Array; - @:isVar public var window (get, set):WindowData; - public var windows:Array; - - private var defaultApp:ApplicationData; - private var defaultArchitectures:Array; - private var defaultMeta:MetaData; - private var defaultWindow:WindowData; - private var needRerun:Bool; - - public static var _command:String; - public static var _debug:Bool; - public static var _environment:Map; - public static var _target:Platform; - public static var _targetFlags:Map; - public static var _templatePaths:Array; - public static var _userDefines:Map; - - private static var initialized:Bool; - - - public static function main () { - - var args = Sys.args (); - - if (args.length < 2) { - - return; - - } - - var inputData = Unserializer.run (File.getContent (args[0])); - var outputFile = args[1]; - - HXProject._command = inputData.command; - HXProject._target = cast inputData.target; - HXProject._debug = inputData.debug; - HXProject._targetFlags = inputData.targetFlags; - HXProject._templatePaths = inputData.templatePaths; - HXProject._userDefines = inputData.userDefines; - HXProject._environment = inputData.environment; - LogHelper.verbose = inputData.logVerbose; - LogHelper.enableColor = inputData.logEnableColor; - - #if lime - ProcessHelper.dryRun = inputData.processDryRun; - #end - - HaxelibHelper.debug = inputData.haxelibDebug; - - initialize (); - - var classRef = Type.resolveClass (inputData.name); - var instance = Type.createInstance (classRef, []); - - var serializer = new Serializer (); - serializer.useCache = true; - serializer.serialize (instance); - - File.saveContent (outputFile, serializer.toString ()); - - } - - - public function new () { - - initialize (); - - command = _command; - config = new ConfigData (); - debug = _debug; - target = _target; - targetFlags = StringMapHelper.copy (_targetFlags); - templatePaths = _templatePaths.copy (); - - defaultMeta = { title: "MyApplication", description: "", packageName: "com.example.myapp", version: "1.0.0", company: "", companyUrl: "", buildNumber: null, companyId: "" } - defaultApp = { main: "Main", file: "MyApplication", path: "bin", preloader: "", swfVersion: 17, url: "", init: null } - defaultWindow = { width: 800, height: 600, parameters: "{}", background: 0xFFFFFF, fps: 30, hardware: true, display: 0, resizable: true, borderless: false, orientation: Orientation.AUTO, vsync: false, fullscreen: false, allowHighDPI: true, alwaysOnTop: false, antialiasing: 0, allowShaders: true, requireShaders: false, depthBuffer: true, stencilBuffer: true, colorDepth: 32, maximized: false, minimized: false, hidden: false } - - platformType = PlatformType.DESKTOP; - architectures = []; - - switch (target) { - - case AIR: - - if (targetFlags.exists ("ios") || targetFlags.exists ("android")) { - - platformType = PlatformType.MOBILE; - - defaultWindow.width = 0; - defaultWindow.height = 0; - - } else { - - platformType = PlatformType.DESKTOP; - - } - - architectures = []; - - case FLASH: - - platformType = PlatformType.WEB; - architectures = []; - - case HTML5, FIREFOX: - - platformType = PlatformType.WEB; - architectures = []; - - defaultWindow.width = 0; - defaultWindow.height = 0; - defaultWindow.fps = 60; - defaultWindow.allowHighDPI = false; - - case EMSCRIPTEN: - - platformType = PlatformType.WEB; - architectures = []; - - defaultWindow.fps = 60; - defaultWindow.allowHighDPI = false; - - case ANDROID, BLACKBERRY, IOS, TIZEN, WEBOS, TVOS: - - platformType = PlatformType.MOBILE; - - if (target == Platform.IOS) { - - architectures = [ Architecture.ARMV7, Architecture.ARM64 ]; - - } else if (target == Platform.ANDROID) { - - if (targetFlags.exists ("simulator") || targetFlags.exists ("emulator")) { - - architectures = [ Architecture.X86 ]; - - } else { - - architectures = [ Architecture.ARMV7 ]; - - } - - } else if (target == Platform.TVOS) { - - architectures = [ Architecture.ARM64 ]; - - } else { - - architectures = [ Architecture.ARMV6 ]; - - } - - defaultWindow.width = 0; - defaultWindow.height = 0; - defaultWindow.fullscreen = true; - defaultWindow.requireShaders = true; - - case WINDOWS: - - platformType = PlatformType.DESKTOP; - - if (targetFlags.exists ("uwp") || targetFlags.exists ("winjs")) { - - architectures = []; - - targetFlags.set ("uwp", ""); - targetFlags.set ("winjs", ""); - - defaultWindow.width = 0; - defaultWindow.height = 0; - defaultWindow.fps = 60; - - } else { - - architectures = [ Architecture.X86 ]; - - } - - defaultWindow.allowHighDPI = false; - - case MAC, LINUX: - - platformType = PlatformType.DESKTOP; - architectures = [ PlatformHelper.hostArchitecture ]; - - defaultWindow.allowHighDPI = false; - - default: - - // TODO: Better handling of platform type for pluggable targets - - platformType = PlatformType.CONSOLE; - - defaultWindow.width = 0; - defaultWindow.height = 0; - defaultWindow.fps = 60; - defaultWindow.fullscreen = true; - - } - - defaultArchitectures = architectures.copy (); - - meta = ObjectHelper.copyFields (defaultMeta, {}); - app = ObjectHelper.copyFields (defaultApp, {}); - window = ObjectHelper.copyFields (defaultWindow, {}); - windows = [ window ]; - assets = new Array (); - - if (_userDefines != null) { - - defines = StringMapHelper.copy (_userDefines); - - } else { - - defines = new Map (); - - } - - dependencies = new Array (); - - if (_environment != null) { - - environment = _environment; - - } else { - - environment = Sys.environment (); - - } - - haxedefs = new Map (); - haxeflags = new Array (); - haxelibs = new Array (); - icons = new Array (); - javaPaths = new Array (); - libraries = new Array (); - libraryHandlers = new Map (); - modules = new Map (); - ndlls = new Array (); - postBuildCallbacks = new Array (); - preBuildCallbacks = new Array (); - sources = new Array (); - samplePaths = new Array (); - splashScreens = new Array (); - targetHandlers = new Map (); - - } - - - public function clone ():HXProject { - - var project = new HXProject (); - - ObjectHelper.copyFields (app, project.app); - project.architectures = architectures.copy (); - project.assets = assets.copy (); - - for (i in 0...assets.length) { - - project.assets[i] = assets[i].clone (); - - } - - project.command = command; - project.config = config.clone (); - project.debug = debug; - - for (key in defines.keys ()) { - - project.defines.set (key, defines.get (key)); - - } - - for (dependency in dependencies) { - - project.dependencies.push (dependency.clone ()); - - } - - for (key in environment.keys ()) { - - project.environment.set (key, environment.get (key)); - - } - - for (key in haxedefs.keys ()) { - - project.haxedefs.set (key, haxedefs.get (key)); - - } - - project.haxeflags = haxeflags.copy (); - - for (haxelib in haxelibs) { - - project.haxelibs.push (haxelib.clone ()); - - } - - for (icon in icons) { - - project.icons.push (icon.clone ()); - - } - - project.javaPaths = javaPaths.copy (); - - if (keystore != null) { - - project.keystore = keystore.clone (); - - } - - for (library in libraries) { - - project.libraries.push (library.clone ()); - - } - - for (key in libraryHandlers.keys ()) { - - project.libraryHandlers.set (key, libraryHandlers.get (key)); - - } - - ObjectHelper.copyFields (meta, project.meta); - - for (key in modules.keys ()) { - - project.modules.set (key, modules.get (key).clone ()); - - } - - for (ndll in ndlls) { - - project.ndlls.push (ndll.clone ()); - - } - - project.platformType = platformType; - project.postBuildCallbacks = postBuildCallbacks.copy (); - project.preBuildCallbacks = preBuildCallbacks.copy (); - project.samplePaths = samplePaths.copy (); - project.sources = sources.copy (); - - for (splashScreen in splashScreens) { - - project.splashScreens.push (splashScreen.clone ()); - - } - - project.target = target; - - for (key in targetFlags.keys ()) { - - project.targetFlags.set (key, targetFlags.get (key)); - - } - - for (key in targetHandlers.keys ()) { - - project.targetHandlers.set (key, targetHandlers.get (key)); - - } - - project.templatePaths = templatePaths.copy (); - - for (i in 0...windows.length) { - - project.windows[i] = (ObjectHelper.copyFields (windows[i], {})); - - } - - return project; - - } - - - private function filter (text:String, include:Array = null, exclude:Array = null):Bool { - - if (include == null) { - - include = [ "*" ]; - - } - - if (exclude == null) { - - exclude = []; - - } - - for (filter in exclude) { - - if (filter != "") { - - filter = StringTools.replace (filter, ".", "\\."); - filter = StringTools.replace (filter, "*", ".*"); - - var regexp = new EReg ("^" + filter + "$", "i"); - - if (regexp.match (text)) { - - return false; - - } - - } - - } - - for (filter in include) { - - if (filter != "") { - - filter = StringTools.replace (filter, ".", "\\."); - filter = StringTools.replace (filter, "*", ".*"); - - var regexp = new EReg ("^" + filter, "i"); - - if (regexp.match (text)) { - - return true; - - } - - } - - } - - return false; - - } - - - #if lime - - public static function fromFile (projectFile:String, userDefines:Map = null, includePaths:Array = null):HXProject { - - var project:HXProject = null; - - var path = FileSystem.fullPath (Path.withoutDirectory (projectFile)); - var name = Path.withoutDirectory (Path.withoutExtension (projectFile)); - name = name.substr (0, 1).toUpperCase () + name.substr (1); - - var tempDirectory = PathHelper.getTemporaryDirectory (); - var classFile = PathHelper.combine (tempDirectory, name + ".hx"); - var nekoOutput = PathHelper.combine (tempDirectory, name + ".n"); - - FileHelper.copyFile (path, classFile); - - var args = [ name, "-main", "lime.project.HXProject", "-cp", tempDirectory, "-neko", nekoOutput, "-cp", PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "tools"), "-lib", "lime", "-D", "lime-curl", "-D", "native", "-D", "lime-native", "-D", "lime-cffi" ]; - var input = File.read (classFile, false); - var tag = "@:compiler("; - - try { - - while (true) { - - var line = input.readLine (); - - if (StringTools.startsWith (line, tag)) { - - args.push (line.substring (tag.length + 1, line.length - 2)); - - } - - } - - } catch (ex:Eof) {} - - input.close (); - - var cacheDryRun = ProcessHelper.dryRun; - ProcessHelper.dryRun = false; - - ProcessHelper.runCommand ("", "haxe", args); - - var inputFile = PathHelper.combine (tempDirectory, "input.dat"); - var outputFile = PathHelper.combine (tempDirectory, "output.dat"); - - var inputData = Serializer.run ({ - - command: HXProject._command, - name: name, - target: HXProject._target, - debug: HXProject._debug, - targetFlags: HXProject._targetFlags, - templatePaths: HXProject._templatePaths, - userDefines: HXProject._userDefines, - environment: HXProject._environment, - logVerbose: LogHelper.verbose, - logEnableColor: LogHelper.enableColor, - processDryRun: cacheDryRun, - haxelibDebug: HaxelibHelper.debug - - }); - - File.saveContent (inputFile, inputData); - - try { - - ProcessHelper.runCommand ("", "neko", [ FileSystem.fullPath (nekoOutput), inputFile, outputFile ]); - - } catch (e:Dynamic) { - - FileSystem.deleteFile (inputFile); - Sys.exit (1); - - } - - ProcessHelper.dryRun = cacheDryRun; - - var tPaths:Array = []; - - try { - - FileSystem.deleteFile (inputFile); - - var outputPath = PathHelper.combine (tempDirectory, "output.dat"); - - if (FileSystem.exists (outputPath)) { - - var output = File.getContent (outputPath); - var unserializer = new Unserializer (output); - unserializer.setResolver (cast { resolveEnum: Type.resolveEnum, resolveClass: resolveClass }); - project = unserializer.unserialize (); - - //Because the project file template paths need to take priority, - //Add them after loading template paths from haxelibs below - tPaths = project.templatePaths; - project.templatePaths = []; - - FileSystem.deleteFile (outputPath); - - } - - } catch (e:Dynamic) {} - - PathHelper.removeDirectory (tempDirectory); - - if (project != null) { - - for (key in project.environment.keys ()) { - - Sys.putEnv (key, project.environment[key]); - - } - - var defines = StringMapHelper.copy (userDefines); - StringMapHelper.copyKeys (project.defines, defines); - - processHaxelibs (project, defines); - - //Adding template paths from the Project file - project.templatePaths = ArrayHelper.concatUnique (project.templatePaths, tPaths, true); - } - - return project; - - } - - - public static function fromHaxelib (haxelib:Haxelib, userDefines:Map = null, clearCache:Bool = false):HXProject { - - if (haxelib.name == null || haxelib.name == "") { - - return null; - - } - - var path = PathHelper.getHaxelib (haxelib, false, clearCache); - - if (path == null || path == "") { - - return null; - - } - - //if (!userDefines.exists (haxelib.name)) { - // - //userDefines.set (haxelib.name, HaxelibHelper.getVersion (haxelib)); - // - //} - - return HXProject.fromPath (path, userDefines); - - } - - - public static function fromPath (path:String, userDefines:Map = null):HXProject { - - if (!FileSystem.exists (path) || !FileSystem.isDirectory (path)) { - - return null; - - } - - var files = [ "include.lime", "include.nmml", "include.xml" ]; - var projectFile = null; - - for (file in files) { - - if (projectFile == null && FileSystem.exists (PathHelper.combine (path, file))) { - - projectFile = PathHelper.combine (path, file); - - } - - } - - if (projectFile != null) { - - var project = new ProjectXMLParser (projectFile, userDefines); - - if (project.config.get ("project.rebuild.path") == null) { - - project.config.set ("project.rebuild.path", PathHelper.combine (path, "project")); - - } - - return project; - - } - - return null; - - } - - #end - - - private function getHaxelibVersion (haxelib:Haxelib):String { - - var version = haxelib.version; - - if (version == "" || version == null) { - - var haxelibPath = PathHelper.getHaxelib (haxelib); - var jsonPath = PathHelper.combine (haxelibPath, "haxelib.json"); - - try { - - if (FileSystem.exists (jsonPath)) { - - var json = Json.parse (File.getContent (jsonPath)); - version = json.version; - - } - - } catch (e:Dynamic) {} - - } - - return version; - - } - - - public function include (path:String):Void { - - // extend project file somehow? - - } - - - public function includeAssets (path:String, rename:String = null, include:Array = null, exclude:Array = null):Void { - - if (include == null) { - - include = [ "*" ]; - - } - - if (exclude == null) { - - exclude = []; - - } - - exclude = exclude.concat ([ ".*", "cvs", "thumbs.db", "desktop.ini", "*.hash" ]); - - if (path == "") { - - return; - - } - - var targetPath = ""; - - if (rename != null) { - - targetPath = rename; - - } else { - - targetPath = path; - - } - - if (!FileSystem.exists (path)) { - - LogHelper.error ("Could not find asset path \"" + path + "\""); - return; - - } - - var files = FileSystem.readDirectory (path); - - if (targetPath != "") { - - targetPath += "/"; - - } - - for (file in files) { - - if (FileSystem.isDirectory (path + "/" + file)) { - - if (filter (file, [ "*" ], exclude)) { - - includeAssets (path + "/" + file, targetPath + file, include, exclude); - - } - - } else { - - if (filter (file, include, exclude)) { - - assets.push (new Asset (path + "/" + file, targetPath + file)); - - } - - } - - } - - } - - - #if lime - - public function includeXML (xml:String):Void { - - var projectXML = new ProjectXMLParser (); - @:privateAccess projectXML.parseXML (new Fast (Xml.parse (xml).firstElement ()), ""); - merge (projectXML); - - } - - #end - - - private static function initialize ():Void { - - if (!initialized) { - - if (_target == null) { - - _target = PlatformHelper.hostPlatform; - - } - - if (_targetFlags == null) { - - _targetFlags = new Map (); - - } - - if (_templatePaths == null) { - - _templatePaths = new Array (); - - } - - initialized = true; - - } - - } - - - public function merge (project:HXProject):Void { - - if (project != null) { - - ObjectHelper.copyUniqueFields (project.meta, meta, project.defaultMeta); - ObjectHelper.copyUniqueFields (project.app, app, project.defaultApp); - - for (i in 0...project.windows.length) { - - if (i < windows.length) { - - ObjectHelper.copyUniqueFields (project.windows[i], windows[i], project.defaultWindow); - - } else { - - windows.push (ObjectHelper.copyFields (project.windows[i], {})); - - } - - } - - StringMapHelper.copyUniqueKeys (project.defines, defines); - StringMapHelper.copyUniqueKeys (project.environment, environment); - StringMapHelper.copyUniqueKeys (project.haxedefs, haxedefs); - StringMapHelper.copyUniqueKeys (project.libraryHandlers, libraryHandlers); - StringMapHelper.copyUniqueKeys (project.targetHandlers, targetHandlers); - - config.merge (project.config); - - for (architecture in project.architectures) { - - if (defaultArchitectures.indexOf (architecture) == -1) { - - architectures.push (architecture); - - } - - } - - if (project.architectures.length > 0) { - - for (architecture in defaultArchitectures) { - - if (project.architectures.indexOf (architecture) == -1) { - - architectures.remove (architecture); - - } - - } - - } - - assets = ArrayHelper.concatUnique (assets, project.assets); - dependencies = ArrayHelper.concatUnique (dependencies, project.dependencies, true); - haxeflags = ArrayHelper.concatUnique (haxeflags, project.haxeflags); - haxelibs = ArrayHelper.concatUnique (haxelibs, project.haxelibs, true, "name"); - icons = ArrayHelper.concatUnique (icons, project.icons); - javaPaths = ArrayHelper.concatUnique (javaPaths, project.javaPaths, true); - - if (keystore == null) { - - keystore = project.keystore; - - } else { - - keystore.merge (project.keystore); - - } - - - libraries = ArrayHelper.concatUnique (libraries, project.libraries, true); - - for (key in project.modules.keys ()) { - - if (modules.exists (key)) { - - modules.get (key).merge (project.modules.get (key)); - - } else { - - modules.set (key, project.modules.get (key)); - - } - - } - - ndlls = ArrayHelper.concatUnique (ndlls, project.ndlls); - postBuildCallbacks = postBuildCallbacks.concat (project.postBuildCallbacks); - preBuildCallbacks = preBuildCallbacks.concat (project.preBuildCallbacks); - samplePaths = ArrayHelper.concatUnique (samplePaths, project.samplePaths, true); - sources = ArrayHelper.concatUnique (sources, project.sources, true); - splashScreens = ArrayHelper.concatUnique (splashScreens, project.splashScreens); - templatePaths = ArrayHelper.concatUnique (templatePaths, project.templatePaths, true); - - } - - } - - - public function path (value:String):Void { - - if (host == Platform.WINDOWS) { - - setenv ("PATH", value + ";" + Sys.getEnv ("PATH")); - - } else { - - setenv ("PATH", value + ":" + Sys.getEnv ("PATH")); - - } - - } - - - #if lime - - @:noCompletion private static function processHaxelibs (project:HXProject, userDefines:Map):Void { - - var haxelibs = project.haxelibs.copy (); - project.haxelibs = []; - - for (haxelib in haxelibs) { - - var validatePath = PathHelper.getHaxelib (haxelib, true); - project.haxelibs.push (haxelib); - - var includeProject = HXProject.fromHaxelib (haxelib, userDefines); - - if (includeProject != null) { - - for (ndll in includeProject.ndlls) { - - if (ndll.haxelib == null) { - - ndll.haxelib = haxelib; - - } - - } - - project.merge (includeProject); - - } - - } - - } - - - @:noCompletion private static function resolveClass (name:String):Class { - - var type = Type.resolveClass (name); - - if (type == null) { - - return HXProject; - - } else { - - return type; - - } - - } - - #end - - - public function setenv (name:String, value:String):Void { - - if (value == null) { - - environment.remove (name); - value = ""; - - } - - if (name == "HAXELIB_PATH") { - - var currentPath = HaxelibHelper.getRepositoryPath (); - Sys.putEnv (name, value); - var newPath = HaxelibHelper.getRepositoryPath (true); - - if (currentPath != newPath) { - - var valid = try { (newPath != null && newPath != "" && FileSystem.exists (FileSystem.fullPath (newPath))); } catch (e:Dynamic) { false; } - - if (!valid) { - - LogHelper.error ("The specified haxelib repository path \"" + value + "\" does not exist"); - - } else { - - needRerun = true; - - } - - } - - } else { - - Sys.putEnv (name, value); - - } - - if (value != "") { - - environment.set (name, value); - - } - - } - - - - - // Getters & Setters - - - - - private function get_host ():Platform { - - return PlatformHelper.hostPlatform; - - } - - - private function get_templateContext ():Dynamic { - - var context:Dynamic = {}; - - if (app == null) app = { }; - if (meta == null) meta = { }; - - if (window == null) { - - window = { }; - windows = [ window ]; - - } - - ObjectHelper.copyMissingFields (defaultApp, app); - ObjectHelper.copyMissingFields (defaultMeta, meta); - - for (item in windows) { - - ObjectHelper.copyMissingFields (defaultWindow, item); - - } - - //config.populate (); - - for (field in Reflect.fields (app)) { - - Reflect.setField (context, "APP_" + StringHelper.formatUppercaseVariable (field), Reflect.field (app, field)); - - } - - context.BUILD_DIR = app.path; - - for (key in environment.keys ()) { - - Reflect.setField (context, "ENV_" + key, environment.get (key)); - - } - - context.meta = meta; - - for (field in Reflect.fields (meta)) { - - Reflect.setField (context, "APP_" + StringHelper.formatUppercaseVariable (field), Reflect.field (meta, field)); - Reflect.setField (context, "META_" + StringHelper.formatUppercaseVariable (field), Reflect.field (meta, field)); - - } - - context.APP_PACKAGE = context.META_PACKAGE = meta.packageName; - - for (field in Reflect.fields (windows[0])) { - - Reflect.setField (context, "WIN_" + StringHelper.formatUppercaseVariable (field), Reflect.field (windows[0], field)); - Reflect.setField (context, "WINDOW_" + StringHelper.formatUppercaseVariable (field), Reflect.field (windows[0], field)); - - } - - if (windows[0].orientation == Orientation.LANDSCAPE || windows[0].orientation == Orientation.PORTRAIT) { - - context.WIN_ORIENTATION = Std.string (windows[0].orientation).toLowerCase (); - context.WINDOW_ORIENTATION = Std.string (windows[0].orientation).toLowerCase (); - - } else { - - context.WIN_ORIENTATION = ""; - context.WINDOW_ORIENTATION = ""; - - } - - context.windows = windows; - - for (i in 0...windows.length) { - - for (field in Reflect.fields (windows[i])) { - - Reflect.setField (context, "WINDOW_" + StringHelper.formatUppercaseVariable (field) + "_" + i, Reflect.field (windows[i], field)); - - } - - if (windows[i].orientation == Orientation.LANDSCAPE || windows[i].orientation == Orientation.PORTRAIT) { - - Reflect.setField (context, "WINDOW_ORIENTATION_" + i, Std.string (windows[i].orientation).toLowerCase ()); - - } else { - - Reflect.setField (context, "WINDOW_ORIENTATION_" + i, ""); - - } - - windows[i].title = meta.title; - - } - - for (haxeflag in haxeflags) { - - if (StringTools.startsWith (haxeflag, "-lib")) { - - Reflect.setField (context, "LIB_" + StringHelper.formatUppercaseVariable (haxeflag.substr (5)), "true"); - - } - - } - - context.assets = new Array (); - - for (asset in assets) { - - if (asset.type != AssetType.TEMPLATE) { - - var embeddedAsset:Dynamic = { }; - ObjectHelper.copyFields (asset, embeddedAsset); - - embeddedAsset.sourcePath = PathHelper.standardize (asset.sourcePath); - - if (asset.embed == null) { - - embeddedAsset.embed = (platformType == PlatformType.WEB || target == AIR); - - } - - embeddedAsset.type = Std.string (asset.type).toLowerCase (); - - #if lime - if (asset.type == FONT) { - - try { - - var font = Font.fromFile (asset.sourcePath); - embeddedAsset.fontName = font.name; - - LogHelper.info ("", " - \x1b[1mDetecting font name:\x1b[0m " + asset.sourcePath + " \x1b[3;37m->\x1b[0m \"" + font.name + "\""); - - } catch (e:Dynamic) {} - - } - #end - - context.assets.push (embeddedAsset); - - } - - } - - context.libraries = new Array (); - var embeddedLibraries = new Map (); - - for (library in libraries) { - - var embeddedLibrary:Dynamic = { }; - ObjectHelper.copyFields (library, embeddedLibrary); - context.libraries.push (embeddedLibrary); - embeddedLibraries[library.name] = embeddedLibrary; - - } - - for (asset in assets) { - - if (asset.library != null && !embeddedLibraries.exists (asset.library)) { - - var embeddedLibrary:Dynamic = { }; - embeddedLibrary.name = asset.library; - context.libraries.push (embeddedLibrary); - embeddedLibraries[asset.library] = embeddedLibrary; - - } - - } - - context.ndlls = new Array (); - - for (ndll in ndlls) { - - var templateNDLL:Dynamic = { }; - ObjectHelper.copyFields (ndll, templateNDLL); - templateNDLL.nameSafe = StringTools.replace (ndll.name, "-", "_"); - context.ndlls.push (templateNDLL); - - } - - //Reflect.setField (context, "ndlls", ndlls); - //Reflect.setField (context, "sslCaCert", sslCaCert); - context.sslCaCert = ""; - - var compilerFlags = []; - - for (haxelib in haxelibs) { - - var name = haxelib.name; - - // TODO: Handle real version when better/smarter haxelib available - var version = haxelib.version; - //var version = HaxelibHelper.getVersion (haxelib); - - if (version != null && version != "") { - - name += ":" + version; - - } - - #if lime - - if (HaxelibHelper.pathOverrides.exists (name)) { - - var param = "-cp " + HaxelibHelper.pathOverrides.get (name); - compilerFlags.remove (param); - compilerFlags.push (param); - - } else { - - var cache = LogHelper.verbose; - LogHelper.verbose = HaxelibHelper.debug; - var output = ""; - - try { - - output = HaxelibHelper.runProcess ("", [ "path", name ], true, true, true); - - } catch (e:Dynamic) { } - - LogHelper.verbose = cache; - - var split = output.split ("\n"); - var haxelibName = null; - - for (arg in split) { - - arg = StringTools.trim (arg); - - if (arg != "") { - - if (StringTools.startsWith (arg, "Error: ")) { - - LogHelper.error (arg.substr (7)); - - } else if (!StringTools.startsWith (arg, "-")) { - - var path = PathHelper.standardize (arg); - - if (path != null && StringTools.trim (path) != "" && !StringTools.startsWith (StringTools.trim (path), "#")) { - - var param = "-cp " + path; - compilerFlags.remove (param); - compilerFlags.push (param); - - } - - var version = "0.0.0"; - var jsonPath = PathHelper.combine (path, "haxelib.json"); - - try { - - if (FileSystem.exists (jsonPath)) { - - var json = Json.parse (File.getContent (jsonPath)); - haxelibName = json.name; - compilerFlags = ArrayHelper.concatUnique (compilerFlags, [ "-D " + haxelibName + "=" + json.version ], true); - - } - - } catch (e:Dynamic) {} - - } else { - - if (StringTools.startsWith (arg, "-D ") && arg.indexOf ("=") == -1) { - - var name = arg.substr (3); - - if (name != haxelibName) { - - compilerFlags = ArrayHelper.concatUnique (compilerFlags, [ "-D " + name ], true); - - } - - /*var haxelib = new Haxelib (arg.substr (3)); - var path = PathHelper.getHaxelib (haxelib); - var version = getHaxelibVersion (haxelib); - - if (path != null) { - - CompatibilityHelper.patchProject (this, haxelib, version); - compilerFlags = ArrayHelper.concatUnique (compilerFlags, [ "-D " + haxelib.name + "=" + version ], true); - - }*/ - - } else if (!StringTools.startsWith (arg, "-L")) { - - compilerFlags = ArrayHelper.concatUnique (compilerFlags, [ arg ], true); - - } - - } - - } - - } - - } - - #else - - compilerFlags.push ("-lib " + name); - - #end - - Reflect.setField (context, "LIB_" + StringHelper.formatUppercaseVariable (haxelib.name), true); - - if (name == "nme") { - - context.EMBED_ASSETS = false; - - } - - } - - for (source in sources) { - - if (source != null && StringTools.trim (source) != "") { - - compilerFlags.push ("-cp " + source); - - } - - } - - for (key in defines.keys ()) { - - var value = defines.get (key); - - if (value == null || value == "") { - - Reflect.setField (context, "SET_" + StringHelper.formatUppercaseVariable (key), true); - - } else { - - Reflect.setField (context, "SET_" + StringHelper.formatUppercaseVariable (key), value); - - } - - } - - for (key in haxedefs.keys ()) { - - var value = haxedefs.get (key); - - if (value == null || value == "") { - - compilerFlags.push ("-D " + key); - - Reflect.setField (context, "DEFINE_" + StringHelper.formatUppercaseVariable (key), true); - - } else { - - compilerFlags.push ("-D " + key + "=" + value); - - Reflect.setField (context, "DEFINE_" + StringHelper.formatUppercaseVariable (key), value); - - } - - } - - if (target != Platform.FLASH) { - - compilerFlags.push ("-D " + Std.string (target).toLowerCase ()); - - } - - compilerFlags.push ("-D " + Std.string (platformType).toLowerCase ()); - compilerFlags = compilerFlags.concat (haxeflags); - - if (compilerFlags.length == 0) { - - context.HAXE_FLAGS = ""; - - } else { - - context.HAXE_FLAGS = "\n" + compilerFlags.join ("\n"); - - } - - var main = app.main; - - if (main == null) { - - main = defaultApp.main; - - } - - var indexOfPeriod = main.lastIndexOf ("."); - - context.APP_MAIN_PACKAGE = main.substr (0, indexOfPeriod + 1); - context.APP_MAIN_CLASS = main.substr (indexOfPeriod + 1); - - var type = "release"; - - if (debug) { - - type = "debug"; - - } else if (targetFlags.exists ("final")) { - - type = "final"; - - } - - var hxml = Std.string (target).toLowerCase () + "/hxml/" + type + ".hxml"; - - for (templatePath in templatePaths) { - - var path = PathHelper.combine (templatePath, hxml); - - if (FileSystem.exists (path)) { - - context.HXML_PATH = path; - - } - - } - - context.RELEASE = (type == "release"); - context.DEBUG = debug; - context.FINAL = (type == "final"); - context.SWF_VERSION = app.swfVersion; - context.PRELOADER_NAME = app.preloader; - - if (keystore != null) { - - context.KEY_STORE = PathHelper.tryFullPath (keystore.path); - - if (keystore.password != null) { - - context.KEY_STORE_PASSWORD = keystore.password; - - } - - if (keystore.alias != null) { - - context.KEY_STORE_ALIAS = keystore.alias; - - } else if (keystore.path != null) { - - context.KEY_STORE_ALIAS = Path.withoutExtension (Path.withoutDirectory (keystore.path)); - - } - - if (keystore.aliasPassword != null) { - - context.KEY_STORE_ALIAS_PASSWORD = keystore.aliasPassword; - - } else if (keystore.password != null) { - - context.KEY_STORE_ALIAS_PASSWORD = keystore.password; - - } - - } - - context.config = config; - - return context; - - } - - - private function get_window ():WindowData { - - if (windows != null) { - - return windows[0]; - - } else { - - return window; - - } - - } - - - private function set_window (value:WindowData):WindowData { - - if (windows != null) { - - return windows[0] = window = value; - - } else { - - return window = value; - - } - - } - - -} diff --git a/lime/project/Haxelib.hx b/lime/project/Haxelib.hx deleted file mode 100644 index 31c7f6fd6..000000000 --- a/lime/project/Haxelib.hx +++ /dev/null @@ -1,43 +0,0 @@ -package lime.project; - - -class Haxelib { - - - public var name:String; - public var version:String; - - - public function new (name:String, version:String = "") { - - this.name = name; - this.version = version; - - } - - - public function clone ():Haxelib { - - var haxelib = new Haxelib (name, version); - return haxelib; - - } - - - public function versionMatches (other:String):Bool { - - if (version == "" || version == null) return true; - if (other == "" || other == null) return false; - - var filter = version; - filter = StringTools.replace (filter, ".", "\\."); - filter = StringTools.replace (filter, "*", ".*"); - - var regexp = new EReg ("^" + filter, "i"); - - return regexp.match (other); - - } - - -} \ No newline at end of file diff --git a/lime/project/Icon.hx b/lime/project/Icon.hx deleted file mode 100644 index b674ff669..000000000 --- a/lime/project/Icon.hx +++ /dev/null @@ -1,33 +0,0 @@ -package lime.project; - - -class Icon { - - - public var height:Int; - public var path:String; - public var size:Int; - public var width:Int; - - - public function new (path:String, size:Int = 0) { - - this.path = path; - this.size = height = width = size; - - } - - - public function clone ():Icon { - - var icon = new Icon (path); - icon.size = size; - icon.width = width; - icon.height = height; - - return icon; - - } - - -} \ No newline at end of file diff --git a/lime/project/Keystore.hx b/lime/project/Keystore.hx deleted file mode 100644 index 033959b75..000000000 --- a/lime/project/Keystore.hx +++ /dev/null @@ -1,40 +0,0 @@ -package lime.project; - - -class Keystore { - - public var alias:String; - public var aliasPassword:String; - public var password:String; - public var path:String; - public var type:String; - - public function new (path:String = null, password:String = null, alias:String = null, aliasPassword:String = null) { - - this.path = path; - this.password = password; - this.alias = alias; - this.aliasPassword = aliasPassword; - - } - - public function clone ():Keystore { - - return new Keystore (path, password, alias, aliasPassword); - - } - - public function merge (keystore:Keystore):Void { - - if (keystore != null) { - - if (keystore.path != null && keystore.path != "") path = keystore.path; - if (keystore.password != null) path = keystore.password; - if (keystore.alias != null) path = keystore.alias; - if (keystore.aliasPassword != null) path = keystore.aliasPassword; - - } - - } - -} \ No newline at end of file diff --git a/lime/project/Library.hx b/lime/project/Library.hx deleted file mode 100644 index d6d8597f6..000000000 --- a/lime/project/Library.hx +++ /dev/null @@ -1,49 +0,0 @@ -package lime.project; - - -import haxe.io.Path; - - -class Library { - - - public var embed:Null; - public var generate:Bool; - public var name:String; - public var prefix:String; - public var preload:Bool; - public var sourcePath:String; - public var type:String; - - - public function new (sourcePath:String, name:String = "", type:String = null, embed:Null = null, preload:Bool = false, generate:Bool = false, prefix:String = "") { - - this.sourcePath = sourcePath; - - if (name == "") { - - this.name = Path.withoutDirectory (Path.withoutExtension (sourcePath)); - - } else { - - this.name = name; - - } - - this.type = type; - this.embed = embed; - this.preload = preload; - this.generate = generate; - this.prefix = prefix; - - } - - - public function clone ():Library { - - return new Library (sourcePath, name, type, embed, preload, generate, prefix); - - } - - -} \ No newline at end of file diff --git a/lime/project/MetaData.hx b/lime/project/MetaData.hx deleted file mode 100644 index 6c2425dcc..000000000 --- a/lime/project/MetaData.hx +++ /dev/null @@ -1,15 +0,0 @@ -package lime.project; - - -typedef MetaData = { - - @:optional var buildNumber:String; - @:optional var company:String; - @:optional var companyId:String; - @:optional var companyUrl:String; - @:optional var description:String; - @:optional var packageName:String; - @:optional var title:String; - @:optional var version:String; - -} \ No newline at end of file diff --git a/lime/project/ModuleData.hx b/lime/project/ModuleData.hx deleted file mode 100644 index 2802efdd7..000000000 --- a/lime/project/ModuleData.hx +++ /dev/null @@ -1,57 +0,0 @@ -package lime.project; - - -import lime.tools.helpers.ArrayHelper; - - -class ModuleData { - - - public var classNames:Array; - public var excludeTypes:Array; - public var haxeflags:Array; - public var includeTypes:Array; - public var name:String; - - - public function new (name:String) { - - this.name = name; - classNames = []; - excludeTypes = []; - haxeflags = []; - includeTypes = []; - - } - - - public function clone ():ModuleData { - - var copy = new ModuleData (name); - copy.classNames = classNames.copy (); - copy.excludeTypes = excludeTypes.copy (); - copy.haxeflags = haxeflags.copy (); - copy.includeTypes = includeTypes.copy (); - return copy; - - } - - - public function merge (other:ModuleData):Bool { - - if (other.name == name) { - - classNames = ArrayHelper.concatUnique (classNames, other.classNames); - excludeTypes = ArrayHelper.concatUnique (excludeTypes, other.excludeTypes); - haxeflags = ArrayHelper.concatUnique (haxeflags, other.haxeflags); - includeTypes = ArrayHelper.concatUnique (includeTypes, other.includeTypes); - return true; - - } - - return false; - - } - - -} \ No newline at end of file diff --git a/lime/project/NDLL.hx b/lime/project/NDLL.hx deleted file mode 100644 index 1e6503e36..000000000 --- a/lime/project/NDLL.hx +++ /dev/null @@ -1,40 +0,0 @@ -package lime.project; - - -import sys.FileSystem; - - -class NDLL { - - - public var extensionPath:String; - public var haxelib:Haxelib; - public var name:String; - public var path:String; - public var registerStatics:Bool; - public var subdirectory:String; - public var type:NDLLType; - - - public function new (name:String, haxelib:Haxelib = null, type:NDLLType = null, registerStatics:Bool = true) { - - this.name = name; - this.haxelib = haxelib; - this.type = type == null ? NDLLType.AUTO : type; - this.registerStatics = registerStatics; - - } - - - public function clone ():NDLL { - - var ndll = new NDLL (name, haxelib, type, registerStatics); - ndll.path = path; - ndll.extensionPath = extensionPath; - ndll.subdirectory = subdirectory; - return ndll; - - } - - -} \ No newline at end of file diff --git a/lime/project/NDLLType.hx b/lime/project/NDLLType.hx deleted file mode 100644 index 8803f992e..000000000 --- a/lime/project/NDLLType.hx +++ /dev/null @@ -1,10 +0,0 @@ -package lime.project; - - -enum NDLLType { - - AUTO; - DYNAMIC; - STATIC; - -} \ No newline at end of file diff --git a/lime/project/Orientation.hx b/lime/project/Orientation.hx deleted file mode 100644 index 51da597e7..000000000 --- a/lime/project/Orientation.hx +++ /dev/null @@ -1,11 +0,0 @@ -package lime.project; - - -enum Orientation { - - PORTRAIT; - LANDSCAPE; - ALL; - AUTO; - -} \ No newline at end of file diff --git a/lime/project/Platform.hx b/lime/project/Platform.hx deleted file mode 100644 index bb349e444..000000000 --- a/lime/project/Platform.hx +++ /dev/null @@ -1,28 +0,0 @@ -package lime.project; - - -@:enum abstract Platform(String) { - - var AIR = "air"; - var ANDROID = "android"; - var BLACKBERRY = "blackberry"; - var CONSOLE_PC = "console-pc"; - var FIREFOX = "firefox"; - var FLASH = "flash"; - var HTML5 = "html5"; - var IOS = "ios"; - var LINUX = "linux"; - var MAC = "mac"; - var PS3 = "ps3"; - var PS4 = "ps4"; - var TIZEN = "tizen"; - var VITA = "vita"; - var WINDOWS = "windows"; - var WEBOS = "webos"; - var WIIU = "wiiu"; - var XBOX1 = "xbox1"; - var EMSCRIPTEN = "emscripten"; - var TVOS = "tvos"; - var CUSTOM = null; - -} diff --git a/lime/project/PlatformTarget.hx b/lime/project/PlatformTarget.hx deleted file mode 100644 index 7df0396d7..000000000 --- a/lime/project/PlatformTarget.hx +++ /dev/null @@ -1,177 +0,0 @@ -package lime.project; - - -import haxe.rtti.Meta; -import lime.tools.helpers.AssetHelper; -import lime.tools.helpers.CommandHelper; -import lime.tools.helpers.LogHelper; - - -class PlatformTarget { - - - public var additionalArguments:Array; - public var buildType:String; - public var command:String; - public var noOutput:Bool; - public var project:HXProject; - public var targetDirectory:String; - public var targetFlags:Map; - public var traceEnabled = true; - - - public function new (command:String = null, project:HXProject = null, targetFlags:Map = null) { - - this.command = command; - this.project = project; - this.targetFlags = targetFlags; - - buildType = "release"; - - if (project != null) { - - if (project.debug) { - - buildType = "debug"; - - } else if (project.targetFlags.exists ("final")) { - - buildType = "final"; - - } - - } - - for (haxeflag in project.haxeflags) { - - if (haxeflag == "--no-output") { - - noOutput = true; - - } - - } - - } - - - public function execute (additionalArguments:Array):Void { - - LogHelper.info ("", LogHelper.accentColor + "Using target platform: " + Std.string (project.target).toUpperCase () + LogHelper.resetColor); - - this.additionalArguments = additionalArguments; - var metaFields = Meta.getFields (Type.getClass (this)); - - if (/*!Reflect.hasField (metaFields.watch, "ignore") && */(project.targetFlags.exists ("watch"))) { - - LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: WATCH" + LogHelper.resetColor); - watch (); - return; - - } - - if (!Reflect.hasField (metaFields.display, "ignore") && (command == "display")) { - - display (); - - } - - //if (!Reflect.hasField (metaFields.clean, "ignore") && (command == "clean" || targetFlags.exists ("clean"))) { - if (!Reflect.hasField (metaFields.clean, "ignore") && (command == "clean" || (project.targetFlags.exists ("clean") && (command == "update" || command == "build" || command == "test")))) { - - LogHelper.info ("", LogHelper.accentColor + "Running command: CLEAN" + LogHelper.resetColor); - clean (); - - } - - if (!Reflect.hasField (metaFields.rebuild, "ignore") && (command == "rebuild" || project.targetFlags.exists ("rebuild"))) { - - LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: REBUILD" + LogHelper.resetColor); - - // hack for now, need to move away from project.rebuild.path, probably - - if (project.targetFlags.exists ("rebuild")) { - - project.config.set ("project.rebuild.path", null); - - } - - rebuild (); - - } - - if (!Reflect.hasField (metaFields.update, "ignore") && (command == "update" || command == "build" || command == "test")) { - - LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: UPDATE" + LogHelper.resetColor); - AssetHelper.processLibraries (project, targetDirectory); - update (); - - } - - if (!Reflect.hasField (metaFields.build, "ignore") && (command == "build" || command == "test")) { - - CommandHelper.executeCommands (project.preBuildCallbacks); - - LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: BUILD" + LogHelper.resetColor); - build (); - - CommandHelper.executeCommands (project.postBuildCallbacks); - - } - - if (!Reflect.hasField (metaFields.deploy, "deploy") && (command == "deploy")) { - - LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: DEPLOY" + LogHelper.resetColor); - deploy (); - - } - - if (!Reflect.hasField (metaFields.install, "ignore") && (command == "install" || command == "run" || command == "test")) { - - LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: INSTALL" + LogHelper.resetColor); - install (); - - } - - if (!Reflect.hasField (metaFields.run, "ignore") && (command == "run" || command == "rerun" || command == "test")) { - - LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: RUN" + LogHelper.resetColor); - run (); - - } - - if (!Reflect.hasField (metaFields.trace, "ignore") && (command == "test" || command == "trace" || command == "run" || command == "rerun" )) { - - if (traceEnabled || command == "trace") { - - LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: TRACE" + LogHelper.resetColor); - this.trace (); - - } - - } - - if (!Reflect.hasField (metaFields.uninstall, "ignore") && (command == "uninstall")) { - - LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: UNINSTALL" + LogHelper.resetColor); - uninstall (); - - } - - } - - - @ignore public function build ():Void {} - @ignore public function clean ():Void {} - @ignore public function deploy ():Void {} - @ignore public function display ():Void {} - @ignore public function install ():Void {} - @ignore public function rebuild ():Void {} - @ignore public function run ():Void {} - @ignore public function trace ():Void {} - @ignore public function uninstall ():Void {} - @ignore public function update ():Void {} - @ignore public function watch ():Void {} - - -} \ No newline at end of file diff --git a/lime/project/PlatformType.hx b/lime/project/PlatformType.hx deleted file mode 100644 index 9f3bfde77..000000000 --- a/lime/project/PlatformType.hx +++ /dev/null @@ -1,11 +0,0 @@ -package lime.project; - - -enum PlatformType { - - DESKTOP; - MOBILE; - WEB; - CONSOLE; - -} \ No newline at end of file diff --git a/lime/project/ProjectXMLParser.hx b/lime/project/ProjectXMLParser.hx deleted file mode 100644 index d236cd5bd..000000000 --- a/lime/project/ProjectXMLParser.hx +++ /dev/null @@ -1,2286 +0,0 @@ -package lime.project; - - -import haxe.io.Path; -import haxe.xml.Fast; -import lime.tools.helpers.ArrayHelper; -import lime.tools.helpers.CommandHelper; -import lime.tools.helpers.HaxelibHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.ModuleHelper; -import lime.tools.helpers.ObjectHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.StringMapHelper; -import lime.tools.helpers.StringHelper; -import lime.project.Asset; -import lime.project.AssetType; -import lime.project.Dependency; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.utils.AssetManifest; -import sys.io.File; -import sys.FileSystem; - - -class ProjectXMLParser extends HXProject { - - - public var includePaths:Array; - - private static var doubleVarMatch = new EReg ("\\$\\${(.*?)}", ""); - private static var varMatch = new EReg ("\\${(.*?)}", ""); - - - public function new (path:String = "", defines:Map = null, includePaths:Array = null, useExtensionPath:Bool = false) { - - super (); - - if (defines != null) { - - this.defines = StringMapHelper.copy (defines); - - } - - if (includePaths != null) { - - this.includePaths = includePaths; - - } else { - - this.includePaths = new Array (); - - } - - initialize (); - - if (path != "") { - - process (path, useExtensionPath); - - } - - } - - - private function initialize ():Void { - - switch (platformType) { - - case MOBILE: - - defines.set ("platformType", "mobile"); - defines.set ("mobile", "1"); - - case DESKTOP: - - defines.set ("platformType", "desktop"); - defines.set ("desktop", "1"); - - case WEB: - - defines.set ("platformType", "web"); - defines.set ("web", "1"); - - case CONSOLE: - - defines.set ("platformType", "console"); - defines.set ("console", "1"); - - } - - if (targetFlags.exists ("neko")) { - - defines.set ("targetType", "neko"); - defines.set ("native", "1"); - defines.set ("neko", "1"); - - } else if (targetFlags.exists ("hl")) { - - defines.set ("targetType", "hl"); - defines.set ("native", "1"); - defines.set ("hl", "1"); - - } else if (targetFlags.exists ("java")) { - - defines.set ("targetType", "java"); - defines.set ("native", "1"); - defines.set ("java", "1"); - - } else if (targetFlags.exists ("nodejs")) { - - defines.set ("targetType", "nodejs"); - defines.set ("native", "1"); - defines.set ("nodejs", "1"); - - } else if (targetFlags.exists ("cs")) { - - defines.set ("targetType", "cs"); - defines.set ("native", "1"); - defines.set ("cs", "1"); - - } else if (target == Platform.FIREFOX) { - - defines.set ("targetType", "js"); - defines.set ("html5", "1"); - - } else if (target == Platform.AIR) { - - defines.set ("targetType", "swf"); - defines.set ("flash", "1"); - if (targetFlags.exists("ios")) defines.set ("ios", "1"); - if (targetFlags.exists("android")) defines.set ("android", "1"); - - } else if (target == Platform.WINDOWS && (targetFlags.exists ("uwp") || targetFlags.exists ("winjs"))) { - - targetFlags.set ("uwp", ""); - targetFlags.set ("winjs", ""); - - defines.set ("targetType", "js"); - defines.set ("html5", "1"); - defines.set ("uwp", "1"); - defines.set ("winjs", "1"); - - } else if (platformType == DESKTOP && target != PlatformHelper.hostPlatform) { - - defines.set ("native", "1"); - - if (target == Platform.WINDOWS) { - - defines.set ("targetType", "cpp"); - defines.set ("cpp", "1"); - defines.set ("mingw", "1"); - - } else { - - defines.set ("targetType", "neko"); - defines.set ("neko", "1"); - - } - - } else if (targetFlags.exists ("cpp") || ((platformType != PlatformType.WEB) && !targetFlags.exists ("html5")) || target == Platform.EMSCRIPTEN) { - - defines.set ("targetType", "cpp"); - defines.set ("native", "1"); - defines.set ("cpp", "1"); - - } else if (target == Platform.FLASH) { - - defines.set ("targetType", "swf"); - - } - - if (debug) { - - defines.set ("buildType", "debug"); - defines.set ("debug", "1"); - - } else if (targetFlags.exists ("final")) { - - defines.set ("buildType", "final"); - defines.set ("final", "1"); - - } else { - - defines.set ("buildType", "release"); - defines.set ("release", "1"); - - } - - if (targetFlags.exists ("static")) { - - defines.set ("static_link", "1"); - - } - - if (defines.exists ("SWF_PLAYER")) { - - environment.set ("SWF_PLAYER", defines.get ("SWF_PLAYER")); - - } - - defines.set (Std.string (target).toLowerCase (), "1"); - defines.set ("target", Std.string (target).toLowerCase ()); - defines.set ("platform", defines.get ("target")); - - switch (PlatformHelper.hostPlatform) { - - case WINDOWS: defines.set ("host", "windows"); - case MAC: defines.set ("host", "mac"); - case LINUX: defines.set ("host", "linux"); - default: defines.set ("host", "unknown"); - - } - - } - - - private function isValidElement (element:Fast, section:String):Bool { - - if (element.x.get ("if") != null) { - - var value = element.x.get ("if"); - var optionalDefines = value.split ("||"); - var matchOptional = false; - - for (optional in optionalDefines) { - - optional = substitute (optional); - var requiredDefines = optional.split (" "); - var matchRequired = true; - - for (required in requiredDefines) { - - required = substitute (required); - var check = StringTools.trim (required); - - if (check == "false") { - - matchRequired = false; - - } else if (check != "" && check != "true" && !defines.exists (check) && (environment == null || !environment.exists (check)) && check != command) { - - matchRequired = false; - - } - - } - - if (matchRequired) { - - matchOptional = true; - - } - - } - - if (optionalDefines.length > 0 && !matchOptional) { - - return false; - - } - - } - - if (element.has.unless) { - - var value = substitute (element.att.unless); - var optionalDefines = value.split ("||"); - var matchOptional = false; - - for (optional in optionalDefines) { - - optional = substitute (optional); - var requiredDefines = optional.split (" "); - var matchRequired = true; - - for (required in requiredDefines) { - - required = substitute (required); - var check = StringTools.trim (required); - - if (check == "false") { - - matchRequired = false; - - } else if (check != "" && check != "true" && !defines.exists (check) && (environment == null || !environment.exists (check)) && check != command) { - - matchRequired = false; - - } - - } - - if (matchRequired) { - - matchOptional = true; - - } - - } - - if (optionalDefines.length > 0 && matchOptional) { - - return false; - - } - - } - - if (section != "") { - - if (element.name != "section") { - - return false; - - } - - if (!element.has.id) { - - return false; - - } - - if (substitute (element.att.id) != section) { - - return false; - - } - - } - - return true; - - } - - - private function findIncludeFile (base:String):String { - - if (base == "") { - - return ""; - - } - - if (base.substr (0, 1) != "/" && base.substr (0, 1) != "\\" && base.substr (1, 1) != ":" && base.substr (0, 1) != "." && !FileSystem.exists (base)) { - - for (path in includePaths) { - - var includePath = path + "/" + base; - - if (FileSystem.exists (includePath)) { - - if (FileSystem.exists (includePath + "/include.lime")) { - - return includePath + "/include.lime"; - - } else if (FileSystem.exists (includePath + "/include.nmml")) { - - return includePath + "/include.nmml"; - - } else if (FileSystem.exists (includePath + "/include.xml")) { - - return includePath + "/include.xml"; - - } else { - - return includePath; - - } - - } - - } - - } else { - - if (base.substr ( -1, 1) == "/") { - - base = base.substr (0, base.length - 1); - - } else if (base.substr ( -1, 1) == "\\") { - - base = base.substring (0, base.length - 1); - - } - - if (FileSystem.exists (base)) { - - if (FileSystem.exists (base + "/include.lime")) { - - return base + "/include.lime"; - - } else if (FileSystem.exists (base + "/include.nmml")) { - - return base + "/include.nmml"; - - } else if (FileSystem.exists (base + "/include.xml")) { - - return base + "/include.xml"; - - } else { - - return base; - - } - - } - - } - - return ""; - - } - - - private function formatAttributeName (name:String):String { - - var segments = name.toLowerCase ().split ("-"); - - for (i in 1...segments.length) { - - segments[i] = segments[i].substr (0, 1).toUpperCase () + segments[i].substr (1); - - } - - return segments.join (""); - - } - - - public static function fromFile (path:String, defines:Map = null, includePaths:Array = null, useExtensionPath:Bool = false):ProjectXMLParser { - - if (path == null) return null; - - if (FileSystem.exists (path)) { - - return new ProjectXMLParser (path, defines, includePaths, useExtensionPath); - - } - - return null; - - } - - - private function parseAppElement (element:Fast, extensionPath:String):Void { - - for (attribute in element.x.attributes ()) { - - switch (attribute) { - - case "path": - - app.path = PathHelper.combine (extensionPath, substitute (element.att.path)); - - case "min-swf-version": - - var version = Std.parseFloat (substitute (element.att.resolve ("min-swf-version"))); - - if (version > app.swfVersion) { - - app.swfVersion = version; - - } - - case "swf-version": - - app.swfVersion = Std.parseFloat (substitute (element.att.resolve ("swf-version"))); - - case "preloader": - - app.preloader = substitute (element.att.preloader); - - default: - - // if we are happy with this spec, we can tighten up this parsing a bit, later - - var name = formatAttributeName (attribute); - var value = substitute (element.att.resolve (attribute)); - - if (attribute == "package") { - - name = "packageName"; - - } - - if (Reflect.hasField (app, name)) { - - Reflect.setField (app, name, value); - - } else if (Reflect.hasField (meta, name)) { - - Reflect.setField (meta, name, value); - - } - - } - - } - - } - - - private function parseAssetsElement (element:Fast, basePath:String = "", isTemplate:Bool = false):Void { - - var path = ""; - var embed:Null = null; - var library = null; - var targetPath = ""; - var glyphs = null; - var type = null; - - if (element.has.path) { - - path = PathHelper.combine (basePath, substitute (element.att.path)); - - } - - if (element.has.embed) { - - embed = parseBool (element.att.embed); - - } - - if (element.has.rename) { - - targetPath = substitute (element.att.rename); - - } else if (element.has.path) { - - targetPath = substitute (element.att.path); - - } - - if (element.has.library) { - - library = substitute (element.att.library); - - } - - if (element.has.glyphs) { - - glyphs = substitute (element.att.glyphs); - - } - - if (isTemplate) { - - type = AssetType.TEMPLATE; - - } else if (element.has.type) { - - var typeName = substitute (element.att.type); - - if (Reflect.hasField (AssetType, typeName.toUpperCase ())) { - - type = Reflect.field (AssetType, typeName.toUpperCase ()); - - } else if (typeName == "bytes") { - - type = AssetType.BINARY; - - } else { - - LogHelper.warn ("Ignoring unknown asset type \"" + typeName + "\""); - - } - - } - - if (path == "" && (element.has.include || element.has.exclude || type != null )) { - - LogHelper.error ("In order to use 'include' or 'exclude' on nodes, you must specify also specify a 'path' attribute"); - return; - - } else if (!element.elements.hasNext ()) { - - // Empty element - - if (path == "") { - - return; - - } - - if (!FileSystem.exists (path)) { - - LogHelper.error ("Could not find asset path \"" + path + "\""); - return; - - } - - if (!FileSystem.isDirectory (path)) { - - var asset = new Asset (path, targetPath, type, embed); - asset.library = library; - - if (element.has.id) { - - asset.id = substitute (element.att.id); - - } - - if (glyphs != null) { - - asset.glyphs = glyphs; - - } - - assets.push (asset); - - } else if (Path.extension (path) == "bundle") { - - parseAssetsElementLibrary (path, targetPath, null, null, type, embed, library, glyphs, true); - - } else { - - var exclude = ".*|cvs|thumbs.db|desktop.ini|*.fla|*.hash"; - var include = ""; - - if (element.has.exclude) { - - exclude += "|" + substitute (element.att.exclude); - - } - - if (element.has.include) { - - include = substitute (element.att.include); - - } else { - - //if (type == null) { - - include = "*"; - - /*} else { - - switch (type) { - - case IMAGE: - - include = "*.jpg|*.jpeg|*.png|*.gif"; - - case SOUND: - - include = "*.wav|*.ogg"; - - case MUSIC: - - include = "*.mp2|*.mp3|*.ogg"; - - case FONT: - - include = "*.otf|*.ttf"; - - case TEMPLATE: - - include = "*"; - - default: - - include = "*"; - - } - - }*/ - - } - - parseAssetsElementDirectory (path, targetPath, include, exclude, type, embed, library, glyphs, true); - - } - - } else { - - if (path != "") { - - path += "/"; - - } - - if (targetPath != "") { - - targetPath += "/"; - - } - - for (childElement in element.elements) { - - var isValid = isValidElement (childElement, ""); - - if (isValid) { - - var childPath = substitute (childElement.has.name ? childElement.att.name : childElement.att.path); - var childTargetPath = childPath; - var childEmbed:Null = embed; - var childLibrary = library; - var childType = type; - var childGlyphs = glyphs; - - if (childElement.has.rename) { - - childTargetPath = substitute (childElement.att.rename); - - } - - if (childElement.has.embed) { - - childEmbed = parseBool (childElement.att.embed); - - } - - if (childElement.has.library) { - - childLibrary = substitute (childElement.att.library); - - } - - if (childElement.has.glyphs) { - - childGlyphs = substitute (childElement.att.glyphs); - - } - - switch (childElement.name) { - - case "image", "sound", "music", "font", "template": - - childType = Reflect.field (AssetType, childElement.name.toUpperCase ()); - - case "library", "manifest": - - childType = AssetType.MANIFEST; - - default: - - if (childElement.has.type) { - - childType = Reflect.field (AssetType, substitute (childElement.att.type).toUpperCase ()); - - } - - } - - var id = ""; - - if (childElement.has.id) { - - id = substitute (childElement.att.id); - - } - else if (childElement.has.name) { - - id = substitute (childElement.att.name); - - } - - var asset = new Asset (path + childPath, targetPath + childTargetPath, childType, childEmbed); - asset.library = childLibrary; - asset.id = id; - - if (childGlyphs != null) { - - asset.glyphs = childGlyphs; - - } - - assets.push (asset); - - } - - } - - } - - } - - - private function parseAssetsElementDirectory (path:String, targetPath:String, include:String, exclude:String, type:AssetType, embed:Null, library:String, glyphs:String, recursive:Bool):Void { - - var files = FileSystem.readDirectory (path); - - if (targetPath != "") { - - targetPath += "/"; - - } - - for (file in files) { - - if (FileSystem.isDirectory (path + "/" + file)) { - - if (Path.extension (file) == "bundle") { - - parseAssetsElementLibrary (path + "/" + file, targetPath + file, include, exclude, type, embed, library, glyphs, true); - - } else if (recursive) { - - if (filter (file, [ "*" ], exclude.split ("|"))) { - - parseAssetsElementDirectory (path + "/" + file, targetPath + file, include, exclude, type, embed, library, glyphs, true); - - } - - } - - } else { - - if (filter (file, include.split ("|"), exclude.split ("|"))) { - - var asset = new Asset (path + "/" + file, targetPath + file, type, embed); - asset.library = library; - - if (glyphs != null) { - - asset.glyphs = glyphs; - - } - - assets.push (asset); - - } - - } - - } - - } - - - private function parseAssetsElementLibrary (path:String, targetPath:String, include:String, exclude:String, type:AssetType, embed:Null, library:String, glyphs:String, recursive:Bool):Void { - - var includePath = findIncludeFile (path); - - if (includePath != null && includePath != "" && FileSystem.exists (includePath) && !FileSystem.isDirectory (includePath)) { - - var includeProject = new ProjectXMLParser (includePath, defines); - merge (includeProject); - - } - - var processedLibrary = false; - var jsonPath = PathHelper.combine (path, "library.json"); - - if (FileSystem.exists (jsonPath)) { - - try { - - var manifest = AssetManifest.fromFile (jsonPath); - - if (manifest != null) { - - library = targetPath; - manifest.rootPath = targetPath; - - var asset = new Asset ("", PathHelper.combine (targetPath, "library.json"), AssetType.MANIFEST); - asset.id = "libraries/" + library + ".json"; - asset.library = library; - asset.data = manifest.serialize (); - asset.embed = embed; - assets.push (asset); - - for (manifestAsset in manifest.assets) { - - if (Reflect.hasField (manifestAsset, "path")) { - - var asset = new Asset (PathHelper.combine (path, manifestAsset.path), PathHelper.combine (targetPath, manifestAsset.path), type, embed); - asset.id = manifestAsset.id; - asset.library = library; - asset.embed = embed; - assets.push (asset); - - } - - } - - processedLibrary = true; - - } - - } catch (e:Dynamic) {} - - } - - if (!processedLibrary) { - - parseAssetsElementDirectory (path, targetPath, include, exclude, type, embed, library, glyphs, true); - - } - - } - - - private function parseBool (attribute:String):Bool { - - return substitute (attribute) == "true"; - - } - - - private function parseCommandElement (element:Fast, commandList:Array):Void { - - var command:CLICommand = null; - - if (element.has.haxe) { - - command = CommandHelper.interpretHaxe (substitute (element.att.haxe)); - - } - - if (element.has.open) { - - command = CommandHelper.openFile (substitute (element.att.open)); - - } - - if (element.has.command) { - - command = CommandHelper.fromSingleString (substitute (element.att.command)); - - } - - if (element.has.cmd) { - - command = CommandHelper.fromSingleString (substitute (element.att.cmd)); - - } - - if (command != null) { - - for (arg in element.elements) { - - if (arg.name == "arg") { - - command.args.push (arg.innerData); - - } - - } - - commandList.push (command); - - } - - } - - - private function parseMetaElement (element:Fast):Void { - - for (attribute in element.x.attributes ()) { - - switch (attribute) { - - case "title", "description", "package", "version", "company", "company-id", "build-number", "company-url": - - var value = substitute (element.att.resolve (attribute)); - - defines.set ("APP_" + StringTools.replace (attribute, "-", "_").toUpperCase (), value); - - var name = formatAttributeName (attribute); - - if (attribute == "package") { - - name = "packageName"; - - } - - if (Reflect.hasField (meta, name)) { - - Reflect.setField (meta, name, value); - - } - - } - - } - - } - - - private function parseModuleElement (element:Fast, basePath:String = "", moduleData:ModuleData = null):Void { - - var topLevel = (moduleData == null); - - var exclude = ""; - var include = "*"; - - if (element.has.include) { - - include = substitute (element.att.include); - - } - - if (element.has.exclude) { - - exclude = substitute (element.att.exclude); - - } - - if (moduleData == null) { - - var name = substitute (element.att.name); - - if (modules.exists (name)) { - - moduleData = modules.get (name); - - } else { - - moduleData = new ModuleData (name); - modules.set (name, moduleData); - - } - - } - - switch (element.name) { - - case "module" | "source": - - var sourceAttribute = (element.name == "module" ? "source" : "path"); - - if (element.has.resolve (sourceAttribute)) { - - var source = PathHelper.combine (basePath, substitute (element.att.resolve (sourceAttribute))); - var packageName = ""; - - if (element.has.resolve ("package")) { - - packageName = element.att.resolve ("package"); - - } - - ModuleHelper.addModuleSource (source, moduleData, include.split ("|"), exclude.split ("|"), packageName); - - } - - case "class": - - if (element.has.remove) { - - moduleData.classNames.remove (substitute (element.att.remove)); - - } else { - - moduleData.classNames.push (substitute (element.att.name)); - - } - - case "haxedef": - - var value = substitute (element.att.name); - - if (element.has.value) { - - value += "=" + substitute (element.att.value); - - } - - moduleData.haxeflags.push ("-D " + value); - - case "haxeflag": - - var flag = substitute (element.att.name); - - if (element.has.value) { - - flag += " " + substitute (element.att.value); - - } - - moduleData.haxeflags.push (substitute (flag)); - - case "include": - - moduleData.includeTypes.push (substitute (element.att.type)); - - case "exclude": - - moduleData.excludeTypes.push (substitute (element.att.type)); - - } - - if (topLevel) { - - for (childElement in element.elements) { - - if (isValidElement (childElement, "")) { - - parseModuleElement (childElement, basePath, moduleData); - - } - - } - - } - - } - - - private function parseOutputElement (element:Fast, extensionPath:String):Void { - - if (element.has.name) { - - app.file = substitute (element.att.name); - - } - - if (element.has.path) { - - app.path = PathHelper.combine (extensionPath, substitute (element.att.path)); - - } - - if (element.has.resolve ("swf-version")) { - - app.swfVersion = Std.parseFloat (substitute (element.att.resolve ("swf-version"))); - - } - - } - - - private function parseXML (xml:Fast, section:String, extensionPath:String = ""):Void { - - for (element in xml.elements) { - - var isValid = isValidElement (element, section); - if (isValid) { - - switch (element.name) { - - case "set": - - var name = element.att.name; - var value = ""; - - if (element.has.value) { - - value = substitute (element.att.value); - - } - - switch (name) { - - case "BUILD_DIR": app.path = value; - case "SWF_VERSION": app.swfVersion = Std.parseFloat (value); - case "PRERENDERED_ICON": config.set ("ios.prerenderedIcon", value); - case "ANDROID_INSTALL_LOCATION": config.set ("android.install-location", value); - - } - - defines.set (name, value); - environment.set (name, value); - - case "unset": - - defines.remove (element.att.name); - environment.remove (element.att.name); - - case "define": - - var name = element.att.name; - var value = ""; - - if (element.has.value) { - - value = substitute (element.att.value); - - } - - defines.set (name, value); - haxedefs.set (name, value); - environment.set (name, value); - - case "setenv": - - var value = ""; - - if (element.has.value) { - - value = substitute (element.att.value); - - } else { - - value = "1"; - - } - - var name = substitute (element.att.name); - - defines.set (name, value); - environment.set (name, value); - setenv (name, value); - - if (needRerun) return; - - case "error": - - LogHelper.error (substitute (element.att.value)); - - case "echo": - - LogHelper.println (substitute (element.att.value)); - - case "log": - - var verbose = ""; - - if (element.has.verbose) { - - verbose = substitute (element.att.verbose); - - } - - if (element.has.error) { - - LogHelper.error (substitute (element.att.error), verbose); - - } else if (element.has.warn) { - - LogHelper.warn (substitute (element.att.warn), verbose); - - } else if (element.has.info) { - - LogHelper.info (substitute (element.att.info), verbose); - - } else if (element.has.value) { - - LogHelper.info (substitute (element.att.value), verbose); - - } else if (verbose != "") { - - LogHelper.info ("", verbose); - - } - - case "path": - - var value = ""; - - if (element.has.value) { - - value = substitute (element.att.value); - - } else { - - value = substitute (element.att.name); - - } - - path (value); - - case "include": - - var path = ""; - var addSourcePath = true; - var haxelib = null; - - if (element.has.haxelib) { - - haxelib = new Haxelib (substitute (element.att.haxelib)); - path = findIncludeFile (HaxelibHelper.getPath (haxelib, true)); - addSourcePath = false; - - } else if (element.has.path) { - - var subPath = substitute (element.att.path); - if (subPath == "") subPath = element.att.path; - - path = findIncludeFile (PathHelper.combine (extensionPath, subPath)); - - } else { - - path = findIncludeFile (PathHelper.combine (extensionPath, substitute (element.att.name))); - - } - - if (path != null && path != "" && FileSystem.exists (path) && !FileSystem.isDirectory (path)) { - - var includeProject = new ProjectXMLParser (path, defines); - - if (includeProject != null && haxelib != null) { - - for (ndll in includeProject.ndlls) { - - if (ndll.haxelib == null) { - - ndll.haxelib = haxelib; - - } - - } - - } - - if (addSourcePath) { - - var dir = Path.directory (path); - - if (dir != "") { - - includeProject.sources.unshift (dir); - - } - - } - - merge (includeProject); - - } else if (!element.has.noerror) { - - if (path == "" || FileSystem.isDirectory (path)) { - - var errorPath = ""; - - if (element.has.path) { - - errorPath = element.att.path; - - } else if (element.has.name) { - - errorPath = element.att.name; - - } else { - - errorPath = Std.string (element); - - } - - LogHelper.error ("\"" + errorPath + "\" does not appear to be a valid path"); - - } else { - - LogHelper.error ("Could not find include file \"" + path + "\""); - - } - - } - - case "meta": - - parseMetaElement (element); - - case "app": - - parseAppElement (element, extensionPath); - - case "java": - - javaPaths.push (PathHelper.combine (extensionPath, substitute (element.att.path))); - - case "haxelib": - - if (element.has.repository) { - - setenv ("HAXELIB_PATH", PathHelper.combine (Sys.getCwd (), element.att.repository)); - if (needRerun) return; - continue; - - } - - var name = substitute (element.att.name); - var version = ""; - var optional = false; - var path = null; - - if (element.has.version) { - - version = substitute (element.att.version); - - } - - if (element.has.optional) { - - optional = parseBool (element.att.optional); - - } - - if (element.has.path) { - - path = PathHelper.combine (extensionPath, substitute (element.att.path)); - - } - - var haxelib = new Haxelib (name, version); - - if (version != "" && defines.exists (name) && !haxelib.versionMatches (defines.get (name))) { - - LogHelper.warn ("Ignoring requested haxelib \"" + name + "\" version \"" + version + "\" (version \"" + defines.get (name) + "\" was already included)"); - continue; - - } - - if (path == null) { - - if (defines.exists ("setup")) { - - path = HaxelibHelper.getPath (haxelib); - - } else { - - path = HaxelibHelper.getPath (haxelib, !optional); - - if (optional && path == "") { - - continue; - - } - - } - - } else { - - path = PathHelper.tryFullPath (PathHelper.combine (extensionPath, path)); - - if (version != "") { - - HaxelibHelper.pathOverrides.set (name + ":" + version, path); - - } else { - - HaxelibHelper.pathOverrides.set (name, path); - - } - - } - - if (!defines.exists (haxelib.name)) { - - defines.set (haxelib.name, Std.string (HaxelibHelper.getVersion (haxelib))); - - } - - haxelibs.push (haxelib); - - var includeProject = HXProject.fromHaxelib (haxelib, defines); - - if (includeProject != null) { - - for (ndll in includeProject.ndlls) { - - if (ndll.haxelib == null) { - - ndll.haxelib = haxelib; - - } - - } - - merge (includeProject); - - } - - case "ndll": - - var name = substitute (element.att.name); - var haxelib = null; - var type = NDLLType.AUTO; - var registerStatics = true; - var subdirectory = null; - - if (element.has.haxelib) { - - haxelib = new Haxelib (substitute (element.att.haxelib)); - - } - - if (element.has.dir) { - - subdirectory = substitute (element.att.dir); - - } - - if (haxelib == null && (name == "std" || name == "regexp" || name == "zlib")) { - - haxelib = new Haxelib (config.getString ("cpp.buildLibrary", "hxcpp")); - - } - - if (element.has.type) { - - type = Reflect.field (NDLLType, substitute (element.att.type).toUpperCase ()); - - } - - if (element.has.register) { - - registerStatics = parseBool (element.att.register); - - } - - var ndll = new NDLL (name, haxelib, type, registerStatics); - ndll.extensionPath = extensionPath; - ndll.subdirectory = subdirectory; - - ndlls.push (ndll); - - case "architecture": - - if (element.has.name) { - - var name = substitute (element.att.name); - - if (Reflect.hasField (Architecture, name.toUpperCase ())) { - - ArrayHelper.addUnique (architectures, Reflect.field (Architecture, name.toUpperCase ())); - - } - - } - - if (element.has.exclude) { - - var exclude = substitute (element.att.exclude); - - if (Reflect.hasField (Architecture, exclude.toUpperCase ())) { - - architectures.remove (Reflect.field (Architecture, exclude.toUpperCase ())); - - } - - } - - case "launchImage", "splashscreen", "splashScreen": - - var path = ""; - - if (element.has.path) { - - path = PathHelper.combine (extensionPath, substitute (element.att.path)); - - } else { - - path = PathHelper.combine (extensionPath, substitute (element.att.name)); - - } - - var splashScreen = new SplashScreen (path); - - if (element.has.width) { - - splashScreen.width = Std.parseInt (substitute (element.att.width)); - - } - - if (element.has.height) { - - splashScreen.height = Std.parseInt (substitute (element.att.height)); - - } - - splashScreens.push (splashScreen); - - case "icon": - - var path = ""; - - if (element.has.path) { - - path = PathHelper.combine (extensionPath, substitute (element.att.path)); - - } else { - - path = PathHelper.combine (extensionPath, substitute (element.att.name)); - - } - - var icon = new Icon (path); - - if (element.has.size) { - - icon.size = icon.width = icon.height = Std.parseInt (substitute (element.att.size)); - - } - - if (element.has.width) { - - icon.width = Std.parseInt (substitute (element.att.width)); - - } - - if (element.has.height) { - - icon.height = Std.parseInt (substitute (element.att.height)); - - } - - icons.push (icon); - - case "source", "classpath": - - var path = ""; - - if (element.has.path) { - - path = PathHelper.combine (extensionPath, substitute (element.att.path)); - - } else { - - path = PathHelper.combine (extensionPath, substitute (element.att.name)); - - } - - sources.push (path); - - case "extension": - - // deprecated - - case "haxedef": - - if (element.has.remove) { - - haxedefs.remove (substitute (element.att.remove)); - - } else { - - var name = substitute (element.att.name); - var value = ""; - - if (element.has.value) { - - value = substitute (element.att.value); - - } - - haxedefs.set (name, value); - - } - - case "haxeflag", "compilerflag": - - var flag = substitute (element.att.name); - - if (element.has.value) { - - flag += " " + substitute (element.att.value); - - } - - haxeflags.push (substitute (flag)); - - case "window": - - parseWindowElement (element); - - case "assets": - - parseAssetsElement (element, extensionPath); - - case "library", "swf": - - if (element.has.handler) { - - if (element.has.type) { - - libraryHandlers.set (substitute (element.att.type), substitute (element.att.handler)); - - } - - } else { - - var path = null; - var name = ""; - var type = null; - var embed:Null = null; - var preload = false; - var generate = false; - var prefix = ""; - - if (element.has.path) { - - path = PathHelper.combine (extensionPath, substitute (element.att.path)); - - } - - if (element.has.name) { - - name = substitute (element.att.name); - - } - - if (element.has.id) { - - name = substitute (element.att.id); - - } - - if (element.has.type) { - - type = substitute (element.att.type); - - } - - if (element.has.embed) { - - embed = parseBool (element.att.embed); - - } - - if (element.has.preload) { - - preload = parseBool (element.att.preload); - - } - - if (element.has.generate) { - - generate = parseBool (element.att.generate); - - } - - if (element.has.prefix) { - - prefix = substitute (element.att.prefix); - - } - - libraries.push (new Library (path, name, type, embed, preload, generate, prefix)); - - } - - case "module": - - parseModuleElement (element, extensionPath); - - case "ssl": - - //if (wantSslCertificate()) - //parseSsl (element); - - case "sample": - - samplePaths.push (PathHelper.combine (extensionPath, substitute (element.att.path))); - - case "target": - - if (element.has.handler) { - - if (element.has.name) { - - targetHandlers.set (substitute (element.att.name), substitute (element.att.handler)); - - } - - } - - case "template": - - if (element.has.path) { - - if (element.has.haxelib) { - - var haxelibPath = HaxelibHelper.getPath (new Haxelib (substitute (element.att.haxelib)), true); - var path = PathHelper.combine (haxelibPath, substitute (element.att.path)); - templatePaths.push (path); - - } else { - - var path = PathHelper.combine (extensionPath, substitute (element.att.path)); - - if (FileSystem.exists (path) && !FileSystem.isDirectory (path)) { - - parseAssetsElement (element, extensionPath, true); - - } else { - - templatePaths.push (path); - - } - - } - - } else { - - parseAssetsElement (element, extensionPath, true); - - } - - case "templatePath": - - templatePaths.push (PathHelper.combine (extensionPath, substitute (element.att.name))); - - case "preloader": - - // deprecated - - app.preloader = substitute (element.att.name); - - case "output": - - // deprecated - - parseOutputElement (element, extensionPath); - - case "section": - - parseXML (element, "", extensionPath); - - case "certificate": - - var path = null; - - if (element.has.path) { - - path = element.att.path; - - } else if (element.has.keystore) { - - path = element.att.keystore; - - } - - if (path != null) { - - keystore = new Keystore (PathHelper.combine (extensionPath, substitute (element.att.path))); - - if (element.has.type) { - - keystore.type = substitute (element.att.type); - - } - - if (element.has.password) { - - keystore.password = substitute (element.att.password); - - } - - if (element.has.alias) { - - keystore.alias = substitute (element.att.alias); - - } - - if (element.has.resolve ("alias-password")) { - - keystore.aliasPassword = substitute (element.att.resolve ("alias-password")); - - } else if (element.has.alias_password) { - - keystore.aliasPassword = substitute (element.att.alias_password); - - } - - } - - if (element.has.identity) { - - config.set ("ios.identity", element.att.identity); - config.set ("tvos.identity", element.att.identity); - - } - - if (element.has.resolve ("team-id")) { - - config.set ("ios.team-id", element.att.resolve ("team-id")); - config.set ("tvos.team-id", element.att.resolve ("team-id")); - - } - - case "dependency": - - var name = ""; - var path = ""; - - if (element.has.path) { - - path = PathHelper.combine (extensionPath, substitute (element.att.path)); - - } - - if (element.has.name) { - - var foundName = substitute (element.att.name); - - if (StringTools.endsWith (foundName, ".a") || StringTools.endsWith (foundName, ".dll")) { - - path = PathHelper.combine (extensionPath, foundName); - - } else { - - name = foundName; - - } - - } - - var dependency = new Dependency (name, path); - - if (element.has.resolve ("force-load")) { - - dependency.forceLoad = (substitute (element.att.resolve ("force-load")) == "true"); - - } - - var i = dependencies.length; - - while (i-- > 0) { - - if ((name != "" && dependencies[i].name == name) || (path != "" && dependencies[i].path == path)) { - - dependencies.splice (i, 1); - - } - - } - - dependencies.push (dependency); - - case "android": - - // deprecated - - for (attribute in element.x.attributes ()) { - - var name = attribute; - var value = substitute (element.att.resolve (attribute)); - - switch (name) { - - case "minimum-sdk-version": - - config.set ("android.minimum-sdk-version", Std.parseInt (value)); - - case "target-sdk-version": - - config.set ("android.target-sdk-version", Std.parseInt (value)); - - case "install-location": - - config.set ("android.install-location", value); - - case "extension": - - var extensions = config.getArrayString ("android.extension"); - - if (extensions == null || extensions.indexOf (value) == -1) { - - config.push ("android.extension", value); - - } - - case "permission": - - var permissions = config.getArrayString ("android.permission"); - - if (permissions == null || permissions.indexOf (value) == -1) { - - config.push ("android.permission", value); - - } - - case "gradle-version": - - config.set ("android.gradle-version", value); - - default: - - name = formatAttributeName (attribute); - - } - - } - - case "cpp": - - // deprecated - - for (attribute in element.x.attributes ()) { - - var name = attribute; - var value = substitute (element.att.resolve (attribute)); - - switch (name) { - - case "build-library": - - config.set ("cpp.buildLibrary", value); - - default: - - name = formatAttributeName (attribute); - - } - - } - - case "ios": - - // deprecated - - if (target == Platform.IOS) { - - if (element.has.deployment) { - - var deployment = Std.parseFloat (substitute (element.att.deployment)); - - // If it is specified, assume the dev knows what he is doing! - config.set ("ios.deployment", deployment); - } - - if (element.has.binaries) { - - var binaries = substitute (element.att.binaries); - - switch (binaries) { - - case "fat": - - ArrayHelper.addUnique (architectures, Architecture.ARMV6); - ArrayHelper.addUnique (architectures, Architecture.ARMV7); - - case "armv6": - - ArrayHelper.addUnique (architectures, Architecture.ARMV6); - architectures.remove (Architecture.ARMV7); - - case "armv7": - - ArrayHelper.addUnique (architectures, Architecture.ARMV7); - architectures.remove (Architecture.ARMV6); - - } - - } - - if (element.has.devices) { - - config.set ("ios.device", substitute (element.att.devices).toLowerCase ()); - - } - - if (element.has.compiler) { - - config.set ("ios.compiler", substitute (element.att.compiler)); - - } - - if (element.has.resolve ("prerendered-icon")) { - - config.set ("ios.prerenderedIcon", substitute (element.att.resolve ("prerendered-icon"))); - - } - - if (element.has.resolve ("linker-flags")) { - - config.push ("ios.linker-flags", substitute (element.att.resolve ("linker-flags"))); - - } - - } - - case "tvos": - - // deprecated - - if (target == Platform.TVOS) { - - if (element.has.deployment) { - - var deployment = Std.parseFloat (substitute (element.att.deployment)); - - // If it is specified, assume the dev knows what he is doing! - config.set ("tvos.deployment", deployment); - } - - if (element.has.binaries) { - - var binaries = substitute (element.att.binaries); - - switch (binaries) { - - case "arm64": - - ArrayHelper.addUnique (architectures, Architecture.ARM64); - - } - - } - - if (element.has.devices) { - - config.set ("tvos.device", substitute (element.att.devices).toLowerCase ()); - - } - - if (element.has.compiler) { - - config.set ("tvos.compiler", substitute (element.att.compiler)); - - } - - if (element.has.resolve ("prerendered-icon")) { - - config.set ("tvos.prerenderedIcon", substitute (element.att.resolve ("prerendered-icon"))); - - } - - if (element.has.resolve ("linker-flags")) { - - config.push ("tvos.linker-flags", substitute (element.att.resolve ("linker-flags"))); - - } - - } - - case "config": - - config.parse (element, substitute); - - case "prebuild": - - parseCommandElement (element, preBuildCallbacks); - - case "postbuild": - - parseCommandElement (element, postBuildCallbacks); - - default : - - if (StringTools.startsWith (element.name, "config:")) { - - config.parse (element, substitute); - - } - - } - - } - - } - - } - - - private function parseWindowElement (element:Fast):Void { - - var id = 0; - - if (element.has.id) { - - id = Std.parseInt (substitute (element.att.id)); - - } - - while (id >= windows.length) { - - windows.push (ObjectHelper.copyFields (defaultWindow, {})); - - } - - for (attribute in element.x.attributes ()) { - - var name = attribute; - var value = substitute (element.att.resolve (attribute)); - - switch (name) { - - case "background": - - value = StringTools.replace (value, "#", ""); - - if (value.indexOf ("0x") == -1) { - - value = "0x" + value; - - } - - if (value == "0x" || (value.length == 10 && StringTools.startsWith (value, "0x00"))) { - - windows[id].background = null; - - } else { - - windows[id].background = Std.parseInt (value); - - } - - case "orientation": - - var orientation = Reflect.field (Orientation, Std.string (value).toUpperCase ()); - - if (orientation != null) { - - windows[id].orientation = orientation; - - } - - case "height", "width", "fps", "antialiasing": - - if (Reflect.hasField (windows[id], name)) { - - Reflect.setField (windows[id], name, Std.parseInt (value)); - - } - - case "parameters": - - if (Reflect.hasField (windows[id], name)) { - - Reflect.setField (windows[id], name, Std.string (value)); - - } - - case "allow-high-dpi": - - if (Reflect.hasField (windows[id], "allowHighDPI")) { - - Reflect.setField (windows[id], "allowHighDPI", value == "true"); - - } - - case "color-depth": - - if (Reflect.hasField (windows[id], "colorDepth")) { - - Reflect.setField (windows[id], "colorDepth", Std.parseInt (value)); - - } - - default: - - if (Reflect.hasField (windows[id], name)) { - - Reflect.setField (windows[id], name, value == "true"); - - } else if (Reflect.hasField (windows[id], formatAttributeName (name))) { - - Reflect.setField (windows[id], formatAttributeName (name), value == "true"); - - } - - } - - } - - } - - - public function process (projectFile:String, useExtensionPath:Bool):Void { - - var xml = null; - var extensionPath = ""; - - try { - - xml = new Fast (Xml.parse (File.getContent (projectFile)).firstElement ()); - extensionPath = Path.directory (projectFile); - - } catch (e:Dynamic) { - - LogHelper.error ("\"" + projectFile + "\" contains invalid XML data", e); - - } - - parseXML (xml, "", extensionPath); - - } - - - private function substitute (string:String):String { - - var newString = string; - - while (doubleVarMatch.match (newString)) { - - newString = doubleVarMatch.matchedLeft () + "${" + StringHelper.replaceVariable (this, doubleVarMatch.matched (1)) + "}" + doubleVarMatch.matchedRight (); - - } - - while (varMatch.match (newString)) { - - newString = varMatch.matchedLeft () + StringHelper.replaceVariable (this, varMatch.matched (1)) + varMatch.matchedRight (); - - } - - return newString; - - } - - - -} diff --git a/lime/project/SplashScreen.hx b/lime/project/SplashScreen.hx deleted file mode 100644 index da542031e..000000000 --- a/lime/project/SplashScreen.hx +++ /dev/null @@ -1,32 +0,0 @@ -package lime.project; - - -class SplashScreen { - - - public var height:Int; - public var path:String; - public var width:Int; - - - public function new (path:String, width:Int = 0, height:Int = 0) { - - this.path = path; - this.width = width; - this.height = height; - - } - - - public function clone ():SplashScreen { - - var splashScreen = new SplashScreen (path); - splashScreen.width = width; - splashScreen.height = height; - - return splashScreen; - - } - - -} \ No newline at end of file diff --git a/lime/project/Version.hx b/lime/project/Version.hx deleted file mode 100644 index 3de0f80fd..000000000 --- a/lime/project/Version.hx +++ /dev/null @@ -1,403 +0,0 @@ -package lime.project; - -using StringTools; - -abstract Version(SemVer) from SemVer to SemVer { - static var VERSION = ~/^(\d+)\.(\d+)\.(\d+)(?:[-]([a-z0-9.-]+))?(?:[+]([a-z0-9.-]+))?$/i; - @:from public static function stringToVersion(s : String) { - if(s == null || !VERSION.match(s)) throw 'Invalid SemVer format for "$s"'; - var major = Std.parseInt(VERSION.matched(1)), - minor = Std.parseInt(VERSION.matched(2)), - patch = Std.parseInt(VERSION.matched(3)), - pre = parseIdentifiers(VERSION.matched(4)), - build = parseIdentifiers(VERSION.matched(5)); - return new Version(major, minor, patch, pre, build); - } - - @:from public static function arrayToVersion(a : Array) { - a = (null == a ? [] : a).map(function(v) return v < 0 ? -v : v) - .concat([0,0,0]) - .slice(0, 3); - return new Version(a[0], a[1], a[2], [], []); - } - - inline function new(major : Int, minor : Int, patch : Int, pre : Array, build : Array) - this = { - version : [major, minor, patch], - pre : pre, - build : build - }; - - public var major(get, never) : Int; - public var minor(get, never) : Int; - public var patch(get, never) : Int; - public var pre(get, never) : String; - public var hasPre(get, never) : Bool; - public var build(get, never) : String; - public var hasBuild(get, never) : Bool; - - public function nextMajor() - return new Version(major+1, 0, 0, [], []); - - public function nextMinor() - return new Version(major, minor+1, 0, [], []); - - public function nextPatch() - return new Version(major, minor, patch+1, [], []); - - public function nextPre() - return new Version(major, minor, patch, nextIdentifiers((this : SemVer).pre), []); - - public function nextBuild() - return new Version(major, minor, patch, (this : SemVer).pre, nextIdentifiers((this : SemVer).build)); - - public function withPre(pre : String, ?build : String) - return new Version(major, minor, patch, parseIdentifiers(pre), parseIdentifiers(build)); - - public function withBuild(build : String) - return new Version(major, minor, patch, this.pre, parseIdentifiers(build)); - - public inline function satisfies(rule : VersionRule) : Bool - return rule.isSatisfiedBy(this); - - @:to public function toString() { - if (this == null || this.version == null) return null; - var v = this.version.join('.'); - if(this.pre.length > 0) - v += '-$pre'; - if(this.build.length > 0) - v += '+$build'; - return v; - } - - @:op(A==B) public function equals(other : Version) { - if(major != other.major || minor != other.minor || patch != other.patch) - return false; - return equalsIdentifiers(this.pre, (other : SemVer).pre); - } - - @:op(A!=B) public function different(other : Version) - return !(other.equals(this)); - - @:op(A>B) public function greaterThan(other : Version) { - if(hasPre && other.hasPre) { - return major == other.major - && minor == other.minor - && patch == other.patch - && greaterThanIdentifiers(this.pre, (other : SemVer).pre); - } else if(other.hasPre) { - if(major != other.major) - return major > other.major; - if(minor != other.minor) - return minor > other.minor; - if(patch != other.patch) - return patch > other.patch; - return !hasPre || greaterThanIdentifiers(this.pre, (other : SemVer).pre); - } else if(!hasPre) { - if(major != other.major) - return major > other.major; - if(minor != other.minor) - return minor > other.minor; - if(patch != other.patch) - return patch > other.patch; - return greaterThanIdentifiers(this.pre, (other : SemVer).pre); - } else { - return false; - } - } - - @:op(A>=B) public function greaterThanOrEqual(other : Version) - return equals(other) || greaterThan(other); - - @:op(A 0; - inline function get_build() return identifiersToString(this.build); - inline function get_hasBuild() return this.pre.length > 0; - - static function identifiersToString(ids : Array) - return ids.map(function(id) return switch id { - case StringId(s): s; - case IntId(i): '$i'; - }).join('.'); - - static function parseIdentifiers(s : String) : Array - return (null == s ? '' : s).split('.') - .map(sanitize) - .filter(function(s) return s != '') - .map(parseIdentifier); - - static function parseIdentifier(s : String) : Identifier { - var i = Std.parseInt(s); - return null == i ? StringId(s) : IntId(i); - } - - static function equalsIdentifiers(a : Array, b : Array) { - if(a.length != b.length) - return false; - for(i in 0...a.length) - switch [a[i], b[i]] { - case [StringId(a), StringId(b)] if(a != b): return false; - case [IntId(a), IntId(b)] if(a != b): return false; - case _: - } - return true; - } - - static function greaterThanIdentifiers(a : Array, b : Array) { - for(i in 0...a.length) - switch [a[i], b[i]] { - case [StringId(a), StringId(b)] if(a == b): continue; - case [IntId(a), IntId(b)] if(a == b): continue; - case [StringId(a), StringId(b)] if(a > b): return true; - case [IntId(a), IntId(b)] if(a > b): return true; - case [StringId(_), IntId(_)]: return true; - case _: return false; - } - return false; - } - - static function nextIdentifiers(identifiers : Array) : Array { - var identifiers = identifiers.copy(), - i = identifiers.length; - while(--i >= 0) switch (identifiers[i]) { - case IntId(id): - identifiers[i] = IntId(id+1); - break; - case _: - } - if(i < 0) throw 'no numeric identifier found in $identifiers'; - return identifiers; - } - - static var SANITIZER = ~/[^0-9A-Za-z-]/g; - static function sanitize(s : String) : String - return SANITIZER.replace(s, ''); -} - -enum Identifier { - StringId(value : String); - IntId(value : Int); -} - -typedef SemVer = { - version : Array, - pre : Array, - build : Array -} - -abstract VersionRule(VersionComparator) from VersionComparator to VersionComparator { - static var VERSION = ~/^(>=|<=|[v=><~^])?(\d+|[x*])(?:\.(\d+|[x*]))?(?:\.(\d+|[x*]))?(?:[-]([a-z0-9.-]+))?(?:[+]([a-z0-9.-]+))?$/i; - @:from public static function stringToVersionRule(s : String) : VersionRule { - var ors = s.split("||").map(function(comp) { - comp = comp.trim(); - var p = comp.split(" - "); - return if(p.length == 1) { - comp = comp.trim(); - p = (~/\s+/).split(comp); - if(p.length == 1) { - if(comp.length == 0) { - GreaterThanOrEqualVersion(Version.arrayToVersion([0,0,0]).withPre(VERSION.matched(5), VERSION.matched(6))); - } else if(!VERSION.match(comp)) { - throw 'invalid single pattern "$comp"'; - } else { - // one term pattern - var v = versionArray(VERSION), - vf = v.concat([0, 0, 0]).slice(0, 3); - switch [VERSION.matched(1), v.length] { - case ["v", 0], ["=", 0], ["", 0], [null, 0]: - GreaterThanOrEqualVersion(Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6))); - case ["v", 1], ["=", 1], ["", 1], [null, 1]: - var version = Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6)); - AndRule( - GreaterThanOrEqualVersion(version), - LessThanVersion(version.nextMajor()) - ); - case ["v", 2], ["=", 2], ["", 2], [null, 2]: - var version = Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6)); - AndRule( - GreaterThanOrEqualVersion(version), - LessThanVersion(version.nextMinor()) - ); - case ["v", 3], ["=", 3], ["", 3], [null, 3]: - EqualVersion(Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6))); - case [">", _]: - GreaterThanVersion(Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6))); - case [">=", _]: - GreaterThanOrEqualVersion(Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6))); - case ["<", _]: - LessThanVersion(Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6))); - case ["<=", _]: - LessThanOrEqualVersion(Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6))); - case ["~", 1]: - var version = Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6)); - AndRule( - GreaterThanOrEqualVersion(version), - LessThanVersion(version.nextMajor()) - ); - case ["~", 2], ["~", 3]: - var version = Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6)); - AndRule( - GreaterThanOrEqualVersion(version), - LessThanVersion(version.nextMinor()) - ); - case ["^", 1]: - var version = Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6)); - AndRule( - GreaterThanOrEqualVersion(version), - LessThanVersion(version.nextMajor()) - ); - case ["^", 2]: - var version = Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6)); - AndRule( - GreaterThanOrEqualVersion(version), - LessThanVersion(version.major == 0 ? version.nextMinor() : version.nextMajor()) - ); - case ["^", 3]: - var version = Version.arrayToVersion(vf).withPre(VERSION.matched(5), VERSION.matched(6)); - AndRule( - GreaterThanOrEqualVersion(version), - LessThanVersion(version.major == 0 ? (version.minor == 0 ? version.nextPatch() : version.nextMinor()) : version.nextMajor()) - ); - case [p, _]: throw 'invalid prefix "$p" for rule $comp'; - }; - } - } else if(p.length == 2) { - if(!VERSION.match(p[0])) - throw 'left hand parameter is not a valid version rule "${p[0]}"'; - var lp = VERSION.matched(1), - lva = versionArray(VERSION), - lvf = lva.concat([0, 0, 0]).slice(0, 3), - lv = Version.arrayToVersion(lvf).withPre(VERSION.matched(5), VERSION.matched(6)); - - if(lp != ">" && lp != ">=") - throw 'invalid left parameter version prefix "${p[0]}", should be either > or >='; - if(!VERSION.match(p[1])) - throw 'left hand parameter is not a valid version rule "${p[0]}"'; - var rp = VERSION.matched(1), - rva = versionArray(VERSION), - rvf = rva.concat([0, 0, 0]).slice(0, 3), - rv = Version.arrayToVersion(rvf).withPre(VERSION.matched(5), VERSION.matched(6)); - if(rp != "<" && rp != "<=") - throw 'invalid right parameter version prefix "${p[1]}", should be either < or <='; - - AndRule( - lp == ">" ? GreaterThanVersion(lv) : GreaterThanOrEqualVersion(lv), - rp == "<" ? LessThanVersion(rv) : LessThanOrEqualVersion(rv) - ); - } else { - throw 'invalid multi pattern $comp'; - } - } else if(p.length == 2) { - if(!VERSION.match(p[0])) - throw 'left range parameter is not a valid version rule "${p[0]}"'; - if(VERSION.matched(1) != null && VERSION.matched(1) != "") - throw 'left range parameter should not be prefixed "${p[0]}"'; - var lv = Version.arrayToVersion(versionArray(VERSION).concat([0, 0, 0]).slice(0, 3)).withPre(VERSION.matched(5), VERSION.matched(6)); - if(!VERSION.match(p[1])) - throw 'right range parameter is not a valid version rule "${p[1]}"'; - if(VERSION.matched(1) != null && VERSION.matched(1) != "") - throw 'right range parameter should not be prefixed "${p[1]}"'; - var rva = versionArray(VERSION), - rv = Version.arrayToVersion(rva.concat([0, 0, 0]).slice(0, 3)).withPre(VERSION.matched(5), VERSION.matched(6)); - - if(rva.length == 1) - rv = rv.nextMajor(); - else if(rva.length == 2) - rv = rv.nextMinor(); - - AndRule( - GreaterThanOrEqualVersion(lv), - rva.length == 3 ? LessThanOrEqualVersion(rv) : LessThanVersion(rv) - ); - } else { - throw 'invalid pattern "$comp"'; - } - }); - - var rule = null; - while(ors.length > 0) { - var r = ors.pop(); - if(null == rule) - rule = r; - else - rule = OrRule(r, rule); - } - return rule; - } - - static var IS_DIGITS = ~/^\d+$/; - static function versionArray(re : EReg) { - var arr = [], - t; - for(i in 2...5) { - t = re.matched(i); - if(null != t && IS_DIGITS.match(t)) - arr.push(Std.parseInt(t)); - else - break; - } - return arr; - } - - public static function versionRuleIsValid(rule : String) - return try stringToVersionRule(rule) != null catch(e : Dynamic) false; - - public function isSatisfiedBy(version : Version) : Bool { - return switch this { - case EqualVersion(ver): - version == ver; - case GreaterThanVersion(ver): - version > ver; - case GreaterThanOrEqualVersion(ver): - version >= ver; - case LessThanVersion(ver): - version < ver; - case LessThanOrEqualVersion(ver): - version <= ver; - case AndRule(a, b): - (a : VersionRule).isSatisfiedBy(version) && (b : VersionRule).isSatisfiedBy(version); - case OrRule(a, b): - (a : VersionRule).isSatisfiedBy(version) || (b : VersionRule).isSatisfiedBy(version); - }; - } - - @:to public function toString() : String - return switch ((this : VersionComparator)) { - case EqualVersion(ver): - ver; - case GreaterThanVersion(ver): - '>$ver'; - case GreaterThanOrEqualVersion(ver): - '>=$ver'; - case LessThanVersion(ver): - '<$ver'; - case LessThanOrEqualVersion(ver): - '<=$ver'; - case AndRule(a, b): { - (a : VersionRule) + ' ' + (b : VersionRule); - } - case OrRule(a, b): - (a : VersionRule) + ' || ' + (b : VersionRule); - }; -} - -enum VersionComparator { - EqualVersion(ver : Version); - GreaterThanVersion(ver : Version); - GreaterThanOrEqualVersion(ver : Version); - LessThanVersion(ver : Version); - LessThanOrEqualVersion(ver : Version); - AndRule(a : VersionComparator, b : VersionComparator); - OrRule(a : VersionComparator, b : VersionComparator); -} \ No newline at end of file diff --git a/lime/project/WindowData.hx b/lime/project/WindowData.hx deleted file mode 100644 index 37c93ae44..000000000 --- a/lime/project/WindowData.hx +++ /dev/null @@ -1,36 +0,0 @@ -package lime.project; - - -typedef WindowData = { - - @:optional var width:Int; - @:optional var height:Int; - @:optional var x:Float; - @:optional var y:Float; - @:optional var background:Null; - @:optional var parameters:String; - @:optional var fps:Int; - @:optional var hardware:Bool; - @:optional var display:Int; - @:optional var resizable:Bool; - @:optional var borderless:Bool; - @:optional var vsync:Bool; - @:optional var fullscreen:Bool; - @:optional var allowHighDPI:Bool; - @:optional var alwaysOnTop:Bool; - @:optional var antialiasing:Int; - @:optional var orientation:Orientation; - @:optional var allowShaders:Bool; - @:optional var requireShaders:Bool; - @:optional var depthBuffer:Bool; - @:optional var stencilBuffer:Bool; - @:optional var title:String; - #if (js && html5) - @:optional var element:js.html.Element; - #end - @:optional var colorDepth:Int; - @:optional var minimized:Bool; - @:optional var maximized:Bool; - @:optional var hidden:Bool; - -} \ No newline at end of file diff --git a/lime/text/GlyphPosition.hx b/lime/text/GlyphPosition.hx deleted file mode 100644 index 432a66b1e..000000000 --- a/lime/text/GlyphPosition.hx +++ /dev/null @@ -1,37 +0,0 @@ -package lime.text; - - -import lime.math.Vector2; - -#if !lime_debug -@:fileXml('tags="haxe,release"') -@:noDebug -#end - - -class GlyphPosition { - - - public var advance:Vector2; - public var glyph:Glyph; - public var offset:Vector2; - - - public function new (glyph:Glyph, advance:Vector2, offset:Vector2 = null) { - - this.glyph = glyph; - this.advance = advance; - - if (offset != null) { - - this.offset = offset; - - } else { - - this.offset = new Vector2 (); - - } - - } - -} \ No newline at end of file diff --git a/lime/text/TextDirection.hx b/lime/text/TextDirection.hx deleted file mode 100644 index 1c8bdbd15..000000000 --- a/lime/text/TextDirection.hx +++ /dev/null @@ -1,70 +0,0 @@ -package lime.text; - - -@:enum abstract TextDirection(Int) to (Int) { - - - var INVALID = 0; - var LEFT_TO_RIGHT = 4; - var RIGHT_TO_LEFT = 5; - var TOP_TO_BOTTOM = 6; - var BOTTOM_TO_TOP = 7; - - - public var backward (get, never):Bool; - public var forward (get, never):Bool; - public var horizontal (get, never):Bool; - public var vertical (get, never):Bool; - - - public inline function reverse ():Void { - - this = this ^ 1; - - } - - - public inline function toString ():String { - - return switch (this) { - - case LEFT_TO_RIGHT: "leftToRight"; - case RIGHT_TO_LEFT: "rightToLeft"; - case TOP_TO_BOTTOM: "topToBottom"; - case BOTTOM_TO_TOP: "bottomToTop"; - default: ""; - - } - - } - - - private inline function get_backward ():Bool { - - return (this & ~2) == 5; - - } - - - private inline function get_forward ():Bool { - - return (this & ~2) == 4; - - } - - - private inline function get_horizontal ():Bool { - - return (this & ~1) == 4; - - } - - - private inline function get_vertical ():Bool { - - return (this & ~1) == 6; - - } - - -} \ No newline at end of file diff --git a/lime/text/TextLayout.hx b/lime/text/TextLayout.hx deleted file mode 100644 index 2b00a45f8..000000000 --- a/lime/text/TextLayout.hx +++ /dev/null @@ -1,252 +0,0 @@ -package lime.text; - - -import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; -import lime.math.Vector2; -import lime.system.System; - -#if !lime_debug -@:fileXml('tags="haxe,release"') -@:noDebug -#end - -@:access(lime._backend.native.NativeCFFI) -@:access(lime.text.Font) - - -class TextLayout { - - - public var direction (get, set):TextDirection; - public var font (default, set):Font; - public var glyphs (get, null):Array; - public var language (get, set):String; - @:isVar public var positions (get, null):Array; - public var script (get, set):TextScript; - public var size (default, set):Int; - public var text (default, set):String; - - private var __dirty:Bool; - - @:noCompletion private var __buffer:Bytes; - @:noCompletion private var __direction:TextDirection; - @:noCompletion private var __handle:Dynamic; - @:noCompletion private var __language:String; - @:noCompletion private var __script:TextScript; - - - public function new (text:String = "", font:Font = null, size:Int = 12, direction:TextDirection = LEFT_TO_RIGHT, script:TextScript = COMMON, language:String = "en") { - - this.text = text; - this.font = font; - this.size = size; - __direction = direction; - __script = script; - __language = language; - - positions = []; - __dirty = true; - - #if (lime_cffi && !macro) - __handle = NativeCFFI.lime_text_layout_create (__direction, __script, __language); - #end - } - - - @:noCompletion private function __position ():Void { - - positions = []; - - #if (lime_cffi && !macro) - - if (__handle != null && text != null && text != "" && font != null && font.src != null) { - - if (__buffer == null) { - - __buffer = Bytes.alloc (text.length * 5); - //__buffer.endian = (System.endianness == BIG_ENDIAN ? "bigEndian" : "littleEndian"); - - } - - var data = NativeCFFI.lime_text_layout_position (__handle, font.src, size, text, #if cs null #else __buffer #end); - var position = 0; - - if (__buffer.length > 4) { - - var count = __buffer.getInt32 (position); position += 4; - var codepoint, index, advanceX, advanceY, offsetX, offsetY; - var lastIndex = -1; - - for (i in 0...count) { - - codepoint = __buffer.getInt32 (position); position += 4; - index = __buffer.getInt32 (position); position += 4; - advanceX = __buffer.getFloat (position); position += 4; - advanceY = __buffer.getFloat (position); position += 4; - offsetX = __buffer.getFloat (position); position += 4; - offsetY = __buffer.getFloat (position); position += 4; - - for (j in lastIndex + 1...index) { - - // TODO: Handle differently? - - positions.push (new GlyphPosition (0, new Vector2 (0, 0), new Vector2 (0, 0))); - - } - - positions.push (new GlyphPosition (codepoint, new Vector2 (advanceX, advanceY), new Vector2 (offsetX, offsetY))); - lastIndex = index; - - } - - } - } - - #end - - } - - - - - // Get & Set Methods - - - - - @:noCompletion private function get_positions ():Array { - - if (__dirty) { - - __dirty = false; - __position (); - - } - - return positions; - - } - - - @:noCompletion private function get_direction ():TextDirection { - - return __direction; - - } - - - @:noCompletion private function set_direction (value:TextDirection):TextDirection { - - if (value == __direction) return value; - - __direction = value; - - #if (lime_cffi && !macro) - NativeCFFI.lime_text_layout_set_direction (__handle, value); - #end - - __dirty = true; - - return value; - - } - - - @:noCompletion private function set_font (value:Font):Font { - - if (value == this.font) return value; - - this.font = value; - __dirty = true; - return value; - - } - - - @:noCompletion private function get_glyphs ():Array { - - var glyphs = []; - - for (position in positions) { - - glyphs.push (position.glyph); - - } - - return glyphs; - - } - - - @:noCompletion private function get_language ():String { - - return __language; - - } - - - @:noCompletion private function set_language (value:String):String { - - if (value == __language) return value; - - __language = value; - - #if (lime_cffi && !macro) - NativeCFFI.lime_text_layout_set_language (__handle, value); - #end - - __dirty = true; - - return value; - - } - - - @:noCompletion private function get_script ():TextScript { - - return __script; - - } - - - @:noCompletion private function set_script (value:TextScript):TextScript { - - if (value == __script) return value; - - __script = value; - - #if (lime_cffi && !macro) - NativeCFFI.lime_text_layout_set_script (__handle, value); - #end - - __dirty = true; - - return value; - - } - - - @:noCompletion private function set_size (value:Int):Int { - - if (value == this.size) return value; - - this.size = value; - __dirty = true; - return value; - - } - - - @:noCompletion private function set_text (value:String):String { - - if (value == this.text) return value; - - this.text = value; - __dirty = true; - return value; - - } - - -} \ No newline at end of file diff --git a/lime/text/TextScript.hx b/lime/text/TextScript.hx deleted file mode 100644 index 1298fc6d4..000000000 --- a/lime/text/TextScript.hx +++ /dev/null @@ -1,162 +0,0 @@ -package lime.text; - - -@:enum abstract TextScript(String) to (String) { - - var COMMON = "Zyyy"; - var INHERITED = "Zinh"; - var UNKNOWN = "Zzzz"; - - var ARABIC = "Arab"; - var ARMENIAN = "Armn"; - var BENGALI = "Beng"; - var CYRILLIC = "Cyrl"; - var DEVANAGARI = "Deva"; - var GEORGIAN = "Geor"; - var GREEK = "Grek"; - var GUJARATI = "Gujr"; - var GURMUKHI = "Guru"; - var HANGUL = "Hang"; - var HAN = "Hani"; - var HEBREW = "Hebr"; - var HIRAGANA = "Hira"; - var KANNADA = "Knda"; - var KATAKANA = "Kana"; - var LAO = "Laoo"; - var LATIN = "Latn"; - var MALAYALAM = "Mlym"; - var ORIYA = "Orya"; - var TAMIL = "Taml"; - var TELUGA = "Telu"; - var THAI = "Thai"; - - var TIBETAN = "Tibt"; - - var BOPOMOFO = "Bopo"; - var BRAILLE = "Brai"; - var CANADIAN_SYLLABICS = "Cans"; - var CHEROKEE = "Cher"; - var ETHIOPIC = "Ethi"; - var KHMER = "Khmr"; - var MONGOLIAN = "Mong"; - var MYANMAR = "Mymr"; - var OGHAM = "Ogam"; - var RUNIC = "Runr"; - var SINHALA = "Sinh"; - var SYRIAC = "Syrc"; - var THAANA = "Thaa"; - var YI = "Yiii"; - - var DESERET = "Dsrt"; - var GOTHIC = "Goth"; - var OLD_ITALIC = "Ital"; - - var BUHID = "Buhd"; - var HANUNOO = "Hano"; - var TAGALOG = "Tglg"; - var TAGBANWA = "Tagb"; - - var CYPRIOT = "Cprt"; - var LIMBU = "Limb"; - var LINEAR_B = "Linb"; - var OSMANYA = "Osma"; - var SHAVIAN = "Shaw"; - var TAI_LE = "Tale"; - var UGARITIC = "Ugar"; - - var BUGINESE = "Bugi"; - var COPTIC = "Copt"; - var GLAGOLITIC = "Glag"; - var KHAROSHTHI = "Khar"; - var NEW_TAI_LUE = "Talu"; - var OLD_PERSIAN = "Xpeo"; - var SYLOTI_NAGRI = "Sylo"; - var TIFINAGH = "Tfng"; - - var BALINESE = "Bali"; - var CUNEIFORM = "Xsux"; - var NKO = "Nkoo"; - var PHAGS_PA = "Phag"; - var PHOENICIAN = "Phnx"; - - var CARIAN = "Cari"; - var CHAM = "Cham"; - var KAYAH_LI = "Kali"; - var LEPCHA = "Lepc"; - var LYCIAN = "Lyci"; - var LYDIAN = "Lydi"; - var OL_CHIKI = "Olck"; - var REJANG = "Rjng"; - var SAURASHTRA = "Saur"; - var SUNDANESE = "Sund"; - var VAI = "Vaii"; - - var AVESTAN = "Avst"; - var BAMUM = "Bamu"; - var EGYPTIAN_HIEROGLYPHS = "Egyp"; - var IMPERIAL_ARAMAIC = "Armi"; - var INSCRIPTIONAL_PAHLAVI = "Phli"; - var INSCRIPTIONAL_PARTHIAN = "Prti"; - var JAVANESE = "Java"; - var KAITHI = "Kthi"; - var LISU = "Lisu"; - var MEETEI_MAYEK = "Mtei"; - var OLD_SOUTH_ARABIAN = "Sarb"; - var OLD_TURKIC = "Orkh"; - var SAMARITAN = "Samr"; - var TAI_THAM = "Lana"; - var TAI_VIET = "Tavt"; - - var BATAK = "Batk"; - var BRAHMI = "Brah"; - var MANDAIC = "Mand"; - - var CHAKMA = "Cakm"; - var MEROITIC_CURSIVE = "Merc"; - var MEROITIC_HIEROGLYPHS = "Mero"; - var MIAO = "Plrd"; - var SHARADA = "Shrd"; - var SORA_SOMPENG = "Sora"; - var TAKRI = "Takr"; - - var BASSA_VAH = "Bass"; - var CAUCASIAN_ALBANIAN = "Aghb"; - var DUPLOYAN = "Dupl"; - var ELBASAN = "Elba"; - var GRANTHA = "Gran"; - var KHOJKI = "Khoj"; - var KHUDAWADI = "Sind"; - var LINEAR_A = "Lina"; - var MAHAJANI = "Mahj"; - var MANICHAEAN = "Mani"; - var MENDE_KIKAKUI = "Mend"; - var MODI = "Modi"; - var MRO = "Mroo"; - var NABATAEAN = "Nbat"; - var OLD_NORTH_ARABIAN = "Narb"; - var OLD_PERMIC = "Perm"; - var PAHAWH_HMONG = "Hmng"; - var PALMYRENE = "Palm"; - var PAU_CIN_HAU = "Pauc"; - var PSALTER_PAHLAVI = "Phlp"; - var SIDDHAM = "Sidd"; - var TIRHUTA = "Tirh"; - var WARANG_CITI = "Wara"; - - - public var rightToLeft (get, never):Bool; - - - private inline function get_rightToLeft ():Bool { - - return switch (this) { - - case HEBREW, ARABIC, SYRIAC, THAANA, NKO, SAMARITAN, MANDAIC, IMPERIAL_ARAMAIC, PHOENICIAN, LYDIAN, CYPRIOT, KHAROSHTHI, OLD_SOUTH_ARABIAN, AVESTAN, INSCRIPTIONAL_PAHLAVI, PSALTER_PAHLAVI, OLD_TURKIC: true; - //case KURDISH: true; - default: false; - - } - - } - -} \ No newline at end of file diff --git a/lime/tools/helpers/AIRHelper.hx b/lime/tools/helpers/AIRHelper.hx deleted file mode 100644 index 223f3a220..000000000 --- a/lime/tools/helpers/AIRHelper.hx +++ /dev/null @@ -1,342 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Path; -import lime.project.HXProject; -import lime.project.Platform; -import sys.FileSystem; - - -class AIRHelper { - - - public static function build (project:HXProject, workingDirectory:String, targetPlatform:Platform, targetPath:String, applicationXML:String, files:Array, fileDirectory:String = null):String { - - //var airTarget = "air"; - //var extension = ".air"; - var airTarget = "bundle"; - var extension = ""; - - switch (targetPlatform) { - - case MAC: - - // extension = ".app"; - - case IOS: - - if (project.targetFlags.exists ("simulator")) { - - if (project.debug) { - - airTarget = "ipa-debug-interpreter-simulator"; - - } else { - - airTarget = "ipa-test-interpreter-simulator"; - - } - - } else { - - if (project.debug) { - - airTarget = "ipa-debug"; - - } else { - - airTarget = "ipa-test"; - - } - - } - - // extension = ".ipa"; - - case ANDROID: - - if (project.debug) { - - airTarget = "apk-debug"; - - } else { - - airTarget = "apk"; - - } - - // extension = ".apk"; - - default: - - } - - var signingOptions = []; - - if (project.keystore != null) { - - var keystore = PathHelper.tryFullPath (project.keystore.path); - var keystoreType = project.keystore.type != null ? project.keystore.type : "pkcs12"; - - signingOptions.push ("-storetype"); - signingOptions.push (keystoreType); - signingOptions.push ("-keystore"); - signingOptions.push (keystore); - - if (project.keystore.alias != null) { - - signingOptions.push ("-alias"); - signingOptions.push (project.keystore.alias); - - } - - if (project.keystore.password != null) { - - signingOptions.push ("-storepass"); - signingOptions.push (project.keystore.password); - - } - - if (project.keystore.aliasPassword != null) { - - signingOptions.push ("-keypass"); - signingOptions.push (project.keystore.aliasPassword); - - } - - } else { - - signingOptions.push ("-storetype"); - signingOptions.push ("pkcs12"); - signingOptions.push ("-keystore"); - signingOptions.push (PathHelper.findTemplate (project.templatePaths, "air/debug.pfx")); - signingOptions.push ("-storepass"); - signingOptions.push ("samplePassword"); - - } - - var args = [ "-package" ]; - - // TODO: Is this an old workaround fixed in newer AIR SDK? - - if (airTarget == "air" || airTarget == "bundle") { - - args = args.concat (signingOptions); - args.push ("-target"); - args.push (airTarget); - - } else { - - args.push ("-target"); - args.push (airTarget); - args = args.concat (signingOptions); - - } - - if (targetPlatform == IOS) { - - var provisioningProfile = IOSHelper.getProvisioningFile (project); - - if (provisioningProfile != "") { - - args.push ("-provisioning-profile"); - args.push (provisioningProfile); - - } - - } - - args = args.concat ([ targetPath + extension, applicationXML ]); - - if (targetPlatform == IOS && PlatformHelper.hostPlatform == Platform.MAC && project.targetFlags.exists ("simulator")) { - - args.push ("-platformsdk"); - args.push (IOSHelper.getSDKDirectory (project)); - - } - - if (fileDirectory != null && fileDirectory != "") { - - args.push ("-C"); - args.push (fileDirectory); - - } - - args = args.concat (files); - - var extDirs:Array = getExtDirs(project); - - if (extDirs.length > 0) { - - args.push("-extdir"); - - for (extDir in extDirs) { - - args.push(extDir); - - } - } - - if (targetPlatform == ANDROID) { - - Sys.putEnv ("AIR_NOANDROIDFLAIR", "true"); - - } - - ProcessHelper.runCommand (workingDirectory, project.defines.get ("AIR_SDK") + "/bin/adt", args); - - return targetPath + extension; - - } - - - public static function getExtDirs(project:HXProject):Array { - - var extDirs:Array = []; - - for (dependency in project.dependencies) { - - var extDir:String = FileSystem.fullPath(Path.directory(dependency.path)); - - if (StringTools.endsWith (dependency.path, ".ane") && extDirs.indexOf(extDir) == -1) { - - extDirs.push(extDir); - - } - - } - - return extDirs; - - } - - - public static function run (project:HXProject, workingDirectory:String, targetPlatform:Platform, applicationXML:String, rootDirectory:String = null):Void { - - if (targetPlatform == ANDROID) { - - AndroidHelper.initialize (project); - AndroidHelper.install (project, FileSystem.fullPath (workingDirectory) + "/" + (rootDirectory != null ? rootDirectory + "/" : "") + project.app.file + ".apk"); - AndroidHelper.run (project.meta.packageName + "/.AppEntry"); - - } else if (targetPlatform == IOS) { - - var args = [ "-platform", "ios" ]; - - if (project.targetFlags.exists ("simulator")) { - - args.push ("-device"); - args.push ("ios-simulator"); - args.push ("-platformsdk"); - args.push (IOSHelper.getSDKDirectory (project)); - - ProcessHelper.runCommand ("", "killall", [ "iPhone Simulator" ], true, true); - - } - - ProcessHelper.runCommand (workingDirectory, project.defines.get ("AIR_SDK") + "/bin/adt", [ "-uninstallApp" ].concat (args).concat ([ "-appid", project.meta.packageName ]), true, true); - ProcessHelper.runCommand (workingDirectory, project.defines.get ("AIR_SDK") + "/bin/adt", [ "-installApp" ].concat (args).concat ([ "-package", FileSystem.fullPath (workingDirectory) + "/" + (rootDirectory != null ? rootDirectory + "/" : "") + project.app.file + ".ipa" ])); - - if (project.targetFlags.exists ("simulator")) { - - var simulatorAppPath:String = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/"; - - if (!FileSystem.exists(simulatorAppPath)) { - - simulatorAppPath = "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/"; - - } - - ProcessHelper.runCommand ("", "open", [ simulatorAppPath ]); - - } - - } else { - - var extDirs:Array = getExtDirs(project); - - var profile:String = extDirs.length > 0 ? "extendedDesktop" : "desktop"; - - var args = [ "-profile", profile ]; - - if (!project.debug) { - - args.push ("-nodebug"); - - } - - if (extDirs.length > 0) { - - args.push("-extdir"); - - for (extDir in extDirs) { - - if (!FileSystem.exists(extDir + "/adl")) { - - LogHelper.error("Create " + extDir + "/adl directory, and extract your ANE files to .ane directories."); - - } - - args.push(extDir + "/adl"); - - } - } - - args.push (applicationXML); - - if (rootDirectory != null && rootDirectory != "") { - - args.push (rootDirectory); - - } - - ProcessHelper.runCommand (workingDirectory, project.defines.get ("AIR_SDK") + "/bin/adl", args); - - } - - } - - - public static function trace (project:HXProject, workingDirectory:String, targetPlatform:Platform, applicationXML:String, rootDirectory:String = null) { - - if (targetPlatform == ANDROID) { - - AndroidHelper.initialize (project); - var deviceID = null; - var adbFilter = null; - - // if (!LogHelper.verbose) { - - if (project.debug) { - - adbFilter = project.meta.packageName + ":I ActivityManager:I *:S"; - - } else { - - adbFilter = project.meta.packageName + ":I *:S"; - - } - - // } - - AndroidHelper.trace (project, project.debug, deviceID, adbFilter); - - } - - } - - - public static function uninstall (project:HXProject, workingDirectory:String, targetPlatform:Platform, applicationXML:String, rootDirectory:String = null) { - - if (targetPlatform == ANDROID) { - - AndroidHelper.initialize (project); - var deviceID = null; - AndroidHelper.uninstall (project.meta.packageName, deviceID); - - } - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/AndroidHelper.hx b/lime/tools/helpers/AndroidHelper.hx deleted file mode 100644 index 2ba4c083a..000000000 --- a/lime/tools/helpers/AndroidHelper.hx +++ /dev/null @@ -1,472 +0,0 @@ -package lime.tools.helpers; - - -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.ProcessHelper; -import lime.project.HXProject; -import lime.project.Platform; -import sys.io.File; -import sys.FileSystem; - - -class AndroidHelper { - - - private static var adbName:String; - private static var adbPath:String; - private static var androidName:String; - private static var androidPath:String; - private static var emulatorName:String; - private static var emulatorPath:String; - - - public static function build (project:HXProject, projectDirectory:String):Void { - - if (project.environment.exists ("ANDROID_SDK")) { - - Sys.putEnv ("ANDROID_SDK", project.environment.get ("ANDROID_SDK")); - - } - - var task = "assembleDebug"; - - if (project.keystore != null) { - - task = "assembleRelease"; - - } - - if (project.environment.exists ("ANDROID_GRADLE_TASK")) { - - task = project.environment.get ("ANDROID_GRADLE_TASK"); - - } - - if (PlatformHelper.hostPlatform != Platform.WINDOWS) { - - ProcessHelper.runCommand ("", "chmod", [ "755", PathHelper.combine (projectDirectory, "gradlew") ]); - ProcessHelper.runCommand (projectDirectory, "./gradlew", task.split (" ")); - - } else { - - ProcessHelper.runCommand (projectDirectory, "gradlew", task.split (" ")); - - } - } - - - private static function connect (deviceID:String):Void { - - if (deviceID != null && deviceID != "" && deviceID.indexOf ("emulator") == -1) { - - if (deviceID.indexOf (":") > 0) { - - deviceID = deviceID.substr (0, deviceID.indexOf (":")); - - } - - ProcessHelper.runCommand (adbPath, adbName, [ "connect", deviceID ]); - - } - - } - - - public static function getBuildToolsVersion (project:HXProject):String { - - var buildToolsPath = PathHelper.combine (project.environment.get ("ANDROID_SDK"), "build-tools/"); - - var version = ~/^(\d+)\.(\d+)\.(\d+)$/i; - var current = { major : 0, minor : 0, micro : 0 }; - - if (!FileSystem.exists (buildToolsPath)) { - - LogHelper.error ("Cannot find directory \"" + buildToolsPath + "\""); - - } - - for (buildTool in FileSystem.readDirectory (buildToolsPath)) { - - //gradle only likes simple version numbers (x.y.z) - - if (!version.match (buildTool)) { - - continue; - - } - - var newVersion = { - - major: Std.parseInt (version.matched (1)), - minor: Std.parseInt (version.matched (2)), - micro: Std.parseInt (version.matched (3)) - - }; - - if (newVersion.major != current.major) { - - if (newVersion.major > current.major) { - - current = newVersion; - - } - - } else if (newVersion.minor != current.minor) { - - if (newVersion.minor > current.minor) { - - current = newVersion; - - } - - } else { - - if (newVersion.micro > current.micro) { - - current = newVersion; - - } - - } - - } - - return '${current.major}.${current.minor}.${current.micro}'; - - } - - - public static function getDeviceSDKVersion (deviceID:String):Int { - - var devices = listDevices (); - - if (devices.length > 0) { - - var tempFile = PathHelper.getTemporaryFile (); - - var args = [ "wait-for-device", "shell", "getprop", "ro.build.version.sdk", ">", tempFile ]; - - if (deviceID != null && deviceID != "") { - - args.unshift (deviceID); - args.unshift ("-s"); - - //connect (deviceID); - - } - - if (PlatformHelper.hostPlatform == Platform.MAC) { - - ProcessHelper.runCommand (adbPath, "perl", [ "-e", 'alarm shift @ARGV; exec @ARGV', "3", adbName ].concat (args), true, true); - - } else { - - ProcessHelper.runCommand (adbPath, adbName, args, true, true); - - } - - if (FileSystem.exists (tempFile)) { - - var output = File.getContent (tempFile); - FileSystem.deleteFile (tempFile); - return Std.parseInt (output); - - } - - } - - return 0; - } - - - public static function initialize (project:HXProject):Void { - - adbPath = project.environment.get ("ANDROID_SDK") + "/tools/"; - androidPath = project.environment.get ("ANDROID_SDK") + "/tools/"; - emulatorPath = project.environment.get ("ANDROID_SDK") + "/tools/"; - - adbName = "adb"; - androidName = "android"; - emulatorName = "emulator"; - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - adbName += ".exe"; - androidName += ".bat"; - emulatorName += ".exe"; - - } - - if (!FileSystem.exists (adbPath + adbName)) { - - adbPath = project.environment.get ("ANDROID_SDK") + "/platform-tools/"; - - } - - if (PlatformHelper.hostPlatform != Platform.WINDOWS) { - - adbName = "./" + adbName; - androidName = "./" + androidName; - emulatorName = "./" + emulatorName; - - } - - if (project.environment.exists ("JAVA_HOME")) { - - Sys.putEnv ("JAVA_HOME", project.environment.get ("JAVA_HOME")); - - } - - } - - - public static function install (project:HXProject, targetPath:String, deviceID:String = null):String { - - if (project.targetFlags.exists ("emulator") || project.targetFlags.exists ("simulator")) { - - LogHelper.info ("", "Searching for Android emulator"); - - var devices = listDevices (); - - for (device in devices) { - - if (device.indexOf ("emulator") > -1) { - - deviceID = device; - - } - - } - - //TODO: Check emulator capabilities, if it is GPU enabled and if API LEVEL >15 (http://developer.android.com/tools/devices/emulator.html) - - if (deviceID == null) { - - var avds = listAVDs (); - - if (avds.length == 0) { - - LogHelper.error ("Cannot find emulator, please use AVD manager to create one"); - - } - - LogHelper.info ("Starting AVD: " + avds[0]); - - ProcessHelper.runProcess (emulatorPath, emulatorName, [ "-avd", avds[0], "-gpu", "on" ], false); - - while (deviceID == null) { - - devices = listDevices (); - - for (device in devices) { - - if (device.indexOf ("emulator") > -1) { - - deviceID = device; - - } - - } - - if (deviceID == null) { - - Sys.sleep (3); - - if (!LogHelper.verbose) { - - Sys.print ("."); - - } - - } else { - - Sys.println (""); - - } - - } - - } - - ProcessHelper.runCommand (adbPath, adbName, [ "-s", deviceID, "shell", "input", "keyevent", "82" ]); - - } - - var args = [ "install", "-r" ]; - - //if (getDeviceSDKVersion (deviceID) > 16) { - - args.push ("-d"); - - //} - - args.push (targetPath); - - if (deviceID != null && deviceID != "") { - - args.unshift (deviceID); - args.unshift ("-s"); - - connect (deviceID); - - } - - ProcessHelper.runCommand (adbPath, adbName, args); - - return deviceID; - - } - - - public static function listAVDs ():Array { - - var avds = new Array (); - var output = ProcessHelper.runProcess (androidPath, androidName, [ "list", "avd" ]); - - if (output != null && output != "") { - - for (line in output.split ("\n")) { - - if (line.indexOf ("Name") > -1) { - - avds.push (StringTools.trim (line.substr (line.indexOf ("Name") + 6))); - - } - - } - - } - - return avds; - - } - - - public static function listDevices ():Array { - - var devices = new Array (); - var output = ""; - - if (PlatformHelper.hostPlatform != Platform.WINDOWS) { - - var tempFile = PathHelper.getTemporaryFile (); - - ProcessHelper.runCommand (adbPath, adbName, [ "devices", ">", tempFile ], true, true); - - if (FileSystem.exists (tempFile)) { - - output = File.getContent (tempFile); - FileSystem.deleteFile (tempFile); - - } - - } else { - - output = ProcessHelper.runProcess (adbPath, adbName, [ "devices" ], true, true); - - } - - if (output != null && output != "") { - - for (line in output.split ("\n")) { - - if (line.indexOf ("device") > -1 && line.indexOf ("attached") == -1) { - - devices.push (StringTools.trim (line.substr (0, line.indexOf ("device")))); - - } - - } - - } - - return devices; - - } - - - public static function run (activityName:String, deviceID:String = null):Void { - - var args = [ "shell", "am", "start", "-a", "android.intent.action.MAIN", "-n", activityName ]; - - if (deviceID != null && deviceID != "") { - - args.unshift (deviceID); - args.unshift ("-s"); - - connect (deviceID); - - } - - ProcessHelper.runCommand (adbPath, adbName, args); - - } - - - public static function trace (project:HXProject, debug:Bool, deviceID:String = null, customFilter:String = null):Void { - - // Use -DFULL_LOGCAT or if you do not want to filter log messages - - var args = [ "logcat" ]; - - if (deviceID != null && deviceID != "") { - - args.unshift (deviceID); - args.unshift ("-s"); - - connect (deviceID); - - } - - if (customFilter != null) { - - ProcessHelper.runCommand (adbPath, adbName, args.concat ([ customFilter ])); - - } else if (project.environment.exists("FULL_LOGCAT") || LogHelper.verbose) { - - ProcessHelper.runCommand (adbPath, adbName, args.concat ([ "-c" ])); - ProcessHelper.runCommand (adbPath, adbName, args); - - } else if (debug) { - - var filter = "*:E"; - var includeTags = [ "lime", "Lime", "Main", "GameActivity", "SDLActivity", "GLThread", "trace", "Haxe" ]; - - for (tag in includeTags) { - - filter += " " + tag + ":D"; - - } - - Sys.println (filter); - - ProcessHelper.runCommand (adbPath, adbName, args.concat ([ filter ])); - - } else { - - ProcessHelper.runCommand (adbPath, adbName, args.concat ([ "*:S trace:I" ])); - - } - - } - - - public static function uninstall (packageName:String, deviceID:String = null):Void { - - var args = [ "uninstall", packageName ]; - - if (deviceID != null && deviceID != "") { - - args.unshift (deviceID); - args.unshift ("-s"); - - connect (deviceID); - - } - - ProcessHelper.runCommand (adbPath, adbName, args); - - } - - -} diff --git a/lime/tools/helpers/AntHelper.hx b/lime/tools/helpers/AntHelper.hx deleted file mode 100644 index 7d67072bd..000000000 --- a/lime/tools/helpers/AntHelper.hx +++ /dev/null @@ -1,46 +0,0 @@ -package lime.tools.helpers; - - -class AntHelper { - - - private static var ant:String; - - - public static function initialize (defines:Map):Void { - - if (defines.exists ("ANDROID_SDK")) { - - Sys.putEnv ("ANDROID_SDK", defines.get ("ANDROID_SDK")); - - } - - ant = defines.get ("ANT_HOME"); - - if (ant == null || ant == "") { - - ant = "ant"; - - } else { - - ant += "/bin/ant"; - - } - - } - - - public static function run (workingDirectory:String, commands:Array):Void { - - if (commands == null) { - - commands = []; - - } - - ProcessHelper.runCommand (workingDirectory, ant, commands); - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/ArrayHelper.hx b/lime/tools/helpers/ArrayHelper.hx deleted file mode 100644 index 6c9e77a5d..000000000 --- a/lime/tools/helpers/ArrayHelper.hx +++ /dev/null @@ -1,163 +0,0 @@ -package lime.tools.helpers; - - -class ArrayHelper { - - - public static function addUnique (array:Array, value:T):T { - - var exists = false; - - for (arrayValue in array) { - - if (arrayValue == value) { - - exists = true; - break; - - } - - } - - if (!exists) { - - array.push (value); - - } - - return value; - - } - - - public static function concatUnique (a:Array, b:Array, adjustOrder:Bool = false, key:String = null):Array { - - if (a == null && b == null) { - - return new Array (); - - } else if (a == null && b != null) { - - return b; - - } - - var concat = a.copy (); - - for (bValue in b) { - - var hasValue = false; - - for (aValue in a) { - - if (key != null) { - - if (Reflect.field (aValue, key) == Reflect.field (bValue, key)) { - - if (adjustOrder) { - - concat.remove (aValue); - - } else { - - hasValue = true; - - } - - } - - } else if (aValue == bValue) { - - hasValue = true; - - } - - } - - if (adjustOrder && hasValue) { - - concat.remove (bValue); - hasValue = false; - - } - - if (!hasValue) { - - concat.push (bValue); - - } - - } - - return concat; - - } - - - public static function containsValue (array:Array< T > , value:T):Bool { - - for (arrayValue in array) { - - if (arrayValue == value) { - - return true; - - } - - } - - return false; - - } - - - public static function getUnique (a:Array, b:Array, key:String = null):Array { - - if (a == null && b == null) { - - return new Array (); - - } else if (a == null && b != null) { - - return b; - - } - - var concat = []; - - for (bValue in b) { - - var hasValue = false; - - for (aValue in a) { - - if (key != null) { - - if (Reflect.field (aValue, key) == Reflect.field (bValue, key)) { - - hasValue = true; - - } - - } else if (aValue == bValue) { - - hasValue = true; - - } - - } - - if (!hasValue) { - - concat.push (bValue); - - } - - } - - return concat; - - } - - -} diff --git a/lime/tools/helpers/AssetHelper.hx b/lime/tools/helpers/AssetHelper.hx deleted file mode 100644 index 5b96a7f72..000000000 --- a/lime/tools/helpers/AssetHelper.hx +++ /dev/null @@ -1,685 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Path; -import haxe.Serializer; -import haxe.Unserializer; -import lime.tools.helpers.PathHelper; -import lime.project.AssetType; -import lime.project.Asset; -import lime.project.HXProject; -import lime.project.Library; -import lime.utils.compress.Deflate; -import lime.utils.compress.GZip; -import lime.utils.AssetManifest; -import sys.io.File; -import sys.io.FileOutput; -import sys.FileSystem; - - -class AssetHelper { - - - private static var DEFAULT_LIBRARY_NAME = "default"; - - - public static function createManifest (project:HXProject, library:String = null, targetPath:String = null):AssetManifest { - - var manifest = new AssetManifest (); - var pathGroups = new Map> (); - - var libraries = new Map (); - if (library == null) library = DEFAULT_LIBRARY_NAME; - - for (lib in project.libraries) { - - libraries[lib.name] = lib; - - } - - var assetData; - - for (asset in project.assets) { - - assetData = getAssetData (project, pathGroups, libraries, library, asset); - - if (assetData != null) { - - manifest.assets.push (assetData); - - } - - } - - if (targetPath != null) { - - PathHelper.mkdir (Path.directory (targetPath)); - LogHelper.info ("", " - \x1b[1mWriting asset manifest:\x1b[0m " + targetPath); - File.saveContent (targetPath, manifest.serialize ()); - - } - - return manifest; - - } - - - public static function createManifests (project:HXProject, targetDirectory:String = null):Array { - - var libraryNames = new Map (); - var hasManifest = new Map (); - - for (asset in project.assets) { - - if (asset.library != null && !libraryNames.exists (asset.library)) { - - libraryNames[asset.library] = true; - - } - - if (asset.type == MANIFEST) { - - hasManifest.set (asset.library != null ? asset.library : DEFAULT_LIBRARY_NAME, true); - - } - - } - - var manifest = null; - var manifests = []; - - if (!hasManifest.exists (DEFAULT_LIBRARY_NAME)) { - - manifest = createManifest (project); - manifest.name = DEFAULT_LIBRARY_NAME; - manifests.push (manifest); - - } - - for (library in libraryNames.keys ()) { - - if (!hasManifest.exists (library)) { - - manifest = createManifest (project, library); - manifest.name = library; - manifests.push (manifest); - - } - - } - - if (targetDirectory != null) { - - PathHelper.mkdir (targetDirectory); - var targetPath; - - for (manifest in manifests) { - - targetPath = PathHelper.combine (targetDirectory, manifest.name + ".json"); - LogHelper.info ("", " - \x1b[1mWriting asset manifest:\x1b[0m " + targetPath); - File.saveContent (targetPath, manifest.serialize ()); - - } - - } - - return manifests; - - } - - - private static function getAssetData (project:HXProject, pathGroups:Map>, libraries:Map, library:String, asset:Asset):Dynamic { - - if ((asset.library != null && asset.library != library) || asset.type == TEMPLATE) return null; - if (asset.library == null && library != DEFAULT_LIBRARY_NAME) return null; - - var size = 100; - - if (FileSystem.exists (asset.sourcePath)) { - - size = FileSystem.stat (asset.sourcePath).size; - - } - - var assetData:Dynamic = { - - id: asset.id, - size: size, - type: Std.string (asset.type) - - }; - - if (project.target == FLASH || project.target == AIR) { - - if (asset.embed != false || asset.type == FONT) { - - assetData.className = "__ASSET__" + asset.flatName; - - } else { - - assetData.path = asset.resourceName; - - } - - if (asset.embed == false && asset.library != null && libraries.exists (asset.library)) { - - assetData.preload = libraries[asset.library].preload; - - } - - } else if (project.target == HTML5) { - - if (asset.type == FONT) { - - assetData.className = "__ASSET__" + asset.flatName; - assetData.preload = true; - - } else { - - assetData.path = asset.resourceName; - - if (asset.embed != false || (asset.library != null && libraries.exists (asset.library) && libraries[asset.library].preload)) { - - assetData.preload = true; - - } - - if (asset.type == MUSIC || asset.type == SOUND) { - - var soundName = Path.withoutExtension (assetData.path); - - if (!pathGroups.exists (soundName)) { - - pathGroups.set (soundName, [ assetData.path ]); - - } else { - - pathGroups[soundName].push (assetData.path); - Reflect.deleteField (assetData, "preload"); - - } - - Reflect.deleteField (assetData, "path"); - assetData.pathGroup = pathGroups[soundName]; - - } - - } - - } else { - - if (project.target == EMSCRIPTEN && (asset.embed != false || (asset.library != null && libraries.exists (asset.library) && libraries[asset.library].preload))) { - - assetData.preload = true; - - } - - if (asset.embed == true || asset.type == FONT) { - - assetData.className = "__ASSET__" + asset.flatName; - - } else { - - assetData.path = asset.resourceName; - - } - - } - - return assetData; - - } - - - private static function getPackedAssetData (project:HXProject, output:FileOutput, pathGroups:Map>, libraries:Map, library:Library, asset:Asset):Dynamic { - - if (project.target == HTML5 && (asset.type == MUSIC || asset.type == SOUND || asset.type == FONT)) { - - return getAssetData (project, pathGroups, libraries, library.name, asset); - - } - - if (asset.type == TEMPLATE) return null; - if (asset.library == library.name || (asset.library == null && library.name == DEFAULT_LIBRARY_NAME)) { - - var assetData:Dynamic = { - - id: asset.id, - size: 0, - type: Std.string (asset.type), - position: output.tell () - - }; - - if (project.target == HTML5 && asset.type == FONT) { - - assetData.className = "__ASSET__" + asset.flatName; - assetData.preload = true; - - } else { - - switch (library.type) { - - case "deflate", "zip": - - if (asset.data != null) { - - output.writeBytes (Deflate.compress (asset.data), 0, asset.data.length); - - } else if (asset.sourcePath != null) { - - var tempBytes = File.getBytes (asset.sourcePath); - tempBytes = Deflate.compress (tempBytes); - output.writeBytes (tempBytes, 0, tempBytes.length); - - } - - case "gzip": - - if (asset.data != null) { - - output.writeBytes (GZip.compress (asset.data), 0, asset.data.length); - - } else if (asset.sourcePath != null) { - - var tempBytes = File.getBytes (asset.sourcePath); - tempBytes = GZip.compress (tempBytes); - output.writeBytes (tempBytes, 0, tempBytes.length); - - } - - default: - - if (asset.data != null) { - - output.writeBytes (asset.data, 0, asset.data.length); - - } else if (asset.sourcePath != null) { - - var input = File.read (asset.sourcePath, true); - output.writeInput (input); - input.close (); - - } - - } - - } - - if (project.target == HTML5 && asset.type == IMAGE) { - - assetData.preload = true; - - } - - var position = output.tell (); - assetData.length = position - assetData.position; - - asset.library = library.name; - - // asset.sourcePath = ""; - - if (project.target != HTML5 || asset.type != FONT) { - - asset.targetPath = null; - - } - - asset.data = null; - - return assetData; - - } else { - - return null; - - } - - } - - - private static function isPackedLibrary (project:HXProject, library:Library) { - - if (project.target == FLASH && library.embed != false) return false; - - return switch (library.type) { - - case "pak", "pack", "gzip", "zip", "deflate": true; - default: false; - - } - - } - - - public static function processLibraries (project:HXProject, targetDirectory:String = null):Void { - - var hasManifest = new Map (); - var libraryMap = new Map (); - - for (library in project.libraries) { - - libraryMap[library.name] = true; - - } - - var library; - - for (asset in project.assets) { - - if (asset.library != null && asset.library != DEFAULT_LIBRARY_NAME && !libraryMap.exists (asset.library)) { - - library = new Library (null, asset.library); - project.libraries.push (library); - - libraryMap[asset.library] = true; - - } - - if (asset.type == MANIFEST) { - - hasManifest.set (asset.library != null ? asset.library : DEFAULT_LIBRARY_NAME, true); - - } - - } - - if (!libraryMap.exists (DEFAULT_LIBRARY_NAME)) { - - library = new Library (null, DEFAULT_LIBRARY_NAME); - project.libraries.push (library); - - } - - var handlers = new Array (); - var hasPackedLibraries = false; - var type; - - for (library in project.libraries) { - - type = library.type; - - if (library.sourcePath != null || type != null) { - - if (type == null) { - - type = Path.extension (library.sourcePath).toLowerCase (); - - } - - if (project.libraryHandlers.exists (type)) { - - var handler = project.libraryHandlers.get (type); - - handlers.remove (handler); - handlers.push (handler); - - library.type = type; - - } else if (isPackedLibrary (project, library)) { - - hasPackedLibraries = true; - - } - - } - - } - - if (handlers.length > 0) { - - var projectData = Serializer.run (project); - var temporaryFile = PathHelper.getTemporaryFile (); - - File.saveContent (temporaryFile, projectData); - - for (handler in handlers) { - - var outputFile = PathHelper.getTemporaryFile (); - var args = [ "run", handler, "process", temporaryFile, outputFile ]; - - if (LogHelper.verbose) { - - args.push ("-verbose"); - - } - - if (targetDirectory != null) { - - args.push ("--targetDirectory=" + PathHelper.tryFullPath (targetDirectory)); - - } - - try { - - HaxelibHelper.runCommand ("", args, false); - - } catch (e:Dynamic) { - - var types = []; - - for (library in project.libraries) { - - if (library.type != null && project.libraryHandlers.exists (library.type) && project.libraryHandlers.get (library.type) == handler) { - - types.push (library.type); - - } - - } - - LogHelper.error ("Could not process asset libraries (" + types.join (", ") + ")"); - - } - - if (FileSystem.exists (outputFile)) { - - try { - - var output = File.getContent (outputFile); - var data:HXProject = Unserializer.run (output); - project.merge (data); - - } catch (e:Dynamic) { - - LogHelper.error (e); - - } - - try { - - FileSystem.deleteFile (outputFile); - - } catch (e:Dynamic) {} - - } - - } - - try { - - FileSystem.deleteFile (temporaryFile); - - } catch (e:Dynamic) {} - - } - - if (hasPackedLibraries) { - - processPackedLibraries (project, targetDirectory); - - } - - var manifest, asset; - - for (library in project.libraries) { - - if (library.type == null || (project.target == FLASH && library.embed != false && ["pak", "pack", "gzip", "zip", "deflate"].indexOf (library.type) > -1)) { - - if (library.name == DEFAULT_LIBRARY_NAME) { - - library.preload = true; - - } - - if (!hasManifest.exists (library.name)) { - - manifest = createManifest (project, library.name != DEFAULT_LIBRARY_NAME ? library.name : null); - - asset = new Asset ("", "manifest/" + library.name + ".json", AssetType.MANIFEST); - asset.library = library.name; - asset.data = manifest.serialize (); - - if (manifest.assets.length == 0 || (project.target == HTML5 && library.name == DEFAULT_LIBRARY_NAME)) { - - asset.embed = true; - - } else { - - // TODO: Make this assumption elsewhere? - - var allEmbedded = true; - - for (childAsset in manifest.assets) { - - if (!Reflect.hasField (childAsset, "className") || childAsset.className == null) { - - allEmbedded = false; - break; - - } - - } - - if (allEmbedded) asset.embed = true; - - } - - project.assets.push (asset); - - } - - } - - } - - } - - - public static function processPackedLibraries (project:HXProject, targetDirectory:String = null):Void { - - var type, asset, cacheAvailable, cacheDirectory, filename; - var output, manifest, position, assetData:Dynamic, input; - var embeddedLibrary = false; - - var pathGroups = new Map> (); - var libraries = new Map (); - for (lib in project.libraries) { - - libraries[lib.name] = lib; - - } - - for (library in project.libraries) { - - type = library.type; - - if (isPackedLibrary (project, library)) { - - // TODO - #if !nodejs - - if (type == "zip") type = "deflate"; - - // TODO: Support library.embed=true by embedding all the assets instead of packing - - cacheAvailable = false; - cacheDirectory = null; - - if (targetDirectory != null) { - - manifest = new AssetManifest (); - - cacheDirectory = targetDirectory + "/obj/libraries/"; - filename = library.name + ".pak"; - - // TODO: Support caching - - PathHelper.mkdir (cacheDirectory); - - if (FileSystem.exists (cacheDirectory + filename)) { - - FileSystem.deleteFile (cacheDirectory + filename); - - } - - output = File.write (cacheDirectory + filename, true); - position = 0; - - try { - - var assetData; - - for (asset in project.assets) { - - assetData = getPackedAssetData (project, output, pathGroups, libraries, library, asset); - - if (assetData != null) { - - manifest.assets.push (assetData); - - } - - } - - } catch (e:Dynamic) { - - output.close (); - FileSystem.deleteFile (cacheDirectory + filename); - - #if neko - neko.Lib.rethrow (e); - #end - - } - - output.close (); - - var libraryAsset = new Asset (cacheDirectory + filename, "lib/" + filename, AssetType.BINARY); - libraryAsset.library = library.name; - project.assets.push (libraryAsset); - - var data = new Asset ("", "manifest/" + library.name + ".json", AssetType.MANIFEST); - data.library = library.name; - manifest.libraryType = "lime.utils.PackedAssetLibrary"; - manifest.libraryArgs = [ "lib/" + filename, library.type ]; - data.data = manifest.serialize (); - data.embed = true; - - project.assets.push (data); - embeddedLibrary = true; - - } - - if (library.name == DEFAULT_LIBRARY_NAME) { - - library.preload = true; - - } - - #end - - } - - } - - if (embeddedLibrary) { - - project.haxeflags.push ("lime.utils.PackedAssetLibrary"); - - } - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/BlackBerryHelper.hx b/lime/tools/helpers/BlackBerryHelper.hx deleted file mode 100644 index e999abb2c..000000000 --- a/lime/tools/helpers/BlackBerryHelper.hx +++ /dev/null @@ -1,447 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Eof; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.ZipHelper; -import lime.project.HXProject; -import lime.project.Platform; -import sys.FileSystem; -import sys.io.File; -import sys.io.Process; - - -class BlackBerryHelper { - - - private static var binDirectory:String; - private static var defines:Map; - private static var targetFlags:Map; - - - public static function createPackage (project:HXProject, workingDirectory:String, descriptorFile:String, targetPath:String):Void { - - var args = [ "-package", targetPath, descriptorFile ]; - var password = null; - - if (project.keystore != null) { - - password = project.keystore.password; - - if (password == null) { - - password = prompt ("Keystore password", true); - Sys.println (""); - - } - - } - - if (project.keystore != null) { - - args.push ("-keystore"); - args.push (PathHelper.tryFullPath (project.keystore.path)); - - if (password != null) { - - args.push ("-storepass"); - args.push (password); - - } - - } else { - - args.push ("-devMode"); - - if (!project.targetFlags.exists ("simulator")) { - - args.push ("-debugToken"); - args.push (PathHelper.tryFullPath (project.environment.get ("BLACKBERRY_DEBUG_TOKEN"))); - - } - - } - - var exe = binDirectory + "blackberry-nativepackager"; - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - exe += ".bat"; - - } - - ProcessHelper.runCommand (workingDirectory, exe, args); - - if (project.keystore != null) { - - args = [ "-keystore", PathHelper.tryFullPath (project.keystore.path) ]; - - if (password != null) { - - args.push ("-storepass"); - args.push (password); - - } - - args.push (targetPath); - - var exe = binDirectory + "blackberry-signer"; - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - exe += ".bat"; - - } - - ProcessHelper.runCommand (workingDirectory, exe, args); - - } - - } - - - public static function createWebWorksPackage (project:HXProject, sourceDirectory:String, targetPath:String):Void { - - var zipPath = PathHelper.combine (targetPath, PathHelper.safeFileName (project.app.file) + ".zip"); - - ZipHelper.compress (sourceDirectory, zipPath); - - var exe = "bbwp.bat"; - var args = [ zipPath ]; - var params = ""; - - if (project.keystore != null) { - - var password = project.keystore.password; - - if (password == null) { - - password = prompt ("Keystore password", true); - Sys.println (""); - - } - - args = args.concat ([ "--password", password, "--buildId", project.meta.buildNumber ]); - - //params = "{\n\t\"blackberry-nativepackager\": {\n\t\t\"-keystore\": \"" + PathHelper.tryFullPath (project.keystore.path) + "\"\n\t}\n}"; - - try { - - FileHelper.copyFile (PathHelper.tryFullPath (project.keystore.path), PathHelper.combine (project.environment.get ("BLACKBERRY_WEBWORKS_SDK"), "author.p12")); - - } catch (e:Dynamic) {} - - } else { - - args.push ("--debug"); - - //params = "{\n\t\"blackberry-nativepackager\": {\n\t\t\"-debugToken\": \"" + PathHelper.tryFullPath (project.environment.get ("BLACKBERRY_DEBUG_TOKEN")) + "\"\n\t}\n}"; - - try { - - FileHelper.copyFile (PathHelper.tryFullPath (project.environment.get ("BLACKBERRY_DEBUG_TOKEN")), PathHelper.combine (project.environment.get ("BLACKBERRY_WEBWORKS_SDK"), "debugToken.bar")); - - } catch (e:Dynamic) {} - - } - - args = args.concat ([ "--output", targetPath ]); - - //if (!project.targetFlags.exists ("simulator")) { - // - //args.push ("-debugToken"); - //args.push (PathHelper.tryFullPath (project.environment.get ("BLACKBERRY_DEBUG_TOKEN"))); - // - //} - - if (LogHelper.verbose) { - - args.push ("--verbose"); - - } - - //var paramsFile = PathHelper.getTemporaryFile (".json"); - //File.saveContent (paramsFile, params); - - //args = args.concat ([ "--params", paramsFile ]); - - ProcessHelper.runCommand ("", PathHelper.combine (project.environment.get ("BLACKBERRY_WEBWORKS_SDK"), exe), args); - - //if (FileSystem.exists (paramsFile)) { - - //FileSystem.deleteFile (paramsFile); - - //} - - } - - - public static function deploy (project:HXProject, workingDirectory:String, targetPath:String, run:Bool = true):Void { - - var deviceIP = project.environment.get ("BLACKBERRY_DEVICE_IP"); - var devicePassword = project.environment.get ("BLACKBERRY_DEVICE_PASSWORD"); - - if (project.targetFlags.exists ("simulator")) { - - deviceIP = project.environment.get ("BLACKBERRY_SIMULATOR_IP"); - devicePassword = "playbook"; - - } - - var args = [ "-installApp" ]; - - if (project.targetFlags.exists ("gdb")) { - - args.push ("-debugNative"); - - } - - if (run) { - - args.push ("-launchApp"); - - } - - args = args.concat ([ "-device", deviceIP, "-password", devicePassword, targetPath ]); - - var exe = binDirectory + "blackberry-deploy"; - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - exe += ".bat"; - - } - - ProcessHelper.runCommand (workingDirectory, exe, args); - - } - - - public static function initialize (project:HXProject):Void { - - if (project.environment.exists ("BLACKBERRY_NDK_ROOT") && (!project.environment.exists("QNX_HOST") || !project.environment.exists("QNX_TARGET"))) { - - var fileName = project.environment.get ("BLACKBERRY_NDK_ROOT"); - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - fileName += "\\bbndk-env.bat"; - - } else { - - fileName += "/bbndk-env.sh"; - - } - - var fin = File.read (fileName, false); - - try { - - while (true) { - - var str = fin.readLine(); - var split = str.split ("="); - var name = StringTools.trim (split[0].substr (split[0].lastIndexOf (" ") + 1)); - - switch (name) { - - case "QNX_HOST", "QNX_TARGET", "QNX_HOST_VERSION", "QNX_TARGET_VERSION": - - var value = split[1]; - - if (StringTools.startsWith (value, "${") && split.length > 2) { - - value = split[2].substr (0, split[2].length - 1); - - } - - if (StringTools.startsWith(value, "\"")) { - - value = value.substr (1); - - } - - if (StringTools.endsWith(value, "\"")) { - - value = value.substr (0, value.length - 1); - - } - - if (name == "QNX_TARGET_VERSION" || name == "QNX_HOST_VERSION") { - - if (project.environment.get (name) != null) { - - continue; - - } - - } else { - - value = StringTools.replace (value, "$BASE_DIR", project.environment.get("BLACKBERRY_NDK_ROOT")); - value = StringTools.replace (value, "%BASE_DIR%", project.environment.get ("BLACKBERRY_NDK_ROOT")); - value = StringTools.replace (value, "$TARGET", "qnx6"); - value = StringTools.replace (value, "%TARGET%", "qnx6"); - value = StringTools.replace (value, "$QNX_HOST_VERSION", project.environment.get ("QNX_HOST_VERSION")); - value = StringTools.replace (value, "$QNX_TARGET_VERSION", project.environment.get ("QNX_TARGET_VERSION")); - value = StringTools.replace (value, "%QNX_HOST_VERSION%", project.environment.get ("QNX_HOST_VERSION")); - value = StringTools.replace (value, "%QNX_TARGET_VERSION%", project.environment.get ("QNX_TARGET_VERSION")); - - } - - project.environment.set (name, value); - - } - - } - - } catch (ex:Eof) {} - - fin.close(); - - } - - binDirectory = PathHelper.combine (project.environment.get ("QNX_HOST"), "usr/bin/"); - - } - - - public static function processDebugToken (project:HXProject, workingDirectory:String = ""):BlackBerryDebugToken { - - var data:BlackBerryDebugToken = { authorID: "", deviceIDs: new Array () }; - - if (project.environment.exists ("BLACKBERRY_DEBUG_TOKEN")) { - - PathHelper.mkdir (workingDirectory); - - var cacheCwd = Sys.getCwd (); - - if (workingDirectory != "") { - - Sys.setCwd (workingDirectory); - - } - - var exe = binDirectory + "blackberry-nativepackager"; - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - exe += ".bat"; - - } - - var process = new Process (exe, [ "-listmanifest", PathHelper.escape (PathHelper.tryFullPath (project.environment.get ("BLACKBERRY_DEBUG_TOKEN"))) ]); - var ret = process.stdout.readAll().toString(); - var ret2 = process.stderr.readAll().toString(); - process.exitCode(); //you need this to wait till the process is closed! - process.close(); - - Sys.setCwd (cacheCwd); - - if (ret != null) { - - var search = "Package-Author-Id: "; - var index = ret.indexOf (search); - - if (index > -1) { - - var start = index + search.length; - data.authorID = StringTools.trim (ret.substr (start, ret.indexOf ("\n", index) - start)); - - } - - search = "Debug-Token-Device-Id: "; - var index = ret.indexOf (search); - - while (index > -1) { - - var start = index + search.length; - var deviceIDs = StringTools.trim (ret.substr (start, ret.indexOf ("\n", index) - start)).split (","); - - for (i in 0...deviceIDs.length) { - - deviceIDs[i] = StringTools.hex (Std.parseInt (deviceIDs[i])); - - } - - data.deviceIDs = data.deviceIDs.concat (deviceIDs); - index = ret.indexOf (search, index + search.length); - - } - - } - - } - - if (data.authorID == "" && project.targetFlags.exists ("simulator")) { - - data.authorID = "gYAAgF-DMYiFsOQ3U6QvuW1fQDY"; - - } - - return data; - - } - - - private static function prompt (name:String, ?passwd:Bool):String { - - Sys.print (name + ": "); - - if (passwd) { - var s = new StringBuf (); - var c; - while ((c = Sys.getChar(false)) != 13) - s.addChar (c); - return s.toString (); - } - - try { - - return Sys.stdin ().readLine (); - - } catch (e:Eof) { - - return ""; - - } - - } - - - public static function trace (project:HXProject, workingDirectory:String, targetPath:String):Void { - - var deviceIP = project.environment.get ("BLACKBERRY_DEVICE_IP"); - var devicePassword = project.environment.get ("BLACKBERRY_DEVICE_PASSWORD"); - - if (project.targetFlags.exists ("simulator")) { - - deviceIP = project.environment.get ("BLACKBERRY_SIMULATOR_IP"); - devicePassword = "playbook"; - - } - - var exe = binDirectory + "blackberry-deploy"; - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - exe += ".bat"; - - } - - ProcessHelper.runCommand (workingDirectory, exe, [ "-getFile", "logs/log", "-", "-device", deviceIP, "-password", devicePassword, targetPath ] ); - - } - - -} - - -typedef BlackBerryDebugToken = { - - var authorID:String; - var deviceIDs:Array; - -} \ No newline at end of file diff --git a/lime/tools/helpers/CLIHelper.hx b/lime/tools/helpers/CLIHelper.hx deleted file mode 100644 index 402edf791..000000000 --- a/lime/tools/helpers/CLIHelper.hx +++ /dev/null @@ -1,110 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Eof; - - -class CLIHelper { - - - public static function ask (question:String, options:Array = null):Answer { - - if (options == null) { - - options = ["y", "n", "a"]; - - } - - while (true) { - - LogHelper.print (LogHelper.accentColor + question + "\x1b[0m \x1b[3;37m[" + options.join ("/") + "]\x1b[0m ? "); - - try { - - switch (readLine ()) { - - case "n": return NO; - case "y": return YES; - case "a": return ALWAYS; - case _ => x if (options.indexOf (x) > -1): return CUSTOM (x); - - } - - } catch (e:Dynamic) { - - Sys.exit (0); - - } - - } - - return null; - - } - - - public static inline function getChar ():Int { - - return Sys.getChar (false); - - } - - - public static function param (name:String, passwd:Bool = false):String { - - LogHelper.print (name + ": "); - - if (passwd) { - - var s = new StringBuf (); - var c; - while ((c = getChar ()) != 13) - s.addChar (c); - - LogHelper.print (""); - LogHelper.println (""); - - return s.toString (); - - } - - try { - - return readLine (); - - } catch (e:Eof) { - - return ""; - - } - - } - - - public static function progress (prefix:String, now:Int, total:Int):Void { - - var percent = Math.floor ((now / total) * 100); - - LogHelper.print ('\r$prefix $now/$total ($percent%)'); - - } - - - public static inline function readLine ():String { - - return Sys.stdin ().readLine (); - - } - - -} - - -enum Answer { - - YES; - NO; - ALWAYS; - CUSTOM (answer:String); - -} \ No newline at end of file diff --git a/lime/tools/helpers/CPPHelper.hx b/lime/tools/helpers/CPPHelper.hx deleted file mode 100644 index a35bfb1f8..000000000 --- a/lime/tools/helpers/CPPHelper.hx +++ /dev/null @@ -1,330 +0,0 @@ -package lime.tools.helpers; - - -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.project.HXProject; -import lime.project.Platform; -import sys.io.File; -import sys.FileSystem; - - -class CPPHelper { - - - private static var rebuiltLibraries = new Map (); - private static var rebuiltPaths = new Map (); - - - public static function compile (project:HXProject, path:String, flags:Array = null, buildFile:String = "Build.xml"):Void { - - if (project.config.getBool ("cpp.requireBuild", true)) { - - var args = [ "run", project.config.getString ("cpp.buildLibrary", "hxcpp"), buildFile ]; - var foundOptions = false; - - try { - - var options = PathHelper.combine (path, "Options.txt"); - - if (FileSystem.exists (options)) { - - args.push ("-options"); - args.push (PathHelper.tryFullPath (options)); - - // var list; - // var input = File.read (options, false); - // var text = input.readLine (); - - // if (StringTools.startsWith (text, " -D")) { - - // list = text.split (" "); - - // } else { - - // list = [ "-D" + StringTools.trim (text) ]; - - // while (!input.eof ()) { - - // list.push ("-D" + StringTools.trim (input.readLine ())); - - // } - - // list.pop (); - - // } - - // for (option in list) { - - // if (option != "" && !StringTools.startsWith (option, "-Dno_compilation") && !StringTools.startsWith (option, "-Dno-compilation")) { - - // args.push (option); - - // } - - // } - - foundOptions = true; - - } - - } catch (e:Dynamic) {} - - if (flags != null) { - - args = args.concat (flags); - - } - - if (!foundOptions) { - - for (key in project.haxedefs.keys ()) { - - var value = project.haxedefs.get (key); - - if (value == null || value == "") { - - args.push ("-D" + key); - - } else { - - args.push ("-D" + key + "=" + value); - - } - - } - - } - - if (project.debug) { - - args.push ("-debug"); - - } - - if (LogHelper.verbose) { - - args.push ("-verbose"); - - } - - if (!LogHelper.enableColor) { - - //args.push ("-nocolor"); - Sys.putEnv ("HXCPP_NO_COLOR", ""); - - } - - if (PlatformHelper.hostPlatform == Platform.WINDOWS && !project.environment.exists ("HXCPP_COMPILE_THREADS")) { - - var threads = 1; - - if (ProcessHelper.processorCores > 1) { - - threads = ProcessHelper.processorCores - 1; - - } - - Sys.putEnv ("HXCPP_COMPILE_THREADS", Std.string (threads)); - - } - - Sys.putEnv ("HXCPP_EXIT_ON_ERROR", ""); - - var code = HaxelibHelper.runCommand (path, args); - - if (code != 0) { - - Sys.exit (code); - - } - - } - - } - - - public static function rebuild (project:HXProject, commands:Array>, path:String = null, buildFile:String = null):Void { - - var buildRelease = (!project.targetFlags.exists ("debug")); - var buildDebug = (project.targetFlags.exists ("debug") || - (!project.targetFlags.exists ("rebuild") && - !project.targetFlags.exists ("release") && - !project.targetFlags.exists ("final") && - project.config.exists ("project.rebuild.fulldebug"))); - - for (haxelib in project.haxelibs) { - - if (!rebuiltLibraries.exists (haxelib.name)) { - - var defines = StringMapHelper.copy (project.defines); - defines.set ("rebuild", 1); - - var haxelibProject = HXProject.fromHaxelib (haxelib, defines); - - if (haxelibProject == null) { - - haxelibProject = new HXProject (); - haxelibProject.config.set ("project.rebuild.path", PathHelper.combine (PathHelper.getHaxelib (haxelib), "project")); - - } - - StringMapHelper.copyKeys (project.targetFlags, haxelibProject.targetFlags); - - rebuiltLibraries.set (haxelib.name, true); - - if (!rebuiltPaths.exists (haxelibProject.config.get ("project.rebuild.path"))) { - - rebuiltPaths.set (haxelibProject.config.get ("project.rebuild.path"), true); - rebuild (haxelibProject, commands); - - } - - } - - } - - if (project.targetFlags.exists ("clean")) { - - if (buildRelease) { - - for (command in commands) { - - rebuildSingle (project, command.concat ([ "clean" ]), path, buildFile); - - } - - } - - if (buildDebug) { - - for (command in commands) { - - rebuildSingle (project, command.concat ([ "-Ddebug", "-Dfulldebug", "clean" ]), path, buildFile); - - } - - } - - - } - - for (command in commands) { - - if (buildRelease) { - - rebuildSingle (project, command, path, buildFile); - - } - - if (buildDebug) { - - rebuildSingle (project, command.concat ([ "-Ddebug", "-Dfulldebug" ]), path, buildFile); - - } - - } - - } - - - public static function rebuildSingle (project:HXProject, flags:Array = null, path:String = null, buildFile:String = null):Void { - - if (path == null) { - - path = project.config.get ("project.rebuild.path"); - - } - - if (path == null || !FileSystem.exists (path)) { - - return; - - } - - if (buildFile == null && project.config.exists ("project.rebuild.file")) { - - buildFile = project.config.get ("project.rebuild.file"); - - } - - if (buildFile == null) buildFile = "Build.xml"; - - if (!FileSystem.exists (PathHelper.combine (path, buildFile))) { - - return; - - } - - var args = [ "run", project.config.getString ("cpp.buildLibrary", "hxcpp"), buildFile ]; - - if (flags != null) { - - args = args.concat (flags); - - } - - for (key in project.haxedefs.keys ()) { - - var value = project.haxedefs.get (key); - - if (value == null || value == "") { - - args.push ("-D" + key); - - } else { - - args.push ("-D" + key + "=" + value); - - } - - } - - /*if (project.debug) { - - args.push ("-Ddebug"); - - }*/ - - if (project.targetFlags.exists ("static")) { - - args.push ("-Dstatic_link"); - - } - - if (LogHelper.verbose) { - - args.push ("-verbose"); - - } - - if (!LogHelper.enableColor) { - - //args.push ("-nocolor"); - Sys.putEnv ("HXCPP_NO_COLOR", ""); - - } - - if (PlatformHelper.hostPlatform == Platform.WINDOWS && !project.environment.exists ("HXCPP_COMPILE_THREADS")) { - - var threads = 1; - - if (ProcessHelper.processorCores > 1) { - - threads = ProcessHelper.processorCores - 1; - - } - - Sys.putEnv ("HXCPP_COMPILE_THREADS", Std.string (threads)); - - } - - Sys.putEnv ("HXCPP_EXIT_ON_ERROR", ""); - - HaxelibHelper.runCommand (path, args); - - } - - -} diff --git a/lime/tools/helpers/CSHelper.hx b/lime/tools/helpers/CSHelper.hx deleted file mode 100644 index 7266e1702..000000000 --- a/lime/tools/helpers/CSHelper.hx +++ /dev/null @@ -1,301 +0,0 @@ -package lime.tools.helpers; - -import lime.project.Architecture; -import lime.project.HXProject; -import lime.project.NDLL; -import lime.tools.helpers.ProcessHelper; -import sys.io.File; -import sys.FileSystem; -using StringTools; - -class CSHelper { - - public static var ndllSourceFiles:Array = [ - "cs.ndll.NDLLFunction", - "cs.ndll.CFFICSLoader", - "cs.ndll.CSAbstract", - "cs.ndll.CSHandleContainer", - "cs.ndll.CSHandleScope", - "cs.ndll.CSPersistent", - "cs.ndll.DelegateConverter", - "cs.ndll.HandleUtils", - "cs.ndll.NativeMethods", - "cs.ndll.NDLLFunction", - ]; - - private static function getAndroidABIName(arch:Architecture):String { - - var name = switch(arch) { - case ARMV5: - "armeabi"; - case ARMV7: - "armeabi-v7a"; - case ARM64: - "arm64-v8a"; - case X86: - "x86"; - case X64: - "x86_64"; - case _: - null; - } - - if (name == null) { - - throw "Unsupported architecture:" + arch; - - } - - return name; - - } - - public static function getAndroidABINames (architectures:Array):String { - - var result = ""; - var first = true; - - for (arch in architectures) { - - if (first) { - - first = false; - - } else { - - result += ","; - - } - - var archName = getAndroidABIName (arch); - result += archName; - - } - - return result; - - } - - public static function getAndroidNativeLibraryPaths (libPath:String, libraries:Array, architectures:Array):Array { - - var paths = []; - - for (arch in architectures) { - - var archName = getAndroidABIName (arch); - - for (lib in libraries) { - - paths.push (FileSystem.absolutePath (libPath + "/" + archName + "/" + "lib" + lib.name + ".so").replace ("/", "\\")); - - } - - } - - return paths; - - } - - public static function copySourceFiles (templatePaths:Array, targetPath:String) { - - FileHelper.recursiveCopyTemplate (templatePaths, "cs/src", targetPath); - - } - - public static function addSourceFiles (txtPath:String, sourceFiles:Array) { - - if (sourceFiles.length == 0) { - - return; - - } - - var file = File.append (txtPath, false); - file.writeString ('\nbegin modules\n'); - - for (fileName in sourceFiles) { - - file.writeString ('M $fileName\nC $fileName\n'); - - } - - file.writeString ('end modules\n'); - file.close(); - - } - - public static function addAndroidResources (txtPath:String, resources:Array) { - - if (resources.length == 0) { - - return; - - } - - var file = File.append (txtPath, false); - file.writeString ('\nbegin android_resources\n'); - - for (resource in resources) { - - file.writeString ('$resource\n'); - - } - - file.writeString ('end android_resources\n'); - file.close(); - - } - - public static function addAssemblies (txtPath:String, assemblies:Array) { - - if (assemblies.length == 0) { - - return; - - } - - var file = File.append (txtPath, false); - file.writeString ('\nbegin libs\n'); - - for (assembly in assemblies) { - - file.writeString (assembly.replace("/", "\\") + '\n'); - - } - - file.writeString ('end libs\n'); - file.close(); - - } - - public static function addNativeLibraries (txtPath:String, libPath:String, libraries:Array, architectures:Array) { - - if (libraries.length == 0) { - - return; - - } - - var file = File.append (txtPath, false); - file.writeString ('\nbegin native_libs\n'); - - for (arch in architectures) { - - var archName = getAndroidABIName (arch); - - for (lib in libraries) { - - file.writeString (FileSystem.absolutePath(libPath + "/" + archName + "/" + "lib" + lib.name + ".so").replace("/", "\\") + '\n'); - - } - - } - - file.writeString ('end native_libs\n'); - file.close(); - - } - - public static function addAndroidABIs (txtPath:String, architectures:Array) { - - if (architectures.length == 0) { - - return; - - } - - var file = File.append (txtPath, false); - file.writeString ('\nbegin android_abis\n'); - - for (arch in architectures) { - - var archName = getAndroidABIName (arch); - file.writeString (archName + '\n'); - - } - - file.writeString ('end android_abis\n'); - file.close(); - - } - - - public static function addAssets (txtPath:String, assets:Array) { - - if (assets.length == 0) { - - return; - - } - - var file = File.append (txtPath, false); - file.writeString ('\nbegin android_assets\n'); - - for (asset in assets) { - - file.writeString (FileSystem.absolutePath(asset).replace("/", "\\") + '\n'); - - } - - file.writeString ('end android_assets\n'); - file.close(); - - } - - public static function addGUID (txtPath:String, guid:String) { - - var file = File.append (txtPath, false); - file.writeString ('\nbegin guid\n'); - - file.writeString ('$guid\n'); - - file.writeString ('end guid\n'); - file.close (); - - } - - public static function compile (project:HXProject, path:String, outPath:String, arch:String, platform:String, buildFile:String = "hxcs_build.txt", noCompile:Bool = false) { - - var args = [ "run", project.config.getString ("cs.buildLibrary", "hxcs"), buildFile, "--arch", arch, "--platform", platform, "--out", outPath, "--unsafe" ]; - if (noCompile) - args.push ("--no-compile"); - var code = HaxelibHelper.runCommand (path, args); - - if (code != 0) { - - Sys.exit (code); - - } - - } - - public static function buildGradleProj (path:String) { - - var gradlePath = FileSystem.absolutePath(path + "/" + "gradlew"); - ProcessHelper.runCommand (path, gradlePath, ["build", "assembleRelease"]); - - } - - inline public static function buildSln (path:String, slnPath:String, task:String = null) { - - buildCSProj (path, slnPath, task); - - } - - public static function buildCSProj (path:String, csprojPath:String, task:String = null) { - - var msBuildPath = "C:/Program Files (x86)/MSBuild/14.0/Bin/MSBuild.exe"; - var absCSProjPath = FileSystem.absolutePath(csprojPath); - var args = [absCSProjPath, "/p:Configuration=Release"]; - - if (task != null) { - - args.push ("/t:" + task); - - } - - ProcessHelper.runCommand (path, msBuildPath, args); - - } - -} diff --git a/lime/tools/helpers/CommandHelper.hx b/lime/tools/helpers/CommandHelper.hx deleted file mode 100644 index 84bcdcc1c..000000000 --- a/lime/tools/helpers/CommandHelper.hx +++ /dev/null @@ -1,56 +0,0 @@ -package lime.tools.helpers; - - -import lime.project.CLICommand; -import lime.project.Platform; - - -class CommandHelper { - - - public static function executeCommands (commands:Array):Void { - - for (c in commands) { - - Sys.command(c.command, c.args); - - } - - } - - public static function openFile (file:String):CLICommand { - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - return new CLICommand ("start", [ file ]); - - } else if (PlatformHelper.hostPlatform == Platform.MAC) { - - return new CLICommand ("/usr/bin/open", [ file ]); - - } else { - - return new CLICommand ("/usr/bin/xdg-open", [ file ]); - - } - - } - - - public static function interpretHaxe (mainFile:String):CLICommand { - - return new CLICommand ("haxe", [ "-main", mainFile, "--interp" ]); - - } - - - public static function fromSingleString (command:String):CLICommand { - - var args:Array = command.split (" "); - command = args.shift (); - return new CLICommand (command, args); - - } - - -} diff --git a/lime/tools/helpers/CompatibilityHelper.hx b/lime/tools/helpers/CompatibilityHelper.hx deleted file mode 100644 index f43f06034..000000000 --- a/lime/tools/helpers/CompatibilityHelper.hx +++ /dev/null @@ -1,45 +0,0 @@ -package lime.tools.helpers; - - -import haxe.Json; -import lime.project.Haxelib; -import lime.project.HXProject; -import sys.io.File; - - -class CompatibilityHelper { - - - public static function patchAssetLibrary (project:HXProject, haxelib:Haxelib, targetPath:String, context:Dynamic):Void { - - // Need to ensure that older OpenFL releases do not define the __ASSET__ classes for Flash, which are embedded - // through -swf-lib now, rather than manually stuffing asset data into the SWF after compiling - - if (haxelib.name != "openfl") return; - - try { - - var json = Json.parse (File.getContent (PathHelper.getHaxelib (haxelib) + "/haxelib.json")); - if (Std.parseInt (json.version.charAt (0)) < 3 && Std.parseInt (json.version.charAt (2)) < 1) { - - FileHelper.copyFile (PathHelper.getHaxelib (new Haxelib ("lime")) + "/templates/compatibility/DefaultAssetLibrary.hx", targetPath, context); - - } - - } catch (e:Dynamic) {} - - } - - - public static function patchProject (project:HXProject, haxelib:Haxelib, version:String):Void { - - if (haxelib.name == "openfl" && Std.parseInt (version.charAt (0)) < 3 && Std.parseInt (version.charAt (2)) < 1) { - - if (project.app.preloader == "") project.app.preloader = "NMEPreloader"; - - } - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/ConfigHelper.hx b/lime/tools/helpers/ConfigHelper.hx deleted file mode 100644 index 8d87f6ce9..000000000 --- a/lime/tools/helpers/ConfigHelper.hx +++ /dev/null @@ -1,384 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Path; -import lime.project.HXProject; -import lime.project.Platform; -import lime.project.ProjectXMLParser; -import sys.io.File; -import sys.FileSystem; - - -class ConfigHelper { - - - private static var backedUpConfig:Bool = false; - private static var configPath:String = null; - - - public static function getConfig ():HXProject { - - var config = getConfigPath (); - - if (FileSystem.exists (config)) { - - LogHelper.info ("", LogHelper.accentColor + "Reading Lime config: " + config + LogHelper.resetColor); - - return new ProjectXMLParser (config); - - } else { - - LogHelper.warn ("", "Could not read Lime config: " + config); - - } - - return null; - - } - - - public static function getConfigPath ():String { - - if (configPath == null) { - - var environment = Sys.environment (); - - if (environment.exists ("LIME_CONFIG")) { - - configPath = environment.get ("LIME_CONFIG"); - - } else { - - var home = ""; - - if (environment.exists ("HOME")) { - - home = environment.get ("HOME"); - - } else if (environment.exists ("USERPROFILE")) { - - home = environment.get ("USERPROFILE"); - - } else { - - LogHelper.warn ("Lime config might be missing (Environment has no \"HOME\" variable)"); - - return null; - - } - - configPath = home + "/.lime/config.xml"; - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - configPath = configPath.split ("/").join ("\\"); - - } - - if (!FileSystem.exists (configPath)) { - - PathHelper.mkdir (Path.directory (configPath)); - - var hxcppConfig = null; - - if (environment.exists ("HXCPP_CONFIG")) { - - hxcppConfig = environment.get ("HXCPP_CONFIG"); - - } else { - - hxcppConfig = home + "/.hxcpp_config.xml"; - - } - - if (FileSystem.exists (hxcppConfig)) { - - var vars = new ProjectXMLParser (hxcppConfig); - - for (key in vars.defines.keys ()) { - - if (key != key.toUpperCase ()) { - - vars.defines.remove (key); - - } - - } - - writeConfig (configPath, vars.defines); - - } else { - - writeConfig (configPath, new Map ()); - - } - - } - - Sys.putEnv ("LIME_CONFIG", configPath); - - } - - } - - return configPath; - - } - - - public static function getConfigValue (name:String):String { - - var config = getConfig (); - - if (config.defines.exists (name)) { - - return config.defines.get (name); - - } - - return null; - - } - - - public static function removeConfigValue (name:String):Void { - - var path = getConfigPath (); - - if (FileSystem.exists (path)) { - - var configText = File.getContent (path); - var lines = configText.split ("\n"); - - var findSet = " -1) { - - found = true; - lines.splice (i, 1); - continue; - - } - - if ((index = line.indexOf (findSetenv)) > -1) { - - found = true; - lines.splice (i, 1); - continue; - - } - - if ((index = line.indexOf (findDefine)) > -1) { - - found = true; - lines.splice (i, 1); - continue; - - } - - i++; - - } - - var content = lines.join ("\n"); - File.saveContent (path, content); - - if (found) { - - LogHelper.info ("Removed define \"" + name + "\""); - - } else { - - LogHelper.info ("There is no define \"" + name + "\""); - - } - - } else { - - LogHelper.error ("Cannot find \"" + path + "\""); - - } - - } - - - private static function stripQuotes (path:String):String { - - if (path != null) { - - return path.split ("\"").join (""); - - } - - return path; - - } - - - public static function writeConfig (path:String, defines:Map):Void { - - var newContent = ""; - var definesText = ""; - var env = Sys.environment (); - - for (key in defines.keys ()) { - - if (key != "LIME_CONFIG" && key != "LIME_CONFIG" && (!env.exists (key) || env.get (key) != defines.get (key))) { - - definesText += "\t\t\n"; - - } - - } - - if (FileSystem.exists (path)) { - - var input = File.read (path, false); - var bytes = input.readAll (); - input.close (); - - if (!backedUpConfig) { - - try { - - var backup = File.write (path + ".bak", false); - backup.writeBytes (bytes, 0, bytes.length); - backup.close (); - - } catch (e:Dynamic) { } - - backedUpConfig = true; - - } - - var content = bytes.getString (0, bytes.length); - - var startIndex = content.indexOf ("
"); - var endIndex = content.indexOf ("
", startIndex); - - newContent += content.substr (0, startIndex) + "
\n\t\t\n"; - newContent += definesText; - newContent += "\t\t\n\t" + content.substr (endIndex); - - } else { - - newContent += "\n"; - newContent += "\n\t\n"; - newContent += "\t
\n\t\t\n"; - newContent += definesText; - newContent += "\t\t\n\t
\n\t\n
"; - - } - - var output = File.write (path, false); - output.writeString (newContent); - output.close (); - - if (backedUpConfig) { - - try { - - FileSystem.deleteFile (path + ".bak"); - - } catch (e:Dynamic) {} - - } - - } - - - public static function writeConfigValue (name:String, value:String):Void { - - var path = getConfigPath (); - - try { - - if (!FileSystem.exists (value) && FileSystem.exists (PathHelper.expand (value))) { - - value = PathHelper.expand (value); - - } - - } catch (e:Dynamic) {} - - if (FileSystem.exists (path)) { - - var configText = File.getContent (path); - var lines = configText.split ("\n"); - - var findSet = " -1) { - - found = true; - lines[i] = line.substr (0, index) + ""; - - } - - if ((index = line.indexOf (findSetenv)) > -1) { - - found = true; - lines[i] = line.substr (0, index) + ""; - - } - - if ((index = line.indexOf (findDefine)) > -1) { - - found = true; - lines[i] = line.substr (0, index) + ""; - - } - - i++; - - } - - if (!found && lines.length > 2) { - - var insertPoint = lines.length - 3; - - if (StringTools.trim (lines[lines.length - 1]) == "") { - - insertPoint--; - - } - - if (StringTools.trim (lines[insertPoint + 1]) != "") { - - lines.insert (insertPoint + 1, "\t"); - - } - - lines.insert (insertPoint + 1, "\t"); - - } - - var content = lines.join ("\n"); - File.saveContent (path, content); - - LogHelper.info ("Set \x1b[1m" + name + "\x1b[0m to \x1b[1m" + value + "\x1b[0m"); - - } else { - - LogHelper.error ("Cannot find \"" + path + "\""); - - } - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/CordovaHelper.hx b/lime/tools/helpers/CordovaHelper.hx deleted file mode 100644 index 4d4af3f87..000000000 --- a/lime/tools/helpers/CordovaHelper.hx +++ /dev/null @@ -1,357 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Eof; -import haxe.io.Path; -import lime.project.Asset; -import lime.project.Icon; -import sys.io.File; -import sys.FileSystem; - - -class CordovaHelper { - - - /*public static var contentPath = "www/"; - - private static var defines:Map; - private static var NME:String; - private static var target:String; - private static var targetFlags:Map; - - - public static function build (workingDirectory:String, debug:Bool):Void { - - switch (target) { - - case "ios": - - var directoryName = "Release"; - - if (debug) { - - directoryName = "Debug"; - - } - - if (targetFlags.exists ("simulator")) { - - directoryName += "-iphonesimulator"; - - } else { - - directoryName += "-iphoneos"; - - } - - IOSHelper.build (workingDirectory, debug, [ "CONFIGURATION_BUILD_DIR=" + FileSystem.fullPath (workingDirectory) + "/build/" + directoryName ]); - - if (!targetFlags.exists ("simulator")) { - - //var entitlements = buildDirectory + "/ios/" + defines.get("APP_FILE") + "/" + defines.get("APP_FILE") + "-Entitlements.plist"; - IOSHelper.sign (workingDirectory, null, debug); - - } - - case "blackberry": - - if (targetFlags.exists ("bbos")) { - - AntHelper.run (workingDirectory, [ "blackberry", "build", "-Dcode.sign=false" ]); - - } else { - - //AntHelper.run (workingDirectory, [ "playbook", "build" ]); - - var args = [ "qnx", "build" ]; - - if (!defines.exists ("KEY_STORE")) { - - var debugTokenPath = PathHelper.tryFullPath (defines.get ("BLACKBERRY_DEBUG_TOKEN")); - var targetPath = defines.get ("WEBWORKS_SDK") + "/debugToken.bar"; - - if (FileSystem.exists (debugTokenPath)) { - - try { - - if (FileSystem.exists (targetPath)) { - - FileSystem.deleteFile (targetPath); - - } - - File.copy (debugTokenPath, targetPath); - - } catch (e:Dynamic) {} - - } - - } else { - - var keyStorePath = PathHelper.tryFullPath (defines.get ("KEY_STORE")); - var targetPath = ""; - - if (InstallTool.isWindows) { - - targetPath = Sys.getEnv ("HOMEPATH") + "\\AppData\\Local\\Research In Motion"; - - } else if (InstallTool.isMac) { - - targetPath = PathHelper.expand ("~/Library/Research In Motion"); - - } else { - - targetPath = PathHelper.expand ("~/.rim"); - - } - - targetPath += "/author.p12"; - - if (FileSystem.exists (keyStorePath)) { - - try { - - PathHelper.mkdir (Path.directory (targetPath)); - - if (FileSystem.exists (targetPath)) { - - FileSystem.deleteFile (targetPath); - - } - - File.copy (keyStorePath, targetPath); - - } catch (e:Dynamic) {} - - } - - if (defines.exists ("KEY_STORE") && !defines.exists ("KEY_STORE_PASSWORD")) { - - defines.set ("KEY_STORE_PASSWORD", prompt ("Keystore password", true)); - Sys.println (""); - - } - - args.push ("-Dproperties.qnx.sigtool.password=" + defines.get ("KEY_STORE_PASSWORD")); - args.push ("-Dbuild.number=" + defines.get ("APP_BUILD_NUMBER")); - args.push ("-Dcode.sign=true"); - - } - - AntHelper.run (workingDirectory, args); - - } - - case "android": - - AndroidHelper.build (workingDirectory); - - } - - } - - - public static function create (workingDirectory:String, targetPath:String, context:Dynamic):Void { - - //if (!FileSystem.exists (targetPath)) { - - if (target == "android") { - - Sys.putEnv ("ANDROID_BIN", defines.get ("ANDROID_SDK") + "/tools/android"); - - } - - PathHelper.removeDirectory (targetPath); - ProcessHelper.runCommand (workingDirectory, defines.get ("CORDOVA_PATH") + "/lib/" + target + "/bin/create", [ targetPath, defines.get ("APP_PACKAGE"), defines.get ("APP_FILE") ]); - - //} - - switch (target) { - - case "ios": - - FileHelper.copyFile (NME + "/templates/cordova/ios/template/PROJ/PROJ-Info.plist", targetPath + "/" + defines.get ("APP_FILE") + "/" + defines.get ("APP_FILE") + "-Info.plist", context); - - case "blackberry": - - context.BLACKBERRY_AUTHOR_ID = BlackBerryHelper.processDebugToken (targetPath).authorID; - FileHelper.recursiveCopy (NME + "/templates/cordova/blackberry/template", targetPath, context); - - } - - } - - - public static function initialize (defines:Map, targetFlags:Map, target:String, NME:String):Void { - - CordovaHelper.defines = defines; - CordovaHelper.NME = NME; - CordovaHelper.target = target; - CordovaHelper.targetFlags = targetFlags; - - switch (target) { - - case "ios": - - IOSHelper.initialize (defines, targetFlags, NME); - - case "blackberry": - - AntHelper.initialize (defines); - BlackBerryHelper.initialize (defines, targetFlags); - - case "android": - - AndroidHelper.initialize (defines); - - } - - } - - - public static function launch (workingDirectory:String, debug:Bool):Void { - - switch (target) { - - case "ios": - - IOSHelper.launch (workingDirectory, debug); - - case "blackberry": - - if (targetFlags.exists ("bbos")) { - - if (targetFlags.exists ("simulator")) { - - AntHelper.run (workingDirectory, [ "blackberry", "load-simulator" ]); - - } else { - - //AntHelper.run (workingDirectory, [ "blackberry", "clean-device" ]); - AntHelper.run (workingDirectory, [ "blackberry", "load-device" ]); - - } - - } else { - - var safePackageName = StringTools.replace (defines.get ("APP_TITLE"), " ", ""); - //BlackBerryHelper.deploy (workingDirectory, "build/" + safePackageName + ".bar"); - - if (targetFlags.exists ("simulator")) { - - BlackBerryHelper.deploy (workingDirectory, "build/simulator/" + safePackageName + ".bar"); - - } else { - - BlackBerryHelper.deploy (workingDirectory, "build/device/" + safePackageName + ".bar"); - - } - - } - - case "android": - - var build:String = "debug"; - - if (defines.exists ("KEY_STORE")) { - - build = "release"; - - } - - AndroidHelper.install (FileSystem.fullPath (workingDirectory) + "/bin/" + defines.get ("APP_FILE") + "-" + build + ".apk"); - AndroidHelper.run (defines.get ("APP_PACKAGE") + "/" + defines.get ("APP_PACKAGE") + "." + defines.get ("APP_FILE")); - - } - - } - - - private static function prompt (name:String, ?passwd:Bool):String { - - Sys.print (name + ": "); - - if (passwd) { - var s = new StringBuf (); - var c; - while ((c = Sys.getChar(false)) != 13) - s.addChar (c); - return s.toString (); - } - - try { - - return Sys.stdin ().readLine (); - - } catch (e:Eof) { - - return ""; - - } - - } - - - public static function updateIcon (buildDirectory:String, icons:Array, assets:Array, context:Dynamic):Void { - - var iconCount = 0; - var sizes = []; - var targetPaths = []; - - switch (target) { - - case "blackberry": - - // 80 for BBOS? - - sizes = [ 86, 150 ]; - targetPaths = [ "res/icon/icon-86.png", "res/icon/icon-150.png" ]; - - case "ios": - - sizes = [ 57, 114 , 72, 144 ]; - targetPaths = [ "../" + defines.get ("APP_FILE") + "/Resources/icons/icon.png", "../" + defines.get ("APP_FILE") + "/Resources/icons/icon@2x.png", "../" + defines.get ("APP_FILE") + "/Resources/icons/icon-72.png", "../" + defines.get ("APP_FILE") + "/Resources/icons/icon-72@2x.png" ]; - - case "android": - - sizes = [ 36, 48, 72, 96 ]; - targetPaths = [ "res/drawable-ldpi/icon.png", "res/drawable-mdpi/icon.png", "res/drawable-hdpi/icon.png", "res/drawable-xhdpi/icon.png" ]; - - } - - context.ICONS = []; - for (i in 0...sizes.length) { - - var icon_name = icons.findIcon (sizes[i], sizes[i]); - - if (icon_name == "") { - - var tmpDir = buildDirectory + "/haxe"; - PathHelper.mkdir (tmpDir); - var tmp_name = tmpDir + "/icon-" + sizes[i] + ".png"; - - Sys.println (sizes[i]); - - if (icons.updateIcon (sizes[i], sizes[i], tmp_name)) { - - icon_name = tmp_name; - - } - - } - - if (icon_name != "") { - - assets.push (new Asset (icon_name, targetPaths[i], Asset.TYPE_IMAGE, Path.withoutDirectory (icon_name), "1")); - context.APP_ICON = targetPaths[i]; - context.ICONS.push (targetPaths[i]); - context.HAS_ICON = true; - - } - - } - - }*/ - - -} \ No newline at end of file diff --git a/lime/tools/helpers/DeploymentHelper.hx b/lime/tools/helpers/DeploymentHelper.hx deleted file mode 100644 index d133d7900..000000000 --- a/lime/tools/helpers/DeploymentHelper.hx +++ /dev/null @@ -1,44 +0,0 @@ -package lime.tools.helpers; - - -import lime.project.HXProject; - - -class DeploymentHelper { - - - public static function deploy (project:HXProject, targetFlags:Map, targetDirectory:String, targetName:String) { - - var name = project.meta.title + " (" + project.meta.version + " build " + project.meta.buildNumber + ") (" + targetName + ").zip"; - var targetPath = PathHelper.combine (targetDirectory + "/dist", name); - - ZipHelper.compress (PathHelper.combine (targetDirectory, "bin"), targetPath); - - if (targetFlags.exists ("gdrive")) { - - var parent = targetFlags.get ("parent"); - - var args = [ "upload" , "-f" , targetPath ]; - - if (targetFlags.exists("config")) { - - args.push ("--config"); - args.push (targetFlags.get("config")); - - } - - if (parent != null && parent != "") { - - args.push ("-p"); - args.push (parent); - - } - - ProcessHelper.runCommand ("", "drive", args); - - } - - } - - -} diff --git a/lime/tools/helpers/ElectronHelper.hx b/lime/tools/helpers/ElectronHelper.hx deleted file mode 100644 index ac590de41..000000000 --- a/lime/tools/helpers/ElectronHelper.hx +++ /dev/null @@ -1,31 +0,0 @@ -package lime.tools.helpers; - - -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.ProcessHelper; -import lime.project.HXProject; - - -class ElectronHelper { - - - public static function launch (project:HXProject, path:String):Void { - - var electronPath = project.defines.get ("ELECTRON_PATH"); - - if (electronPath == null || electronPath == "") { - - electronPath = "electron"; - - } else { - - electronPath = PathHelper.combine (electronPath, "electron"); - - } - - ProcessHelper.runCommand ("", electronPath, [ path ]); - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/FileHelper.hx b/lime/tools/helpers/FileHelper.hx deleted file mode 100644 index f2002bb04..000000000 --- a/lime/tools/helpers/FileHelper.hx +++ /dev/null @@ -1,595 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Bytes; -import haxe.io.Path; -import haxe.Template; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.StringHelper; -import lime.project.Asset; -import lime.project.AssetEncoding; -import lime.project.AssetType; -import lime.project.HXProject; -import lime.project.NDLL; -import lime.project.Platform; -import sys.io.File; -import sys.io.FileOutput; -import sys.FileSystem; - -#if neko -import neko.Lib; -#elseif cpp -import cpp.Lib; -#end - - -class FileHelper { - - - private static var knownExtensions:Map; - - - private static function __init__ ():Void { - - knownExtensions = [ - - "jpg" => IMAGE, - "jpeg" => IMAGE, - "png" => IMAGE, - "gif" => IMAGE, - "webp" => IMAGE, - "bmp" => IMAGE, - "tiff" => IMAGE, - "jfif" => IMAGE, - "otf" => FONT, - "ttf" => FONT, - "wav" => SOUND, - "wave" => SOUND, - "mp3" => MUSIC, - "mp2" => MUSIC, - "exe" => BINARY, - "bin" => BINARY, - "so" => BINARY, - "pch" => BINARY, - "dll" => BINARY, - "zip" => BINARY, - "tar" => BINARY, - "gz" => BINARY, - "fla" => BINARY, - "swf" => BINARY, - "atf" => BINARY, - "psd" => BINARY, - "awd" => BINARY, - "txt" => TEXT, - "text" => TEXT, - "xml" => TEXT, - "java" => TEXT, - "hx" => TEXT, - "cpp" => TEXT, - "c" => TEXT, - "h" => TEXT, - "cs" => TEXT, - "js" => TEXT, - "mm" => TEXT, - "hxml" => TEXT, - "html" => TEXT, - "json" => TEXT, - "css" => TEXT, - "gpe" => TEXT, - "pbxproj" => TEXT, - "plist" => TEXT, - "properties" => TEXT, - "ini" => TEXT, - "hxproj" => TEXT, - "nmml" => TEXT, - "lime" => TEXT, - "svg" => TEXT, - - ]; - - } - - - public static function copyAsset (asset:Asset, destination:String, context:Dynamic = null) { - - if (asset.sourcePath != "") { - - copyFile (asset.sourcePath, destination, context, asset.type == TEMPLATE); - - } else { - - try { - - if (asset.encoding == AssetEncoding.BASE64) { - - File.saveBytes (destination, StringHelper.base64Decode (asset.data)); - - } else if (Std.is (asset.data, Bytes)) { - - File.saveBytes (destination, cast asset.data); - - } else { - - File.saveContent (destination, Std.string (asset.data)); - - } - - } catch (e:Dynamic) { - - LogHelper.error ("Cannot write to file \"" + destination + "\""); - - } - - } - - } - - - public static function copyAssetIfNewer (asset:Asset, destination:String) { - - if (asset.sourcePath != "") { - - if (isNewer (asset.sourcePath, destination)) { - - copyFile (asset.sourcePath, destination, null, asset.type == TEMPLATE); - - } - - } else { - - PathHelper.mkdir (Path.directory (destination)); - - LogHelper.info ("", " - \x1b[1mWriting file:\x1b[0m " + destination); - - try { - - if (asset.encoding == AssetEncoding.BASE64) { - - File.saveBytes (destination, StringHelper.base64Decode (asset.data)); - - } else if (Std.is (asset.data, Bytes)) { - - File.saveBytes (destination, cast asset.data); - - } else { - - File.saveContent (destination, Std.string (asset.data)); - - } - - } catch (e:Dynamic) { - - LogHelper.error ("Cannot write to file \"" + destination + "\""); - - } - - } - - } - - - public static function copyFile (source:String, destination:String, context:Dynamic = null, process:Bool = true) { - - var extension = Path.extension (source); - - if (process && context != null) { - - if (knownExtensions.exists (extension) && knownExtensions.get (extension) != TEXT) { - - copyIfNewer (source, destination); - return; - - } - - var _isText = false; - - if (knownExtensions.exists (extension) && knownExtensions.get (extension) == TEXT) { - - _isText = true; - - } else { - - _isText = isText (source); - - } - - if (_isText) { - - //LogHelper.info ("", " - \x1b[1mProcessing template file:\x1b[0m " + source + " \x1b[3;37m->\x1b[0m " + destination); - - var fileContents:String = File.getContent (source); - var template:Template = new Template (fileContents); - var result:String = template.execute (context, { - toJSON: function(_, s) return haxe.Json.stringify(s), - upper: function (_, s) return s.toUpperCase (), - replace: function (_, s, sub, by) return StringTools.replace(s, sub, by) - }); - - try { - - if (FileSystem.exists (destination)) { - - var existingContent = File.getContent (destination); - if (result == existingContent) return; - - } - - } catch (e:Dynamic) {} - - PathHelper.mkdir (Path.directory (destination)); - - LogHelper.info ("", " - \x1b[1mCopying template file:\x1b[0m " + source + " \x1b[3;37m->\x1b[0m " + destination); - - try { - - File.saveContent (destination, result); - - } catch (e:Dynamic) { - - LogHelper.error ("Cannot write to file \"" + destination + "\""); - - } - - return; - - } - - } - - copyIfNewer (source, destination); - - } - - - public static function copyFileTemplate (templatePaths:Array, source:String, destination:String, context:Dynamic = null, process:Bool = true, warnIfNotFound:Bool = true) { - - var path = PathHelper.findTemplate (templatePaths, source, warnIfNotFound); - - if (path != null) { - - copyFile (path, destination, context, process); - - } - - } - - - public static function copyIfNewer (source:String, destination:String) { - - //allFiles.push (destination); - - if (!isNewer (source, destination)) { - - return; - - } - - PathHelper.mkdir (Path.directory (destination)); - - LogHelper.info ("", " - \x1b[1mCopying file:\x1b[0m " + source + " \x1b[3;37m->\x1b[0m " + destination); - - try { - - File.copy (source, destination); - - } catch (e:Dynamic) { - - try { - - if (FileSystem.exists (destination)) { - - LogHelper.error ("Cannot copy to \"" + destination + "\", is the file in use?"); - return; - - } else {} - - } catch (e:Dynamic) {} - - LogHelper.error ("Cannot open \"" + destination + "\" for writing, do you have correct access permissions?"); - - } - - } - - - public static function copyLibrary (project:HXProject, ndll:NDLL, directoryName:String, namePrefix:String, nameSuffix:String, targetDirectory:String, allowDebug:Bool = false, targetSuffix:String = null) { - - var path = PathHelper.getLibraryPath (ndll, directoryName, namePrefix, nameSuffix, allowDebug); - - if (FileSystem.exists (path)) { - - var targetPath = PathHelper.combine (targetDirectory, namePrefix + ndll.name); - - if (targetSuffix != null) { - - targetPath += targetSuffix; - - } else { - - targetPath += nameSuffix; - - } - - if (project.config.getBool ("tools.copy-ndlls")) { - - LogHelper.info ("", " - \x1b[1mCopying library file:\x1b[0m " + path + " \x1b[3;37m->\x1b[0m " + targetPath); - - PathHelper.mkdir (targetDirectory); - - try { - - File.copy (path, targetPath); - - } catch (e:Dynamic) { - - LogHelper.error ("Cannot copy to \"" + targetPath + "\", is the file in use?"); - - } - - } else { - - LogHelper.info ("", " - \x1b[1mSkipping library file:\x1b[0m " + path + " \x1b[3;37m->\x1b[0m " + targetPath); - - } - - } else { - - LogHelper.error ("Source path \"" + path + "\" does not exist"); - - } - - } - - - public static function getLastModified (source:String):Float { - - if (FileSystem.exists (source)) { - - return FileSystem.stat (source).mtime.getTime (); - - } - - return -1; - - } - - - public static function linkFile (source:String, destination:String, symbolic:Bool = true, overwrite:Bool = false) { - - if (!isNewer (source, destination)) { - - return; - - } - - if (FileSystem.exists (destination)) { - - FileSystem.deleteFile (destination); - - } - - if (!FileSystem.exists (destination)) { - - try { - - var command = "/bin/ln"; - var args = []; - - if (symbolic) { - - args.push ("-s"); - - } - - if(overwrite){ - - args.push("-f"); - - } - - args.push (source); - args.push (destination); - - ProcessHelper.runCommand (".", command, args); - - } catch (e:Dynamic) {} - - } - - } - - - public static function recursiveCopy (source:String, destination:String, context:Dynamic = null, process:Bool = true) { - - PathHelper.mkdir (destination); - - var files:Array = null; - - try { - - files = FileSystem.readDirectory (source); - - } catch (e:Dynamic) { - - LogHelper.error ("Could not find source directory \"" + source + "\""); - - } - - for (file in files) { - - if (file.substr (0, 1) != ".") { - - var itemDestination:String = destination + "/" + file; - var itemSource:String = source + "/" + file; - - if (FileSystem.isDirectory (itemSource)) { - - recursiveCopy (itemSource, itemDestination, context, process); - - } else { - - copyFile (itemSource, itemDestination, context, process); - - } - - } - - } - - } - - - public static function recursiveCopyTemplate (templatePaths:Array = null, source:String, destination:String, context:Dynamic = null, process:Bool = true, warnIfNotFound:Bool = true) { - - var destinations = []; - var paths = PathHelper.findTemplateRecursive (templatePaths, source, warnIfNotFound, destinations); - - if (paths != null) { - - PathHelper.mkdir (destination); - var itemDestination; - - for (i in 0...paths.length) { - - itemDestination = PathHelper.combine (destination, destinations[i]); - copyFile (paths[i], itemDestination, context, process); - - } - - } - - } - - - public static function recursiveSmartCopyTemplate (project:HXProject, source:String, destination:String, context:Dynamic = null, process:Bool = true, warnIfNotFound:Bool = true) { - - var destinations = []; - var paths = PathHelper.findTemplateRecursive (project.templatePaths, source, warnIfNotFound, destinations); - - if (paths != null) { - - PathHelper.mkdir (destination); - var itemDestination; - - for (i in 0...paths.length) { - - itemDestination = PathHelper.combine (destination, PathHelper.substitutePath (project, destinations[i])); - copyFile (paths[i], itemDestination, context, process); - - } - - } - - } - - - public static function replaceText (source:String, replaceString:String, replacement:String) { - - if (FileSystem.exists (source)) { - - var output = File.getContent (source); - - var index = output.indexOf (replaceString); - - if (index > -1) { - - output = output.substr (0, index) + replacement + output.substr (index + replaceString.length); - File.saveContent (source, output); - - } - - } - - } - - - public static function isNewer (source:String, destination:String):Bool { - - if (source == null || !FileSystem.exists (source)) { - - LogHelper.error ("Source path \"" + source + "\" does not exist"); - return false; - - } - - if (FileSystem.exists (destination)) { - - if (FileSystem.stat (source).mtime.getTime () < FileSystem.stat (destination).mtime.getTime ()) { - - return false; - - } - - } - - return true; - - } - - - public static function isText (source:String):Bool { - - if (!FileSystem.exists (source)) { - - return false; - - } - - var input = File.read (source, true); - - var numChars = 0; - var numBytes = 0; - var byteHeader = []; - var zeroBytes = 0; - - try { - - while (numBytes < 512) { - - var byte = input.readByte (); - - if (numBytes < 3) { - - byteHeader.push (byte); - - } else if (byteHeader != null) { - - if (byteHeader[0] == 0xFF && byteHeader[1] == 0xFE) return true; // UCS-2LE or UTF-16LE - if (byteHeader[0] == 0xFE && byteHeader[1] == 0xFF) return true; // UCS-2BE or UTF-16BE - if (byteHeader[0] == 0xEF && byteHeader[1] == 0xBB && byteHeader[2] == 0xBF) return true; // UTF-8 - byteHeader = null; - - } - - numBytes++; - - if (byte == 0) { - - zeroBytes++; - - } - - if ((byte > 8 && byte < 16) || (byte > 32 && byte < 256) || byte > 287) { - - numChars++; - - } - - } - - } catch (e:Dynamic) { } - - input.close (); - - if (numBytes == 0 || (numChars / numBytes) > 0.9 || ((zeroBytes / numBytes) < 0.015 && (numChars / numBytes) > 0.5)) { - - return true; - - } - - return false; - - } - - -} diff --git a/lime/tools/helpers/FlashHelper.hx b/lime/tools/helpers/FlashHelper.hx deleted file mode 100644 index 4ce3a77d5..000000000 --- a/lime/tools/helpers/FlashHelper.hx +++ /dev/null @@ -1,1054 +0,0 @@ -package lime.tools.helpers; - - -//import openfl.text.Font; -//import openfl.utils.ByteArray; -import haxe.io.Bytes; -import haxe.io.Path; -import lime.project.Asset; -import lime.project.AssetEncoding; -import lime.project.AssetType; -import lime.project.HXProject; -import lime.text.Font; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.ProcessHelper; -import sys.io.File; -import sys.FileSystem; -import sys.io.FileSeek; - -#if format -import format.swf.Data; -import format.swf.Constants; -import format.swf.Reader; -import format.swf.Writer; -import format.wav.Data; -#end - - -class FlashHelper { - - - private static var swfAssetID = 1000; - - - #if format - private static function embedAsset (inAsset:Asset, packageName:String, outTags:Array) { - - var embed = inAsset.embed; - var path = inAsset.sourcePath; - var type = inAsset.type; - var flatName = inAsset.flatName; - var ext = inAsset.format; - var name = (path == null || path == "") ? inAsset.targetPath : path; - - if (embed == false) { - - return false; - - } - - LogHelper.info ("", " - \x1b[1mEmbedding asset:\x1b[0m \x1b[3;37m(" + type + ")\x1b[0m " + name); - - var cid = nextAssetID (); - - if (type == AssetType.MUSIC || type == AssetType.SOUND) { - - var src = path; - - if (ext != "mp3" && ext != "wav") { - - for (e in ["wav", "mp3"]) { - - src = path.substr (0, path.length - ext.length) + e; - - if (FileSystem.exists (src)) { - - break; - - } - - } - - } - - if (!FileSystem.exists (src)) { - - Sys.println ("Warning: Could not embed unsupported audio file \"" + name + "\", embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - - } - - var input = File.read (src, true); - - if (ext == "mp3") { - - var reader = new mpeg.audio.MpegAudioReader(input); - - var frameDataWriter = new haxe.io.BytesOutput(); - var totalLengthSamples = 0; - var samplingFrequency = -1; - var isStereo:Null = null; - var encoderDelay = 0; - var endPadding = 0; - var decoderDelay = 529; // This is a constant delay caused by the Fraunhofer MP3 Decoder used in Flash Player. - - while (true) { - switch (reader.readNext()) { - case Frame(frame): - if (frame.header.layer != mpeg.audio.Layer.Layer3) { - Sys.println ("Warning: Could not embed \"" + name + "\" (Flash only supports Layer-III MP3 files, but file is " + frame.header.layer + "), embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - } - var frameSamplingFrequency = frame.header.samplingFrequency; - if (samplingFrequency == -1) { - samplingFrequency = frameSamplingFrequency; - } else if (frameSamplingFrequency != samplingFrequency) { - Sys.println ("Warning: Could not embed \"" + name + "\" (Flash does not support MP3 audio with variable sampling frequencies), embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - } - var frameIsStereo = frame.header.mode != mpeg.audio.Mode.SingleChannel; - if (isStereo == null) { - isStereo = frameIsStereo; - } else if (frameIsStereo != isStereo) { - Sys.println ("Warning: Could not embed \"" + name + "\" (Flash does not support MP3 audio with mixed mono and stero frames), embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - } - frameDataWriter.write(frame.frameData); - totalLengthSamples += mpeg.audio.Utils.lookupSamplesPerFrame(frame.header.version, frame.header.layer); - - case GaplessInfo(giEncoderDelay, giEndPadding): - encoderDelay = giEncoderDelay; - endPadding = giEndPadding; - - case Info(_): // ignore - case Unknown(_): // ignore - case End: break; - } - } - - if (totalLengthSamples == 0) { - Sys.println ("Warning: Could not embed \"" + name + "\" (Could not find any valid MP3 audio data), embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - } - - var flashSamplingFrequency = switch (samplingFrequency) { - case 11025: SR11k; - case 22050: SR22k; - case 44100: SR44k; - default: null; - } - - if (flashSamplingFrequency == null) { - - Sys.println ("Warning: Could not embed \"" + name + "\" (Flash supports 11025, 22050 and 44100kHz MP3 files, but file is " + samplingFrequency + "kHz), embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - - } - - var frameData = frameDataWriter.getBytes(); - - var snd:format.swf.Sound = { - sid: cid, - format: SFMP3, - rate: flashSamplingFrequency, - is16bit: true, - isStereo: isStereo, - samples: totalLengthSamples - endPadding - encoderDelay, - data: SDMp3(encoderDelay + decoderDelay, frameData) - }; - - outTags.push (TSound (snd)); - - } else { - - var header = input.readString (4); - - if (ext == "ogg" || header == "OggS") { - - Sys.println ("Warning: Skipping unsupported OGG file \"" + name + "\", embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - - } else if (header != "RIFF") { - - Sys.println ("Warning: Could not embed unrecognized WAV file \"" + name + "\", embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - - } else { - - input.close (); - input = File.read (src, true); - - var r = new format.wav.Reader (input); - var wav = r.read (); - var hdr = wav.header; - - if (hdr.format != WF_PCM) { - - Sys.println ("Warning: Could not embed \"" + name + "\" (Only PCM uncompressed WAV files are currently supported), embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - - } - - // Check sampling rate - var flashRate = switch (hdr.samplingRate) { - - case 5512: SR5k; - case 11025: SR11k; - case 22050: SR22k; - case 44100: SR44k; - default: null; - - } - - if (flashRate == null) { - - Sys.println ("Warning: Could not embed \"" + name + "\" (Flash supports 5512, 11025, 22050 and 44100kHz WAV files, but file is " + hdr.samplingRate + "kHz), embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - - } - - var isStereo = switch (hdr.channels) { - - case 1: false; - case 2: true; - default: - throw "Number of channels should be 1 or 2, but for '" + src + "' it is " + hdr.channels; - - } - - var is16bit = switch (hdr.bitsPerSample) { - - case 8: false; - case 16: true; - default: - throw "Bits per sample should be 8 or 16, but for '" + src + "' it is " + hdr.bitsPerSample; - - } - - if (wav.data != null) { - - var sampleCount = Std.int (wav.data.length / (hdr.bitsPerSample / 8)); - - var snd:format.swf.Sound = { - - sid : cid, - format : SFLittleEndianUncompressed, - rate : flashRate, - is16bit : is16bit, - isStereo : isStereo, - samples : sampleCount, - data : SDRaw (wav.data) - - } - - outTags.push (TSound (snd)); - - } else { - - Sys.println ("Warning: Could not embed WAV file \"" + name + "\", the file may be corrupted, embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - - } - - } - - } - - input.close (); - - } else if (type == AssetType.IMAGE) { - - if (inAsset.data != null) { - - if (inAsset.encoding == AssetEncoding.BASE64) { - - outTags.push (TBitsJPEG (cid, JDJPEG2 (StringHelper.base64Decode (inAsset.data)))); - - } else { - - outTags.push (TBitsJPEG (cid, JDJPEG2 (inAsset.data))); - - } - - } else { - - var src = path; - - if (ext == "jpg" || ext == "jpeg" || ext == "png" || ext == "gif") { - - if (!FileSystem.exists (src)) { - - Sys.println ("Warning: Could not find image path \"" + src + "\""); - - } else { - - var bytes = File.getBytes (src); - outTags.push (TBitsJPEG (cid, JDJPEG2 (bytes))); - - } - - } else { - - Sys.println ("Warning: Could not embed image file \"" + name + "\", unknown image type, embedding as binary"); - inAsset.type = BINARY; - return embedAsset (inAsset, packageName, outTags); - - } - - } - - } else if (type == AssetType.FONT) { - - // More code ripped off from "samhaxe" - - var src = path; - var face = Font.fromFile (src); - var font = face.decompose (); - var font_name = font.family_name; - //fallback for font name is case no one could be found.. - if ( font_name == null || font_name.length == 0 ) - font_name = Path.withoutExtension(name).split("/").pop().split("\\").pop(); - - var glyphs = new Array (); - var glyph_layout = new Array (); - - for (native_glyph in font.glyphs) { - - if (native_glyph.char_code > 65535) { - - Sys.println("Warning: glyph with character code greater than 65535 encountered ("+ native_glyph.char_code+"). Skipping..."); - continue; - - } - - var shapeRecords = new Array (); - var i:Int = 0; - var styleChanged:Bool = false; - var dx = 0; - var dy = 0; - - while (i < native_glyph.points.length) { - - var type = native_glyph.points[i++]; - - switch (type) { - - case 1: // Move - - dx = native_glyph.points[i++]; - dy = native_glyph.points[i++]; - shapeRecords.push( SHRChange({ - moveTo: {dx: dx, dy: -dy}, - // Set fill style to 1 in first style change record - // Required by DefineFontX - fillStyle0: if (!styleChanged) {idx: 1} else null, - fillStyle1: null, - lineStyle: null, - newStyles: null - })); - styleChanged = true; - - case 2: // LineTo - - dx = native_glyph.points[i++]; - dy = native_glyph.points[i++]; - shapeRecords.push (SHREdge(dx, -dy)); - - case 3: // CurveTo - var cdx = native_glyph.points[i++]; - var cdy = native_glyph.points[i++]; - dx = native_glyph.points[i++]; - dy = native_glyph.points[i++]; - shapeRecords.push (SHRCurvedEdge(cdx, -cdy, dx, -dy)); - - case 4: // CubicCurveTo - var p1x = native_glyph.points[i++]; - var p1y = native_glyph.points[i++]; - var p2x = native_glyph.points[i++]; - var p2y = native_glyph.points[i++]; - var p3x = native_glyph.points[i++]; - var p3y = native_glyph.points[i++]; - - // Get original points - - var cp1x = p1x + dx; - var cp1y = p1y + dy; - var cp2x = p2x + cp1x; - var cp2y = p2y + cp1y; - var endx = p3x + cp2x; - var endy = p3y + cp2y; - - // Convert to quadratic - - var cpx = Std.int ((-0.25 * dx) + (0.75 * cp1x) + (0.75 * cp2x) + ( -0.25 * endx)); - var cpy = Std.int (( -0.25 * dy) + (0.75 * cp1y) + (0.75 * cp2y) + ( -0.25 * endy)); - - // Offset again - - var cdx = cpx - dx; - var cdy = cpy - dy; - dx = endx - cpx; - dy = endy - cpy; - - shapeRecords.push (SHRCurvedEdge(cdx, -cdy, dx, -dy)); - - default: - throw "Invalid control point type encountered! (" + type + ")"; - - } - - } - - shapeRecords.push (SHREnd); - - glyphs.push({ - charCode: native_glyph.char_code, - shape: { - shapeRecords: shapeRecords - } - }); - - glyph_layout.push({ - advance: native_glyph.advance, - bounds: { - left: native_glyph.min_x, - right: native_glyph.max_x, - top: -native_glyph.max_y, - bottom: -native_glyph.min_y, - } - }); - - } - - var kerning = new Array (); - - if (font.kerning != null) { - - var length = font.kerning.length; - if (length > 0xFFFF) length = 0xFFFF; - var k; - - for (i in 0...length) { - - k = font.kerning[i]; - - kerning.push ({ - charCode1: k.left_glyph, - charCode2: k.right_glyph, - adjust: k.x, - }); - - } - - } - - var swf_em = 1024 * 20; - var ascent = Math.round (Math.abs (font.ascend * swf_em / font.em_size)); - var descent = Math.round (Math.abs ((font.descend) * swf_em / font.em_size)); - var leading = Math.round ((font.height - font.ascend + font.descend) * swf_em / font.em_size); - var language = LangCode.LCNone; - - outTags.push (TFont (cid, FDFont3 ({ - shiftJIS: false, - isSmall: false, - isANSI: false, - isItalic: font.is_italic, - isBold: font.is_bold, - language: language, - name: font_name, - glyphs: glyphs, - layout: { - ascent: ascent, - descent: descent, - leading: leading, - glyphs: glyph_layout, - kerning: kerning - } - })) ); - - } else { - - var bytes:Bytes = null; - - if (inAsset.data != null) { - - if (inAsset.encoding == AssetEncoding.BASE64) { - - bytes = StringHelper.base64Decode (inAsset.data); - - } else if (Std.is (inAsset.data, Bytes)) { - - bytes = cast inAsset.data; - - } else { - - bytes = Bytes.ofString (Std.string (inAsset.data)); - - } - - } - - if (bytes == null) { - - bytes = File.getBytes (path); - - } - - outTags.push (TBinaryData (cid, bytes)); - - } - - outTags.push (TSymbolClass ( [ { cid:cid, className: packageName + "__ASSET__" + flatName } ] )); - - return true; - - } - #end - - - /*public static function embedAssets (targetPath:String, assets:Array, packageName:String = ""):Void { - - try { - - var input = File.read (targetPath, true); - - if (input != null) { - - var reader = new Reader (input); - var swf = reader.read (); - input.close(); - - var new_tags = new Array (); - var inserted = false; - - for (tag in swf.tags) { - - var name = Type.enumConstructor (tag); - - if (name == "TShowFrame" && !inserted && assets.length > 0) { - - new_tags.push (TShowFrame); - - for (asset in assets) { - - try { - - if (asset.type != AssetType.TEMPLATE && embedAsset (asset, packageName, new_tags)) { - - inserted = true; - - } - - } catch (e:Dynamic) { - - Sys.println ("Error embedding \"" + asset.sourcePath + "\": " + e); - - } - - } - - } - - new_tags.push (tag); - - } - - if (inserted) { - - swf.tags = new_tags; - var output = File.write (targetPath, true); - var writer = new Writer (output); - writer.write (swf); - output.close (); - - } - - } else { - - trace ("Embedding assets failed! We encountered an error. Does '" + targetPath + "' exist?"); - - } - - } catch (e:Dynamic) { - - trace ("Embedding assets failed! We encountered an error accessing '" + targetPath + "': " + e); - - } - - }*/ - - - public static function enableLogging ():Void { - - try { - - var path = switch (PlatformHelper.hostPlatform) { - - case WINDOWS: Sys.getEnv ("HOMEDRIVE") + "/" + Sys.getEnv ("HOMEPATH") + "/mm.cfg"; - //case MAC: "/Library/Application Support/Macromedia/mm.cfg"; - default: Sys.getEnv ("HOME") + "/mm.cfg"; - - } - - if (!FileSystem.exists (path)) { - - File.saveContent (path, "ErrorReportingEnable=1\nTraceOutputFileEnable=1\nMaxWarnings=50"); - - } - - } catch (e:Dynamic) {} - - } - - - private static function compileSWC (project:HXProject, assets:Array, id:Int, destination:String):Void { - - #if format - destination = destination + "/obj"; - PathHelper.mkdir (destination); - - var label = (id > 0 ? Std.string (id + 1) : ""); - - var swfVersions = [ 9, 10, /*10.1,*/ 10.2, 10.3, 11, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6, 11.7, 11.8, 12, 13, 14 ]; - - var flashVersion = 9; - - if (project.app.swfVersion > 14) { - - flashVersion += Std.int ((swfVersions.length - 1) + (project.app.swfVersion - 14)); - - } else { - - for (swfVersion in swfVersions) { - - if (project.app.swfVersion > swfVersion) { - - flashVersion++; - - } - - } - - } - - var header:SWFHeader = - { - version : flashVersion, - compressed : true, - width : (project.window.width == 0 ? 800 : project.window.width), - height : (project.window.height == 0 ? 500 : project.window.height), - fps : project.window.fps * 256, - nframes : project.target == AIR ? 1 : 2 - }; - - var tags = new Array (); - var packageName = ""; - var inserted = false; - - tags.push (TBackgroundColor (project.window.background)); - - if (project.target != AIR) { - - tags.push (TShowFrame); - - } - - // Might generate ABC later, so we don't need the @:bind calls in DefaultAssetLibrary? - - /*var abc = new haxe.io.BytesOutput (); - var abcWriter = new format.abc.Writer (abc); - - for (asset in assets) { - - var classDef:ClassDef = { - var name : packageName + "__ASSET__" + asset.flatName; - var superclass : asset.flashClass; - var interfaces : []]; - var constructor : null; - var fields : []; - var namespace : null; - var isSealed : false; - var isFinal : false; - var isInterface : false; - var statics : []; - var staticFields : []; - } - abcWriter.writeClass (classDef); - - }*/ - - for (asset in assets) { - - #if format - try { - - if (asset.type != AssetType.TEMPLATE && embedAsset (asset, packageName, tags)) { - - inserted = true; - - } - - } catch (e:Dynamic) { - - Sys.println ("Error embedding \"" + asset.sourcePath + "\": " + e); - - } - #end - - } - - tags.push (TShowFrame); - - if (inserted) { - - var swf:SWF = { header: header, tags: tags }; - var output = File.write (destination + "/assets.swf", true); - var writer = new Writer (output); - writer.write (swf); - output.close (); - - } - #end - - } - - - /*private static function compileSWC (project:HXProject, embed:String, id:Int):Void { - - var destination = project.app.path + "/flash/obj"; - PathHelper.mkdir (destination); - - var label = (id > 0 ? Std.string (id + 1) : ""); - - File.saveContent (destination + "/EmbeddedAssets.hx", embed); - var args = [ "EmbeddedAssets", "-cp", destination, "-D", "swf-preloader-frame", "-swf", destination + "/assets.swf" ]; - - if (id == 0) { - - var header = args.push ("-swf-header"); - args.push ((project.window.width == 0 ? 800 : project.window.width) + ":" + (project.window.height == 0 ? 500 : project.window.height) + ":" + project.window.fps + ":" + StringTools.hex (project.window.background, 6)); - - } else { - - if (FileSystem.exists (destination + "/assets.swf")) { - - FileHelper.copyFile (destination + "/assets.swf", destination + "/.assets.swf"); - - } - - // Have to daisy-chain it to fix Haxe compiler issue - - args.push ("-swf-lib"); - args.push (destination + "/.assets.swf"); - args.push ("-D"); - args.push ("flash-use-stage"); - - } - - ProcessHelper.runCommand ("", "haxe", args); - - if (FileSystem.exists (destination + "/.assets.swf")) { - - try { - - FileSystem.deleteFile (destination + "/.assets.swf"); - - } catch (e:Dynamic) {} - - } - - }*/ - - - public static function embedAssets (project:HXProject, targetDirectory:String):Bool { - - var embed = ""; - var assets = []; - var maxSize = 1024 * 1024 * 16; - var currentSize = 0; - var id = 0; - var tempFiles = []; - - for (asset in project.assets) { - - if (asset.embed == null || asset.embed == true) { - - //LogHelper.info ("", " - \x1b[1mEmbedding asset:\x1b[0m \x1b[3;37m(" + asset.type + ")\x1b[0m " + asset.sourcePath); - - var flashClass = switch (asset.type) { - - case MUSIC: "flash.media.Sound"; - case SOUND: "flash.media.Sound"; - case IMAGE: "flash.display.BitmapData"; - case FONT: "flash.text.Font"; - default: "flash.utils.ByteArray"; - - } - - var tagName = switch (asset.type) { - - case MUSIC: "@:sound"; - case SOUND: "@:sound"; - case IMAGE: "@:bitmap"; - case FONT: "@:font"; - default: "@:file"; - - } - - var ignoreAsset = false; - var sourcePath = null; - - if (asset.data != null) { - - sourcePath = PathHelper.getTemporaryFile (); - tempFiles.push (sourcePath); - - if (asset.encoding == AssetEncoding.BASE64) { - - File.saveBytes (sourcePath, StringHelper.base64Decode (asset.data)); - - } else if (Std.is (asset.data, Bytes)) { - - File.saveBytes (sourcePath, asset.data); - - } else { - - File.saveContent (sourcePath, Std.string (asset.data)); - - } - - } else { - - sourcePath = asset.sourcePath; - - } - - try { - - var stat = FileSystem.stat (sourcePath); - - if (stat.size >= maxSize) { - - Sys.println ("Warning: Cannot embed large file \"" + sourcePath + "\" (>16MB)"); - ignoreAsset = true; - - } else { - - /*if (currentSize + stat.size >= maxSize) { - - //compileSWC (project, embed, id); - compileSWC (project, assets, id); - - id++; - currentSize = 0; - embed = ""; - assets = []; - - }*/ - - currentSize += stat.size; - - } - - } catch (e:Dynamic) { - - Sys.println ("Warning: Could not access \"" + sourcePath + "\", does the file exist?"); - ignoreAsset = true; - - } - - if (ignoreAsset) { - - embed += "@:keep class __ASSET__" + asset.flatName + " extends " + flashClass + " { }\n"; - - } else { - - assets.push (asset); - - if (asset.type == IMAGE) { - - embed += "@:keep " + tagName + "('" + sourcePath + "') class __ASSET__" + asset.flatName + " extends " + flashClass + " { public function new () { super (0, 0, true, 0); } }\n"; - - } else { - - embed += "@:keep " + tagName + "('" + sourcePath + "') class __ASSET__" + asset.flatName + " extends " + flashClass + " { }\n"; - - } - - } - - } - - } - - if (embed != "") { - - //compileSWC (project, embed, id); - compileSWC (project, assets, id, targetDirectory); - - } - - for (tempFile in tempFiles) { - - try { - - FileSystem.deleteFile (tempFile); - - } catch (e:Dynamic) {} - - } - - if (assets.length > 0) { - - project.haxeflags.push ("-cp " + targetDirectory); - project.haxeflags.push ("-swf-lib obj/assets.swf"); - project.haxedefs.set ("flash-use-stage", ""); - - return true; - - } - - return false; - - } - - - public static function getLogLength ():Int { - - try { - - var path = switch (PlatformHelper.hostPlatform) { - - case WINDOWS: PathHelper.escape (Sys.getEnv ("APPDATA") + "/Macromedia/Flash Player/Logs/flashlog.txt"); - case MAC: Sys.getEnv ("HOME") + "/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt"; - default: Sys.getEnv ("HOME") + "/.macromedia/Flash_Player/Logs/flashlog.txt"; - - } - - if (FileSystem.exists (path)) { - - return FileSystem.stat (path).size; - - } - - } catch (e:Dynamic) { } - - return 0; - - } - - - private static function nextAssetID () { - - return swfAssetID++; - - } - - - public static function run (project:HXProject, workingDirectory:String, targetPath:String):Void { - - var player:String = null; - - if (!StringTools.endsWith (targetPath, ".html")) { - - if (project.environment.exists ("SWF_PLAYER")) { - - player = project.environment.get ("SWF_PLAYER"); - - } else { - - player = Sys.getEnv ("FLASH_PLAYER_EXE"); - - } - - } - - ProcessHelper.openFile (workingDirectory, targetPath, player); - - } - - - public static function tailLog (start:Int = 0, clear:Bool = true):Void { - - try { - - var path = switch (PlatformHelper.hostPlatform) { - - case WINDOWS: Sys.getEnv ("APPDATA") + "/Macromedia/Flash Player/Logs/flashlog.txt"; - case MAC: Sys.getEnv ("HOME") + "/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt"; - default: Sys.getEnv ("HOME") + "/.macromedia/Flash_Player/Logs/flashlog.txt"; - - } - - var position = start; - - if (FileSystem.exists (path)) { - - if (clear) { - - try { - - File.saveContent (path, ""); - position = 0; - - } catch (e:Dynamic) {} - - } - - while (true) { - - var input = null; - - try { - - input = File.read (path, false); - input.seek (position, FileSeek.SeekBegin); - - if (!input.eof ()) { - - var bytes = input.readAll (); - position = input.tell (); - - if (bytes.length > 0) { - - Sys.print (bytes.getString (0, bytes.length)); - - } - - } - - input.close (); - - } catch (e:Dynamic) { - - if (input != null) { - - input.close (); - - } - - } - - Sys.sleep (0.3); - - } - - } - - } catch (e:Dynamic) {} - - } - - -} diff --git a/lime/tools/helpers/GUID.hx b/lime/tools/helpers/GUID.hx deleted file mode 100644 index 4be90dc51..000000000 --- a/lime/tools/helpers/GUID.hx +++ /dev/null @@ -1,67 +0,0 @@ -package lime.tools.helpers; - - -import haxe.crypto.Sha1; -import haxe.io.Bytes; -import haxe.crypto.Crc32; - - -// https://groups.google.com/d/msg/haxelang/N03kf5WSrTU/KU8nmsaqfIIJ -class GUID { - - inline public static function randomIntegerWithinRange (min:Int, max:Int, ?seeded:Bool = false):Int { - - return seeded ? - Math.floor(GUID.seededRandom() * (1 + max - min) + min) : - Math.floor(Math.random() * (1 + max - min) + min); - - } - - public static function createRandomIdentifier (length:Int, radix:Int = 61, ?seeded:Bool = false):String { - - var characters = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; - var id:Array = new Array (); - radix = (radix > 61) ? 61 : radix; - - while (length-- > 0) { - - id.push (characters[GUID.randomIntegerWithinRange (0, radix, seeded)]); - } - - return id.join(''); - } - - public static function uuid (?seeded:Bool = false):String { - - var specialChars = ['8', '9', 'A', 'B']; - - return "{" + GUID.createRandomIdentifier (8, 15, seeded) + '-' + - GUID.createRandomIdentifier (4, 15, seeded) + '-4' + - GUID.createRandomIdentifier (3, 15, seeded) + '-' + - specialChars[GUID.randomIntegerWithinRange (0, 3, seeded)] + - GUID.createRandomIdentifier (3, 15, seeded) + '-' + - GUID.createRandomIdentifier (12, 15, seeded) + - "}"; - - } - - private static var seed:Int = 0; - - private static function setSeed(input:String):Int { - var inputBytes = Bytes.ofString(input); - var hashedBytes = Sha1.make(inputBytes); - return GUID.seed = Crc32.make(hashedBytes); - } - - private static function seededRandom():Float { - GUID.seed++; - var x = Math.sin(GUID.seed) * 10000; - return x - Math.floor(x); - } - - public static function seededUuid (seed:String):String { - GUID.setSeed(seed); - return uuid(true); - } - -} \ No newline at end of file diff --git a/lime/tools/helpers/HTML5Helper.hx b/lime/tools/helpers/HTML5Helper.hx deleted file mode 100644 index 1adaa30f7..000000000 --- a/lime/tools/helpers/HTML5Helper.hx +++ /dev/null @@ -1,269 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Path; -import haxe.Timer; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.project.Architecture; -import lime.project.Asset; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Platform; -import lime.project.Version; -import sys.FileSystem; -import sys.io.File; - -#if neko -import neko.vm.Thread; -#elseif cpp -import cpp.vm.Thread; -#end - - -class HTML5Helper { - - - public static function encodeSourceMappingURL (sourceFile:String) { - - // This is only required for projects with url-unsafe characters built with a Haxe version prior to 4.0.0 - - var filename = Path.withoutDirectory (sourceFile); - - if (filename != StringTools.urlEncode (filename)) { - - var output = ProcessHelper.runProcess ("", "haxe", [ "-version" ], true, true, true, false, true); - var haxeVer:Version = StringTools.trim (output); - - if (haxeVer < ("4.0.0" : Version)) { - - var replaceString = "//# sourceMappingURL=" + filename + ".map"; - var replacement = "//# sourceMappingURL=" + StringTools.urlEncode (filename) + ".map"; - - FileHelper.replaceText (sourceFile, replaceString, replacement); - - } - - } - - } - - - public static function generateFontData (project:HXProject, font:Asset):String { - - var sourcePath = font.sourcePath; - - if (!FileSystem.exists (FileSystem.fullPath (sourcePath) + ".hash")) { - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - ProcessHelper.runCommand (Path.directory (sourcePath), "neko", [ PathHelper.findTemplate (templatePaths, "bin/hxswfml.n"), "ttf2hash2", Path.withoutDirectory (sourcePath), FileSystem.fullPath (sourcePath) + ".hash", "-glyphs", font.glyphs ]); - - } - - return "-resource " + FileSystem.fullPath (sourcePath) + ".hash@__ASSET__" + font.flatName; - - } - - - public static function generateWebfonts (project:HXProject, font:Asset):Void { - - var suffix = switch (PlatformHelper.hostPlatform) { - - case Platform.WINDOWS: "-windows.exe"; - case Platform.MAC: "-mac"; - case Platform.LINUX: "-linux"; - default: return; - - } - - if (suffix == "-linux") { - - if (PlatformHelper.hostArchitecture == Architecture.X86) { - - suffix += "32"; - - } else { - - suffix += "64"; - - } - - } - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - var webify = PathHelper.findTemplate (templatePaths, "bin/webify" + suffix); - if (PlatformHelper.hostPlatform != Platform.WINDOWS) { - - Sys.command ("chmod", [ "+x", webify ]); - - } - - if (LogHelper.verbose) { - - ProcessHelper.runCommand ("", webify, [ FileSystem.fullPath (font.sourcePath) ]); - - } else { - - ProcessHelper.runProcess ("", webify, [ FileSystem.fullPath (font.sourcePath) ], true, true, true); - - } - - } - - - public static function launch (project:HXProject, path:String, port:Int = 3000):Void { - - if (project.app.url != null && project.app.url != "") { - - ProcessHelper.openURL (project.app.url); - - } else { - - var suffix = switch (PlatformHelper.hostPlatform) { - - case Platform.WINDOWS: "-windows.exe"; - case Platform.MAC: "-mac"; - case Platform.LINUX: "-linux"; - default: return; - - } - - if (suffix == "-linux") { - - if (PlatformHelper.hostArchitecture == Architecture.X86) { - - suffix += "32"; - - } else { - - suffix += "64"; - - } - - } - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - var node = PathHelper.findTemplate (templatePaths, "bin/node/node" + suffix); - var server = PathHelper.findTemplate (templatePaths, "bin/node/http-server/bin/http-server"); - - if (PlatformHelper.hostPlatform != Platform.WINDOWS) { - - Sys.command ("chmod", [ "+x", node ]); - - } - - if (project.targetFlags.exists ("port")) { - - port = Std.parseInt (project.targetFlags.get ("port")); - - } - - LogHelper.info ("", " - \x1b[1mStarting local web server:\x1b[0m http://localhost:" + port); - - /*Thread.create (function () { - - Sys.sleep (0.5); - ProcessHelper.openURL ("http://localhost:" + port); - - });*/ - - var args = [ server, path, "-p", Std.string (port), "-c-1", "--cors" ]; - - if (project.targetFlags.exists ("nolaunch")) { - - LogHelper.info ("\x1b[1mStarting local web server:\x1b[0m http://localhost:" + port); - - } else { - - args.push ("-o"); - - } - - if (!LogHelper.verbose) { - - args.push ("--silent"); - - } - - ProcessHelper.runCommand ("", node, args); - - } - - } - - - public static function minify (project:HXProject, sourceFile:String):Bool { - - if (FileSystem.exists (sourceFile)) { - - var tempFile = PathHelper.getTemporaryFile (".js"); - - if (project.targetFlags.exists ("yui")) { - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - ProcessHelper.runCommand ("", "java", [ "-Dapple.awt.UIElement=true", "-jar", PathHelper.findTemplate (templatePaths, "bin/yuicompressor-2.4.7.jar"), "-o", tempFile, sourceFile ]); - - } else { - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - var args = [ "-Dapple.awt.UIElement=true", "-jar", PathHelper.findTemplate (templatePaths, "bin/compiler.jar"), "--strict_mode_input", "false", "--js", sourceFile, "--js_output_file", tempFile ]; - - if (project.targetFlags.exists ("advanced")) { - - args.push ("--compilation_level"); - args.push ("ADVANCED_OPTIMIZATIONS"); - - } - - if (FileSystem.exists (sourceFile + ".map") || project.targetFlags.exists ("source-map")) { - - // if an input .js.map exists closure automatically detects it (from sourceMappingURL) - // --source_map_location_mapping adds file:// to paths (similarly to haxe's .js.map) - - args.push ("--create_source_map"); - args.push (tempFile + ".map"); - args.push ("--source_map_location_mapping"); - args.push ("/|file:///"); - - } - - if (!LogHelper.verbose) { - - args.push ("--jscomp_off=uselessCode"); - - } - - ProcessHelper.runCommand ("", "java", args); - - if (FileSystem.exists (tempFile + ".map")) { - - // closure does not include a sourceMappingURL in the created .js, we do it here - #if !nodejs - var f = File.append (tempFile); - f.writeString ("//# sourceMappingURL=" + StringTools.urlEncode (Path.withoutDirectory (sourceFile)) + ".map"); - f.close (); - #end - - File.copy (tempFile + ".map", sourceFile + ".map"); - FileSystem.deleteFile (tempFile + ".map"); - - } - - } - - FileSystem.deleteFile (sourceFile); - File.copy (tempFile, sourceFile); - FileSystem.deleteFile (tempFile); - - return true; - - } - - return false; - - } - - -} diff --git a/lime/tools/helpers/HaxelibHelper.hx b/lime/tools/helpers/HaxelibHelper.hx deleted file mode 100644 index 30d0bb81e..000000000 --- a/lime/tools/helpers/HaxelibHelper.hx +++ /dev/null @@ -1,518 +0,0 @@ -package lime.tools.helpers; - - -import haxe.Json; -import lime.project.Architecture; -import lime.project.Haxelib; -import lime.project.Platform; -import lime.project.Version; -import sys.io.File; -import sys.FileSystem; - - -class HaxelibHelper { - - - public static var debug = false; - public static var pathOverrides = new Map (); - public static var workingDirectory = ""; - - private static var repositoryPath:String; - private static var paths = new Map (); - private static var toolPath = null; - private static var versions = new Map (); - - - public static function findFolderMatch (haxelib:Haxelib, directory:String):Version { - - var versions = new Array (); - var version:Version; - - try { - - for (file in FileSystem.readDirectory (directory)) { - - try { - - version = StringTools.replace (file, ",", "."); - versions.push (version); - - } catch (e:Dynamic) {} - - } - - } catch (e:Dynamic) {} - - return findMatch (haxelib, versions); - - } - - - public static function findMatch (haxelib:Haxelib, otherVersions:Array):Version { - - var matches = []; - - for (otherVersion in otherVersions) { - - if (haxelib.versionMatches (otherVersion)) { - - matches.push (otherVersion); - - } - - } - - if (matches.length == 0) return null; - - var bestMatch = null; - - for (match in matches) { - - if (bestMatch == null || match > bestMatch) { - - bestMatch = match; - - } - - } - - return bestMatch; - - } - - - public static function getRepositoryPath (clearCache:Bool = false):String { - - if (repositoryPath == null || clearCache) { - - var cache = LogHelper.verbose; - LogHelper.verbose = debug; - var output = ""; - - try { - - var cacheDryRun = ProcessHelper.dryRun; - ProcessHelper.dryRun = false; - output = HaxelibHelper.runProcess (workingDirectory, [ "config" ], true, true, true); - if (output == null) output = ""; - - ProcessHelper.dryRun = cacheDryRun; - - } catch (e:Dynamic) { } - - LogHelper.verbose = cache; - - repositoryPath = StringTools.trim (output); - - } - - return repositoryPath; - - } - - - public static function getPath (haxelib:Haxelib, validate:Bool = false, clearCache:Bool = false):String { - - var name = haxelib.name; - - if (pathOverrides.exists (name)) { - - if (!versions.exists (name)) { - - versions.set (name, getPathVersion (pathOverrides.get (name))); - - } - - return pathOverrides.get (name); - - } - - if (haxelib.version != null && haxelib.version != "") { - - name += ":" + haxelib.version; - - } - - if (pathOverrides.exists (name)) { - - if (!versions.exists (name)) { - - var version = getPathVersion (pathOverrides.get (name)); - versions.set (haxelib.name, version); - versions.set (name, version); - - } - - return pathOverrides.get (name); - - } - - if (clearCache) { - - paths.remove (name); - versions.remove (name); - - } - - if (!paths.exists (name)) { - - var cache = LogHelper.verbose; - LogHelper.verbose = debug; - var output = ""; - - try { - - var cacheDryRun = ProcessHelper.dryRun; - ProcessHelper.dryRun = false; - - output = HaxelibHelper.runProcess (workingDirectory, [ "path", name ], true, true, true); - if (output == null) output = ""; - - ProcessHelper.dryRun = cacheDryRun; - - } catch (e:Dynamic) { } - - LogHelper.verbose = cache; - - var lines = output.split ("\n"); - var result = ""; - - for (i in 1...lines.length) { - - var trim = StringTools.trim (lines[i]); - - if (trim == "-D " + haxelib.name || StringTools.startsWith (trim, "-D " + haxelib.name + "=")) { - - result = StringTools.trim (lines[i - 1]); - - } - - } - - if (result == "") { - - try { - - for (line in lines) { - - if (line != "" && line.substr (0, 1) != "-") { - - if (FileSystem.exists (line)) { - - result = line; - break; - - } - - } - - } - - } catch (e:Dynamic) {} - - } - - if (validate) { - - if (result == "") { - - if (output.indexOf ("does not have") > -1) { - - var directoryName = ""; - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - directoryName = "Windows"; - - } else if (PlatformHelper.hostPlatform == Platform.MAC) { - - directoryName = PlatformHelper.hostArchitecture == Architecture.X64 ? "Mac64" : "Mac"; - - } else { - - directoryName = PlatformHelper.hostArchitecture == Architecture.X64 ? "Linux64" : "Linux"; - - } - - LogHelper.error ("haxelib \"" + haxelib.name + "\" does not have an \"ndll/" + directoryName + "\" directory"); - - } else if (output.indexOf ("haxelib install ") > -1 && output.indexOf ("haxelib install " + haxelib.name) == -1) { - - var start = output.indexOf ("haxelib install ") + 16; - var end = output.lastIndexOf ("'"); - var dependencyName = output.substring (start, end); - - LogHelper.error ("Could not find haxelib \"" + dependencyName + "\" (dependency of \"" + haxelib.name + "\"), does it need to be installed?"); - - } else { - - if (haxelib.version != "") { - - LogHelper.error ("Could not find haxelib \"" + haxelib.name + "\" version \"" + haxelib.version + "\", does it need to be installed?"); - - } else { - - LogHelper.error ("Could not find haxelib \"" + haxelib.name + "\", does it need to be installed?"); - - } - - } - - } - - } - - /*var libraryPath = PathHelper.combine (getRepositoryPath (), haxelib.name); - var result = ""; - - if (FileSystem.exists (libraryPath)) { - - var devPath = PathHelper.combine (libraryPath, ".dev"); - var currentPath = PathHelper.combine (libraryPath, ".current"); - var matched = false, version; - - if (haxelib.version != "" && haxelib.version != null) { - - if (FileSystem.exists (devPath)) { - - result = StringTools.trim (File.getContent (devPath)); - - if (FileSystem.exists (result)) { - - version = getPathVersion (result); - - if (haxelib.version == "dev" || haxelib.versionMatches (version)) { - - matched = true; - - } - - } - - } - - if (!matched) { - - var match = findFolderMatch (haxelib, libraryPath); - - if (match != null) { - - result = PathHelper.combine (libraryPath, StringTools.replace (match, ".", ",")); - - } else { - - result = ""; - - } - - } - - } else { - - if (FileSystem.exists (devPath)) { - - result = StringTools.trim (File.getContent (devPath)); - - } else { - - result = StringTools.trim (File.getContent (currentPath)); - result = PathHelper.combine (libraryPath, StringTools.replace (result, ".", ",")); - - } - - } - - if (result == null) result == ""; - if (result != "" && !FileSystem.exists (result)) result = ""; - - } - - if (validate && result == "") { - - if (haxelib.version != "") { - - LogHelper.error ("Could not find haxelib \"" + haxelib.name + "\" version \"" + haxelib.version + "\", does it need to be installed?"); - - } else { - - LogHelper.error ("Could not find haxelib \"" + haxelib.name + "\", does it need to be installed?"); - - } - - }*/ - - var standardizedPath = PathHelper.standardize (result, false); - var pathSplit = standardizedPath.split ("/"); - var hasHaxelibJSON = false; - - while (!hasHaxelibJSON && pathSplit.length > 0) { - - var path = pathSplit.join ("/"); - var jsonPath = PathHelper.combine (path, "haxelib.json"); - - if (FileSystem.exists (jsonPath)) { - - paths.set (name, path); - - if (haxelib.version != "" && haxelib.version != null) { - - paths.set (haxelib.name, path); - var version = getPathVersion (path); - - versions.set (name, version); - versions.set (haxelib.name, version); - - } else { - - versions.set (name, getPathVersion (path)); - - } - - hasHaxelibJSON = true; - - } else { - - pathSplit.pop (); - - } - - } - - if (!hasHaxelibJSON) { - - paths.set (name, result); - - } - - } - - return paths.get (name); - - } - - - public static function getPathVersion (path:String):Version { - - path = PathHelper.combine (path, "haxelib.json"); - - if (FileSystem.exists (path)) { - - try { - - var json = Json.parse (File.getContent (path)); - var versionString:String = json.version; - var version:Version = versionString; - return version; - - } catch (e:Dynamic) {} - - } - - return null; - - } - - - public static function getVersion (haxelib:Haxelib = null):Version { - - var clearCache = false; - - if (haxelib == null) { - - haxelib = new Haxelib ("lime"); - clearCache = true; - - } - - getPath (haxelib, true, clearCache); - - //if (haxelib.version != "") { - - //return haxelib.version; - - //} - - return versions.get (haxelib.name); - - } - - - public static function runCommand (path:String, args:Array, safeExecute:Bool = true, ignoreErrors:Bool = false, print:Bool = false):Int { - - if (pathOverrides.exists ("haxelib")) { - - var script = PathHelper.combine (pathOverrides.get ("haxelib"), "run.n"); - - if (!FileSystem.exists (script)) { - - LogHelper.error ("Cannot find haxelib script: " + script); - - } - - return ProcessHelper.runCommand (path, "neko", [ script ].concat (args), safeExecute, ignoreErrors, print); - - } else { - - // var haxe = Sys.getEnv ("HAXEPATH"); - var command = "haxelib"; - - // if (haxe != null) { - - // command = PathHelper.combine (haxe, command); - - // } - - return ProcessHelper.runCommand (path, command, args, safeExecute, ignoreErrors, print); - - } - - } - - - public static function runProcess (path:String, args:Array, waitForOutput:Bool = true, safeExecute:Bool = true, ignoreErrors:Bool = false, print:Bool = false, returnErrorValue:Bool = false):String { - - if (pathOverrides.exists ("haxelib")) { - - var script = PathHelper.combine (pathOverrides.get ("haxelib"), "run.n"); - - if (!FileSystem.exists (script)) { - - LogHelper.error ("Cannot find haxelib script: " + script); - - } - - return ProcessHelper.runProcess (path, "neko", [ script ].concat (args), waitForOutput, safeExecute, ignoreErrors, print, returnErrorValue); - - } else { - - // var haxe = Sys.getEnv ("HAXEPATH"); - var command = "haxelib"; - - // if (haxe != null) { - - // command = PathHelper.combine (haxe, command); - - // } - - return ProcessHelper.runProcess (path, command, args, waitForOutput, safeExecute, ignoreErrors, print, returnErrorValue); - - } - - } - - - public static function setOverridePath (haxelib:Haxelib, path:String):Void { - - var name = haxelib.name; - var version = getPathVersion (path); - - pathOverrides.set (name, path); - pathOverrides.set (name + ":" + version, path); - - versions.set (name, version); - versions.set (name + ":" + version, version); - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/IOSHelper.hx b/lime/tools/helpers/IOSHelper.hx deleted file mode 100644 index a8b0929be..000000000 --- a/lime/tools/helpers/IOSHelper.hx +++ /dev/null @@ -1,513 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Path; -import lime.project.Platform; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.ProcessHelper; -import lime.project.Haxelib; -import lime.project.HXProject; -import sys.io.Process; -import sys.FileSystem; - - -class IOSHelper { - - - private static var initialized = false; - - - public static function build (project:HXProject, workingDirectory:String, additionalArguments:Array = null):Void { - - initialize (project); - - var commands = getXCodeArgs(project); - - if (project.targetFlags.exists("archive")) { - - var configuration = project.environment.get ("CONFIGURATION"); - var platformName = project.environment.get ("PLATFORM_NAME"); - - commands.push ("archive"); - commands.push ("-scheme"); - commands.push (project.app.file); - commands.push ("-archivePath"); - commands.push (PathHelper.combine ("build", PathHelper.combine (configuration + "-" + platformName, project.app.file))); - - } else { - - commands.push ("build"); - - } - - if (additionalArguments != null) { - - commands = commands.concat (additionalArguments); - - } - - ProcessHelper.runCommand (workingDirectory, "xcodebuild", commands); - - } - - - public static function deploy (project:HXProject, workingDirectory:String):Void { - - initialize (project); - - var commands = getXCodeArgs (project); - var archiveCommands = commands.concat ([]); - - // generate xcarchive - var configuration = project.environment.get ("CONFIGURATION"); - var platformName = project.environment.get ("PLATFORM_NAME"); - - archiveCommands.push ("archive"); - archiveCommands.push ("-scheme"); - archiveCommands.push (project.app.file); - archiveCommands.push ("-archivePath"); - archiveCommands.push (PathHelper.combine ("build", PathHelper.combine (configuration + "-" + platformName, project.app.file))); - - ProcessHelper.runCommand (workingDirectory, "xcodebuild", archiveCommands); - - var supportedExportMethods = [ "adhoc", "development", "enterprise", "appstore" ]; - var exportMethods = []; - for (m in supportedExportMethods) { - if (project.targetFlags.exists(m)) { - exportMethods.push(m); - } - } - - if (exportMethods.length == 0) { - exportMethods.push("appstore"); - } - - for (exportMethod in exportMethods) { - // generate IPA from xcarchive - var exportCommands = commands.concat ([]); - - exportCommands.push ("-exportArchive"); - exportCommands.push ("-archivePath"); - exportCommands.push (PathHelper.combine ("build", PathHelper.combine (configuration + "-" + platformName, project.app.file + ".xcarchive"))); - exportCommands.push ("-exportOptionsPlist"); - exportCommands.push (PathHelper.combine (project.app.file, "exportOptions-" + exportMethod + ".plist")); - exportCommands.push ("-exportPath"); - exportCommands.push (PathHelper.combine ("dist", exportMethod)); - - ProcessHelper.runCommand (workingDirectory, "xcodebuild", exportCommands); - } - - } - - - private static function getXCodeArgs(project:HXProject):Array { - - var platformName = "iphoneos"; - var iphoneVersion = project.environment.get ("IPHONE_VER"); - - if (project.targetFlags.exists ("simulator")) { - - platformName = "iphonesimulator"; - - } - - var configuration = "Release"; - - if (project.debug) { - - configuration = "Debug"; - - } - - project.setenv ("PLATFORM_NAME", platformName); - project.setenv ("CONFIGURATION", configuration); - - // setting CONFIGURATION and PLATFORM_NAME in project.environment doesn't set them for xcodebuild so also pass via command line - var commands = [ "-configuration", configuration, "PLATFORM_NAME=" + platformName, "SDKROOT=" + platformName + iphoneVersion ]; - - if (project.targetFlags.exists ("simulator")) { - - if (project.targetFlags.exists ("i386") || project.targetFlags.exists ("32")) { - - commands.push ("-arch"); - commands.push ("i386"); - - } else { - - commands.push ("-arch"); - commands.push ("x86_64"); - - } - - } else if (project.targetFlags.exists ("armv7")) { - - commands.push ("-arch"); - commands.push ("armv7"); - - } else if (project.targetFlags.exists ("armv7s")) { - - commands.push ("-arch"); - commands.push ("armv7s"); - - } else if (project.targetFlags.exists ("arm64")) { - - commands.push ("-arch"); - commands.push ("arm64"); - - } - - commands.push ("-project"); - commands.push (project.app.file + ".xcodeproj"); - - var xcodeVersions = getXcodeVersion() - .split(".") - .map(function (i:String) { - var ver = Std.parseInt(i); - return ver != null ? ver : 0; - }); - - if (xcodeVersions[0] >= 9) { - if (project.config.getBool('ios.allow-provisioning-updates', true)) { - commands.push("-allowProvisioningUpdates"); - } - if (project.config.getBool('ios.allow-provisioning-device-registration', true)) { - commands.push("-allowProvisioningDeviceRegistration"); - } - } - - return commands; - - } - - - public static function getSDKDirectory (project:HXProject):String { - - initialize (project); - - var platformName = "iPhoneOS"; - - if (project.targetFlags.exists ("simulator")) { - - platformName = "iPhoneSimulator"; - - } - - var process = new Process ("xcode-select", [ "--print-path" ]); - var directory = process.stdout.readLine (); - process.close (); - - if (directory == "" || directory.indexOf ("Run xcode-select") > -1) { - - directory = "/Applications/Xcode.app/Contents/Developer"; - - } - - directory += "/Platforms/" + platformName + ".platform/Developer/SDKs/" + platformName + project.environment.get ("IPHONE_VER") + ".sdk"; - return directory; - - } - - - public static function getIOSVersion (project:HXProject):Void { - - if (!project.environment.exists ("IPHONE_VER") || project.environment.get ("IPHONE_VER") == "4.2") { - - if (!project.environment.exists ("DEVELOPER_DIR") && PlatformHelper.hostPlatform == MAC) { - - var process = new Process ("xcode-select", [ "--print-path" ]); - var developerDir = process.stdout.readLine (); - process.close (); - - project.environment.set ("DEVELOPER_DIR", developerDir); - - } - - var devPath = project.environment.get ("DEVELOPER_DIR") + "/Platforms/iPhoneOS.platform/Developer/SDKs"; - - if (FileSystem.exists (devPath)) { - - var files = FileSystem.readDirectory (devPath); - var extractVersion = ~/^iPhoneOS(.*).sdk$/; - var best = "0", version; - - for (file in files) { - - if (extractVersion.match (file)) { - - version = extractVersion.matched (1); - - if (Std.parseFloat (version) > Std.parseFloat (best)) { - - best = version; - - } - - } - - } - - if (best != "") { - - project.environment.set ("IPHONE_VER", best); - - } - - } - - } - - } - - - private static function getOSXVersion ():String { - - var output = ProcessHelper.runProcess ("", "sw_vers", [ "-productVersion" ]); - - return StringTools.trim (output); - - } - - - public static function getProvisioningFile (project:HXProject = null):String { - - if (project != null && project.config.exists ("ios.provisioning-profile")) { - - return PathHelper.tryFullPath (project.config.getString ("ios.provisioning-profile")); - - } else if (PlatformHelper.hostPlatform == Platform.MAC) { - - var path = PathHelper.expand ("~/Library/MobileDevice/Provisioning Profiles"); - var files = FileSystem.readDirectory (path); - - for (file in files) { - - if (Path.extension (file) == "mobileprovision") { - - return path + "/" + file; - - } - - } - - } - - return ""; - - } - - - private static function getXcodeVersion ():String { - - var output = ProcessHelper.runProcess ("", "xcodebuild", [ "-version" ]); - var firstLine = output.split ("\n").shift (); - - return StringTools.trim (firstLine.substring ("Xcode".length, firstLine.length)); - - } - - - private static function initialize (project:HXProject):Void { - - if (!initialized) { - - getIOSVersion (project); - - initialized = true; - - } - - } - - - public static function launch (project:HXProject, workingDirectory:String):Void { - - initialize (project); - - var configuration = "Release"; - - if (project.debug) { - - configuration = "Debug"; - - } - - if (project.targetFlags.exists ("simulator")) { - - var applicationPath = ""; - - if (Path.extension (workingDirectory) == "app" || Path.extension (workingDirectory) == "ipa") { - - applicationPath = workingDirectory; - - } else { - - applicationPath = workingDirectory + "/build/" + configuration + "-iphonesimulator/" + project.app.file + ".app"; - - } - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - - var output = ProcessHelper.runProcess ("", "xcrun", [ "simctl", "list", "devices" ]); - var lines = output.split ("\n"); - var foundSection = false; - - var device, deviceID; - var devices = new Map (); - - var currentDeviceID = null; - - for (line in lines) { - - if (StringTools.startsWith (line, "--")) { - - if (line.indexOf ("iOS") > -1) { - - foundSection = true; - - } else if (foundSection) { - - break; - - } - - } else if (foundSection) { - - device = StringTools.trim (line); - device = device.substring (0, device.indexOf ("(") - 1); - device = device.toLowerCase (); - device = StringTools.replace (device, " ", "-"); - - deviceID = line.substring (line.indexOf ("(") + 1, line.indexOf (")")); - - if (deviceID.indexOf ("inch") > -1) { - - var startIndex = line.indexOf (")") + 2; - deviceID = line.substring (line.indexOf ("(", startIndex) + 1, line.indexOf (")", startIndex)); - - } - - devices.set (device, deviceID); - - if (project.targetFlags.exists (device)) { - - currentDeviceID = deviceID; - break; - - } - - } - - } - - if (currentDeviceID == null) { - - if (project.targetFlags.exists ("ipad")) { - - currentDeviceID = devices.get ("ipad-air"); - - } else { - - currentDeviceID = devices.get ("iphone-6"); - - } - - } - - try { - - ProcessHelper.runProcess ("", "open", [ "-Ra", "iOS Simulator" ], true, false); - ProcessHelper.runCommand ("", "open", [ "-a", "iOS Simulator", "--args", "-CurrentDeviceUDID", currentDeviceID ]); - - } catch (e:Dynamic) { - - ProcessHelper.runCommand ("", "open", [ "-a", "Simulator", "--args", "-CurrentDeviceUDID", currentDeviceID ]); - - } - - waitForDeviceState ("xcrun", [ "simctl", "uninstall", currentDeviceID, project.meta.packageName ]); - waitForDeviceState ("xcrun", [ "simctl", "install", currentDeviceID, applicationPath ]); - waitForDeviceState ("xcrun", [ "simctl", "launch", currentDeviceID, project.meta.packageName ]); - - ProcessHelper.runCommand ("", "tail", [ "-F", "~/Library/Logs/CoreSimulator/" + currentDeviceID + "/system.log"]); - - } else { - - var applicationPath = ""; - - if (Path.extension (workingDirectory) == "app" || Path.extension (workingDirectory) == "ipa") { - - applicationPath = workingDirectory; - - } else { - - applicationPath = workingDirectory + "/build/" + configuration + "-iphoneos/" + project.app.file + ".app"; - - } - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - var launcher = PathHelper.findTemplate (templatePaths, "bin/ios-deploy"); - Sys.command ("chmod", [ "+x", launcher ]); - - var xcodeVersion = getXcodeVersion (); - - ProcessHelper.runCommand ("", launcher, [ "install", "--noninteractive", "--debug", "--bundle", FileSystem.fullPath (applicationPath) ]); - - } - - } - - - public static function sign (project:HXProject, workingDirectory:String):Void { - - initialize (project); - - var configuration = "Release"; - - if (project.debug) { - - configuration = "Debug"; - - } - - var identity = project.config.getString ("ios.identity", "iPhone Developer"); - - var commands = [ "-s", identity, "CODE_SIGN_IDENTITY=" + identity ]; - - if (project.config.exists ("ios.provisioning-profile")) { - - commands.push ("PROVISIONING_PROFILE=" + project.config.getString ("ios.provisioning-profile")); - - } - - var applicationPath = "build/" + configuration + "-iphoneos/" + project.app.file + ".app"; - commands.push (applicationPath); - - ProcessHelper.runCommand (workingDirectory, "codesign", commands, true, true); - - } - - - private static function waitForDeviceState (command:String, args:Array):Void { - - var output; - - while (true) { - - output = ProcessHelper.runProcess ("", command, args, true, true, true); - - if (output != null && output.toLowerCase ().indexOf ("invalid device state") > -1) { - - Sys.sleep (3); - - } else { - - break; - - } - - } - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/IconHelper.hx b/lime/tools/helpers/IconHelper.hx deleted file mode 100644 index 80364a24f..000000000 --- a/lime/tools/helpers/IconHelper.hx +++ /dev/null @@ -1,450 +0,0 @@ -package lime.tools.helpers; - - -//import openfl.display.Bitmap; -//import openfl.display.BitmapData; -//import openfl.display.Shape; -//import openfl.geom.Rectangle; -//import openfl.utils.ByteArray; -//import format.SVG; -import haxe.io.Bytes; -import haxe.io.BytesOutput; -import haxe.io.Path; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.ImageHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.PathHelper; -import lime.graphics.format.BMP; -import lime.graphics.Image; -import lime.math.Rectangle; -import lime.project.Icon; -import sys.io.File; -import sys.FileSystem; - - -class IconHelper { - - - private static function canUseCache (targetPath:String, icons:Array):Bool { - - if (FileSystem.exists (targetPath)) { - - var cacheTime = FileHelper.getLastModified (targetPath); - - for (icon in icons) { - - if (FileHelper.getLastModified (icon.path) > cacheTime) { - - return false; - - } - - } - - return true; - - } - - return false; - - } - - - public static function createIcon (icons:Array, width:Int, height:Int, targetPath:String):Bool { - - var icon = findMatch (icons, width, height); - - if (icon != null && icon.size > 0 && Path.extension (icon.path) == "png") { - - if (canUseCache (targetPath, [ icon ])) { - - return true; - - } - - PathHelper.mkdir (Path.directory (targetPath)); - FileHelper.copyFile (icon.path, targetPath); - return true; - - } else { - - if (canUseCache (targetPath, icons)) { - - return true; - - } - - var image = getIconImage (icons, width, height); - - if (image != null) { - - var bytes = image.encode ("png"); - - if (bytes != null) { - - PathHelper.mkdir (Path.directory (targetPath)); - File.saveBytes (targetPath, bytes); - return true; - - } - - } - - } - - return false; - - } - - - public static function createMacIcon (icons:Array, targetPath:String):Bool { - - if (canUseCache (targetPath, icons)) { - - return true; - - } - - var out = new BytesOutput (); - out.bigEndian = true; - - // Not sure why the 128x128 icon is not saving properly. Disabling for now - - for (i in 0...3) { - - var s = ([ 16, 32, 48, 128 ])[i]; - var code = ([ "is32", "il32", "ih32", "it32" ])[i]; - var image = getIconImage (icons, s, s); - - if (image != null) { - - for (c in 0...4) out.writeByte (code.charCodeAt(c)); - - var n = s * s; - var pixels = image.getPixels (new Rectangle (0, 0, s, s), ARGB32); - - var bytes_r = packBits (pixels, 1, s * s); - var bytes_g = packBits (pixels, 2, s * s); - var bytes_b = packBits (pixels, 3, s * s); - - out.writeInt32 (bytes_r.length + bytes_g.length + bytes_b.length + 8); - out.writeBytes (bytes_r, 0, bytes_r.length); - out.writeBytes (bytes_g, 0, bytes_g.length); - out.writeBytes (bytes_b, 0, bytes_b.length); - - var code = ([ "s8mk", "l8mk", "h8mk", "t8mk" ])[i]; - - for (c in 0...4) out.writeByte (code.charCodeAt (c)); - - var bytes_a = extractBits (pixels, 0, s * s); - out.writeInt32 (bytes_a.length + 8); - out.writeBytes (bytes_a, 0, bytes_a.length); - - } - - } - - for (i in 0...5) { - - var s = ([ 32, 64, 256, 512, 1024 ])[i]; - var code = ([ "ic11", "ic12", "ic08", "ic09", "ic10" ])[i]; - var image = getIconImage (icons, s, s); - - if (image != null) { - - var bytes = image.encode ("png"); - - if (bytes != null) { - - for (c in 0...4) out.writeByte (code.charCodeAt(c)); - - out.writeInt32 (bytes.length + 8); - out.writeBytes (bytes, 0, bytes.length); - - } - - } - - } - - var bytes = out.getBytes (); - - if (bytes.length > 0) { - - var file = File.write (targetPath, true); - file.bigEndian = true; - - for (c in 0...4) file.writeByte ("icns".charCodeAt (c)); - - file.writeInt32 (bytes.length + 8); - file.writeBytes (bytes, 0, bytes.length); - file.close (); - - return true; - - } - - return false; - - } - - - public static function createWindowsIcon (icons:Array, targetPath:String):Bool { - - if (canUseCache (targetPath, icons)) { - - return true; - - } - - var sizes = [ 16, 24, 32, 40, 48, 64, 96, 128, 256, 512, 768 ]; - - var images = new Array (); - var imageData = new Array (); - - for (size in sizes) { - - var image = getIconImage (icons, size, size); - - if (image != null) { - - var data = null; - - if (size < 256) { - - data = BMP.encode (image, ICO); - - } else { - - data = image.encode ("png"); - - } - - if (data != null) { - - imageData.push (data); - images.push (image); - - } - - } - - } - - var length = 6 + (16 * images.length); - - for (data in imageData) { - - length += data.length; - - } - - var icon = Bytes.alloc (length); - var position = 0; - icon.setUInt16 (position, 0); position += 2; - icon.setUInt16 (position, 1); position += 2; - icon.setUInt16 (position, images.length); position += 2; - - var dataOffset = 6 + (16 * images.length); - - for (i in 0...images.length) { - - var size = images[i].width; - - icon.set (position++, size > 255 ? 0 : size); - icon.set (position++, size > 255 ? 0 : size); - icon.set (position++, 0); - icon.set (position++, 0); - icon.setUInt16 (position, 1); position += 2; - icon.setUInt16 (position, 32); position += 2; - icon.setInt32 (position, imageData[i].length); position += 4; - icon.setInt32 (position, dataOffset); position += 4; - - dataOffset += imageData[i].length; - - } - - for (data in imageData) { - - icon.blit (position, data, 0, data.length); - position += data.length; - - } - - if (images.length > 0) { - - File.saveBytes (targetPath, icon); - return true; - - } - - return false; - - } - - - private static function extractBits (data:Bytes, offset:Int, len:Int):Bytes { - - var out = new BytesOutput (); - - for (i in 0...len) { - - out.writeByte (data.get (i * 4 + offset)); - - } - - return out.getBytes (); - - } - - - public static function findMatch (icons:Array, width:Int, height:Int):Icon { - - var match = null; - - for (icon in icons) { - - if ((icon.width == 0 && icon.height == 0) || (icon.width == width && icon.height == height)) { - - match = icon; - - } - - } - - return match; - - } - - - public static function findNearestMatch (icons:Array, width:Int, height:Int):Icon { - - var match = null; - - for (icon in icons) { - - if (icon.width > width / 2 && icon.height > height / 2) { - - if (match == null) { - - match = icon; - - } else { - - if (icon.width > match.width && icon.height > match.height) { - - if (match.width < width || match.height < height) { - - match = icon; - - } - - } else { - - if (icon.width > width && icon.height > height) { - - match = icon; - - } - - } - - } - - } - - } - - return match; - - } - - - private static function getIconImage (icons:Array, width:Int, height:Int, backgroundColor:Int = null):Image { - - var icon = findMatch (icons, width, height); - - if (icon == null) { - - icon = findNearestMatch (icons, width, height); - - } - - if (icon == null) { - - return null; - - } - - if (icon.path == null || !FileSystem.exists (icon.path)) { - - LogHelper.warn ("Could not find icon path: " + icon.path); - return null; - - } - - var extension = Path.extension (icon.path); - var image = null; - - switch (extension) { - - case "png", "jpg", "jpeg": - - image = ImageHelper.resizeImage (Image.fromFile (icon.path), width, height); - - case "svg": - - //image = ImageHelper.rasterizeSVG (null /*new SVG (File.getContent (icon.path))*/, width, height, backgroundColor); - image = ImageHelper.rasterizeSVG (icon.path, width, height, backgroundColor); - - } - - return image; - - } - - - private static function packBits (data:Bytes, offset:Int, len:Int):Bytes { - - var out = new BytesOutput (); - var idx = 0; - - while (idx < len) { - - var val = data.get (idx * 4 + offset); - var same = 1; - - /* - Hmmmm... - while( ((idx+same) < len) && (data[ (idx+same)*4 + offset ]==val) && (same < 2) ) - same++; - */ - - if (same == 1) { - - var raw = idx + 120 < len ? 120 : len - idx; - out.writeByte (raw - 1); - - for (i in 0...raw) { - - out.writeByte (data.get (idx * 4 + offset)); - idx++; - - } - - } else { - - out.writeByte (257 - same); - out.writeByte (val); - idx += same; - - } - - } - - return out.getBytes (); - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/ImageHelper.hx b/lime/tools/helpers/ImageHelper.hx deleted file mode 100644 index 3cd6ea9fa..000000000 --- a/lime/tools/helpers/ImageHelper.hx +++ /dev/null @@ -1,144 +0,0 @@ -package lime.tools.helpers; - - -import lime.graphics.Image; -import lime.graphics.ImageBuffer; -import lime.utils.UInt8Array; -import lime.project.Haxelib; -import lime.project.Platform; -import sys.io.File; -import sys.FileSystem; - - -class ImageHelper { - - - public static function rasterizeSVG (path:String, width:Int, height:Int, backgroundColor:Int = null):Image { - //public static function rasterizeSVG (svg:Dynamic /*SVG*/, width:Int, height:Int, backgroundColor:Int = null):Image { - - if (path == null) return null; - - var temp = PathHelper.getTemporaryFile (".png"); - - try { - - ProcessHelper.runCommand ("", "neko", [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "svg.n"), "process", path, Std.string (width), Std.string (height), temp ], true, true); - - if (FileSystem.exists (temp)) { - - var image = Image.fromFile (temp); - - try { - - FileSystem.deleteFile (temp); - - } catch (e:Dynamic) {} - - if (image.buffer != null) { - - return image; - - } - - } - - } catch (e:Dynamic) {} - - var rasterizer = PathHelper.getHaxelib (new Haxelib ("lime")) + "/templates/bin/batik/batik-rasterizer.jar"; - var args = [ "-Dapple.awt.UIElement=true", "-jar", rasterizer, "-d", temp, "-w", Std.string (width), "-h", Std.string (height) ]; - - if (backgroundColor != null) { - - var a:Int = (( backgroundColor >> 24) & 0xFF); - var r:Int = (( backgroundColor >> 16) & 0xFF); - var g:Int = (( backgroundColor >> 8) & 0xFF); - var b:Int = (backgroundColor & 0xFF); - - args.push ("-bg"); - args.push (a + "." + r + "." + g + "." + b); - - } - - args.push (path); - - if (PlatformHelper.hostPlatform == Platform.MAC) { - - try { - - var found = false; - - if (FileSystem.exists ("/System/Library/Java/JavaVirtualMachines")) { - - found = (FileSystem.readDirectory ("/System/Library/Java/JavaVirtualMachines").length > 0); - - } - - if (!found && FileSystem.exists ("/Library/Java/JavaVirtualMachines")) { - - found = (FileSystem.readDirectory ("/Library/Java/JavaVirtualMachines").length > 0); - - } - - if (!found) { - - if (LogHelper.verbose) LogHelper.warn ("Skipping SVG to PNG rasterization step, no Java runtime detected"); - - return null; - - } - - } catch (e:Dynamic) {} - - } - - if (LogHelper.verbose) { - - ProcessHelper.runCommand ("", "java", args, true, true); - - } else { - - ProcessHelper.runProcess ("", "java", args, true, true, true); - - } - - if (FileSystem.exists (temp)) { - - var image = Image.fromFile (temp); - - try { - - FileSystem.deleteFile (temp); - - } catch (e:Dynamic) {} - - if (image.buffer != null) { - - return image; - - } - - } - - return null; - - } - - - public static function resizeImage (image:Image, width:Int, height:Int):Image { - - if (image == null) return null; - - if (image.width == width && image.height == height) { - - return image; - - } - - image.resize (width, height); - - return image; - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/JavaHelper.hx b/lime/tools/helpers/JavaHelper.hx deleted file mode 100644 index a1e15a70a..000000000 --- a/lime/tools/helpers/JavaHelper.hx +++ /dev/null @@ -1,17 +0,0 @@ -package lime.tools.helpers; - - -import sys.io.File; - - -class JavaHelper { - - - public static function copyLibraries (templatePaths:Array, platformName:String, targetPath:String) { - - FileHelper.recursiveCopyTemplate (templatePaths, "java/ndll/" + platformName, targetPath); - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/LogHelper.hx b/lime/tools/helpers/LogHelper.hx deleted file mode 100644 index 70b00d468..000000000 --- a/lime/tools/helpers/LogHelper.hx +++ /dev/null @@ -1,221 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Bytes; -import lime.tools.helpers.PlatformHelper; -import lime.project.Platform; -import lime.system.CFFI; -import sys.io.Process; - -#if neko -import neko.Lib; -#elseif cpp -import cpp.Lib; -#elseif cs -import cs.Lib; -#end - - -class LogHelper { - - - public static var accentColor = "\x1b[32;1m"; - public static var enableColor = true; - public static var mute = false; - public static var resetColor = "\x1b[0m"; - public static var verbose = false; - - private static var colorCodes:EReg = ~/\x1b\[[^m]+m/g; - private static var colorSupported:Null; - private static var sentWarnings:Map = new Map (); - - - public static function error (message:String, verboseMessage:String = "", e:Dynamic = null):Void { - - if (message != "" && !mute) { - - var output; - - if (verbose && verboseMessage != "") { - - output = "\x1b[31;1mError:\x1b[0m\x1b[1m " + verboseMessage + "\x1b[0m\n"; - - } else { - - output = "\x1b[31;1mError:\x1b[0m \x1b[1m" + message + "\x1b[0m\n"; - - } - - Sys.stderr ().write (Bytes.ofString (stripColor (output))); - - } - - if (verbose && e != null) { - - #if js - throw e; - #elseif !cs - Lib.rethrow (e); - #end - - } - - Sys.exit (1); - - } - - - public static function info (message:String, verboseMessage:String = ""):Void { - - if (!mute) { - - if (verbose && verboseMessage != "") { - - println (verboseMessage); - - } else if (message != "") { - - println (message); - - } - - } - - } - - - public static function print (message:String):Void { - - Sys.print (stripColor (message)); - - } - - - public static function println (message:String):Void { - - Sys.println (stripColor (message)); - - } - - - private static function stripColor (output:String):String { - - if (colorSupported == null) { - - if (PlatformHelper.hostPlatform != Platform.WINDOWS) { - - var result = -1; - - try { - - var process = new Process ("tput", [ "colors" ]); - result = process.exitCode (); - process.close (); - - } catch (e:Dynamic) {}; - - colorSupported = (result == 0); - - } else { - - colorSupported = false; - - if (Sys.getEnv ("TERM") == "xterm" || Sys.getEnv ("ANSICON") != null) { - - colorSupported = true; - - } else if (CFFI.enabled) { - - var getConsoleMode = CFFI.load ("lime", "lime_system_get_windows_console_mode", 1); - var setConsoleMode = CFFI.load ("lime", "lime_system_set_windows_console_mode", 2); - - var STD_INPUT_HANDLE = -10; - var STD_OUTPUT_HANDLE = -11; - var STD_ERROR_HANDLE = -12; - - var ENABLE_VIRTUAL_TERMINAL_INPUT = 0x0200; - var ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004; - var DISABLE_NEWLINE_AUTO_RETURN = 0x0008; - - var outputMode = getConsoleMode (STD_OUTPUT_HANDLE); - var errorMode = getConsoleMode (STD_ERROR_HANDLE); - - if (outputMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING != 0) { - - colorSupported = true; - - } else { - - outputMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING | DISABLE_NEWLINE_AUTO_RETURN; - colorSupported = setConsoleMode (STD_OUTPUT_HANDLE, outputMode); - - } - - if (colorSupported) { - - if (errorMode & ENABLE_VIRTUAL_TERMINAL_PROCESSING == 0) { - - errorMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING | DISABLE_NEWLINE_AUTO_RETURN; - colorSupported = setConsoleMode (STD_ERROR_HANDLE, errorMode); - - } - - if (colorSupported) { - - // Fake presence of ANSICON, so subsequent tools know they can use ANSI codes - Sys.putEnv ("ANSICON", "1"); - - } - - } - - } - - } - - } - - if (enableColor && colorSupported) { - - return output; - - } else { - - return colorCodes.replace (output, ""); - - } - - } - - - public static function warn (message:String, verboseMessage:String = "", allowRepeat:Bool = false):Void { - - if (!mute) { - - var output = ""; - - if (verbose && verboseMessage != "") { - - output = "\x1b[33;1mWarning:\x1b[0m \x1b[1m" + verboseMessage + "\x1b[0m"; - - } else if (message != "") { - - output = "\x1b[33;1mWarning:\x1b[0m \x1b[1m" + message + "\x1b[0m"; - - } - - if (!allowRepeat && sentWarnings.exists (output)) { - - return; - - } - - sentWarnings.set (output, true); - println (output); - - } - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/ModuleHelper.hx b/lime/tools/helpers/ModuleHelper.hx deleted file mode 100644 index 077ca1180..000000000 --- a/lime/tools/helpers/ModuleHelper.hx +++ /dev/null @@ -1,725 +0,0 @@ -package lime.tools.helpers; #if !macro - - -import haxe.io.Path; -import lime.project.Dependency; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.ModuleData; -import sys.io.File; -import sys.FileSystem; - - -class ModuleHelper { - - - public static function addModuleSource (source:String, moduleData:ModuleData, include:Array, exclude:Array, packageName:String = null) { - - if (!FileSystem.exists (source)) { - - LogHelper.error ("Could not find module source \"" + source + "\""); - return; - - } - - moduleData.haxeflags.push ("-cp " + source); - - var path = source; - - if (packageName != null && packageName.length > 0) { - - path = PathHelper.combine (source, StringTools.replace (packageName, ".", "/")); - - } - - parseModuleSource (source, moduleData, include, exclude, path); - - } - - - public static function buildModules (project:HXProject, tempDirectory:String, outputDirectory:String):Void { - - tempDirectory = PathHelper.combine (tempDirectory, "lib"); - outputDirectory = PathHelper.combine (outputDirectory, "lib"); - - PathHelper.mkdir (tempDirectory); - PathHelper.mkdir (outputDirectory); - - var importName, hxmlPath, importPath, outputPath, moduleImport, hxml; - - for (module in project.modules) { - - if (module.classNames.length > 0) { - - importName = "Module" + module.name.charAt (0).toUpperCase () + module.name.substr (1); - - hxmlPath = PathHelper.combine (tempDirectory, module.name + ".hxml"); - importPath = PathHelper.combine (tempDirectory, importName + ".hx"); - - if (project.targetFlags.exists ("final")) { - - outputPath = PathHelper.combine (outputDirectory, module.name + ".min.js"); - - } else { - - outputPath = PathHelper.combine (outputDirectory, module.name + ".js"); - - } - - moduleImport = "package;\n\nimport " + module.classNames.join (";\nimport ") + ";"; - - hxml = "-cp " + tempDirectory; - hxml += "\n" + module.haxeflags.join ("\n"); - - for (haxelib in project.haxelibs) { - - hxml += "\n-cp " + PathHelper.getHaxelib (haxelib); - - } - - for (key in project.haxedefs.keys ()) { - - if (key != "no-compilation") { - - var value = project.haxedefs.get (key); - - if (value == null || value == "") { - - hxml += "\n-D " + key; - - } else { - - hxml += "\n-D " + key + "=" + value; - - } - - } - - } - - hxml += "\n-D html5"; - hxml += "\n-D html"; - hxml += "\n--no-inline"; - hxml += "\n-dce no"; - hxml += "\n-js " + outputPath; - - var includeTypes = module.classNames.concat (module.includeTypes); - var excludeTypes = module.excludeTypes; - - for (otherModule in project.modules) { - - if (otherModule != module) { - - excludeTypes = excludeTypes.concat (ArrayHelper.getUnique (includeTypes, otherModule.classNames)); - excludeTypes = excludeTypes.concat (ArrayHelper.getUnique (includeTypes, otherModule.includeTypes)); - - } - - } - - if (excludeTypes.length > 0) { - - // order by short filters first, so they match earlier - haxe.ds.ArraySort.sort(excludeTypes, shortFirst); - hxml += "\n--macro lime.tools.helpers.ModuleHelper.exclude(['" + excludeTypes.join ("','") + "'])"; - - } - - // order by short filters first, so they match earlier - haxe.ds.ArraySort.sort(includeTypes, shortFirst); - hxml += "\n--macro lime.tools.helpers.ModuleHelper.expose(['" + includeTypes.join ("','") + "'])"; - //hxml += "\n--macro lime.tools.helpers.ModuleHelper.generate()"; - - hxml += "\n" + importName; - - File.saveContent (importPath, moduleImport); - File.saveContent (hxmlPath, hxml); - - ProcessHelper.runCommand ("", "haxe", [ hxmlPath ]); - - patchFile (outputPath); - - if (project.targetFlags.exists ("final")) { - - HTML5Helper.minify (project, outputPath); - - } - - } - - } - - } - - - private static function parseModuleSource (source:String, moduleData:ModuleData, include:Array, exclude:Array, currentPath:String):Void { - - var files = FileSystem.readDirectory (currentPath); - var filePath:String, className:String, packageName:String; - - for (file in files) { - - filePath = PathHelper.combine (currentPath, file); - - if (FileSystem.isDirectory (filePath)) { - - packageName = StringTools.replace (filePath, source, ""); - packageName = StringTools.replace (packageName, "\\", "/"); - - while (StringTools.startsWith (packageName, "/")) packageName = packageName.substr (1); - - packageName = StringTools.replace (packageName, "/", "."); - - if (StringHelper.filter (packageName, include, exclude)) { - - parseModuleSource (source, moduleData, include, exclude, filePath); - - } - - } else { - - if (Path.extension (file) != "hx") continue; - - className = StringTools.replace (filePath, source, ""); - className = StringTools.replace (className, "\\", "/"); - - while (StringTools.startsWith (className, "/")) className = className.substr (1); - - className = StringTools.replace (className, "/", "."); - className = StringTools.replace (className, ".hx", ""); - - if (StringHelper.filter (className, include, exclude)) { - - moduleData.classNames.push (className); - - } - - } - - } - - } - - - public static function patchFile (outputPath:String):Void { - - var replaceString = "var $hxClasses = {}"; - var replacement = "if (!$hx_exports.$hxClasses) $hx_exports.$hxClasses = {};\nvar $hxClasses = $hx_exports.$hxClasses"; - - FileHelper.replaceText (outputPath, replaceString, replacement); - - } - - - public static function updateProject (project:HXProject):Void { - - var excludeTypes = []; - var suffix = (project.targetFlags.exists ("final") ? ".min" : "") + ".js"; - var hasModules = false; - - for (module in project.modules) { - - project.dependencies.push (new Dependency ("./lib/" + module.name + suffix, null)); - - excludeTypes = ArrayHelper.concatUnique (excludeTypes, module.classNames); - excludeTypes = ArrayHelper.concatUnique (excludeTypes, module.excludeTypes); - excludeTypes = ArrayHelper.concatUnique (excludeTypes, module.includeTypes); - - hasModules = true; - - } - - if (excludeTypes.length > 0) { - - // order by short filters first, so they match earlier - haxe.ds.ArraySort.sort(excludeTypes, shortFirst); - project.haxeflags.push ("--macro lime.tools.helpers.ModuleHelper.exclude(['" + excludeTypes.join ("','") + "'])"); - - } - - //if (hasModules) { - // - //project.haxeflags.push ("--macro lime.tools.helpers.ModuleHelper.generate()"); - // - //} - - } - - - public static function shortFirst(a, b):Int { - if (a.length < b.length) return -1; - else if (a.length > b.length) return 1; - return 0; - } - - -} - - -#else - - -import haxe.macro.Compiler; -import haxe.macro.Context; -import haxe.macro.Type; -import haxe.macro.Expr; -import haxe.macro.JSGenApi; -using haxe.macro.Tools; - -using Lambda; -using StringTools; - - -class ModuleHelper { - - - public static function exclude (types:Array):Void { - - for (type in types) { - - Compiler.exclude (type); - Compiler.addMetadata ("@:native(\"$hx_exports." + type + "\")", type); - - } - - } - - - public static function expose (classNames:Array):Void { - - for (className in classNames) { - - Compiler.addMetadata ("@:expose('" + className + "')", className); - - } - - } - - - public static function generate() { - - //Compiler.setCustomJSGenerator(function(api) new Generator(api).generate()); - - } - - -} - - -class Generator { - - var api : JSGenApi; - var buf : StringBuf; - var inits : List; - var statics : List<{ c : ClassType, f : ClassField }>; - var packages : haxe.ds.StringMap; - var forbidden : haxe.ds.StringMap; - var jsModern:Bool; - var jsFlatten:Bool; - var dce:Bool; - var indentLevel=0; - var genExtend=false; - var genExpose=false; - - var iRE=~/^(.*)$/gm; - - public function new(api) { - this.api = api; - buf = new StringBuf(); - inits = new List(); - statics = new List(); - packages = new haxe.ds.StringMap(); - forbidden = new haxe.ds.StringMap(); - jsModern=!Context.defined("js-classic"); - jsFlatten=!Context.defined("js-unflatten"); - dce=Context.definedValue("dce")!="no"; - for( x in ["prototype", "__proto__", "constructor"] ) - forbidden.set(x, true); - api.setTypeAccessor(getType); - - for (t in api.types){ - switch (t) { - case TInst(c,_): - if (!c.get().isExtern && c.get().superClass!=null) - genExtend=true; - if (c.get().meta.has(":expose")) - genExpose=true; - if (genExtend && genExpose) break; - case _: - } - } - } - - function getType( t : Type ) { - return switch(t) { - case TInst(c, _): getPath(c.get()); - case TEnum(e, _): getPath(e.get()); - case TAbstract(a, _): getPath(a.get()); - default: throw "assert"; - }; - } - inline function indent(str:String,level=0,notFirst=false):String{ - var first=true; - var lines=str.split("\n"); - var nstr=""; - for (i in 0...lines.length){ - var s=lines[i]; - if (first && notFirst){ - first=false; - nstr+=s; - }else{ - for (i in 0...level){ - nstr+='\t'; - } - nstr+='$s'; - } - if (i ) { - if (p.length==0) - print("var "); - var full = null; - for( x in p ) { - var prev = full; - if( full == null ) full = x else full += "." + x; - if( packages.exists(full) ) - continue; - packages.set(full, true); - if( prev == null ) - println('var $x = '+(jsModern?"{}":'$x || {}') ); - else { - var p = prev + field(x); - println((jsModern?'':'if(!$p) ')+'$p = {}'); - } - } - } - - function getPath( t : BaseType ) { - return packClass(t.pack,t.name); - } - function getDotPath( t : BaseType ) { - return (t.pack.length == 0) ? t.name : t.pack.join('.') + '.' + t.name; - } - - function packClass(p:Array,name:String){ - if (jsFlatten){ - var r=''; - for (i in p){ - r+=i.replace("_","_$")+'_'; - } - return r+name.replace("_","_$"); - } - return (p.length == 0) ? name : p.join('.') + '.' + name; - } - - function checkFieldName( c : ClassType, f : ClassField ) { - if( forbidden.exists(f.name) ) - Context.error("The field " + f.name + " is not allowed in JS", c.pos); - } - - function genClassField( c : ClassType, p : String, f : ClassField , first:Bool) { - checkFieldName(c, f); - var field = field(f.name,false); - var e=f.expr(); - if (e!=null){ - printin((first?"":",")+'$field: '+api.generateValue(e) ,indentLevel,false); - return false; - }else if (!dce && (f.kind.match(FVar(AccNormal, AccNormal) | FMethod(_)) || f.meta.has(":isVar"))){ - printin((first?"":",")+'$field: null' ,indentLevel,false); - return false; - } - return first; - } - - - function genStaticField( c : ClassType, p : String, f : ClassField ) { - checkFieldName(c, f); - var field = field(f.name); - var e = f.expr(); - if( e != null ) { - switch( f.kind ) { - case FMethod(_): - print('$p$field = '); - println(api.generateValue(e)); - default: - statics.add( { c : c, f : f } ); - } - } else{ - if (!dce && (f.kind.match(FVar(AccNormal, AccNormal) | FMethod(_)) || f.meta.has(":isVar"))) - println('$p$field = null'); - } - } - - function getProperties(fields:Array):String{ - var properties=[]; - for (f in fields){ - switch (f.kind) { - case FVar(g,s):{ - if (g==AccCall) - properties.push('get_${f.name}:"get_${f.name}"'); - if (s==AccCall) - properties.push('set_${f.name}:"set_${f.name}"'); - } - case _: - } - } - return (properties.length>0)?('{'+properties.join(",")+'}'):""; - } - - - function genClass( c : ClassType ) { - api.setCurrentClass(c); - - var hxClasses=api.hasFeature("Type.resolveClass"); - var p = getPath(c); - var pn= getDotPath(c); - if (jsFlatten) - print("var "); - else - genPackage(c.pack); - - if (hxClasses && !jsModern) - print('$p = $$hxClasses["$pn"] = '); - else - print('$p = '+(c.meta.has(":expose")?'$$hx_exports.$p = ':'')); - if( c.constructor != null ) - print(api.generateValue(c.constructor.get().expr())); - else - print("function() { }"); - newline(); - if (hxClasses && jsModern) - println('$$hxClasses["$pn"] = $p'); - - var name = pn.split(".").map(api.quoteString).join(","); - if (api.hasFeature("js.Boot.isClass")){ - if (api.hasFeature("Type.getClassName")) - println('$p.__name__ = [$name]'); - else - println('$p.__name__ = true'); - } - if( c.interfaces.length > 0 ) { - var me = this; - var inter = c.interfaces.map(function(i) return me.getPath(i.t.get())).join(","); - print('$p.__interfaces__ = [$inter]'); - newline(); - } - var has_property_reflection =api.hasFeature("Reflect.getProperty") || api.hasFeature("Reflect.setProperty"); - - if (has_property_reflection){ - var staticProperties=getProperties(c.statics.get()); - if (staticProperties.length>0) - printn('$p.__properties__ = $staticProperties'); - } - for( f in c.statics.get() ) - genStaticField(c, p, f); - - var has_class = api.hasFeature("js.Boot.getClass") && (c.superClass != null || c.fields.get().length > 0 || c.constructor != null); - var has_prototype = has_class || c.superClass != null || c.fields.get().length > 0; - - if (has_prototype){ - if( c.superClass != null ) { - var psup = getPath(c.superClass.t.get()); - println('$p.__super__ = $psup'); - printn('$p.prototype = $$extend($psup.prototype,{'); - }else{ - printn('$p.prototype = {'); - } - indentLevel++; - var first=true; - for( f in c.fields.get() ) { - switch( f.kind ) { - case FVar(r, _): - if( r == AccResolve ) continue; - default: - } - first=genClassField(c, p, f, first); - } - if (has_class){ - if(!first) - print(","); - printi('__class__: $p\n'); - } - if (has_property_reflection){ - var properties=getProperties(c.fields.get()); - if (properties.length>0) - if( c.superClass != null ) { - var psup = getPath(c.superClass.t.get()); - printn((first?"":",")+'__properties__: $$extend($psup.prototype.__properties__,$properties)'); - } else - printn((first?"":",")+'__properties__: $properties'); - } - indentLevel--; - if( c.superClass != null ) - printin("});",0); - else - printin("};",0); - } - - - } - - function genEnum( e : EnumType ) { - var p = getPath(e); - var pn= getDotPath(e); - var names = pn.split(".").map(api.quoteString).join(","); - var constructs = e.names.map(api.quoteString).join(","); - var hxClasses=api.hasFeature("Type.resolveEnum"); - - if (jsFlatten) - print("var "); - else - genPackage(e.pack); - - if (hxClasses) - print('$p = $$hxClasses["$pn"] = {'); - else - print('$p = {'); - - if (api.hasFeature("js.Boot.isEnum")) - if (api.hasFeature("Type.getEnumName")) - print(' __ename__ : [$names],'); - else - print(' __ename__ : true,'); - println(' __constructs__ : [$constructs] }'); - for( c in e.constructs.keys() ) { - var c = e.constructs.get(c); - var f = field(c.name); - print('$p$f = '); - switch( c.type ) { - case TFun(args, _): - var sargs = args.map(function(a) return a.name).join(","); - print('function($sargs) { var $$x = ["${c.name}",${c.index},$sargs]; $$x.__enum__ = $p; $$x.toString = $$estr; return $$x; }'); - default: - println("[" + api.quoteString(c.name) + "," + c.index + "]"); - if (api.hasFeature("may_print_enum")) - println('$p$f.toString = $$estr'); - print('$p$f.__enum__ = $p'); - } - newline(); - } - if (api.hasFeature("Type.allEnums")){ - var ec=Lambda.fold(e.constructs, function(c:EnumField, r:Array) { - if (!c.type.match(TFun(_,_))) - r.push('$p.${c.name}'); - return r; - }, []); - if (ec.length>0) - println('$p.__empty_constructs__ = ['+ec.join(",")+']'); - } - var meta = api.buildMetaData(e); - if( meta != null ) { - print('$p.__meta__ = '); - println(api.generateValue(meta)); - } - } - - function genType( t : Type ) { - switch( t ) { - case TInst(c, _): - var c = c.get(); - if( c.init != null ) - inits.add(c.init); - if( !c.isExtern ) genClass(c); - case TEnum(r, _): - var e = r.get(); - if( !e.isExtern ) genEnum(e); - default: - } - } - - public function generate() { - if (jsModern) - println('(function ('+(genExpose?"$hx_exports":"")+", $global) { \"use strict\""); - - if (jsModern) - println("if (!$hx_exports.$hxClasses) $hx_exports.$hxClasses = {}"); - - var vars = []; - if (api.hasFeature("Type.resolveClass") || api.hasFeature("Type.resolveEnum")) - //vars.push("$hxClasses = " + (jsModern? "{}" : "$hxClasses || {}")); - vars.push("$hxClasses = " + (jsModern? "$hx_exports.$hxClasses" : "$hxClasses || {}")); - if (api.hasFeature("may_print_enum")) - vars.push("$estr = function() { return "+packClass(["js"],"Boot")+".__string_rec(this,''); }"); - if (vars.length>0) - println("var "+vars.join(",")); - - if(genExtend) - print("function $extend(from, fields) { - function Inherit() {} Inherit.prototype = from; var proto = new Inherit(); - for (var name in fields) proto[name] = fields[name]; - if( fields.toString !== Object.prototype.toString ) proto.toString = fields.toString; - return proto; -}\n"); - - for( t in api.types ) - genType(t); - - if (api.hasFeature("use.$iterator")){ - api.addFeature("use.$bind"); - printn("function $iterator(o) { if( o instanceof Array ) return function() { return HxOverrides.iter(o); }; return typeof(o.iterator) == 'function' ? $bind(o,o.iterator) : o.iterator; }"); - } - if (api.hasFeature("use.$bind")){ - println("var $_, $fid = 0"); - printn("function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $fid++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; o.hx__closures__[m.__id__] = f; } return f; }"); - } - for( e in inits ) - genInit(e); - for( s in statics ) - println(getPath(s.c)+field(s.f.name)+' = '+api.generateValue(s.f.expr())); - if( api.main != null ) - println(api.generateValue(api.main)); - if (jsModern) - print('})('+(genExpose?'typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this, ':'')+'typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this);\n'); - sys.io.File.saveContent(api.outputFile, buf.toString()); - } - - function genInit(e:TypedExpr){ - var code=api.generateStatement(e); - //cosmetic only - var colon=';'; - for (l in code.split('\n')){ - if (l=="{" || l=="}") { - colon=''; - continue; - } - printn(l.replace("\t","")+colon); - } - } - -} - - -#end \ No newline at end of file diff --git a/lime/tools/helpers/NekoHelper.hx b/lime/tools/helpers/NekoHelper.hx deleted file mode 100644 index 12a505cda..000000000 --- a/lime/tools/helpers/NekoHelper.hx +++ /dev/null @@ -1,84 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Path; -import lime.tools.helpers.PlatformHelper; -import lime.project.Haxelib; -import lime.project.Platform; -import sys.FileSystem; -import sys.io.File; - - -class NekoHelper { - - - public static function copyLibraries (templatePaths:Array, platformName:String, targetPath:String) { - - //FileHelper.recursiveCopyTemplate (templatePaths, "neko/ndll/" + platformName, targetPath); - - } - - - public static function createExecutable (templatePaths:Array, platformName:String, source:String, target:String, iconPath:String = null):Void { - - /*var executablePath = PathHelper.findTemplate (templatePaths, "neko/bin/neko-" + platformName); - var executable = File.getBytes (executablePath); - var sourceContents = File.getBytes (source); - - var output = File.write (target, true); - output.write (executable); - output.write (sourceContents); - output.writeString ("NEKO"); - output.writeInt32 (executable.length); - output.close ();*/ - - var path = PathHelper.tryFullPath (source); - var file = Path.withoutDirectory (path); - var dir = Path.directory (path); - - ProcessHelper.runCommand (dir, "nekotools", [ "boot", file ]); - - var path = Path.withoutExtension (source); - - if (PlatformHelper.hostPlatform == WINDOWS) { - - path += ".exe"; - - } - - FileHelper.copyFile (path, target); - - } - - - public static function createWindowsExecutable (templatePaths:Array, source:String, target:String, iconPath:String):Void { - - /*var executablePath = PathHelper.findTemplate (templatePaths, "neko/bin/neko-windows"); - var executable = File.getBytes (executablePath); - var sourceContents = File.getBytes (source); - - var output = File.write (target, true); - output.write (executable); - output.close (); - - if (iconPath != null && PlatformHelper.hostPlatform == Platform.WINDOWS) { - - var templates = [ PathHelper.getHaxelib (new Haxelib ("lime")) + "/templates" ].concat (templatePaths); - ProcessHelper.runCommand ("", PathHelper.findTemplate (templates, "bin/ReplaceVistaIcon.exe"), [ target, iconPath, "1" ], true, true); - - } - - var executable = File.getBytes (target); - var output = File.write (target, true); - output.write (executable); - output.write (sourceContents); - output.writeString ("NEKO"); - output.writeInt32 (executable.length); - output.close ();*/ - - createExecutable (templatePaths, null, source, target, iconPath); - - } - - -} diff --git a/lime/tools/helpers/NodeJSHelper.hx b/lime/tools/helpers/NodeJSHelper.hx deleted file mode 100644 index fa4848bdc..000000000 --- a/lime/tools/helpers/NodeJSHelper.hx +++ /dev/null @@ -1,61 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Path; -import lime.project.Architecture; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Platform; - - -class NodeJSHelper { - - - public static function run (project:HXProject, modulePath:String, args:Array = null):Void { - - /*var suffix = switch (PlatformHelper.hostPlatform) { - - case Platform.WINDOWS: "-windows.exe"; - case Platform.MAC: "-mac"; - case Platform.LINUX: "-linux"; - default: return; - - } - - if (suffix == "-linux") { - - if (PlatformHelper.hostArchitecture == Architecture.X86) { - - suffix += "32"; - - } else { - - suffix += "64"; - - } - - } - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - var node = PathHelper.findTemplate (templatePaths, "bin/node/node" + suffix); - - if (PlatformHelper.hostPlatform != Platform.WINDOWS) { - - Sys.command ("chmod", [ "+x", node ]); - - } - - if (args == null) { - - args = []; - - }*/ - - args.unshift (Path.withoutDirectory (modulePath)); - - ProcessHelper.runCommand (Path.directory (modulePath), "node", args); - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/ObjectHelper.hx b/lime/tools/helpers/ObjectHelper.hx deleted file mode 100644 index 0460dd286..000000000 --- a/lime/tools/helpers/ObjectHelper.hx +++ /dev/null @@ -1,155 +0,0 @@ -package lime.tools.helpers; - - -import haxe.ds.IntMap; -import haxe.ds.StringMap; - - -@:generic class ObjectHelper { - - - public static function copyFields (source:T, destination:T):T { - - for (field in Reflect.fields (source)) { - - Reflect.setField (destination, field, Reflect.field (source, field)); - - } - - return destination; - - } - - - public static function copyMissingFields (source:T, destination:T):T { - - for (field in Reflect.fields (source)) { - - if (!Reflect.hasField (destination, field)) { - - Reflect.setField (destination, field, Reflect.field (source, field)); - - } - - } - - return destination; - - } - - - public static function copyUniqueFields (source:T, destination:T, defaultInstance:T):T { - - for (field in Reflect.fields (source)) { - - var value = Reflect.field (source, field); - - if (value != Reflect.field (defaultInstance, field)) { - - Reflect.setField (destination, field, value); - - } - - } - - return destination; - - } - - - public static function deepCopy (v:T):T { - - if (!Reflect.isObject (v)) { // simple type - - return v; - - } else if (Std.is (v, String)) { // string - - return v; - - } else if (Std.is (v, Array)) { // array - - var result = Type.createInstance (Type.getClass (v), []); - - if (result != null) { - - untyped { - var copy:Dynamic; - for (ii in 0...v.length) { - copy = deepCopy (v[ii]); - result.push (copy); - } - } - - } - - return result; - - } else if (Std.is (v, StringMap)) { // hashmap - - var result = Type.createInstance (Type.getClass(v), []); - - untyped { - var keys:Iterator = v.keys (); - for (key in keys) { - result.set (key, deepCopy (v.get (key))); - } - } - - return result; - - } else if (Std.is (v, IntMap)) { // integer-indexed hashmap - - var result = Type.createInstance (Type.getClass (v), []); - - untyped { - var keys:Iterator = v.keys (); - for (key in keys) { - result.set (key, deepCopy (v.get (key))); - } - } - - return result; - - } else if (Std.is (v, List)) { // list - - //List would be copied just fine without this special case, but I want to avoid going recursive - var result = Type.createInstance (Type.getClass (v), []); - - untyped { - var iter:Iterator = v.iterator (); - for (ii in iter) { - result.add (ii); - } - } - - return result; - - } else if (Type.getClass(v) == null) { // anonymous object - - var obj:Dynamic = {}; - - for (ff in Reflect.fields (v)) { - Reflect.setField (obj, ff, deepCopy (Reflect.field (v, ff))); - } - - return obj; - - } else { // class - - var obj = Type.createEmptyInstance (Type.getClass (v)); - - for (ff in Reflect.fields (v)) { - Reflect.setField (obj, ff, deepCopy (Reflect.field (v, ff))); - } - - return obj; - - } - - return null; - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/PathHelper.hx b/lime/tools/helpers/PathHelper.hx deleted file mode 100644 index bf48afd8d..000000000 --- a/lime/tools/helpers/PathHelper.hx +++ /dev/null @@ -1,748 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Path; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.StringHelper; -import lime.project.Architecture; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.NDLL; -import lime.project.Platform; -import sys.io.Process; -import sys.FileSystem; - - -class PathHelper { - - - //private static var doubleVarMatch = new EReg ("\\$\\${(.*?)}", ""); - private static var varMatch = new EReg ("{{(.*?)}}", ""); - - - public static function combine (firstPath:String, secondPath:String):String { - - if (firstPath == null || firstPath == "") { - - return secondPath; - - } else if (secondPath != null && secondPath != "") { - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - if (secondPath.indexOf (":") == 1) { - - return secondPath; - - } - - } else { - - if (secondPath.substr (0, 1) == "/") { - - return secondPath; - - } - - } - - var firstSlash = (firstPath.substr (-1) == "/" || firstPath.substr (-1) == "\\"); - var secondSlash = (secondPath.substr (0, 1) == "/" || secondPath.substr (0, 1) == "\\"); - - if (firstSlash && secondSlash) { - - return firstPath + secondPath.substr (1); - - } else if (!firstSlash && !secondSlash) { - - return firstPath + "/" + secondPath; - - } else { - - return firstPath + secondPath; - - } - - } else { - - return firstPath; - - } - - } - - - public static function escape (path:String):String { - - if (PlatformHelper.hostPlatform != Platform.WINDOWS) { - - path = StringTools.replace (path, "\\ ", " "); - path = StringTools.replace (path, " ", "\\ "); - path = StringTools.replace (path, "\\'", "'"); - path = StringTools.replace (path, "'", "\\'"); - - } else { - - path = StringTools.replace (path, "^,", ","); - path = StringTools.replace (path, ",", "^,"); - path = StringTools.replace (path, "^ ", " "); - path = StringTools.replace (path, " ", "^ "); - - } - - return expand (path); - - } - - - public static function expand (path:String):String { - - if (path == null) { - - path = ""; - - } - - if (PlatformHelper.hostPlatform != Platform.WINDOWS) { - - if (StringTools.startsWith (path, "~/")) { - - path = Sys.getEnv ("HOME") + "/" + path.substr (2); - - } - - } - - return path; - - } - - - public static function findTemplate (templatePaths:Array, path:String, warnIfNotFound:Bool = true):String { - - var matches = findTemplates (templatePaths, path, warnIfNotFound); - - if (matches.length > 0) { - - return matches[matches.length - 1]; - - } - - return null; - - } - - - public static function findTemplateRecursive (templatePaths:Array, path:String, warnIfNotFound:Bool = true, destinationPaths:Array = null):Array { - - var paths = findTemplates (templatePaths, path, warnIfNotFound); - if (paths.length == 0) return null; - - try { - - if (FileSystem.isDirectory (paths[0])) { - - var templateFiles = new Array (); - var templateMatched = new Map (); - - paths.reverse (); - - findTemplateRecursive_ (paths, "", templateFiles, templateMatched, destinationPaths); - return templateFiles; - - } - - } catch (e:Dynamic) {} - - paths.splice (0, paths.length - 1); - - if (destinationPaths != null) { - - destinationPaths.push (paths[0]); - - } - - return paths; - - } - - - private static function findTemplateRecursive_ (templatePaths:Array, source:String, templateFiles:Array, templateMatched:Map, destinationPaths:Array):Void { - - var files:Array; - - for (templatePath in templatePaths) { - - try { - - files = FileSystem.readDirectory (PathHelper.combine (templatePath, source)); - - for (file in files) { - - //if (file.substr (0, 1) != ".") { - - var itemSource = PathHelper.combine (source, file); - - if (!templateMatched.exists (itemSource)) { - - templateMatched.set (itemSource, true); - var path = PathHelper.combine (templatePath, itemSource); - - if (FileSystem.isDirectory (path)) { - - findTemplateRecursive_ (templatePaths, itemSource, templateFiles, templateMatched, destinationPaths); - - } else { - - templateFiles.push (path); - - if (destinationPaths != null) { - - destinationPaths.push (itemSource); - - } - - } - - } - - //} - - } - - } catch (e:Dynamic) {} - - } - - } - - - public static function findTemplates (templatePaths:Array, path:String, warnIfNotFound:Bool = true):Array { - - var matches = []; - - for (templatePath in templatePaths) { - - var targetPath = combine (templatePath, path); - - if (FileSystem.exists (targetPath)) { - - matches.push (targetPath); - - } - - } - - if (matches.length == 0 && warnIfNotFound) { - - LogHelper.warn ("Could not find template file: " + path); - - } - - return matches; - - } - - - public static function getHaxelib (haxelib:Haxelib, validate:Bool = false, clearCache:Bool = false):String { - - return HaxelibHelper.getPath (haxelib, validate, clearCache); - - } - - - public static function getLibraryPath (ndll:NDLL, directoryName:String, namePrefix:String = "", nameSuffix:String = ".ndll", allowDebug:Bool = false):String { - - var usingDebug = false; - var path = ""; - - if (allowDebug) { - - path = searchForLibrary (ndll, directoryName, namePrefix + ndll.name + "-debug" + nameSuffix); - usingDebug = FileSystem.exists (path); - - } - - if (!usingDebug) { - - path = searchForLibrary (ndll, directoryName, namePrefix + ndll.name + nameSuffix); - - } - - return path; - - } - - - public static function getTemporaryFile (extension:String = ""):String { - - var path = ""; - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - path = Sys.getEnv ("TEMP"); - - } else { - - path = Sys.getEnv ("TMPDIR"); - - if (path == null) { - - path = "/tmp"; - - } - - } - - path += "/temp_" + Math.round (0xFFFFFF * Math.random ()) + extension; - - if (FileSystem.exists (path)) { - - return getTemporaryFile (extension); - - } - - return path; - - } - - - public static function getTemporaryDirectory ():String { - - var path = getTemporaryFile (); - mkdir (path); - return path; - - } - - - public static function isAbsolute (path:String):Bool { - - if (StringTools.startsWith (path, "/") || StringTools.startsWith (path, "\\")) { - - return true; - - } - - return false; - - } - - - public static function isRelative (path:String):Bool { - - return !isAbsolute (path); - - } - - - public static function mkdir (directory:String):Void { - - directory = StringTools.replace (directory, "\\", "/"); - var total = ""; - - if (directory.substr (0, 1) == "/") { - - total = "/"; - - } - - var parts = directory.split("/"); - var oldPath = ""; - - if (parts.length > 0 && parts[0].indexOf (":") > -1) { - - try { - - oldPath = Sys.getCwd (); - Sys.setCwd (parts[0] + "\\"); - parts.shift (); - - } catch (e:Dynamic) { - - LogHelper.error ("Cannot create directory \"" + directory + "\""); - - } - - } - - for (part in parts) { - - if (part != "." && part != "") { - - if (total != "" && total != "/") { - - total += "/"; - - } - - total += part; - - if (FileSystem.exists (total) && !FileSystem.isDirectory (total)) { - - LogHelper.info ("", " - \x1b[1mRemoving file:\x1b[0m " + total); - - FileSystem.deleteFile (total); - - } - - if (!FileSystem.exists (total)) { - - LogHelper.info ("", " - \x1b[1mCreating directory:\x1b[0m " + total); - - FileSystem.createDirectory (total); - - } - - } - - } - - if (oldPath != "") { - - Sys.setCwd (oldPath); - - } - - } - - - public static function readDirectory (directory:String, ignore:Array = null, paths:Array = null):Array { - - if (FileSystem.exists (directory)) { - - if (paths == null) { - - paths = []; - - } - - var files; - - try { - - files = FileSystem.readDirectory (directory); - - } catch (e:Dynamic) { - - return paths; - - } - - for (file in FileSystem.readDirectory (directory)) { - - if (ignore != null) { - - var filtered = false; - - for (filter in ignore) { - - if (filter == file) { - - filtered = true; - - } - - } - - if (filtered) continue; - - } - - var path = directory + "/" + file; - - try { - - if (FileSystem.isDirectory (path)) { - - readDirectory (path, ignore, paths); - - } else { - - paths.push (path); - - } - - } catch (e:Dynamic) { - - return paths; - - } - - } - - return paths; - - } - - return null; - - } - - - public static function relocatePath (path:String, targetDirectory:String):String { - - // this should be improved for target directories that are outside the current working path - - if (isAbsolute (path) || targetDirectory == "") { - - return path; - - } else if (isAbsolute (targetDirectory)) { - - return combine (Sys.getCwd (), path); - - } else { - - targetDirectory = StringTools.replace (targetDirectory, "\\", "/"); - - var splitTarget = targetDirectory.split ("/"); - var directories = 0; - - while (splitTarget.length > 0) { - - switch (splitTarget.shift ()) { - - case ".", "": - - // ignore - - case "..": - - directories--; - - default: - - directories++; - - } - - } - - var adjust = ""; - - for (i in 0...directories) { - - adjust += "../"; - - } - - return adjust + path; - - } - - } - - - public static function relocatePaths (paths:Array, targetDirectory:String):Array { - - var relocatedPaths = paths.copy (); - - for (i in 0...paths.length) { - - relocatedPaths[i] = relocatePath (paths[i], targetDirectory); - - } - - return relocatedPaths; - - } - - - public static function removeDirectory (directory:String):Void { - - if (FileSystem.exists (directory)) { - - var files; - - try { - - files = FileSystem.readDirectory (directory); - - } catch (e:Dynamic) { - - return; - - } - - for (file in FileSystem.readDirectory (directory)) { - - var path = directory + "/" + file; - - try { - - if (FileSystem.isDirectory (path)) { - - removeDirectory (path); - - } else { - - FileSystem.deleteFile (path); - - } - - } catch (e:Dynamic) {} - - } - - LogHelper.info ("", " - \x1b[1mRemoving directory:\x1b[0m " + directory); - - try { - - FileSystem.deleteDirectory (directory); - - } catch (e:Dynamic) {} - - } - - } - - - public static function safeFileName (name:String):String { - - var safeName = StringTools.replace (name, " ", ""); - return safeName; - - } - - - private static function searchForLibrary (ndll:NDLL, directoryName:String, filename:String):String { - - if (ndll.path != null && ndll.path != "") { - - return ndll.path; - - } else if (ndll.haxelib == null) { - - if (ndll.extensionPath != null && ndll.extensionPath != "") { - - var subdirectory = "ndll/"; - - if (ndll.subdirectory != null) { - - if (ndll.subdirectory != "") { - - subdirectory = ndll.subdirectory + "/"; - - } else { - - subdirectory = ""; - - } - - } - - return combine (ndll.extensionPath, subdirectory + directoryName + "/" + filename); - - } else { - - return filename; - - } - - } else if (ndll.haxelib.name == "hxcpp") { - - var extension = Path.extension (filename); - - if (extension == "a" || extension == "lib") { - - return combine (getHaxelib (ndll.haxelib, true), "lib/" + directoryName + "/" + filename); - - } else { - - return combine (getHaxelib (ndll.haxelib, true), "bin/" + directoryName + "/" + filename); - - } - - } else { - - var subdirectory = "ndll/"; - - if (ndll.subdirectory != null) { - - if (ndll.subdirectory != "") { - - subdirectory = ndll.subdirectory + "/"; - - } else { - - subdirectory = ""; - - } - - } - - return combine (getHaxelib (ndll.haxelib, true), subdirectory + directoryName + "/" + filename); - - } - - } - - - public static function standardize (path:String, trailingSlash:Bool = false):String { - - if (path == null) return null; - - path = StringTools.replace (path, "\\", "/"); - path = StringTools.replace (path, "//", "/"); - path = StringTools.replace (path, "//", "/"); - - if (!trailingSlash && StringTools.endsWith (path, "/")) { - - path = path.substr (0, path.length - 1); - - } else if (trailingSlash && !StringTools.endsWith (path, "/")) { - - path += "/"; - - } - - if (PlatformHelper.hostPlatform == Platform.WINDOWS && path.charAt (1) == ":") { - - path = path.charAt (0).toUpperCase () + ":" + path.substr (2); - - } - - return path; - - } - - - public static function substitutePath (project:HXProject, path:String):String { - - var newString = path; - - // while (doubleVarMatch.match (newString)) { - - // newString = doubleVarMatch.matchedLeft () + "${" + StringHelper.replaceVariable (this, doubleVarMatch.matched (1)) + "}" + doubleVarMatch.matchedRight (); - - // } - - while (varMatch.match (newString)) { - - newString = varMatch.matchedLeft () + StringHelper.replaceVariable (project, varMatch.matched (1)) + varMatch.matchedRight (); - - } - - return newString; - - } - - - public static function tryFullPath (path:String):String { - - try { - - return FileSystem.fullPath (path); - - } catch (e:Dynamic) { - - return expand (path); - - } - - } - - -} diff --git a/lime/tools/helpers/PlatformHelper.hx b/lime/tools/helpers/PlatformHelper.hx deleted file mode 100644 index 609dc2620..000000000 --- a/lime/tools/helpers/PlatformHelper.hx +++ /dev/null @@ -1,129 +0,0 @@ -package lime.tools.helpers; - - -import lime.project.Architecture; -import lime.project.Platform; -import sys.io.Process; - - -class PlatformHelper { - - - public static var hostArchitecture (get_hostArchitecture, null):Architecture; - public static var hostPlatform (get_hostPlatform, null):Platform; - - private static var _hostArchitecture:Architecture; - private static var _hostPlatform:Platform; - - - private static function get_hostArchitecture ():Architecture { - - if (_hostArchitecture == null) { - - switch (hostPlatform) { - - case WINDOWS: - - var architecture = Sys.getEnv ("PROCESSOR_ARCHITEW6432"); - - if (architecture != null && architecture.indexOf ("64") > -1) { - - _hostArchitecture = Architecture.X64; - - } else { - - _hostArchitecture = Architecture.X86; - - } - - case LINUX, MAC: - - #if nodejs - - switch (js.Node.process.arch) { - - case "arm": - - _hostArchitecture = Architecture.ARMV7; - - case "x64": - - _hostArchitecture = Architecture.X64; - - default: - - _hostArchitecture = Architecture.X86; - - } - - #else - - var process = new Process ("uname", [ "-m" ]); - var output = process.stdout.readAll ().toString (); - var error = process.stderr.readAll ().toString (); - process.exitCode (); - process.close (); - - if (output.indexOf ("armv6") > -1) { - - _hostArchitecture = Architecture.ARMV6; - - } else if (output.indexOf ("armv7") > -1) { - - _hostArchitecture = Architecture.ARMV7; - - } else if (output.indexOf ("64") > -1) { - - _hostArchitecture = Architecture.X64; - - } else { - - _hostArchitecture = Architecture.X86; - - } - - #end - - default: - - _hostArchitecture = Architecture.ARMV6; - - } - - LogHelper.info ("", " - \x1b[1mDetected host architecture:\x1b[0m " + Std.string (_hostArchitecture).toUpperCase ()); - - } - - return _hostArchitecture; - - } - - - private static function get_hostPlatform ():Platform { - - if (_hostPlatform == null) { - - if (new EReg ("window", "i").match (Sys.systemName ())) { - - _hostPlatform = Platform.WINDOWS; - - } else if (new EReg ("linux", "i").match (Sys.systemName ())) { - - _hostPlatform = Platform.LINUX; - - } else if (new EReg ("mac", "i").match (Sys.systemName ())) { - - _hostPlatform = Platform.MAC; - - } - - LogHelper.info ("", " - \x1b[1mDetected host platform:\x1b[0m " + Std.string (_hostPlatform).toUpperCase ()); - - } - - return _hostPlatform; - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/ProcessHelper.hx b/lime/tools/helpers/ProcessHelper.hx deleted file mode 100644 index cca91350f..000000000 --- a/lime/tools/helpers/ProcessHelper.hx +++ /dev/null @@ -1,521 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.BytesOutput; -import haxe.io.Eof; -import haxe.io.Path; -import lime.project.Platform; -import sys.io.Process; -import sys.FileSystem; - - -class ProcessHelper { - - - public static var dryRun:Bool = false; - public static var processorCores (get_processorCores, null):Int; - - private static var _processorCores:Int = 0; - - - public static function openFile (workingDirectory:String, targetPath:String, executable:String = ""):Void { - - if (executable == null) { - - executable = ""; - - } - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - var args = []; - - if (executable == "") { - - executable = "cmd"; - args = [ "/c" ]; - - } - - if (targetPath.indexOf (":\\") == -1) { - - runCommand (workingDirectory, executable, args.concat ([ targetPath ])); - - } else { - - runCommand (workingDirectory, executable, args.concat ([ ".\\" + targetPath ])); - - } - - } else if (PlatformHelper.hostPlatform == Platform.MAC) { - - if (executable == "") { - - executable = "/usr/bin/open"; - - } - - if (targetPath.substr (0, 1) == "/") { - - runCommand (workingDirectory, executable, [ "-W", targetPath ]); - - } else { - - runCommand (workingDirectory, executable, [ "-W", "./" + targetPath ]); - - } - - } else { - - if (executable == "") { - - executable = "/usr/bin/xdg-open"; - - } - - if (targetPath.substr (0, 1) == "/") { - - runCommand (workingDirectory, executable, [ targetPath ]); - - } else { - - runCommand (workingDirectory, executable, [ "./" + targetPath ]); - - } - - } - - } - - - public static function openURL (url:String):Void { - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - runCommand ("", "start", [ url ]); - - } else if (PlatformHelper.hostPlatform == Platform.MAC) { - - runCommand ("", "/usr/bin/open", [ url ]); - - } else { - - runCommand ("", "/usr/bin/xdg-open", [ url, "&" ]); - - } - - } - - - public static function runCommand (path:String, command:String, args:Array, safeExecute:Bool = true, ignoreErrors:Bool = false, print:Bool = false):Int { - - if (print) { - - var message = command; - - if (args != null) { - - for (arg in args) { - - if (arg.indexOf (" ") > -1) { - - message += " \"" + arg + "\""; - - } else { - - message += " " + arg; - - } - - } - - } - - Sys.println (message); - - } - - #if (haxe_ver < "3.3.0") - if (args != null && PlatformHelper.hostPlatform == Platform.WINDOWS) { - - command = PathHelper.escape (command); - - } - #end - - if (safeExecute) { - - try { - - if (path != null && path != "" && !FileSystem.exists (FileSystem.fullPath (path)) && !FileSystem.exists (FileSystem.fullPath (new Path (path).dir))) { - - LogHelper.error ("The specified target path \"" + path + "\" does not exist"); - return 1; - - } - - return _runCommand (path, command, args); - - } catch (e:Dynamic) { - - if (!ignoreErrors) { - - LogHelper.error ("", e); - return 1; - - } - - return 0; - - } - - } else { - - return _runCommand (path, command, args); - - } - - } - - - private static function _runCommand (path:String, command:String, args:Array):Int { - - var oldPath:String = ""; - - if (path != null && path != "") { - - LogHelper.info ("", " - \x1b[1mChanging directory:\x1b[0m " + path + ""); - - if (!dryRun) { - - oldPath = Sys.getCwd (); - Sys.setCwd (path); - - } - - } - - var argString = ""; - - if (args != null) { - - for (arg in args) { - - if (arg.indexOf (" ") > -1) { - - argString += " \"" + arg + "\""; - - } else { - - argString += " " + arg; - - } - - } - - } - - LogHelper.info ("", " - \x1b[1mRunning command:\x1b[0m " + command + argString); - - var result = 0; - - if (!dryRun) { - - if (args != null && args.length > 0) { - - result = Sys.command (command, args); - - } else { - - result = Sys.command (command); - - } - - if (oldPath != "") { - - Sys.setCwd (oldPath); - - } - - } - - if (result != 0) { - - throw ("Error running: " + command + " " + args.join (" ") + " [" + path + "]"); - - } - - return result; - - } - - - public static function runProcess (path:String, command:String, args:Array, waitForOutput:Bool = true, safeExecute:Bool = true, ignoreErrors:Bool = false, print:Bool = false, returnErrorValue:Bool = false):String { - - if (print) { - - var message = command; - - for (arg in args) { - - if (arg.indexOf (" ") > -1) { - - message += " \"" + arg + "\""; - - } else { - - message += " " + arg; - - } - - } - - Sys.println (message); - - } - - #if (haxe_ver < "3.3.0") - command = PathHelper.escape (command); - #end - - if (safeExecute) { - - try { - - if (path != null && path != "" && !FileSystem.exists (FileSystem.fullPath (path)) && !FileSystem.exists (FileSystem.fullPath (new Path (path).dir))) { - - LogHelper.error ("The specified target path \"" + path + "\" does not exist"); - - } - - return _runProcess (path, command, args, waitForOutput, safeExecute, ignoreErrors, returnErrorValue); - - } catch (e:Dynamic) { - - if (!ignoreErrors) { - - LogHelper.error ("", e); - - } - - return null; - - } - - } else { - - return _runProcess (path, command, args, waitForOutput, safeExecute, ignoreErrors, returnErrorValue); - - } - - } - - - private static function _runProcess (path:String, command:String, args:Array, waitForOutput:Bool, safeExecute:Bool, ignoreErrors:Bool, returnErrorValue:Bool):String { - - var oldPath:String = ""; - - if (path != null && path != "") { - - LogHelper.info ("", " - \x1b[1mChanging directory:\x1b[0m " + path + ""); - - if (!dryRun) { - - oldPath = Sys.getCwd (); - Sys.setCwd (path); - - } - - } - - var argString = ""; - - for (arg in args) { - - if (arg.indexOf (" ") > -1) { - - argString += " \"" + arg + "\""; - - } else { - - argString += " " + arg; - - } - - } - - LogHelper.info ("", " - \x1b[1mRunning process:\x1b[0m " + command + argString); - - var output = ""; - var result = 0; - - if (!dryRun) { - - var process = new Process (command, args); - var buffer = new BytesOutput (); - - if (waitForOutput) { - - var waiting = true; - - while (waiting) { - - try { - - var current = process.stdout.readAll (1024); - buffer.write (current); - - if (current.length == 0) { - - waiting = false; - - } - - } catch (e:Eof) { - - waiting = false; - - } - - } - - result = process.exitCode (); - - output = buffer.getBytes ().toString (); - - if (output == "") { - - var error = process.stderr.readAll ().toString (); - process.close (); - - if (result != 0 || error != "") { - - if (ignoreErrors) { - - output = error; - - } else if (!safeExecute) { - - throw error; - - } else { - - LogHelper.error (error); - - } - - if (returnErrorValue) { - - return output; - - } else { - - return null; - - } - - } - - /*if (error != "") { - - LogHelper.error (error); - - }*/ - - } else { - - process.close (); - - } - - } - - if (oldPath != "") { - - Sys.setCwd (oldPath); - - } - - } - - return output; - - } - - - - - // Get & Set Methods - - - - - public static function get_processorCores ():Int { - - var cacheDryRun = dryRun; - dryRun = false; - - if (_processorCores < 1) { - - var result = null; - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - var env = Sys.getEnv ("NUMBER_OF_PROCESSORS"); - - if (env != null) { - - result = env; - - } - - } else if (PlatformHelper.hostPlatform == Platform.LINUX) { - - result = runProcess ("", "nproc", [], true, true, true); - - if (result == null) { - - var cpuinfo = runProcess ("", "cat", [ "/proc/cpuinfo" ], true, true, true); - - if (cpuinfo != null) { - - var split = cpuinfo.split ("processor"); - result = Std.string (split.length - 1); - - } - - } - - } else if (PlatformHelper.hostPlatform == Platform.MAC) { - - var cores = ~/Total Number of Cores: (\d+)/; - var output = runProcess ("", "/usr/sbin/system_profiler", [ "-detailLevel", "full", "SPHardwareDataType" ]); - - if (cores.match (output)) { - - result = cores.matched (1); - - } - - } - - if (result == null || Std.parseInt (result) < 1) { - - _processorCores = 1; - - } else { - - _processorCores = Std.parseInt (result); - - } - - } - - dryRun = cacheDryRun; - - return _processorCores; - - } - - -} diff --git a/lime/tools/helpers/StringHelper.hx b/lime/tools/helpers/StringHelper.hx deleted file mode 100644 index d7d366d53..000000000 --- a/lime/tools/helpers/StringHelper.hx +++ /dev/null @@ -1,442 +0,0 @@ -package lime.tools.helpers; - - -import haxe.crypto.BaseCode; -import haxe.io.Bytes; -import lime.project.Haxelib; -import lime.project.HXProject; - - -class StringHelper { - - - private static var seedNumber = 0; - private static var base64Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - private static var base64Encoder:BaseCode; - private static var usedFlatNames = new Map (); - private static var uuidChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - - - public static function base64Decode (base64:String):Bytes { - - base64 = StringTools.trim (base64); - base64 = StringTools.replace (base64, "=", ""); - - if (base64Encoder == null) { - - base64Encoder = new BaseCode (Bytes.ofString (base64Chars)); - - } - - var bytes = base64Encoder.decodeBytes (Bytes.ofString (base64)); - return bytes; - - } - - - public static function base64Encode (bytes:Bytes):String { - - var extension = switch (bytes.length % 3) { - - case 1: "=="; - case 2: "="; - default: ""; - - } - - if (base64Encoder == null) { - - base64Encoder = new BaseCode (Bytes.ofString (base64Chars)); - - } - - return base64Encoder.encodeBytes (bytes).toString () + extension; - - } - - - public static function filter (text:String, include:Array = null, exclude:Array = null):Bool { - - if (include == null) { - - include = [ "*" ]; - - } - - if (exclude == null) { - - exclude = []; - - } - - for (filter in exclude) { - - if (filter != "") { - - if(filter == "*") return false; - if(filter.indexOf("*") == filter.length - 1) { - if(StringTools.startsWith(text, filter.substr(0, -1))) return false; - continue; - } - - filter = StringTools.replace (filter, ".", "\\."); - filter = StringTools.replace (filter, "*", ".*"); - - var regexp = new EReg ("^" + filter + "$", "i"); - - if (regexp.match (text)) { - - return false; - - } - - } - - } - - for (filter in include) { - - if (filter != "") { - - if(filter == "*") return true; - if(filter.indexOf("*") == filter.length - 1) { - if(StringTools.startsWith(text, filter.substr(0, -1))) return true; - continue; - } - - filter = StringTools.replace (filter, ".", "\\."); - filter = StringTools.replace (filter, "*", ".*"); - - var regexp = new EReg ("^" + filter, "i"); - - if (regexp.match (text)) { - - return true; - - } - - } - - } - - return false; - - } - - - public static function formatArray (array:Array):String { - - var output = "[ "; - - for (i in 0...array.length) { - - output += array[i]; - - if (i < array.length - 1) { - - output += ", "; - - } else { - - output += " "; - - } - - } - - output += "]"; - - return output; - - } - - - public static function formatEnum (value:Dynamic):String { - - return Type.getEnumName (Type.getEnum (value)) + "." + value; - - } - - - public static function formatUppercaseVariable (name:String):String { - - var isAlpha = ~/[A-Z0-9]/i; - var variableName = ""; - var lastWasUpperCase = false; - var lastWasAlpha = true; - - for (i in 0...name.length) { - - var char = name.charAt (i); - - if (!isAlpha.match (char)) { - - variableName += "_"; - lastWasUpperCase = false; - lastWasAlpha = false; - - } else { - - if (char == char.toUpperCase () && i > 0) { - - if (lastWasUpperCase) { - - if (i == name.length - 1 || name.charAt (i + 1) == name.charAt (i + 1).toUpperCase ()) { - - variableName += char; - - } else { - - variableName += "_" + char; - - } - - } else if (lastWasAlpha) { - - variableName += "_" + char; - - } else { - - variableName += char; - - } - - lastWasUpperCase = true; - - } else { - - variableName += char.toUpperCase (); - lastWasUpperCase = i == 0 && char == char.toUpperCase (); - - } - - lastWasAlpha = true; - - } - - } - - return variableName; - - } - - - public static function generateHashCode (value:String):Int { - - var hash = 5381; - var length = value.length; - - for (i in 0...value.length) { - - hash = ((hash << 5) + hash) + value.charCodeAt (i); - - } - - return hash; - - } - - - public static function generateUUID (length:Int, radix:Null = null, seed:Null = null):String { - - var chars = uuidChars.split (""); - - if (radix == null || radix > chars.length) { - - radix = chars.length; - - } else if (radix < 2) { - - radix = 2; - - } - - if (seed == null) { - - seed = Math.floor (Math.random () * 2147483647.0); - - } - - var uuid = []; - var seedValue:Int = Math.round (Math.abs (seed)); - - for (i in 0...length) { - - seedValue = Std.int ((seedValue * 16807.0) % 2147483647.0); - uuid[i] = chars[0 | Std.int ((seedValue / 2147483647.0) * radix)]; - - } - - return uuid.join (""); - - } - - - - public static function getFlatName (name:String):String { - - var chars = name.toLowerCase (); - var flatName = ""; - - for (i in 0...chars.length) { - - var code = chars.charCodeAt (i); - - if ((i > 0 && code >= "0".charCodeAt (0) && code <= "9".charCodeAt (0)) || (code >= "a".charCodeAt (0) && code <= "z".charCodeAt (0)) || (code == "_".charCodeAt (0))) { - - flatName += chars.charAt (i); - - } else { - - flatName += "_"; - - } - - } - - if (flatName == "") { - - flatName = "_"; - - } - - if (flatName.substr (0, 1) == "_") { - - flatName = "file" + flatName; - - } - - while (usedFlatNames.exists (flatName)) { - - // Find last digit ... - var match = ~/(.*?)(\d+)/; - - if (match.match (flatName)) { - - flatName = match.matched (1) + (Std.parseInt (match.matched (2)) + 1); - - } else { - - flatName += "1"; - - } - - } - - usedFlatNames.set (flatName, "1"); - - return flatName; - - } - - - public static function getUniqueID ():String { - - return StringTools.hex (seedNumber++, 8); - - } - - - public static function replaceVariable (project:HXProject, string:String):String { - - if (string.substr (0, 8) == "haxelib:") { - - var path = HaxelibHelper.getPath (new Haxelib (string.substr (8)), true); - return PathHelper.standardize (path); - - } else if (project.defines.exists (string)) { - - return project.defines.get (string); - - } else if (project.environment != null && project.environment.exists (string)) { - - return project.environment.get (string); - - } else { - - var substring = StringTools.replace (string, " ", ""); - var index, value; - - if (substring.indexOf ("==") > -1) { - - index = substring.indexOf ("=="); - value = StringHelper.replaceVariable (project, substring.substr (0, index)); - - return Std.string (value == substring.substr (index + 2)); - - } else if (substring.indexOf ("!=") > -1) { - - index = substring.indexOf ("!="); - value = StringHelper.replaceVariable (project, substring.substr (0, index)); - - return Std.string (value != substring.substr (index + 2)); - - } else if (substring.indexOf ("<=") > -1) { - - index = substring.indexOf ("<="); - value = StringHelper.replaceVariable (project, substring.substr (0, index)); - - return Std.string (value <= substring.substr (index + 2)); - - } else if (substring.indexOf ("<") > -1) { - - index = substring.indexOf ("<"); - value = StringHelper.replaceVariable (project, substring.substr (0, index)); - - return Std.string (value < substring.substr (index + 1)); - - } else if (substring.indexOf (">=") > -1) { - - index = substring.indexOf (">="); - value = StringHelper.replaceVariable (project, substring.substr (0, index)); - - return Std.string (value >= substring.substr (index + 2)); - - } else if (substring.indexOf (">") > -1) { - - index = substring.indexOf (">"); - value = StringHelper.replaceVariable (project, substring.substr (0, index)); - - return Std.string (value > substring.substr (index + 1)); - - } else if (substring.indexOf (".") > -1) { - - var index = substring.indexOf ("."); - var fieldName = substring.substr (0, index); - var subField = substring.substr (index + 1); - - if (Reflect.hasField (project, fieldName)) { - - var field = Reflect.field (project, fieldName); - - if (Reflect.hasField (field, subField)) { - - return Std.string (Reflect.field (field, subField)); - - } - - } - - } else if (substring == "projectDirectory") { - - // TODO: Better handling if CWD has changed? - - return Std.string (Sys.getCwd ()); - - } - - } - - return string; - - } - - - public static function underline (string:String, character = "="):String { - - return string + "\n" + StringTools.lpad ("", character, string.length); - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/StringMapHelper.hx b/lime/tools/helpers/StringMapHelper.hx deleted file mode 100644 index 5f7f9cc2a..000000000 --- a/lime/tools/helpers/StringMapHelper.hx +++ /dev/null @@ -1,51 +0,0 @@ -package lime.tools.helpers; - - -import haxe.ds.StringMap; - - -class StringMapHelper { - - - public static function copy (source:StringMap):StringMap { - - var target = new StringMap (); - - for (key in source.keys ()) { - - target.set (key, source.get (key)); - - } - - return target; - - } - - - public static function copyKeys (source:StringMap, target:StringMap):Void { - - for (key in source.keys ()) { - - target.set (key, source.get (key)); - - } - - } - - - public static function copyUniqueKeys (source:StringMap, target:StringMap):Void { - - for (key in source.keys ()) { - - if (!target.exists (key)) { - - target.set (key, source.get (key)); - - } - - } - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/TVOSHelper.hx b/lime/tools/helpers/TVOSHelper.hx deleted file mode 100644 index c78e8c08f..000000000 --- a/lime/tools/helpers/TVOSHelper.hx +++ /dev/null @@ -1,453 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Path; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.ProcessHelper; -import lime.project.Haxelib; -import lime.project.HXProject; -import sys.io.Process; -import sys.FileSystem; - - -class TVOSHelper { - - - private static var initialized = false; - - - public static function build (project:HXProject, workingDirectory:String, additionalArguments:Array = null):Void { - - initialize (project); - - var commands = getXCodeArgs(project); - - if (project.targetFlags.exists ("archive")) { - - var configuration = project.environment.get ("CONFIGURATION"); - var platformName = project.environment.get ("PLATFORM_NAME"); - - commands.push ("archive"); - commands.push ("-scheme"); - commands.push (project.app.file); - commands.push ("-archivePath"); - commands.push (PathHelper.combine ("build", PathHelper.combine (configuration + "-" + platformName, project.app.file))); - - } - - if (additionalArguments != null) { - - commands = commands.concat (additionalArguments); - - } - - ProcessHelper.runCommand (workingDirectory, "xcodebuild", commands); - - } - - - public static function deploy (project:HXProject, workingDirectory:String):Void { - - initialize (project); - - var commands = getXCodeArgs (project); - var archiveCommands = commands.concat ([]); - - // generate xcarchive - var configuration = project.environment.get ("CONFIGURATION"); - var platformName = project.environment.get ("PLATFORM_NAME"); - - archiveCommands.push ("archive"); - archiveCommands.push ("-scheme"); - archiveCommands.push (project.app.file); - archiveCommands.push ("-archivePath"); - archiveCommands.push (PathHelper.combine ("build", PathHelper.combine (configuration + "-" + platformName, project.app.file))); - - ProcessHelper.runCommand (workingDirectory, "xcodebuild", archiveCommands); - - // generate IPA from xcarchive - var exportCommands = commands.concat ([]); - - var exportMethod = project.targetFlags.exists ("adhoc") ? "adhoc" - : project.targetFlags.exists ("development") ? "development" - : project.targetFlags.exists ("enterprise") ? "enterprise" - : "appstore"; - - exportCommands.push ("-exportArchive"); - exportCommands.push ("-archivePath"); - exportCommands.push (PathHelper.combine("build", PathHelper.combine (configuration + "-" + platformName, project.app.file + ".xcarchive"))); - exportCommands.push ("-exportOptionsPlist"); - exportCommands.push (PathHelper.combine (project.app.file, "exportOptions-" + exportMethod + ".plist")); - exportCommands.push ("-exportPath"); - exportCommands.push (PathHelper.combine ("dist", exportMethod)); - - ProcessHelper.runCommand (workingDirectory, "xcodebuild", exportCommands); - - } - - - private static function getXCodeArgs (project:HXProject):Array { - - var platformName = "appletvos"; - - if (project.targetFlags.exists ("simulator")) { - - platformName = "appletvsimulator"; - - } - - var configuration = "Release"; - - if (project.debug) { - - configuration = "Debug"; - - } - - var iphoneVersion = project.environment.get ("TVOS_VER"); - var commands = [ "-configuration", configuration, "PLATFORM_NAME=" + platformName, "SDKROOT=" + platformName + iphoneVersion ]; - - if (project.targetFlags.exists("simulator")) { - - commands.push ("-arch"); - commands.push ("x86_64"); - - } - - project.setenv ("PLATFORM_NAME", platformName); - project.setenv ("CONFIGURATION", configuration); - - // setting CONFIGURATION and PLATFORM_NAME in project.environment doesn't set them for xcodebuild so also pass via command line - var commands = [ "-configuration", configuration, "PLATFORM_NAME=" + platformName, "SDKROOT=" + platformName + iphoneVersion ]; - - if (project.targetFlags.exists ("simulator")) { - - commands.push ("-arch"); - commands.push ("x86_64"); - - } - - commands.push ("-project"); - commands.push (project.app.file + ".xcodeproj"); - - var xcodeVersions = getXcodeVersion() - .split(".") - .map(function (i:String) { - var ver = Std.parseInt(i); - return ver != null ? ver : 0; - }); - - if (xcodeVersions[0] >= 9) { - if (project.config.getBool('ios.allow-provisioning-updates', true)) { - commands.push("-allowProvisioningUpdates"); - } - if (project.config.getBool('ios.allow-provisioning-device-registration', true)) { - commands.push("-allowProvisioningDeviceRegistration"); - } - } - - return commands; - - } - - - private static function getIOSVersion (project:HXProject):Void { - - if (!project.environment.exists("TVOS_VER")) { - - if (!project.environment.exists("DEVELOPER_DIR")) { - - var proc = new Process ("xcode-select", ["--print-path"]); - var developer_dir = proc.stdout.readLine (); - proc.close (); - project.environment.set ("DEVELOPER_DIR", developer_dir); - - } - - var dev_path = project.environment.get ("DEVELOPER_DIR") + "/Platforms/AppleTVOS.platform/Developer/SDKs"; - - if (FileSystem.exists (dev_path)) { - - var best = ""; - var files = FileSystem.readDirectory (dev_path); - var extract_version = ~/^AppleTVOS(.*).sdk$/; - - for (file in files) { - - if (extract_version.match (file)) { - - var ver = extract_version.matched (1); - - if (ver > best) { - - best = ver; - - } - - } - - } - - if (best != "") { - - project.environment.set ("TVOS_VER", best); - - } - - } - - } - - } - - - private static function getOSXVersion ():String { - - var output = ProcessHelper.runProcess ("", "sw_vers", [ "-productVersion" ]); - return StringTools.trim (output); - - } - - - public static function getProvisioningFile ():String { - - var path = PathHelper.expand ("~/Library/MobileDevice/Provisioning Profiles"); - var files = FileSystem.readDirectory (path); - - for (file in files) { - - if (Path.extension (file) == "mobileprovision") { - - return path + "/" + file; - - } - - } - - return ""; - - } - - - public static function getSDKDirectory (project:HXProject):String { - - initialize (project); - - var platformName = "AppleTVOS"; - - if (project.targetFlags.exists ("simulator")) { - - platformName = "AppleTVSimulator"; - - } - - var process = new Process ("xcode-select", [ "--print-path" ]); - var directory = process.stdout.readLine (); - process.close (); - - if (directory == "" || directory.indexOf ("Run xcode-select") > -1) { - - directory = "/Applications/Xcode.app/Contents/Developer"; - - } - - directory += "/Platforms/" + platformName + ".platform/Developer/SDKs/" + platformName + project.environment.get ("TVOS_VER") + ".sdk"; - LogHelper.info(directory); - return directory; - - } - - - private static function getXcodeVersion ():String { - - var output = ProcessHelper.runProcess ("", "xcodebuild", [ "-version" ]); - var firstLine = output.split ("\n").shift (); - - return StringTools.trim (firstLine.substring ("Xcode".length, firstLine.length)); - - } - - - private static function initialize (project:HXProject):Void { - - if (!initialized) { - - getIOSVersion (project); - - initialized = true; - - } - - } - - - public static function launch (project:HXProject, workingDirectory:String):Void { - - initialize (project); - - var configuration = "Release"; - - if (project.debug) { - - configuration = "Debug"; - - } - - if (project.targetFlags.exists ("simulator")) { - - var applicationPath = ""; - - if (Path.extension (workingDirectory) == "app" || Path.extension (workingDirectory) == "ipa") { - - applicationPath = workingDirectory; - - } else { - - applicationPath = workingDirectory + "/build/" + configuration + "-appletvsimulator/" + project.app.file + ".app"; - - } - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - var launcher = PathHelper.findTemplate (templatePaths, "bin/ios-sim"); - Sys.command ("chmod", [ "+x", launcher ]); - - // device config - var defaultDevice = "apple-tv-1080p"; - var devices:Array = ["apple-tv-1080p"]; - var oldDevices:Map = ["appletv" => "apple-tv-1080p"]; - - var deviceFlag:String = null; - var deviceTypeID = null; - - // check if old device flag and convert to current - for (key in oldDevices.keys ()) { - - if (project.targetFlags.exists (key)) { - - deviceFlag = oldDevices[key]; - break; - - } - - } - - // check known device in command line args - if (deviceFlag == null) { - - for (i in 0...devices.length) { - - if (project.targetFlags.exists (devices[i])) { - - deviceFlag = devices[i]; - break; - - } - - } - - } - - // default to iphone 6 - if (deviceFlag == null) { - - deviceFlag = defaultDevice; - - } - - // check if device is available - // $ ios-sim showdevicetypes - var devicesOutput:String = ProcessHelper.runProcess ("", launcher, [ "showdevicetypes" ]); - var deviceTypeList:Array = devicesOutput.split ("\n"); - - for (i in 0...deviceTypeList.length) { - - var r = new EReg (deviceFlag + ",", "i"); - - if (r.match (deviceTypeList[i])) { - - deviceTypeID = deviceTypeList[i]; - break; - - } - - } - - if (deviceTypeID == null) { - - LogHelper.warn("Device \"" + deviceFlag + "\" was not found"); - - } else { - - LogHelper.info("Launch app on \"" + deviceTypeID + "\""); - - } - - // run command with --devicetypeid if exists - if (deviceTypeID != null) { - - ProcessHelper.runCommand ("", launcher, [ "launch", FileSystem.fullPath (applicationPath), /*"--sdk", project.environment.get ("IPHONE_VER"),*/ "--devicetypeid", deviceTypeID, "--timeout", "60" ]); - - } else { - - ProcessHelper.runCommand ("", launcher, [ "launch", FileSystem.fullPath (applicationPath), /*"--sdk", project.environment.get ("IPHONE_VER"), "--devicetypeid", deviceTypeID,*/ "--timeout", "60" ]); - - } - - } else { - - var applicationPath = ""; - - if (Path.extension (workingDirectory) == "app" || Path.extension (workingDirectory) == "ipa") { - - applicationPath = workingDirectory; - - } else { - - applicationPath = workingDirectory + "/build/" + configuration + "-appletvos/" + project.app.file + ".app"; - - } - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - var launcher = PathHelper.findTemplate (templatePaths, "bin/ios-deploy"); - Sys.command ("chmod", [ "+x", launcher ]); - - var xcodeVersion = getXcodeVersion (); - - ProcessHelper.runCommand ("", launcher, [ "install", "--noninteractive", "--debug", "--timeout", "5", "--bundle", FileSystem.fullPath (applicationPath) ]); - - } - - } - - - public static function sign (project:HXProject, workingDirectory:String):Void { - - initialize (project); - - var configuration = "Release"; - - if (project.debug) { - - configuration = "Debug"; - - } - - var identity = project.config.getString ("tvos.identity", "tvOS Developer"); - - var commands = [ "-s", identity, "CODE_SIGN_IDENTITY=" + identity ]; - - if (project.config.exists ("tvos.provisioning-profile")) { - - commands.push ("PROVISIONING_PROFILE=" + project.config.getString ("tvos.provisioning-profile")); - - } - - var applicationPath = "build/" + configuration + "-appletvos/" + project.app.file + ".app"; - commands.push (applicationPath); - - ProcessHelper.runCommand (workingDirectory, "codesign", commands, true, true); - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/TizenHelper.hx b/lime/tools/helpers/TizenHelper.hx deleted file mode 100644 index 2d0d5439e..000000000 --- a/lime/tools/helpers/TizenHelper.hx +++ /dev/null @@ -1,229 +0,0 @@ -package lime.tools.helpers; - - -import haxe.crypto.Crc32; -import haxe.io.Bytes; -import haxe.io.Eof; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Platform; -import sys.FileSystem; - - -class TizenHelper { - - - private static var cacheID:String = null; - private static var cacheUUID:String = null; - - - public static function createPackage (project:HXProject, workingDirectory:String, targetPath:String):Void { - - var keystore = null; - var password = null; - - if (project.keystore != null) { - - keystore = PathHelper.tryFullPath (project.keystore.path); - password = project.keystore.password; - - if (password == null) { - - password = prompt ("Keystore password", true); - Sys.println (""); - - } - - } - - if (keystore == null) { - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - keystore = PathHelper.findTemplate (templatePaths, "bin/debug.p12"); - password = "1234"; - - } - - var packageName = getUUID (project) + "-" + project.meta.version + "-"; - - if (project.targetFlags.exists ("simulator")) { - - packageName += "i386"; - - } else { - - packageName += "arm"; - - } - - packageName += ".tpk"; - - if (FileSystem.exists (PathHelper.combine (workingDirectory, packageName))) { - - try { - - FileSystem.deleteFile ((PathHelper.combine (workingDirectory, packageName))); - - } catch (e:Dynamic) {} - - } - - runCommand (project, workingDirectory, "native-packaging" , [ "--sign-author-key", keystore, "--sign-author-pwd", password ]); - - } - - - public static function getUUID (project:HXProject):String { - - if (cacheID != project.meta.packageName) { - - if (project.meta.packageName != null || project.meta.packageName.length == 10 || project.meta.packageName.indexOf (".") == -1) { - - var bytes = Bytes.ofString (project.meta.packageName); - var crc = Crc32.make (bytes); - cacheUUID = StringHelper.generateUUID (10, null, crc); - - } else { - - cacheUUID = project.meta.packageName; - - } - - cacheID = project.meta.packageName; - - } - - return cacheUUID; - - } - - - public static function install (project:HXProject, workingDirectory:String):Void { - - var packageName = getUUID (project) + "-" + project.meta.version + "-"; - - if (project.targetFlags.exists ("simulator")) { - - packageName += "i386"; - - } else { - - packageName += "arm"; - - } - - packageName += ".tpk"; - - runCommand (project, "", "native-install", [ "--package", FileSystem.fullPath (workingDirectory + "/" + packageName) ]); - - } - - - public static function launch (project:HXProject):Void { - - runCommand (project, "", "native-run", [ "--package", getUUID (project) ]); - - } - - - private static function prompt (name:String, ?passwd:Bool):String { - - Sys.print (name + ": "); - - if (passwd) { - var s = new StringBuf (); - var c; - while ((c = Sys.getChar(false)) != 13) - s.addChar (c); - return s.toString (); - } - - try { - - return Sys.stdin ().readLine (); - - } catch (e:Eof) { - - return ""; - - } - - } - - - private static function runCommand (project:HXProject, workingDirectory:String, command:String, args:Array):Void { - - var sdkDirectory = ""; - - if (project.environment.exists ("TIZEN_SDK")) { - - sdkDirectory = project.environment.get ("TIZEN_SDK"); - - } else { - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - sdkDirectory = "C:\\Development\\Tizen\\tizen-sdk"; - - } else { - - sdkDirectory = "~/Development/Tizen/tizen-sdk"; - - } - - } - - ProcessHelper.runCommand (workingDirectory, PathHelper.combine (sdkDirectory, "tools/ide/bin/" + command), args); - - } - - - public static function trace (project:HXProject, follow:Bool = true):Void { - - /*var args = []; - - if (follow) { - - args.push ("-f"); - - } - - args.push (project.meta.packageName); - - runPalmCommand (project, "", "log", args);*/ - - var sdkDirectory = ""; - - if (project.environment.exists ("TIZEN_SDK")) { - - sdkDirectory = project.environment.get ("TIZEN_SDK"); - - } else { - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - sdkDirectory = "C:\\Development\\Tizen\\tizen-sdk"; - - } else { - - sdkDirectory = "~/Development/Tizen/tizen-sdk"; - - } - - } - - //var args = [ "--package", project.meta.packageName ]; - //var args = [ "dlog", project.meta.packageName + ":V", "*:E" ]; - var args = [ "dlog", project.app.file + ":V", "*:F" ]; - - ProcessHelper.runCommand ("", PathHelper.combine (sdkDirectory, "tools/sdb"), [ "dlog", "-c" ]); - ProcessHelper.runCommand ("", PathHelper.combine (sdkDirectory, "tools/sdb"), args); - //runCommand (project, "", "native-debug", [ "-p", project.meta.packageName ]); - - } - - -} diff --git a/lime/tools/helpers/WatchHelper.hx b/lime/tools/helpers/WatchHelper.hx deleted file mode 100644 index 8f3febda2..000000000 --- a/lime/tools/helpers/WatchHelper.hx +++ /dev/null @@ -1,117 +0,0 @@ -package lime.tools.helpers; - - -import lime.project.Architecture; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Platform; -import sys.FileSystem; - - -class WatchHelper { - - - public static function getCurrentCommand ():String { - - var args = Sys.args (); - args.remove ("-watch"); - - if (HaxelibHelper.pathOverrides.exists ("lime-tools")) { - - var tools = HaxelibHelper.pathOverrides.get ("lime-tools"); - - return "neko " + tools + "/tools.n " + args.join (" "); - - } else { - - args.pop (); - - return "lime " + args.join (" "); - - } - - } - - - public static function processHXML (project:HXProject, hxml:String):Array { - - var directories = []; - var outputPath = PathHelper.tryFullPath (project.app.path); - var dir, fullPath = null; - - for (line in hxml.split ("\n")) { - - if (StringTools.startsWith (line, "-cp ")) { - - dir = StringTools.trim (line.substr (4)); - - if (FileSystem.exists (dir)) { - - fullPath = PathHelper.tryFullPath (dir); - - if (!StringTools.startsWith (fullPath, outputPath)) { - - // directories.push (fullPath); - directories.push (dir); - - } - - } - - } - - } - - return directories; - - } - - - public static function watch (project:HXProject, command:String, directories:Array):Void { - - var suffix = switch (PlatformHelper.hostPlatform) { - - case Platform.WINDOWS: "-windows.exe"; - case Platform.MAC: "-mac"; - case Platform.LINUX: "-linux"; - default: return; - - } - - if (suffix == "-linux") { - - if (PlatformHelper.hostArchitecture == Architecture.X86) { - - suffix += "32"; - - } else { - - suffix += "64"; - - } - - } - - var templatePaths = [ PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates") ].concat (project.templatePaths); - var node = PathHelper.findTemplate (templatePaths, "bin/node/node" + suffix); - var bin = PathHelper.findTemplate (templatePaths, "bin/node/watch/cli-custom.js"); - - if (PlatformHelper.hostPlatform != Platform.WINDOWS) { - - Sys.command ("chmod", [ "+x", node ]); - - } - - var args = [ bin, command ]; - args = args.concat (directories); - - args.push ("--exit"); - args.push ("--ignoreDotFiles"); - args.push ("--ignoreUnreadable"); - - ProcessHelper.runCommand ("", node, args); - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/WebOSHelper.hx b/lime/tools/helpers/WebOSHelper.hx deleted file mode 100644 index ed60685b5..000000000 --- a/lime/tools/helpers/WebOSHelper.hx +++ /dev/null @@ -1,78 +0,0 @@ -package lime.tools.helpers; - - -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.project.HXProject; -import lime.project.Platform; - - -class WebOSHelper { - - - public static function createPackage (project:HXProject, workingDirectory:String, targetPath:String):Void { - - runPalmCommand (project, workingDirectory, "package" , [ targetPath ]); - - } - - - public static function install (project:HXProject, workingDirectory:String):Void { - - runPalmCommand (project, workingDirectory, "install", [ project.meta.packageName + "_" + project.meta.version + "_all.ipk" ]); - - } - - - public static function launch (project:HXProject):Void { - - runPalmCommand (project, "", "launch", [ project.meta.packageName ]); - - } - - - private static function runPalmCommand (project:HXProject, workingDirectory:String, command:String, args:Array):Void { - - var sdkDirectory = ""; - - if (project.environment.exists ("PalmSDK")) { - - sdkDirectory = project.environment.get ("PalmSDK"); - - } else { - - if (PlatformHelper.hostPlatform == Platform.WINDOWS) { - - sdkDirectory = "c:\\Program Files (x86)\\HP webOS\\SDK\\"; - - } else { - - sdkDirectory = "/opt/PalmSDK/Current/"; - - } - - } - - ProcessHelper.runCommand (workingDirectory, PathHelper.combine (sdkDirectory, "bin/palm-" + command), args); - - } - - - public static function trace (project:HXProject, follow:Bool = true):Void { - - var args = []; - - if (follow) { - - args.push ("-f"); - - } - - args.push (project.meta.packageName); - - runPalmCommand (project, "", "log", args); - - } - - -} \ No newline at end of file diff --git a/lime/tools/helpers/ZipHelper.hx b/lime/tools/helpers/ZipHelper.hx deleted file mode 100644 index 640f12507..000000000 --- a/lime/tools/helpers/ZipHelper.hx +++ /dev/null @@ -1,125 +0,0 @@ -package lime.tools.helpers; - - -import haxe.io.Bytes; -import haxe.io.Path; -import haxe.zip.Entry; -import haxe.zip.Writer; -import sys.io.File; -import sys.FileSystem; - - -class ZipHelper { - - - public static function compress (path:String, targetPath:String = ""):Void { - - if (targetPath == "") { - - targetPath = path; - - } - - PathHelper.mkdir (Path.directory (targetPath)); - - if (PlatformHelper.hostPlatform == WINDOWS || !FileSystem.isDirectory (path)) { - - var files = new List (); - - if (FileSystem.isDirectory (path)) { - - readDirectory (path, "", files); - - } else { - - readFile (path, "", files); - - } - - var output = File.write (targetPath, true); - - /*if (Path.extension (path) == "crx") { - - var input = File.read (defines.get ("KEY_STORE"), true); - var publicKey:Bytes = input.readAll (); - input.close (); - - var signature = SHA1.encode ("this isn't working"); - - output.writeString ("Cr24"); // magic number - output.writeInt32 (Int32.ofInt (2)); // CRX file format version - output.writeInt32 (Int32.ofInt (publicKey.length)); // public key length - output.writeInt32 (Int32.ofInt (signature.length)); // signature length - output.writeBytes (publicKey, 0, publicKey.length); - output.writeString (signature); - - //output.writeBytes (); // public key contents "The contents of the author's RSA public key, formatted as an X509 SubjectPublicKeyInfo block. " - //output.writeBytes (); // "The signature of the ZIP content using the author's private key. The signature is created using the RSA algorithm with the SHA-1 hash function." - - }*/ - - LogHelper.info ("", " - \x1b[1mWriting file:\x1b[0m " + targetPath); - - var writer = new Writer (output); - writer.write (cast files); - output.close (); - - } else { - - ProcessHelper.runCommand (path, "zip", [ "-r", PathHelper.relocatePath (targetPath, path), "./" ]); - - } - - } - - - private static function readDirectory (basePath:String, path:String, files:List):Void { - - var directory = PathHelper.combine (basePath, path); - - for (file in FileSystem.readDirectory (directory)) { - - var fullPath = PathHelper.combine (directory, file); - var childPath = PathHelper.combine (path, file); - - if (FileSystem.isDirectory (fullPath)) { - - readDirectory (basePath, childPath, files); - - } else { - - readFile (basePath, childPath, files); - - } - - } - - } - - - private static function readFile (basePath:String, path:String, files:List):Void { - - if (Path.extension (path) != "zip" && Path.extension (path) != "crx" && Path.extension (path) != "wgt") { - - var fullPath = PathHelper.combine (basePath, path); - - var name = path; - //var date = FileSystem.stat (directory + "/" + file).ctime; - var date = Date.now (); - - LogHelper.info ("", " - \x1b[1mCompressing file:\x1b[0m " + fullPath); - - var input = File.read (fullPath, true); - var data = input.readAll (); - input.close (); - - var entry:Entry = { fileName:name, fileSize:data.length, fileTime:date, compressed:false, dataSize:data.length, data:data, crc32:null }; - - files.push (entry); - - } - - } - - -} \ No newline at end of file diff --git a/lime/tools/platforms/AIRPlatform.hx b/lime/tools/platforms/AIRPlatform.hx deleted file mode 100644 index 8030154ee..000000000 --- a/lime/tools/platforms/AIRPlatform.hx +++ /dev/null @@ -1,353 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import lime.project.AssetType; -import lime.project.HXProject; -import lime.project.Icon; -import lime.project.Platform; -import lime.project.PlatformType; -import lime.tools.helpers.AIRHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.FlashHelper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.ZipHelper; -import sys.io.File; -import sys.FileSystem; - - -class AIRPlatform extends FlashPlatform { - - - private var iconData:Array; - private var targetPlatform:Platform; - private var targetPlatformType:PlatformType; - - - public function new (command:String, _project:HXProject, targetFlags:Map) { - - super (command, _project, targetFlags); - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("air.output-directory", "air")); - - if (targetFlags.exists ("android")) { - - targetPlatform = Platform.ANDROID; - targetPlatformType = MOBILE; - - } else if (targetFlags.exists ("ios")) { - - targetPlatform = Platform.IOS; - targetPlatformType = MOBILE; - - } else if (targetFlags.exists ("windows")) { - - targetPlatform = Platform.WINDOWS; - targetPlatformType = DESKTOP; - - } else if (targetFlags.exists ("mac")) { - - targetPlatform = Platform.MAC; - targetPlatformType = DESKTOP; - - } else { - - targetPlatform = PlatformHelper.hostPlatform; - targetPlatformType = DESKTOP; - - } - - } - - - public override function build ():Void { - - super.build (); - - if (!project.defines.exists ("AIR_SDK")) { - - LogHelper.error ("You must define AIR_SDK with the path to your AIR SDK"); - - } - - // TODO: Should we package on desktop in "deploy" command instead? - - if (targetPlatformType != DESKTOP) { - - var files = [ project.app.file + ".swf" ]; - for (asset in project.assets) { - - if (asset.embed == false && asset.type != TEMPLATE) { - - files.push (asset.targetPath); - - } - - } - - for (icon in iconData) { - - files.push (icon.path); - - } - - var targetPath = switch (targetPlatform) { - - case ANDROID: "bin/" + project.app.file + ".apk"; - case IOS: "bin/" + project.app.file + ".ipa"; - default: "bin/" + project.app.file + ".air"; - - } - - AIRHelper.build (project, targetDirectory, targetPlatform, targetPath, "application.xml", files, "bin"); - - } - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - if (targetFlags.exists ("gdrive") || targetFlags.exists ("zip")) { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "AIR"); - - } else { - - var rootDirectory = targetDirectory + "/bin"; - var paths = PathHelper.readDirectory (rootDirectory, [ project.app.file + ".apk", project.app.file + ".ipa", project.app.file + ".air" ]); - var files = []; - - for (path in paths) { - - files.push (path.substr (rootDirectory.length + 1)); - - } - - var name = project.meta.title + " (" + project.meta.version + " build " + project.meta.buildNumber + ")"; - - switch (targetPlatform) { - - case WINDOWS: - - name += " (Windows)"; - - case MAC: - - name += " (macOS)"; - - case IOS: - - name += " (iOS).ipa"; - - case ANDROID: - - name += " (Android).apk"; - - default: - - } - - var outputPath = "dist/" + name; - - PathHelper.mkdir (targetDirectory + "/dist"); - - outputPath = AIRHelper.build (project, targetDirectory, targetPlatform, outputPath, "application.xml", files, "bin"); - - if (targetPlatformType == DESKTOP) { - - ZipHelper.compress (PathHelper.combine (targetDirectory, outputPath), PathHelper.combine (targetDirectory, "dist/" + name + ".zip")); - - } - - } - - } - - - public override function install ():Void { - - // TODO: Make separate install step - - } - - - public override function run ():Void { - - AIRHelper.run (project, targetDirectory, targetPlatform, "application.xml", "bin"); - - } - - - public override function trace ():Void { - - AIRHelper.trace (project, targetDirectory, targetPlatform, "application.xml", "bin"); - - } - - - public override function uninstall ():Void { - - AIRHelper.uninstall (project, targetDirectory, targetPlatform, "application.xml", "bin"); - - } - - - public override function update ():Void { - - var destination = targetDirectory + "/bin/"; - PathHelper.mkdir (destination); - - project = project.clone (); - - embedded = FlashHelper.embedAssets (project, targetDirectory); - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - context.AIR_SDK_VERSION = project.config.getString ("air.sdk-version", "28.0"); - - var buildNumber = Std.string (context.APP_BUILD_NUMBER); - - if (buildNumber.length <= 3) { - - context.APP_BUILD_NUMBER_SPLIT = buildNumber; - - } else { - - var major = null; - - var patch = buildNumber.substr (-3); - buildNumber = buildNumber.substr (0, -3); - - var minor = buildNumber.substr (-Std.int (Math.min (buildNumber.length, 3))); - buildNumber = buildNumber.substr (0, -minor.length); - - if (buildNumber.length > 0) { - - major = buildNumber.substr (-Std.int (Math.min (buildNumber.length, 3))); - buildNumber = buildNumber.substr (0, -major.length); - - } - - var buildNumberSplit = minor + "." + patch; - if (major != null) buildNumberSplit = major + "." + buildNumberSplit; - - context.APP_BUILD_NUMBER_SPLIT = buildNumberSplit; - - if (buildNumber.length > 0) { - - LogHelper.warn ("Application build number " + buildNumber + buildNumberSplit + " exceeds 9 digits"); - - } - - } - - var iconSizes = [ 16, 29, 32, 36, 40, 48, 50, 57, 58, 60, 72, 75, 76, 80, 87, 96, 100, 114, 120, 128, 144, 152, 167, 180, 192, 512, 1024 ]; - var icons = project.icons; - iconData = []; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - for (size in iconSizes) { - - if (IconHelper.createIcon (icons, size, size, targetDirectory + "/bin/_res/icon-" + size + ".png")) { - - iconData.push ({ size: size, path: "_res/icon-" + size + ".png" }); - - } - - } - - if (iconData.length > 0) context.icons = iconData; - - context.extensions = new Array(); - - for (dependency in project.dependencies) { - - if (StringTools.endsWith(dependency.path, ".ane")) { - - var extension:Dynamic = { name: dependency.name }; - context.extensions.push(extension); - context.HAXE_FLAGS += "\n-swf-lib " + dependency.path; - - } - - } - - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "air/hxml", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "air/template", targetDirectory, context); - - if (embedded) { - - var files = [ "debug.hxml", "release.hxml", "final.hxml" ]; - var path, hxml, lines, output; - - for (file in files) { - - path = targetDirectory + "/haxe/" + file; - hxml = File.getContent (path); - - if (hxml.indexOf ("-swf-header") > -1) { - - lines = ~/[\r\n]+/g.split (hxml); - output = []; - - for (line in lines) { - - if (line.indexOf ("-swf-header") > -1) continue; - output.push (line); - - } - - if (output.length < lines.length) { - - File.saveContent (path, output.join ("\n")); - - } - - } - - } - - } - - for (asset in project.assets) { - - if (asset.type == AssetType.TEMPLATE || asset.embed == false /*|| !usesLime*/) { - - var path = PathHelper.combine (destination, asset.targetPath); - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path, context); - - } - - } - - } - - - @ignore public override function rebuild ():Void {} - - -} \ No newline at end of file diff --git a/lime/tools/platforms/AndroidPlatform.hx b/lime/tools/platforms/AndroidPlatform.hx deleted file mode 100644 index 2ba22fa1e..000000000 --- a/lime/tools/platforms/AndroidPlatform.hx +++ /dev/null @@ -1,481 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import haxe.Template; -import lime.tools.helpers.AndroidHelper; -import lime.tools.helpers.ArrayHelper; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.WatchHelper; -import lime.project.Architecture; -import lime.project.AssetType; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Icon; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - - -class AndroidPlatform extends PlatformTarget { - - - private var deviceID:String; - - - public function new (command:String, _project:HXProject, targetFlags:Map) { - - super (command, _project, targetFlags); - - if (command != "display" && command != "clean") { - - project = project.clone (); - - if (!project.environment.exists ("ANDROID_SETUP")) { - - LogHelper.error ("You need to run \"lime setup android\" before you can use the Android target"); - - } - - AndroidHelper.initialize (project); - - if (deviceID == null && project.targetFlags.exists ("device")) { - - deviceID = project.targetFlags.get ("device") + ":5555"; - - } - - } - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("android.output-directory", "android")); - - } - - - public override function build ():Void { - - var destination = targetDirectory + "/bin"; - var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; - var sourceSet = destination + "/app/src/main"; - - var hasARMV5 = (ArrayHelper.containsValue (project.architectures, Architecture.ARMV5) || ArrayHelper.containsValue (project.architectures, Architecture.ARMV6)); - var hasARMV7 = ArrayHelper.containsValue (project.architectures, Architecture.ARMV7); - var hasX86 = ArrayHelper.containsValue (project.architectures, Architecture.X86); - - var architectures = []; - - if (hasARMV5) architectures.push (Architecture.ARMV5); - if (hasARMV7 || (!hasARMV5 && !hasX86)) architectures.push (Architecture.ARMV7); - if (hasX86) architectures.push (Architecture.X86); - - for (architecture in architectures) { - - var haxeParams = [ hxml, "-D", "android", "-D", "PLATFORM=android-14" ]; - var cppParams = [ "-Dandroid", "-DPLATFORM=android-14" ]; - var path = sourceSet + "/jniLibs/armeabi"; - var suffix = ".so"; - - if (architecture == Architecture.ARMV7) { - - haxeParams.push ("-D"); - haxeParams.push ("HXCPP_ARMV7"); - cppParams.push ("-DHXCPP_ARMV7"); - - if (hasARMV5) { - - path = sourceSet + "/jniLibs/armeabi-v7a"; - - } - - suffix = "-v7.so"; - - } else if (architecture == Architecture.X86) { - - haxeParams.push ("-D"); - haxeParams.push ("HXCPP_X86"); - cppParams.push ("-DHXCPP_X86"); - path = sourceSet + "/jniLibs/x86"; - suffix = "-x86.so"; - - } - - for (ndll in project.ndlls) { - - FileHelper.copyLibrary (project, ndll, "Android", "lib", suffix, path, project.debug, ".so"); - - } - - ProcessHelper.runCommand ("", "haxe", haxeParams); - - if (noOutput) return; - - CPPHelper.compile (project, targetDirectory + "/obj", cppParams); - - FileHelper.copyIfNewer (targetDirectory + "/obj/libApplicationMain" + (project.debug ? "-debug" : "") + suffix, path + "/libApplicationMain.so"); - - } - - if (!ArrayHelper.containsValue (project.architectures, Architecture.ARMV7) || !hasARMV5) { - - if (FileSystem.exists (sourceSet + "/jniLibs/armeabi-v7a")) { - - PathHelper.removeDirectory (sourceSet + "/jniLibs/armeabi-v7a"); - - } - - } - - if (!hasX86) { - - if (FileSystem.exists (sourceSet + "/jniLibs/x86")) { - - PathHelper.removeDirectory (sourceSet + "/jniLibs/x86"); - - } - - } - - if (noOutput) return; - - AndroidHelper.build (project, destination); - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "Android"); - - } - - - public override function display ():Void { - - Sys.println (getDisplayHXML ()); - - } - - - private function getDisplayHXML ():String { - - var hxml = PathHelper.findTemplate (project.templatePaths, "android/hxml/" + buildType + ".hxml"); - - var context = project.templateContext; - context.CPP_DIR = targetDirectory + "/obj"; - context.OUTPUT_DIR = targetDirectory; - - var template = new Template (File.getContent (hxml)); - - return template.execute (context) + "\n-D display"; - - } - - - public override function install ():Void { - - var build = "-debug"; - - if (project.keystore != null) { - - build = "-release"; - - } - - var outputDirectory = null; - - if (project.config.exists ("android.gradle-build-directory")) { - - outputDirectory = PathHelper.combine (project.config.getString ("android.gradle-build-directory"), project.app.file + "/app/outputs/apk"); - - } else { - - outputDirectory = PathHelper.combine (FileSystem.fullPath (targetDirectory), "bin/app/build/outputs/apk"); - - } - - var apkPath = PathHelper.combine (outputDirectory, project.app.file + build + ".apk"); - - deviceID = AndroidHelper.install (project, apkPath, deviceID); - - } - - - public override function rebuild ():Void { - - var armv5 = (command == "rebuild" || ArrayHelper.containsValue (project.architectures, Architecture.ARMV5) || ArrayHelper.containsValue (project.architectures, Architecture.ARMV6)); - var armv7 = (command == "rebuild" || ArrayHelper.containsValue (project.architectures, Architecture.ARMV7)); - var x86 = (command == "rebuild" || ArrayHelper.containsValue (project.architectures, Architecture.X86)); - - var commands = []; - - if (armv5) commands.push ([ "-Dandroid", "-DPLATFORM=android-14" ]); - if (armv7) commands.push ([ "-Dandroid", "-DHXCPP_ARMV7", "-DHXCPP_ARM7", "-DPLATFORM=android-14" ]); - if (x86) commands.push ([ "-Dandroid", "-DHXCPP_X86", "-DPLATFORM=android-14" ]); - - CPPHelper.rebuild (project, commands); - - } - - - public override function run ():Void { - - AndroidHelper.run (project.meta.packageName + "/" + project.meta.packageName + ".MainActivity", deviceID); - - } - - - public override function trace ():Void { - - AndroidHelper.trace (project, project.debug, deviceID); - - } - - - public override function uninstall ():Void { - - AndroidHelper.uninstall (project.meta.packageName, deviceID); - - } - - - public override function update ():Void { - - project = project.clone (); - - for (asset in project.assets) { - - if (asset.embed && asset.sourcePath == "") { - - var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path); - asset.sourcePath = path; - - } - - } - - //initialize (project); - - var destination = targetDirectory + "/bin"; - var sourceSet = destination + "/app/src/main"; - PathHelper.mkdir (sourceSet); - PathHelper.mkdir (sourceSet + "/res/drawable-ldpi/"); - PathHelper.mkdir (sourceSet + "/res/drawable-mdpi/"); - PathHelper.mkdir (sourceSet + "/res/drawable-hdpi/"); - PathHelper.mkdir (sourceSet + "/res/drawable-xhdpi/"); - - for (asset in project.assets) { - - if (asset.type != AssetType.TEMPLATE) { - - var targetPath = ""; - - switch (asset.type) { - - default: - //case SOUND, MUSIC: - - //var extension = Path.extension (asset.sourcePath); - //asset.flatName += ((extension != "") ? "." + extension : ""); - - //asset.resourceName = asset.flatName; - targetPath = PathHelper.combine (sourceSet + "/assets/", asset.resourceName); - - //asset.resourceName = asset.id; - //targetPath = sourceSet + "/res/raw/" + asset.flatName + "." + Path.extension (asset.targetPath); - - //default: - - //asset.resourceName = asset.flatName; - //targetPath = sourceSet + "/assets/" + asset.resourceName; - - } - - FileHelper.copyAssetIfNewer (asset, targetPath); - - } - - } - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - var context = project.templateContext; - - context.CPP_DIR = targetDirectory + "/obj"; - context.OUTPUT_DIR = targetDirectory; - context.ANDROID_INSTALL_LOCATION = project.config.getString ("android.install-location", "auto"); - context.ANDROID_MINIMUM_SDK_VERSION = project.config.getInt ("android.minimum-sdk-version", 14); - context.ANDROID_TARGET_SDK_VERSION = project.config.getInt ("android.target-sdk-version", 26); - context.ANDROID_EXTENSIONS = project.config.getArrayString ("android.extension"); - context.ANDROID_PERMISSIONS = project.config.getArrayString ("android.permission", [ "android.permission.WAKE_LOCK", "android.permission.INTERNET", "android.permission.VIBRATE", "android.permission.ACCESS_NETWORK_STATE" ]); - context.ANDROID_GRADLE_VERSION = project.config.getString ("android.gradle-version", "2.10"); - context.ANDROID_GRADLE_PLUGIN = project.config.getString ("android.gradle-plugin", "2.1.0"); - context.ANDROID_LIBRARY_PROJECTS = []; - - if (!project.environment.exists ("ANDROID_SDK") || !project.environment.exists ("ANDROID_NDK_ROOT")) { - - var command = "lime"; - var toolsBase = Type.resolveClass ("CommandLineTools"); - if (toolsBase != null) - command = Reflect.field (toolsBase, "commandName"); - - LogHelper.error ("You must define ANDROID_SDK and ANDROID_NDK_ROOT to target Android, please run '" + command + " setup android' first"); - Sys.exit (1); - - } - - if (project.config.exists ("android.gradle-build-directory")) { - - context.ANDROID_GRADLE_BUILD_DIRECTORY = project.config.getString ("android.gradle-build-directory"); - - } - - if (project.config.exists ("android.build-tools-version")) { - - context.ANDROID_BUILD_TOOLS_VERSION = project.config.getString ("android.build-tools-version"); - - } else { - - context.ANDROID_BUILD_TOOLS_VERSION = AndroidHelper.getBuildToolsVersion (project); - - } - - var escaped = ~/([ #!=\\:])/g; - context.ANDROID_SDK_ESCAPED = escaped.replace(context.ENV_ANDROID_SDK, "\\$1"); - context.ANDROID_NDK_ROOT_ESCAPED = escaped.replace(context.ENV_ANDROID_NDK_ROOT, "\\$1"); - - if (Reflect.hasField (context, "KEY_STORE")) context.KEY_STORE = StringTools.replace (context.KEY_STORE, "\\", "\\\\"); - if (Reflect.hasField (context, "KEY_STORE_ALIAS")) context.KEY_STORE_ALIAS = StringTools.replace (context.KEY_STORE_ALIAS, "\\", "\\\\"); - if (Reflect.hasField (context, "KEY_STORE_PASSWORD")) context.KEY_STORE_PASSWORD = StringTools.replace (context.KEY_STORE_PASSWORD, "\\", "\\\\"); - if (Reflect.hasField (context, "KEY_STORE_ALIAS_PASSWORD")) context.KEY_STORE_ALIAS_PASSWORD = StringTools.replace (context.KEY_STORE_ALIAS_PASSWORD, "\\", "\\\\"); - - var index = 1; - - for (dependency in project.dependencies) { - - if (dependency.path != "" && FileSystem.exists (dependency.path) && FileSystem.isDirectory (dependency.path) && (FileSystem.exists (PathHelper.combine (dependency.path, "project.properties")) || FileSystem.exists (PathHelper.combine (dependency.path, "build.gradle")))) { - - var name = dependency.name; - if (name == "") name = "project" + index; - - context.ANDROID_LIBRARY_PROJECTS.push ({ name: name, index: index, path: "deps/" + name, source: dependency.path }); - index++; - - } - - } - - var iconTypes = [ "ldpi", "mdpi", "hdpi", "xhdpi", "xxhdpi", "xxxhdpi" ]; - var iconSizes = [ 36, 48, 72, 96, 144, 192 ]; - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - for (i in 0...iconTypes.length) { - - if (IconHelper.createIcon (icons, iconSizes[i], iconSizes[i], sourceSet + "/res/drawable-" + iconTypes[i] + "/icon.png")) { - - context.HAS_ICON = true; - - } - - } - - IconHelper.createIcon (icons, 732, 412, sourceSet + "/res/drawable-xhdpi/ouya_icon.png"); - - var packageDirectory = project.meta.packageName; - packageDirectory = sourceSet + "/java/" + packageDirectory.split (".").join ("/"); - PathHelper.mkdir (packageDirectory); - - for (javaPath in project.javaPaths) { - - try { - - if (FileSystem.isDirectory (javaPath)) { - - FileHelper.recursiveCopy (javaPath, sourceSet + "/java", context, true); - - } else { - - if (Path.extension (javaPath) == "jar") { - - FileHelper.copyIfNewer (javaPath, destination + "/app/libs/" + Path.withoutDirectory (javaPath)); - - } else { - - FileHelper.copyIfNewer (javaPath, sourceSet + "/java/" + Path.withoutDirectory (javaPath)); - - } - - } - - } catch (e:Dynamic) {} - - // throw"Could not find javaPath " + javaPath +" required by extension."; - - //} - - } - - for (library in context.ANDROID_LIBRARY_PROJECTS) { - - FileHelper.recursiveCopy (library.source, destination + "/deps/" + library.name, context, true); - - } - - FileHelper.recursiveSmartCopyTemplate (project, "android/template", destination, context); - FileHelper.copyFileTemplate (project.templatePaths, "android/MainActivity.java", packageDirectory + "/MainActivity.java", context); - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "android/hxml", targetDirectory + "/haxe", context); - - for (asset in project.assets) { - - if (asset.type == AssetType.TEMPLATE) { - - var targetPath = PathHelper.combine (destination, asset.targetPath); - PathHelper.mkdir (Path.directory (targetPath)); - FileHelper.copyAsset (asset, targetPath, context); - - } - - } - - } - - - public override function watch ():Void { - - var dirs = WatchHelper.processHXML (project, getDisplayHXML ()); - var command = WatchHelper.getCurrentCommand (); - WatchHelper.watch (project, command, dirs); - - } - - -} \ No newline at end of file diff --git a/lime/tools/platforms/BlackBerryPlatform.hx b/lime/tools/platforms/BlackBerryPlatform.hx deleted file mode 100644 index 24b65f002..000000000 --- a/lime/tools/platforms/BlackBerryPlatform.hx +++ /dev/null @@ -1,383 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import haxe.Template; -import lime.tools.helpers.BlackBerryHelper; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.HTML5Helper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.ProcessHelper; -import lime.project.AssetType; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Icon; -import lime.project.NDLL; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - - -class BlackBerryPlatform extends PlatformTarget { - - - private var outputFile:String; - - - public function new (command:String, _project:HXProject, targetFlags:Map) { - - super (command, _project, targetFlags); - - if (!project.targetFlags.exists ("html5")) { - - targetDirectory = project.app.path + "/blackberry"; - outputFile = targetDirectory + "/bin/" + PathHelper.safeFileName (project.app.file); - - } else { - - targetDirectory = project.app.path + "/blackberry"; - outputFile = targetDirectory + "/src/" + project.app.file + ".js"; - - } - - if (command != "display" && command != "clean") { - - project = project.clone (); - - if (!project.environment.exists ("BLACKBERRY_SETUP")) { - - LogHelper.error ("You need to run \"lime setup blackberry\" before you can use the BlackBerry target"); - - } - - BlackBerryHelper.initialize (project); - - } - - } - - - public override function build ():Void { - - if (project.app.main != null) { - - var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; - ProcessHelper.runCommand ("", "haxe", [ hxml, "-D", "blackberry" ] ); - - } - - if (noOutput) return; - - if (!project.targetFlags.exists ("html5")) { - - var destination = targetDirectory + "/bin/"; - var arch = ""; - - if (project.targetFlags.exists ("simulator")) { - - arch = "-x86"; - - } - - var haxelib = new Haxelib ("lime"); - var ndlls = project.ndlls.copy (); - ndlls.push (new NDLL ("libTouchControlOverlay", haxelib)); - - for (ndll in ndlls) { - - FileHelper.copyLibrary (project, ndll, "BlackBerry", "", arch + ".so", destination, project.debug, ".so"); - - } - - var linkedLibraries = [ new NDLL ("libSDL", haxelib), new NDLL ("libOpenAL", haxelib) ]; - - for (ndll in linkedLibraries) { - - var deviceLib = ndll.name + ".so"; - var simulatorLib = ndll.name + "-x86.so"; - - if (project.targetFlags.exists ("simulator")) { - - if (FileSystem.exists (destination + deviceLib)) { - - FileSystem.deleteFile (destination + deviceLib); - - } - - FileHelper.copyIfNewer (PathHelper.getLibraryPath (ndll, "BlackBerry", "", "-x86.so"), destination + simulatorLib); - - } else { - - if (FileSystem.exists (destination + simulatorLib)) { - - FileSystem.deleteFile (destination + simulatorLib); - - } - - FileHelper.copyIfNewer (PathHelper.getLibraryPath (ndll, "BlackBerry", "", ".so"), destination + deviceLib); - - } - - } - - CPPHelper.compile (project, targetDirectory + "/obj", [ "-Dblackberry" ]); - FileHelper.copyIfNewer (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : ""), outputFile); - BlackBerryHelper.createPackage (project, targetDirectory, "bin/bar-descriptor.xml", project.meta.packageName + "_" + project.meta.version + ".bar"); - - } else { - - if (project.targetFlags.exists ("minify")) { - - HTML5Helper.minify (project, targetDirectory + "/src/" + project.app.file + ".js"); - - } - - BlackBerryHelper.createWebWorksPackage (project, targetDirectory + "/src", targetDirectory + "/bin"); - - } - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "BlackBerry"); - - } - - - public override function display ():Void { - - var context = project.templateContext; - context.OUTPUT_DIR = targetDirectory; - - var hxml = ""; - - if (!project.targetFlags.exists ("html5")) { - - hxml = PathHelper.findTemplate (project.templatePaths, "blackberry/hxml/" + buildType + ".hxml"); - context.CPP_DIR = targetDirectory + "/obj"; - - } else { - - hxml = PathHelper.findTemplate (project.templatePaths, "html5/hxml/" + buildType + ".hxml"); - context.OUTPUT_FILE = outputFile; - - } - - var template = new Template (File.getContent (hxml)); - - Sys.println (template.execute (context)); - Sys.println ("-D display"); - - } - - - public override function rebuild ():Void { - - var device = (command == "rebuild" || !targetFlags.exists ("simulator")); - var simulator = (command == "rebuild" || targetFlags.exists ("simulator")); - - var commands = []; - - if (device) commands.push ([ "-Dblackberry" ]); - if (simulator) commands.push ([ "-Dblackberry", "-Dsimulator" ]); - - CPPHelper.rebuild (project, commands); - - } - - - public override function run ():Void { - - if (!project.targetFlags.exists ("html5")) { - - BlackBerryHelper.deploy (project, targetDirectory, project.meta.packageName + "_" + project.meta.version + ".bar"); - - } else { - - BlackBerryHelper.deploy (project, targetDirectory + "/bin/" + (project.targetFlags.exists ("simulator") ? "simulator" : "device"), PathHelper.safeFileName (project.app.file) + ".bar"); - - } - - } - - - public override function trace ():Void { - - if (!project.targetFlags.exists ("html5")) { - - BlackBerryHelper.trace (project, targetDirectory, project.meta.packageName + "_" + project.meta.version + ".bar"); - - } else { - - //BlackBerryHelper.trace (project, targetDirectory + "/bin/" + (project.targetFlags.exists ("simulator") ? "simulator" : "device"), PathHelper.safeFileName (project.app.file) + ".bar"); - - } - - } - - - public override function update ():Void { - - project = project.clone (); - //initialize (project); - - for (asset in project.assets) { - - if (asset.embed && asset.sourcePath == "") { - - var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path); - asset.sourcePath = path; - - } - - } - - if (!project.targetFlags.exists ("html5")) { - - for (asset in project.assets) { - - asset.resourceName = "app/native/" + asset.resourceName; - - } - - } else { - - for (asset in project.assets) { - - if (asset.type == AssetType.FONT) { - - project.haxeflags.push (HTML5Helper.generateFontData (project, asset)); - - } - - } - - project.haxedefs.set ("html5", 1); - - } - - if (project.targetFlags.exists ("simulator")) { - - project.haxedefs.set ("simulator", 1); - - } - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - var context = project.templateContext; - var destination = targetDirectory + "/bin/"; - - if (!project.targetFlags.exists ("html5")) { - - context.CPP_DIR = targetDirectory + "/obj"; - - } else { - - destination = targetDirectory + "/src/"; - - context.WIN_FLASHBACKGROUND = StringTools.hex (project.window.background, 6); - context.OUTPUT_FILE = outputFile; - - } - - context.OUTPUT_DIR = targetDirectory; - context.BLACKBERRY_AUTHOR_ID = BlackBerryHelper.processDebugToken (project, targetDirectory).authorID; - context.APP_FILE_SAFE = PathHelper.safeFileName (project.app.file); - - PathHelper.mkdir (destination); - - context.ICONS = []; - context.HAS_ICON = false; - - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - for (size in [ 114, 86 ]) { - - if (IconHelper.createIcon (icons, size, size, PathHelper.combine (destination, "icon-" + size + ".png"))) { - - context.ICONS.push ("icon-" + size + ".png"); - context.HAS_ICON = true; - - } - - } - - if (!project.targetFlags.exists ("html5")) { - - FileHelper.copyFileTemplate (project.templatePaths, "blackberry/template/bar-descriptor.xml", destination + "/bar-descriptor.xml", context); - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "blackberry/hxml", targetDirectory + "/haxe", context); - - } else { - - FileHelper.recursiveSmartCopyTemplate (project, "html5/template", destination, context); - FileHelper.copyFileTemplate (project.templatePaths, "blackberry/template/config.xml", destination + "/config.xml", context); - - if (project.app.main != null) { - - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "html5/haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "html5/hxml", targetDirectory + "/haxe", context); - - } - - } - - for (asset in project.assets) { - - var targetPath = PathHelper.combine (destination, asset.targetPath); - PathHelper.mkdir (Path.directory (targetPath)); - - if (asset.type != AssetType.TEMPLATE) { - - if (asset.type != AssetType.FONT || !project.targetFlags.exists ("html5")) { - - FileHelper.copyAssetIfNewer (asset, targetPath); - - } - - } else { - - FileHelper.copyAsset (asset, targetPath, context); - - } - - } - - } - - - @ignore public override function install ():Void {} - @ignore public override function uninstall ():Void {} - - -} \ No newline at end of file diff --git a/lime/tools/platforms/EmscriptenPlatform.hx b/lime/tools/platforms/EmscriptenPlatform.hx deleted file mode 100644 index df5806e80..000000000 --- a/lime/tools/platforms/EmscriptenPlatform.hx +++ /dev/null @@ -1,374 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import haxe.Json; -import haxe.Template; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.HTML5Helper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.ProcessHelper; -import lime.project.AssetType; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - - -class EmscriptenPlatform extends PlatformTarget { - - - private var outputFile:String; - - - public function new (command:String, _project:HXProject, targetFlags:Map) { - - super (command, _project, targetFlags); - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("emscripten.output-directory", "emscripten")); - outputFile = targetDirectory + "/bin/" + project.app.file + ".js"; - - } - - - public override function build ():Void { - - var sdkPath = null; - - if (project.defines.exists ("EMSCRIPTEN_SDK")) { - - sdkPath = project.defines.get ("EMSCRIPTEN_SDK"); - - } else if (project.environment.exists ("EMSCRIPTEN_SDK")) { - - sdkPath = project.environment.get ("EMSCRIPTEN_SDK"); - - } - - if (sdkPath == null) { - - LogHelper.error ("You must define EMSCRIPTEN_SDK with the path to your Emscripten SDK"); - - } - - var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; - var args = [ hxml, "-D", "emscripten", "-D", "webgl", "-D", "static_link"]; - - if (LogHelper.verbose) { - - args.push ("-D"); - args.push ("verbose"); - - } - - ProcessHelper.runCommand ("", "haxe", args); - - if (noOutput) return; - - CPPHelper.compile (project, targetDirectory + "/obj", [ "-Demscripten", "-Dwebgl", "-Dstatic_link" ]); - - project.path (sdkPath); - - ProcessHelper.runCommand ("", "emcc", [ targetDirectory + "/obj/Main.cpp", "-o", targetDirectory + "/obj/Main.o" ], true, false, true); - - args = [ "Main.o" ]; - - for (ndll in project.ndlls) { - - var path = PathHelper.getLibraryPath (ndll, "Emscripten", "lib", ".a", project.debug); - args.push (path); - - } - - var json = Json.parse (File.getContent (PathHelper.getHaxelib (new Haxelib ("hxcpp"), true) + "/haxelib.json")); - var prefix = ""; - - if (Std.parseFloat (json.version) > 3.1) { - - prefix = "lib"; - - } - - args = args.concat ([ prefix + "ApplicationMain" + (project.debug ? "-debug" : "") + ".a", "-o", "ApplicationMain.o" ]); - ProcessHelper.runCommand (targetDirectory + "/obj", "emcc", args, true, false, true); - - args = [ "ApplicationMain.o" ]; - - if (project.targetFlags.exists ("webassembly") || project.targetFlags.exists ("wasm")) { - - args.push ("-s"); - args.push ("WASM=1"); - - } else { - - args.push ("-s"); - args.push ("ASM_JS=1"); - - } - - args.push ("-s"); - args.push ("NO_EXIT_RUNTIME=1"); - - args.push ("-s"); - args.push ("USE_SDL=2"); - - for (dependency in project.dependencies) { - - if (dependency.name != "") { - - args.push ("-l" + dependency.name); - - } - - } - - if (project.targetFlags.exists ("final")) { - - args.push ("-s"); - args.push ("DISABLE_EXCEPTION_CATCHING=0"); - args.push ("-O3"); - - } else if (!project.debug) { - - args.push ("-s"); - args.push ("DISABLE_EXCEPTION_CATCHING=0"); - //args.push ("-s"); - //args.push ("OUTLINING_LIMIT=70000"); - args.push ("-O2"); - - } else { - - args.push ("-s"); - args.push ("DISABLE_EXCEPTION_CATCHING=2"); - args.push ("-s"); - args.push ("ASSERTIONS=1"); - args.push ("-O1"); - - } - - args.push ("-s"); - args.push ("ALLOW_MEMORY_GROWTH=1"); - - if (project.targetFlags.exists ("minify")) { - - // 02 enables minification - - //args.push ("--minify"); - //args.push ("1"); - //args.push ("--closure"); - //args.push ("1"); - - } - - //args.push ("--memory-init-file"); - //args.push ("1"); - //args.push ("--jcache"); - //args.push ("-g"); - - if (FileSystem.exists (targetDirectory + "/obj/assets")) { - - args.push ("--preload-file"); - args.push ("assets"); - - } - - if (LogHelper.verbose) { - - args.push ("-v"); - - } - - //if (project.targetFlags.exists ("compress")) { - // - //args.push ("--compression"); - //args.push (PathHelper.findTemplate (project.templatePaths, "bin/utils/lzma/compress.exe") + "," + PathHelper.findTemplate (project.templatePaths, "resources/lzma-decoder.js") + ",LZMA.decompress"); - //args.push ("haxelib run openfl compress," + PathHelper.findTemplate (project.templatePaths, "resources/lzma-decoder.js") + ",LZMA.decompress"); - //args.push ("-o"); - //args.push ("../bin/index.html"); - // - //} else { - - args.push ("-o"); - args.push ("../bin/" + project.app.file + ".js"); - - //} - - //args.push ("../bin/index.html"); - - ProcessHelper.runCommand (targetDirectory + "/obj", "emcc", args, true, false, true); - - if (project.targetFlags.exists ("minify")) { - - HTML5Helper.minify (project, targetDirectory + "/bin/" + project.app.file + ".js"); - - } - - if (project.targetFlags.exists ("compress")) { - - if (FileSystem.exists (targetDirectory + "/bin/" + project.app.file + ".data")) { - - //var byteArray = ByteArray.readFile (targetDirectory + "/bin/" + project.app.file + ".data"); - //byteArray.compress (CompressionAlgorithm.GZIP); - //File.saveBytes (targetDirectory + "/bin/" + project.app.file + ".data.compress", byteArray); - - } - - //var byteArray = ByteArray.readFile (targetDirectory + "/bin/" + project.app.file + ".js"); - //byteArray.compress (CompressionAlgorithm.GZIP); - //File.saveBytes (targetDirectory + "/bin/" + project.app.file + ".js.compress", byteArray); - - } else { - - File.saveContent (targetDirectory + "/bin/.htaccess", "SetOutputFilter DEFLATE"); - - } - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "Emscripten"); - - } - - - public override function display ():Void { - - var hxml = PathHelper.findTemplate (project.templatePaths, "emscripten/hxml/" + buildType + ".hxml"); - - var context = project.templateContext; - context.OUTPUT_DIR = targetDirectory; - context.OUTPUT_FILE = outputFile; - - var template = new Template (File.getContent (hxml)); - - Sys.println (template.execute (context)); - Sys.println ("-D display"); - - } - - - public override function rebuild ():Void { - - CPPHelper.rebuild (project, [[ "-Demscripten", "-Dstatic_link" ]]); - - } - - - public override function run ():Void { - - HTML5Helper.launch (project, targetDirectory + "/bin"); - - } - - - public override function update ():Void { - - project = project.clone (); - - for (asset in project.assets) { - - if (asset.embed && asset.sourcePath == "") { - - var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path); - asset.sourcePath = path; - - } - - } - - for (asset in project.assets) { - - asset.resourceName = "assets/" + asset.resourceName; - - } - - var destination = targetDirectory + "/bin/"; - PathHelper.mkdir (destination); - - //for (asset in project.assets) { - // - //if (asset.type == AssetType.FONT) { - // - //project.haxeflags.push (HTML5Helper.generateFontData (project, asset)); - // - //} - // - //} - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - var context = project.templateContext; - - context.WIN_FLASHBACKGROUND = StringTools.hex (project.window.background, 6); - context.OUTPUT_DIR = targetDirectory; - context.OUTPUT_FILE = outputFile; - context.CPP_DIR = targetDirectory + "/obj"; - context.USE_COMPRESSION = project.targetFlags.exists ("compress"); - - for (asset in project.assets) { - - var path = PathHelper.combine (targetDirectory + "/obj/assets", asset.targetPath); - - if (asset.type != AssetType.TEMPLATE) { - - //if (asset.type != AssetType.FONT) { - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAssetIfNewer (asset, path); - - //} - - } - - } - - FileHelper.recursiveSmartCopyTemplate (project, "emscripten/template", destination, context); - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "emscripten/hxml", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "emscripten/cpp", targetDirectory + "/obj", context); - - for (asset in project.assets) { - - var path = PathHelper.combine (destination, asset.targetPath); - - if (asset.type == AssetType.TEMPLATE) { - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path, context); - - } - - } - - } - - - @ignore public override function install ():Void {} - @ignore public override function trace ():Void {} - @ignore public override function uninstall ():Void {} - - -} diff --git a/lime/tools/platforms/FirefoxPlatform.hx b/lime/tools/platforms/FirefoxPlatform.hx deleted file mode 100644 index 1311fd27a..000000000 --- a/lime/tools/platforms/FirefoxPlatform.hx +++ /dev/null @@ -1,95 +0,0 @@ -package lime.tools.platforms; - - -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.HTML5Helper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.LogHelper; -import lime.project.HXProject; -import lime.project.Icon; -import sys.FileSystem; - - -class FirefoxPlatform extends HTML5Platform { - - - public function new (command:String, _project:HXProject, targetFlags:Map) { - - super (command, _project, targetFlags); - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "Firefox"); - - } - - - private override function initialize (command:String, project:HXProject):Void { - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("firefox.output-directory", "firefox")); - outputFile = targetDirectory + "/bin/" + project.app.file + ".js"; - - } - - - public override function run ():Void { - - HTML5Helper.launch (project, targetDirectory + "/bin"); - - } - - - public override function update ():Void { - - super.update (); - - var destination = targetDirectory + "/bin/"; - var context = project.templateContext; - - FileHelper.recursiveSmartCopyTemplate (project, "firefoxos/hxml", destination, context, true, false); - FileHelper.recursiveSmartCopyTemplate (project, "firefoxos/template", destination, context, true, false); - - FileHelper.recursiveSmartCopyTemplate (project, "firefox/hxml", destination, context); - FileHelper.recursiveSmartCopyTemplate (project, "firefox/template", destination, context); - - var sizes = [ 32, 48, 60, 64, 128, 512 ]; - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - for (size in sizes) { - - IconHelper.createIcon (icons, size, size, PathHelper.combine (destination, "icon-" + size + ".png")); - - } - - } - - - @ignore public override function install ():Void {} - @ignore public override function rebuild ():Void {} - @ignore public override function trace ():Void {} - @ignore public override function uninstall ():Void {} - - -} \ No newline at end of file diff --git a/lime/tools/platforms/FlashPlatform.hx b/lime/tools/platforms/FlashPlatform.hx deleted file mode 100644 index 6c06eb5bf..000000000 --- a/lime/tools/platforms/FlashPlatform.hx +++ /dev/null @@ -1,295 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import haxe.Json; -import haxe.Template; -import lime.tools.helpers.CompatibilityHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.FlashHelper; -import lime.tools.helpers.HTML5Helper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.WatchHelper; -import lime.project.AssetType; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Platform; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - -#if neko -import neko.vm.Thread; -#end - - -class FlashPlatform extends PlatformTarget { - - - private var embedded:Bool; - private var logLength:Int = 0; - - - public function new (command:String, _project:HXProject, targetFlags:Map) { - - super (command, _project, targetFlags); - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("flash.output-directory", "flash")); - - } - - - public override function build ():Void { - - ProcessHelper.runCommand ("", "haxe", [ targetDirectory + "/haxe/" + buildType + ".hxml" ]); - - } - - - public override function clean ():Void { - - var targetPath = targetDirectory + ""; - - if (FileSystem.exists (targetPath)) { - - PathHelper.removeDirectory (targetPath); - - } - - } - - - public override function deploy ():Void { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "Flash"); - - } - - - public override function display ():Void { - - Sys.println (getDisplayHXML ()); - - } - - - private function generateContext ():Dynamic { - - project = project.clone (); - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - if (LogHelper.verbose) { - - project.haxedefs.set ("verbose", 1); - - } - - var context = project.templateContext; - context.WIN_FLASHBACKGROUND = project.window.background != null ? StringTools.hex (project.window.background, 6) : "0xFFFFFF"; - var assets:Array = cast context.assets; - - for (asset in assets) { - - var assetType:AssetType = Reflect.field (AssetType, asset.type.toUpperCase ()); - - switch (assetType) { - - case MUSIC : asset.flashClass = "flash.media.Sound"; - case SOUND : asset.flashClass = "flash.media.Sound"; - case IMAGE : asset.flashClass = "flash.display.BitmapData"; - case FONT : asset.flashClass = "flash.text.Font"; - default: asset.flashClass = "flash.utils.ByteArray"; - - } - - } - - return context; - - } - - - private function getDisplayHXML ():String { - - var hxml = PathHelper.findTemplate (project.templatePaths, "flash/hxml/" + buildType + ".hxml"); - - var context = project.templateContext; - context.WIN_FLASHBACKGROUND = StringTools.hex (project.window.background, 6); - context.OUTPUT_DIR = targetDirectory; - - var template = new Template (File.getContent (hxml)); - - return template.execute (context) + "\n-D display"; - - } - - - public override function run ():Void { - - if (traceEnabled) { - - FlashHelper.enableLogging (); - logLength = FlashHelper.getLogLength (); - - } - - if (project.app.url != null && project.app.url != "") { - - ProcessHelper.openURL (project.app.url); - - } else { - - var destination = targetDirectory + "/bin"; - var targetPath = project.app.file + ".swf"; - - if (project.targetFlags.exists ("web")) { - - HTML5Helper.launch (project, targetDirectory + "/bin"); - - } else { - - if (traceEnabled) { - - #if neko Thread.create (function () { #end - - FlashHelper.run (project, destination, targetPath); - //Sys.exit (0); - - #if neko }); #end - - Sys.sleep (0.1); - - } else { - - FlashHelper.run (project, destination, targetPath); - - } - - } - - } - - } - - - public override function trace ():Void { - - FlashHelper.enableLogging (); - FlashHelper.tailLog (logLength); - - } - - - public override function update ():Void { - - var destination = targetDirectory + "/bin/"; - PathHelper.mkdir (destination); - - project = project.clone (); - - embedded = FlashHelper.embedAssets (project, targetDirectory); - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "flash/hxml", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "flash/haxe", targetDirectory + "/haxe", context, true, false); - - if (project.targetFlags.exists ("web") || project.app.url != "") { - - PathHelper.mkdir (destination); - FileHelper.recursiveSmartCopyTemplate (project, "flash/templates/web", destination, generateContext ()); - - } - - if (embedded) { - - var files = [ "debug.hxml", "release.hxml", "final.hxml" ]; - var path, hxml, lines, output; - - for (file in files) { - - path = targetDirectory + "/haxe/" + file; - hxml = File.getContent (path); - - if (hxml.indexOf ("-swf-header") > -1) { - - lines = ~/[\r\n]+/g.split (hxml); - output = []; - - for (line in lines) { - - if (line.indexOf ("-swf-header") > -1) continue; - output.push (line); - - } - - if (output.length < lines.length) { - - File.saveContent (path, output.join ("\n")); - - } - - } - - } - - } - - for (asset in project.assets) { - - if (asset.type == AssetType.TEMPLATE || asset.embed == false /*|| !usesLime*/) { - - var path = PathHelper.combine (destination, asset.targetPath); - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path, context); - - } - - } - - } - - - /*private function getIcon (size:Int, targetPath:String):Void { - - var icon = icons.findIcon (size, size); - - if (icon != "") { - - FileHelper.copyIfNewer (icon, targetPath); - - } else { - - icons.updateIcon (size, size, targetPath); - - } - - }*/ - - - public override function watch ():Void { - - var dirs = WatchHelper.processHXML (project, getDisplayHXML ()); - var command = WatchHelper.getCurrentCommand (); - WatchHelper.watch (project, command, dirs); - - } - - - @ignore public override function install ():Void {} - @ignore public override function rebuild ():Void {} - @ignore public override function uninstall ():Void {} - -} \ No newline at end of file diff --git a/lime/tools/platforms/HTML5Platform.hx b/lime/tools/platforms/HTML5Platform.hx deleted file mode 100644 index 8fe0f1f1a..000000000 --- a/lime/tools/platforms/HTML5Platform.hx +++ /dev/null @@ -1,487 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import haxe.Template; -import lime.text.Font; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.ElectronHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.HTML5Helper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.ModuleHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.WatchHelper; -import lime.project.AssetType; -import lime.project.HXProject; -import lime.project.Icon; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - - -class HTML5Platform extends PlatformTarget { - - - private var dependencyPath:String; - private var outputFile:String; - - - public function new (command:String, _project:HXProject, targetFlags:Map ) { - - super (command, _project, targetFlags); - - initialize (command, _project); - - } - - - public override function build ():Void { - - ModuleHelper.buildModules (project, targetDirectory + "/obj", targetDirectory + "/bin"); - - if (project.app.main != null) { - - var type = "release"; - - if (project.debug) { - - type = "debug"; - - } else if (project.targetFlags.exists ("final")) { - - type = "final"; - - } - - var hxml = targetDirectory + "/haxe/" + type + ".hxml"; - ProcessHelper.runCommand ("", "haxe", [ hxml ] ); - - if (noOutput) return; - - HTML5Helper.encodeSourceMappingURL (targetDirectory + "/bin/" + project.app.file + ".js"); - - if (project.targetFlags.exists ("webgl")) { - - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain.js", outputFile); - - } - - if (project.modules.iterator ().hasNext ()) { - - ModuleHelper.patchFile (outputFile); - - } - - if (project.targetFlags.exists ("minify") || type == "final") { - - HTML5Helper.minify (project, targetDirectory + "/bin/" + project.app.file + ".js"); - - } - - } - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - var name = "HTML5"; - - if (targetFlags.exists ("electron")) { - - name = "Electron"; - - } - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, name); - - } - - - public override function display ():Void { - - Sys.println (getDisplayHXML ()); - - } - - - private function getDisplayHXML ():String { - - var type = "html5"; - - if (targetFlags.exists ("electron")) { - - type = "electron"; - - } - - var hxml = PathHelper.findTemplate (project.templatePaths, type + "/hxml/" + buildType + ".hxml"); - - var context = project.templateContext; - context.OUTPUT_DIR = targetDirectory; - context.OUTPUT_FILE = outputFile; - - var template = new Template (File.getContent (hxml)); - - return template.execute (context) + "\n-D display"; - - } - - - private function initialize (command:String, project:HXProject):Void { - - if (targetFlags.exists ("electron")) { - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("electron.output-directory", "electron")); - - } else { - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("html5.output-directory", "html5")); - - } - - dependencyPath = project.config.getString ("html5.dependency-path", "lib"); - - if (targetFlags.exists ("electron")) { - - dependencyPath = project.config.getString ("html5.dependency-path", dependencyPath); - - } - - outputFile = targetDirectory + "/bin/" + project.app.file + ".js"; - - } - - - public override function run ():Void { - - if (targetFlags.exists ("electron")) { - - ElectronHelper.launch (project, targetDirectory + "/bin"); - - } else { - - HTML5Helper.launch (project, targetDirectory + "/bin"); - - } - - } - - - public override function update ():Void { - - project = project.clone (); - - var destination = targetDirectory + "/bin/"; - PathHelper.mkdir (destination); - - var webfontDirectory = targetDirectory + "/obj/webfont"; - var useWebfonts = true; - - for (haxelib in project.haxelibs) { - - if (haxelib.name == "openfl-html5-dom" || haxelib.name == "openfl-bitfive") { - - useWebfonts = false; - - } - - } - - var fontPath; - - for (asset in project.assets) { - - if (asset.type == AssetType.FONT && asset.targetPath != null) { - - if (useWebfonts) { - - fontPath = PathHelper.combine (webfontDirectory, Path.withoutDirectory (asset.targetPath)); - - if (!FileSystem.exists (fontPath)) { - - PathHelper.mkdir (webfontDirectory); - FileHelper.copyFile (asset.sourcePath, fontPath); - - var originalPath = asset.sourcePath; - asset.sourcePath = fontPath; - - HTML5Helper.generateWebfonts (project, asset); - - var ext = "." + Path.extension (asset.sourcePath); - var source = Path.withoutExtension (asset.sourcePath); - var extensions = [ ext, ".eot", ".woff", ".svg" ]; - - for (extension in extensions) { - - if (!FileSystem.exists (source + extension)) { - - if (extension != ".eot" && extension != ".svg") { - - LogHelper.warn ("Could not generate *" + extension + " web font for \"" + originalPath + "\""); - - } - - } - - } - - } - - asset.sourcePath = fontPath; - asset.targetPath = Path.withoutExtension (asset.targetPath); - - } else { - - project.haxeflags.push (HTML5Helper.generateFontData (project, asset)); - - } - - } - - } - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - if (LogHelper.verbose) { - - project.haxedefs.set ("verbose", 1); - - } - - ModuleHelper.updateProject (project); - - var libraryNames = new Map (); - - for (asset in project.assets) { - - if (asset.library != null && !libraryNames.exists (asset.library)) { - - libraryNames[asset.library] = true; - - } - - } - - //for (library in libraryNames.keys ()) { - // - //project.haxeflags.push ("-resource " + targetDirectory + "/obj/manifest/" + library + ".json@__ASSET_MANIFEST__" + library); - // - //} - - //project.haxeflags.push ("-resource " + targetDirectory + "/obj/manifest/default.json@__ASSET_MANIFEST__default"); - - var context = project.templateContext; - - context.WIN_FLASHBACKGROUND = project.window.background != null ? StringTools.hex (project.window.background, 6) : ""; - context.OUTPUT_DIR = targetDirectory; - context.OUTPUT_FILE = outputFile; - - if (project.targetFlags.exists ("webgl")) { - - context.CPP_DIR = targetDirectory + "/obj"; - - } - - context.favicons = []; - - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - //if (IconHelper.createWindowsIcon (icons, PathHelper.combine (destination, "favicon.ico"))) { - // - //context.favicons.push ({ rel: "icon", type: "image/x-icon", href: "./favicon.ico" }); - // - //} - - if (IconHelper.createIcon (icons, 192, 192, PathHelper.combine (destination, "favicon.png"))) { - - context.favicons.push ({ rel: "shortcut icon", type: "image/png", href: "./favicon.png" }); - - } - - context.linkedLibraries = []; - - for (dependency in project.dependencies) { - - if (StringTools.endsWith (dependency.name, ".js")) { - - context.linkedLibraries.push (dependency.name); - - } else if (StringTools.endsWith (dependency.path, ".js") && FileSystem.exists (dependency.path)) { - - var name = Path.withoutDirectory (dependency.path); - - context.linkedLibraries.push ("./" + dependencyPath + "/" + name); - FileHelper.copyIfNewer (dependency.path, PathHelper.combine (destination, PathHelper.combine (dependencyPath, name))); - - } - - } - - for (asset in project.assets) { - - var path = PathHelper.combine (destination, asset.targetPath); - - if (asset.type != AssetType.TEMPLATE) { - - if (/*asset.embed != true &&*/ asset.type != AssetType.FONT) { - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAssetIfNewer (asset, path); - - } else if (asset.type == AssetType.FONT && useWebfonts) { - - PathHelper.mkdir (Path.directory (path)); - var ext = "." + Path.extension (asset.sourcePath); - var source = Path.withoutExtension (asset.sourcePath); - - var hasFormat = [ false, false, false, false ]; - var extensions = [ ext, ".eot", ".svg", ".woff" ]; - var extension; - - for (i in 0...extensions.length) { - - extension = extensions[i]; - - if (FileSystem.exists (source + extension)) { - - FileHelper.copyIfNewer (source + extension, path + extension); - hasFormat[i] = true; - - } - - } - - var shouldEmbedFont = false; - - for (embedded in hasFormat) { - if (embedded) shouldEmbedFont = true; - } - - var embeddedAssets:Array = cast context.assets; - for (embeddedAsset in embeddedAssets) { - - if (embeddedAsset.type == "font" && embeddedAsset.sourcePath == asset.sourcePath) { - - var font = Font.fromFile (asset.sourcePath); - - embeddedAsset.ascender = font.ascender; - embeddedAsset.descender = font.descender; - embeddedAsset.height = font.height; - embeddedAsset.numGlyphs = font.numGlyphs; - embeddedAsset.underlinePosition = font.underlinePosition; - embeddedAsset.underlineThickness = font.underlineThickness; - embeddedAsset.unitsPerEM = font.unitsPerEM; - - if (shouldEmbedFont) { - - var urls = []; - if (hasFormat[1]) urls.push ("url('" + embeddedAsset.targetPath + ".eot?#iefix') format('embedded-opentype')"); - if (hasFormat[3]) urls.push ("url('" + embeddedAsset.targetPath + ".woff') format('woff')"); - urls.push ("url('" + embeddedAsset.targetPath + ext + "') format('truetype')"); - if (hasFormat[2]) urls.push ("url('" + embeddedAsset.targetPath + ".svg#" + StringTools.urlEncode (embeddedAsset.fontName) + "') format('svg')"); - - var fontFace = "\t\t@font-face {\n"; - fontFace += "\t\t\tfont-family: '" + embeddedAsset.fontName + "';\n"; - // if (hasFormat[1]) fontFace += "\t\t\tsrc: url('" + embeddedAsset.targetPath + ".eot');\n"; - fontFace += "\t\t\tsrc: " + urls.join (",\n\t\t\t") + ";\n"; - fontFace += "\t\t\tfont-weight: normal;\n"; - fontFace += "\t\t\tfont-style: normal;\n"; - fontFace += "\t\t}\n"; - - embeddedAsset.cssFontFace = fontFace; - - } - break; - - } - - } - - } - - } - - } - - FileHelper.recursiveSmartCopyTemplate (project, "html5/template", destination, context); - - if (project.app.main != null) { - - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "html5/haxe", targetDirectory + "/haxe", context, true, false); - FileHelper.recursiveSmartCopyTemplate (project, "html5/hxml", targetDirectory + "/haxe", context); - - } - - if (targetFlags.exists ("electron")) { - - FileHelper.recursiveSmartCopyTemplate (project, "electron/template", destination, context); - - if (project.app.main != null) { - - FileHelper.recursiveSmartCopyTemplate (project, "electron/haxe", targetDirectory + "/haxe", context, true, false); - FileHelper.recursiveSmartCopyTemplate (project, "electron/hxml", targetDirectory + "/haxe", context); - - } - - } - - for (asset in project.assets) { - - var path = PathHelper.combine (destination, asset.targetPath); - - if (asset.type == AssetType.TEMPLATE) { - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path, context); - - } - - } - - } - - - public override function watch ():Void { - - // TODO: Use a custom live reload HTTP server for test/run instead - - var dirs = WatchHelper.processHXML (project, getDisplayHXML ()); - var command = WatchHelper.getCurrentCommand (); - WatchHelper.watch (project, command, dirs); - - } - - - @ignore public override function install ():Void {} - @ignore public override function rebuild ():Void {} - @ignore public override function trace ():Void {} - @ignore public override function uninstall ():Void {} - - -} \ No newline at end of file diff --git a/lime/tools/platforms/IOSPlatform.hx b/lime/tools/platforms/IOSPlatform.hx deleted file mode 100644 index cdc62a914..000000000 --- a/lime/tools/platforms/IOSPlatform.hx +++ /dev/null @@ -1,775 +0,0 @@ -package lime.tools.platforms; - - -//import openfl.display.BitmapData; -import haxe.io.Path; -import haxe.Json; -import haxe.Template; -import lime.tools.helpers.ArrayHelper; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.IOSHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.StringHelper; -import lime.tools.helpers.WatchHelper; -import lime.graphics.Image; -import lime.project.Architecture; -import lime.project.Asset; -import lime.project.AssetType; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Icon; -import lime.project.Keystore; -import lime.project.NDLL; -import lime.project.Platform; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - - -class IOSPlatform extends PlatformTarget { - - - public function new (command:String, _project:HXProject, targetFlags:Map ) { - - super (command, _project, targetFlags); - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("ios.output-directory", "ios")); - - } - - - public override function build ():Void { - - if (project.targetFlags.exists ("xcode") && PlatformHelper.hostPlatform == Platform.MAC) { - - ProcessHelper.runCommand ("", "open", [ targetDirectory + "/" + project.app.file + ".xcodeproj" ] ); - - } else { - - IOSHelper.build (project, targetDirectory); - - if (noOutput) return; - - if (!project.targetFlags.exists ("simulator")) { - - IOSHelper.sign (project, targetDirectory + "/bin"); - - } - - } - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - IOSHelper.deploy (project, targetDirectory); - - } - - - public override function display ():Void { - - Sys.println (getDisplayHXML ()); - - } - - - private function generateContext ():Dynamic { - - //project = project.clone (); - - project.sources.unshift (""); - project.sources = PathHelper.relocatePaths (project.sources, PathHelper.combine (targetDirectory, project.app.file + "/haxe")); - //project.dependencies.push ("stdc++"); - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - if (project.targetFlags.exists ("final")) { - - project.haxedefs.set ("final", ""); - - } - - if (!project.config.exists ("ios.identity")) { - - project.config.set ("ios.identity", "iPhone Developer"); - - } - - IOSHelper.getIOSVersion (project); - project.haxedefs.set ("IPHONE_VER", project.environment.get ("IPHONE_VER")); - - project.haxedefs.set ("HXCPP_CPP11", "1"); - - if (project.config.getString ("ios.compiler") == "llvm" || project.config.getString ("ios.compiler", "clang") == "clang") { - - project.haxedefs.set ("HXCPP_CLANG", "1"); - project.haxedefs.set ("OBJC_ARC", "1"); - - } - - var context = project.templateContext; - - context.HAS_ICON = false; - context.HAS_LAUNCH_IMAGE = false; - context.OBJC_ARC = false; - context.KEY_STORE_IDENTITY = project.config.getString ("ios.identity"); - - if (project.config.exists ("ios.provisioning-profile")) { - - context.IOS_PROVISIONING_PROFILE = PathHelper.tryFullPath (project.config.getString ("ios.provisioning-profile")); - - } - - if (project.config.exists ("ios.team-id")) { - - context.DEVELOPMENT_TEAM_ID = project.config.getString ("ios.team-id"); - - } - - context.linkedLibraries = []; - - for (dependency in project.dependencies) { - - if (!StringTools.endsWith (dependency.name, ".framework") && !StringTools.endsWith (dependency.name, ".tbd") && !StringTools.endsWith (dependency.path, ".framework")) { - - if (dependency.path != "") { - - var name = Path.withoutDirectory (Path.withoutExtension (dependency.path)); - - if (dependency.forceLoad) { - - project.config.push ("ios.linker-flags", "-force_load $SRCROOT/$PRODUCT_NAME/lib/$CURRENT_ARCH/" + Path.withoutDirectory (dependency.path)); - - } - - if (StringTools.startsWith (name, "lib")) { - - name = name.substring (3, name.length); - - } - - context.linkedLibraries.push (name); - - } else if (dependency.name != "") { - - context.linkedLibraries.push (dependency.name); - - } - - } - - } - - var valid_archs = new Array (); - var armv6 = false; - var armv7 = false; - var armv7s = false; - var arm64 = false; - var architectures = project.architectures; - - if (architectures == null || architectures.length == 0) { - - architectures = [ Architecture.ARMV7, Architecture.ARM64 ]; - - } - - if (project.config.getString ("ios.device", "universal") == "universal" || project.config.getString ("ios.device") == "iphone") { - - if (project.config.getFloat ("ios.deployment", 8) < 5) { - - ArrayHelper.addUnique (architectures, Architecture.ARMV6); - - } - - } - - for (architecture in project.architectures) { - - switch (architecture) { - - case ARMV6: valid_archs.push ("armv6"); armv6 = true; - case ARMV7: valid_archs.push ("armv7"); armv7 = true; - case ARMV7S: valid_archs.push ("armv7s"); armv7s = true; - case ARM64: valid_archs.push ("arm64"); arm64 = true; - default: - - } - - } - - context.CURRENT_ARCHS = "( " + valid_archs.join(",") + ") "; - - valid_archs.push ("x86_64"); - valid_archs.push ("i386"); - - context.VALID_ARCHS = valid_archs.join(" "); - context.THUMB_SUPPORT = armv6 ? "GCC_THUMB_SUPPORT = NO;" : ""; - - var requiredCapabilities = []; - - if (!armv6 && armv7) { - - requiredCapabilities.push ({ name: "armv7", value: true }); - - } else if (!armv6 && !armv7 && armv7s) { - - requiredCapabilities.push ({ name: "armv7s", value: true }); - - } else if (!armv6 && !armv7 && !armv7s && arm64) { - - requiredCapabilities.push ({ name: "arm64", value: true }); - - } - - context.REQUIRED_CAPABILITY = requiredCapabilities; - context.ARMV6 = armv6; - context.ARMV7 = armv7; - context.ARMV7S = armv7s; - context.ARM64 = arm64; - context.TARGET_DEVICES = switch (project.config.getString ("ios.device", "universal")) { case "iphone": "1"; case "ipad": "2"; default: "1,2"; } - context.DEPLOYMENT = project.config.getString ("ios.deployment", "8.0"); - - if (project.config.getString ("ios.compiler") == "llvm" || project.config.getString ("ios.compiler", "clang") == "clang") { - - context.OBJC_ARC = true; - - } - - //context.ENABLE_BITCODE = (project.config.getFloat ("ios.deployment", 8) >= 6); - context.ENABLE_BITCODE = project.config.getBool ("ios.enable-bitcode", false); - context.IOS_COMPILER = project.config.getString ("ios.compiler", "clang"); - context.CPP_BUILD_LIBRARY = project.config.getString ("cpp.buildLibrary", "hxcpp"); - - var json = Json.parse (File.getContent (PathHelper.getHaxelib (new Haxelib ("hxcpp"), true) + "/haxelib.json")); - - if (Std.parseFloat (json.version) > 3.1) { - - context.CPP_LIBPREFIX = "lib"; - - } else { - - context.CPP_LIBPREFIX = ""; - - } - - context.IOS_LINKER_FLAGS = ["-stdlib=libc++"].concat (project.config.getArrayString ("ios.linker-flags")); - context.IOS_NON_EXEMPT_ENCRYPTION = project.config.getBool ("ios.non-exempt-encryption", true); - - switch (project.window.orientation) { - - case PORTRAIT: - context.IOS_APP_ORIENTATION = "UIInterfaceOrientationPortraitUIInterfaceOrientationPortraitUpsideDown"; - case LANDSCAPE: - context.IOS_APP_ORIENTATION = "UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRight"; - case ALL: - context.IOS_APP_ORIENTATION = "UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRightUIInterfaceOrientationPortraitUIInterfaceOrientationPortraitUpsideDown"; - //case "allButUpsideDown": - //context.IOS_APP_ORIENTATION = "UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRightUIInterfaceOrientationPortrait"; - default: - context.IOS_APP_ORIENTATION = "UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRightUIInterfaceOrientationPortraitUIInterfaceOrientationPortraitUpsideDown"; - - } - - context.ADDL_PBX_BUILD_FILE = ""; - context.ADDL_PBX_FILE_REFERENCE = ""; - context.ADDL_PBX_FRAMEWORKS_BUILD_PHASE = ""; - context.ADDL_PBX_FRAMEWORK_GROUP = ""; - - context.frameworkSearchPaths = []; - - for (dependency in project.dependencies) { - - var name = null; - var path = null; - var fileType = null; - - if (Path.extension (dependency.name) == "framework") { - - name = dependency.name; - path = "/System/Library/Frameworks/" + dependency.name; - fileType = "wrapper.framework"; - - } else if (Path.extension (dependency.name) == "tbd") { - - name = dependency.name; - path = "/usr/lib/" + dependency.name; - fileType = "sourcecode.text-based-dylib-definition"; - - } else if (Path.extension (dependency.path) == "framework") { - - name = Path.withoutDirectory (dependency.path); - path = PathHelper.tryFullPath (dependency.path); - fileType = "wrapper.framework"; - - } - - if (name != null) { - - var frameworkID = "11C0000000000018" + StringHelper.getUniqueID (); - var fileID = "11C0000000000018" + StringHelper.getUniqueID (); - - ArrayHelper.addUnique (context.frameworkSearchPaths, Path.directory (path)); - - context.ADDL_PBX_BUILD_FILE += " " + frameworkID + " /* " + name + " in Frameworks */ = {isa = PBXBuildFile; fileRef = " + fileID + " /* " + name + " */; };\n"; - context.ADDL_PBX_FILE_REFERENCE += " " + fileID + " /* " + name + " */ = {isa = PBXFileReference; lastKnownFileType = \"" + fileType + "\"; name = \"" + name + "\"; path = \"" + path + "\"; sourceTree = SDKROOT; };\n"; - context.ADDL_PBX_FRAMEWORKS_BUILD_PHASE += " " + frameworkID + " /* " + name + " in Frameworks */,\n"; - context.ADDL_PBX_FRAMEWORK_GROUP += " " + fileID + " /* " + name + " */,\n"; - - } - - } - - context.HXML_PATH = PathHelper.findTemplate (project.templatePaths, "iphone/PROJ/haxe/Build.hxml", false); - if (context.HXML_PATH == null) context.HXML_PATH = PathHelper.findTemplate (project.templatePaths, "ios/template/{{app.file}}/haxe/Build.hxml"); - context.PRERENDERED_ICON = project.config.getBool ("ios.prerenderedIcon", false); - - var allowInsecureHTTP = project.config.getString ("ios.allow-insecure-http", "*"); - - if (allowInsecureHTTP != "*" && allowInsecureHTTP != "true") { - - var sites = []; - - if (allowInsecureHTTP != "false") { - - var domains = project.config.getArrayString ("ios.allow-insecure-http"); - - for (domain in domains) { - - sites.push ({ domain: domain }); - - } - - } - - context.IOS_ALLOW_INSECURE_HTTP = sites; - - } - - var haxelibPath = project.environment.get ("HAXELIB_PATH"); - - if (haxelibPath != null) { - - context.HAXELIB_PATH = 'export HAXELIB_PATH="$haxelibPath";'; - - } else { - - context.HAXELIB_PATH = ''; - - } - - return context; - - } - - - private function getDisplayHXML ():String { - - var hxml = PathHelper.findTemplate (project.templatePaths, "iphone/PROJ/haxe/Build.hxml", false); - if (hxml == null) hxml = PathHelper.findTemplate (project.templatePaths, "iphone/template/{{app.file}}/Build.hxml", true); - var template = new Template (File.getContent (hxml)); - - project = project.clone (); - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - return template.execute (context) + "\n-D display"; - - } - - - public override function rebuild ():Void { - - var armv6 = (project.architectures.indexOf (Architecture.ARMV6) > -1 && !project.targetFlags.exists ("simulator")); - var armv7 = (command == "rebuild" || (project.architectures.indexOf (Architecture.ARMV7) > -1 && !project.targetFlags.exists ("simulator"))); - var armv7s = (project.architectures.indexOf (Architecture.ARMV7S) > -1 && !project.targetFlags.exists ("simulator")); - var arm64 = (command == "rebuild" || (project.architectures.indexOf (Architecture.ARM64) > -1 && !project.targetFlags.exists ("simulator"))); - var i386 = (command == "rebuild" || project.targetFlags.exists ("simulator")); - var x86_64 = (command == "rebuild" || project.targetFlags.exists ("simulator")); - - var arc = (project.targetFlags.exists ("arc")); - - var commands = []; - - if (armv6) commands.push ([ "-Dios", "-DHXCPP_CPP11" ]); - if (armv7) commands.push ([ "-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV7" ]); - if (armv7s) commands.push ([ "-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARMV7S" ]); - if (arm64) commands.push ([ "-Dios", "-DHXCPP_CPP11", "-DHXCPP_ARM64" ]); - if (i386) commands.push ([ "-Dios", "-Dsimulator", "-DHXCPP_CPP11" ]); - if (x86_64) commands.push ([ "-Dios", "-Dsimulator", "-DHXCPP_M64", "-DHXCPP_CPP11" ]); - - if (arc) { - - for (command in commands) { - - command.push ("-DOBJC_ARC"); - - } - - } - - IOSHelper.getIOSVersion (project); - var iphoneVer = project.environment.get ("IPHONE_VER"); - - for (command in commands) { - - command.push ("-DIPHONE_VER=" + iphoneVer); - - } - - CPPHelper.rebuild (project, commands); - - } - - - public override function run ():Void { - - if (project.targetFlags.exists ("xcode")) return; - - IOSHelper.launch (project, targetDirectory); - - } - - - public override function update ():Void { - - project = project.clone (); - - for (asset in project.assets) { - - if (asset.embed && asset.sourcePath == "") { - - var path = PathHelper.combine (targetDirectory + "/" + project.app.file + "/obj/tmp", asset.targetPath); - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path); - asset.sourcePath = path; - - } - - } - - //var manifest = new Asset (); - //manifest.id = "__manifest__"; - //manifest.data = AssetHelper.createManifest (project).serialize (); - //manifest.resourceName = manifest.flatName = manifest.targetPath = "manifest"; - //manifest.type = AssetType.TEXT; - //project.assets.push (manifest); - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - var projectDirectory = targetDirectory + "/" + project.app.file + "/"; - - PathHelper.mkdir (targetDirectory); - PathHelper.mkdir (projectDirectory); - PathHelper.mkdir (projectDirectory + "/haxe"); - PathHelper.mkdir (projectDirectory + "/haxe/lime/installer"); - - var iconSizes:Array = [ - { name: "Icon-20.png", size: 20 }, - { name: "Icon-Small.png", size: 29 }, - { name: "Icon-Small-40.png", size: 40 }, - { name: "Icon-20@2x.png", size: 40 }, - { name: "Icon-Small-50.png", size: 50 }, - { name: "Icon.png", size: 57 }, - { name: "Icon-Small@2x.png", size: 58 }, - { name: "Icon-20@3x.png", size: 60 }, - { name: "Icon-72.png", size: 72 }, - { name: "Icon-76.png", size: 76 }, - { name: "Icon-Small-40@2x.png", size: 80 }, - { name: "Icon-Small@3x.png", size: 87 }, - { name: "Icon-Small-50@2x.png", size: 100 }, - { name: "Icon@2x.png", size: 114 }, - { name: "Icon-60@2x.png", size: 120 }, - { name: "Icon-Small-40@3x.png", size: 120 }, - { name: "Icon-72@2x.png", size: 144 }, - { name: "Icon-76@2x.png", size: 152 }, - { name: "Icon-83.5@2x.png", size: 167 }, - { name: "Icon-60@3x.png", size: 180 }, - { name: "Icon-Marketing.png", size: 1024 } - ]; - - context.HAS_ICON = true; - - var iconPath = PathHelper.combine (projectDirectory, "Images.xcassets/AppIcon.appiconset"); - PathHelper.mkdir (iconPath); - - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - for (iconSize in iconSizes) { - - if (!IconHelper.createIcon (icons, iconSize.size, iconSize.size, PathHelper.combine (iconPath, iconSize.name))) { - - context.HAS_ICON = false; - - } - - } - - var splashSizes:Array = [ - { name: "Default.png", w: 320, h: 480 }, // iPhone, portrait - { name: "Default@2x.png", w: 640, h: 960 }, // iPhone Retina, portrait - { name: "Default-568h@2x.png", w: 640, h: 1136 }, // iPhone 5, portrait - { name: "Default-667h@2x.png", w: 750, h: 1334 }, // iPhone 6, portrait - { name: "Default-736h@3x.png", w: 1242, h: 2208 }, // iPhone 6 Plus, portrait - { name: "Default-Landscape.png", w: 1024, h: 768 }, // iPad, landscape - { name: "Default-Landscape@2x.png", w: 2048, h: 1536 }, // iPad Retina, landscape - { name: "Default-736h-Landscape@3x.png", w: 2208, h: 1242 }, // iPhone 6 Plus, landscape - { name: "Default-Portrait.png", w: 768, h: 1024 }, // iPad, portrait - { name: "Default-Portrait@2x.png", w: 1536, h: 2048 }, // iPad Retina, portrait - { name: "Default-812h@3x.png", w: 1125, h: 2436 }, // iPhone X, portrait - { name: "Default-Landscape-812h@3x.png", w: 2436, h: 1125 } // iPhone X, landscape - ]; - - var splashScreenPath = PathHelper.combine (projectDirectory, "Images.xcassets/LaunchImage.launchimage"); - PathHelper.mkdir (splashScreenPath); - - for (size in splashSizes) { - - var match = false; - - for (splashScreen in project.splashScreens) { - - if (splashScreen.width == size.w && splashScreen.height == size.h && Path.extension (splashScreen.path) == "png") { - - FileHelper.copyFile (splashScreen.path, PathHelper.combine (splashScreenPath, size.name)); - match = true; - - } - - } - - if (!match) { - - var imagePath = PathHelper.combine (splashScreenPath, size.name); - - if (!FileSystem.exists (imagePath)) { - - LogHelper.info ("", " - \x1b[1mGenerating image:\x1b[0m " + imagePath); - - var image = new Image (null, 0, 0, size.w, size.h, (0xFF << 24) | (project.window.background & 0xFFFFFF)); - var bytes = image.encode ("png"); - - File.saveBytes (imagePath, bytes); - - } - - } - - } - - context.HAS_LAUNCH_IMAGE = true; - - PathHelper.mkdir (projectDirectory + "/resources"); - PathHelper.mkdir (projectDirectory + "/haxe/build"); - - // Long deprecated template path - - FileHelper.recursiveSmartCopyTemplate (project, "iphone/resources", projectDirectory + "/resources", context, true, false); - - // New template path - - FileHelper.recursiveSmartCopyTemplate (project, "ios/template", targetDirectory, context); - - // Recently deprecated template paths - - FileHelper.recursiveSmartCopyTemplate (project, "iphone/PROJ/haxe", projectDirectory + "/haxe", context, true, false); - FileHelper.recursiveSmartCopyTemplate (project, "haxe", projectDirectory + "/haxe", context, true, false); - FileHelper.recursiveSmartCopyTemplate (project, "iphone/PROJ/Classes", projectDirectory + "/Classes", context, true, false); - FileHelper.recursiveSmartCopyTemplate (project, "iphone/PROJ/Images.xcassets", projectDirectory + "/Images.xcassets", context, true, false); - FileHelper.copyFileTemplate (project.templatePaths, "iphone/PROJ/PROJ-Info.plist", projectDirectory + "/" + project.app.file + "-Info.plist", context, true, false); - FileHelper.copyFileTemplate (project.templatePaths, "iphone/PROJ/PROJ-Prefix.pch", projectDirectory + "/" + project.app.file + "-Prefix.pch", context, true, false); - FileHelper.recursiveSmartCopyTemplate (project, "iphone/PROJ.xcodeproj", targetDirectory + "/" + project.app.file + ".xcodeproj", context, true, false); - - PathHelper.mkdir (projectDirectory + "/lib"); - - for (archID in 0...6) { - - var arch = [ "armv6", "armv7", "armv7s", "arm64", "i386", "x86_64" ][archID]; - - if (arch == "armv6" && !context.ARMV6) - continue; - - if (arch == "armv7" && !context.ARMV7) - continue; - - if (arch == "armv7s" && !context.ARMV7S) - continue; - - if (arch == "arm64" && !context.ARM64) - continue; - - var libExt = [ ".iphoneos.a", ".iphoneos-v7.a", ".iphoneos-v7s.a", ".iphoneos-64.a", ".iphonesim.a", ".iphonesim-64.a" ][archID]; - - PathHelper.mkdir (projectDirectory + "/lib/" + arch); - PathHelper.mkdir (projectDirectory + "/lib/" + arch + "-debug"); - - for (ndll in project.ndlls) { - - //if (ndll.haxelib != null) { - - var releaseLib = PathHelper.getLibraryPath (ndll, "iPhone", "lib", libExt); - var debugLib = PathHelper.getLibraryPath (ndll, "iPhone", "lib", libExt, true); - var releaseDest = projectDirectory + "/lib/" + arch + "/lib" + ndll.name + ".a"; - var debugDest = projectDirectory + "/lib/" + arch + "-debug/lib" + ndll.name + ".a"; - - if (!FileSystem.exists (releaseLib)) { - - releaseLib = PathHelper.getLibraryPath (ndll, "iPhone", "lib", ".iphoneos.a"); - debugLib = PathHelper.getLibraryPath (ndll, "iPhone", "lib", ".iphoneos.a", true); - - } - - FileHelper.copyIfNewer (releaseLib, releaseDest); - - if (FileSystem.exists (debugLib) && debugLib != releaseLib) { - - FileHelper.copyIfNewer (debugLib, debugDest); - - } else if (FileSystem.exists (debugDest)) { - - FileSystem.deleteFile (debugDest); - - } - - //} - - } - - for (dependency in project.dependencies) { - - if (StringTools.endsWith (dependency.path, ".a")) { - - var fileName = Path.withoutDirectory (dependency.path); - - if (!StringTools.startsWith (fileName, "lib")) { - - fileName = "lib" + fileName; - - } - - FileHelper.copyIfNewer (dependency.path, projectDirectory + "/lib/" + arch + "/" + fileName); - - } - - } - - } - - PathHelper.mkdir (projectDirectory + "/assets"); - - for (asset in project.assets) { - - if (asset.type != AssetType.TEMPLATE) { - - var targetPath = PathHelper.combine (projectDirectory + "/assets/", asset.resourceName); - - //var sourceAssetPath:String = projectDirectory + "haxe/" + asset.sourcePath; - - PathHelper.mkdir (Path.directory (targetPath)); - FileHelper.copyAssetIfNewer (asset, targetPath); - - //PathHelper.mkdir (Path.directory (sourceAssetPath)); - //FileHelper.linkFile (flatAssetPath, sourceAssetPath, true, true); - - } else { - - var targetPath = PathHelper.combine (projectDirectory, asset.targetPath); - - PathHelper.mkdir (Path.directory (targetPath)); - FileHelper.copyAsset (asset, targetPath, context); - - } - - } - - if (project.targetFlags.exists ("xcode") && PlatformHelper.hostPlatform == Platform.MAC && command == "update") { - - ProcessHelper.runCommand ("", "open", [ targetDirectory + "/" + project.app.file + ".xcodeproj" ] ); - - } - - } - - - /*private function updateLaunchImage () { - - var destination = buildDirectory + "/ios"; - PathHelper.mkdir (destination); - - var has_launch_image = false; - if (launchImages.length > 0) has_launch_image = true; - - for (launchImage in launchImages) { - - var splitPath = launchImage.name.split ("/"); - var path = destination + "/" + splitPath[splitPath.length - 1]; - FileHelper.copyFile (launchImage.name, path, context, false); - - } - - context.HAS_LAUNCH_IMAGE = has_launch_image; - - }*/ - - - public override function watch ():Void { - - var dirs = WatchHelper.processHXML (project, getDisplayHXML ()); - var command = WatchHelper.getCurrentCommand (); - WatchHelper.watch (project, command, dirs); - - } - - - @ignore public override function install ():Void {} - @ignore public override function trace ():Void {} - @ignore public override function uninstall ():Void {} - - -} - - -private typedef IconSize = { - - name:String, - size:Int, - -} - - -private typedef SplashSize = { - - name:String, - w:Int, - h:Int, - -} diff --git a/lime/tools/platforms/LinuxPlatform.hx b/lime/tools/platforms/LinuxPlatform.hx deleted file mode 100644 index 096aa2a34..000000000 --- a/lime/tools/platforms/LinuxPlatform.hx +++ /dev/null @@ -1,457 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import haxe.Template; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.JavaHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.NekoHelper; -import lime.tools.helpers.NodeJSHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.WatchHelper; -import lime.project.AssetType; -import lime.project.Architecture; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Platform; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.io.Process; -import sys.FileSystem; - - -class LinuxPlatform extends PlatformTarget { - - - private var applicationDirectory:String; - private var executablePath:String; - private var is64:Bool; - private var isRaspberryPi:Bool; - private var targetType:String; - - - public function new (command:String, _project:HXProject, targetFlags:Map ) { - - super (command, _project, targetFlags); - - for (architecture in project.architectures) { - - if (!targetFlags.exists ("32") && architecture == Architecture.X64) { - - is64 = true; - - } else if (architecture == Architecture.ARMV7) { - - isRaspberryPi = true; - - } - - } - - if (project.targetFlags.exists ("rpi")) { - - isRaspberryPi = true; - is64 = false; - - } - - if (project.targetFlags.exists ("neko") || project.target != PlatformHelper.hostPlatform) { - - targetType = "neko"; - - } else if (project.targetFlags.exists ("hl")) { - - targetType = "hl"; - - } else if (project.targetFlags.exists ("nodejs")) { - - targetType = "nodejs"; - - } else if (project.targetFlags.exists ("java")) { - - targetType = "java"; - - } else { - - targetType = "cpp"; - - } - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("linux.output-directory", targetType == "cpp" ? "linux" : targetType)); - targetDirectory = StringTools.replace (targetDirectory, "arch64", is64 ? "64" : ""); - applicationDirectory = targetDirectory + "/bin/"; - executablePath = PathHelper.combine (applicationDirectory, project.app.file); - - } - - - public override function build ():Void { - - var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; - - PathHelper.mkdir (targetDirectory); - - if (!project.targetFlags.exists ("static") || targetType != "cpp") { - - var targetSuffix = (targetType == "hl") ? ".hdll" : null; - - for (ndll in project.ndlls) { - - if (isRaspberryPi) { - - FileHelper.copyLibrary (project, ndll, "RPi", "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, project.debug, targetSuffix); - - } else { - - FileHelper.copyLibrary (project, ndll, "Linux" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dso" : ".ndll", applicationDirectory, project.debug, targetSuffix); - - } - - } - - } - - if (targetType == "neko") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - if (isRaspberryPi) { - - NekoHelper.createExecutable (project.templatePaths, "rpi", targetDirectory + "/obj/ApplicationMain.n", executablePath); - NekoHelper.copyLibraries (project.templatePaths, "rpi", applicationDirectory); - - } else { - - NekoHelper.createExecutable (project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); - NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory); - - } - - } else if (targetType == "hl") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl", PathHelper.combine (applicationDirectory, project.app.file + ".hl")); - - } else if (targetType == "nodejs") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - //NekoHelper.createExecutable (project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); - //NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory); - - } else if (targetType == "java") { - - var libPath = PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates/java/lib/"); - - ProcessHelper.runCommand ("", "haxe", [ hxml, "-java-lib", libPath + "disruptor.jar", "-java-lib", libPath + "lwjgl.jar" ]); - //ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - var haxeVersion = project.environment.get ("haxe_ver"); - var haxeVersionString = "3404"; - - if (haxeVersion.length > 4) { - - haxeVersionString = haxeVersion.charAt (0) + haxeVersion.charAt (2) + (haxeVersion.length == 5 ? "0" + haxeVersion.charAt (4) : haxeVersion.charAt (4) + haxeVersion.charAt (5)); - - } - - ProcessHelper.runCommand (targetDirectory + "/obj", "haxelib", [ "run", "hxjava", "hxjava_build.txt", "--haxe-version", haxeVersionString ]); - FileHelper.recursiveCopy (targetDirectory + "/obj/lib", PathHelper.combine (applicationDirectory, "lib")); - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".jar", PathHelper.combine (applicationDirectory, project.app.file + ".jar")); - JavaHelper.copyLibraries (project.templatePaths, "Linux" + (is64 ? "64" : ""), applicationDirectory); - - } else { - - var haxeArgs = [ hxml ]; - var flags = []; - - if (is64) { - - haxeArgs.push ("-D"); - haxeArgs.push ("HXCPP_M64"); - flags.push ("-DHXCPP_M64"); - - } else { - - haxeArgs.push ("-D"); - haxeArgs.push ("HXCPP_M32"); - flags.push ("-DHXCPP_M32"); - - } - - if (!project.targetFlags.exists ("static")) { - - ProcessHelper.runCommand ("", "haxe", haxeArgs); - - if (noOutput) return; - - CPPHelper.compile (project, targetDirectory + "/obj", flags); - - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : ""), executablePath); - - } else { - - ProcessHelper.runCommand ("", "haxe", haxeArgs.concat ([ "-D", "static_link" ])); - - if (noOutput) return; - - CPPHelper.compile (project, targetDirectory + "/obj", flags.concat ([ "-Dstatic_link" ])); - CPPHelper.compile (project, targetDirectory + "/obj", flags, "BuildMain.xml"); - - FileHelper.copyFile (targetDirectory + "/obj/Main" + (project.debug ? "-debug" : ""), executablePath); - - } - - } - - if (PlatformHelper.hostPlatform != Platform.WINDOWS && (targetType != "nodejs" && targetType != "java")) { - - ProcessHelper.runCommand ("", "chmod", [ "755", executablePath ]); - - } - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "Linux " + (is64 ? "64" : "32") + "-bit"); - - } - - - public override function display ():Void { - - Sys.println (getDisplayHXML ()); - - } - - - private function generateContext ():Dynamic { - - var project = project.clone (); - - if (isRaspberryPi) { - - project.haxedefs.set ("rpi", 1); - - } - - var context = project.templateContext; - - context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n"; - context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js"; - context.HL_FILE = targetDirectory + "/obj/ApplicationMain.hl"; - context.CPP_DIR = targetDirectory + "/obj/"; - context.BUILD_DIR = project.app.path + "/linux" + (is64 ? "64" : "") + (isRaspberryPi ? "-rpi" : ""); - context.WIN_ALLOW_SHADERS = false; - - return context; - - } - - - private function getDisplayHXML ():String { - - var hxml = PathHelper.findTemplate (project.templatePaths, targetType + "/hxml/" + buildType + ".hxml"); - var template = new Template (File.getContent (hxml)); - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - return template.execute (context) + "\n-D display"; - - } - - - public override function rebuild ():Void { - - var commands = []; - - if (targetFlags.exists ("rpi")) { - - commands.push ([ "-Dlinux", "-Drpi", "-Dtoolchain=linux", "-DBINDIR=RPi", "-DCXX=arm-linux-gnueabihf-g++", "-DHXCPP_M32", "-DHXCPP_STRIP=arm-linux-gnueabihf-strip", "-DHXCPP_AR=arm-linux-gnueabihf-ar", "-DHXCPP_RANLIB=arm-linux-gnueabihf-ranlib" ]); - - } else { - - if (!targetFlags.exists ("32") && PlatformHelper.hostArchitecture == X64) { - - commands.push ([ "-Dlinux", "-DHXCPP_M64" ]); - - } - - if (!targetFlags.exists ("64") && (command == "rebuild" || PlatformHelper.hostArchitecture == Architecture.X86)) { - - commands.push ([ "-Dlinux", "-DHXCPP_M32" ]); - - } - - } - - CPPHelper.rebuild (project, commands); - - } - - - public override function run ():Void { - - var arguments = additionalArguments.copy (); - - if (LogHelper.verbose) { - - arguments.push ("-verbose"); - - } - - if (targetType == "hl") { - - ProcessHelper.runCommand (applicationDirectory, "hl", [ project.app.file + ".hl" ].concat (arguments)); - - } else if (targetType == "nodejs") { - - NodeJSHelper.run (project, targetDirectory + "/bin/ApplicationMain.js", arguments); - - } else if (targetType == "java") { - - ProcessHelper.runCommand (applicationDirectory, "java", [ "-jar", project.app.file + ".jar" ].concat (arguments)); - - } else if (project.target == PlatformHelper.hostPlatform) { - - arguments = arguments.concat ([ "-livereload" ]); - ProcessHelper.runCommand (applicationDirectory, "./" + Path.withoutDirectory (executablePath), arguments); - - } - - } - - - public override function update ():Void { - - project = project.clone (); - //initialize (project); - - for (asset in project.assets) { - - if (asset.embed && asset.sourcePath == "") { - - var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path); - asset.sourcePath = path; - - } - - } - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - if (targetType == "cpp" && project.targetFlags.exists ("static")) { - - for (i in 0...project.ndlls.length) { - - var ndll = project.ndlls[i]; - - if (ndll.path == null || ndll.path == "") { - - if (isRaspberryPi) { - - context.ndlls[i].path = PathHelper.getLibraryPath (ndll, "RPi", "lib", ".a", project.debug); - - } else { - - context.ndlls[i].path = PathHelper.getLibraryPath (ndll, "Linux" + (is64 ? "64" : ""), "lib", ".a", project.debug); - - } - - } - - } - - } - - PathHelper.mkdir (targetDirectory); - PathHelper.mkdir (targetDirectory + "/obj"); - PathHelper.mkdir (targetDirectory + "/haxe"); - PathHelper.mkdir (applicationDirectory); - - //SWFHelper.generateSWFClasses (project, targetDirectory + "/haxe"); - - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, targetType + "/hxml", targetDirectory + "/haxe", context); - - if (targetType == "cpp" && project.targetFlags.exists ("static")) { - - FileHelper.recursiveSmartCopyTemplate (project, "cpp/static", targetDirectory + "/obj", context); - - } - - //context.HAS_ICON = IconHelper.createIcon (project.icons, 256, 256, PathHelper.combine (applicationDirectory, "icon.png")); - for (asset in project.assets) { - - var path = PathHelper.combine (applicationDirectory, asset.targetPath); - - if (asset.embed != true) { - - if (asset.type != AssetType.TEMPLATE) { - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAssetIfNewer (asset, path); - - } else { - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path, context); - - } - - } - - } - - } - - - public override function watch ():Void { - - var dirs = WatchHelper.processHXML (project, getDisplayHXML ()); - var command = WatchHelper.getCurrentCommand (); - WatchHelper.watch (project, command, dirs); - - } - - - @ignore public override function install ():Void {} - @ignore public override function trace ():Void {} - @ignore public override function uninstall ():Void {} - - -} \ No newline at end of file diff --git a/lime/tools/platforms/MacPlatform.hx b/lime/tools/platforms/MacPlatform.hx deleted file mode 100644 index 7154f148e..000000000 --- a/lime/tools/platforms/MacPlatform.hx +++ /dev/null @@ -1,425 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import haxe.Template; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.CSHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.GUID; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.HaxelibHelper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.JavaHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.NekoHelper; -import lime.tools.helpers.NodeJSHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.WatchHelper; -import lime.project.AssetType; -import lime.project.Architecture; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Icon; -import lime.project.Platform; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - - -class MacPlatform extends PlatformTarget { - - - private var applicationDirectory:String; - private var contentDirectory:String; - private var executableDirectory:String; - private var executablePath:String; - private var is64:Bool; - private var targetType:String; - - - public function new (command:String, _project:HXProject, targetFlags:Map ) { - - super (command, _project, targetFlags); - - for (architecture in project.architectures) { - - if (architecture == Architecture.X64) { - - is64 = true; - - } - - } - - if (project.targetFlags.exists ("neko") || project.target != PlatformHelper.hostPlatform) { - - targetType = "neko"; - - } else if (project.targetFlags.exists ("hl")) { - - targetType = "hl"; - - } else if (project.targetFlags.exists ("java")) { - - targetType = "java"; - - } else if (project.targetFlags.exists ("nodejs")) { - - targetType = "nodejs"; - - } else if (project.targetFlags.exists ("cs")) { - - targetType = "cs"; - - } else { - - targetType = "cpp"; - - } - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("mac.output-directory", targetType == "cpp" ? "macos" : targetType)); - targetDirectory = StringTools.replace (targetDirectory, "arch64", is64 ? "64" : ""); - applicationDirectory = targetDirectory + "/bin/" + project.app.file + ".app"; - contentDirectory = applicationDirectory + "/Contents/Resources"; - executableDirectory = applicationDirectory + "/Contents/MacOS"; - executablePath = executableDirectory + "/" + project.app.file; - - } - - - public override function build ():Void { - - var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; - - PathHelper.mkdir (targetDirectory); - - if (!project.targetFlags.exists ("static") || targetType != "cpp") { - - var targetSuffix = (targetType == "hl") ? ".hdll" : null; - - for (ndll in project.ndlls) { - - FileHelper.copyLibrary (project, ndll, "Mac" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dylib" : ".ndll", executableDirectory, project.debug, targetSuffix); - - } - - } - - if (targetType == "neko") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - NekoHelper.createExecutable (project.templatePaths, "mac" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); - NekoHelper.copyLibraries (project.templatePaths, "mac" + (is64 ? "64" : ""), executableDirectory); - - } else if (targetType == "hl") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".hl", PathHelper.combine (executableDirectory, project.app.file + ".hl")); - - } else if (targetType == "java") { - - var libPath = PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates/java/lib/"); - - ProcessHelper.runCommand ("", "haxe", [ hxml, "-java-lib", libPath + "disruptor.jar", "-java-lib", libPath + "lwjgl.jar" ]); - - if (noOutput) return; - - HaxelibHelper.runCommand (targetDirectory + "/obj", [ "run", "hxjava", "hxjava_build.txt", "--haxe-version", "3103" ]); - FileHelper.recursiveCopy (targetDirectory + "/obj/lib", PathHelper.combine (executableDirectory, "lib")); - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".jar", PathHelper.combine (executableDirectory, project.app.file + ".jar")); - JavaHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory); - - } else if (targetType == "nodejs") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - //NekoHelper.createExecutable (project.templatePaths, "Mac" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); - //NekoHelper.copyLibraries (project.templatePaths, "Mac" + (is64 ? "64" : ""), executableDirectory); - - } else if (targetType == "cs") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - CSHelper.copySourceFiles (project.templatePaths, targetDirectory + "/obj/src"); - var txtPath = targetDirectory + "/obj/hxcs_build.txt"; - CSHelper.addSourceFiles (txtPath, CSHelper.ndllSourceFiles); - CSHelper.addGUID (txtPath, GUID.uuid ()); - CSHelper.compile (project, targetDirectory + "/obj", targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : ""), "x64", "desktop"); - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : "") + ".exe", executablePath + ".exe"); - File.saveContent (executablePath, "#!/bin/sh\nmono ${PWD}/" + project.app.file + ".exe"); - - } else { - - var haxeArgs = [ hxml, "-D", "HXCPP_CLANG" ]; - var flags = [ "-DHXCPP_CLANG" ]; - - if (is64) { - - haxeArgs.push ("-D"); - haxeArgs.push ("HXCPP_M64"); - flags.push ("-DHXCPP_M64"); - - } - - if (!project.targetFlags.exists ("static")) { - - ProcessHelper.runCommand ("", "haxe", haxeArgs); - - if (noOutput) return; - - CPPHelper.compile (project, targetDirectory + "/obj", flags); - - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : ""), executablePath); - - } else { - - ProcessHelper.runCommand ("", "haxe", haxeArgs.concat ([ "-D", "static_link" ])); - - if (noOutput) return; - - CPPHelper.compile (project, targetDirectory + "/obj", flags.concat ([ "-Dstatic_link" ])); - CPPHelper.compile (project, targetDirectory + "/obj", flags, "BuildMain.xml"); - - FileHelper.copyFile (targetDirectory + "/obj/Main" + (project.debug ? "-debug" : ""), executablePath); - - } - - } - - if (PlatformHelper.hostPlatform != Platform.WINDOWS && targetType != "nodejs" && targetType != "java") { - - ProcessHelper.runCommand ("", "chmod", [ "755", executablePath ]); - - } - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "Mac"); - - } - - - public override function display ():Void { - - Sys.println (getDisplayHXML ()); - - } - - - private function generateContext ():Dynamic { - - var context = project.templateContext; - context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n"; - context.NODE_FILE = executableDirectory + "/ApplicationMain.js"; - context.HL_FILE = targetDirectory + "/obj/ApplicationMain.hl"; - context.CPP_DIR = targetDirectory + "/obj/"; - context.BUILD_DIR = project.app.path + "/mac" + (is64 ? "64" : ""); - - return context; - - } - - - private function getDisplayHXML ():String { - - var hxml = PathHelper.findTemplate (project.templatePaths, targetType + "/hxml/" + buildType + ".hxml"); - var template = new Template (File.getContent (hxml)); - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - return template.execute (context) + "\n-D display"; - - } - - - public override function rebuild ():Void { - - var commands = []; - - if (!targetFlags.exists ("32") && (command == "rebuild" || PlatformHelper.hostArchitecture == Architecture.X64)) { - - commands.push ([ "-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M64" ]); - - } - - if (!targetFlags.exists ("64") && (command == "rebuild" || PlatformHelper.hostArchitecture == Architecture.X86)) { - - commands.push ([ "-Dmac", "-DHXCPP_CLANG", "-DHXCPP_M32" ]); - - } - - CPPHelper.rebuild (project, commands); - - } - - - public override function run ():Void { - - var arguments = additionalArguments.copy (); - - if (LogHelper.verbose) { - - arguments.push ("-verbose"); - - } - - if (targetType == "hl") { - - ProcessHelper.runCommand (applicationDirectory, "hl", [ project.app.file + ".hl" ].concat (arguments)); - - } else if (targetType == "nodejs") { - - NodeJSHelper.run (project, executableDirectory + "/ApplicationMain.js", arguments); - - } else if (targetType == "java") { - - ProcessHelper.runCommand (executableDirectory, "java", [ "-jar", project.app.file + ".jar" ].concat (arguments)); - - } else if (project.target == PlatformHelper.hostPlatform) { - - arguments = arguments.concat ([ "-livereload" ]); - ProcessHelper.runCommand (executableDirectory, "./" + Path.withoutDirectory (executablePath), arguments); - - } - - } - - - public override function update ():Void { - - project = project.clone (); - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - for (asset in project.assets) { - - if (asset.embed && asset.sourcePath == "") { - - var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path); - asset.sourcePath = path; - - } - - } - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - if (targetType == "cpp" && project.targetFlags.exists ("static")) { - - for (i in 0...project.ndlls.length) { - - var ndll = project.ndlls[i]; - - if (ndll.path == null || ndll.path == "") { - - context.ndlls[i].path = PathHelper.getLibraryPath (ndll, "Mac" + (is64 ? "64" : ""), "lib", ".a", project.debug); - - } - - } - - } - - PathHelper.mkdir (targetDirectory); - PathHelper.mkdir (targetDirectory + "/obj"); - PathHelper.mkdir (targetDirectory + "/haxe"); - PathHelper.mkdir (applicationDirectory); - PathHelper.mkdir (contentDirectory); - - //SWFHelper.generateSWFClasses (project, targetDirectory + "/haxe"); - - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, targetType + "/hxml", targetDirectory + "/haxe", context); - - if (targetType == "cpp" && project.targetFlags.exists ("static")) { - - FileHelper.recursiveSmartCopyTemplate (project, "cpp/static", targetDirectory + "/obj", context); - - } - - FileHelper.copyFileTemplate (project.templatePaths, "mac/Info.plist", targetDirectory + "/bin/" + project.app.file + ".app/Contents/Info.plist", context); - FileHelper.copyFileTemplate (project.templatePaths, "mac/Entitlements.plist", targetDirectory + "/bin/" + project.app.file + ".app/Contents/Entitlements.plist", context); - - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - context.HAS_ICON = IconHelper.createMacIcon (icons, PathHelper.combine (contentDirectory, "icon.icns")); - - for (asset in project.assets) { - - if (asset.embed != true) { - - if (asset.type != AssetType.TEMPLATE) { - - PathHelper.mkdir (Path.directory (PathHelper.combine (contentDirectory, asset.targetPath))); - FileHelper.copyAssetIfNewer (asset, PathHelper.combine (contentDirectory, asset.targetPath)); - - } else { - - PathHelper.mkdir (Path.directory (PathHelper.combine (targetDirectory, asset.targetPath))); - FileHelper.copyAsset (asset, PathHelper.combine (targetDirectory, asset.targetPath), context); - - } - - } - - } - - } - - - public override function watch ():Void { - - var dirs = WatchHelper.processHXML (project, getDisplayHXML ()); - var command = WatchHelper.getCurrentCommand (); - WatchHelper.watch (project, command, dirs); - - } - - - @ignore public override function install ():Void {} - @ignore public override function trace ():Void {} - @ignore public override function uninstall ():Void {} - - -} \ No newline at end of file diff --git a/lime/tools/platforms/TVOSPlatform.hx b/lime/tools/platforms/TVOSPlatform.hx deleted file mode 100644 index 5f381f215..000000000 --- a/lime/tools/platforms/TVOSPlatform.hx +++ /dev/null @@ -1,649 +0,0 @@ -package lime.tools.platforms; - - -//import openfl.display.BitmapData; -import haxe.io.Path; -import haxe.Json; -import haxe.Template; -import lime.tools.helpers.ArrayHelper; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.TVOSHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.StringHelper; -import lime.tools.helpers.WatchHelper; -import lime.graphics.Image; -import lime.project.Architecture; -import lime.project.Asset; -import lime.project.AssetType; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Icon; -import lime.project.Keystore; -import lime.project.NDLL; -import lime.project.Platform; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - - -class TVOSPlatform extends PlatformTarget { - - - public function new (command:String, _project:HXProject, targetFlags:Map ) { - - super (command, _project, targetFlags); - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("tvos.output-directory", "tvos")); - - } - - - public override function build ():Void { - - if (project.targetFlags.exists ("xcode") && PlatformHelper.hostPlatform == Platform.MAC) { - - ProcessHelper.runCommand ("", "open", [ targetDirectory + "/" + project.app.file + ".xcodeproj" ] ); - - } else { - - TVOSHelper.build (project, targetDirectory); - - if (noOutput) return; - - if (!project.targetFlags.exists ("simulator")) { - - TVOSHelper.sign (project, targetDirectory + "/bin"); - - } - - } - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - TVOSHelper.deploy (project, targetDirectory); - - } - - - public override function display ():Void { - - Sys.println (getDisplayHXML ()); - - } - - - private function generateContext ():Dynamic { - - project = project.clone (); - - project.sources.unshift (""); - project.sources = PathHelper.relocatePaths (project.sources, PathHelper.combine (targetDirectory, project.app.file + "/haxe")); - //project.dependencies.push ("stdc++"); - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - if (project.targetFlags.exists ("final")) { - - project.haxedefs.set ("final", ""); - - } - - if (!project.config.exists ("tvos.identity")) { - - project.config.set ("tvos.identity", "tvOS Developer"); - - } - - var context = project.templateContext; - - context.HAS_ICON = false; - context.HAS_LAUNCH_IMAGE = false; - context.OBJC_ARC = false; - context.KEY_STORE_IDENTITY = project.config.getString ("tvos.identity"); - - context.linkedLibraries = []; - - for (dependency in project.dependencies) { - - if (!StringTools.endsWith (dependency.name, ".framework") && !StringTools.endsWith (dependency.name, ".tbd") && !StringTools.endsWith (dependency.path, ".framework")) { - - if (dependency.path != "") { - - var name = Path.withoutDirectory (Path.withoutExtension (dependency.path)); - - project.config.push ("tvos.linker-flags", "-force_load $SRCROOT/$PRODUCT_NAME/lib/$CURRENT_ARCH/" + Path.withoutDirectory (dependency.path)); - - if (StringTools.startsWith (name, "lib")) { - - name = name.substring (3, name.length); - - } - - context.linkedLibraries.push (name); - - } else if (dependency.name != "") { - - context.linkedLibraries.push (dependency.name); - - } - - } - - } - - var valid_archs = new Array (); - var arm64 = false; - var architectures = project.architectures; - - if (architectures == null || architectures.length == 0) { - - architectures = [ Architecture.ARM64 ]; - - } - - /*if (project.config.getString ("ios.device", "universal") == "universal" || project.config.getString ("ios.device") == "iphone") { - - if (project.config.getFloat ("ios.deployment", 5.1) < 5) { - - ArrayHelper.addUnique (architectures, Architecture.ARMV6); - - } - - }*/ - - for (architecture in project.architectures) { - - switch (architecture) { - - case ARM64: valid_archs.push ("arm64"); arm64 = true; - default: - - } - - } - - context.CURRENT_ARCHS = "( " + valid_archs.join(",") + ") "; - - valid_archs.push ("i386"); - - context.VALID_ARCHS = valid_archs.join(" "); - context.THUMB_SUPPORT = ""; - - var requiredCapabilities = []; - - requiredCapabilities.push( { name: "arm64", value: true } ); - - context.REQUIRED_CAPABILITY = requiredCapabilities; - context.ARM64 = arm64; - context.TARGET_DEVICES = switch (project.config.getString ("tvos.device", "appletv")) { case "appletv": "3"; default: "3"; } - context.DEPLOYMENT = project.config.getString ("tvos.deployment", "9.0"); - - if (project.config.getString ("tvos.compiler") == "llvm" || project.config.getString ("tvos.compiler", "clang") == "clang") { - - context.OBJC_ARC = true; - - } - - context.IOS_COMPILER = project.config.getString ("tvos.compiler", "clang"); - context.CPP_BUILD_LIBRARY = project.config.getString ("cpp.buildLibrary", "hxcpp"); - - var json = Json.parse (File.getContent (PathHelper.getHaxelib (new Haxelib ("hxcpp"), true) + "/haxelib.json")); - - if (Std.parseFloat (json.version) > 3.1) { - - context.CPP_LIBPREFIX = "lib"; - - } else { - - context.CPP_LIBPREFIX = ""; - - } - - context.IOS_LINKER_FLAGS = ["-stdlib=libc++"].concat (project.config.getArrayString ("tvos.linker-flags")); - context.IOS_NON_EXEMPT_ENCRYPTION = project.config.getBool ("tvos.non-exempt-encryption", true); - - switch (project.window.orientation) { - - case PORTRAIT: - context.IOS_APP_ORIENTATION = "UIInterfaceOrientationPortraitUIInterfaceOrientationPortraitUpsideDown"; - case LANDSCAPE: - context.IOS_APP_ORIENTATION = "UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRight"; - case ALL: - context.IOS_APP_ORIENTATION = "UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRightUIInterfaceOrientationPortraitUIInterfaceOrientationPortraitUpsideDown"; - //case "allButUpsideDown": - //context.IOS_APP_ORIENTATION = "UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRightUIInterfaceOrientationPortrait"; - default: - context.IOS_APP_ORIENTATION = "UIInterfaceOrientationLandscapeLeftUIInterfaceOrientationLandscapeRightUIInterfaceOrientationPortraitUIInterfaceOrientationPortraitUpsideDown"; - - } - - context.ADDL_PBX_BUILD_FILE = ""; - context.ADDL_PBX_FILE_REFERENCE = ""; - context.ADDL_PBX_FRAMEWORKS_BUILD_PHASE = ""; - context.ADDL_PBX_FRAMEWORK_GROUP = ""; - - context.frameworkSearchPaths = []; - - for (dependency in project.dependencies) { - - var name = null; - var path = null; - var fileType = null; - - if (Path.extension (dependency.name) == "framework") { - - name = dependency.name; - path = "/System/Library/Frameworks/" + dependency.name; - fileType = "wrapper.framework"; - - } else if (Path.extension (dependency.name) == "tbd") { - - name = dependency.name; - path = "usr/lib/" + dependency.name; - fileType = "sourcecode.text-based-dylib-definition"; - - } else if (Path.extension (dependency.path) == "framework") { - - name = Path.withoutDirectory (dependency.path); - path = PathHelper.tryFullPath (dependency.path); - fileType = "wrapper.framework"; - - } - - if (name != null) { - - var frameworkID = "11C0000000000018" + StringHelper.getUniqueID (); - var fileID = "11C0000000000018" + StringHelper.getUniqueID (); - - ArrayHelper.addUnique (context.frameworkSearchPaths, Path.directory (path)); - - context.ADDL_PBX_BUILD_FILE += " " + frameworkID + " /* " + name + " in Frameworks */ = {isa = PBXBuildFile; fileRef = " + fileID + " /* " + name + " */; };\n"; - context.ADDL_PBX_FILE_REFERENCE += " " + fileID + " /* " + name + " */ = {isa = PBXFileReference; lastKnownFileType = \"" + fileType + "\"; name = \"" + name + "\"; path = \"" + path + "\"; sourceTree = SDKROOT; };\n"; - context.ADDL_PBX_FRAMEWORKS_BUILD_PHASE += " " + frameworkID + " /* " + name + " in Frameworks */,\n"; - context.ADDL_PBX_FRAMEWORK_GROUP += " " + fileID + " /* " + name + " */,\n"; - - } - - } - - context.HXML_PATH = PathHelper.findTemplate (project.templatePaths, "tvos/PROJ/haxe/Build.hxml"); - context.PRERENDERED_ICON = project.config.getBool ("tvos.prerenderedIcon", false); - - var haxelibPath = project.environment.get ("HAXELIB_PATH"); - - if (haxelibPath != null) { - - context.HAXELIB_PATH = 'export HAXELIB_PATH=$haxelibPath;'; - - } else { - - context.HAXELIB_PATH = ''; - - } - - return context; - - } - - - private function getDisplayHXML ():String { - - var hxml = PathHelper.findTemplate (project.templatePaths, "tvos/PROJ/haxe/Build.hxml"); - var template = new Template (File.getContent (hxml)); - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - return template.execute (context) + "\n-D display"; - - } - - - public override function rebuild ():Void { - - var arm64 = (command == "rebuild" || (project.architectures.indexOf (Architecture.ARM64) > -1 && !project.targetFlags.exists ("simulator"))); - var i386 = (command == "rebuild" || project.targetFlags.exists ("simulator")); - var x86_64 = (command == "rebuild" || project.targetFlags.exists ("simulator")); - - var commands = []; - - if (arm64) commands.push ([ "-Dtvos", "-Dappletvos", "-DHXCPP_CPP11", "-DHXCPP_ARM64", "-DOBJC_ARC", "-DENABLE_BITCODE" ]); - if (i386) commands.push ([ "-Dtvos", "-Dappletvsim", "-Dsimulator", "-DHXCPP_CPP11", "-DOBJC_ARC", "-DENABLE_BITCODE" ]); - if (x86_64) commands.push ([ "-Dtvos", "-Dappletvsim", "-Dsimulator", "-DHXCPP_M64", "-DHXCPP_CPP11", "-DOBJC_ARC", "-DENABLE_BITCODE" ]); - - CPPHelper.rebuild (project, commands); - - } - - - public override function run ():Void { - - if (project.targetFlags.exists ("xcode")) return; - - TVOSHelper.launch (project, targetDirectory); - - } - - - public override function update ():Void { - - project = project.clone (); - - for (asset in project.assets) { - - if (asset.embed && asset.sourcePath == "") { - - var path = PathHelper.combine (targetDirectory + "/" + project.app.file + "/obj/tmp", asset.targetPath); - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path); - asset.sourcePath = path; - - } - - } - - //var manifest = new Asset (); - //manifest.id = "__manifest__"; - //manifest.data = AssetHelper.createManifest (project).serialize (); - //manifest.resourceName = manifest.flatName = manifest.targetPath = "manifest"; - //manifest.type = AssetType.TEXT; - //project.assets.push (manifest); - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - var projectDirectory = targetDirectory + "/" + project.app.file + "/"; - - PathHelper.mkdir (targetDirectory); - PathHelper.mkdir (projectDirectory); - PathHelper.mkdir (projectDirectory + "/haxe"); - PathHelper.mkdir (projectDirectory + "/haxe/lime/installer"); - - var iconSizes:Array = [ - { name : "Icon-Small.png", size : 29 }, - { name : "Icon-Small-40.png", size : 40 }, - { name : "Icon-Small-50.png", size : 50 }, - { name : "Icon.png", size : 57 }, - { name : "Icon-Small@2x.png", size : 58 }, - { name : "Icon-72.png", size : 72 }, - { name : "Icon-76.png", size : 76 }, - { name : "Icon-Small-40@2x.png", size : 80 }, - { name : "Icon-Small-50@2x.png", size : 100 }, - { name : "Icon@2x.png", size : 114 }, - { name : "Icon-60@2x.png", size : 120 }, - { name : "Icon-72@2x.png", size : 144 }, - { name : "Icon-76@2x.png", size : 152 }, - { name : "Icon-60@3x.png", size : 180 }, - ]; - - context.HAS_ICON = true; - - var iconPath = PathHelper.combine (projectDirectory, "Images.xcassets/AppIcon.appiconset"); - PathHelper.mkdir (iconPath); - - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - for (iconSize in iconSizes) { - - if (!IconHelper.createIcon (icons, iconSize.size, iconSize.size, PathHelper.combine (iconPath, iconSize.name))) { - - context.HAS_ICON = false; - - } - - } - - var splashSizes:Array = [ - { name: "Default.png", w: 320, h: 480 }, // iPhone, portrait - { name: "Default@2x.png", w: 640, h: 960 }, // iPhone Retina, portrait - { name: "Default-568h@2x.png", w: 640, h: 1136 }, // iPhone 5, portrait - { name: "Default-Portrait.png", w: 768, h: 1024 }, // iPad, portrait - { name: "Default-Landscape.png", w: 1024, h: 768 }, // iPad, landscape - { name: "Default-Portrait@2x.png", w: 1536, h: 2048 }, // iPad Retina, portrait - { name: "Default-Landscape@2x.png", w: 2048, h: 1536 }, // iPad Retina, landscape - { name: "Default-667h@2x.png", w: 750, h: 1334 }, // iPhone 6, portrait - { name: "Default-736h@3x.png", w: 1242, h: 2208 }, // iPhone 6 Plus, portrait - { name: "Default-736h-Landscape@3x.png", w: 2208, h: 1242 }, // iPhone 6 Plus, landscape - ]; - - var splashScreenPath = PathHelper.combine (projectDirectory, "Images.xcassets/LaunchImage.launchimage"); - PathHelper.mkdir (splashScreenPath); - - for (size in splashSizes) { - - var match = false; - - for (splashScreen in project.splashScreens) { - - if (splashScreen.width == size.w && splashScreen.height == size.h && Path.extension (splashScreen.path) == "png") { - - FileHelper.copyFile (splashScreen.path, PathHelper.combine (splashScreenPath, size.name)); - match = true; - - } - - } - - if (!match) { - - var imagePath = PathHelper.combine (splashScreenPath, size.name); - - if (!FileSystem.exists (imagePath)) { - - LogHelper.info ("", " - \x1b[1mGenerating image:\x1b[0m " + imagePath); - - var image = new Image (null, 0, 0, size.w, size.h, (0xFF << 24) | (project.window.background & 0xFFFFFF)); - var bytes = image.encode ("png"); - - File.saveBytes (imagePath, bytes); - - } - - } - - } - - context.HAS_LAUNCH_IMAGE = true; - - PathHelper.mkdir (projectDirectory + "/resources"); - PathHelper.mkdir (projectDirectory + "/haxe/build"); - - FileHelper.recursiveSmartCopyTemplate (project, "tvos/resources", projectDirectory + "/resources", context, true, false); - FileHelper.recursiveSmartCopyTemplate (project, "tvos/PROJ/haxe", projectDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "haxe", projectDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "tvos/PROJ/Classes", projectDirectory + "/Classes", context); - FileHelper.recursiveSmartCopyTemplate (project, "tvos/PROJ/Images.xcassets", projectDirectory + "/Images.xcassets", context); - FileHelper.copyFileTemplate (project.templatePaths, "tvos/PROJ/PROJ-Info.plist", projectDirectory + "/" + project.app.file + "-Info.plist", context); - FileHelper.copyFileTemplate (project.templatePaths, "tvos/PROJ/PROJ-Prefix.pch", projectDirectory + "/" + project.app.file + "-Prefix.pch", context); - FileHelper.recursiveSmartCopyTemplate (project, "tvos/PROJ.xcodeproj", targetDirectory + "/" + project.app.file + ".xcodeproj", context); - - //SWFHelper.generateSWFClasses (project, projectDirectory + "/haxe"); - - PathHelper.mkdir (projectDirectory + "/lib"); - - for (archID in 0...3) { - - var arch = [ "arm64", "i386", "x86_64" ][archID]; - - if (arch == "arm64" && !context.ARM64) - continue; - - var libExt = [ ".appletvos-64.a", ".appletvsim.a", ".appletvsim-64.a" ][archID]; - - PathHelper.mkdir (projectDirectory + "/lib/" + arch); - PathHelper.mkdir (projectDirectory + "/lib/" + arch + "-debug"); - - for (ndll in project.ndlls) { - - //if (ndll.haxelib != null) { - - var releaseLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", libExt); - LogHelper.info("releaseLib: " + releaseLib); - var debugLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", libExt, true); - var releaseDest = projectDirectory + "/lib/" + arch + "/lib" + ndll.name + ".a"; - LogHelper.info("releaseDest: " + releaseDest); - var debugDest = projectDirectory + "/lib/" + arch + "-debug/lib" + ndll.name + ".a"; - - if (!FileSystem.exists (releaseLib)) { - - releaseLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", ".appletvos-64.a"); - LogHelper.info("alternative releaseLib: " + releaseLib); - debugLib = PathHelper.getLibraryPath (ndll, "AppleTV", "lib", ".appletvos-64.a", true); - - } - - FileHelper.copyIfNewer (releaseLib, releaseDest); - - if (FileSystem.exists (debugLib) && debugLib != releaseLib) { - - FileHelper.copyIfNewer (debugLib, debugDest); - - } else if (FileSystem.exists (debugDest)) { - - FileSystem.deleteFile (debugDest); - - } - - //} - - } - - for (dependency in project.dependencies) { - - if (StringTools.endsWith (dependency.path, ".a")) { - - var fileName = Path.withoutDirectory (dependency.path); - - if (!StringTools.startsWith (fileName, "lib")) { - - fileName = "lib" + fileName; - - } - - FileHelper.copyIfNewer (dependency.path, projectDirectory + "/lib/" + arch + "/" + fileName); - - } - - } - - } - - PathHelper.mkdir (projectDirectory + "/assets"); - - for (asset in project.assets) { - - if (asset.type != AssetType.TEMPLATE) { - - var targetPath = PathHelper.combine (projectDirectory + "/assets/", asset.resourceName); - - //var sourceAssetPath:String = projectDirectory + "haxe/" + asset.sourcePath; - - PathHelper.mkdir (Path.directory (targetPath)); - FileHelper.copyAssetIfNewer (asset, targetPath); - - //PathHelper.mkdir (Path.directory (sourceAssetPath)); - //FileHelper.linkFile (flatAssetPath, sourceAssetPath, true, true); - - } else { - - var targetPath = PathHelper.combine (projectDirectory, asset.targetPath); - - PathHelper.mkdir (Path.directory (targetPath)); - FileHelper.copyAsset (asset, targetPath, context); - - } - - } - - if (project.targetFlags.exists ("xcode") && PlatformHelper.hostPlatform == Platform.MAC && command == "update") { - - ProcessHelper.runCommand ("", "open", [ targetDirectory + "/" + project.app.file + ".xcodeproj" ] ); - - } - - } - - - /*private function updateLaunchImage () { - - var destination = buildDirectory + "/ios"; - PathHelper.mkdir (destination); - - var has_launch_image = false; - if (launchImages.length > 0) has_launch_image = true; - - for (launchImage in launchImages) { - - var splitPath = launchImage.name.split ("/"); - var path = destination + "/" + splitPath[splitPath.length - 1]; - FileHelper.copyFile (launchImage.name, path, context, false); - - } - - context.HAS_LAUNCH_IMAGE = has_launch_image; - - }*/ - - - public override function watch ():Void { - - var dirs = WatchHelper.processHXML (project, getDisplayHXML ()); - var command = WatchHelper.getCurrentCommand (); - WatchHelper.watch (project, command, dirs); - - } - - - @ignore public override function install ():Void {} - @ignore public override function trace ():Void {} - @ignore public override function uninstall ():Void {} - - -} - - -private typedef IconSize = { - - name:String, - size:Int, - -} - - -private typedef SplashSize = { - - name:String, - w:Int, - h:Int, - -} \ No newline at end of file diff --git a/lime/tools/platforms/TizenPlatform.hx b/lime/tools/platforms/TizenPlatform.hx deleted file mode 100644 index f7419aa85..000000000 --- a/lime/tools/platforms/TizenPlatform.hx +++ /dev/null @@ -1,232 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import haxe.Template; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.TizenHelper; -import lime.project.AssetType; -import lime.project.HXProject; -import lime.project.Icon; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - - -class TizenPlatform extends PlatformTarget { - - - private static var uuid:String = null; - - - public function new (command:String, _project:HXProject, targetFlags:Map ) { - - super (command, _project, targetFlags); - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("tizen.output-directory", "tizen")); - - } - - - public override function build ():Void { - - var destination = targetDirectory + "/bin/"; - - var arch = ""; - - if (project.targetFlags.exists ("simulator")) { - - arch = "-x86"; - - } - - for (ndll in project.ndlls) { - - FileHelper.copyLibrary (project, ndll, "Tizen", "", arch + ".so", destination + "lib/", project.debug, ".so"); - - } - - var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; - - ProcessHelper.runCommand ("", "haxe", [ hxml, "-D", "tizen" ] ); - - if (noOutput) return; - - var args = [ "-Dtizen", "-DAPP_ID=" + TizenHelper.getUUID (project) ]; - - if (project.targetFlags.exists ("simulator")) { - - args.push ("-Dsimulator"); - - } - - CPPHelper.compile (project, targetDirectory + "/obj", args); - FileHelper.copyIfNewer (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : "") + ".exe", targetDirectory + "/bin/CommandLineBuild/" + project.app.file + ".exe"); - TizenHelper.createPackage (project, targetDirectory + "/bin/CommandLineBuild", ""); - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "Tizen"); - - } - - - public override function display ():Void { - - var hxml = PathHelper.findTemplate (project.templatePaths, "tizen/hxml/" + buildType + ".hxml"); - - var context = project.templateContext; - context.CPP_DIR = targetDirectory + "/obj"; - context.OUTPUT_DIR = targetDirectory; - - var template = new Template (File.getContent (hxml)); - - Sys.println (template.execute (context)); - Sys.println ("-D display"); - - } - - - public override function rebuild ():Void { - - var device = (command == "rebuild" || !targetFlags.exists ("simulator")); - var simulator = (command == "rebuild" || targetFlags.exists ("simulator")); - - var commands = []; - - if (device) commands.push ([ "-Dtizen" ]); - if (simulator) commands.push ([ "-Dtizen", "-Dsimulator" ]); - - CPPHelper.rebuild (project, commands); - - } - - - public override function run ():Void { - - TizenHelper.install (project, targetDirectory + "/bin/CommandLineBuild"); - TizenHelper.launch (project); - - } - - - public override function trace ():Void { - - TizenHelper.trace (project); - - } - - - public override function update ():Void { - - project = project.clone (); - - for (asset in project.assets) { - - if (asset.embed && asset.sourcePath == "") { - - var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path); - asset.sourcePath = path; - - } - - } - - var destination = targetDirectory + "/bin/"; - PathHelper.mkdir (destination); - - for (asset in project.assets) { - - asset.resourceName = "../res/" + asset.resourceName; - - } - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - var context = project.templateContext; - context.CPP_DIR = targetDirectory + "/obj"; - context.OUTPUT_DIR = targetDirectory; - context.APP_PACKAGE = TizenHelper.getUUID (project); - context.SIMULATOR = project.targetFlags.exists ("simulator"); - - PathHelper.mkdir (destination + "shared/res/screen-density-xhigh"); - - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - if (IconHelper.createIcon (icons, 117, 117, PathHelper.combine (destination + "shared/res/screen-density-xhigh", "mainmenu.png"))) { - - context.APP_ICON = "mainmenu.png"; - - } - - FileHelper.recursiveSmartCopyTemplate (project, "tizen/template", destination, context); - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "tizen/hxml", targetDirectory + "/haxe", context); - - for (asset in project.assets) { - - var path = PathHelper.combine (destination + "res/", asset.targetPath); - - PathHelper.mkdir (Path.directory (path)); - - if (asset.type != AssetType.TEMPLATE) { - - if (asset.targetPath == "/appinfo.json") { - - FileHelper.copyAsset (asset, path, context); - - } else { - - // going to root directory now, but should it be a forced "assets" folder later? - - FileHelper.copyAssetIfNewer (asset, path); - - } - - } else { - - FileHelper.copyAsset (asset, path, context); - - } - - } - - } - - - @ignore public override function install ():Void {} - @ignore public override function uninstall ():Void {} - - -} \ No newline at end of file diff --git a/lime/tools/platforms/WebOSPlatform.hx b/lime/tools/platforms/WebOSPlatform.hx deleted file mode 100644 index 15b5f7421..000000000 --- a/lime/tools/platforms/WebOSPlatform.hx +++ /dev/null @@ -1,205 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import haxe.Template; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.WebOSHelper; -import lime.project.AssetType; -import lime.project.HXProject; -import lime.project.Icon; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - - -class WebOSPlatform extends PlatformTarget { - - - public function new (command:String, _project:HXProject, targetFlags:Map) { - - super (command, _project, targetFlags); - - targetDirectory = project.app.path + "/webos"; - - } - - - public override function build ():Void { - - var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; - var destination = targetDirectory + "/bin/"; - - for (ndll in project.ndlls) { - - FileHelper.copyLibrary (project, ndll, "webOS", "", ".so", destination, project.debug); - - } - - ProcessHelper.runCommand ("", "haxe", [ hxml, "-D", "webos", "-D", "HXCPP_LOAD_DEBUG", "-D", "HXCPP_RTLD_LAZY" ] ); - - if (noOutput) return; - - CPPHelper.compile (project, targetDirectory + "/obj", [ "-Dwebos", "-DHXCPP_LOAD_DEBUG", "-DHXCPP_RTLD_LAZY" ]); - - FileHelper.copyIfNewer (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : ""), targetDirectory + "/bin/" + project.app.file); - - WebOSHelper.createPackage (project, targetDirectory + "", "bin"); - - } - - - public override function clean ():Void { - - var targetPath = targetDirectory + ""; - - if (FileSystem.exists (targetPath)) { - - PathHelper.removeDirectory (targetPath); - - } - - } - - - public override function deploy ():Void { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "webOS"); - - } - - - public override function display ():Void { - - var hxml = PathHelper.findTemplate (project.templatePaths, "webos/hxml/" + buildType + ".hxml"); - - var context = project.templateContext; - context.CPP_DIR = targetDirectory + "/obj"; - context.OUTPUT_DIR = targetDirectory; - - var template = new Template (File.getContent (hxml)); - - Sys.println (template.execute (context)); - Sys.println ("-D display"); - - } - - - public override function install ():Void { - - WebOSHelper.install (project, targetDirectory + ""); - - } - - - public override function rebuild ():Void { - - CPPHelper.rebuild (project, [[ "-Dwebos" ]]); - - } - - - public override function run ():Void { - - WebOSHelper.launch (project); - - } - - - public override function trace ():Void { - - WebOSHelper.trace (project); - - } - - - public override function update ():Void { - - project = project.clone (); - - for (asset in project.assets) { - - if (asset.embed && asset.sourcePath == "") { - - var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path); - asset.sourcePath = path; - - } - - } - - var destination = targetDirectory + "/bin/"; - PathHelper.mkdir (destination); - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - var context = project.templateContext; - context.CPP_DIR = targetDirectory + "/obj"; - context.OUTPUT_DIR = targetDirectory; - - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - if (IconHelper.createIcon (icons, 64, 64, PathHelper.combine (destination, "icon.png"))) { - - context.APP_ICON = "icon.png"; - - } - - FileHelper.recursiveSmartCopyTemplate (project, "webos/template", destination, context); - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "webos/hxml", targetDirectory + "/haxe", context); - - //SWFHelper.generateSWFClasses (project, targetDirectory + "/haxe"); - - for (asset in project.assets) { - - var path = PathHelper.combine (destination, asset.targetPath); - - PathHelper.mkdir (Path.directory (path)); - - if (asset.type != AssetType.TEMPLATE) { - - if (asset.targetPath == "/appinfo.json") { - - FileHelper.copyAsset (asset, path, context); - - } else { - - // going to root directory now, but should it be a forced "assets" folder later? - - FileHelper.copyAssetIfNewer (asset, path); - - } - - } else { - - FileHelper.copyAsset (asset, path, context); - - } - - } - - } - - - @ignore public override function uninstall ():Void {} - - -} \ No newline at end of file diff --git a/lime/tools/platforms/WindowsPlatform.hx b/lime/tools/platforms/WindowsPlatform.hx deleted file mode 100644 index 74f02863d..000000000 --- a/lime/tools/platforms/WindowsPlatform.hx +++ /dev/null @@ -1,870 +0,0 @@ -package lime.tools.platforms; - - -import haxe.io.Path; -import haxe.Template; -import lime.project.Icon; -import lime.tools.helpers.CPPHelper; -import lime.tools.helpers.DeploymentHelper; -import lime.tools.helpers.FileHelper; -import lime.tools.helpers.HTML5Helper; -import lime.tools.helpers.IconHelper; -import lime.tools.helpers.JavaHelper; -import lime.tools.helpers.LogHelper; -import lime.tools.helpers.ModuleHelper; -import lime.tools.helpers.CSHelper; -import lime.tools.helpers.GUID; -import lime.tools.helpers.NekoHelper; -import lime.tools.helpers.NodeJSHelper; -import lime.tools.helpers.PathHelper; -import lime.tools.helpers.PlatformHelper; -import lime.tools.helpers.ProcessHelper; -import lime.tools.helpers.WatchHelper; -import lime.project.Architecture; -import lime.project.Asset; -import lime.project.AssetType; -import lime.project.Haxelib; -import lime.project.HXProject; -import lime.project.Platform; -import lime.project.PlatformTarget; -import sys.io.File; -import sys.FileSystem; - - -class WindowsPlatform extends PlatformTarget { - - - private var applicationDirectory:String; - private var executablePath:String; - private var is64:Bool; - private var targetType:String; - private var outputFile:String; - - - public function new (command:String, _project:HXProject, targetFlags:Map ) { - - super (command, _project, targetFlags); - - for (architecture in project.architectures) { - - if (architecture == Architecture.X64) { - - is64 = true; - - } - - } - - if (project.targetFlags.exists ("uwp") || project.targetFlags.exists ("winjs")) { - - targetType = "winjs"; - - } else if (project.targetFlags.exists ("neko") || project.target != PlatformHelper.hostPlatform) { - - targetType = "neko"; - - } else if (project.targetFlags.exists ("hl")) { - - targetType = "hl"; - - } else if (project.targetFlags.exists ("nodejs")) { - - targetType = "nodejs"; - - } else if (project.targetFlags.exists ("cs")) { - - targetType = "cs"; - - } else if (project.targetFlags.exists ("java")) { - - targetType = "java"; - - } else { - - targetType = "cpp"; - - } - - targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("windows.output-directory", targetType == "cpp" ? "windows" : targetType)); - targetDirectory = StringTools.replace (targetDirectory, "arch64", is64 ? "64" : ""); - - if (targetType == "winjs") { - - outputFile = targetDirectory + "/source/js/" + project.app.file + ".js"; - - } else { - - applicationDirectory = targetDirectory + "/bin/"; - executablePath = applicationDirectory + project.app.file + ".exe"; - - } - - } - - - public override function build ():Void { - - var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; - - PathHelper.mkdir (targetDirectory); - - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - if (targetType == "winjs") { - - ModuleHelper.buildModules (project, targetDirectory, targetDirectory); - - if (project.app.main != null) { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - var msBuildPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe"; - var args = [ PathHelper.tryFullPath (targetDirectory + "/source/" + project.app.file + ".jsproj"), "/p:Configuration=Release" ]; - - ProcessHelper.runCommand ("", msBuildPath, args); - if (noOutput) return; - - if (project.targetFlags.exists ("webgl")) { - - FileHelper.copyFile (targetDirectory + "/source/ApplicationMain.js", outputFile); - - } - - if (project.modules.iterator ().hasNext ()) { - - ModuleHelper.patchFile (outputFile); - - } - - if (project.targetFlags.exists ("minify") || buildType == "final") { - - HTML5Helper.minify (project, targetDirectory + outputFile); - - } - - } - - } else { - - for (dependency in project.dependencies) { - - if (StringTools.endsWith (dependency.path, ".dll")) { - - var fileName = Path.withoutDirectory (dependency.path); - FileHelper.copyIfNewer (dependency.path, applicationDirectory + "/" + fileName); - - } - - } - - if (!project.targetFlags.exists ("static") || targetType != "cpp") { - - var targetSuffix = (targetType == "hl") ? ".hdll" : null; - - for (ndll in project.ndlls) { - - FileHelper.copyLibrary (project, ndll, "Windows" + (is64 ? "64" : ""), "", (ndll.haxelib != null && (ndll.haxelib.name == "hxcpp" || ndll.haxelib.name == "hxlibc")) ? ".dll" : ".ndll", applicationDirectory, project.debug, targetSuffix); - - } - - } - - //IconHelper.createIcon (project.icons, 32, 32, PathHelper.combine (applicationDirectory, "icon.png")); - - if (targetType == "neko") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - var iconPath = PathHelper.combine (applicationDirectory, "icon.ico"); - - if (!IconHelper.createWindowsIcon (icons, iconPath)) { - - iconPath = null; - - } - - NekoHelper.createWindowsExecutable (project.templatePaths, targetDirectory + "/obj/ApplicationMain.n", executablePath, iconPath); - NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory); - - } else if (targetType == "hl") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain.hl", PathHelper.combine (applicationDirectory, project.app.file + ".hl")); - - } else if (targetType == "nodejs") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - //NekoHelper.createExecutable (project.templatePaths, "windows" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); - //NekoHelper.copyLibraries (project.templatePaths, "windows" + (is64 ? "64" : ""), applicationDirectory); - - } else if (targetType == "cs") { - - ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - CSHelper.copySourceFiles (project.templatePaths, targetDirectory + "/obj/src"); - var txtPath = targetDirectory + "/obj/hxcs_build.txt"; - CSHelper.addSourceFiles (txtPath, CSHelper.ndllSourceFiles); - CSHelper.addGUID (txtPath, GUID.uuid ()); - CSHelper.compile (project, targetDirectory + "/obj", applicationDirectory + project.app.file, "x86", "desktop"); - - } else if (targetType == "java") { - - var libPath = PathHelper.combine (PathHelper.getHaxelib (new Haxelib ("lime")), "templates/java/lib/"); - - ProcessHelper.runCommand ("", "haxe", [ hxml, "-java-lib", libPath + "disruptor.jar", "-java-lib", libPath + "lwjgl.jar" ]); - //ProcessHelper.runCommand ("", "haxe", [ hxml ]); - - if (noOutput) return; - - var haxeVersion = project.environment.get ("haxe_ver"); - var haxeVersionString = "3404"; - - if (haxeVersion.length > 4) { - - haxeVersionString = haxeVersion.charAt (0) + haxeVersion.charAt (2) + (haxeVersion.length == 5 ? "0" + haxeVersion.charAt (4) : haxeVersion.charAt (4) + haxeVersion.charAt (5)); - - } - - ProcessHelper.runCommand (targetDirectory + "/obj", "haxelib", [ "run", "hxjava", "hxjava_build.txt", "--haxe-version", haxeVersionString ]); - FileHelper.recursiveCopy (targetDirectory + "/obj/lib", PathHelper.combine (applicationDirectory, "lib")); - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".jar", PathHelper.combine (applicationDirectory, project.app.file + ".jar")); - JavaHelper.copyLibraries (project.templatePaths, "Windows" + (is64 ? "64" : ""), applicationDirectory); - - } else { - - var haxeArgs = [ hxml ]; - var flags = []; - - if (is64) { - - haxeArgs.push ("-D"); - haxeArgs.push ("HXCPP_M64"); - flags.push ("-DHXCPP_M64"); - - } else { - - flags.push ("-DHXCPP_M32"); - - } - - if (!project.environment.exists ("SHOW_CONSOLE")) { - - haxeArgs.push ("-D"); - haxeArgs.push ("no_console"); - flags.push ("-Dno_console"); - - } - - if (!project.targetFlags.exists ("static")) { - - ProcessHelper.runCommand ("", "haxe", haxeArgs); - - if (noOutput) return; - - CPPHelper.compile (project, targetDirectory + "/obj", flags); - - FileHelper.copyFile (targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-debug" : "") + ".exe", executablePath); - - } else { - - ProcessHelper.runCommand ("", "haxe", haxeArgs.concat ([ "-D", "static_link" ])); - - if (noOutput) return; - - CPPHelper.compile (project, targetDirectory + "/obj", flags.concat ([ "-Dstatic_link" ])); - CPPHelper.compile (project, targetDirectory + "/obj", flags, "BuildMain.xml"); - - FileHelper.copyFile (targetDirectory + "/obj/Main" + (project.debug ? "-debug" : "") + ".exe", executablePath); - - } - - var iconPath = PathHelper.combine (applicationDirectory, "icon.ico"); - - if (IconHelper.createWindowsIcon (icons, iconPath) && PlatformHelper.hostPlatform == Platform.WINDOWS) { - - var templates = [ PathHelper.getHaxelib (new Haxelib ("lime")) + "/templates" ].concat (project.templatePaths); - ProcessHelper.runCommand ("", PathHelper.findTemplate (templates, "bin/ReplaceVistaIcon.exe"), [ executablePath, iconPath, "1" ], true, true); - - } - - } - - } - - } - - - public override function clean ():Void { - - if (FileSystem.exists (targetDirectory)) { - - PathHelper.removeDirectory (targetDirectory); - - } - - } - - - public override function deploy ():Void { - - DeploymentHelper.deploy (project, targetFlags, targetDirectory, "Windows" + (is64 ? "64" : "")); - - } - - - public override function display ():Void { - - Sys.println (getDisplayHXML ()); - - } - - - private function generateContext ():Dynamic { - - var context = project.templateContext; - - if (targetType == "winjs") { - - context.WIN_FLASHBACKGROUND = project.window.background != null ? StringTools.hex (project.window.background, 6) : ""; - context.OUTPUT_FILE = outputFile; - - if (project.targetFlags.exists ("webgl")) { - - context.CPP_DIR = targetDirectory; - - } - - var guid = GUID.seededUuid (project.meta.packageName); - context.APP_GUID = guid; - - var guidNoBrackets = guid.split("{").join("").split("}").join(""); - context.APP_GUID_NOBRACKETS = guidNoBrackets; - - if (context.APP_DESCRIPTION == null || context.APP_DESCRIPTION == "") { - - context.APP_DESCRIPTION = project.meta.title; - - } - - } else { - - context.NEKO_FILE = targetDirectory + "/obj/ApplicationMain.n"; - context.NODE_FILE = targetDirectory + "/bin/ApplicationMain.js"; - context.HL_FILE = targetDirectory + "/obj/ApplicationMain.hl"; - context.CPP_DIR = targetDirectory + "/obj"; - context.BUILD_DIR = project.app.path + "/windows" + (is64 ? "64" : ""); - - } - - return context; - - } - - - private function getDisplayHXML ():String { - - var hxml = PathHelper.findTemplate (project.templatePaths, targetType + "/hxml/" + buildType + ".hxml"); - var template = new Template (File.getContent (hxml)); - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - return template.execute (context) + "\n-D display"; - - } - - - public override function rebuild ():Void { - - if (targetType != "winjs") { - - if (project.environment.exists ("VS110COMNTOOLS") && project.environment.exists ("VS100COMNTOOLS")) { - - project.environment.set ("HXCPP_MSVC", project.environment.get ("VS100COMNTOOLS")); - Sys.putEnv ("HXCPP_MSVC", project.environment.get ("VS100COMNTOOLS")); - - } - - var commands = []; - - if (targetFlags.exists ("64")) { - - commands.push ([ "-Dwindow", "-DHXCPP_M64" ]); - - } else { - - commands.push ([ "-Dwindow", "-DHXCPP_M32" ]); - - } - - CPPHelper.rebuild (project, commands); - - } - - } - - - public override function run ():Void { - - var arguments = additionalArguments.copy (); - - if (LogHelper.verbose) { - - arguments.push ("-verbose"); - - } - - if (targetType == "hl") { - - ProcessHelper.runCommand (applicationDirectory, "hl", [ project.app.file + ".hl" ].concat (arguments)); - - } else if (targetType == "nodejs") { - - NodeJSHelper.run (project, targetDirectory + "/bin/ApplicationMain.js", arguments); - - } else if (targetType == "winjs") { - - /* - - The 'test' target is problematic for UWP applications. UWP applications are bundled in appx packages and - require app certs to properly install. - - There are two options to trigger an appx install from the command line. - - A. Use the WinAppDeployCmd.exe utility to deploy to local and remote devices - - B. Execute the Add-AppDevPackage.ps1 powershell script that is an - artifact of the UWP msbuild - - A: WinAppDeployCmd.exe - https://docs.microsoft.com/en-us/windows/uwp/packaging/install-universal-windows-apps-with-the-winappdeploycmd-tool - https://msdn.microsoft.com/en-us/windows/desktop/mt627714 - Windows 10 SDK: https://developer.microsoft.com/windows/downloads/windows-10-sdk - - I've never actually got this to work, but I feel like I was close. The WinAppDeployCmd.exe is a part of the - Windows 10 SDK and not a part of the Visual Studio 2017 community edition. It will appear magically if you - check enough boxes when installing various project templates for Visual Studio. It appeared for me, and I - have no clue how it got there. - - A developer must take a few steps in order for this command to work. - 1. Install Visual Studio 2017 Community Edition - 2. Install the Windows 10 SDK - 3. Modify Windows 10 Settings to enable side loading and device discovery - 3. Enabling device discovery generates a pin number that is displayed to the user - 4. Open the "Developer Command Promp for VS 2017" from the Start menu - 5. run: - > WinAppDeployCmd devices - 6. Make sure your device shows up in the list (if it does not appear try step 3 again, toggling things on/off) - 7. run: (replase file, ip and pin with your values) - > WinAppDeployCmd install -file "uwp-project_1.0.0.0_AnyCPU.appx" -ip 192.168.27.167 -pin 326185 - - B: Add-AppDevPackage.ps1 + PowerShell_Set_Unrestricted.reg - The UWP build generates a powershell script by default. This script is usually executed by the user - by right clicking the file and choosing "run with powershell". Executing this script directly from the cmd - prompt results in a security error: "Add-AppDevPackage.ps1 cannot be loaded because running scripts is - disabled on this system." - - We must edit the registry if we want to run this script directly from a shell. - See lime/templates/windows/template/PowerShell_Set_Unrestricted.reg - - 1. run: - > regedit /s PowerShell_Set_Unrestricted.reg - 2. run: - > powershell "& ""./Add-AppDevPackage.ps1""" - - note: the nonsensical double quotes are required. - - */ - - // Using option B because obtaining the device pin programatically does not seem possible. - //ProcessHelper.runCommand ("", "regedit", [ '/s', '"' + targetDirectory + '/bin/PowerShell_Set_Unrestricted.reg"' ]); - //var test = '"& ""' + targetDirectory + '/bin/PowerShell_Set_Unrestricted.reg"""'; - //Sys.command ('powershell & ""' + targetDirectory + '/bin/source/AppPackages/' + project.app.file + '_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.ps1""'); - var version = project.meta.version + "." + project.meta.buildNumber; - ProcessHelper.openFile (targetDirectory + "/source/AppPackages/" + project.app.file + "_" + version + "_AnyCPU_Test", project.app.file + "_" + version + "_AnyCPU.appx"); - - //source/AppPackages/uwp-project_1.0.0.0_AnyCPU_Test/Add-AppDevPackage.ps1 - - //HTML5Helper.launch (project, targetDirectory + "/bin"); - - } else if (targetType == "java") { - - ProcessHelper.runCommand (applicationDirectory, "java", [ "-jar", project.app.file + ".jar" ].concat (arguments)); - - } else if (project.target == PlatformHelper.hostPlatform) { - - arguments = arguments.concat ([ "-livereload" ]); - ProcessHelper.runCommand (applicationDirectory, Path.withoutDirectory (executablePath), arguments); - - } - - } - - - public override function update ():Void { - - if (targetType == "winjs") { - - updateUWP (); - return; - - } - - project = project.clone (); - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - for (asset in project.assets) { - - if (asset.embed && asset.sourcePath == "") { - - var path = PathHelper.combine (targetDirectory + "/obj/tmp", asset.targetPath); - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path); - asset.sourcePath = path; - - } - - } - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - if (targetType == "cpp" && project.targetFlags.exists ("static")) { - - // TODO: Better way to detect the suffix HXCPP will use? - - var msvc19 = true; - var olderVersions = [ "120", "110", "100", "90", "80", "71", "70" ]; - - for (olderVersion in olderVersions) { - - if (project.environment.exists ("VS" + olderVersion + "COMNTOOLS")) { - - msvc19 = false; - break; - - } - - } - - var suffix = (msvc19 ? "-19.lib" : ".lib"); - - for (i in 0...project.ndlls.length) { - - var ndll = project.ndlls[i]; - - if (ndll.path == null || ndll.path == "") { - - context.ndlls[i].path = PathHelper.getLibraryPath (ndll, "Windows" + (is64 ? "64" : ""), "lib", suffix, project.debug); - - } - - } - - } - - PathHelper.mkdir (targetDirectory); - PathHelper.mkdir (targetDirectory + "/obj"); - PathHelper.mkdir (targetDirectory + "/haxe"); - PathHelper.mkdir (applicationDirectory); - - //SWFHelper.generateSWFClasses (project, targetDirectory + "/haxe"); - - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, targetType + "/hxml", targetDirectory + "/haxe", context); - - if (targetType == "cpp" && project.targetFlags.exists ("static")) { - - FileHelper.recursiveSmartCopyTemplate (project, "cpp/static", targetDirectory + "/obj", context); - - } - - /*if (IconHelper.createIcon (project.icons, 32, 32, PathHelper.combine (applicationDirectory, "icon.png"))) { - - context.HAS_ICON = true; - context.WIN_ICON = "icon.png"; - - }*/ - - for (asset in project.assets) { - - if (asset.embed != true) { - - var path = PathHelper.combine (applicationDirectory, asset.targetPath); - - if (asset.type != AssetType.TEMPLATE) { - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAssetIfNewer (asset, path); - - } else { - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path, context); - - } - - } - - } - - } - - - private function updateUWP ():Void { - - project = project.clone (); - - var destination = targetDirectory + "/source/"; - PathHelper.mkdir (destination); - - var webfontDirectory = targetDirectory + "/obj/webfont"; - var useWebfonts = true; - - for (haxelib in project.haxelibs) { - - if (haxelib.name == "openfl-html5-dom" || haxelib.name == "openfl-bitfive") { - - useWebfonts = false; - - } - - } - - var fontPath; - - for (asset in project.assets) { - - if (asset.type == AssetType.FONT) { - - if (useWebfonts) { - - fontPath = PathHelper.combine (webfontDirectory, Path.withoutDirectory (asset.targetPath)); - - if (!FileSystem.exists (fontPath)) { - - PathHelper.mkdir (webfontDirectory); - FileHelper.copyFile (asset.sourcePath, fontPath); - - asset.sourcePath = fontPath; - - HTML5Helper.generateWebfonts (project, asset); - - } - - asset.sourcePath = fontPath; - asset.targetPath = Path.withoutExtension (asset.targetPath); - - } else { - - project.haxeflags.push (HTML5Helper.generateFontData (project, asset)); - - } - - } - - } - - if (project.targetFlags.exists ("xml")) { - - project.haxeflags.push ("-xml " + targetDirectory + "/types.xml"); - - } - - if (LogHelper.verbose) { - - project.haxedefs.set ("verbose", 1); - - } - - ModuleHelper.updateProject (project); - - var libraryNames = new Map (); - - for (asset in project.assets) { - - if (asset.library != null && !libraryNames.exists (asset.library)) { - - libraryNames[asset.library] = true; - - } - - } - - //for (library in libraryNames.keys ()) { - // - //project.haxeflags.push ("-resource " + targetDirectory + "/obj/manifest/" + library + ".json@__ASSET_MANIFEST__" + library); - // - //} - - //project.haxeflags.push ("-resource " + targetDirectory + "/obj/manifest/default.json@__ASSET_MANIFEST__default"); - - var context = generateContext (); - context.OUTPUT_DIR = targetDirectory; - - context.favicons = []; - - var icons = project.icons; - - if (icons.length == 0) { - - icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; - - } - - //if (IconHelper.createWindowsIcon (icons, PathHelper.combine (destination, "favicon.ico"))) { - // - //context.favicons.push ({ rel: "icon", type: "image/x-icon", href: "./favicon.ico" }); - // - //} - - if (IconHelper.createIcon (icons, 192, 192, PathHelper.combine (destination, "favicon.png"))) { - - context.favicons.push ({ rel: "shortcut icon", type: "image/png", href: "./favicon.png" }); - - } - - context.linkedLibraries = []; - - for (dependency in project.dependencies) { - - if (StringTools.endsWith (dependency.name, ".js")) { - - context.linkedLibraries.push (dependency.name); - - } else if (StringTools.endsWith (dependency.path, ".js") && FileSystem.exists (dependency.path)) { - - var name = Path.withoutDirectory (dependency.path); - - context.linkedLibraries.push ("./js/lib/" + name); - FileHelper.copyIfNewer (dependency.path, PathHelper.combine (destination, PathHelper.combine ("js/lib", name))); - - } - - } - - for (asset in project.assets) { - - var path = PathHelper.combine (destination, asset.targetPath); - - if (asset.type != AssetType.TEMPLATE) { - - if (asset.type != AssetType.FONT) { - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAssetIfNewer (asset, path); - - } else if (useWebfonts) { - - PathHelper.mkdir (Path.directory (path)); - var ext = "." + Path.extension (asset.sourcePath); - var source = Path.withoutExtension (asset.sourcePath); - - for (extension in [ ext, ".eot", ".woff", ".svg" ]) { - - if (FileSystem.exists (source + extension)) { - - FileHelper.copyIfNewer (source + extension, path + extension); - - } else { - - LogHelper.warn ("Could not find generated font file \"" + source + extension + "\""); - - } - - } - - } - - } - - } - - FileHelper.recursiveSmartCopyTemplate (project, "winjs/template", targetDirectory, context); - - var renamePaths = [ "uwp-project.sln", "source/uwp-project.jsproj", "source/uwp-project_TemporaryKey.pfx" ]; - var fullPath; - - for (path in renamePaths) { - - fullPath = targetDirectory + "/" + path; - - try { - - if (FileSystem.exists (fullPath)) { - - File.copy (fullPath, targetDirectory + "/" + StringTools.replace (path, "uwp-project", project.app.file)); - FileSystem.deleteFile (fullPath); - - } - - } catch (e:Dynamic) {} - - } - - if (project.app.main != null) { - - FileHelper.recursiveSmartCopyTemplate (project, "haxe", targetDirectory + "/haxe", context); - FileHelper.recursiveSmartCopyTemplate (project, "winjs/haxe", targetDirectory + "/haxe", context, true, false); - FileHelper.recursiveSmartCopyTemplate (project, "winjs/hxml", targetDirectory + "/haxe", context); - - if (project.targetFlags.exists ("webgl")) { - - FileHelper.recursiveSmartCopyTemplate (project, "webgl/hxml", targetDirectory + "/haxe", context, true, false); - - } - - } - - for (asset in project.assets) { - - var path = PathHelper.combine (destination, asset.targetPath); - - if (asset.type == AssetType.TEMPLATE) { - - PathHelper.mkdir (Path.directory (path)); - FileHelper.copyAsset (asset, path, context); - - } - - } - - } - - - public override function watch ():Void { - - var dirs = WatchHelper.processHXML (project, getDisplayHXML ()); - var command = WatchHelper.getCurrentCommand (); - WatchHelper.watch (project, command, dirs); - - } - - - @ignore public override function install ():Void {} - @ignore public override function trace ():Void {} - @ignore public override function uninstall ():Void {} - - -} \ No newline at end of file diff --git a/lime/vm/NekoVM.hx b/lime/vm/NekoVM.hx deleted file mode 100644 index 607d69e4b..000000000 --- a/lime/vm/NekoVM.hx +++ /dev/null @@ -1,21 +0,0 @@ -package lime.vm; - - -import lime._backend.native.NativeCFFI; - -@:access(lime._backend.native.NativeCFFI) - - -class NekoVM { - - - public static function loadModule (path:String):Void { - - #if (lime_cffi && !macro) - NativeCFFI.lime_neko_execute (path); - #end - - } - - -} \ No newline at end of file diff --git a/cs/ndll/NDLLFunction.hx b/src/cs/ndll/NDLLFunction.hx similarity index 100% rename from cs/ndll/NDLLFunction.hx rename to src/cs/ndll/NDLLFunction.hx diff --git a/haxe/Timer.hx b/src/haxe/Timer.hx similarity index 100% rename from haxe/Timer.hx rename to src/haxe/Timer.hx diff --git a/haxe/io/Bytes.hx b/src/haxe/io/Bytes.hx similarity index 99% rename from haxe/io/Bytes.hx rename to src/haxe/io/Bytes.hx index 13c45f0ac..5c71cda33 100644 --- a/haxe/io/Bytes.hx +++ b/src/haxe/io/Bytes.hx @@ -27,7 +27,7 @@ using cpp.NativeArray; #end #if !macro -@:autoBuild(lime._macros.AssetsMacro.embedBytes()) // Enable @:bytes embed metadata +@:autoBuild(lime._internal.macros.AssetsMacro.embedBytes()) // Enable @:bytes embed metadata #end #if !lime_debug @@ -580,7 +580,7 @@ import js.html.compat.DataView; #end #if !macro -@:autoBuild(lime._macros.AssetsMacro.embedBytes()) // Enable @:bytes embed metadata +@:autoBuild(lime._internal.macros.AssetsMacro.embedBytes()) // Enable @:bytes embed metadata #end class Bytes { diff --git a/lime/_backend/air/AIRApplication.hx b/src/lime/_internal/backend/air/AIRApplication.hx similarity index 89% rename from lime/_backend/air/AIRApplication.hx rename to src/lime/_internal/backend/air/AIRApplication.hx index a022a880f..cf64d2835 100644 --- a/lime/_backend/air/AIRApplication.hx +++ b/src/lime/_internal/backend/air/AIRApplication.hx @@ -1,10 +1,10 @@ -package lime._backend.air; +package lime._internal.backend.air; import flash.desktop.NativeApplication; import flash.desktop.SystemIdleMode; import flash.events.Event; -import lime._backend.flash.FlashApplication; +import lime._internal.backend.flash.FlashApplication; import lime.app.Application; import lime.app.Config; import lime.system.System; diff --git a/lime/_backend/air/AIRWindow.hx b/src/lime/_internal/backend/air/AIRWindow.hx similarity index 97% rename from lime/_backend/air/AIRWindow.hx rename to src/lime/_internal/backend/air/AIRWindow.hx index 7c70cdb82..5e9f5126b 100644 --- a/lime/_backend/air/AIRWindow.hx +++ b/src/lime/_internal/backend/air/AIRWindow.hx @@ -1,4 +1,4 @@ -package lime._backend.air; +package lime._internal.backend.air; import flash.desktop.NotificationType; @@ -9,7 +9,7 @@ import flash.display.NativeWindowSystemChrome; import flash.events.Event; import flash.html.HTMLLoader; import flash.Lib; -import lime._backend.flash.FlashWindow; +import lime._internal.backend.flash.FlashWindow; import lime.app.Application; import lime.ui.Window; @@ -126,21 +126,22 @@ class AIRWindow extends FlashWindow { nativeWindow.addEventListener (Event.CLOSING, handleNativeWindowEvent); nativeWindow.addEventListener (Event.CLOSE, handleNativeWindowEvent); - + nativeWindow.visible = !hidden; //nativeWindow.activate (); nativeWindow.alwaysInFront = alwaysOnTop; nativeWindow.title = title; - + if (maximized) { - + nativeWindow.maximize (); - + } else if (minimized) { - + nativeWindow.minimize (); - + } + } if (fullscreen) { @@ -155,7 +156,7 @@ class AIRWindow extends FlashWindow { parent.__height = Std.int (nativeWindow.height); parent.__x = Math.round (nativeWindow.x); parent.__y = Math.round (nativeWindow.y); - parent.stage = nativeWindow.stage; + stage = nativeWindow.stage; } diff --git a/lime/_backend/flash/FlashApplication.hx b/src/lime/_internal/backend/flash/FlashApplication.hx similarity index 87% rename from lime/_backend/flash/FlashApplication.hx rename to src/lime/_internal/backend/flash/FlashApplication.hx index 5358d854f..db7bae34c 100644 --- a/lime/_backend/flash/FlashApplication.hx +++ b/src/lime/_internal/backend/flash/FlashApplication.hx @@ -1,4 +1,4 @@ -package lime._backend.flash; +package lime._internal.backend.flash; import flash.events.Event; @@ -10,7 +10,9 @@ import lime.app.Config; import lime.media.AudioManager; import lime.ui.Window; +@:access(lime._internal.backend.flash.FlashWindow) @:access(lime.app.Application) +@:access(lime.ui.Window) class FlashApplication { @@ -75,7 +77,7 @@ class FlashApplication { if (parent.window != null) { - parent.window.onRender.dispatch (); + parent.window.onRender.dispatch (parent.window.context); } @@ -88,7 +90,7 @@ class FlashApplication { for (window in parent.windows) { - window.stage.frameRate = value; + window.__backend.stage.frameRate = value; } diff --git a/lime/_backend/flash/FlashAudioSource.hx b/src/lime/_internal/backend/flash/FlashAudioSource.hx similarity index 98% rename from lime/_backend/flash/FlashAudioSource.hx rename to src/lime/_internal/backend/flash/FlashAudioSource.hx index 25cec1522..8de59bf05 100644 --- a/lime/_backend/flash/FlashAudioSource.hx +++ b/src/lime/_internal/backend/flash/FlashAudioSource.hx @@ -1,9 +1,9 @@ -package lime._backend.flash; +package lime._internal.backend.flash; import flash.media.SoundChannel; -import lime.media.AudioSource; import lime.math.Vector4; +import lime.media.AudioSource; @:access(lime.media.AudioBuffer) diff --git a/lime/_backend/flash/FlashHTTPRequest.hx b/src/lime/_internal/backend/flash/FlashHTTPRequest.hx similarity index 99% rename from lime/_backend/flash/FlashHTTPRequest.hx rename to src/lime/_internal/backend/flash/FlashHTTPRequest.hx index f38d57446..93fc441f2 100644 --- a/lime/_backend/flash/FlashHTTPRequest.hx +++ b/src/lime/_internal/backend/flash/FlashHTTPRequest.hx @@ -1,4 +1,4 @@ -package lime._backend.flash; +package lime._internal.backend.flash; import flash.events.Event; diff --git a/lime/_backend/flash/FlashMouse.hx b/src/lime/_internal/backend/flash/FlashMouse.hx similarity index 97% rename from lime/_backend/flash/FlashMouse.hx rename to src/lime/_internal/backend/flash/FlashMouse.hx index 367a7c241..231abfc0f 100644 --- a/lime/_backend/flash/FlashMouse.hx +++ b/src/lime/_internal/backend/flash/FlashMouse.hx @@ -1,4 +1,4 @@ -package lime._backend.flash; +package lime._internal.backend.flash; import flash.ui.Mouse; diff --git a/lime/_backend/flash/FlashWindow.hx b/src/lime/_internal/backend/flash/FlashWindow.hx similarity index 95% rename from lime/_backend/flash/FlashWindow.hx rename to src/lime/_internal/backend/flash/FlashWindow.hx index 20412db04..a450892d9 100644 --- a/lime/_backend/flash/FlashWindow.hx +++ b/src/lime/_internal/backend/flash/FlashWindow.hx @@ -1,7 +1,8 @@ -package lime._backend.flash; +package lime._internal.backend.flash; import flash.display.BitmapData; +import flash.display.Stage; import flash.display.StageAlign; import flash.display.StageScaleMode; import flash.events.Event; @@ -40,6 +41,7 @@ class FlashWindow { private var enableTextEvents:Bool; private var mouseLeft:Bool; private var parent:Window; + private var stage:Stage; private var unusedTouchesPool = new List (); @@ -146,8 +148,7 @@ class FlashWindow { parent.id = windowID++; - if (parent.stage == null) parent.stage = Lib.current.stage; - var stage = parent.stage; + if (stage == null) stage = Lib.current.stage; stage.align = StageAlign.TOP_LEFT; stage.scaleMode = StageScaleMode.NO_SCALE; @@ -177,6 +178,7 @@ class FlashWindow { context.sprite = Lib.current; context.type = FLASH; context.version = Capabilities.version; + context.window = parent; parent.context = context; @@ -400,8 +402,8 @@ class FlashWindow { case Event.RESIZE: - parent.__width = parent.stage.stageWidth; - parent.__height = parent.stage.stageHeight; + parent.__width = stage.stageWidth; + parent.__height = stage.stageHeight; parent.onResize.dispatch (parent.__width, parent.__height); @@ -416,11 +418,11 @@ class FlashWindow { if (rect == null) { - rect = new Rectangle (0, 0, parent.stage.stageWidth, parent.stage.stageHeight); + rect = new Rectangle (0, 0, stage.stageWidth, stage.stageHeight); } else { - rect.__contract (0, 0, parent.stage.stageWidth, parent.stage.stageHeight); + rect.__contract (0, 0, stage.stageWidth, stage.stageHeight); } @@ -432,7 +434,7 @@ class FlashWindow { matrix.tx = -rect.x; matrix.ty = -rect.y; - bitmapData.draw (parent.stage, matrix); + bitmapData.draw (stage, matrix); return Image.fromBitmapData (bitmapData); @@ -489,7 +491,7 @@ class FlashWindow { public function setFullscreen (value:Bool):Bool { - parent.stage.displayState = (value ? FULL_SCREEN_INTERACTIVE : NORMAL); + stage.displayState = (value ? FULL_SCREEN_INTERACTIVE : NORMAL); return value; } diff --git a/lime/_backend/html5/HTML5Application.hx b/src/lime/_internal/backend/html5/HTML5Application.hx similarity index 98% rename from lime/_backend/html5/HTML5Application.hx rename to src/lime/_internal/backend/html5/HTML5Application.hx index 0e9deab72..fbb634776 100644 --- a/lime/_backend/html5/HTML5Application.hx +++ b/src/lime/_internal/backend/html5/HTML5Application.hx @@ -1,4 +1,4 @@ -package lime._backend.html5; +package lime._internal.backend.html5; import js.html.DeviceMotionEvent; @@ -17,7 +17,7 @@ import lime.ui.GamepadButton; import lime.ui.Joystick; import lime.ui.Window; -@:access(lime._backend.html5.HTML5Window) +@:access(lime._internal.backend.html5.HTML5Window) @:access(lime.app.Application) @:access(lime.system.Sensor) @:access(lime.ui.Gamepad) @@ -245,7 +245,7 @@ class HTML5Application { if (parent.window != null) { - parent.window.backend.updateSize (); + parent.window.__backend.updateSize (); } @@ -265,7 +265,7 @@ class HTML5Application { if (parent.window != null && parent.window.context != null) { - parent.window.onRender.dispatch (); + parent.window.onRender.dispatch (parent.window.context); } @@ -276,7 +276,6 @@ class HTML5Application { if (framePeriod < 0) { nextUpdate = currentUpdate; - nextUpdate = currentUpdate; } else { @@ -368,7 +367,7 @@ class HTML5Application { case "resize": - parent.window.backend.handleResizeEvent (event); + parent.window.__backend.handleResizeEvent (event); case "beforeunload": diff --git a/lime/_backend/html5/HTML5AudioSource.hx b/src/lime/_internal/backend/html5/HTML5AudioSource.hx similarity index 99% rename from lime/_backend/html5/HTML5AudioSource.hx rename to src/lime/_internal/backend/html5/HTML5AudioSource.hx index 6ba4ea58a..06bbc7394 100644 --- a/lime/_backend/html5/HTML5AudioSource.hx +++ b/src/lime/_internal/backend/html5/HTML5AudioSource.hx @@ -1,8 +1,8 @@ -package lime._backend.html5; +package lime._internal.backend.html5; -import lime.media.AudioSource; import lime.math.Vector4; +import lime.media.AudioSource; @:access(lime.media.AudioBuffer) diff --git a/lime/_backend/html5/HTML5HTTPRequest.hx b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx similarity index 99% rename from lime/_backend/html5/HTML5HTTPRequest.hx rename to src/lime/_internal/backend/html5/HTML5HTTPRequest.hx index faaf3a552..e5ad19e76 100644 --- a/lime/_backend/html5/HTML5HTTPRequest.hx +++ b/src/lime/_internal/backend/html5/HTML5HTTPRequest.hx @@ -1,15 +1,15 @@ -package lime._backend.html5; +package lime._internal.backend.html5; +import haxe.io.Bytes; import js.html.AnchorElement; import js.html.ErrorEvent; import js.html.Event; import js.html.Image in JSImage; import js.html.ProgressEvent; import js.html.XMLHttpRequest; -import js.Browser; -import haxe.io.Bytes; import js.html.XMLHttpRequestResponseType; +import js.Browser; import lime.app.Future; import lime.app.Promise; import lime.graphics.Image; @@ -21,6 +21,7 @@ import lime.utils.AssetType; @:access(lime.graphics.ImageBuffer) @:access(lime.graphics.Image) + class HTML5HTTPRequest { @@ -37,7 +38,8 @@ class HTML5HTTPRequest { private var parent:_IHTTPRequest; private var request:XMLHttpRequest; private var validStatus0:Bool; - + + public function new () { validStatus0 = ~/Tizen/gi.match (Browser.window.navigator.userAgent); diff --git a/lime/_backend/html5/HTML5Mouse.hx b/src/lime/_internal/backend/html5/HTML5Mouse.hx similarity index 91% rename from lime/_backend/html5/HTML5Mouse.hx rename to src/lime/_internal/backend/html5/HTML5Mouse.hx index c1b4016d3..3bb7c8d3d 100644 --- a/lime/_backend/html5/HTML5Mouse.hx +++ b/src/lime/_internal/backend/html5/HTML5Mouse.hx @@ -1,4 +1,4 @@ -package lime._backend.html5; +package lime._internal.backend.html5; import lime.app.Application; @@ -24,7 +24,7 @@ class HTML5Mouse { for (window in Application.current.windows) { - window.backend.element.style.cursor = "none"; + window.__backend.element.style.cursor = "none"; } @@ -78,7 +78,7 @@ class HTML5Mouse { for (window in Application.current.windows) { - window.backend.element.style.cursor = switch (value) { + window.__backend.element.style.cursor = switch (value) { case ARROW: "default"; case CROSSHAIR: "crosshair"; diff --git a/lime/_backend/html5/HTML5GLRenderContext.hx b/src/lime/_internal/backend/html5/HTML5OpenGLRenderContext.hx similarity index 99% rename from lime/_backend/html5/HTML5GLRenderContext.hx rename to src/lime/_internal/backend/html5/HTML5OpenGLRenderContext.hx index 55b9be2c6..5ec6dd2fe 100644 --- a/lime/_backend/html5/HTML5GLRenderContext.hx +++ b/src/lime/_internal/backend/html5/HTML5OpenGLRenderContext.hx @@ -1,4 +1,4 @@ -package lime._backend.html5; +package lime._internal.backend.html5; import haxe.io.Bytes; @@ -20,7 +20,7 @@ import lime.utils.UInt32Array; @:allow(lime.ui.Window) -class HTML5GLRenderContext { +class HTML5OpenGLRenderContext { public var DEPTH_BUFFER_BIT = 0x00000100; diff --git a/lime/_backend/html5/HTML5Window.hx b/src/lime/_internal/backend/html5/HTML5Window.hx similarity index 97% rename from lime/_backend/html5/HTML5Window.hx rename to src/lime/_internal/backend/html5/HTML5Window.hx index 6b0f87680..9185b4f7b 100644 --- a/lime/_backend/html5/HTML5Window.hx +++ b/src/lime/_internal/backend/html5/HTML5Window.hx @@ -1,4 +1,4 @@ -package lime._backend.html5; +package lime._internal.backend.html5; import haxe.Timer; @@ -15,11 +15,11 @@ import js.html.Node; import js.html.TouchEvent; import js.html.ClipboardEvent; import js.Browser; +import lime._internal.graphics.ImageCanvasUtil; import lime.app.Application; import lime.graphics.opengl.GL; -import lime.graphics.utils.ImageCanvasUtil; -import lime.graphics.GLRenderContext; import lime.graphics.Image; +import lime.graphics.OpenGLRenderContext; import lime.graphics.RenderContext; import lime.math.Rectangle; import lime.system.Display; @@ -32,9 +32,10 @@ import lime.ui.Touch; import lime.ui.Window; -@:access(lime._backend.html5.HTML5GLRenderContext) +@:access(lime._internal.backend.html5.HTML5OpenGLRenderContext) @:access(lime.app.Application) @:access(lime.graphics.opengl.GL) +@:access(lime.graphics.OpenGLRenderContext) @:access(lime.graphics.RenderContext) @:access(lime.ui.Gamepad) @:access(lime.ui.Joystick) @@ -270,10 +271,11 @@ class HTML5Window { private function createContext ():Void { var context = new RenderContext (); + context.window = parent; if (div != null) { - context.element = div; + context.element = cast div; context.type = DOM; context.version = ""; @@ -333,12 +335,12 @@ class HTML5Window { #end #if ((js && html5) && !display) - var gl = new GLRenderContext (cast webgl); + var gl = new OpenGLRenderContext (cast webgl); context.gl = gl; context.webgl = gl; if (isWebGL2) context.webgl2 = gl; #else - var gl = new GLRenderContext (); + var gl = new OpenGLRenderContext (); context.gl = gl; context.webgl = gl; #end @@ -414,14 +416,13 @@ class HTML5Window { parent.context = null; - parent.onContextLost.dispatch (); + parent.onRenderContextLost.dispatch (); case "webglcontextrestored": createContext (); - parent.onContextRestored.dispatch (); - // parent.onContextRestored.dispatch (parent.context); + parent.onRenderContextRestored.dispatch (parent.context); default: @@ -570,9 +571,9 @@ class HTML5Window { } else if (div != null) { var rect = div.getBoundingClientRect (); - //x = (event.clientX - rect.left) * (window.backend.div.style.width / rect.width); + //x = (event.clientX - rect.left) * (window.__backend.div.style.width / rect.width); x = (event.clientX - rect.left); - //y = (event.clientY - rect.top) * (window.backend.div.style.height / rect.height); + //y = (event.clientY - rect.top) * (window.__backend.div.style.height / rect.height); y = (event.clientY - rect.top); } else { diff --git a/lime/_backend/kha/KhaApplication.hx b/src/lime/_internal/backend/kha/KhaApplication.hx similarity index 98% rename from lime/_backend/kha/KhaApplication.hx rename to src/lime/_internal/backend/kha/KhaApplication.hx index 0b7e47084..5320acb1b 100644 --- a/lime/_backend/kha/KhaApplication.hx +++ b/src/lime/_internal/backend/kha/KhaApplication.hx @@ -1,4 +1,4 @@ -package lime._backend.kha; +package lime._internal.backend.kha; import haxe.Timer; @@ -115,7 +115,7 @@ class KhaApplication { private function mouseDown (button:Int, x:Int, y:Int):Void { - var window = parent.windowByID.get (-1); + var window = parent.__windowByID.get (-1); if (window != null) { window.onMouseDown.dispatch (x, y, button); @@ -126,7 +126,7 @@ class KhaApplication { private function mouseUp (button:Int, x:Int, y:Int):Void { - var window = parent.windowByID.get (-1); + var window = parent.__windowByID.get (-1); if (window != null) { window.onMouseUp.dispatch (x, y, button); @@ -137,7 +137,7 @@ class KhaApplication { private function mouseMove (x:Int, y:Int, mx:Int, my:Int):Void { - var window = parent.windowByID.get (-1); + var window = parent.__windowByID.get (-1); if (window != null) { window.onMouseMove.dispatch (x, y); @@ -148,7 +148,7 @@ class KhaApplication { private function mouseWheel (amount:Int):Void { - var window = parent.windowByID.get (-1); + var window = parent.__windowByID.get (-1); if (window != null) { window.onMouseWheel.dispatch (0, amount); diff --git a/lime/_backend/kha/KhaRenderer.hx b/src/lime/_internal/backend/kha/KhaRenderer.hx similarity index 95% rename from lime/_backend/kha/KhaRenderer.hx rename to src/lime/_internal/backend/kha/KhaRenderer.hx index 61a78014f..30f2b1c75 100644 --- a/lime/_backend/kha/KhaRenderer.hx +++ b/src/lime/_internal/backend/kha/KhaRenderer.hx @@ -1,4 +1,4 @@ -package lime._backend.kha; +package lime._internal.backend.kha; import haxe.io.Bytes; diff --git a/lime/_backend/native/NativeApplication.hx b/src/lime/_internal/backend/native/NativeApplication.hx similarity index 94% rename from lime/_backend/native/NativeApplication.hx rename to src/lime/_internal/backend/native/NativeApplication.hx index ddd31ccf9..20761555e 100644 --- a/lime/_backend/native/NativeApplication.hx +++ b/src/lime/_internal/backend/native/NativeApplication.hx @@ -1,16 +1,15 @@ -package lime._backend.native; +package lime._internal.backend.native; import haxe.Timer; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.app.Application; import lime.app.Config; -import lime.media.AudioManager; import lime.graphics.opengl.GL; -import lime.graphics.ConsoleRenderContext; -import lime.graphics.GLRenderContext; +import lime.graphics.OpenGLRenderContext; import lime.graphics.RenderContext; import lime.math.Rectangle; +import lime.media.AudioManager; import lime.system.Clipboard; import lime.system.Display; import lime.system.DisplayMode; @@ -32,12 +31,12 @@ import lime.ui.Window; #end @:access(haxe.Timer) -@:access(lime._backend.native.NativeCFFI) -@:access(lime._backend.native.NativeGLRenderContext) -@:access(lime._backend.native.NativeWindow) +@:access(lime._internal.backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeOpenGLRenderContext) +@:access(lime._internal.backend.native.NativeWindow) @:access(lime.app.Application) @:access(lime.graphics.opengl.GL) -@:access(lime.graphics.GLRenderContext) +@:access(lime.graphics.OpenGLRenderContext) @:access(lime.graphics.Renderer) @:access(lime.system.Clipboard) @:access(lime.system.Sensor) @@ -86,11 +85,6 @@ class NativeApplication { frameRate = 60; toggleFullscreen = true; - #if (lime_console && final) - // suppress traces in final builds - haxe.Log.trace = function(v:Dynamic, ?infos:haxe.PosInfos) {}; - #end - AudioManager.init (); #if (ios || android || tvos) @@ -301,7 +295,7 @@ class NativeApplication { private function handleKeyEvent ():Void { - var window = parent.windowByID.get (keyEventInfo.windowID); + var window = parent.__windowByID.get (keyEventInfo.windowID); if (window != null) { @@ -401,7 +395,7 @@ class NativeApplication { private function handleMouseEvent ():Void { - var window = parent.windowByID.get (mouseEventInfo.windowID); + var window = parent.__windowByID.get (mouseEventInfo.windowID); if (window != null) { @@ -449,12 +443,12 @@ class NativeApplication { if (window.context != null) { - window.backend.render (); - window.onRender.dispatch (); + window.__backend.render (); + window.onRender.dispatch (window.context); if (!window.onRender.canceled) { - window.backend.contextFlip (); + window.__backend.contextFlip (); } @@ -462,7 +456,7 @@ class NativeApplication { case RENDER_CONTEXT_LOST: - if (window.backend.useHardware && window.context != null) { + if (window.__backend.useHardware && window.context != null) { switch (window.context.type) { @@ -470,7 +464,7 @@ class NativeApplication { #if (lime_cffi && lime_opengl && !display) var gl = window.context.gl; - (gl:NativeGLRenderContext).__contextLost (); + (gl:NativeOpenGLRenderContext).__contextLost (); if (GL.context == gl) GL.context = null; #end @@ -479,22 +473,18 @@ class NativeApplication { } window.context = null; - window.onContextLost.dispatch (); + window.onRenderContextLost.dispatch (); } case RENDER_CONTEXT_RESTORED: - if (window.backend.useHardware) { + if (window.__backend.useHardware) { - #if lime_console - // renderer.context = CONSOLE (ConsoleRenderContext.singleton); - #else - // GL.context = new GLRenderContext (); + // GL.context = new OpenGLRenderContext (); // window.context.gl = GL.context; - #end - window.onContextRestored.dispatch (); + window.onRenderContextRestored.dispatch (window.context); } @@ -520,7 +510,7 @@ class NativeApplication { private function handleTextEvent ():Void { - var window = parent.windowByID.get (textEventInfo.windowID); + var window = parent.__windowByID.get (textEventInfo.windowID); if (window != null) { @@ -615,7 +605,7 @@ class NativeApplication { private function handleWindowEvent ():Void { - var window = parent.windowByID.get (windowEventInfo.windowID); + var window = parent.__windowByID.get (windowEventInfo.windowID); if (window != null) { diff --git a/lime/_backend/native/NativeAudioSource.hx b/src/lime/_internal/backend/native/NativeAudioSource.hx similarity index 99% rename from lime/_backend/native/NativeAudioSource.hx rename to src/lime/_internal/backend/native/NativeAudioSource.hx index 0ed5d7d51..3ca1821f7 100644 --- a/lime/_backend/native/NativeAudioSource.hx +++ b/src/lime/_internal/backend/native/NativeAudioSource.hx @@ -1,15 +1,15 @@ -package lime._backend.native; +package lime._internal.backend.native; import haxe.Int64; import haxe.Timer; -import lime.media.codecs.vorbis.VorbisFile; +import lime.math.Vector4; import lime.media.openal.AL; import lime.media.openal.ALBuffer; import lime.media.openal.ALSource; +import lime.media.vorbis.VorbisFile; import lime.media.AudioManager; import lime.media.AudioSource; -import lime.math.Vector4; import lime.utils.UInt8Array; #if !lime_debug diff --git a/lime/_backend/native/NativeCFFI.hx b/src/lime/_internal/backend/native/NativeCFFI.hx similarity index 99% rename from lime/_backend/native/NativeCFFI.hx rename to src/lime/_internal/backend/native/NativeCFFI.hx index d01cd60b9..ea8ba4997 100644 --- a/lime/_backend/native/NativeCFFI.hx +++ b/src/lime/_internal/backend/native/NativeCFFI.hx @@ -1,4 +1,4 @@ -package lime._backend.native; +package lime._internal.backend.native; import haxe.io.Bytes; @@ -17,7 +17,7 @@ import lime.system.CFFIPointer; import lime.utils.DataPointer; #if hl -import lime._backend.native.NativeApplication; +import lime._internal.backend.native.NativeApplication; import lime.graphics.cairo.CairoGlyph; import lime.graphics.opengl.GL; import lime.math.Matrix3; diff --git a/lime/_backend/native/NativeHTTPRequest.hx b/src/lime/_internal/backend/native/NativeHTTPRequest.hx similarity index 99% rename from lime/_backend/native/NativeHTTPRequest.hx rename to src/lime/_internal/backend/native/NativeHTTPRequest.hx index 94eb5fe29..c7116fe10 100644 --- a/lime/_backend/native/NativeHTTPRequest.hx +++ b/src/lime/_internal/backend/native/NativeHTTPRequest.hx @@ -1,4 +1,4 @@ -package lime._backend.native; +package lime._internal.backend.native; import haxe.io.Bytes; diff --git a/lime/_backend/native/NativeMouse.hx b/src/lime/_internal/backend/native/NativeMouse.hx similarity index 93% rename from lime/_backend/native/NativeMouse.hx rename to src/lime/_internal/backend/native/NativeMouse.hx index 73d4cf778..cea228707 100644 --- a/lime/_backend/native/NativeMouse.hx +++ b/src/lime/_internal/backend/native/NativeMouse.hx @@ -1,7 +1,7 @@ -package lime._backend.native; +package lime._internal.backend.native; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.ui.MouseCursor; import lime.ui.Window; @@ -10,7 +10,7 @@ import lime.ui.Window; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.ui.Window) @@ -55,7 +55,7 @@ class NativeMouse { public static function warp (x:Int, y:Int, window:Window):Void { #if (!macro && lime_cffi) - NativeCFFI.lime_mouse_warp (x, y, window == null ? 0 : window.backend.handle); + NativeCFFI.lime_mouse_warp (x, y, window == null ? 0 : window.__backend.handle); #end } diff --git a/lime/_backend/native/NativeGLRenderContext.hx b/src/lime/_internal/backend/native/NativeOpenGLRenderContext.hx similarity index 99% rename from lime/_backend/native/NativeGLRenderContext.hx rename to src/lime/_internal/backend/native/NativeOpenGLRenderContext.hx index 8deedb863..5ac783f3f 100644 --- a/lime/_backend/native/NativeGLRenderContext.hx +++ b/src/lime/_internal/backend/native/NativeOpenGLRenderContext.hx @@ -1,14 +1,14 @@ -package lime._backend.native; +package lime._internal.backend.native; -import haxe.Int64; import haxe.io.Bytes; +import haxe.Int64; +import lime.graphics.opengl.ext.*; import lime.graphics.opengl.GLQuery; import lime.graphics.opengl.GLSampler; import lime.graphics.opengl.GLSync; import lime.graphics.opengl.GLTransformFeedback; import lime.graphics.opengl.GLVertexArrayObject; -import lime.graphics.opengl.ext.*; import lime.graphics.opengl.GLActiveInfo; import lime.graphics.opengl.GLBuffer; import lime.graphics.opengl.GLContextAttributes; @@ -33,11 +33,11 @@ import lime.utils.UInt32Array; #end @:allow(lime.ui.Window) -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.graphics.opengl) -class NativeGLRenderContext { +class NativeOpenGLRenderContext { private static var __extensionObjects:Map; diff --git a/lime/_backend/native/NativeWindow.hx b/src/lime/_internal/backend/native/NativeWindow.hx similarity index 95% rename from lime/_backend/native/NativeWindow.hx rename to src/lime/_internal/backend/native/NativeWindow.hx index 00efe90f9..cb832f316 100644 --- a/lime/_backend/native/NativeWindow.hx +++ b/src/lime/_internal/backend/native/NativeWindow.hx @@ -1,8 +1,8 @@ -package lime._backend.native; +package lime._internal.backend.native; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.app.Application; import lime.graphics.cairo.Cairo; import lime.graphics.cairo.CairoFormat; @@ -10,10 +10,9 @@ import lime.graphics.cairo.CairoImageSurface; import lime.graphics.cairo.CairoSurface; import lime.graphics.opengl.GL; import lime.graphics.CairoRenderContext; -import lime.graphics.ConsoleRenderContext; -import lime.graphics.GLRenderContext; import lime.graphics.Image; import lime.graphics.ImageBuffer; +import lime.graphics.OpenGLRenderContext; import lime.graphics.RenderContext; import lime.math.Rectangle; import lime.math.Vector2; @@ -30,12 +29,12 @@ import lime.utils.UInt8Array; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) -@:access(lime._backend.native.NativeGLRenderContext) +@:access(lime._internal.backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeOpenGLRenderContext) @:access(lime.app.Application) @:access(lime.graphics.cairo.Cairo) @:access(lime.graphics.opengl.GL) -@:access(lime.graphics.GLRenderContext) +@:access(lime.graphics.OpenGLRenderContext) @:access(lime.graphics.RenderContext) @:access(lime.system.DisplayMode) @:access(lime.ui.Window) @@ -158,7 +157,7 @@ class NativeWindow { } #if (!macro && lime_cffi) - handle = NativeCFFI.lime_window_create (application.backend.handle, parent.width, parent.height, flags, title); + handle = NativeCFFI.lime_window_create (application.__backend.handle, parent.width, parent.height, flags, title); if (handle != null) { @@ -173,14 +172,7 @@ class NativeWindow { parent.__scale = NativeCFFI.lime_window_get_scale (handle); var context = new RenderContext (); - - #if lime_console - - useHardware = true; - // parent.context = CONSOLE (ConsoleRenderContext.singleton); - // parent.type = CONSOLE; - - #else + context.window = parent; #if hl var contextType = @:privateAccess String.fromUTF8 (NativeCFFI.lime_window_get_context_type (handle)); @@ -192,7 +184,7 @@ class NativeWindow { case "opengl": - var gl = new GLRenderContext (); + var gl = new OpenGLRenderContext (); useHardware = true; context.gl = gl; @@ -234,8 +226,6 @@ class NativeWindow { parent.context = context; - #end - } diff --git a/lime/graphics/format/BMP.hx b/src/lime/_internal/format/BMP.hx similarity index 99% rename from lime/graphics/format/BMP.hx rename to src/lime/_internal/format/BMP.hx index 517428cab..17eb1f9df 100644 --- a/lime/graphics/format/BMP.hx +++ b/src/lime/_internal/format/BMP.hx @@ -1,4 +1,4 @@ -package lime.graphics.format; +package lime._internal.format; import haxe.io.Bytes; diff --git a/lime/utils/compress/Deflate.hx b/src/lime/_internal/format/Deflate.hx similarity index 93% rename from lime/utils/compress/Deflate.hx rename to src/lime/_internal/format/Deflate.hx index 9d69104c0..3f2bb9329 100644 --- a/lime/utils/compress/Deflate.hx +++ b/src/lime/_internal/format/Deflate.hx @@ -1,8 +1,8 @@ -package lime.utils.compress; +package lime._internal.format; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; #if flash import flash.utils.ByteArray; @@ -13,7 +13,7 @@ import flash.utils.ByteArray; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class Deflate { diff --git a/lime/utils/compress/GZip.hx b/src/lime/_internal/format/GZip.hx similarity index 90% rename from lime/utils/compress/GZip.hx rename to src/lime/_internal/format/GZip.hx index 7b47eabef..8b9c72004 100644 --- a/lime/utils/compress/GZip.hx +++ b/src/lime/_internal/format/GZip.hx @@ -1,15 +1,15 @@ -package lime.utils.compress; +package lime._internal.format; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; #if !lime_debug @:fileXml('tags="haxe,release"') @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class GZip { diff --git a/lime/graphics/format/JPEG.hx b/src/lime/_internal/format/JPEG.hx similarity index 95% rename from lime/graphics/format/JPEG.hx rename to src/lime/_internal/format/JPEG.hx index 39c1e6cfa..0e26972a1 100644 --- a/lime/graphics/format/JPEG.hx +++ b/src/lime/_internal/format/JPEG.hx @@ -1,9 +1,9 @@ -package lime.graphics.format; +package lime._internal.format; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; -import lime.graphics.utils.ImageCanvasUtil; +import lime._internal.backend.native.NativeCFFI; +import lime._internal.graphics.ImageCanvasUtil; import lime.graphics.Image; import lime.graphics.ImageBuffer; import lime.system.CFFI; @@ -26,7 +26,7 @@ import haxe.io.BytesOutput; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.graphics.ImageBuffer) diff --git a/lime/utils/compress/LZMA.hx b/src/lime/_internal/format/LZMA.hx similarity index 91% rename from lime/utils/compress/LZMA.hx rename to src/lime/_internal/format/LZMA.hx index 715f07527..e826ce965 100644 --- a/lime/utils/compress/LZMA.hx +++ b/src/lime/_internal/format/LZMA.hx @@ -1,8 +1,8 @@ -package lime.utils.compress; +package lime._internal.format; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; #if flash import flash.utils.CompressionAlgorithm; @@ -14,7 +14,7 @@ import flash.utils.ByteArray; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class LZMA { diff --git a/lime/graphics/format/PNG.hx b/src/lime/_internal/format/PNG.hx similarity index 94% rename from lime/graphics/format/PNG.hx rename to src/lime/_internal/format/PNG.hx index 76549fb34..a6d48a87f 100644 --- a/lime/graphics/format/PNG.hx +++ b/src/lime/_internal/format/PNG.hx @@ -1,12 +1,12 @@ -package lime.graphics.format; +package lime._internal.format; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; -import lime.graphics.utils.ImageCanvasUtil; +import lime._internal.backend.native.NativeCFFI; +import lime._internal.graphics.ImageCanvasUtil; import lime.graphics.Image; +import lime.graphics.ImageBuffer; import lime.system.CFFI; -import lime.utils.compress.Zlib; import lime.utils.UInt8Array; #if (js && html5) @@ -26,7 +26,7 @@ import haxe.io.BytesOutput; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.graphics.ImageBuffer) diff --git a/lime/utils/compress/Zlib.hx b/src/lime/_internal/format/Zlib.hx similarity index 93% rename from lime/utils/compress/Zlib.hx rename to src/lime/_internal/format/Zlib.hx index a93c852d4..abc733f2f 100644 --- a/lime/utils/compress/Zlib.hx +++ b/src/lime/_internal/format/Zlib.hx @@ -1,8 +1,8 @@ -package lime.utils.compress; +package lime._internal.format; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; #if flash import flash.utils.ByteArray; @@ -13,7 +13,7 @@ import flash.utils.ByteArray; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class Zlib { diff --git a/lime/graphics/utils/ImageCanvasUtil.hx b/src/lime/_internal/graphics/ImageCanvasUtil.hx similarity index 99% rename from lime/graphics/utils/ImageCanvasUtil.hx rename to src/lime/_internal/graphics/ImageCanvasUtil.hx index 8f387ad6b..9dd919bac 100644 --- a/lime/graphics/utils/ImageCanvasUtil.hx +++ b/src/lime/_internal/graphics/ImageCanvasUtil.hx @@ -1,10 +1,11 @@ -package lime.graphics.utils; +package lime._internal.graphics; import haxe.format.JsonParser; import haxe.io.Bytes; import lime.graphics.Image; import lime.graphics.ImageBuffer; +import lime.graphics.ImageChannel; import lime.graphics.PixelFormat; import lime.math.ColorMatrix; import lime.math.Rectangle; diff --git a/lime/graphics/utils/ImageDataUtil.hx b/src/lime/_internal/graphics/ImageDataUtil.hx similarity index 99% rename from lime/graphics/utils/ImageDataUtil.hx rename to src/lime/_internal/graphics/ImageDataUtil.hx index 78f1d4aae..fb346b0ae 100644 --- a/lime/graphics/utils/ImageDataUtil.hx +++ b/src/lime/_internal/graphics/ImageDataUtil.hx @@ -1,16 +1,17 @@ -package lime.graphics.utils; +package lime._internal.graphics; import haxe.ds.Vector; import haxe.Int32; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.graphics.Image; import lime.graphics.ImageBuffer; +import lime.graphics.ImageChannel; import lime.graphics.PixelFormat; -import lime.math.color.ARGB; -import lime.math.color.BGRA; -import lime.math.color.RGBA; +import lime.math.ARGB; +import lime.math.BGRA; +import lime.math.RGBA; import lime.math.ColorMatrix; import lime.math.Rectangle; import lime.math.Vector2; @@ -24,9 +25,9 @@ import lime.utils.UInt8Array; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.graphics.ImageBuffer) -@:access(lime.math.color.RGBA) +@:access(lime.math.RGBA) class ImageDataUtil { diff --git a/lime/_macros/AssetsMacro.hx b/src/lime/_internal/macros/AssetsMacro.hx similarity index 92% rename from lime/_macros/AssetsMacro.hx rename to src/lime/_internal/macros/AssetsMacro.hx index debafc458..fb56c5f9c 100644 --- a/lime/_macros/AssetsMacro.hx +++ b/src/lime/_internal/macros/AssetsMacro.hx @@ -1,4 +1,4 @@ -package lime._macros; +package lime._internal.macros; #if macro @@ -69,16 +69,12 @@ class AssetsMacro { var constructor = macro { - #if lime_console - throw "not implemented"; - #else var bytes = haxe.Resource.getBytes (resourceName); #if html5 super (bytes.b.buffer); #else super (bytes.length, bytes.b); #end - #end }; @@ -106,12 +102,8 @@ class AssetsMacro { super (); - #if lime_console - throw "not implemented"; - #else var bytes = haxe.Resource.getBytes (resourceName); __fromBytes (bytes); - #end }; @@ -146,21 +138,6 @@ class AssetsMacro { case EConst(CString(filePath)): - #if lime_console - - var fieldValue = { - pos: position, - expr: EConst(CString(filePath)) - }; - fields.push ({ - kind: FVar(macro :String, fieldValue), - name: "filePath", - access: [ APrivate, AStatic ], - pos: position - }); - - #else - var path = filePath; if (path == "") return null; @@ -216,8 +193,6 @@ class AssetsMacro { var fieldValue = { pos: position, expr: EConst(CString(resourceName)) }; fields.push ({ kind: FVar(macro :String, fieldValue), name: "resourceName", access: [ APrivate, AStatic ], pos: position }); - #end - return fields; default: @@ -281,10 +256,6 @@ class AssetsMacro { if (path != null && path != "") { - #if lime_console - throw "not implemented"; - #end - #if html5 Sys.command ("haxelib", [ "run", "lime", "generate", "-font-hash", sys.FileSystem.fullPath(path) ]); path += ".hash"; @@ -381,11 +352,7 @@ class AssetsMacro { super (); - #if lime_console - throw "not implemented"; - #else __fromBytes (haxe.Resource.getBytes (resourceName), null); - #end #end @@ -421,12 +388,8 @@ class AssetsMacro { super(); - #if lime_console - throw "not implemented"; - #else var byteArray = openfl.utils.ByteArray.fromBytes (haxe.Resource.getBytes(resourceName)); loadCompressedDataFromByteArray(byteArray, byteArray.length, forcePlayAsMusic); - #end }; diff --git a/lime/_macros/CFFIMacro.hx b/src/lime/_internal/macros/CFFIMacro.hx similarity index 99% rename from lime/_macros/CFFIMacro.hx rename to src/lime/_internal/macros/CFFIMacro.hx index bc4e03ebb..e60cf4a32 100644 --- a/lime/_macros/CFFIMacro.hx +++ b/src/lime/_internal/macros/CFFIMacro.hx @@ -1,4 +1,4 @@ -package lime._macros; #if macro +package lime._internal.macros; #if macro import haxe.macro.Context; diff --git a/lime/Lib.hx b/src/lime/_internal/macros/DefineMacro.hx similarity index 54% rename from lime/Lib.hx rename to src/lime/_internal/macros/DefineMacro.hx index 4912d732a..22e9d8a92 100644 --- a/lime/Lib.hx +++ b/src/lime/_internal/macros/DefineMacro.hx @@ -1,28 +1,14 @@ -package lime; +package lime._internal.macros; #if macro -import haxe.PosInfos; -import lime.utils.Log; - -#if macro import haxe.macro.Compiler; import haxe.macro.Context; -#end - -#if !lime_debug -@:fileXml('tags="haxe,release"') -@:noDebug -#end -class Lib { +class DefineMacro { - @:noCompletion private static var __sentWarnings = new Map (); - - - #if macro - public static function extraParams ():Void { + public static function run ():Void { if (!Context.defined ("tools") && !Context.defined ("nocffi")) { @@ -46,20 +32,9 @@ class Lib { } } - #end - - - public static function notImplemented (api:String, ?posInfo:PosInfos):Void { - - if (!__sentWarnings.exists (api)) { - - __sentWarnings.set (api, true); - - Log.warn (api + " is not implemented", posInfo); - - } - - } } + + +#end \ No newline at end of file diff --git a/lime/_macros/EventMacro.hx b/src/lime/_internal/macros/EventMacro.hx similarity index 98% rename from lime/_macros/EventMacro.hx rename to src/lime/_internal/macros/EventMacro.hx index 1d44d0d5e..dadebe39c 100644 --- a/lime/_macros/EventMacro.hx +++ b/src/lime/_internal/macros/EventMacro.hx @@ -1,4 +1,4 @@ -package lime._macros; #if macro +package lime._internal.macros; #if macro import haxe.macro.Context; diff --git a/lime/_macros/HTTPRequestMacro.hx b/src/lime/_internal/macros/HTTPRequestMacro.hx similarity index 99% rename from lime/_macros/HTTPRequestMacro.hx rename to src/lime/_internal/macros/HTTPRequestMacro.hx index 4828e2959..e01b9734c 100644 --- a/lime/_macros/HTTPRequestMacro.hx +++ b/src/lime/_internal/macros/HTTPRequestMacro.hx @@ -1,4 +1,4 @@ -package lime._macros; #if macro +package lime._internal.macros; #if macro import haxe.macro.Context; diff --git a/lime/text/unifill/CodePoint.hx b/src/lime/_internal/unifill/CodePoint.hx old mode 100755 new mode 100644 similarity index 97% rename from lime/text/unifill/CodePoint.hx rename to src/lime/_internal/unifill/CodePoint.hx index 4f51950e2..b7314eef0 --- a/lime/text/unifill/CodePoint.hx +++ b/src/lime/_internal/unifill/CodePoint.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; abstract CodePoint(Int) { diff --git a/lime/text/unifill/CodePointIter.hx b/src/lime/_internal/unifill/CodePointIter.hx old mode 100755 new mode 100644 similarity index 94% rename from lime/text/unifill/CodePointIter.hx rename to src/lime/_internal/unifill/CodePointIter.hx index 355a5780b..5a8ba0ccf --- a/lime/text/unifill/CodePointIter.hx +++ b/src/lime/_internal/unifill/CodePointIter.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; #if !lime_debug @:fileXml('tags="haxe,release"') diff --git a/lime/text/unifill/Exception.hx b/src/lime/_internal/unifill/Exception.hx old mode 100755 new mode 100644 similarity index 96% rename from lime/text/unifill/Exception.hx rename to src/lime/_internal/unifill/Exception.hx index 8d261e257..94f15f60a --- a/lime/text/unifill/Exception.hx +++ b/src/lime/_internal/unifill/Exception.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; #if !lime_debug @:fileXml('tags="haxe,release"') diff --git a/lime/text/unifill/InternalEncoding.hx b/src/lime/_internal/unifill/InternalEncoding.hx old mode 100755 new mode 100644 similarity index 99% rename from lime/text/unifill/InternalEncoding.hx rename to src/lime/_internal/unifill/InternalEncoding.hx index 12c3ba0ce..777392fa1 --- a/lime/text/unifill/InternalEncoding.hx +++ b/src/lime/_internal/unifill/InternalEncoding.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; #if (neko || php || cpp || lua || macro) private typedef UtfX = Utf8; diff --git a/lime/text/unifill/InternalEncodingBackwardIter.hx b/src/lime/_internal/unifill/InternalEncodingBackwardIter.hx old mode 100755 new mode 100644 similarity index 94% rename from lime/text/unifill/InternalEncodingBackwardIter.hx rename to src/lime/_internal/unifill/InternalEncodingBackwardIter.hx index 6809487d1..4b4d0c6cb --- a/lime/text/unifill/InternalEncodingBackwardIter.hx +++ b/src/lime/_internal/unifill/InternalEncodingBackwardIter.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; #if !lime_debug @:fileXml('tags="haxe,release"') diff --git a/lime/text/unifill/InternalEncodingIter.hx b/src/lime/_internal/unifill/InternalEncodingIter.hx old mode 100755 new mode 100644 similarity index 94% rename from lime/text/unifill/InternalEncodingIter.hx rename to src/lime/_internal/unifill/InternalEncodingIter.hx index 2805d68d4..2aec402a4 --- a/lime/text/unifill/InternalEncodingIter.hx +++ b/src/lime/_internal/unifill/InternalEncodingIter.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; #if !lime_debug @:fileXml('tags="haxe,release"') diff --git a/lime/text/unifill/Unicode.hx b/src/lime/_internal/unifill/Unicode.hx old mode 100755 new mode 100644 similarity index 97% rename from lime/text/unifill/Unicode.hx rename to src/lime/_internal/unifill/Unicode.hx index 479e49ddb..b8afcdd65 --- a/lime/text/unifill/Unicode.hx +++ b/src/lime/_internal/unifill/Unicode.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; #if !lime_debug @:fileXml('tags="haxe,release"') diff --git a/lime/text/unifill/Unifill.hx b/src/lime/_internal/unifill/Unifill.hx old mode 100755 new mode 100644 similarity index 99% rename from lime/text/unifill/Unifill.hx rename to src/lime/_internal/unifill/Unifill.hx index dc4344e6a..71a5d9648 --- a/lime/text/unifill/Unifill.hx +++ b/src/lime/_internal/unifill/Unifill.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; #if !lime_debug @:fileXml('tags="haxe,release"') diff --git a/lime/text/unifill/Utf16.hx b/src/lime/_internal/unifill/Utf16.hx old mode 100755 new mode 100644 similarity index 99% rename from lime/text/unifill/Utf16.hx rename to src/lime/_internal/unifill/Utf16.hx index 7592f00b7..03f891860 --- a/lime/text/unifill/Utf16.hx +++ b/src/lime/_internal/unifill/Utf16.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; abstract Utf16 (StringU16) { diff --git a/lime/text/unifill/Utf32.hx b/src/lime/_internal/unifill/Utf32.hx old mode 100755 new mode 100644 similarity index 99% rename from lime/text/unifill/Utf32.hx rename to src/lime/_internal/unifill/Utf32.hx index 88ac5861b..935f9fd08 --- a/lime/text/unifill/Utf32.hx +++ b/src/lime/_internal/unifill/Utf32.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; #if python diff --git a/lime/text/unifill/Utf8.hx b/src/lime/_internal/unifill/Utf8.hx old mode 100755 new mode 100644 similarity index 99% rename from lime/text/unifill/Utf8.hx rename to src/lime/_internal/unifill/Utf8.hx index 08c4c7d2d..7de87131c --- a/lime/text/unifill/Utf8.hx +++ b/src/lime/_internal/unifill/Utf8.hx @@ -1,4 +1,4 @@ -package lime.text.unifill; +package lime._internal.unifill; import haxe.io.Bytes; import haxe.io.BytesBuffer; diff --git a/lime/app/Application.hx b/src/lime/app/Application.hx similarity index 85% rename from lime/app/Application.hx rename to src/lime/app/Application.hx index dabcc85fe..450cffef7 100644 --- a/lime/app/Application.hx +++ b/src/lime/app/Application.hx @@ -3,6 +3,7 @@ package lime.app; import lime.system.System; import lime.ui.Window; +import lime.utils.Preloader; #if !lime_debug @:fileXml('tags="haxe,release"') @@ -64,8 +65,8 @@ class Application extends Module { **/ public var windows (get, null):Array; - @:noCompletion private var backend:ApplicationBackend; - @:noCompletion private var windowByID:Map; + @:noCompletion private var __backend:ApplicationBackend; + @:noCompletion private var __windowByID:Map; private static function __init__ () { @@ -98,9 +99,9 @@ class Application extends Module { } modules = new Array (); - windowByID = new Map (); + __windowByID = new Map (); - backend = new ApplicationBackend (this); + __backend = new ApplicationBackend (this); registerModule (this); @@ -141,7 +142,7 @@ class Application extends Module { this.config = config; - backend.create (config); + __backend.create (config); if (config != null) { @@ -200,7 +201,7 @@ class Application extends Module { window.create (this); //__windows.push (window); - windowByID.set (window.id, window); + __windowByID.set (window.id, window); window.onCreate.dispatch (); @@ -217,14 +218,14 @@ class Application extends Module { Application.current = this; - return backend.exec (); + return __backend.exec (); } public override function onModuleExit (code:Int):Void { - backend.exit (); + __backend.exit (); } @@ -254,10 +255,10 @@ class Application extends Module { @:noCompletion public override function removeWindow (window:Window):Void { - if (window != null && windowByID.exists (window.id)) { + if (window != null && __windowByID.exists (window.id)) { __windows.remove (window); - windowByID.remove (window.id); + __windowByID.remove (window.id); window.close (); if (this.window == window) { @@ -299,14 +300,14 @@ class Application extends Module { @:noCompletion private inline function get_frameRate ():Float { - return backend.getFrameRate (); + return __backend.getFrameRate (); } @:noCompletion private inline function set_frameRate (value:Float):Float { - return backend.setFrameRate (value); + return __backend.setFrameRate (value); } @@ -336,13 +337,13 @@ class Application extends Module { #if kha -@:noCompletion private typedef ApplicationBackend = lime._backend.kha.KhaApplication; +@:noCompletion private typedef ApplicationBackend = lime._internal.backend.kha.KhaApplication; #elseif air -@:noCompletion private typedef ApplicationBackend = lime._backend.air.AIRApplication; +@:noCompletion private typedef ApplicationBackend = lime._internal.backend.air.AIRApplication; #elseif flash -@:noCompletion private typedef ApplicationBackend = lime._backend.flash.FlashApplication; +@:noCompletion private typedef ApplicationBackend = lime._internal.backend.flash.FlashApplication; #elseif (js && html5) -@:noCompletion private typedef ApplicationBackend = lime._backend.html5.HTML5Application; +@:noCompletion private typedef ApplicationBackend = lime._internal.backend.html5.HTML5Application; #else -@:noCompletion private typedef ApplicationBackend = lime._backend.native.NativeApplication; +@:noCompletion private typedef ApplicationBackend = lime._internal.backend.native.NativeApplication; #end \ No newline at end of file diff --git a/lime/app/Config.hx b/src/lime/app/Config.hx similarity index 100% rename from lime/app/Config.hx rename to src/lime/app/Config.hx diff --git a/lime/app/Event.hx b/src/lime/app/Event.hx similarity index 97% rename from lime/app/Event.hx rename to src/lime/app/Event.hx index 3a4ad0e88..7310c611b 100644 --- a/lime/app/Event.hx +++ b/src/lime/app/Event.hx @@ -9,7 +9,7 @@ using haxe.macro.Tools; #end #if (!macro && !display) -@:genericBuild(lime._macros.EventMacro.build()) +@:genericBuild(lime._internal.macros.EventMacro.build()) #end #if !lime_debug @@ -25,7 +25,7 @@ class Event { @:noCompletion @:dox(hide) public var __listeners:Array; @:noCompletion @:dox(hide) public var __repeat:Array; - private var __priorities:Array; + @:noCompletion private var __priorities:Array; public function new () { diff --git a/lime/app/Future.hx b/src/lime/app/Future.hx similarity index 96% rename from lime/app/Future.hx rename to src/lime/app/Future.hx index 9f4004004..9e576a027 100644 --- a/lime/app/Future.hx +++ b/src/lime/app/Future.hx @@ -21,9 +21,9 @@ import lime.utils.Log; public var isError (default, null):Bool; public var value (default, null):T; - private var __completeListeners:ArrayVoid>; - private var __errorListeners:ArrayVoid>; - private var __progressListeners:ArrayInt->Void>; + @:noCompletion private var __completeListeners:ArrayVoid>; + @:noCompletion private var __errorListeners:ArrayVoid>; + @:noCompletion private var __progressListeners:ArrayInt->Void>; public function new (work:Void->T = null, async:Bool = false) { diff --git a/lime/app/IModule.hx b/src/lime/app/IModule.hx similarity index 93% rename from lime/app/IModule.hx rename to src/lime/app/IModule.hx index 230c6a4cd..f8fefbf9d 100644 --- a/lime/app/IModule.hx +++ b/src/lime/app/IModule.hx @@ -2,6 +2,7 @@ package lime.app; import lime.ui.Window; +import lime.utils.Preloader; interface IModule { diff --git a/lime/app/Module.hx b/src/lime/app/Module.hx similarity index 96% rename from lime/app/Module.hx rename to src/lime/app/Module.hx index 2b5c44c18..ce0afa01a 100644 --- a/lime/app/Module.hx +++ b/src/lime/app/Module.hx @@ -11,6 +11,7 @@ import lime.ui.KeyCode; import lime.ui.KeyModifier; import lime.ui.Touch; import lime.ui.Window; +import lime.utils.Preloader; #if !lime_debug @:fileXml('tags="haxe,release"') @@ -42,8 +43,8 @@ class Module implements IModule { window.onActivate.add (onWindowActivate.bind (window)); window.onClose.add (__onWindowClose.bind (window), false, -10000); - window.onContextLost.add (onWindowContextLost.bind (window)); - window.onContextRestored.add (onWindowContextRestored.bind (window)); + window.onRenderContextLost.add (onRenderContextLost.bind (window)); + window.onRenderContextRestored.add (onRenderContextRestored.bind (window)); window.onCreate.add (onWindowCreate.bind (window)); window.onDeactivate.add (onWindowDeactivate.bind (window)); window.onDropFile.add (onWindowDropFile.bind (window)); @@ -349,6 +350,21 @@ class Module implements IModule { public function onPreloadProgress (loaded:Int, total:Int):Void { } + /** + * Called when a render context is lost + * @param window The window dispatching the event + */ + public function onRenderContextLost (window:Window):Void { } + + + /** + * Called when a render context is restored + * @param window The window dispatching the event + * @param context The render context relevant to the event + */ + public function onRenderContextRestored (window:Window, context:RenderContext):Void { } + + /** * Called when a text edit event is fired * @param window The window dispatching the event @@ -409,20 +425,6 @@ class Module implements IModule { public function onWindowClose (window:Window):Void { } - /** - * Called when a render context is lost - * @param window The window dispatching the event - */ - public function onWindowContextLost (window:Window):Void { } - - - /** - * Called when a render context is restored - * @param window The window dispatching the event - */ - public function onWindowContextRestored (window:Window):Void { } - - /** * Called when a window create event is fired * @param window The window dispatching the event @@ -521,8 +523,9 @@ class Module implements IModule { /** * Called when a render event is fired * @param window The window dispatching the event + * @param context The render context ready to be rendered */ - public function render (window:Window):Void { } + public function render (window:Window, context:RenderContext):Void { } /** diff --git a/lime/app/Promise.hx b/src/lime/app/Promise.hx similarity index 100% rename from lime/app/Promise.hx rename to src/lime/app/Promise.hx diff --git a/lime/graphics/CairoRenderContext.hx b/src/lime/graphics/CairoRenderContext.hx similarity index 100% rename from lime/graphics/CairoRenderContext.hx rename to src/lime/graphics/CairoRenderContext.hx diff --git a/lime/graphics/CanvasRenderContext.hx b/src/lime/graphics/CanvasRenderContext.hx similarity index 100% rename from lime/graphics/CanvasRenderContext.hx rename to src/lime/graphics/CanvasRenderContext.hx diff --git a/lime/graphics/DOMRenderContext.hx b/src/lime/graphics/DOMRenderContext.hx similarity index 100% rename from lime/graphics/DOMRenderContext.hx rename to src/lime/graphics/DOMRenderContext.hx diff --git a/lime/graphics/FlashRenderContext.hx b/src/lime/graphics/FlashRenderContext.hx similarity index 100% rename from lime/graphics/FlashRenderContext.hx rename to src/lime/graphics/FlashRenderContext.hx diff --git a/lime/graphics/Image.hx b/src/lime/graphics/Image.hx similarity index 94% rename from lime/graphics/Image.hx rename to src/lime/graphics/Image.hx index 916af0eda..e47037cbc 100644 --- a/lime/graphics/Image.hx +++ b/src/lime/graphics/Image.hx @@ -6,20 +6,20 @@ import haxe.io.Bytes; import haxe.io.BytesData; import haxe.io.BytesInput; import haxe.io.BytesOutput; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; +import lime._internal.format.BMP; +import lime._internal.format.JPEG; +import lime._internal.format.PNG; +import lime._internal.graphics.ImageCanvasUtil; +import lime._internal.graphics.ImageDataUtil; import lime.app.Application; import lime.app.Future; import lime.app.Promise; -import lime.graphics.format.BMP; -import lime.graphics.format.JPEG; -import lime.graphics.format.PNG; -import lime.graphics.utils.ImageCanvasUtil; -import lime.graphics.utils.ImageDataUtil; -import lime.math.color.ARGB; -import lime.math.color.BGRA; -import lime.math.color.RGBA; +import lime.math.ARGB; +import lime.math.BGRA; import lime.math.ColorMatrix; import lime.math.Rectangle; +import lime.math.RGBA; import lime.math.Vector2; import lime.net.HTTPRequest; import lime.system.CFFI; @@ -32,7 +32,7 @@ import lime.utils.UInt8Array; #if (js && html5) #if !display -import lime._backend.html5.HTML5HTTPRequest; +import lime._internal.backend.html5.HTML5HTTPRequest; #end import js.html.CanvasElement; import js.html.ImageElement; @@ -62,19 +62,16 @@ import sys.io.File; #end #end -#if lime_console -import lime.graphics.console.TextureData; -#end - #if !lime_debug @:fileXml('tags="haxe,release"') @:noDebug #end -@:autoBuild(lime._macros.AssetsMacro.embedImage()) -@:allow(lime.graphics.util.ImageCanvasUtil) -@:allow(lime.graphics.util.ImageDataUtil) -@:access(lime._backend.native.NativeCFFI) +@:autoBuild(lime._internal.macros.AssetsMacro.embedImage()) + +@:access(lime._internal.backend.native.NativeCFFI) +@:allow(lime._internal.graphics.ImageCanvasUtil) +@:allow(lime._internal.graphics.ImageDataUtil) @:access(lime.app.Application) @:access(lime.math.ColorMatrix) @:access(lime.math.Rectangle) @@ -84,7 +81,7 @@ import lime.graphics.console.TextureData; @:keep #end #if (js && html5 && !display) -@:access(lime._backend.html5.HTML5HTTPRequest) +@:access(lime._internal.backend.html5.HTML5HTTPRequest) #end @@ -414,19 +411,19 @@ class Image { } - public function encode (format:String = "png", quality:Int = 90):Bytes { + public function encode (format:ImageFileFormat = null, quality:Int = 90):Bytes { switch (format) { - case "png": + case null, ImageFileFormat.PNG: return PNG.encode (this); - case "jpg", "jpeg": + case ImageFileFormat.JPEG: return JPEG.encode (this, quality); - case "bmp": + case ImageFileFormat.BMP: return BMP.encode (this); @@ -1383,10 +1380,6 @@ class Image { __fromBase64 (__base64Encode (bytes), type, onload); - #elseif lime_console - - Log.warn ("Image.fromBytes not implemented for console target"); - #elseif (lime_cffi && !macro) var imageBuffer:ImageBuffer = null; @@ -1522,55 +1515,6 @@ class Image { var buffer:ImageBuffer = null; - #if lime_console - - var td = TextureData.fromFile (path); - - if (td.valid) { - - var w = td.width; - var h = td.height; - var data = new Array (); - - #if 1 - - var size = w * h * 4; - cpp.NativeArray.setSize (data, size); - - td.decode (cpp.Pointer.arrayElem (data, 0), size); - /* - { - var dest:cpp.Pointer = cast cpp.Pointer.arrayElem (data, 0); - var src:cpp.Pointer = cast td.pointer; - var n = w * h; - for (i in 0...n) { - dest[i] = src[i]; - } - } - */ - td.release (); - - #else - - // TODO(james4k): caveats here with every image - // pointing to the same piece of memory, and things may - // change with compressed textures. but, may be worth - // considering if game is hitting memory constraints. - // can we do this safely somehow? copy on write? - // probably too many people writing directly to the - // buffer... - cpp.NativeArray.setUnmanagedData (data, td.pointer, w*h*4); - - #end - - var array = new UInt8Array (Bytes.ofData (cast data)); - buffer = new ImageBuffer (array, w, h); - buffer.format = BGRA32; - - } - - #else - #if (!sys || disable_cffi || java || macro) if (false) {} #else @@ -1626,8 +1570,6 @@ class Image { #end - #end - if (buffer != null) { __fromImageBuffer (buffer); diff --git a/lime/graphics/ImageBuffer.hx b/src/lime/graphics/ImageBuffer.hx similarity index 98% rename from lime/graphics/ImageBuffer.hx rename to src/lime/graphics/ImageBuffer.hx index e371d0066..3d130b886 100644 --- a/lime/graphics/ImageBuffer.hx +++ b/src/lime/graphics/ImageBuffer.hx @@ -6,13 +6,13 @@ import lime.graphics.cairo.CairoSurface; import lime.utils.UInt8Array; #if (js && html5) +import lime._internal.graphics.ImageCanvasUtil; import js.html.CanvasElement; import js.html.CanvasRenderingContext2D; import js.html.Image in HTMLImage; import js.html.ImageData; import js.html.Uint8ClampedArray; import js.Browser; -import lime.graphics.utils.ImageCanvasUtil; #elseif flash import flash.display.BitmapData; #end diff --git a/lime/graphics/ImageChannel.hx b/src/lime/graphics/ImageChannel.hx similarity index 100% rename from lime/graphics/ImageChannel.hx rename to src/lime/graphics/ImageChannel.hx diff --git a/src/lime/graphics/ImageFileFormat.hx b/src/lime/graphics/ImageFileFormat.hx new file mode 100644 index 000000000..e5bb1af24 --- /dev/null +++ b/src/lime/graphics/ImageFileFormat.hx @@ -0,0 +1,10 @@ +package lime.graphics; + + +enum ImageFileFormat { + + BMP; + JPEG; + PNG; + +} \ No newline at end of file diff --git a/lime/graphics/ImageType.hx b/src/lime/graphics/ImageType.hx similarity index 100% rename from lime/graphics/ImageType.hx rename to src/lime/graphics/ImageType.hx diff --git a/lime/graphics/GLES2RenderContext.hx b/src/lime/graphics/OpenGLES2RenderContext.hx similarity index 97% rename from lime/graphics/GLES2RenderContext.hx rename to src/lime/graphics/OpenGLES2RenderContext.hx index ad876be9d..eb9718430 100644 --- a/lime/graphics/GLES2RenderContext.hx +++ b/src/lime/graphics/OpenGLES2RenderContext.hx @@ -91,10 +91,10 @@ vertexAttrib3fv, vertexAttrib4f, vertexAttrib4fv, vertexAttribPointer, viewport, EXTENSIONS, type, version) -abstract GLES2RenderContext(GLES3RenderContext) from GLES3RenderContext from GLRenderContext to WebGLRenderContext { +abstract OpenGLES2RenderContext(OpenGLES3RenderContext) from OpenGLES3RenderContext from OpenGLRenderContext to WebGLRenderContext { - @:from private static function fromGL (gl:#if lime_opengl Class #else Dynamic #end):GLES2RenderContext { + @:from private static function fromGL (gl:#if lime_opengl Class #else Dynamic #end):OpenGLES2RenderContext { #if lime_opengl return cast GL.context; diff --git a/lime/graphics/GLES3RenderContext.hx b/src/lime/graphics/OpenGLES3RenderContext.hx similarity index 99% rename from lime/graphics/GLES3RenderContext.hx rename to src/lime/graphics/OpenGLES3RenderContext.hx index b49c7619e..499342ccb 100644 --- a/lime/graphics/GLES3RenderContext.hx +++ b/src/lime/graphics/OpenGLES3RenderContext.hx @@ -9,7 +9,7 @@ import lime.utils.Float32Array; import lime.utils.Int32Array; -abstract GLES3RenderContext(GLRenderContext) from GLRenderContext to GLRenderContext to GLES2RenderContext to WebGL2RenderContext to WebGLRenderContext { +abstract OpenGLES3RenderContext(OpenGLRenderContext) from OpenGLRenderContext to OpenGLRenderContext to OpenGLES2RenderContext to WebGL2RenderContext to WebGLRenderContext { private static var __extensions:String; @@ -3195,7 +3195,7 @@ abstract GLES3RenderContext(GLRenderContext) from GLRenderContext to GLRenderCon } - @:from private static function fromGL (gl:#if lime_opengl Class #else Dynamic #end):GLES3RenderContext { + @:from private static function fromGL (gl:#if lime_opengl Class #else Dynamic #end):OpenGLES3RenderContext { #if lime_opengl return cast GL.context; diff --git a/lime/graphics/GLRenderContext.hx b/src/lime/graphics/OpenGLRenderContext.hx similarity index 99% rename from lime/graphics/GLRenderContext.hx rename to src/lime/graphics/OpenGLRenderContext.hx index 8939708bc..5ff22fa4f 100644 --- a/lime/graphics/GLRenderContext.hx +++ b/src/lime/graphics/OpenGLRenderContext.hx @@ -2,9 +2,9 @@ package lime.graphics; #if (lime_cffi && lime_opengl && !display) -typedef GLRenderContext = lime._backend.native.NativeGLRenderContext; +typedef OpenGLRenderContext = lime._internal.backend.native.NativeOpenGLRenderContext; #elseif (js && html5 && lime_opengl && !display) -typedef GLRenderContext = lime._backend.html5.HTML5GLRenderContext; +typedef OpenGLRenderContext = lime._internal.backend.html5.HTML5OpenGLRenderContext; #else @@ -38,7 +38,7 @@ import js.html.CanvasElement; #end -class GLRenderContext { +class OpenGLRenderContext { public var ACTIVE_ATTRIBUTES:Int; diff --git a/lime/graphics/PixelFormat.hx b/src/lime/graphics/PixelFormat.hx similarity index 100% rename from lime/graphics/PixelFormat.hx rename to src/lime/graphics/PixelFormat.hx diff --git a/lime/graphics/RenderContext.hx b/src/lime/graphics/RenderContext.hx similarity index 72% rename from lime/graphics/RenderContext.hx rename to src/lime/graphics/RenderContext.hx index 53ab5e230..ad0549fbc 100644 --- a/lime/graphics/RenderContext.hx +++ b/src/lime/graphics/RenderContext.hx @@ -11,14 +11,15 @@ class RenderContext { public var cairo (default, null):CairoRenderContext; public var ctx (default, null):CanvasRenderContext; public var element (default, null):DOMRenderContext; - public var gl (default, null):GLRenderContext; - public var gles2 (default, null):GLES2RenderContext; - public var gles3 (default, null):GLES3RenderContext; + public var gl (default, null):OpenGLRenderContext; + public var gles2 (default, null):OpenGLES2RenderContext; + public var gles3 (default, null):OpenGLES3RenderContext; public var sprite (default, null):FlashRenderContext; public var type (default, null):RenderContextType; public var version (default, null):String; public var webgl (default, null):WebGLRenderContext; public var webgl2 (default, null):WebGL2RenderContext; + public var window (default, null):Window; private function new () { diff --git a/lime/graphics/RenderContextType.hx b/src/lime/graphics/RenderContextType.hx similarity index 100% rename from lime/graphics/RenderContextType.hx rename to src/lime/graphics/RenderContextType.hx diff --git a/lime/graphics/WebGL2RenderContext.hx b/src/lime/graphics/WebGL2RenderContext.hx similarity index 99% rename from lime/graphics/WebGL2RenderContext.hx rename to src/lime/graphics/WebGL2RenderContext.hx index 84a821747..e30b6d855 100644 --- a/lime/graphics/WebGL2RenderContext.hx +++ b/src/lime/graphics/WebGL2RenderContext.hx @@ -12,7 +12,7 @@ import lime.utils.Int32Array; import lime.utils.UInt32Array; -abstract WebGL2RenderContext(GLRenderContext) from GLRenderContext to GLRenderContext { +abstract WebGL2RenderContext(OpenGLRenderContext) from OpenGLRenderContext to OpenGLRenderContext { private static var __tempPointer = new BytePointer (); @@ -3158,9 +3158,9 @@ abstract WebGL2RenderContext(GLRenderContext) from GLRenderContext to GLRenderCo } - @:from private static function fromGLES3RenderContext (gl:GLES3RenderContext):WebGL2RenderContext { + @:from private static function fromOpenGLES3RenderContext (gl:OpenGLES3RenderContext):WebGL2RenderContext { - return (gl:GLRenderContext); + return (gl:OpenGLRenderContext); } diff --git a/lime/graphics/WebGLRenderContext.hx b/src/lime/graphics/WebGLRenderContext.hx similarity index 97% rename from lime/graphics/WebGLRenderContext.hx rename to src/lime/graphics/WebGLRenderContext.hx index 2f31ff1eb..c562e679b 100644 --- a/lime/graphics/WebGLRenderContext.hx +++ b/src/lime/graphics/WebGLRenderContext.hx @@ -8,7 +8,7 @@ import lime.utils.Float32Array; @:forward(DEPTH_BUFFER_BIT, STENCIL_BUFFER_BIT, COLOR_BUFFER_BIT, POINTS, LINES, LINE_LOOP, LINE_STRIP, TRIANGLES, TRIANGLE_STRIP, TRIANGLE_FAN, ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, DST_COLOR, ONE_MINUS_DST_COLOR, SRC_ALPHA_SATURATE, FUNC_ADD, BLEND_EQUATION, BLEND_EQUATION_RGB, BLEND_EQUATION_ALPHA, FUNC_SUBTRACT, FUNC_REVERSE_SUBTRACT, BLEND_DST_RGB, BLEND_SRC_RGB, BLEND_DST_ALPHA, BLEND_SRC_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR, CONSTANT_ALPHA, ONE_MINUS_CONSTANT_ALPHA, BLEND_COLOR, ARRAY_BUFFER, ELEMENT_ARRAY_BUFFER, ARRAY_BUFFER_BINDING, ELEMENT_ARRAY_BUFFER_BINDING, STREAM_DRAW, STATIC_DRAW, DYNAMIC_DRAW, BUFFER_SIZE, BUFFER_USAGE, CURRENT_VERTEX_ATTRIB, FRONT, BACK, FRONT_AND_BACK, CULL_FACE, BLEND, DITHER, STENCIL_TEST, DEPTH_TEST, SCISSOR_TEST, POLYGON_OFFSET_FILL, SAMPLE_ALPHA_TO_COVERAGE, SAMPLE_COVERAGE, NO_ERROR, INVALID_ENUM, INVALID_VALUE, INVALID_OPERATION, OUT_OF_MEMORY, CW , CCW, LINE_WIDTH, ALIASED_POINT_SIZE_RANGE, ALIASED_LINE_WIDTH_RANGE, CULL_FACE_MODE, FRONT_FACE, DEPTH_RANGE, DEPTH_WRITEMASK, DEPTH_CLEAR_VALUE, DEPTH_FUNC, STENCIL_CLEAR_VALUE, STENCIL_FUNC, STENCIL_FAIL, STENCIL_PASS_DEPTH_FAIL, STENCIL_PASS_DEPTH_PASS, STENCIL_REF, STENCIL_VALUE_MASK, STENCIL_WRITEMASK, STENCIL_BACK_FUNC, STENCIL_BACK_FAIL, STENCIL_BACK_PASS_DEPTH_FAIL, STENCIL_BACK_PASS_DEPTH_PASS, STENCIL_BACK_REF, STENCIL_BACK_VALUE_MASK, STENCIL_BACK_WRITEMASK, VIEWPORT, SCISSOR_BOX, COLOR_CLEAR_VALUE, COLOR_WRITEMASK, UNPACK_ALIGNMENT, PACK_ALIGNMENT, MAX_TEXTURE_SIZE, MAX_VIEWPORT_DIMS, SUBPIXEL_BITS, RED_BITS, GREEN_BITS, BLUE_BITS, ALPHA_BITS, DEPTH_BITS, STENCIL_BITS, POLYGON_OFFSET_UNITS, POLYGON_OFFSET_FACTOR, TEXTURE_BINDING_2D, SAMPLE_BUFFERS, SAMPLES, SAMPLE_COVERAGE_VALUE, SAMPLE_COVERAGE_INVERT, COMPRESSED_TEXTURE_FORMATS, DONT_CARE, FASTEST, NICEST, GENERATE_MIPMAP_HINT, BYTE, UNSIGNED_BYTE, SHORT, UNSIGNED_SHORT, INT, UNSIGNED_INT, FLOAT, DEPTH_COMPONENT, ALPHA, RGB, RGBA, LUMINANCE, LUMINANCE_ALPHA, UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_5_5_5_1, UNSIGNED_SHORT_5_6_5, FRAGMENT_SHADER, VERTEX_SHADER, MAX_VERTEX_ATTRIBS, MAX_VERTEX_UNIFORM_VECTORS, MAX_VARYING_VECTORS, MAX_COMBINED_TEXTURE_IMAGE_UNITS, MAX_VERTEX_TEXTURE_IMAGE_UNITS, MAX_TEXTURE_IMAGE_UNITS, MAX_FRAGMENT_UNIFORM_VECTORS, SHADER_TYPE, DELETE_STATUS, LINK_STATUS, VALIDATE_STATUS, ATTACHED_SHADERS, ACTIVE_UNIFORMS, ACTIVE_ATTRIBUTES, SHADING_LANGUAGE_VERSION, CURRENT_PROGRAM, NEVER, LESS, EQUAL, LEQUAL, GREATER, NOTEQUAL, GEQUAL, ALWAYS, KEEP, REPLACE, INCR, DECR, INVERT, INCR_WRAP, DECR_WRAP, VENDOR, RENDERER, VERSION, NEAREST, LINEAR, NEAREST_MIPMAP_NEAREST, LINEAR_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR, LINEAR_MIPMAP_LINEAR, TEXTURE_MAG_FILTER, TEXTURE_MIN_FILTER, TEXTURE_WRAP_S, TEXTURE_WRAP_T, TEXTURE_2D, TEXTURE, TEXTURE_CUBE_MAP, TEXTURE_BINDING_CUBE_MAP, TEXTURE_CUBE_MAP_POSITIVE_X, TEXTURE_CUBE_MAP_NEGATIVE_X, TEXTURE_CUBE_MAP_POSITIVE_Y, TEXTURE_CUBE_MAP_NEGATIVE_Y, TEXTURE_CUBE_MAP_POSITIVE_Z, TEXTURE_CUBE_MAP_NEGATIVE_Z, MAX_CUBE_MAP_TEXTURE_SIZE, TEXTURE0, TEXTURE1, TEXTURE2, TEXTURE3, TEXTURE4, TEXTURE5, TEXTURE6, TEXTURE7, TEXTURE8, TEXTURE9, TEXTURE10, TEXTURE11, TEXTURE12, TEXTURE13, TEXTURE14, TEXTURE15, TEXTURE16, TEXTURE17, TEXTURE18, TEXTURE19, TEXTURE20, TEXTURE21, TEXTURE22, TEXTURE23, TEXTURE24, TEXTURE25, TEXTURE26, TEXTURE27, TEXTURE28, TEXTURE29, TEXTURE30, TEXTURE31, ACTIVE_TEXTURE, REPEAT, CLAMP_TO_EDGE, MIRRORED_REPEAT, FLOAT_VEC2, FLOAT_VEC3, FLOAT_VEC4, INT_VEC2, INT_VEC3, INT_VEC4, BOOL, BOOL_VEC2, BOOL_VEC3, BOOL_VEC4, FLOAT_MAT2, FLOAT_MAT3, FLOAT_MAT4, SAMPLER_2D, SAMPLER_CUBE, VERTEX_ATTRIB_ARRAY_ENABLED, VERTEX_ATTRIB_ARRAY_SIZE, VERTEX_ATTRIB_ARRAY_STRIDE, VERTEX_ATTRIB_ARRAY_TYPE, VERTEX_ATTRIB_ARRAY_NORMALIZED, VERTEX_ATTRIB_ARRAY_POINTER, VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, COMPILE_STATUS, LOW_FLOAT, MEDIUM_FLOAT, HIGH_FLOAT, LOW_INT, MEDIUM_INT, HIGH_INT, FRAMEBUFFER, RENDERBUFFER, RGBA4, RGB5_A1, RGB565, DEPTH_COMPONENT16, STENCIL_INDEX, STENCIL_INDEX8, DEPTH_STENCIL, RENDERBUFFER_WIDTH, RENDERBUFFER_HEIGHT, RENDERBUFFER_INTERNAL_FORMAT, RENDERBUFFER_RED_SIZE, RENDERBUFFER_GREEN_SIZE, RENDERBUFFER_BLUE_SIZE, RENDERBUFFER_ALPHA_SIZE, RENDERBUFFER_DEPTH_SIZE, RENDERBUFFER_STENCIL_SIZE, FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, COLOR_ATTACHMENT0, DEPTH_ATTACHMENT, STENCIL_ATTACHMENT, DEPTH_STENCIL_ATTACHMENT, NONE, FRAMEBUFFER_COMPLETE, FRAMEBUFFER_INCOMPLETE_ATTACHMENT, FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, FRAMEBUFFER_INCOMPLETE_DIMENSIONS, FRAMEBUFFER_UNSUPPORTED, FRAMEBUFFER_BINDING, RENDERBUFFER_BINDING, MAX_RENDERBUFFER_SIZE, INVALID_FRAMEBUFFER_OPERATION, UNPACK_FLIP_Y_WEBGL, UNPACK_PREMULTIPLY_ALPHA_WEBGL, CONTEXT_LOST_WEBGL, UNPACK_COLORSPACE_CONVERSION_WEBGL, BROWSER_DEFAULT_WEBGL, type, version, activeTexture, attachShader, bindAttribLocation, bindBuffer, bindFramebuffer, bindRenderbuffer, bindTexture, blendColor, blendEquation, blendEquationSeparate, blendFunc, blendFuncSeparate, checkFramebufferStatus, clear, clearColor, clearDepth, clearStencil, colorMask, compileShader, copyTexImage2D, copyTexSubImage2D, createBuffer, createFramebuffer, createProgram, createRenderbuffer, createShader, createTexture, cullFace, cullFace, deleteBuffer, deleteFramebuffer, deleteProgram, deleteRenderbuffer, deleteShader, deleteTexture, depthFunc, depthMask, depthRange, detachShader, disable, disableVertexAttribArray, drawArrays, drawElements, enable, enableVertexAttribArray, finish, flush, framebufferRenderbuffer, framebufferTexture2D, frontFace, generateMipmap, getActiveAttrib, getActiveUniform, getAttachedShaders, getAttribLocation, getBufferParameter, getContextAttributes, getError, getExtension, getFramebufferAttachmentParameter, getParameter, getProgramInfoLog, getProgramParameter, getRenderbufferParameter, getShaderInfoLog, getShaderParameter, getShaderPrecisionFormat, getShaderSource, getSupportedExtensions, getTexParameter, getUniform, getUniformLocation, getVertexAttrib, getVertexAttribOffset, hint, isBuffer, isContextLost, isEnabled, isFramebuffer, isProgram, isRenderbuffer, isShader, isTexture, lineWidth, linkProgram, pixelStorei, polygonOffset, renderbufferStorage, sampleCoverage, scissor, shaderSource, stencilFunc, stencilFuncSeparate, stencilMask, stencilMaskSeparate, stencilOp, stencilOpSeparate, texParameterf, texParameteri, uniform1f, uniform1fv, uniform1i, uniform1iv, uniform2f, uniform2fv, uniform2i, uniform2iv, uniform3f, uniform3fv, uniform3i, uniform3iv, uniform4f, uniform4fv, uniform4i, uniform4iv, useProgram, validateProgram, vertexAttrib1f, vertexAttrib1fv, vertexAttrib2f, vertexAttrib2fv, vertexAttrib3f, vertexAttrib3fv, vertexAttrib4f, vertexAttrib4fv, vertexAttribPointer, viewport) -abstract WebGLRenderContext(WebGL2RenderContext) from GLRenderContext from WebGL2RenderContext { +abstract WebGLRenderContext(WebGL2RenderContext) from OpenGLRenderContext from WebGL2RenderContext { @@ -121,14 +121,14 @@ abstract WebGLRenderContext(WebGL2RenderContext) from GLRenderContext from WebGL } - @:from private static function fromGLES2Context (gl:GLES2RenderContext):WebGLRenderContext { + @:from private static function fromGLES2Context (gl:OpenGLES2RenderContext):WebGLRenderContext { return cast gl; } - @:from private static function fromGLES3Context (gl:GLES3RenderContext):WebGLRenderContext { + @:from private static function fromGLES3Context (gl:OpenGLES3RenderContext):WebGLRenderContext { return cast gl; diff --git a/lime/graphics/cairo/Cairo.hx b/src/lime/graphics/cairo/Cairo.hx similarity index 99% rename from lime/graphics/cairo/Cairo.hx rename to src/lime/graphics/cairo/Cairo.hx index 8a1600563..9ee97394e 100644 --- a/lime/graphics/cairo/Cairo.hx +++ b/src/lime/graphics/cairo/Cairo.hx @@ -1,7 +1,7 @@ package lime.graphics.cairo; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.math.Matrix3; import lime.math.Vector2; import lime.system.CFFI; @@ -13,7 +13,7 @@ import lime.text.Glyph; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class Cairo { diff --git a/lime/graphics/cairo/CairoAntialias.hx b/src/lime/graphics/cairo/CairoAntialias.hx similarity index 100% rename from lime/graphics/cairo/CairoAntialias.hx rename to src/lime/graphics/cairo/CairoAntialias.hx diff --git a/lime/graphics/cairo/CairoContent.hx b/src/lime/graphics/cairo/CairoContent.hx similarity index 100% rename from lime/graphics/cairo/CairoContent.hx rename to src/lime/graphics/cairo/CairoContent.hx diff --git a/lime/graphics/cairo/CairoExtend.hx b/src/lime/graphics/cairo/CairoExtend.hx similarity index 100% rename from lime/graphics/cairo/CairoExtend.hx rename to src/lime/graphics/cairo/CairoExtend.hx diff --git a/lime/graphics/cairo/CairoFTFontFace.hx b/src/lime/graphics/cairo/CairoFTFontFace.hx similarity index 84% rename from lime/graphics/cairo/CairoFTFontFace.hx rename to src/lime/graphics/cairo/CairoFTFontFace.hx index a801c3345..55b7b0ae1 100644 --- a/lime/graphics/cairo/CairoFTFontFace.hx +++ b/src/lime/graphics/cairo/CairoFTFontFace.hx @@ -1,11 +1,11 @@ package lime.graphics.cairo; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.system.CFFIPointer; import lime.text.Font; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) abstract CairoFTFontFace(CairoFontFace) from CairoFontFace to CairoFontFace from CFFIPointer to CFFIPointer { diff --git a/lime/graphics/cairo/CairoFillRule.hx b/src/lime/graphics/cairo/CairoFillRule.hx similarity index 100% rename from lime/graphics/cairo/CairoFillRule.hx rename to src/lime/graphics/cairo/CairoFillRule.hx diff --git a/lime/graphics/cairo/CairoFilter.hx b/src/lime/graphics/cairo/CairoFilter.hx similarity index 100% rename from lime/graphics/cairo/CairoFilter.hx rename to src/lime/graphics/cairo/CairoFilter.hx diff --git a/lime/graphics/cairo/CairoFontFace.hx b/src/lime/graphics/cairo/CairoFontFace.hx similarity index 78% rename from lime/graphics/cairo/CairoFontFace.hx rename to src/lime/graphics/cairo/CairoFontFace.hx index 1e453200e..4b16157ed 100644 --- a/lime/graphics/cairo/CairoFontFace.hx +++ b/src/lime/graphics/cairo/CairoFontFace.hx @@ -1,10 +1,10 @@ package lime.graphics.cairo; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.system.CFFIPointer; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) abstract CairoFontFace(CFFIPointer) from CFFIPointer to CFFIPointer { diff --git a/lime/graphics/cairo/CairoFontOptions.hx b/src/lime/graphics/cairo/CairoFontOptions.hx similarity index 92% rename from lime/graphics/cairo/CairoFontOptions.hx rename to src/lime/graphics/cairo/CairoFontOptions.hx index e0117976c..35267a40e 100644 --- a/lime/graphics/cairo/CairoFontOptions.hx +++ b/src/lime/graphics/cairo/CairoFontOptions.hx @@ -1,127 +1,127 @@ -package lime.graphics.cairo; - - -import lime._backend.native.NativeCFFI; -import lime.system.CFFIPointer; -import lime.text.Font; - -@:access(lime._backend.native.NativeCFFI) - - -abstract CairoFontOptions(CFFIPointer) from CFFIPointer to CFFIPointer { - - - public var antialias (get, set):CairoAntialias; - public var hintMetrics (get, set):CairoHintMetrics; - public var hintStyle (get, set):CairoHintStyle; - public var subpixelOrder (get, set):CairoSubpixelOrder; - - - public function new () { - - #if (lime_cffi && lime_cairo && !macro) - this = NativeCFFI.lime_cairo_font_options_create (); - #else - this = null; - #end - - } - - - - - // Get & Set Methods - - - - - @:noCompletion private function get_antialias ():CairoAntialias { - - #if (lime_cffi && lime_cairo && !macro) - return NativeCFFI.lime_cairo_font_options_get_antialias (this); - #end - - return cast 0; - - } - - - @:noCompletion private function set_antialias (value:CairoAntialias):CairoAntialias { - - #if (lime_cffi && lime_cairo && !macro) - NativeCFFI.lime_cairo_font_options_set_antialias (this, value); - #end - - return value; - - } - - - @:noCompletion private function get_hintMetrics ():CairoHintMetrics { - - #if (lime_cffi && lime_cairo && !macro) - return NativeCFFI.lime_cairo_font_options_get_hint_metrics (this); - #end - - return cast 0; - - } - - - @:noCompletion private function set_hintMetrics (value:CairoHintMetrics):CairoHintMetrics { - - #if (lime_cffi && lime_cairo && !macro) - NativeCFFI.lime_cairo_font_options_set_hint_metrics (this, value); - #end - - return value; - - } - - - - @:noCompletion private function get_hintStyle ():CairoHintStyle { - - #if (lime_cffi && lime_cairo && !macro) - return NativeCFFI.lime_cairo_font_options_get_hint_style (this); - #end - - return cast 0; - - } - - - @:noCompletion private function set_hintStyle (value:CairoHintStyle):CairoHintStyle { - - #if (lime_cffi && lime_cairo && !macro) - NativeCFFI.lime_cairo_font_options_set_hint_style (this, value); - #end - - return value; - - } - - - @:noCompletion private function get_subpixelOrder ():CairoSubpixelOrder { - - #if (lime_cffi && lime_cairo && !macro) - return NativeCFFI.lime_cairo_font_options_get_subpixel_order (this); - #end - - return cast 0; - - } - - - @:noCompletion private function set_subpixelOrder (value:CairoSubpixelOrder):CairoSubpixelOrder { - - #if (lime_cffi && lime_cairo && !macro) - NativeCFFI.lime_cairo_font_options_set_subpixel_order (this, value); - #end - - return value; - - } - - +package lime.graphics.cairo; + + +import lime._internal.backend.native.NativeCFFI; +import lime.system.CFFIPointer; +import lime.text.Font; + +@:access(lime._internal.backend.native.NativeCFFI) + + +abstract CairoFontOptions(CFFIPointer) from CFFIPointer to CFFIPointer { + + + public var antialias (get, set):CairoAntialias; + public var hintMetrics (get, set):CairoHintMetrics; + public var hintStyle (get, set):CairoHintStyle; + public var subpixelOrder (get, set):CairoSubpixelOrder; + + + public function new () { + + #if (lime_cffi && lime_cairo && !macro) + this = NativeCFFI.lime_cairo_font_options_create (); + #else + this = null; + #end + + } + + + + + // Get & Set Methods + + + + + @:noCompletion private function get_antialias ():CairoAntialias { + + #if (lime_cffi && lime_cairo && !macro) + return NativeCFFI.lime_cairo_font_options_get_antialias (this); + #end + + return cast 0; + + } + + + @:noCompletion private function set_antialias (value:CairoAntialias):CairoAntialias { + + #if (lime_cffi && lime_cairo && !macro) + NativeCFFI.lime_cairo_font_options_set_antialias (this, value); + #end + + return value; + + } + + + @:noCompletion private function get_hintMetrics ():CairoHintMetrics { + + #if (lime_cffi && lime_cairo && !macro) + return NativeCFFI.lime_cairo_font_options_get_hint_metrics (this); + #end + + return cast 0; + + } + + + @:noCompletion private function set_hintMetrics (value:CairoHintMetrics):CairoHintMetrics { + + #if (lime_cffi && lime_cairo && !macro) + NativeCFFI.lime_cairo_font_options_set_hint_metrics (this, value); + #end + + return value; + + } + + + + @:noCompletion private function get_hintStyle ():CairoHintStyle { + + #if (lime_cffi && lime_cairo && !macro) + return NativeCFFI.lime_cairo_font_options_get_hint_style (this); + #end + + return cast 0; + + } + + + @:noCompletion private function set_hintStyle (value:CairoHintStyle):CairoHintStyle { + + #if (lime_cffi && lime_cairo && !macro) + NativeCFFI.lime_cairo_font_options_set_hint_style (this, value); + #end + + return value; + + } + + + @:noCompletion private function get_subpixelOrder ():CairoSubpixelOrder { + + #if (lime_cffi && lime_cairo && !macro) + return NativeCFFI.lime_cairo_font_options_get_subpixel_order (this); + #end + + return cast 0; + + } + + + @:noCompletion private function set_subpixelOrder (value:CairoSubpixelOrder):CairoSubpixelOrder { + + #if (lime_cffi && lime_cairo && !macro) + NativeCFFI.lime_cairo_font_options_set_subpixel_order (this, value); + #end + + return value; + + } + + } \ No newline at end of file diff --git a/lime/graphics/cairo/CairoFormat.hx b/src/lime/graphics/cairo/CairoFormat.hx similarity index 100% rename from lime/graphics/cairo/CairoFormat.hx rename to src/lime/graphics/cairo/CairoFormat.hx diff --git a/lime/graphics/cairo/CairoGlyph.hx b/src/lime/graphics/cairo/CairoGlyph.hx similarity index 100% rename from lime/graphics/cairo/CairoGlyph.hx rename to src/lime/graphics/cairo/CairoGlyph.hx diff --git a/lime/graphics/cairo/CairoHintMetrics.hx b/src/lime/graphics/cairo/CairoHintMetrics.hx similarity index 100% rename from lime/graphics/cairo/CairoHintMetrics.hx rename to src/lime/graphics/cairo/CairoHintMetrics.hx diff --git a/lime/graphics/cairo/CairoHintStyle.hx b/src/lime/graphics/cairo/CairoHintStyle.hx similarity index 100% rename from lime/graphics/cairo/CairoHintStyle.hx rename to src/lime/graphics/cairo/CairoHintStyle.hx diff --git a/lime/graphics/cairo/CairoImageSurface.hx b/src/lime/graphics/cairo/CairoImageSurface.hx similarity index 95% rename from lime/graphics/cairo/CairoImageSurface.hx rename to src/lime/graphics/cairo/CairoImageSurface.hx index 9aa18d7d4..74a5f347c 100644 --- a/lime/graphics/cairo/CairoImageSurface.hx +++ b/src/lime/graphics/cairo/CairoImageSurface.hx @@ -1,11 +1,11 @@ package lime.graphics.cairo; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.system.CFFIPointer; import lime.utils.DataPointer; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:forward abstract CairoImageSurface(CairoSurface) from CairoSurface to CairoSurface from CFFIPointer to CFFIPointer { diff --git a/lime/graphics/cairo/CairoLineCap.hx b/src/lime/graphics/cairo/CairoLineCap.hx similarity index 100% rename from lime/graphics/cairo/CairoLineCap.hx rename to src/lime/graphics/cairo/CairoLineCap.hx diff --git a/lime/graphics/cairo/CairoLineJoin.hx b/src/lime/graphics/cairo/CairoLineJoin.hx similarity index 100% rename from lime/graphics/cairo/CairoLineJoin.hx rename to src/lime/graphics/cairo/CairoLineJoin.hx diff --git a/lime/graphics/cairo/CairoOperator.hx b/src/lime/graphics/cairo/CairoOperator.hx similarity index 100% rename from lime/graphics/cairo/CairoOperator.hx rename to src/lime/graphics/cairo/CairoOperator.hx diff --git a/lime/graphics/cairo/CairoPattern.hx b/src/lime/graphics/cairo/CairoPattern.hx similarity index 97% rename from lime/graphics/cairo/CairoPattern.hx rename to src/lime/graphics/cairo/CairoPattern.hx index 601f33d80..4e97f50a4 100644 --- a/lime/graphics/cairo/CairoPattern.hx +++ b/src/lime/graphics/cairo/CairoPattern.hx @@ -1,11 +1,11 @@ package lime.graphics.cairo; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.math.Matrix3; import lime.system.CFFIPointer; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) abstract CairoPattern(CFFIPointer) from CFFIPointer to CFFIPointer { diff --git a/lime/graphics/cairo/CairoStatus.hx b/src/lime/graphics/cairo/CairoStatus.hx similarity index 100% rename from lime/graphics/cairo/CairoStatus.hx rename to src/lime/graphics/cairo/CairoStatus.hx diff --git a/lime/graphics/cairo/CairoSubpixelOrder.hx b/src/lime/graphics/cairo/CairoSubpixelOrder.hx similarity index 100% rename from lime/graphics/cairo/CairoSubpixelOrder.hx rename to src/lime/graphics/cairo/CairoSubpixelOrder.hx diff --git a/lime/graphics/cairo/CairoSurface.hx b/src/lime/graphics/cairo/CairoSurface.hx similarity index 73% rename from lime/graphics/cairo/CairoSurface.hx rename to src/lime/graphics/cairo/CairoSurface.hx index d6cd2fda5..bae5f3992 100644 --- a/lime/graphics/cairo/CairoSurface.hx +++ b/src/lime/graphics/cairo/CairoSurface.hx @@ -1,10 +1,10 @@ package lime.graphics.cairo; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.system.CFFIPointer; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) abstract CairoSurface(CFFIPointer) from CFFIPointer to CFFIPointer { diff --git a/lime/graphics/opengl/GL.hx b/src/lime/graphics/opengl/GL.hx similarity index 99% rename from lime/graphics/opengl/GL.hx rename to src/lime/graphics/opengl/GL.hx index 5de33c54c..4b18eb0a5 100644 --- a/lime/graphics/opengl/GL.hx +++ b/src/lime/graphics/opengl/GL.hx @@ -12,7 +12,7 @@ import lime.utils.Float32Array; import lime.utils.Int32Array; #if (lime_cffi && lime_opengl && !macro) -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; #end @:allow(lime.ui.Window) @@ -655,7 +655,7 @@ class GL { public static inline var TIMEOUT_IGNORED = -1; public static inline var MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247; - public static var context (default, null):GLRenderContext; + public static var context (default, null):OpenGLRenderContext; public static var type (get, null):RenderContextType; public static var version (get, null):Float; @@ -3128,7 +3128,7 @@ class GL { #if (!js || !html5 || display) -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) #if hl @:keep #end @:dox(hide) @:noCompletion class GLObject { diff --git a/lime/graphics/opengl/GLActiveInfo.hx b/src/lime/graphics/opengl/GLActiveInfo.hx similarity index 100% rename from lime/graphics/opengl/GLActiveInfo.hx rename to src/lime/graphics/opengl/GLActiveInfo.hx diff --git a/lime/graphics/opengl/GLBuffer.hx b/src/lime/graphics/opengl/GLBuffer.hx similarity index 100% rename from lime/graphics/opengl/GLBuffer.hx rename to src/lime/graphics/opengl/GLBuffer.hx diff --git a/lime/graphics/opengl/GLContextAttributes.hx b/src/lime/graphics/opengl/GLContextAttributes.hx similarity index 100% rename from lime/graphics/opengl/GLContextAttributes.hx rename to src/lime/graphics/opengl/GLContextAttributes.hx diff --git a/lime/graphics/opengl/GLFramebuffer.hx b/src/lime/graphics/opengl/GLFramebuffer.hx similarity index 100% rename from lime/graphics/opengl/GLFramebuffer.hx rename to src/lime/graphics/opengl/GLFramebuffer.hx diff --git a/lime/graphics/opengl/GLProgram.hx b/src/lime/graphics/opengl/GLProgram.hx similarity index 100% rename from lime/graphics/opengl/GLProgram.hx rename to src/lime/graphics/opengl/GLProgram.hx diff --git a/lime/graphics/opengl/GLQuery.hx b/src/lime/graphics/opengl/GLQuery.hx similarity index 100% rename from lime/graphics/opengl/GLQuery.hx rename to src/lime/graphics/opengl/GLQuery.hx diff --git a/lime/graphics/opengl/GLRenderbuffer.hx b/src/lime/graphics/opengl/GLRenderbuffer.hx similarity index 100% rename from lime/graphics/opengl/GLRenderbuffer.hx rename to src/lime/graphics/opengl/GLRenderbuffer.hx diff --git a/lime/graphics/opengl/GLSampler.hx b/src/lime/graphics/opengl/GLSampler.hx similarity index 100% rename from lime/graphics/opengl/GLSampler.hx rename to src/lime/graphics/opengl/GLSampler.hx diff --git a/lime/graphics/opengl/GLShader.hx b/src/lime/graphics/opengl/GLShader.hx similarity index 100% rename from lime/graphics/opengl/GLShader.hx rename to src/lime/graphics/opengl/GLShader.hx diff --git a/lime/graphics/opengl/GLShaderPrecisionFormat.hx b/src/lime/graphics/opengl/GLShaderPrecisionFormat.hx similarity index 100% rename from lime/graphics/opengl/GLShaderPrecisionFormat.hx rename to src/lime/graphics/opengl/GLShaderPrecisionFormat.hx diff --git a/lime/graphics/opengl/GLSync.hx b/src/lime/graphics/opengl/GLSync.hx similarity index 72% rename from lime/graphics/opengl/GLSync.hx rename to src/lime/graphics/opengl/GLSync.hx index b7472c1ae..19166ed63 100644 --- a/lime/graphics/opengl/GLSync.hx +++ b/src/lime/graphics/opengl/GLSync.hx @@ -1,10 +1,10 @@ package lime.graphics.opengl; #if lime_opengl #if (!js || !html5 || display) -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.system.CFFIPointer; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) abstract GLSync(CFFIPointer) from CFFIPointer to CFFIPointer { diff --git a/lime/graphics/opengl/GLTexture.hx b/src/lime/graphics/opengl/GLTexture.hx similarity index 100% rename from lime/graphics/opengl/GLTexture.hx rename to src/lime/graphics/opengl/GLTexture.hx diff --git a/lime/graphics/opengl/GLTransformFeedback.hx b/src/lime/graphics/opengl/GLTransformFeedback.hx similarity index 100% rename from lime/graphics/opengl/GLTransformFeedback.hx rename to src/lime/graphics/opengl/GLTransformFeedback.hx diff --git a/lime/graphics/opengl/GLUniformLocation.hx b/src/lime/graphics/opengl/GLUniformLocation.hx similarity index 100% rename from lime/graphics/opengl/GLUniformLocation.hx rename to src/lime/graphics/opengl/GLUniformLocation.hx diff --git a/lime/graphics/opengl/GLVertexArrayObject.hx b/src/lime/graphics/opengl/GLVertexArrayObject.hx similarity index 100% rename from lime/graphics/opengl/GLVertexArrayObject.hx rename to src/lime/graphics/opengl/GLVertexArrayObject.hx diff --git a/lime/graphics/opengl/ext/AMD_compressed_3DC_texture.hx b/src/lime/graphics/opengl/ext/AMD_compressed_3DC_texture.hx similarity index 100% rename from lime/graphics/opengl/ext/AMD_compressed_3DC_texture.hx rename to src/lime/graphics/opengl/ext/AMD_compressed_3DC_texture.hx diff --git a/lime/graphics/opengl/ext/AMD_compressed_ATC_texture.hx b/src/lime/graphics/opengl/ext/AMD_compressed_ATC_texture.hx similarity index 100% rename from lime/graphics/opengl/ext/AMD_compressed_ATC_texture.hx rename to src/lime/graphics/opengl/ext/AMD_compressed_ATC_texture.hx diff --git a/lime/graphics/opengl/ext/AMD_performance_monitor.hx b/src/lime/graphics/opengl/ext/AMD_performance_monitor.hx similarity index 100% rename from lime/graphics/opengl/ext/AMD_performance_monitor.hx rename to src/lime/graphics/opengl/ext/AMD_performance_monitor.hx diff --git a/lime/graphics/opengl/ext/AMD_program_binary_Z400.hx b/src/lime/graphics/opengl/ext/AMD_program_binary_Z400.hx similarity index 100% rename from lime/graphics/opengl/ext/AMD_program_binary_Z400.hx rename to src/lime/graphics/opengl/ext/AMD_program_binary_Z400.hx diff --git a/lime/graphics/opengl/ext/ANGLE_framebuffer_blit.hx b/src/lime/graphics/opengl/ext/ANGLE_framebuffer_blit.hx similarity index 100% rename from lime/graphics/opengl/ext/ANGLE_framebuffer_blit.hx rename to src/lime/graphics/opengl/ext/ANGLE_framebuffer_blit.hx diff --git a/lime/graphics/opengl/ext/ANGLE_framebuffer_multisample.hx b/src/lime/graphics/opengl/ext/ANGLE_framebuffer_multisample.hx similarity index 100% rename from lime/graphics/opengl/ext/ANGLE_framebuffer_multisample.hx rename to src/lime/graphics/opengl/ext/ANGLE_framebuffer_multisample.hx diff --git a/lime/graphics/opengl/ext/ANGLE_instanced_arrays.hx b/src/lime/graphics/opengl/ext/ANGLE_instanced_arrays.hx similarity index 100% rename from lime/graphics/opengl/ext/ANGLE_instanced_arrays.hx rename to src/lime/graphics/opengl/ext/ANGLE_instanced_arrays.hx diff --git a/lime/graphics/opengl/ext/ANGLE_pack_reverse_row_order.hx b/src/lime/graphics/opengl/ext/ANGLE_pack_reverse_row_order.hx similarity index 100% rename from lime/graphics/opengl/ext/ANGLE_pack_reverse_row_order.hx rename to src/lime/graphics/opengl/ext/ANGLE_pack_reverse_row_order.hx diff --git a/lime/graphics/opengl/ext/ANGLE_texture_compression_dxt3.hx b/src/lime/graphics/opengl/ext/ANGLE_texture_compression_dxt3.hx similarity index 100% rename from lime/graphics/opengl/ext/ANGLE_texture_compression_dxt3.hx rename to src/lime/graphics/opengl/ext/ANGLE_texture_compression_dxt3.hx diff --git a/lime/graphics/opengl/ext/ANGLE_texture_compression_dxt5.hx b/src/lime/graphics/opengl/ext/ANGLE_texture_compression_dxt5.hx similarity index 100% rename from lime/graphics/opengl/ext/ANGLE_texture_compression_dxt5.hx rename to src/lime/graphics/opengl/ext/ANGLE_texture_compression_dxt5.hx diff --git a/lime/graphics/opengl/ext/ANGLE_texture_usage.hx b/src/lime/graphics/opengl/ext/ANGLE_texture_usage.hx similarity index 100% rename from lime/graphics/opengl/ext/ANGLE_texture_usage.hx rename to src/lime/graphics/opengl/ext/ANGLE_texture_usage.hx diff --git a/lime/graphics/opengl/ext/ANGLE_translated_shader_source.hx b/src/lime/graphics/opengl/ext/ANGLE_translated_shader_source.hx similarity index 100% rename from lime/graphics/opengl/ext/ANGLE_translated_shader_source.hx rename to src/lime/graphics/opengl/ext/ANGLE_translated_shader_source.hx diff --git a/lime/graphics/opengl/ext/APPLE_copy_texture_levels.hx b/src/lime/graphics/opengl/ext/APPLE_copy_texture_levels.hx similarity index 100% rename from lime/graphics/opengl/ext/APPLE_copy_texture_levels.hx rename to src/lime/graphics/opengl/ext/APPLE_copy_texture_levels.hx diff --git a/lime/graphics/opengl/ext/APPLE_framebuffer_multisample.hx b/src/lime/graphics/opengl/ext/APPLE_framebuffer_multisample.hx similarity index 100% rename from lime/graphics/opengl/ext/APPLE_framebuffer_multisample.hx rename to src/lime/graphics/opengl/ext/APPLE_framebuffer_multisample.hx diff --git a/lime/graphics/opengl/ext/APPLE_rgb_422.hx b/src/lime/graphics/opengl/ext/APPLE_rgb_422.hx similarity index 100% rename from lime/graphics/opengl/ext/APPLE_rgb_422.hx rename to src/lime/graphics/opengl/ext/APPLE_rgb_422.hx diff --git a/lime/graphics/opengl/ext/APPLE_sync.hx b/src/lime/graphics/opengl/ext/APPLE_sync.hx similarity index 100% rename from lime/graphics/opengl/ext/APPLE_sync.hx rename to src/lime/graphics/opengl/ext/APPLE_sync.hx diff --git a/lime/graphics/opengl/ext/APPLE_texture_format_BGRA8888.hx b/src/lime/graphics/opengl/ext/APPLE_texture_format_BGRA8888.hx similarity index 100% rename from lime/graphics/opengl/ext/APPLE_texture_format_BGRA8888.hx rename to src/lime/graphics/opengl/ext/APPLE_texture_format_BGRA8888.hx diff --git a/lime/graphics/opengl/ext/APPLE_texture_max_level.hx b/src/lime/graphics/opengl/ext/APPLE_texture_max_level.hx similarity index 100% rename from lime/graphics/opengl/ext/APPLE_texture_max_level.hx rename to src/lime/graphics/opengl/ext/APPLE_texture_max_level.hx diff --git a/lime/graphics/opengl/ext/ARM_mali_program_binary.hx b/src/lime/graphics/opengl/ext/ARM_mali_program_binary.hx similarity index 100% rename from lime/graphics/opengl/ext/ARM_mali_program_binary.hx rename to src/lime/graphics/opengl/ext/ARM_mali_program_binary.hx diff --git a/lime/graphics/opengl/ext/ARM_mali_shader_binary.hx b/src/lime/graphics/opengl/ext/ARM_mali_shader_binary.hx similarity index 100% rename from lime/graphics/opengl/ext/ARM_mali_shader_binary.hx rename to src/lime/graphics/opengl/ext/ARM_mali_shader_binary.hx diff --git a/lime/graphics/opengl/ext/ARM_rgba8.hx b/src/lime/graphics/opengl/ext/ARM_rgba8.hx similarity index 100% rename from lime/graphics/opengl/ext/ARM_rgba8.hx rename to src/lime/graphics/opengl/ext/ARM_rgba8.hx diff --git a/lime/graphics/opengl/ext/DMP_shader_binary.hx b/src/lime/graphics/opengl/ext/DMP_shader_binary.hx similarity index 100% rename from lime/graphics/opengl/ext/DMP_shader_binary.hx rename to src/lime/graphics/opengl/ext/DMP_shader_binary.hx diff --git a/lime/graphics/opengl/ext/EXT_bgra.hx b/src/lime/graphics/opengl/ext/EXT_bgra.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_bgra.hx rename to src/lime/graphics/opengl/ext/EXT_bgra.hx diff --git a/lime/graphics/opengl/ext/EXT_blend_minmax.hx b/src/lime/graphics/opengl/ext/EXT_blend_minmax.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_blend_minmax.hx rename to src/lime/graphics/opengl/ext/EXT_blend_minmax.hx diff --git a/lime/graphics/opengl/ext/EXT_color_buffer_float.hx b/src/lime/graphics/opengl/ext/EXT_color_buffer_float.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_color_buffer_float.hx rename to src/lime/graphics/opengl/ext/EXT_color_buffer_float.hx diff --git a/lime/graphics/opengl/ext/EXT_color_buffer_half_float.hx b/src/lime/graphics/opengl/ext/EXT_color_buffer_half_float.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_color_buffer_half_float.hx rename to src/lime/graphics/opengl/ext/EXT_color_buffer_half_float.hx diff --git a/lime/graphics/opengl/ext/EXT_debug_label.hx b/src/lime/graphics/opengl/ext/EXT_debug_label.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_debug_label.hx rename to src/lime/graphics/opengl/ext/EXT_debug_label.hx diff --git a/lime/graphics/opengl/ext/EXT_debug_marker.hx b/src/lime/graphics/opengl/ext/EXT_debug_marker.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_debug_marker.hx rename to src/lime/graphics/opengl/ext/EXT_debug_marker.hx diff --git a/lime/graphics/opengl/ext/EXT_discard_framebuffer.hx b/src/lime/graphics/opengl/ext/EXT_discard_framebuffer.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_discard_framebuffer.hx rename to src/lime/graphics/opengl/ext/EXT_discard_framebuffer.hx diff --git a/lime/graphics/opengl/ext/EXT_disjoint_timer_query.hx b/src/lime/graphics/opengl/ext/EXT_disjoint_timer_query.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_disjoint_timer_query.hx rename to src/lime/graphics/opengl/ext/EXT_disjoint_timer_query.hx diff --git a/lime/graphics/opengl/ext/EXT_frag_depth.hx b/src/lime/graphics/opengl/ext/EXT_frag_depth.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_frag_depth.hx rename to src/lime/graphics/opengl/ext/EXT_frag_depth.hx diff --git a/lime/graphics/opengl/ext/EXT_map_buffer_range.hx b/src/lime/graphics/opengl/ext/EXT_map_buffer_range.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_map_buffer_range.hx rename to src/lime/graphics/opengl/ext/EXT_map_buffer_range.hx diff --git a/lime/graphics/opengl/ext/EXT_multi_draw_arrays.hx b/src/lime/graphics/opengl/ext/EXT_multi_draw_arrays.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_multi_draw_arrays.hx rename to src/lime/graphics/opengl/ext/EXT_multi_draw_arrays.hx diff --git a/lime/graphics/opengl/ext/EXT_multisampled_render_to_texture.hx b/src/lime/graphics/opengl/ext/EXT_multisampled_render_to_texture.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_multisampled_render_to_texture.hx rename to src/lime/graphics/opengl/ext/EXT_multisampled_render_to_texture.hx diff --git a/lime/graphics/opengl/ext/EXT_multiview_draw_buffers.hx b/src/lime/graphics/opengl/ext/EXT_multiview_draw_buffers.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_multiview_draw_buffers.hx rename to src/lime/graphics/opengl/ext/EXT_multiview_draw_buffers.hx diff --git a/lime/graphics/opengl/ext/EXT_occlusion_query_boolean.hx b/src/lime/graphics/opengl/ext/EXT_occlusion_query_boolean.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_occlusion_query_boolean.hx rename to src/lime/graphics/opengl/ext/EXT_occlusion_query_boolean.hx diff --git a/lime/graphics/opengl/ext/EXT_packed_depth_stencil.hx b/src/lime/graphics/opengl/ext/EXT_packed_depth_stencil.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_packed_depth_stencil.hx rename to src/lime/graphics/opengl/ext/EXT_packed_depth_stencil.hx diff --git a/lime/graphics/opengl/ext/EXT_read_format_bgra.hx b/src/lime/graphics/opengl/ext/EXT_read_format_bgra.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_read_format_bgra.hx rename to src/lime/graphics/opengl/ext/EXT_read_format_bgra.hx diff --git a/lime/graphics/opengl/ext/EXT_robustness.hx b/src/lime/graphics/opengl/ext/EXT_robustness.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_robustness.hx rename to src/lime/graphics/opengl/ext/EXT_robustness.hx diff --git a/lime/graphics/opengl/ext/EXT_sRGB.hx b/src/lime/graphics/opengl/ext/EXT_sRGB.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_sRGB.hx rename to src/lime/graphics/opengl/ext/EXT_sRGB.hx diff --git a/lime/graphics/opengl/ext/EXT_separate_shader_objects.hx b/src/lime/graphics/opengl/ext/EXT_separate_shader_objects.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_separate_shader_objects.hx rename to src/lime/graphics/opengl/ext/EXT_separate_shader_objects.hx diff --git a/lime/graphics/opengl/ext/EXT_shader_framebuffer_fetch.hx b/src/lime/graphics/opengl/ext/EXT_shader_framebuffer_fetch.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_shader_framebuffer_fetch.hx rename to src/lime/graphics/opengl/ext/EXT_shader_framebuffer_fetch.hx diff --git a/lime/graphics/opengl/ext/EXT_shader_texture_lod.hx b/src/lime/graphics/opengl/ext/EXT_shader_texture_lod.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_shader_texture_lod.hx rename to src/lime/graphics/opengl/ext/EXT_shader_texture_lod.hx diff --git a/lime/graphics/opengl/ext/EXT_shadow_samplers.hx b/src/lime/graphics/opengl/ext/EXT_shadow_samplers.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_shadow_samplers.hx rename to src/lime/graphics/opengl/ext/EXT_shadow_samplers.hx diff --git a/lime/graphics/opengl/ext/EXT_texture_compression_dxt1.hx b/src/lime/graphics/opengl/ext/EXT_texture_compression_dxt1.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_texture_compression_dxt1.hx rename to src/lime/graphics/opengl/ext/EXT_texture_compression_dxt1.hx diff --git a/lime/graphics/opengl/ext/EXT_texture_compression_s3tc.hx b/src/lime/graphics/opengl/ext/EXT_texture_compression_s3tc.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_texture_compression_s3tc.hx rename to src/lime/graphics/opengl/ext/EXT_texture_compression_s3tc.hx diff --git a/lime/graphics/opengl/ext/EXT_texture_filter_anisotropic.hx b/src/lime/graphics/opengl/ext/EXT_texture_filter_anisotropic.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_texture_filter_anisotropic.hx rename to src/lime/graphics/opengl/ext/EXT_texture_filter_anisotropic.hx diff --git a/lime/graphics/opengl/ext/EXT_texture_format_BGRA8888.hx b/src/lime/graphics/opengl/ext/EXT_texture_format_BGRA8888.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_texture_format_BGRA8888.hx rename to src/lime/graphics/opengl/ext/EXT_texture_format_BGRA8888.hx diff --git a/lime/graphics/opengl/ext/EXT_texture_rg.hx b/src/lime/graphics/opengl/ext/EXT_texture_rg.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_texture_rg.hx rename to src/lime/graphics/opengl/ext/EXT_texture_rg.hx diff --git a/lime/graphics/opengl/ext/EXT_texture_storage.hx b/src/lime/graphics/opengl/ext/EXT_texture_storage.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_texture_storage.hx rename to src/lime/graphics/opengl/ext/EXT_texture_storage.hx diff --git a/lime/graphics/opengl/ext/EXT_texture_type_2_10_10_10_REV.hx b/src/lime/graphics/opengl/ext/EXT_texture_type_2_10_10_10_REV.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_texture_type_2_10_10_10_REV.hx rename to src/lime/graphics/opengl/ext/EXT_texture_type_2_10_10_10_REV.hx diff --git a/lime/graphics/opengl/ext/EXT_unpack_subimage.hx b/src/lime/graphics/opengl/ext/EXT_unpack_subimage.hx similarity index 100% rename from lime/graphics/opengl/ext/EXT_unpack_subimage.hx rename to src/lime/graphics/opengl/ext/EXT_unpack_subimage.hx diff --git a/lime/graphics/opengl/ext/FJ_shader_binary_GCCSO.hx b/src/lime/graphics/opengl/ext/FJ_shader_binary_GCCSO.hx similarity index 100% rename from lime/graphics/opengl/ext/FJ_shader_binary_GCCSO.hx rename to src/lime/graphics/opengl/ext/FJ_shader_binary_GCCSO.hx diff --git a/lime/graphics/opengl/ext/IMG_multisampled_render_to_texture.hx b/src/lime/graphics/opengl/ext/IMG_multisampled_render_to_texture.hx similarity index 100% rename from lime/graphics/opengl/ext/IMG_multisampled_render_to_texture.hx rename to src/lime/graphics/opengl/ext/IMG_multisampled_render_to_texture.hx diff --git a/lime/graphics/opengl/ext/IMG_program_binary.hx b/src/lime/graphics/opengl/ext/IMG_program_binary.hx similarity index 100% rename from lime/graphics/opengl/ext/IMG_program_binary.hx rename to src/lime/graphics/opengl/ext/IMG_program_binary.hx diff --git a/lime/graphics/opengl/ext/IMG_read_format.hx b/src/lime/graphics/opengl/ext/IMG_read_format.hx similarity index 100% rename from lime/graphics/opengl/ext/IMG_read_format.hx rename to src/lime/graphics/opengl/ext/IMG_read_format.hx diff --git a/lime/graphics/opengl/ext/IMG_shader_binary.hx b/src/lime/graphics/opengl/ext/IMG_shader_binary.hx similarity index 100% rename from lime/graphics/opengl/ext/IMG_shader_binary.hx rename to src/lime/graphics/opengl/ext/IMG_shader_binary.hx diff --git a/lime/graphics/opengl/ext/IMG_texture_compression_pvrtc.hx b/src/lime/graphics/opengl/ext/IMG_texture_compression_pvrtc.hx similarity index 100% rename from lime/graphics/opengl/ext/IMG_texture_compression_pvrtc.hx rename to src/lime/graphics/opengl/ext/IMG_texture_compression_pvrtc.hx diff --git a/lime/graphics/opengl/ext/KHR_debug.hx b/src/lime/graphics/opengl/ext/KHR_debug.hx similarity index 100% rename from lime/graphics/opengl/ext/KHR_debug.hx rename to src/lime/graphics/opengl/ext/KHR_debug.hx diff --git a/lime/graphics/opengl/ext/KHR_texture_compression_astc_ldr.hx b/src/lime/graphics/opengl/ext/KHR_texture_compression_astc_ldr.hx similarity index 100% rename from lime/graphics/opengl/ext/KHR_texture_compression_astc_ldr.hx rename to src/lime/graphics/opengl/ext/KHR_texture_compression_astc_ldr.hx diff --git a/lime/graphics/opengl/ext/NV_coverage_sample.hx b/src/lime/graphics/opengl/ext/NV_coverage_sample.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_coverage_sample.hx rename to src/lime/graphics/opengl/ext/NV_coverage_sample.hx diff --git a/lime/graphics/opengl/ext/NV_depth_nonlinear.hx b/src/lime/graphics/opengl/ext/NV_depth_nonlinear.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_depth_nonlinear.hx rename to src/lime/graphics/opengl/ext/NV_depth_nonlinear.hx diff --git a/lime/graphics/opengl/ext/NV_draw_buffers.hx b/src/lime/graphics/opengl/ext/NV_draw_buffers.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_draw_buffers.hx rename to src/lime/graphics/opengl/ext/NV_draw_buffers.hx diff --git a/lime/graphics/opengl/ext/NV_fbo_color_attachments.hx b/src/lime/graphics/opengl/ext/NV_fbo_color_attachments.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_fbo_color_attachments.hx rename to src/lime/graphics/opengl/ext/NV_fbo_color_attachments.hx diff --git a/lime/graphics/opengl/ext/NV_fence.hx b/src/lime/graphics/opengl/ext/NV_fence.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_fence.hx rename to src/lime/graphics/opengl/ext/NV_fence.hx diff --git a/lime/graphics/opengl/ext/NV_read_buffer.hx b/src/lime/graphics/opengl/ext/NV_read_buffer.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_read_buffer.hx rename to src/lime/graphics/opengl/ext/NV_read_buffer.hx diff --git a/lime/graphics/opengl/ext/NV_read_buffer_front.hx b/src/lime/graphics/opengl/ext/NV_read_buffer_front.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_read_buffer_front.hx rename to src/lime/graphics/opengl/ext/NV_read_buffer_front.hx diff --git a/lime/graphics/opengl/ext/NV_read_depth.hx b/src/lime/graphics/opengl/ext/NV_read_depth.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_read_depth.hx rename to src/lime/graphics/opengl/ext/NV_read_depth.hx diff --git a/lime/graphics/opengl/ext/NV_read_depth_stencil.hx b/src/lime/graphics/opengl/ext/NV_read_depth_stencil.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_read_depth_stencil.hx rename to src/lime/graphics/opengl/ext/NV_read_depth_stencil.hx diff --git a/lime/graphics/opengl/ext/NV_read_stencil.hx b/src/lime/graphics/opengl/ext/NV_read_stencil.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_read_stencil.hx rename to src/lime/graphics/opengl/ext/NV_read_stencil.hx diff --git a/lime/graphics/opengl/ext/NV_texture_compression_s3tc_update.hx b/src/lime/graphics/opengl/ext/NV_texture_compression_s3tc_update.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_texture_compression_s3tc_update.hx rename to src/lime/graphics/opengl/ext/NV_texture_compression_s3tc_update.hx diff --git a/lime/graphics/opengl/ext/NV_texture_npot_2D_mipmap.hx b/src/lime/graphics/opengl/ext/NV_texture_npot_2D_mipmap.hx similarity index 100% rename from lime/graphics/opengl/ext/NV_texture_npot_2D_mipmap.hx rename to src/lime/graphics/opengl/ext/NV_texture_npot_2D_mipmap.hx diff --git a/lime/graphics/opengl/ext/OES_EGL_image.hx b/src/lime/graphics/opengl/ext/OES_EGL_image.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_EGL_image.hx rename to src/lime/graphics/opengl/ext/OES_EGL_image.hx diff --git a/lime/graphics/opengl/ext/OES_EGL_image_external.hx b/src/lime/graphics/opengl/ext/OES_EGL_image_external.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_EGL_image_external.hx rename to src/lime/graphics/opengl/ext/OES_EGL_image_external.hx diff --git a/lime/graphics/opengl/ext/OES_compressed_ETC1_RGB8_texture.hx b/src/lime/graphics/opengl/ext/OES_compressed_ETC1_RGB8_texture.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_compressed_ETC1_RGB8_texture.hx rename to src/lime/graphics/opengl/ext/OES_compressed_ETC1_RGB8_texture.hx diff --git a/lime/graphics/opengl/ext/OES_compressed_paletted_texture.hx b/src/lime/graphics/opengl/ext/OES_compressed_paletted_texture.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_compressed_paletted_texture.hx rename to src/lime/graphics/opengl/ext/OES_compressed_paletted_texture.hx diff --git a/lime/graphics/opengl/ext/OES_depth24.hx b/src/lime/graphics/opengl/ext/OES_depth24.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_depth24.hx rename to src/lime/graphics/opengl/ext/OES_depth24.hx diff --git a/lime/graphics/opengl/ext/OES_depth32.hx b/src/lime/graphics/opengl/ext/OES_depth32.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_depth32.hx rename to src/lime/graphics/opengl/ext/OES_depth32.hx diff --git a/lime/graphics/opengl/ext/OES_depth_texture.hx b/src/lime/graphics/opengl/ext/OES_depth_texture.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_depth_texture.hx rename to src/lime/graphics/opengl/ext/OES_depth_texture.hx diff --git a/lime/graphics/opengl/ext/OES_element_index_uint.hx b/src/lime/graphics/opengl/ext/OES_element_index_uint.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_element_index_uint.hx rename to src/lime/graphics/opengl/ext/OES_element_index_uint.hx diff --git a/lime/graphics/opengl/ext/OES_get_program_binary.hx b/src/lime/graphics/opengl/ext/OES_get_program_binary.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_get_program_binary.hx rename to src/lime/graphics/opengl/ext/OES_get_program_binary.hx diff --git a/lime/graphics/opengl/ext/OES_mapbuffer.hx b/src/lime/graphics/opengl/ext/OES_mapbuffer.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_mapbuffer.hx rename to src/lime/graphics/opengl/ext/OES_mapbuffer.hx diff --git a/lime/graphics/opengl/ext/OES_packed_depth_stencil.hx b/src/lime/graphics/opengl/ext/OES_packed_depth_stencil.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_packed_depth_stencil.hx rename to src/lime/graphics/opengl/ext/OES_packed_depth_stencil.hx diff --git a/lime/graphics/opengl/ext/OES_required_internalformat.hx b/src/lime/graphics/opengl/ext/OES_required_internalformat.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_required_internalformat.hx rename to src/lime/graphics/opengl/ext/OES_required_internalformat.hx diff --git a/lime/graphics/opengl/ext/OES_rgb8_rgba8.hx b/src/lime/graphics/opengl/ext/OES_rgb8_rgba8.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_rgb8_rgba8.hx rename to src/lime/graphics/opengl/ext/OES_rgb8_rgba8.hx diff --git a/lime/graphics/opengl/ext/OES_standard_derivatives.hx b/src/lime/graphics/opengl/ext/OES_standard_derivatives.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_standard_derivatives.hx rename to src/lime/graphics/opengl/ext/OES_standard_derivatives.hx diff --git a/lime/graphics/opengl/ext/OES_stencil1.hx b/src/lime/graphics/opengl/ext/OES_stencil1.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_stencil1.hx rename to src/lime/graphics/opengl/ext/OES_stencil1.hx diff --git a/lime/graphics/opengl/ext/OES_stencil4.hx b/src/lime/graphics/opengl/ext/OES_stencil4.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_stencil4.hx rename to src/lime/graphics/opengl/ext/OES_stencil4.hx diff --git a/lime/graphics/opengl/ext/OES_surfaceless_context.hx b/src/lime/graphics/opengl/ext/OES_surfaceless_context.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_surfaceless_context.hx rename to src/lime/graphics/opengl/ext/OES_surfaceless_context.hx diff --git a/lime/graphics/opengl/ext/OES_texture_3D.hx b/src/lime/graphics/opengl/ext/OES_texture_3D.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_texture_3D.hx rename to src/lime/graphics/opengl/ext/OES_texture_3D.hx diff --git a/lime/graphics/opengl/ext/OES_texture_float.hx b/src/lime/graphics/opengl/ext/OES_texture_float.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_texture_float.hx rename to src/lime/graphics/opengl/ext/OES_texture_float.hx diff --git a/lime/graphics/opengl/ext/OES_texture_float_linear.hx b/src/lime/graphics/opengl/ext/OES_texture_float_linear.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_texture_float_linear.hx rename to src/lime/graphics/opengl/ext/OES_texture_float_linear.hx diff --git a/lime/graphics/opengl/ext/OES_texture_half_float.hx b/src/lime/graphics/opengl/ext/OES_texture_half_float.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_texture_half_float.hx rename to src/lime/graphics/opengl/ext/OES_texture_half_float.hx diff --git a/lime/graphics/opengl/ext/OES_texture_half_float_linear.hx b/src/lime/graphics/opengl/ext/OES_texture_half_float_linear.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_texture_half_float_linear.hx rename to src/lime/graphics/opengl/ext/OES_texture_half_float_linear.hx diff --git a/lime/graphics/opengl/ext/OES_texture_npot.hx b/src/lime/graphics/opengl/ext/OES_texture_npot.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_texture_npot.hx rename to src/lime/graphics/opengl/ext/OES_texture_npot.hx diff --git a/lime/graphics/opengl/ext/OES_vertex_array_object.hx b/src/lime/graphics/opengl/ext/OES_vertex_array_object.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_vertex_array_object.hx rename to src/lime/graphics/opengl/ext/OES_vertex_array_object.hx diff --git a/lime/graphics/opengl/ext/OES_vertex_half_float.hx b/src/lime/graphics/opengl/ext/OES_vertex_half_float.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_vertex_half_float.hx rename to src/lime/graphics/opengl/ext/OES_vertex_half_float.hx diff --git a/lime/graphics/opengl/ext/OES_vertex_type_10_10_10_2.hx b/src/lime/graphics/opengl/ext/OES_vertex_type_10_10_10_2.hx similarity index 100% rename from lime/graphics/opengl/ext/OES_vertex_type_10_10_10_2.hx rename to src/lime/graphics/opengl/ext/OES_vertex_type_10_10_10_2.hx diff --git a/lime/graphics/opengl/ext/QCOM_alpha_test.hx b/src/lime/graphics/opengl/ext/QCOM_alpha_test.hx similarity index 100% rename from lime/graphics/opengl/ext/QCOM_alpha_test.hx rename to src/lime/graphics/opengl/ext/QCOM_alpha_test.hx diff --git a/lime/graphics/opengl/ext/QCOM_binning_control.hx b/src/lime/graphics/opengl/ext/QCOM_binning_control.hx similarity index 100% rename from lime/graphics/opengl/ext/QCOM_binning_control.hx rename to src/lime/graphics/opengl/ext/QCOM_binning_control.hx diff --git a/lime/graphics/opengl/ext/QCOM_driver_control.hx b/src/lime/graphics/opengl/ext/QCOM_driver_control.hx similarity index 100% rename from lime/graphics/opengl/ext/QCOM_driver_control.hx rename to src/lime/graphics/opengl/ext/QCOM_driver_control.hx diff --git a/lime/graphics/opengl/ext/QCOM_extended_get.hx b/src/lime/graphics/opengl/ext/QCOM_extended_get.hx similarity index 100% rename from lime/graphics/opengl/ext/QCOM_extended_get.hx rename to src/lime/graphics/opengl/ext/QCOM_extended_get.hx diff --git a/lime/graphics/opengl/ext/QCOM_extended_get2.hx b/src/lime/graphics/opengl/ext/QCOM_extended_get2.hx similarity index 100% rename from lime/graphics/opengl/ext/QCOM_extended_get2.hx rename to src/lime/graphics/opengl/ext/QCOM_extended_get2.hx diff --git a/lime/graphics/opengl/ext/QCOM_perfmon_global_mode.hx b/src/lime/graphics/opengl/ext/QCOM_perfmon_global_mode.hx similarity index 100% rename from lime/graphics/opengl/ext/QCOM_perfmon_global_mode.hx rename to src/lime/graphics/opengl/ext/QCOM_perfmon_global_mode.hx diff --git a/lime/graphics/opengl/ext/QCOM_tiled_rendering.hx b/src/lime/graphics/opengl/ext/QCOM_tiled_rendering.hx similarity index 100% rename from lime/graphics/opengl/ext/QCOM_tiled_rendering.hx rename to src/lime/graphics/opengl/ext/QCOM_tiled_rendering.hx diff --git a/lime/graphics/opengl/ext/QCOM_writeonly_rendering.hx b/src/lime/graphics/opengl/ext/QCOM_writeonly_rendering.hx similarity index 100% rename from lime/graphics/opengl/ext/QCOM_writeonly_rendering.hx rename to src/lime/graphics/opengl/ext/QCOM_writeonly_rendering.hx diff --git a/lime/graphics/opengl/ext/VIV_shader_binary.hx b/src/lime/graphics/opengl/ext/VIV_shader_binary.hx similarity index 100% rename from lime/graphics/opengl/ext/VIV_shader_binary.hx rename to src/lime/graphics/opengl/ext/VIV_shader_binary.hx diff --git a/lime/graphics/opengl/ext/WEBGL_color_buffer_float.hx b/src/lime/graphics/opengl/ext/WEBGL_color_buffer_float.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_color_buffer_float.hx rename to src/lime/graphics/opengl/ext/WEBGL_color_buffer_float.hx diff --git a/lime/graphics/opengl/ext/WEBGL_compressed_texture_atc.hx b/src/lime/graphics/opengl/ext/WEBGL_compressed_texture_atc.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_compressed_texture_atc.hx rename to src/lime/graphics/opengl/ext/WEBGL_compressed_texture_atc.hx diff --git a/lime/graphics/opengl/ext/WEBGL_compressed_texture_etc.hx b/src/lime/graphics/opengl/ext/WEBGL_compressed_texture_etc.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_compressed_texture_etc.hx rename to src/lime/graphics/opengl/ext/WEBGL_compressed_texture_etc.hx diff --git a/lime/graphics/opengl/ext/WEBGL_compressed_texture_etc1.hx b/src/lime/graphics/opengl/ext/WEBGL_compressed_texture_etc1.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_compressed_texture_etc1.hx rename to src/lime/graphics/opengl/ext/WEBGL_compressed_texture_etc1.hx diff --git a/lime/graphics/opengl/ext/WEBGL_compressed_texture_pvrtc.hx b/src/lime/graphics/opengl/ext/WEBGL_compressed_texture_pvrtc.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_compressed_texture_pvrtc.hx rename to src/lime/graphics/opengl/ext/WEBGL_compressed_texture_pvrtc.hx diff --git a/lime/graphics/opengl/ext/WEBGL_compressed_texture_s3tc.hx b/src/lime/graphics/opengl/ext/WEBGL_compressed_texture_s3tc.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_compressed_texture_s3tc.hx rename to src/lime/graphics/opengl/ext/WEBGL_compressed_texture_s3tc.hx diff --git a/lime/graphics/opengl/ext/WEBGL_debug_renderer_info.hx b/src/lime/graphics/opengl/ext/WEBGL_debug_renderer_info.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_debug_renderer_info.hx rename to src/lime/graphics/opengl/ext/WEBGL_debug_renderer_info.hx diff --git a/lime/graphics/opengl/ext/WEBGL_debug_shaders.hx b/src/lime/graphics/opengl/ext/WEBGL_debug_shaders.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_debug_shaders.hx rename to src/lime/graphics/opengl/ext/WEBGL_debug_shaders.hx diff --git a/lime/graphics/opengl/ext/WEBGL_depth_texture.hx b/src/lime/graphics/opengl/ext/WEBGL_depth_texture.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_depth_texture.hx rename to src/lime/graphics/opengl/ext/WEBGL_depth_texture.hx diff --git a/lime/graphics/opengl/ext/WEBGL_draw_buffers.hx b/src/lime/graphics/opengl/ext/WEBGL_draw_buffers.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_draw_buffers.hx rename to src/lime/graphics/opengl/ext/WEBGL_draw_buffers.hx diff --git a/lime/graphics/opengl/ext/WEBGL_lose_context.hx b/src/lime/graphics/opengl/ext/WEBGL_lose_context.hx similarity index 100% rename from lime/graphics/opengl/ext/WEBGL_lose_context.hx rename to src/lime/graphics/opengl/ext/WEBGL_lose_context.hx diff --git a/lime/math/color/ARGB.hx b/src/lime/math/ARGB.hx similarity index 99% rename from lime/math/color/ARGB.hx rename to src/lime/math/ARGB.hx index 90faa9894..01260d7af 100644 --- a/lime/math/color/ARGB.hx +++ b/src/lime/math/ARGB.hx @@ -1,4 +1,4 @@ -package lime.math.color; +package lime.math; import lime.graphics.PixelFormat; diff --git a/lime/math/color/BGRA.hx b/src/lime/math/BGRA.hx similarity index 99% rename from lime/math/color/BGRA.hx rename to src/lime/math/BGRA.hx index 17a30adbf..53ff5ddd0 100644 --- a/lime/math/color/BGRA.hx +++ b/src/lime/math/BGRA.hx @@ -1,4 +1,4 @@ -package lime.math.color; +package lime.math; import lime.graphics.PixelFormat; diff --git a/lime/math/ColorMatrix.hx b/src/lime/math/ColorMatrix.hx similarity index 100% rename from lime/math/ColorMatrix.hx rename to src/lime/math/ColorMatrix.hx diff --git a/lime/math/Matrix3.hx b/src/lime/math/Matrix3.hx similarity index 100% rename from lime/math/Matrix3.hx rename to src/lime/math/Matrix3.hx diff --git a/lime/math/Matrix4.hx b/src/lime/math/Matrix4.hx similarity index 100% rename from lime/math/Matrix4.hx rename to src/lime/math/Matrix4.hx diff --git a/lime/math/color/RGBA.hx b/src/lime/math/RGBA.hx similarity index 98% rename from lime/math/color/RGBA.hx rename to src/lime/math/RGBA.hx index dca23bbec..e5bca3e26 100644 --- a/lime/math/color/RGBA.hx +++ b/src/lime/math/RGBA.hx @@ -1,11 +1,11 @@ -package lime.math.color; +package lime.math; import lime.graphics.PixelFormat; import lime.utils.UInt32Array; import lime.utils.UInt8Array; -@:allow(lime.math.color) +@:allow(lime.math) abstract RGBA(#if flash Int #else UInt #end) from Int to Int from UInt to UInt { diff --git a/lime/math/Rectangle.hx b/src/lime/math/Rectangle.hx similarity index 100% rename from lime/math/Rectangle.hx rename to src/lime/math/Rectangle.hx diff --git a/lime/math/Vector2.hx b/src/lime/math/Vector2.hx similarity index 100% rename from lime/math/Vector2.hx rename to src/lime/math/Vector2.hx diff --git a/lime/math/Vector4.hx b/src/lime/math/Vector4.hx similarity index 100% rename from lime/math/Vector4.hx rename to src/lime/math/Vector4.hx diff --git a/lime/media/ALAudioContext.hx b/src/lime/media/ALAudioContext.hx similarity index 100% rename from lime/media/ALAudioContext.hx rename to src/lime/media/ALAudioContext.hx diff --git a/lime/media/ALCAudioContext.hx b/src/lime/media/ALCAudioContext.hx similarity index 100% rename from lime/media/ALCAudioContext.hx rename to src/lime/media/ALCAudioContext.hx diff --git a/lime/media/AudioBuffer.hx b/src/lime/media/AudioBuffer.hx similarity index 84% rename from lime/media/AudioBuffer.hx rename to src/lime/media/AudioBuffer.hx index bd1da9c90..29ae64e57 100644 --- a/lime/media/AudioBuffer.hx +++ b/src/lime/media/AudioBuffer.hx @@ -4,12 +4,12 @@ package lime.media; import haxe.crypto.Base64; import haxe.io.Bytes; import haxe.io.Path; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.app.Future; import lime.app.Promise; -import lime.media.codecs.vorbis.VorbisFile; import lime.media.openal.AL; import lime.media.openal.ALBuffer; +import lime.media.vorbis.VorbisFile; import lime.net.HTTPRequest; import lime.utils.Log; import lime.utils.UInt8Array; @@ -22,13 +22,10 @@ import js.html.Audio; #elseif flash import flash.media.Sound; import flash.net.URLRequest; -#elseif lime_console -import lime.media.fmod.FMODMode; -import lime.media.fmod.FMODSound; #end -@:access(lime._backend.native.NativeCFFI) -@:access(lime.Assets) +@:access(lime._internal.backend.native.NativeCFFI) +@:access(lime.utils.Assets) #if hl @:keep @@ -52,7 +49,6 @@ class AudioBuffer { @:noCompletion private var __srcAudio:#if (js && html5) Audio #else Dynamic #end; @:noCompletion private var __srcBuffer:#if lime_cffi ALBuffer #else Dynamic #end; @:noCompletion private var __srcCustom:Dynamic; - @:noCompletion private var __srcFMODSound:#if lime_console FMODSound #else Dynamic #end; @:noCompletion private var __srcHowl:#if howlerjs Howl #else Dynamic #end; @:noCompletion private var __srcSound:#if flash Sound #else Dynamic #end; @:noCompletion private var __srcVorbisFile:#if lime_vorbis VorbisFile #else Dynamic #end; @@ -83,28 +79,11 @@ class AudioBuffer { __srcHowl.unload (); - #elseif lime_console - if (channels > 0) { - - src.release (); - channels = 0; - - } #end } - #if lime_console - @:void - private static function finalize (a:AudioBuffer):Void { - - a.dispose (); - - } - #end - - public static function fromBase64 (base64String:String):AudioBuffer { if (base64String == null) return null; @@ -122,10 +101,6 @@ class AudioBuffer { audioBuffer.src = new Howl ({ src: [ base64String ], html5: true, preload: false }); return audioBuffer; - #elseif lime_console - - lime.Lib.notImplemented ("AudioBuffer.fromBase64"); - #elseif (lime_cffi && !macro) #if !cs @@ -176,10 +151,6 @@ class AudioBuffer { return audioBuffer; - #elseif lime_console - - lime.Lib.notImplemented ("AudioBuffer.fromBytes"); - #elseif (lime_cffi && !macro) #if !cs @@ -234,31 +205,6 @@ class AudioBuffer { audioBuffer.__srcSound = new Sound (new URLRequest (path)); return audioBuffer; - #elseif lime_console - - var mode = StringTools.endsWith(path, ".wav") ? FMODMode.LOOP_OFF : FMODMode.LOOP_NORMAL; - var sound:FMODSound = FMODSound.fromFile (path, mode); - - if (sound.valid) { - - // TODO(james4k): AudioBuffer needs sound info filled in - // TODO(james4k): probably move fmod.Sound creation to AudioSource, - // and keep AudioBuffer as raw data. not as efficient for typical - // use, but probably less efficient to do complex copy-on-read - // mechanisms and such. also, what do we do for compressed sounds? - // usually don't want to decompress large music files. I suppose we - // can specialize for those and not allow data access. - var audioBuffer = new AudioBuffer (); - audioBuffer.bitsPerSample = 0; - audioBuffer.channels = 1; - audioBuffer.data = null; - audioBuffer.sampleRate = 0; - audioBuffer.__srcFMODSound = sound; - cpp.vm.Gc.setFinalizer (audioBuffer, cpp.Function.fromStaticFunction (finalize)); - return audioBuffer; - - } - #elseif (lime_cffi && !macro) #if !cs @@ -523,10 +469,6 @@ class AudioBuffer { return __srcSound; - #elseif lime_console - - return __srcFMODSound; - #elseif lime_vorbis return __srcVorbisFile; @@ -556,10 +498,6 @@ class AudioBuffer { return __srcSound = value; - #elseif lime_console - - return __srcFMODSound = value; - #elseif lime_vorbis return __srcVorbisFile = value; diff --git a/lime/media/AudioContext.hx b/src/lime/media/AudioContext.hx similarity index 100% rename from lime/media/AudioContext.hx rename to src/lime/media/AudioContext.hx diff --git a/lime/media/AudioManager.hx b/src/lime/media/AudioManager.hx similarity index 94% rename from lime/media/AudioManager.hx rename to src/lime/media/AudioManager.hx index f8fdc7dc7..231057171 100644 --- a/lime/media/AudioManager.hx +++ b/src/lime/media/AudioManager.hx @@ -2,7 +2,7 @@ package lime.media; import haxe.Timer; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.media.openal.AL; import lime.media.openal.ALC; import lime.media.openal.ALContext; @@ -17,7 +17,7 @@ import js.Browser; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class AudioManager { @@ -49,11 +49,6 @@ class AudioManager { AudioManager.context = FLASH (new FlashAudioContext ()); - #elseif lime_console - - // TODO - AudioManager.context = CUSTOM (null); - #else AudioManager.context = OPENAL (new ALCAudioContext (), new ALAudioContext ()); diff --git a/lime/media/AudioSource.hx b/src/lime/media/AudioSource.hx similarity index 66% rename from lime/media/AudioSource.hx rename to src/lime/media/AudioSource.hx index 31fef5896..4dd782871 100644 --- a/lime/media/AudioSource.hx +++ b/src/lime/media/AudioSource.hx @@ -25,7 +25,7 @@ class AudioSource { public var offset:Int; public var position (get, set):Vector4; - @:noCompletion private var backend:AudioSourceBackend; + @:noCompletion private var __backend:AudioSourceBackend; public function new (buffer:AudioBuffer = null, offset:Int = 0, length:Null = null, loops:Int = 0) { @@ -33,7 +33,7 @@ class AudioSource { this.buffer = buffer; this.offset = offset; - backend = new AudioSourceBackend (this); + __backend = new AudioSourceBackend (this); if (length != null && length != 0) { @@ -54,35 +54,35 @@ class AudioSource { public function dispose ():Void { - backend.dispose (); + __backend.dispose (); } private function init ():Void { - backend.init (); + __backend.init (); } public function play ():Void { - backend.play (); + __backend.play (); } public function pause ():Void { - backend.pause (); + __backend.pause (); } public function stop ():Void { - backend.stop (); + __backend.stop (); } @@ -96,70 +96,70 @@ class AudioSource { private function get_currentTime ():Int { - return backend.getCurrentTime (); + return __backend.getCurrentTime (); } private function set_currentTime (value:Int):Int { - return backend.setCurrentTime (value); + return __backend.setCurrentTime (value); } private function get_gain ():Float { - return backend.getGain (); + return __backend.getGain (); } private function set_gain (value:Float):Float { - return backend.setGain (value); + return __backend.setGain (value); } private function get_length ():Int { - return backend.getLength (); + return __backend.getLength (); } private function set_length (value:Int):Int { - return backend.setLength (value); + return __backend.setLength (value); } private function get_loops ():Int { - return backend.getLoops (); + return __backend.getLoops (); } private function set_loops (value:Int):Int { - return backend.setLoops (value); + return __backend.setLoops (value); } private function get_position ():Vector4 { - return backend.getPosition (); + return __backend.getPosition (); } private function set_position (value:Vector4):Vector4 { - return backend.setPosition (value); + return __backend.setPosition (value); } @@ -168,9 +168,9 @@ class AudioSource { #if flash -@:noCompletion private typedef AudioSourceBackend = lime._backend.flash.FlashAudioSource; +@:noCompletion private typedef AudioSourceBackend = lime._internal.backend.flash.FlashAudioSource; #elseif (js && html5) -@:noCompletion private typedef AudioSourceBackend = lime._backend.html5.HTML5AudioSource; +@:noCompletion private typedef AudioSourceBackend = lime._internal.backend.html5.HTML5AudioSource; #else -@:noCompletion private typedef AudioSourceBackend = lime._backend.native.NativeAudioSource; +@:noCompletion private typedef AudioSourceBackend = lime._internal.backend.native.NativeAudioSource; #end \ No newline at end of file diff --git a/lime/media/FlashAudioContext.hx b/src/lime/media/FlashAudioContext.hx similarity index 100% rename from lime/media/FlashAudioContext.hx rename to src/lime/media/FlashAudioContext.hx diff --git a/lime/media/HTML5AudioContext.hx b/src/lime/media/HTML5AudioContext.hx similarity index 100% rename from lime/media/HTML5AudioContext.hx rename to src/lime/media/HTML5AudioContext.hx diff --git a/lime/media/WebAudioContext.hx b/src/lime/media/WebAudioContext.hx similarity index 100% rename from lime/media/WebAudioContext.hx rename to src/lime/media/WebAudioContext.hx diff --git a/lime/media/howlerjs/Howl.hx b/src/lime/media/howlerjs/Howl.hx similarity index 100% rename from lime/media/howlerjs/Howl.hx rename to src/lime/media/howlerjs/Howl.hx diff --git a/lime/media/howlerjs/Howler.hx b/src/lime/media/howlerjs/Howler.hx similarity index 100% rename from lime/media/howlerjs/Howler.hx rename to src/lime/media/howlerjs/Howler.hx diff --git a/lime/media/openal/AL.hx b/src/lime/media/openal/AL.hx similarity index 99% rename from lime/media/openal/AL.hx rename to src/lime/media/openal/AL.hx index bd9c0be25..90ad81dec 100644 --- a/lime/media/openal/AL.hx +++ b/src/lime/media/openal/AL.hx @@ -1,7 +1,7 @@ package lime.media.openal; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.system.CFFIPointer; import lime.utils.ArrayBufferView; @@ -10,7 +10,7 @@ import lime.utils.ArrayBufferView; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class AL { diff --git a/lime/media/openal/ALAuxiliaryEffectSlot.hx b/src/lime/media/openal/ALAuxiliaryEffectSlot.hx similarity index 100% rename from lime/media/openal/ALAuxiliaryEffectSlot.hx rename to src/lime/media/openal/ALAuxiliaryEffectSlot.hx diff --git a/lime/media/openal/ALBuffer.hx b/src/lime/media/openal/ALBuffer.hx similarity index 100% rename from lime/media/openal/ALBuffer.hx rename to src/lime/media/openal/ALBuffer.hx diff --git a/lime/media/openal/ALC.hx b/src/lime/media/openal/ALC.hx similarity index 98% rename from lime/media/openal/ALC.hx rename to src/lime/media/openal/ALC.hx index 8a757b6f1..924e4eb1b 100644 --- a/lime/media/openal/ALC.hx +++ b/src/lime/media/openal/ALC.hx @@ -1,7 +1,7 @@ package lime.media.openal; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.system.CFFIPointer; #if !lime_debug @@ -9,7 +9,7 @@ import lime.system.CFFIPointer; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class ALC { diff --git a/lime/media/openal/ALContext.hx b/src/lime/media/openal/ALContext.hx similarity index 100% rename from lime/media/openal/ALContext.hx rename to src/lime/media/openal/ALContext.hx diff --git a/lime/media/openal/ALDevice.hx b/src/lime/media/openal/ALDevice.hx similarity index 100% rename from lime/media/openal/ALDevice.hx rename to src/lime/media/openal/ALDevice.hx diff --git a/lime/media/openal/ALEffect.hx b/src/lime/media/openal/ALEffect.hx similarity index 100% rename from lime/media/openal/ALEffect.hx rename to src/lime/media/openal/ALEffect.hx diff --git a/lime/media/openal/ALFilter.hx b/src/lime/media/openal/ALFilter.hx similarity index 100% rename from lime/media/openal/ALFilter.hx rename to src/lime/media/openal/ALFilter.hx diff --git a/lime/media/openal/ALSource.hx b/src/lime/media/openal/ALSource.hx similarity index 100% rename from lime/media/openal/ALSource.hx rename to src/lime/media/openal/ALSource.hx diff --git a/lime/media/codecs/vorbis/Vorbis.hx b/src/lime/media/vorbis/Vorbis.hx similarity index 94% rename from lime/media/codecs/vorbis/Vorbis.hx rename to src/lime/media/vorbis/Vorbis.hx index f7b0b4944..34a86ec86 100644 --- a/lime/media/codecs/vorbis/Vorbis.hx +++ b/src/lime/media/vorbis/Vorbis.hx @@ -1,4 +1,4 @@ -package lime.media.codecs.vorbis; +package lime.media.vorbis; class Vorbis { diff --git a/lime/media/codecs/vorbis/VorbisComment.hx b/src/lime/media/vorbis/VorbisComment.hx similarity index 80% rename from lime/media/codecs/vorbis/VorbisComment.hx rename to src/lime/media/vorbis/VorbisComment.hx index 8d2bb65f4..7dc2e26d0 100644 --- a/lime/media/codecs/vorbis/VorbisComment.hx +++ b/src/lime/media/vorbis/VorbisComment.hx @@ -1,4 +1,4 @@ -package lime.media.codecs.vorbis; +package lime.media.vorbis; class VorbisComment { diff --git a/lime/media/codecs/vorbis/VorbisFile.hx b/src/lime/media/vorbis/VorbisFile.hx similarity index 98% rename from lime/media/codecs/vorbis/VorbisFile.hx rename to src/lime/media/vorbis/VorbisFile.hx index cb7c9942a..9985e3df9 100644 --- a/lime/media/codecs/vorbis/VorbisFile.hx +++ b/src/lime/media/vorbis/VorbisFile.hx @@ -1,11 +1,11 @@ -package lime.media.codecs.vorbis; +package lime.media.vorbis; import haxe.Int64; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class VorbisFile { diff --git a/lime/media/codecs/vorbis/VorbisInfo.hx b/src/lime/media/vorbis/VorbisInfo.hx similarity index 88% rename from lime/media/codecs/vorbis/VorbisInfo.hx rename to src/lime/media/vorbis/VorbisInfo.hx index 66c591686..89178bb79 100644 --- a/lime/media/codecs/vorbis/VorbisInfo.hx +++ b/src/lime/media/vorbis/VorbisInfo.hx @@ -1,4 +1,4 @@ -package lime.media.codecs.vorbis; +package lime.media.vorbis; class VorbisInfo { diff --git a/lime/net/HTTPRequest.hx b/src/lime/net/HTTPRequest.hx similarity index 86% rename from lime/net/HTTPRequest.hx rename to src/lime/net/HTTPRequest.hx index c9cdba1d7..7148b6f1a 100644 --- a/lime/net/HTTPRequest.hx +++ b/src/lime/net/HTTPRequest.hx @@ -20,7 +20,7 @@ class HTTPRequest { #else #if !macro -@:genericBuild(lime._macros.HTTPRequestMacro.build()) +@:genericBuild(lime._internal.macros.HTTPRequestMacro.build()) #end class HTTPRequest extends AbstractHTTPRequest {} @@ -50,7 +50,7 @@ private class AbstractHTTPRequest implements _IHTTPRequest { public var withCredentials:Bool; #if !display - private var backend:HTTPRequestBackend; + private var __backend:HTTPRequestBackend; #end @@ -68,8 +68,8 @@ private class AbstractHTTPRequest implements _IHTTPRequest { withCredentials = false; #if !display - backend = new HTTPRequestBackend (); - backend.init (this); + __backend = new HTTPRequestBackend (); + __backend.init (this); #end } @@ -78,7 +78,7 @@ private class AbstractHTTPRequest implements _IHTTPRequest { public function cancel ():Void { #if !display - backend.cancel (); + __backend.cancel (); #end } @@ -128,7 +128,7 @@ class _HTTPRequest_Bytes extends AbstractHTTPRequest { } var promise = new Promise (); - var future = backend.loadData (this.uri); + var future = __backend.loadData (this.uri); future.onProgress (promise.progress); future.onError (promise.error); @@ -172,7 +172,7 @@ class _HTTPRequest_String extends AbstractHTTPRequest { } var promise = new Promise (); - var future = backend.loadText (this.uri); + var future = __backend.loadText (this.uri); future.onProgress (promise.progress); future.onError (promise.error); @@ -215,10 +215,10 @@ interface _IHTTPRequest { #if flash -private typedef HTTPRequestBackend = lime._backend.flash.FlashHTTPRequest; +private typedef HTTPRequestBackend = lime._internal.backend.flash.FlashHTTPRequest; #elseif (js && html5) -private typedef HTTPRequestBackend = lime._backend.html5.HTML5HTTPRequest; +private typedef HTTPRequestBackend = lime._internal.backend.html5.HTML5HTTPRequest; #else -private typedef HTTPRequestBackend = lime._backend.native.NativeHTTPRequest; +private typedef HTTPRequestBackend = lime._internal.backend.native.NativeHTTPRequest; #end #end diff --git a/lime/net/HTTPRequestHeader.hx b/src/lime/net/HTTPRequestHeader.hx similarity index 100% rename from lime/net/HTTPRequestHeader.hx rename to src/lime/net/HTTPRequestHeader.hx diff --git a/lime/net/HTTPRequestMethod.hx b/src/lime/net/HTTPRequestMethod.hx similarity index 100% rename from lime/net/HTTPRequestMethod.hx rename to src/lime/net/HTTPRequestMethod.hx diff --git a/lime/net/URIParser.hx b/src/lime/net/URIParser.hx similarity index 100% rename from lime/net/URIParser.hx rename to src/lime/net/URIParser.hx diff --git a/lime/net/curl/CURL.hx b/src/lime/net/curl/CURL.hx similarity index 96% rename from lime/net/curl/CURL.hx rename to src/lime/net/curl/CURL.hx index 797db06df..c64da3d5a 100644 --- a/lime/net/curl/CURL.hx +++ b/src/lime/net/curl/CURL.hx @@ -2,7 +2,7 @@ package lime.net.curl; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.system.CFFIPointer; #if !lime_debug @@ -10,7 +10,7 @@ import lime.system.CFFIPointer; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class CURL { @@ -23,9 +23,9 @@ class CURL { public static inline var GLOBAL_DEFAULT:Int = GLOBAL_ALL; public static inline var GLOBAL_ACK_EINTR:Int = 1 << 2; - private var handle:CFFIPointer; - private var headerBytes:Bytes; - private var writeBytes:Bytes; + @:noCompletion private var handle:CFFIPointer; + @:noCompletion private var headerBytes:Bytes; + @:noCompletion private var writeBytes:Bytes; public function new (handle:CFFIPointer = null) { diff --git a/lime/net/curl/CURLCode.hx b/src/lime/net/curl/CURLCode.hx similarity index 100% rename from lime/net/curl/CURLCode.hx rename to src/lime/net/curl/CURLCode.hx diff --git a/lime/net/curl/CURLInfo.hx b/src/lime/net/curl/CURLInfo.hx similarity index 100% rename from lime/net/curl/CURLInfo.hx rename to src/lime/net/curl/CURLInfo.hx diff --git a/lime/net/curl/CURLMulti.hx b/src/lime/net/curl/CURLMulti.hx similarity index 91% rename from lime/net/curl/CURLMulti.hx rename to src/lime/net/curl/CURLMulti.hx index b7edfff9e..11fadf05d 100644 --- a/lime/net/curl/CURLMulti.hx +++ b/src/lime/net/curl/CURLMulti.hx @@ -1,7 +1,7 @@ package lime.net.curl; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.system.CFFIPointer; #if !lime_debug @@ -9,7 +9,7 @@ import lime.system.CFFIPointer; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.net.curl.CURL) @:access(lime.net.curl.CURLMultiMessage) @@ -19,10 +19,10 @@ class CURLMulti { public var runningHandles (get, never):Int; - private var handle:CFFIPointer; + @:noCompletion private var handle:CFFIPointer; #if hl - private var infoObject:CURLMultiMessage; + @:noCompletion private var infoObject:CURLMultiMessage; #end diff --git a/lime/net/curl/CURLMultiCode.hx b/src/lime/net/curl/CURLMultiCode.hx similarity index 100% rename from lime/net/curl/CURLMultiCode.hx rename to src/lime/net/curl/CURLMultiCode.hx diff --git a/lime/net/curl/CURLMultiMessage.hx b/src/lime/net/curl/CURLMultiMessage.hx similarity index 100% rename from lime/net/curl/CURLMultiMessage.hx rename to src/lime/net/curl/CURLMultiMessage.hx diff --git a/lime/net/curl/CURLMultiOption.hx b/src/lime/net/curl/CURLMultiOption.hx similarity index 100% rename from lime/net/curl/CURLMultiOption.hx rename to src/lime/net/curl/CURLMultiOption.hx diff --git a/lime/net/curl/CURLOption.hx b/src/lime/net/curl/CURLOption.hx similarity index 100% rename from lime/net/curl/CURLOption.hx rename to src/lime/net/curl/CURLOption.hx diff --git a/lime/net/curl/CURLVersion.hx b/src/lime/net/curl/CURLVersion.hx similarity index 100% rename from lime/net/curl/CURLVersion.hx rename to src/lime/net/curl/CURLVersion.hx diff --git a/lime/net/oauth/OAuthClient.hx b/src/lime/net/oauth/OAuthClient.hx similarity index 96% rename from lime/net/oauth/OAuthClient.hx rename to src/lime/net/oauth/OAuthClient.hx index ace467d3c..57c99c583 100644 --- a/lime/net/oauth/OAuthClient.hx +++ b/src/lime/net/oauth/OAuthClient.hx @@ -1,48 +1,48 @@ -package lime.net.oauth; - - -import haxe.crypto.Sha1; -//import lime.net.URLRequestMethod; -//import lime.net.URLRequest; - - -class OAuthClient { - - public var version:OAuthVersion; - public var consumer:OAuthConsumer; - - - public function new (version:OAuthVersion, consumer:OAuthConsumer) { - - this.version = version; - this.consumer = consumer; - - } - - - //public function createRequest (method:URLRequestMethod, url:String):URLRequest { - // - //var parameters = new Map(); - // - //parameters.set("oauth_version", Std.string(version)); - //parameters.set("oauth_signature_method", Std.string(OAuthSignatureMethod.HMAC_SHA1)); - //parameters.set("oauth_nonce", generateNonce ()); - //parameters.set("oauth_timestamp", Std.string(Std.int(Date.now ().getTime () / 1000))); - //parameters.set("oauth_consumer_key", consumer.key); - // - //var oauth = new OAuthRequest (version, method, url, parameters); - //if(version == V1) oauth.sign (consumer, OAuthSignatureMethod.HMAC_SHA1); - //oauth.request.requestHeaders.push(oauth.getHeader()); - //return oauth.request; - // - //} - - - public function generateNonce ():String { - - return Sha1.encode(Std.string(Math.random())); - - } - - +package lime.net.oauth; + + +import haxe.crypto.Sha1; +//import lime.net.URLRequestMethod; +//import lime.net.URLRequest; + + +class OAuthClient { + + public var version:OAuthVersion; + public var consumer:OAuthConsumer; + + + public function new (version:OAuthVersion, consumer:OAuthConsumer) { + + this.version = version; + this.consumer = consumer; + + } + + + //public function createRequest (method:URLRequestMethod, url:String):URLRequest { + // + //var parameters = new Map(); + // + //parameters.set("oauth_version", Std.string(version)); + //parameters.set("oauth_signature_method", Std.string(OAuthSignatureMethod.HMAC_SHA1)); + //parameters.set("oauth_nonce", generateNonce ()); + //parameters.set("oauth_timestamp", Std.string(Std.int(Date.now ().getTime () / 1000))); + //parameters.set("oauth_consumer_key", consumer.key); + // + //var oauth = new OAuthRequest (version, method, url, parameters); + //if(version == V1) oauth.sign (consumer, OAuthSignatureMethod.HMAC_SHA1); + //oauth.request.requestHeaders.push(oauth.getHeader()); + //return oauth.request; + // + //} + + + public function generateNonce ():String { + + return Sha1.encode(Std.string(Math.random())); + + } + + } \ No newline at end of file diff --git a/lime/net/oauth/OAuthConsumer.hx b/src/lime/net/oauth/OAuthConsumer.hx similarity index 91% rename from lime/net/oauth/OAuthConsumer.hx rename to src/lime/net/oauth/OAuthConsumer.hx index 8300c42a1..c138507a5 100644 --- a/lime/net/oauth/OAuthConsumer.hx +++ b/src/lime/net/oauth/OAuthConsumer.hx @@ -1,19 +1,19 @@ -package lime.net.oauth; - - -class OAuthConsumer { - - - public var key:String; - public var secret:String; - - - public function new (key:String, secret:String) { - - this.key = key; - this.secret = secret; - - } - - +package lime.net.oauth; + + +class OAuthConsumer { + + + public var key:String; + public var secret:String; + + + public function new (key:String, secret:String) { + + this.key = key; + this.secret = secret; + + } + + } \ No newline at end of file diff --git a/lime/net/oauth/OAuthRequest.hx b/src/lime/net/oauth/OAuthRequest.hx similarity index 95% rename from lime/net/oauth/OAuthRequest.hx rename to src/lime/net/oauth/OAuthRequest.hx index b05bad06a..e467f029a 100644 --- a/lime/net/oauth/OAuthRequest.hx +++ b/src/lime/net/oauth/OAuthRequest.hx @@ -1,124 +1,124 @@ -package lime.net.oauth; - - -//import haxe.crypto.Base64; -//import haxe.crypto.Hmac; -//import haxe.io.Bytes; -//import lime.net.URLRequestMethod; -//import lime.net.URLRequestHeader; -//import lime.net.URLRequest; -//import lime.net.URIParser; -//import lime.net.oauth.OAuthToken; -// -//using StringTools; -// -//class OAuthRequest { - // - //public var version:OAuthVersion = V1; - //public var parameters:Map; - //public var request:URLRequest; -// - //private var uri:URIParser; - // - // - //public function new (version:OAuthVersion = V1, method:URLRequestMethod, url:String, parameters:Map) { - // - //this.version = version; - //request = new URLRequest(); - //request.url = url; - //request.method = cast method; - //this.parameters = parameters; -// - //uri = new URIParser(url); - // - //} - // - // - //public function getHeader ():URLRequestHeader { - // - //var result = ""; -// - //switch(version) { -// - //case V1: - //result = "OAuth "; -// - //var keys = parameters.keys(); - //for(key in keys) { - //result += '${key.urlEncode()}="${parameters.get(key).urlEncode()}"'; - //if(keys.hasNext()) { - //result += ", "; - //} - //} -// - //case V2: - //// TODO - //} -// - //return new URLRequestHeader("Authorization", result); - // - //} - // - ///** - //* Signs the petition, only for OAuth 1.0 - //*/ - //public function sign (consumer:OAuthConsumer, ?accessToken:OAuth1AccessToken, ?signatureMethod:OAuthSignatureMethod = HMAC_SHA1):Void { - // - //var key = consumer.secret.urlEncode() + "&"; - //if(accessToken != null) { - //key += accessToken.secret == null ? "" : accessToken.secret.urlEncode(); - //} - //var message = request.method + "&" + normalizeURI() + "&" + normalizeParameters(); - //var hash = new Hmac (SHA1); - //var bytes = hash.make (Bytes.ofString (key), Bytes.ofString (message)); -// - //parameters.set("oauth_signature", Base64.encode (bytes)); - //} - // - //// SIGNING FUNCTIONS -// - ///** - //* Prepares the message parameters for the signing process - //*/ - //private function normalizeParameters():String { -// - //var result = new Array(); -// - //if(uri.queryArray != null) { - //result = result.concat(uri.queryArray); - //} - //// TODO add data if POST -// - //for(key in parameters.keys()) { -// - //if(key == "realm") continue; - //result.push( { k: key, v: parameters.get(key) } ); -// - //} -// - //result.sort(OAuthSort); -// - //return result.map(function(p:KVPair) return p.k.urlEncode()+"="+p.v.urlEncode()).join("&").urlEncode(); - //} -// - //private function normalizeURI():String { - //var scheme = uri.protocol == null ? "https" : uri.protocol.toLowerCase(); - //var authority = uri.authority.toLowerCase(); - //var port = (scheme == "https" || scheme == "http") ? null : uri.port; - //var path = uri.path; - //var result = (scheme + "://" + authority + (port == null ? "" : ":" + port) + path); - //return result.urlEncode(); - //} -// - ///** - //* Parameters are sorted by name, using lexicographical byte value ordering. - //* If two or more parameters share the same name, they are sorted by their value. - //*/ - //private function OAuthSort(a:KVPair, b:KVPair) { - //return if(a.k < b.k) -1 else if (a.k > b.k) 1 else if (a.v < b.v) -1 else 1; - //} - // -//} -// -// +package lime.net.oauth; + + +//import haxe.crypto.Base64; +//import haxe.crypto.Hmac; +//import haxe.io.Bytes; +//import lime.net.URLRequestMethod; +//import lime.net.URLRequestHeader; +//import lime.net.URLRequest; +//import lime.net.URIParser; +//import lime.net.oauth.OAuthToken; +// +//using StringTools; +// +//class OAuthRequest { + // + //public var version:OAuthVersion = V1; + //public var parameters:Map; + //public var request:URLRequest; +// + //private var uri:URIParser; + // + // + //public function new (version:OAuthVersion = V1, method:URLRequestMethod, url:String, parameters:Map) { + // + //this.version = version; + //request = new URLRequest(); + //request.url = url; + //request.method = cast method; + //this.parameters = parameters; +// + //uri = new URIParser(url); + // + //} + // + // + //public function getHeader ():URLRequestHeader { + // + //var result = ""; +// + //switch(version) { +// + //case V1: + //result = "OAuth "; +// + //var keys = parameters.keys(); + //for(key in keys) { + //result += '${key.urlEncode()}="${parameters.get(key).urlEncode()}"'; + //if(keys.hasNext()) { + //result += ", "; + //} + //} +// + //case V2: + //// TODO + //} +// + //return new URLRequestHeader("Authorization", result); + // + //} + // + ///** + //* Signs the petition, only for OAuth 1.0 + //*/ + //public function sign (consumer:OAuthConsumer, ?accessToken:OAuth1AccessToken, ?signatureMethod:OAuthSignatureMethod = HMAC_SHA1):Void { + // + //var key = consumer.secret.urlEncode() + "&"; + //if(accessToken != null) { + //key += accessToken.secret == null ? "" : accessToken.secret.urlEncode(); + //} + //var message = request.method + "&" + normalizeURI() + "&" + normalizeParameters(); + //var hash = new Hmac (SHA1); + //var bytes = hash.make (Bytes.ofString (key), Bytes.ofString (message)); +// + //parameters.set("oauth_signature", Base64.encode (bytes)); + //} + // + //// SIGNING FUNCTIONS +// + ///** + //* Prepares the message parameters for the signing process + //*/ + //private function normalizeParameters():String { +// + //var result = new Array(); +// + //if(uri.queryArray != null) { + //result = result.concat(uri.queryArray); + //} + //// TODO add data if POST +// + //for(key in parameters.keys()) { +// + //if(key == "realm") continue; + //result.push( { k: key, v: parameters.get(key) } ); +// + //} +// + //result.sort(OAuthSort); +// + //return result.map(function(p:KVPair) return p.k.urlEncode()+"="+p.v.urlEncode()).join("&").urlEncode(); + //} +// + //private function normalizeURI():String { + //var scheme = uri.protocol == null ? "https" : uri.protocol.toLowerCase(); + //var authority = uri.authority.toLowerCase(); + //var port = (scheme == "https" || scheme == "http") ? null : uri.port; + //var path = uri.path; + //var result = (scheme + "://" + authority + (port == null ? "" : ":" + port) + path); + //return result.urlEncode(); + //} +// + ///** + //* Parameters are sorted by name, using lexicographical byte value ordering. + //* If two or more parameters share the same name, they are sorted by their value. + //*/ + //private function OAuthSort(a:KVPair, b:KVPair) { + //return if(a.k < b.k) -1 else if (a.k > b.k) 1 else if (a.v < b.v) -1 else 1; + //} + // +//} +// +// //typedef KVPair = {k:String, v:String}; \ No newline at end of file diff --git a/lime/net/oauth/OAuthSignatureMethod.hx b/src/lime/net/oauth/OAuthSignatureMethod.hx similarity index 94% rename from lime/net/oauth/OAuthSignatureMethod.hx rename to src/lime/net/oauth/OAuthSignatureMethod.hx index 921fece11..7d57eb0f2 100644 --- a/lime/net/oauth/OAuthSignatureMethod.hx +++ b/src/lime/net/oauth/OAuthSignatureMethod.hx @@ -1,9 +1,9 @@ -package lime.net.oauth; - - -@:enum abstract OAuthSignatureMethod(String) { - - //var PLAINTEXT = "PLAINTEXT"; - var HMAC_SHA1 = "HMAC-SHA1"; - //var RSA_SHA1 = "RSA-SHA1"; +package lime.net.oauth; + + +@:enum abstract OAuthSignatureMethod(String) { + + //var PLAINTEXT = "PLAINTEXT"; + var HMAC_SHA1 = "HMAC-SHA1"; + //var RSA_SHA1 = "RSA-SHA1"; } \ No newline at end of file diff --git a/lime/net/oauth/OAuthToken.hx b/src/lime/net/oauth/OAuthToken.hx similarity index 100% rename from lime/net/oauth/OAuthToken.hx rename to src/lime/net/oauth/OAuthToken.hx diff --git a/lime/net/oauth/OAuthVersion.hx b/src/lime/net/oauth/OAuthVersion.hx similarity index 91% rename from lime/net/oauth/OAuthVersion.hx rename to src/lime/net/oauth/OAuthVersion.hx index dc11c3167..f14364e77 100644 --- a/lime/net/oauth/OAuthVersion.hx +++ b/src/lime/net/oauth/OAuthVersion.hx @@ -1,9 +1,9 @@ -package lime.net.oauth; - - -@:enum abstract OAuthVersion(String) { - - var V1 = "1.0"; - var V2 = "2.0"; - +package lime.net.oauth; + + +@:enum abstract OAuthVersion(String) { + + var V1 = "1.0"; + var V2 = "2.0"; + } \ No newline at end of file diff --git a/lime/system/BackgroundWorker.hx b/src/lime/system/BackgroundWorker.hx similarity index 94% rename from lime/system/BackgroundWorker.hx rename to src/lime/system/BackgroundWorker.hx index 54f5faed7..da6a94914 100644 --- a/lime/system/BackgroundWorker.hx +++ b/src/lime/system/BackgroundWorker.hx @@ -31,11 +31,11 @@ class BackgroundWorker { public var onError = new EventVoid> (); public var onProgress = new EventVoid> (); - private var __runMessage:Dynamic; + @:noCompletion private var __runMessage:Dynamic; #if (cpp || neko) - private var __messageQueue:Deque; - private var __workerThread:Thread; + @:noCompletion private var __messageQueue:Deque; + @:noCompletion private var __workerThread:Thread; #end diff --git a/lime/system/CFFI.hx b/src/lime/system/CFFI.hx similarity index 99% rename from lime/system/CFFI.hx rename to src/lime/system/CFFI.hx index 71e6180b1..5669904df 100644 --- a/lime/system/CFFI.hx +++ b/src/lime/system/CFFI.hx @@ -1,7 +1,7 @@ package lime.system; -import lime._macros.CFFIMacro; +import lime._internal.macros.CFFIMacro; #if (sys && !macro) import sys.io.Process; diff --git a/lime/system/CFFIPointer.hx b/src/lime/system/CFFIPointer.hx similarity index 95% rename from lime/system/CFFIPointer.hx rename to src/lime/system/CFFIPointer.hx index 4d69e68af..b5cd0876f 100644 --- a/lime/system/CFFIPointer.hx +++ b/src/lime/system/CFFIPointer.hx @@ -1,9 +1,9 @@ package lime.system; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) abstract CFFIPointer(Dynamic) from Dynamic to Dynamic { diff --git a/lime/system/Clipboard.hx b/src/lime/system/Clipboard.hx similarity index 88% rename from lime/system/Clipboard.hx rename to src/lime/system/Clipboard.hx index 51eae48ad..601e1cd66 100644 --- a/lime/system/Clipboard.hx +++ b/src/lime/system/Clipboard.hx @@ -1,14 +1,14 @@ package lime.system; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.app.Application; import lime.app.Event; #if flash import flash.desktop.Clipboard in FlashClipboard; #elseif (js && html5) -import lime._backend.html5.HTML5Window; +import lime._internal.backend.html5.HTML5Window; #end #if !lime_debug @@ -16,7 +16,7 @@ import lime._backend.html5.HTML5Window; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.ui.Window) @@ -89,7 +89,7 @@ class Clipboard { var window = Application.current.window; if (window != null) { - window.backend.setClipboard (value); + window.__backend.setClipboard (value); } #end diff --git a/lime/system/Display.hx b/src/lime/system/Display.hx similarity index 100% rename from lime/system/Display.hx rename to src/lime/system/Display.hx diff --git a/lime/system/DisplayMode.hx b/src/lime/system/DisplayMode.hx similarity index 100% rename from lime/system/DisplayMode.hx rename to src/lime/system/DisplayMode.hx diff --git a/lime/system/Endian.hx b/src/lime/system/Endian.hx similarity index 100% rename from lime/system/Endian.hx rename to src/lime/system/Endian.hx diff --git a/lime/system/FileWatcher.hx b/src/lime/system/FileWatcher.hx similarity index 82% rename from lime/system/FileWatcher.hx rename to src/lime/system/FileWatcher.hx index 82eded9de..c7fcf8294 100644 --- a/lime/system/FileWatcher.hx +++ b/src/lime/system/FileWatcher.hx @@ -1,7 +1,7 @@ package lime.system; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.app.Application; import lime.app.Event; @@ -10,7 +10,7 @@ import lime.app.Event; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class FileWatcher { @@ -21,16 +21,16 @@ class FileWatcher { public var onModify = new EventVoid> (); public var onMove = new EventString->Void> (); - private var handle:CFFIPointer; - private var hasUpdate:Bool; - private var ids:Map; + @:noCompletion private var handle:CFFIPointer; + @:noCompletion private var __hasUpdate:Bool; + @:noCompletion private var __ids:Map; public function new () { #if (lime_cffi && !macro) handle = NativeCFFI.lime_file_watcher_create (this_onChange); - ids = new Map (); + __ids = new Map (); #end } @@ -39,10 +39,10 @@ class FileWatcher { public function addDirectory (path:String, recursive:Bool = true):Bool { #if (lime_cffi && !macro) - if (!hasUpdate) { + if (!__hasUpdate) { Application.current.onUpdate.add (this_onUpdate); - hasUpdate = true; + __hasUpdate = true; } @@ -50,7 +50,7 @@ class FileWatcher { if (id >= 0) { - ids[path] = id; + __ids[path] = id; return true; } else { @@ -98,15 +98,15 @@ class FileWatcher { public function removeDirectory (path:String):Bool { #if (lime_cffi && !macro) - if (ids.exists (path)) { + if (__ids.exists (path)) { - NativeCFFI.lime_file_watcher_remove_directory (handle, ids[path]); - ids.remove (path); + NativeCFFI.lime_file_watcher_remove_directory (handle, __ids[path]); + __ids.remove (path); - if (!ids.keys ().hasNext ()) { + if (!__ids.keys ().hasNext ()) { Application.current.onUpdate.remove (this_onUpdate); - hasUpdate = false; + __hasUpdate = false; } diff --git a/lime/system/JNI.hx b/src/lime/system/JNI.hx similarity index 96% rename from lime/system/JNI.hx rename to src/lime/system/JNI.hx index 94ab5343b..d325b7a76 100644 --- a/lime/system/JNI.hx +++ b/src/lime/system/JNI.hx @@ -1,14 +1,14 @@ package lime.system; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; #if !lime_debug @:fileXml('tags="haxe,release"') @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class JNI { @@ -208,7 +208,7 @@ class JNI { @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class JNIMemberField { @@ -253,7 +253,7 @@ class JNIMemberField { @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class JNIStaticField { @@ -298,7 +298,7 @@ class JNIStaticField { @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class JNIMethod { diff --git a/lime/system/Locale.hx b/src/lime/system/Locale.hx similarity index 100% rename from lime/system/Locale.hx rename to src/lime/system/Locale.hx diff --git a/lime/system/Sensor.hx b/src/lime/system/Sensor.hx similarity index 100% rename from lime/system/Sensor.hx rename to src/lime/system/Sensor.hx diff --git a/lime/system/SensorType.hx b/src/lime/system/SensorType.hx similarity index 100% rename from lime/system/SensorType.hx rename to src/lime/system/SensorType.hx diff --git a/lime/system/System.hx b/src/lime/system/System.hx similarity index 99% rename from lime/system/System.hx rename to src/lime/system/System.hx index bd5875b61..1608ccdf8 100644 --- a/lime/system/System.hx +++ b/src/lime/system/System.hx @@ -2,7 +2,7 @@ package lime.system; import haxe.Constraints; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.app.Application; import lime.app.Config; import lime.math.Rectangle; @@ -34,7 +34,7 @@ import sys.io.Process; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.system.Display) @:access(lime.system.DisplayMode) diff --git a/lime/system/ThreadPool.hx b/src/lime/system/ThreadPool.hx similarity index 93% rename from lime/system/ThreadPool.hx rename to src/lime/system/ThreadPool.hx index b702136e2..5dcc5c78b 100644 --- a/lime/system/ThreadPool.hx +++ b/src/lime/system/ThreadPool.hx @@ -32,11 +32,11 @@ class ThreadPool { public var onRun = new EventVoid> (); #if (cpp || neko) - private var __synchronous:Bool; - private var __workCompleted:Int; - private var __workIncoming = new Deque (); - private var __workQueued:Int; - private var __workResult = new Deque (); + @:noCompletion private var __synchronous:Bool; + @:noCompletion private var __workCompleted:Int; + @:noCompletion private var __workIncoming = new Deque (); + @:noCompletion private var __workQueued:Int; + @:noCompletion private var __workResult = new Deque (); #end diff --git a/lime/text/Font.hx b/src/lime/text/Font.hx similarity index 98% rename from lime/text/Font.hx rename to src/lime/text/Font.hx index 3badc6c0c..69510c277 100644 --- a/lime/text/Font.hx +++ b/src/lime/text/Font.hx @@ -2,7 +2,7 @@ package lime.text; import haxe.io.Bytes; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.app.Future; import lime.app.Promise; import lime.graphics.Image; @@ -10,6 +10,7 @@ import lime.graphics.ImageBuffer; import lime.math.Vector2; import lime.net.HTTPRequest; import lime.system.System; +import lime.utils.Assets; import lime.utils.Log; import lime.utils.UInt8Array; @@ -30,10 +31,10 @@ import haxe.io.Path; #end #if (!display && !flash && !nodejs && !macro) -@:autoBuild(lime._macros.AssetsMacro.embedFont()) +@:autoBuild(lime._internal.macros.AssetsMacro.embedFont()) #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.text.Glyph) diff --git a/lime/text/Glyph.hx b/src/lime/text/Glyph.hx similarity index 100% rename from lime/text/Glyph.hx rename to src/lime/text/Glyph.hx diff --git a/lime/text/GlyphMetrics.hx b/src/lime/text/GlyphMetrics.hx similarity index 100% rename from lime/text/GlyphMetrics.hx rename to src/lime/text/GlyphMetrics.hx diff --git a/lime/text/UTF8String.hx b/src/lime/text/UTF8String.hx similarity index 99% rename from lime/text/UTF8String.hx rename to src/lime/text/UTF8String.hx index d96f9c451..5c48e78fc 100644 --- a/lime/text/UTF8String.hx +++ b/src/lime/text/UTF8String.hx @@ -2,8 +2,8 @@ package lime.text; import haxe.Utf8; -import lime.text.unifill.Unifill; -import lime.text.unifill.CodePoint; +import lime._internal.unifill.Unifill; +import lime._internal.unifill.CodePoint; abstract UTF8String(String) from String to String { diff --git a/lime/text/harfbuzz/HB.hx b/src/lime/text/harfbuzz/HB.hx similarity index 72% rename from lime/text/harfbuzz/HB.hx rename to src/lime/text/harfbuzz/HB.hx index a36fc4308..dde5633fc 100644 --- a/lime/text/harfbuzz/HB.hx +++ b/src/lime/text/harfbuzz/HB.hx @@ -1,9 +1,9 @@ package lime.text.harfbuzz; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class HB { diff --git a/lime/ui/FileDialog.hx b/src/lime/ui/FileDialog.hx similarity index 98% rename from lime/ui/FileDialog.hx rename to src/lime/ui/FileDialog.hx index 8e16ea5d5..6720b31dc 100644 --- a/lime/ui/FileDialog.hx +++ b/src/lime/ui/FileDialog.hx @@ -3,7 +3,7 @@ package lime.ui; import haxe.io.Bytes; import haxe.io.Path; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.app.Event; import lime.graphics.Image; import lime.system.BackgroundWorker; @@ -23,7 +23,7 @@ import js.html.Blob; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.graphics.Image) diff --git a/lime/ui/FileDialogType.hx b/src/lime/ui/FileDialogType.hx similarity index 100% rename from lime/ui/FileDialogType.hx rename to src/lime/ui/FileDialogType.hx diff --git a/lime/ui/Gamepad.hx b/src/lime/ui/Gamepad.hx similarity index 95% rename from lime/ui/Gamepad.hx rename to src/lime/ui/Gamepad.hx index 91013dec4..6e4572fbc 100644 --- a/lime/ui/Gamepad.hx +++ b/src/lime/ui/Gamepad.hx @@ -1,7 +1,7 @@ package lime.ui; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.app.Event; #if !lime_debug @@ -9,7 +9,7 @@ import lime.app.Event; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.ui.Joystick) diff --git a/lime/ui/GamepadAxis.hx b/src/lime/ui/GamepadAxis.hx similarity index 100% rename from lime/ui/GamepadAxis.hx rename to src/lime/ui/GamepadAxis.hx diff --git a/lime/ui/GamepadButton.hx b/src/lime/ui/GamepadButton.hx similarity index 100% rename from lime/ui/GamepadButton.hx rename to src/lime/ui/GamepadButton.hx diff --git a/lime/ui/Haptic.hx b/src/lime/ui/Haptic.hx similarity index 88% rename from lime/ui/Haptic.hx rename to src/lime/ui/Haptic.hx index 34456d49c..ae650c09e 100644 --- a/lime/ui/Haptic.hx +++ b/src/lime/ui/Haptic.hx @@ -1,7 +1,7 @@ package lime.ui; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.system.JNI; import lime.utils.Log; @@ -10,7 +10,7 @@ import lime.utils.Log; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class Haptic { diff --git a/lime/ui/Joystick.hx b/src/lime/ui/Joystick.hx similarity index 97% rename from lime/ui/Joystick.hx rename to src/lime/ui/Joystick.hx index a549436da..88f92039b 100644 --- a/lime/ui/Joystick.hx +++ b/src/lime/ui/Joystick.hx @@ -1,7 +1,7 @@ package lime.ui; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; import lime.app.Event; #if !lime_debug @@ -9,7 +9,7 @@ import lime.app.Event; @:noDebug #end -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) class Joystick { diff --git a/lime/ui/JoystickHatPosition.hx b/src/lime/ui/JoystickHatPosition.hx similarity index 100% rename from lime/ui/JoystickHatPosition.hx rename to src/lime/ui/JoystickHatPosition.hx diff --git a/lime/ui/KeyCode.hx b/src/lime/ui/KeyCode.hx similarity index 98% rename from lime/ui/KeyCode.hx rename to src/lime/ui/KeyCode.hx index 970306eb5..c1aa57c26 100644 --- a/lime/ui/KeyCode.hx +++ b/src/lime/ui/KeyCode.hx @@ -1,9 +1,9 @@ package lime.ui; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:enum abstract KeyCode(Int) from Int to Int from UInt to UInt { diff --git a/lime/ui/KeyModifier.hx b/src/lime/ui/KeyModifier.hx similarity index 100% rename from lime/ui/KeyModifier.hx rename to src/lime/ui/KeyModifier.hx diff --git a/lime/ui/Mouse.hx b/src/lime/ui/Mouse.hx similarity index 78% rename from lime/ui/Mouse.hx rename to src/lime/ui/Mouse.hx index dbd27407d..c3065c499 100644 --- a/lime/ui/Mouse.hx +++ b/src/lime/ui/Mouse.hx @@ -74,9 +74,9 @@ class Mouse { #if flash -@:noCompletion private typedef MouseBackend = lime._backend.flash.FlashMouse; +@:noCompletion private typedef MouseBackend = lime._internal.backend.flash.FlashMouse; #elseif (js && html5) -@:noCompletion private typedef MouseBackend = lime._backend.html5.HTML5Mouse; +@:noCompletion private typedef MouseBackend = lime._internal.backend.html5.HTML5Mouse; #else -@:noCompletion private typedef MouseBackend = lime._backend.native.NativeMouse; +@:noCompletion private typedef MouseBackend = lime._internal.backend.native.NativeMouse; #end \ No newline at end of file diff --git a/lime/ui/MouseCursor.hx b/src/lime/ui/MouseCursor.hx similarity index 100% rename from lime/ui/MouseCursor.hx rename to src/lime/ui/MouseCursor.hx diff --git a/lime/ui/ScanCode.hx b/src/lime/ui/ScanCode.hx similarity index 98% rename from lime/ui/ScanCode.hx rename to src/lime/ui/ScanCode.hx index e9cfe6f37..10f69c6b6 100644 --- a/lime/ui/ScanCode.hx +++ b/src/lime/ui/ScanCode.hx @@ -1,9 +1,9 @@ package lime.ui; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:access(lime.ui.KeyCode) diff --git a/lime/ui/Touch.hx b/src/lime/ui/Touch.hx similarity index 100% rename from lime/ui/Touch.hx rename to src/lime/ui/Touch.hx diff --git a/lime/ui/Window.hx b/src/lime/ui/Window.hx similarity index 94% rename from lime/ui/Window.hx rename to src/lime/ui/Window.hx index 68886405e..8e2b22a1e 100644 --- a/lime/ui/Window.hx +++ b/src/lime/ui/Window.hx @@ -34,7 +34,7 @@ class Window { public var application (default, null):Application; public var borderless (get, set):Bool; public var config:WindowConfig; - public var context:RenderContext; + public var context (default, null):RenderContext; public var display (get, null):Display; public var displayMode (get, set):DisplayMode; public var enableTextEvents (get, set):Bool; @@ -43,42 +43,43 @@ class Window { public var id (default, null):Int; public var maximized (get, set):Bool; public var minimized (get, set):Bool; - public var onActivate = new EventVoid> (); - public var onClose = new EventVoid> (); - public var onContextLost = new EventVoid> (); - public var onContextRestored = new EventVoid> (); - public var onCreate = new EventVoid> (); - public var onDeactivate = new EventVoid> (); - public var onDropFile = new EventVoid> (); - public var onEnter = new EventVoid> (); - public var onExpose = new EventVoid> (); - public var onFocusIn = new EventVoid> (); - public var onFocusOut = new EventVoid> (); - public var onFullscreen = new EventVoid> (); - public var onKeyDown = new EventKeyModifier->Void> (); - public var onKeyUp = new EventKeyModifier->Void> (); - public var onLeave = new EventVoid> (); - public var onMinimize = new EventVoid> (); - public var onMouseDown = new EventFloat->Int->Void> (); - public var onMouseMove = new EventFloat->Void> (); - public var onMouseMoveRelative = new EventFloat->Void> (); - public var onMouseUp = new EventFloat->Int->Void> (); - public var onMouseWheel = new EventFloat->Void> (); - public var onMove = new EventFloat->Void> (); - public var onRender (default, null) = new EventVoid> (); - public var onResize = new EventInt->Void> (); - public var onRestore = new EventVoid> (); - public var onTextEdit = new EventInt->Int->Void> (); - public var onTextInput = new EventVoid> (); + public var onActivate (default, null) = new EventVoid> (); + public var onClose (default, null) = new EventVoid> (); + public var onCreate (default, null) = new EventVoid> (); + public var onDeactivate (default, null) = new EventVoid> (); + public var onDropFile (default, null) = new EventVoid> (); + public var onEnter (default, null) = new EventVoid> (); + public var onExpose (default, null) = new EventVoid> (); + public var onFocusIn (default, null) = new EventVoid> (); + public var onFocusOut (default, null) = new EventVoid> (); + public var onFullscreen (default, null) = new EventVoid> (); + public var onKeyDown (default, null) = new EventKeyModifier->Void> (); + public var onKeyUp (default, null) = new EventKeyModifier->Void> (); + public var onLeave (default, null) = new EventVoid> (); + public var onMinimize (default, null) = new EventVoid> (); + public var onMouseDown (default, null) = new EventFloat->Int->Void> (); + public var onMouseMove (default, null) = new EventFloat->Void> (); + public var onMouseMoveRelative (default, null) = new EventFloat->Void> (); + public var onMouseUp (default, null) = new EventFloat->Int->Void> (); + public var onMouseWheel (default, null) = new EventFloat->Void> (); + public var onMove (default, null) = new EventFloat->Void> (); + public var onRender (default, null) = new EventVoid> (); + public var onRenderContextLost (default, null) = new EventVoid> (); + public var onRenderContextRestored (default, null) = new EventVoid> (); + public var onResize (default, null) = new EventInt->Void> (); + public var onRestore (default, null) = new EventVoid> (); + public var onTextEdit (default, null) = new EventInt->Int->Void> (); + public var onTextInput (default, null) = new EventVoid> (); + public var parameters (default, null):Dynamic; public var resizable (get, set):Bool; public var scale (get, null):Float; - public var stage:Stage; + // public var stage:Stage; public var title (get, set):String; public var width (get, set):Int; public var x (get, set):Int; public var y (get, set):Int; - @:noCompletion private var backend:WindowBackend; + @:noCompletion private var __backend:WindowBackend; @:noCompletion private var __borderless:Bool; @:noCompletion private var __fullscreen:Bool; @:noCompletion private var __height:Int; @@ -144,21 +145,21 @@ class Window { } - backend = new WindowBackend (this); + __backend = new WindowBackend (this); } public function alert (message:String = null, title:String = null):Void { - backend.alert (message, title); + __backend.alert (message, title); } public function close ():Void { - backend.close (); + __backend.close (); } @@ -168,7 +169,7 @@ class Window { this.application = application; if (config == null) config = {}; - backend.create (application); + __backend.create (application); #if windows @@ -387,14 +388,14 @@ class Window { public function focus ():Void { - backend.focus (); + __backend.focus (); } public function move (x:Int, y:Int):Void { - backend.move (x, y); + __backend.move (x, y); __x = x; __y = y; @@ -404,14 +405,14 @@ class Window { public function readPixels (rect:Rectangle = null):Image { - return backend.readPixels (rect); + return __backend.readPixels (rect); } public function resize (width:Int, height:Int):Void { - backend.resize (width, height); + __backend.resize (width, height); __width = width; __height = height; @@ -427,7 +428,7 @@ class Window { } - backend.setIcon (image); + __backend.setIcon (image); } @@ -448,21 +449,21 @@ class Window { @:noCompletion private function get_display ():Display { - return backend.getDisplay (); + return __backend.getDisplay (); } @:noCompletion private function get_displayMode ():DisplayMode { - return backend.getDisplayMode (); + return __backend.getDisplayMode (); } @:noCompletion private function set_displayMode (value:DisplayMode):DisplayMode { - return backend.setDisplayMode (value); + return __backend.setDisplayMode (value); } @@ -476,21 +477,21 @@ class Window { @:noCompletion private function set_borderless (value:Bool):Bool { - return __borderless = backend.setBorderless (value); + return __borderless = __backend.setBorderless (value); } @:noCompletion private inline function get_enableTextEvents ():Bool { - return backend.getEnableTextEvents (); + return __backend.getEnableTextEvents (); } @:noCompletion private inline function set_enableTextEvents (value:Bool):Bool { - return backend.setEnableTextEvents (value); + return __backend.setEnableTextEvents (value); } @@ -504,7 +505,7 @@ class Window { @:noCompletion private function set_fullscreen (value:Bool):Bool { - return __fullscreen = backend.setFullscreen (value); + return __fullscreen = __backend.setFullscreen (value); } @@ -534,7 +535,7 @@ class Window { @:noCompletion private inline function set_maximized (value:Bool):Bool { __minimized = false; - return __maximized = backend.setMaximized (value); + return __maximized = __backend.setMaximized (value); } @@ -549,7 +550,7 @@ class Window { @:noCompletion private function set_minimized (value:Bool):Bool { __maximized = false; - return __minimized = backend.setMinimized (value); + return __minimized = __backend.setMinimized (value); } @@ -563,7 +564,7 @@ class Window { @:noCompletion private function set_resizable (value:Bool):Bool { - __resizable = backend.setResizable (value); + __resizable = __backend.setResizable (value); return __resizable; } @@ -585,7 +586,7 @@ class Window { @:noCompletion private function set_title (value:String):String { - return __title = backend.setTitle (value); + return __title = __backend.setTitle (value); } @@ -639,11 +640,11 @@ class Window { #if air -@:noCompletion private typedef WindowBackend = lime._backend.air.AIRWindow; +@:noCompletion private typedef WindowBackend = lime._internal.backend.air.AIRWindow; #elseif flash -@:noCompletion private typedef WindowBackend = lime._backend.flash.FlashWindow; +@:noCompletion private typedef WindowBackend = lime._internal.backend.flash.FlashWindow; #elseif (js && html5) -@:noCompletion private typedef WindowBackend = lime._backend.html5.HTML5Window; +@:noCompletion private typedef WindowBackend = lime._internal.backend.html5.HTML5Window; #else -@:noCompletion private typedef WindowBackend = lime._backend.native.NativeWindow; +@:noCompletion private typedef WindowBackend = lime._internal.backend.native.NativeWindow; #end diff --git a/lime/utils/ArrayBuffer.hx b/src/lime/utils/ArrayBuffer.hx similarity index 100% rename from lime/utils/ArrayBuffer.hx rename to src/lime/utils/ArrayBuffer.hx diff --git a/lime/utils/ArrayBufferView.hx b/src/lime/utils/ArrayBufferView.hx similarity index 100% rename from lime/utils/ArrayBufferView.hx rename to src/lime/utils/ArrayBufferView.hx diff --git a/lime/utils/AssetCache.hx b/src/lime/utils/AssetCache.hx similarity index 98% rename from lime/utils/AssetCache.hx rename to src/lime/utils/AssetCache.hx index 467ad0cb7..9babca530 100644 --- a/lime/utils/AssetCache.hx +++ b/src/lime/utils/AssetCache.hx @@ -2,7 +2,7 @@ package lime.utils; #if !(macro || commonjs) -import lime._macros.AssetsMacro; +import lime._internal.macros.AssetsMacro; #end import lime.media.AudioBuffer; diff --git a/lime/utils/AssetLibrary.hx b/src/lime/utils/AssetLibrary.hx similarity index 100% rename from lime/utils/AssetLibrary.hx rename to src/lime/utils/AssetLibrary.hx diff --git a/lime/utils/AssetManifest.hx b/src/lime/utils/AssetManifest.hx similarity index 100% rename from lime/utils/AssetManifest.hx rename to src/lime/utils/AssetManifest.hx diff --git a/lime/utils/AssetType.hx b/src/lime/utils/AssetType.hx similarity index 100% rename from lime/utils/AssetType.hx rename to src/lime/utils/AssetType.hx diff --git a/lime/utils/Assets.hx b/src/lime/utils/Assets.hx similarity index 100% rename from lime/utils/Assets.hx rename to src/lime/utils/Assets.hx diff --git a/lime/utils/BytePointer.hx b/src/lime/utils/BytePointer.hx similarity index 100% rename from lime/utils/BytePointer.hx rename to src/lime/utils/BytePointer.hx diff --git a/lime/utils/Bytes.hx b/src/lime/utils/Bytes.hx similarity index 68% rename from lime/utils/Bytes.hx rename to src/lime/utils/Bytes.hx index de1eea8da..0cff28c1a 100644 --- a/lime/utils/Bytes.hx +++ b/src/lime/utils/Bytes.hx @@ -3,12 +3,16 @@ package lime.utils; import haxe.io.Bytes in HaxeBytes; import haxe.io.BytesData; -import lime._backend.native.NativeCFFI; +import lime._internal.backend.native.NativeCFFI; +import lime._internal.format.Deflate; +import lime._internal.format.GZip; +import lime._internal.format.LZMA; +import lime._internal.format.Zlib; import lime.app.Future; import lime.net.HTTPRequest; @:access(haxe.io.Bytes) -@:access(lime._backend.native.NativeCFFI) +@:access(lime._internal.backend.native.NativeCFFI) @:forward() @@ -38,6 +42,60 @@ abstract Bytes(HaxeBytes) from HaxeBytes to HaxeBytes { } + public function compress (algorithm:CompressionAlgorithm):Bytes { + + switch (algorithm) { + + case DEFLATE: + + return Deflate.compress (this); + + case GZIP: + + return GZip.compress (this); + + case LZMA: + + return LZMA.compress (this); + + case ZLIB: + + return Zlib.compress (this); + + default: return null; + + } + + } + + + public function decompress (algorithm:CompressionAlgorithm):Bytes { + + switch (algorithm) { + + case DEFLATE: + + return Deflate.decompress (this); + + case GZIP: + + return GZip.decompress (this); + + case LZMA: + + return LZMA.decompress (this); + + case ZLIB: + + return Zlib.decompress (this); + + default: return null; + + } + + } + + public static inline function fastGet (b:BytesData, pos:Int):Int { return HaxeBytes.fastGet (b, pos); diff --git a/src/lime/utils/CompressionAlgorithm.hx b/src/lime/utils/CompressionAlgorithm.hx new file mode 100644 index 000000000..710b2c3e4 --- /dev/null +++ b/src/lime/utils/CompressionAlgorithm.hx @@ -0,0 +1,11 @@ +package lime.utils; + + +enum CompressionAlgorithm { + + DEFLATE; + GZIP; + LZMA; + ZLIB; + +} \ No newline at end of file diff --git a/lime/utils/DataPointer.hx b/src/lime/utils/DataPointer.hx similarity index 99% rename from lime/utils/DataPointer.hx rename to src/lime/utils/DataPointer.hx index aedc96990..d7127a2d5 100644 --- a/lime/utils/DataPointer.hx +++ b/src/lime/utils/DataPointer.hx @@ -7,8 +7,8 @@ import lime.system.CFFIPointer; import lime.utils.Bytes in LimeBytes; #if (lime_cffi && !macro) -import lime._backend.native.NativeCFFI; -@:access(lime._backend.native.NativeCFFI) +import lime._internal.backend.native.NativeCFFI; +@:access(lime._internal.backend.native.NativeCFFI) #end diff --git a/lime/utils/DataView.hx b/src/lime/utils/DataView.hx similarity index 100% rename from lime/utils/DataView.hx rename to src/lime/utils/DataView.hx diff --git a/lime/utils/Float32Array.hx b/src/lime/utils/Float32Array.hx similarity index 100% rename from lime/utils/Float32Array.hx rename to src/lime/utils/Float32Array.hx diff --git a/lime/utils/Float64Array.hx b/src/lime/utils/Float64Array.hx similarity index 100% rename from lime/utils/Float64Array.hx rename to src/lime/utils/Float64Array.hx diff --git a/lime/utils/GLUtils.hx b/src/lime/utils/GLUtils.hx similarity index 100% rename from lime/utils/GLUtils.hx rename to src/lime/utils/GLUtils.hx diff --git a/lime/utils/Int16Array.hx b/src/lime/utils/Int16Array.hx similarity index 100% rename from lime/utils/Int16Array.hx rename to src/lime/utils/Int16Array.hx diff --git a/lime/utils/Int32Array.hx b/src/lime/utils/Int32Array.hx similarity index 97% rename from lime/utils/Int32Array.hx rename to src/lime/utils/Int32Array.hx index 507883653..577bfdfdc 100644 --- a/lime/utils/Int32Array.hx +++ b/src/lime/utils/Int32Array.hx @@ -1,129 +1,129 @@ -package lime.utils; - -#if (js && !display) - - @:forward - abstract Int32Array(js.html.Int32Array) - from js.html.Int32Array - to js.html.Int32Array { - - public inline static var BYTES_PER_ELEMENT : Int = 4; - - @:generic - public inline function new( - ?elements:Int, - ?array:Array, - #if openfl ?vector:openfl.Vector, #end - ?view:ArrayBufferView, - ?buffer:ArrayBuffer, ?byteoffset:Int = 0, ?len:Null - ) { - if(elements != null) { - this = new js.html.Int32Array( elements ); - } else if(array != null) { - this = new js.html.Int32Array( untyped array ); - #if (openfl && commonjs) } else if(vector != null) { this = new js.html.Int32Array( untyped (vector) ); - #elseif openfl } else if(vector != null) { this = new js.html.Int32Array( untyped untyped (vector).__array ); #end - } else if(view != null) { - this = new js.html.Int32Array( untyped view ); - } else if(buffer != null) { - if(len == null) { - this = new js.html.Int32Array( buffer, byteoffset ); - } else { - this = new js.html.Int32Array( buffer, byteoffset, len ); - } - } else { - this = null; - } - } - - @:arrayAccess @:extern inline function __set(idx:Int, val:Int) : Int return this[idx] = val; - @:arrayAccess @:extern inline function __get(idx:Int) : Int return this[idx]; - - - //non spec haxe conversions - inline public static function fromBytes( bytes:haxe.io.Bytes, ?byteOffset:Int=0, ?len:Int ) : Int32Array { - if(byteOffset == null) return new js.html.Int32Array(cast bytes.getData()); - if(len == null) return new js.html.Int32Array(cast bytes.getData(), byteOffset); - return new js.html.Int32Array(cast bytes.getData(), byteOffset, len); - } - - inline public function toBytes() : haxe.io.Bytes { - return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) ); - } - - inline function toString() return this != null ? 'Int32Array [byteLength:${this.byteLength}, length:${this.length}]' : null; - - } - -#else - - import lime.utils.ArrayBufferView; - - @:forward - abstract Int32Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView { - - public inline static var BYTES_PER_ELEMENT : Int = 4; - - public var length (get, never):Int; - - @:generic - public inline function new( - ?elements:Int, - ?buffer:ArrayBuffer, - ?array:Array, - #if openfl ?vector:openfl.Vector, #end - ?view:ArrayBufferView, - ?byteoffset:Int = 0, ?len:Null - ) { - - if(elements != null) { - this = new ArrayBufferView( elements, Int32 ); - } else if(array != null) { - this = new ArrayBufferView(0, Int32).initArray(array); - #if openfl } else if(vector != null) { this = new ArrayBufferView(0, Int32).initArray(untyped (vector).__array); #end - } else if(view != null) { - this = new ArrayBufferView(0, Int32).initTypedArray(view); - } else if(buffer != null) { - this = new ArrayBufferView(0, Int32).initBuffer(buffer, byteoffset, len); - } else { - throw "Invalid constructor arguments for Int32Array"; - } - } - - //Public API - - public inline function subarray( begin:Int, end:Null = null) : Int32Array return this.subarray(begin, end); - - - //non spec haxe conversions - inline public static function fromBytes( bytes:haxe.io.Bytes, ?byteOffset:Int=0, ?len:Int ) : Int32Array { - return new Int32Array(bytes, byteOffset, len); - } - - inline public function toBytes() : haxe.io.Bytes { - return this.buffer; - } - - //Internal - - inline function get_length() return this.length; - - - @:noCompletion - @:arrayAccess @:extern - public inline function __get(idx:Int) { - return ArrayBufferIO.getInt32(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT)); - } - - @:noCompletion - @:arrayAccess @:extern - public inline function __set(idx:Int, val:Int) { - ArrayBufferIO.setInt32(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val); - return val; - } - - inline function toString() return this != null ? 'Int32Array [byteLength:${this.byteLength}, length:${this.length}]' : null; - - } - +package lime.utils; + +#if (js && !display) + + @:forward + abstract Int32Array(js.html.Int32Array) + from js.html.Int32Array + to js.html.Int32Array { + + public inline static var BYTES_PER_ELEMENT : Int = 4; + + @:generic + public inline function new( + ?elements:Int, + ?array:Array, + #if openfl ?vector:openfl.Vector, #end + ?view:ArrayBufferView, + ?buffer:ArrayBuffer, ?byteoffset:Int = 0, ?len:Null + ) { + if(elements != null) { + this = new js.html.Int32Array( elements ); + } else if(array != null) { + this = new js.html.Int32Array( untyped array ); + #if (openfl && commonjs) } else if(vector != null) { this = new js.html.Int32Array( untyped (vector) ); + #elseif openfl } else if(vector != null) { this = new js.html.Int32Array( untyped untyped (vector).__array ); #end + } else if(view != null) { + this = new js.html.Int32Array( untyped view ); + } else if(buffer != null) { + if(len == null) { + this = new js.html.Int32Array( buffer, byteoffset ); + } else { + this = new js.html.Int32Array( buffer, byteoffset, len ); + } + } else { + this = null; + } + } + + @:arrayAccess @:extern inline function __set(idx:Int, val:Int) : Int return this[idx] = val; + @:arrayAccess @:extern inline function __get(idx:Int) : Int return this[idx]; + + + //non spec haxe conversions + inline public static function fromBytes( bytes:haxe.io.Bytes, ?byteOffset:Int=0, ?len:Int ) : Int32Array { + if(byteOffset == null) return new js.html.Int32Array(cast bytes.getData()); + if(len == null) return new js.html.Int32Array(cast bytes.getData(), byteOffset); + return new js.html.Int32Array(cast bytes.getData(), byteOffset, len); + } + + inline public function toBytes() : haxe.io.Bytes { + return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) ); + } + + inline function toString() return this != null ? 'Int32Array [byteLength:${this.byteLength}, length:${this.length}]' : null; + + } + +#else + + import lime.utils.ArrayBufferView; + + @:forward + abstract Int32Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView { + + public inline static var BYTES_PER_ELEMENT : Int = 4; + + public var length (get, never):Int; + + @:generic + public inline function new( + ?elements:Int, + ?buffer:ArrayBuffer, + ?array:Array, + #if openfl ?vector:openfl.Vector, #end + ?view:ArrayBufferView, + ?byteoffset:Int = 0, ?len:Null + ) { + + if(elements != null) { + this = new ArrayBufferView( elements, Int32 ); + } else if(array != null) { + this = new ArrayBufferView(0, Int32).initArray(array); + #if openfl } else if(vector != null) { this = new ArrayBufferView(0, Int32).initArray(untyped (vector).__array); #end + } else if(view != null) { + this = new ArrayBufferView(0, Int32).initTypedArray(view); + } else if(buffer != null) { + this = new ArrayBufferView(0, Int32).initBuffer(buffer, byteoffset, len); + } else { + throw "Invalid constructor arguments for Int32Array"; + } + } + + //Public API + + public inline function subarray( begin:Int, end:Null = null) : Int32Array return this.subarray(begin, end); + + + //non spec haxe conversions + inline public static function fromBytes( bytes:haxe.io.Bytes, ?byteOffset:Int=0, ?len:Int ) : Int32Array { + return new Int32Array(bytes, byteOffset, len); + } + + inline public function toBytes() : haxe.io.Bytes { + return this.buffer; + } + + //Internal + + inline function get_length() return this.length; + + + @:noCompletion + @:arrayAccess @:extern + public inline function __get(idx:Int) { + return ArrayBufferIO.getInt32(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT)); + } + + @:noCompletion + @:arrayAccess @:extern + public inline function __set(idx:Int, val:Int) { + ArrayBufferIO.setInt32(this.buffer, this.byteOffset+(idx*BYTES_PER_ELEMENT), val); + return val; + } + + inline function toString() return this != null ? 'Int32Array [byteLength:${this.byteLength}, length:${this.length}]' : null; + + } + #end //!js \ No newline at end of file diff --git a/lime/utils/Int8Array.hx b/src/lime/utils/Int8Array.hx similarity index 100% rename from lime/utils/Int8Array.hx rename to src/lime/utils/Int8Array.hx diff --git a/lime/utils/Log.hx b/src/lime/utils/Log.hx similarity index 57% rename from lime/utils/Log.hx rename to src/lime/utils/Log.hx index 20b317c1a..9bef149ae 100644 --- a/lime/utils/Log.hx +++ b/src/lime/utils/Log.hx @@ -16,14 +16,14 @@ class Log { public static var throwErrors:Bool = true; - public static function debug (message:String, ?info:PosInfos):Void { + public static function debug (message:Dynamic, ?info:PosInfos):Void { if (level >= LogLevel.DEBUG) { #if js untyped __js__("console").debug ("[" + info.className + "] " + message); #else - println ("[" + info.className + "] " + message); + println ("[" + info.className + "] " + Std.string (message)); #end } @@ -31,7 +31,7 @@ class Log { } - public static function error (message:String, ?info:PosInfos):Void { + public static function error (message:Dynamic, ?info:PosInfos):Void { if (level >= LogLevel.ERROR) { @@ -56,14 +56,14 @@ class Log { } - public static function info (message:String, ?info:PosInfos):Void { + public static function info (message:Dynamic, ?info:PosInfos):Void { if (level >= LogLevel.INFO) { #if js untyped __js__("console").info ("[" + info.className + "] " + message); #else - println ("[" + info.className + "] " + message); + println ("[" + info.className + "] " + Std.string (message)); #end } @@ -71,12 +71,12 @@ class Log { } - public static inline function print (message:String):Void { + public static inline function print (message:Dynamic):Void { #if sys - Sys.print (message); + Sys.print (Std.string (message)); #elseif flash - untyped __global__["trace"] (message); + untyped __global__["trace"] (Std.string (message)); #elseif js untyped __js__("console").log (message); #else @@ -86,22 +86,22 @@ class Log { } - public static inline function println (message:String):Void { + public static inline function println (message:Dynamic):Void { #if sys - Sys.println (message); + Sys.println (Std.string (message)); #elseif flash - untyped __global__["trace"] (message); + untyped __global__["trace"] (Std.string (message)); #elseif js untyped __js__("console").log (message); #else - trace (message); + trace (Std.string (message)); #end } - public static function verbose (message:String, ?info:PosInfos):Void { + public static function verbose (message:Dynamic, ?info:PosInfos):Void { if (level >= LogLevel.VERBOSE) { @@ -112,14 +112,14 @@ class Log { } - public static function warn (message:String, ?info:PosInfos):Void { + public static function warn (message:Dynamic, ?info:PosInfos):Void { if (level >= LogLevel.WARN) { #if js untyped __js__("console").warn ("[" + info.className + "] WARNING: " + message); #else - println ("[" + info.className + "] WARNING: " + message); + println ("[" + info.className + "] WARNING: " + Std.string (message)); #end } @@ -158,28 +158,7 @@ class Log { } #end - #if (lime >= "4.0.0") - throwErrors = true; - #end - } -} - - -@:enum abstract LogLevel(Int) from Int to Int from UInt to UInt { - - var NONE = 0; - var ERROR = 1; - var WARN = 2; - var INFO = 3; - var DEBUG = 4; - var VERBOSE = 5; - - @:op(A > B) private static inline function gt (a:LogLevel, b:LogLevel):Bool { return (a:Int) > (b:Int); } - @:op(A >= B) private static inline function gte (a:LogLevel, b:LogLevel):Bool { return (a:Int) >= (b:Int); } - @:op(A < B) private static inline function lt (a:LogLevel, b:LogLevel):Bool { return (a:Int) < (b:Int); } - @:op(A <= B) private static inline function lte (a:LogLevel, b:LogLevel):Bool { return (a:Int) <= (b:Int); } - } \ No newline at end of file diff --git a/src/lime/utils/LogLevel.hx b/src/lime/utils/LogLevel.hx new file mode 100644 index 000000000..7fc7e826c --- /dev/null +++ b/src/lime/utils/LogLevel.hx @@ -0,0 +1,18 @@ +package lime.utils; + + +@:enum abstract LogLevel(Int) from Int to Int from UInt to UInt { + + var NONE = 0; + var ERROR = 1; + var WARN = 2; + var INFO = 3; + var DEBUG = 4; + var VERBOSE = 5; + + @:op(A > B) private static inline function gt (a:LogLevel, b:LogLevel):Bool { return (a:Int) > (b:Int); } + @:op(A >= B) private static inline function gte (a:LogLevel, b:LogLevel):Bool { return (a:Int) >= (b:Int); } + @:op(A < B) private static inline function lt (a:LogLevel, b:LogLevel):Bool { return (a:Int) < (b:Int); } + @:op(A <= B) private static inline function lte (a:LogLevel, b:LogLevel):Bool { return (a:Int) <= (b:Int); } + +} \ No newline at end of file diff --git a/lime/utils/ObjectPool.hx b/src/lime/utils/ObjectPool.hx similarity index 94% rename from lime/utils/ObjectPool.hx rename to src/lime/utils/ObjectPool.hx index 0aa54c622..b4e59b966 100644 --- a/lime/utils/ObjectPool.hx +++ b/src/lime/utils/ObjectPool.hx @@ -16,11 +16,11 @@ import haxe.ds.ObjectMap; public var inactiveObjects (default, null):Int; public var size (get, set):Null; - private var __inactiveObject0:T; - private var __inactiveObject1:T; - private var __inactiveObjectList:List; - private var __pool:Map; - private var __size:Null; + @:noCompletion private var __inactiveObject0:T; + @:noCompletion private var __inactiveObject1:T; + @:noCompletion private var __inactiveObjectList:List; + @:noCompletion private var __pool:Map; + @:noCompletion private var __size:Null; public function new (create:Void->T = null, clean:T->Void = null, size:Null = null) { diff --git a/lime/utils/PackedAssetLibrary.hx b/src/lime/utils/PackedAssetLibrary.hx similarity index 89% rename from lime/utils/PackedAssetLibrary.hx rename to src/lime/utils/PackedAssetLibrary.hx index 7b3162fd5..d41463a2a 100644 --- a/lime/utils/PackedAssetLibrary.hx +++ b/src/lime/utils/PackedAssetLibrary.hx @@ -1,6 +1,7 @@ package lime.utils; +import haxe.io.Bytes; import haxe.io.Path; import lime.app.Event; import lime.app.Future; @@ -9,9 +10,8 @@ import lime.media.AudioBuffer; import lime.graphics.Image; import lime.net.HTTPRequest; import lime.text.Font; -import lime.utils.compress.Deflate; -import lime.utils.compress.GZip; import lime.utils.AssetType; +import lime.utils.Bytes; #if flash import flash.display.BitmapData; @@ -83,8 +83,8 @@ import flash.media.Sound; // TODO: More efficient method var bytes = Bytes.alloc (lengths[id]); bytes.blit (0, packedData, positions[id], lengths[id]); - if (type == "gzip") bytes = GZip.decompress (bytes); - else if (type == "deflate") bytes = Deflate.decompress (bytes); + if (type == "gzip") bytes = bytes.decompress (GZIP); + else if (type == "deflate") bytes = bytes.decompress (DEFLATE); return AudioBuffer.fromBytes (bytes); } @@ -110,8 +110,8 @@ import flash.media.Sound; var bytes = Bytes.alloc (lengths[id]); bytes.blit (0, packedData, positions[id], lengths[id]); - if (type == "gzip") bytes = GZip.decompress (bytes); - else if (type == "deflate") bytes = Deflate.decompress (bytes); + if (type == "gzip") bytes = bytes.decompress (GZIP); + else if (type == "deflate") bytes = bytes.decompress (DEFLATE); return bytes; } @@ -136,8 +136,8 @@ import flash.media.Sound; // TODO: More efficient method var bytes = Bytes.alloc (lengths[id]); bytes.blit (0, packedData, positions[id], lengths[id]); - if (type == "gzip") bytes = GZip.decompress (bytes); - else if (type == "deflate") bytes = Deflate.decompress (bytes); + if (type == "gzip") bytes = bytes.decompress (GZIP); + else if (type == "deflate") bytes = bytes.decompress (DEFLATE); return Font.fromBytes (bytes); } @@ -158,8 +158,8 @@ import flash.media.Sound; // TODO: More efficient method var bytes = Bytes.alloc (lengths[id]); bytes.blit (0, packedData, positions[id], lengths[id]); - if (type == "gzip") bytes = GZip.decompress (bytes); - else if (type == "deflate") bytes = Deflate.decompress (bytes); + if (type == "gzip") bytes = bytes.decompress (GZIP); + else if (type == "deflate") bytes = bytes.decompress (DEFLATE); return Image.fromBytes (bytes); } @@ -177,8 +177,8 @@ import flash.media.Sound; var bytes = Bytes.alloc (lengths[id]); bytes.blit (0, packedData, positions[id], lengths[id]); - if (type == "gzip") bytes = GZip.decompress (bytes); - else if (type == "deflate") bytes = Deflate.decompress (bytes); + if (type == "gzip") bytes = bytes.decompress (GZIP); + else if (type == "deflate") bytes = bytes.decompress (DEFLATE); return bytes.getString (0, bytes.length); } else { @@ -292,7 +292,7 @@ import flash.media.Sound; var basePath = rootPath; if (basePath == null) basePath = ""; if (basePath != "") basePath += "/"; - + var path = basePath + (paths.exists (id) ? paths.get (id) : id); path = __cacheBreak (path); @@ -324,8 +324,8 @@ import flash.media.Sound; // TODO: More efficient method, use `loadFromBytes` method var bytes = Bytes.alloc (lengths[id]); bytes.blit (0, packedData, positions[id], lengths[id]); - if (type == "gzip") bytes = GZip.decompress (bytes); - else if (type == "deflate") bytes = Deflate.decompress (bytes); + if (type == "gzip") bytes = bytes.decompress (GZIP); + else if (type == "deflate") bytes = bytes.decompress (DEFLATE); return Future.withValue (AudioBuffer.fromBytes (bytes)); } @@ -346,8 +346,8 @@ import flash.media.Sound; // TODO: More efficient method var bytes = Bytes.alloc (lengths[id]); bytes.blit (0, packedData, positions[id], lengths[id]); - if (type == "gzip") bytes = GZip.decompress (bytes); - else if (type == "deflate") bytes = Deflate.decompress (bytes); + if (type == "gzip") bytes = bytes.decompress (GZIP); + else if (type == "deflate") bytes = bytes.decompress (DEFLATE); return Future.withValue (bytes); } @@ -372,8 +372,8 @@ import flash.media.Sound; // TODO: More efficient method var bytes = Bytes.alloc (lengths[id]); bytes.blit (0, packedData, positions[id], lengths[id]); - if (type == "gzip") bytes = GZip.decompress (bytes); - else if (type == "deflate") bytes = Deflate.decompress (bytes); + if (type == "gzip") bytes = bytes.decompress (GZIP); + else if (type == "deflate") bytes = bytes.decompress (DEFLATE); return Font.loadFromBytes (bytes); } @@ -430,8 +430,8 @@ import flash.media.Sound; // TODO: More efficient method var bytes = Bytes.alloc (lengths[id]); bytes.blit (0, packedData, positions[id], lengths[id]); - if (type == "gzip") bytes = GZip.decompress (bytes); - else if (type == "deflate") bytes = Deflate.decompress (bytes); + if (type == "gzip") bytes = bytes.decompress (GZIP); + else if (type == "deflate") bytes = bytes.decompress (DEFLATE); return Image.loadFromBytes (bytes); } @@ -465,8 +465,8 @@ import flash.media.Sound; var bytes = Bytes.alloc (lengths[id]); bytes.blit (0, packedData, positions[id], lengths[id]); - if (type == "gzip") bytes = GZip.decompress (bytes); - else if (type == "deflate") bytes = Deflate.decompress (bytes); + if (type == "gzip") bytes = bytes.decompress (GZIP); + else if (type == "deflate") bytes = bytes.decompress (DEFLATE); return Future.withValue (bytes.getString (0, bytes.length)); } else { diff --git a/lime/app/Preloader.hx b/src/lime/utils/Preloader.hx similarity index 99% rename from lime/app/Preloader.hx rename to src/lime/utils/Preloader.hx index e54373c51..a735fcf19 100644 --- a/lime/app/Preloader.hx +++ b/src/lime/utils/Preloader.hx @@ -1,10 +1,11 @@ -package lime.app; +package lime.utils; import haxe.io.Bytes; import haxe.io.Path; import haxe.macro.Compiler; import haxe.Timer; +import lime.app.Config; import lime.app.Event; import lime.media.AudioBuffer; import lime.system.System; diff --git a/lime/utils/Resource.hx b/src/lime/utils/Resource.hx similarity index 100% rename from lime/utils/Resource.hx rename to src/lime/utils/Resource.hx diff --git a/lime/utils/UInt16Array.hx b/src/lime/utils/UInt16Array.hx similarity index 100% rename from lime/utils/UInt16Array.hx rename to src/lime/utils/UInt16Array.hx diff --git a/lime/utils/UInt32Array.hx b/src/lime/utils/UInt32Array.hx similarity index 100% rename from lime/utils/UInt32Array.hx rename to src/lime/utils/UInt32Array.hx diff --git a/lime/utils/UInt8Array.hx b/src/lime/utils/UInt8Array.hx similarity index 97% rename from lime/utils/UInt8Array.hx rename to src/lime/utils/UInt8Array.hx index 3c6f423fc..c4e2941ea 100644 --- a/lime/utils/UInt8Array.hx +++ b/src/lime/utils/UInt8Array.hx @@ -1,129 +1,129 @@ -package lime.utils; - -#if (js && !display) - - @:forward - abstract UInt8Array(js.html.Uint8Array) - from js.html.Uint8Array - to js.html.Uint8Array { - - public inline static var BYTES_PER_ELEMENT : Int = 1; - - @:generic - public inline function new( - ?elements:Int, - ?array:Array, - #if openfl ?vector:openfl.Vector, #end - ?view:ArrayBufferView, - ?buffer:ArrayBuffer, ?byteoffset:Int = 0, ?len:Null - ) { - if(elements != null) { - this = new js.html.Uint8Array( elements ); - } else if(array != null) { - this = new js.html.Uint8Array( untyped array ); - #if (openfl && commonjs) } else if(vector != null) { this = new js.html.Uint8Array( untyped (vector) ); - #elseif openfl } else if(vector != null) { this = new js.html.Uint8Array( untyped untyped (vector).__array ); #end - } else if(view != null) { - this = new js.html.Uint8Array( untyped view ); - } else if(buffer != null) { - if(len == null) { - this = new js.html.Uint8Array( buffer, byteoffset ); - } else { - this = new js.html.Uint8Array( buffer, byteoffset, len ); - } - } else { - this = null; - } - } - - @:arrayAccess @:extern inline function __set(idx:Int, val:UInt) : UInt return this[idx] = val; - @:arrayAccess @:extern inline function __get(idx:Int) : UInt return this[idx]; - - - //non spec haxe conversions - inline public static function fromBytes( bytes:haxe.io.Bytes, ?byteOffset:Int, ?len:Int ) : UInt8Array { - if(byteOffset == null) return new js.html.Uint8Array(cast bytes.getData()); - if(len == null) return new js.html.Uint8Array(cast bytes.getData(), byteOffset); - return new js.html.Uint8Array(cast bytes.getData(), byteOffset, len); - } - - inline public function toBytes() : haxe.io.Bytes { - return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) ); - } - - inline function toString() return this != null ? 'UInt8Array [byteLength:${this.byteLength}, length:${this.length}]' : null; - - } - -#else - - import lime.utils.ArrayBufferView; - - @:forward - abstract UInt8Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView { - - public inline static var BYTES_PER_ELEMENT : Int = 1; - - public var length (get, never):Int; - - @:generic - public inline function new( - ?elements:Int, - ?buffer:ArrayBuffer, - ?array:Array, - #if openfl ?vector:openfl.Vector, #end - ?view:ArrayBufferView, - ?byteoffset:Int = 0, ?len:Null - ) { - - if(elements != null) { - this = new ArrayBufferView( elements, Uint8 ); - } else if(array != null) { - this = new ArrayBufferView(0, Uint8).initArray(array); - #if openfl } else if(vector != null) { this = new ArrayBufferView(0, Uint8).initArray(untyped (vector).__array); #end - } else if(view != null) { - this = new ArrayBufferView(0, Uint8).initTypedArray(view); - } else if(buffer != null) { - this = new ArrayBufferView(0, Uint8).initBuffer(buffer, byteoffset, len); - } else { - throw "Invalid constructor arguments for UInt8Array"; - } - } - - //Public API - - public inline function subarray( begin:Int, end:Null = null) : UInt8Array return this.subarray(begin, end); - - - //non spec haxe conversions - inline public static function fromBytes( bytes:haxe.io.Bytes, ?byteOffset:Int=0, ?len:Int ) : UInt8Array { - return new UInt8Array(bytes, byteOffset, len); - } - - inline public function toBytes() : haxe.io.Bytes { - return this.buffer; - } - - //Internal - - inline function toString() return this != null ? 'UInt8Array [byteLength:${this.byteLength}, length:${this.length}]' : null; - - inline function get_length() return this.length; - - - @:noCompletion - @:arrayAccess @:extern - public inline function __get(idx:Int) { - return ArrayBufferIO.getUint8(this.buffer, this.byteOffset+idx); - } - - @:noCompletion - @:arrayAccess @:extern - public inline function __set(idx:Int, val:UInt) { - ArrayBufferIO.setUint8(this.buffer, this.byteOffset+idx, val); - return val; - } - - } - +package lime.utils; + +#if (js && !display) + + @:forward + abstract UInt8Array(js.html.Uint8Array) + from js.html.Uint8Array + to js.html.Uint8Array { + + public inline static var BYTES_PER_ELEMENT : Int = 1; + + @:generic + public inline function new( + ?elements:Int, + ?array:Array, + #if openfl ?vector:openfl.Vector, #end + ?view:ArrayBufferView, + ?buffer:ArrayBuffer, ?byteoffset:Int = 0, ?len:Null + ) { + if(elements != null) { + this = new js.html.Uint8Array( elements ); + } else if(array != null) { + this = new js.html.Uint8Array( untyped array ); + #if (openfl && commonjs) } else if(vector != null) { this = new js.html.Uint8Array( untyped (vector) ); + #elseif openfl } else if(vector != null) { this = new js.html.Uint8Array( untyped untyped (vector).__array ); #end + } else if(view != null) { + this = new js.html.Uint8Array( untyped view ); + } else if(buffer != null) { + if(len == null) { + this = new js.html.Uint8Array( buffer, byteoffset ); + } else { + this = new js.html.Uint8Array( buffer, byteoffset, len ); + } + } else { + this = null; + } + } + + @:arrayAccess @:extern inline function __set(idx:Int, val:UInt) : UInt return this[idx] = val; + @:arrayAccess @:extern inline function __get(idx:Int) : UInt return this[idx]; + + + //non spec haxe conversions + inline public static function fromBytes( bytes:haxe.io.Bytes, ?byteOffset:Int, ?len:Int ) : UInt8Array { + if(byteOffset == null) return new js.html.Uint8Array(cast bytes.getData()); + if(len == null) return new js.html.Uint8Array(cast bytes.getData(), byteOffset); + return new js.html.Uint8Array(cast bytes.getData(), byteOffset, len); + } + + inline public function toBytes() : haxe.io.Bytes { + return @:privateAccess new haxe.io.Bytes( cast new js.html.Uint8Array(this.buffer) ); + } + + inline function toString() return this != null ? 'UInt8Array [byteLength:${this.byteLength}, length:${this.length}]' : null; + + } + +#else + + import lime.utils.ArrayBufferView; + + @:forward + abstract UInt8Array(ArrayBufferView) from ArrayBufferView to ArrayBufferView { + + public inline static var BYTES_PER_ELEMENT : Int = 1; + + public var length (get, never):Int; + + @:generic + public inline function new( + ?elements:Int, + ?buffer:ArrayBuffer, + ?array:Array, + #if openfl ?vector:openfl.Vector, #end + ?view:ArrayBufferView, + ?byteoffset:Int = 0, ?len:Null + ) { + + if(elements != null) { + this = new ArrayBufferView( elements, Uint8 ); + } else if(array != null) { + this = new ArrayBufferView(0, Uint8).initArray(array); + #if openfl } else if(vector != null) { this = new ArrayBufferView(0, Uint8).initArray(untyped (vector).__array); #end + } else if(view != null) { + this = new ArrayBufferView(0, Uint8).initTypedArray(view); + } else if(buffer != null) { + this = new ArrayBufferView(0, Uint8).initBuffer(buffer, byteoffset, len); + } else { + throw "Invalid constructor arguments for UInt8Array"; + } + } + + //Public API + + public inline function subarray( begin:Int, end:Null = null) : UInt8Array return this.subarray(begin, end); + + + //non spec haxe conversions + inline public static function fromBytes( bytes:haxe.io.Bytes, ?byteOffset:Int=0, ?len:Int ) : UInt8Array { + return new UInt8Array(bytes, byteOffset, len); + } + + inline public function toBytes() : haxe.io.Bytes { + return this.buffer; + } + + //Internal + + inline function toString() return this != null ? 'UInt8Array [byteLength:${this.byteLength}, length:${this.length}]' : null; + + inline function get_length() return this.length; + + + @:noCompletion + @:arrayAccess @:extern + public inline function __get(idx:Int) { + return ArrayBufferIO.getUint8(this.buffer, this.byteOffset+idx); + } + + @:noCompletion + @:arrayAccess @:extern + public inline function __set(idx:Int, val:UInt) { + ArrayBufferIO.setUint8(this.buffer, this.byteOffset+idx, val); + return val; + } + + } + #end //!js \ No newline at end of file diff --git a/lime/utils/UInt8ClampedArray.hx b/src/lime/utils/UInt8ClampedArray.hx similarity index 100% rename from lime/utils/UInt8ClampedArray.hx rename to src/lime/utils/UInt8ClampedArray.hx diff --git a/templates/haxe/ApplicationMain.hx b/templates/haxe/ApplicationMain.hx index e9f8703c5..c6b4b7aaf 100644 --- a/templates/haxe/ApplicationMain.hx +++ b/templates/haxe/ApplicationMain.hx @@ -69,7 +69,7 @@ package; ManifestResources.init (config); - var preloader = new ::if (PRELOADER_NAME != "")::::PRELOADER_NAME::::else::lime.app.Preloader::end:: (); + var preloader = new ::if (PRELOADER_NAME != "")::::PRELOADER_NAME::::else::lime.utils.Preloader::end:: (); #if !munit var app = new ::APP_MAIN:: (); diff --git a/tools/utils/JavaExternGenerator.hx b/tools/utils/JavaExternGenerator.hx index bcbe4d565..bb8823222 100644 --- a/tools/utils/JavaExternGenerator.hx +++ b/tools/utils/JavaExternGenerator.hx @@ -766,7 +766,7 @@ class JavaExternGenerator java_out.close(); PathHelper.mkdir("compiled"); - var nme_path = getHaxelib("openfl") + "/backends/native/templates/android/template/src"; + var nme_path = getHaxelib("openfl") + "/__backends/native/templates/android/template/src"; ProcessHelper.runCommand ("", "javac", [ "-classpath", "\"classes/android.jar\";\"" + javaPath.substr (0, javaPath.length -1) + "\"", "-sourcepath", nme_path, "-d", "compiled", "stubs/" + java_name ], true, true, true); //Sys.setCwd("compiled");