Add iOS framework

This commit is contained in:
Panayot Cankov
2016-04-27 17:38:19 +03:00
parent 89dd21f357
commit 5f1a79ad5a
63 changed files with 925 additions and 205 deletions

2
.gitignore vendored
View File

@@ -16,7 +16,7 @@ proguard/
captures/
# Built application files
/*/build/
build/
## File-based project format:
*.ipr

View File

@@ -1,10 +1,25 @@
# Android-Widgets
Contains the source code of the `org.nativescript.widgets` library used by the NativeScript cross-platform modules implementation for Android.
Contains the source code of the `tns-core-modules-widgets` library.
This library contains native code (Java and Objective-C) used by the NativeScript core modules `tns-core-modules`.
## How to Build
On Mac in the root folder run:
```
gradle packFramework
./build.sh
```
This will run Android and iOS build and pack `dist/tns-core-modules-widgets-*.tgz`.
## How to Build Android
In the `android` folder run:
```
gradle build
```
This will output `android/build/widgets-release.aar`.
## How to Build iOS
On Mac in the `ios` folder under mac run:
```
./build.sh
```
This will output `ios/build/TNSWidgets.framework`.
This generates widgets-debug.aar and widgets-release.aar files located in the widgets/build/outputs/aar folder.
And generates tgz files in dist folder.

View File

View File

View File

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

View File

View File

View File

View File

View File

@@ -0,0 +1,73 @@
import groovy.json.JsonSlurper //used to parse package.json
import groovy.json.JsonBuilder
import groovy.json.JsonOutput
def isWinOs = System.properties['os.name'].toLowerCase().contains('windows')
apply plugin: 'com.android.library'
def computeCompuleSdkVersion () {
if(project.hasProperty("compileSdk")) {
return compileSdk
}
else {
return 23
}
}
def computeBuildToolsVersion() {
if(project.hasProperty("buildToolsVersion")) {
return buildToolsVersion
}
else {
return "22.0.1"
}
}
def computeTargetSdkVersion() {
if(project.hasProperty("targetSdk")) {
return targetSdk
}
else {
return 23
}
}
android {
compileSdkVersion computeCompuleSdkVersion()
buildToolsVersion computeBuildToolsVersion()
defaultConfig {
minSdkVersion 17
targetSdkVersion computeTargetSdkVersion()
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:+'
}
task cleanBuildDir (type: Delete) {
delete "../build/"
}
task copyAar << {
copy {
from "build/outputs/aar/widgets-release.aar"
into "../build/"
}
}
assembleRelease.dependsOn(cleanBuildDir)
copyAar.dependsOn(assembleRelease)
build.dependsOn(copyAar)

View File

View File

@@ -1,90 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

35
build.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/bin/sh
rm -rf dist
mkdir dist
mkdir dist/package
mkdir dist/package/platforms
echo "Build android"
mkdir dist/package/platforms/android
cd android
gradle build
cd ..
cp android/build/widgets-release.aar dist/package/platforms/android/widgets-release.aar
echo "Build ios"
mkdir dist/package/platforms/ios
cd ios
./build.sh
cd ..
cp -r ios/TNSWidgets/build/TNSWidgets.framework dist/package/platforms/ios/TNSWidgets.framework
echo "Copy NPM artefacts"
cp LICENSE dist/package/LICENSE
cp LICENSE.md dist/package/LICENSE.md
cp README.md dist/package/README.md
cp package.json dist/package/package.json
# npm pack
echo "NPM pack"
cd dist/package
PACKAGE="$(npm pack)"
cd ../..
mv dist/package/$PACKAGE dist/$PACKAGE
echo "Output: dist/$PACKAGE"

View File

@@ -0,0 +1,397 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
F98F5CB31CD0EFEA00978308 /* TNSWidgets.h in Headers */ = {isa = PBXBuildFile; fileRef = F98F5CB21CD0EFEA00978308 /* TNSWidgets.h */; settings = {ATTRIBUTES = (Public, ); }; };
F98F5CBA1CD0EFEA00978308 /* TNSWidgets.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F98F5CAF1CD0EFEA00978308 /* TNSWidgets.framework */; };
F98F5CBF1CD0EFEA00978308 /* TNSWidgetsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F98F5CBE1CD0EFEA00978308 /* TNSWidgetsTests.m */; };
F98F5CCB1CD0F09E00978308 /* UIImage+TNSBlocks.h in Headers */ = {isa = PBXBuildFile; fileRef = F98F5CC91CD0F09E00978308 /* UIImage+TNSBlocks.h */; settings = {ATTRIBUTES = (Public, ); }; };
F98F5CCC1CD0F09E00978308 /* UIImage+TNSBlocks.m in Sources */ = {isa = PBXBuildFile; fileRef = F98F5CCA1CD0F09E00978308 /* UIImage+TNSBlocks.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
F98F5CBB1CD0EFEA00978308 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = F98F5CA61CD0EFEA00978308 /* Project object */;
proxyType = 1;
remoteGlobalIDString = F98F5CAE1CD0EFEA00978308;
remoteInfo = TNSWidgets;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
F98F5CAF1CD0EFEA00978308 /* TNSWidgets.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TNSWidgets.framework; sourceTree = BUILT_PRODUCTS_DIR; };
F98F5CB21CD0EFEA00978308 /* TNSWidgets.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TNSWidgets.h; sourceTree = "<group>"; };
F98F5CB41CD0EFEA00978308 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F98F5CB91CD0EFEA00978308 /* TNSWidgetsTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = TNSWidgetsTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
F98F5CBE1CD0EFEA00978308 /* TNSWidgetsTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TNSWidgetsTests.m; sourceTree = "<group>"; };
F98F5CC01CD0EFEA00978308 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F98F5CC91CD0F09E00978308 /* UIImage+TNSBlocks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+TNSBlocks.h"; sourceTree = "<group>"; };
F98F5CCA1CD0F09E00978308 /* UIImage+TNSBlocks.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+TNSBlocks.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
F98F5CAB1CD0EFEA00978308 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
F98F5CB61CD0EFEA00978308 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F98F5CBA1CD0EFEA00978308 /* TNSWidgets.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
F98F5CA51CD0EFEA00978308 = {
isa = PBXGroup;
children = (
F98F5CB11CD0EFEA00978308 /* TNSWidgets */,
F98F5CBD1CD0EFEA00978308 /* TNSWidgetsTests */,
F98F5CB01CD0EFEA00978308 /* Products */,
);
sourceTree = "<group>";
};
F98F5CB01CD0EFEA00978308 /* Products */ = {
isa = PBXGroup;
children = (
F98F5CAF1CD0EFEA00978308 /* TNSWidgets.framework */,
F98F5CB91CD0EFEA00978308 /* TNSWidgetsTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
F98F5CB11CD0EFEA00978308 /* TNSWidgets */ = {
isa = PBXGroup;
children = (
F98F5CB21CD0EFEA00978308 /* TNSWidgets.h */,
F98F5CC91CD0F09E00978308 /* UIImage+TNSBlocks.h */,
F98F5CCA1CD0F09E00978308 /* UIImage+TNSBlocks.m */,
F98F5CB41CD0EFEA00978308 /* Info.plist */,
);
path = TNSWidgets;
sourceTree = "<group>";
};
F98F5CBD1CD0EFEA00978308 /* TNSWidgetsTests */ = {
isa = PBXGroup;
children = (
F98F5CBE1CD0EFEA00978308 /* TNSWidgetsTests.m */,
F98F5CC01CD0EFEA00978308 /* Info.plist */,
);
path = TNSWidgetsTests;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
F98F5CAC1CD0EFEA00978308 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
F98F5CB31CD0EFEA00978308 /* TNSWidgets.h in Headers */,
F98F5CCB1CD0F09E00978308 /* UIImage+TNSBlocks.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
F98F5CAE1CD0EFEA00978308 /* TNSWidgets */ = {
isa = PBXNativeTarget;
buildConfigurationList = F98F5CC31CD0EFEA00978308 /* Build configuration list for PBXNativeTarget "TNSWidgets" */;
buildPhases = (
F98F5CAA1CD0EFEA00978308 /* Sources */,
F98F5CAB1CD0EFEA00978308 /* Frameworks */,
F98F5CAC1CD0EFEA00978308 /* Headers */,
F98F5CAD1CD0EFEA00978308 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = TNSWidgets;
productName = TNSWidgets;
productReference = F98F5CAF1CD0EFEA00978308 /* TNSWidgets.framework */;
productType = "com.apple.product-type.framework";
};
F98F5CB81CD0EFEA00978308 /* TNSWidgetsTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = F98F5CC61CD0EFEA00978308 /* Build configuration list for PBXNativeTarget "TNSWidgetsTests" */;
buildPhases = (
F98F5CB51CD0EFEA00978308 /* Sources */,
F98F5CB61CD0EFEA00978308 /* Frameworks */,
F98F5CB71CD0EFEA00978308 /* Resources */,
);
buildRules = (
);
dependencies = (
F98F5CBC1CD0EFEA00978308 /* PBXTargetDependency */,
);
name = TNSWidgetsTests;
productName = TNSWidgetsTests;
productReference = F98F5CB91CD0EFEA00978308 /* TNSWidgetsTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
F98F5CA61CD0EFEA00978308 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Telerik A D";
TargetAttributes = {
F98F5CAE1CD0EFEA00978308 = {
CreatedOnToolsVersion = 7.2;
};
F98F5CB81CD0EFEA00978308 = {
CreatedOnToolsVersion = 7.2;
};
};
};
buildConfigurationList = F98F5CA91CD0EFEA00978308 /* Build configuration list for PBXProject "TNSWidgets" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = F98F5CA51CD0EFEA00978308;
productRefGroup = F98F5CB01CD0EFEA00978308 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
F98F5CAE1CD0EFEA00978308 /* TNSWidgets */,
F98F5CB81CD0EFEA00978308 /* TNSWidgetsTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
F98F5CAD1CD0EFEA00978308 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
F98F5CB71CD0EFEA00978308 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
F98F5CAA1CD0EFEA00978308 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F98F5CCC1CD0F09E00978308 /* UIImage+TNSBlocks.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
F98F5CB51CD0EFEA00978308 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F98F5CBF1CD0EFEA00978308 /* TNSWidgetsTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
F98F5CBC1CD0EFEA00978308 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = F98F5CAE1CD0EFEA00978308 /* TNSWidgets */;
targetProxy = F98F5CBB1CD0EFEA00978308 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
F98F5CC11CD0EFEA00978308 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
F98F5CC21CD0EFEA00978308 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.2;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
F98F5CC41CD0EFEA00978308 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = TNSWidgets/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.nativescript.TNSWidgets;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
F98F5CC51CD0EFEA00978308 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = TNSWidgets/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.nativescript.TNSWidgets;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
F98F5CC71CD0EFEA00978308 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = TNSWidgetsTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.nativescript.TNSWidgetsTests;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
F98F5CC81CD0EFEA00978308 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = TNSWidgetsTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = org.nativescript.TNSWidgetsTests;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
F98F5CA91CD0EFEA00978308 /* Build configuration list for PBXProject "TNSWidgets" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F98F5CC11CD0EFEA00978308 /* Debug */,
F98F5CC21CD0EFEA00978308 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
F98F5CC31CD0EFEA00978308 /* Build configuration list for PBXNativeTarget "TNSWidgets" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F98F5CC41CD0EFEA00978308 /* Debug */,
F98F5CC51CD0EFEA00978308 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
F98F5CC61CD0EFEA00978308 /* Build configuration list for PBXNativeTarget "TNSWidgetsTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
F98F5CC71CD0EFEA00978308 /* Debug */,
F98F5CC81CD0EFEA00978308 /* Release */,
);
defaultConfigurationIsVisible = 0;
};
/* End XCConfigurationList section */
};
rootObject = F98F5CA61CD0EFEA00978308 /* Project object */;
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:TNSWidgets.xcodeproj">
</FileRef>
</Workspace>

View File

@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F98F5CAE1CD0EFEA00978308"
BuildableName = "TNSWidgets.framework"
BlueprintName = "TNSWidgets"
ReferencedContainer = "container:TNSWidgets.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F98F5CB81CD0EFEA00978308"
BuildableName = "TNSWidgetsTests.xctest"
BlueprintName = "TNSWidgetsTests"
ReferencedContainer = "container:TNSWidgets.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F98F5CAE1CD0EFEA00978308"
BuildableName = "TNSWidgets.framework"
BlueprintName = "TNSWidgets"
ReferencedContainer = "container:TNSWidgets.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F98F5CAE1CD0EFEA00978308"
BuildableName = "TNSWidgets.framework"
BlueprintName = "TNSWidgets"
ReferencedContainer = "container:TNSWidgets.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F98F5CAE1CD0EFEA00978308"
BuildableName = "TNSWidgets.framework"
BlueprintName = "TNSWidgets"
ReferencedContainer = "container:TNSWidgets.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>TNSWidgets.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>F98F5CAE1CD0EFEA00978308</key>
<dict>
<key>primary</key>
<true/>
</dict>
<key>F98F5CB81CD0EFEA00978308</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@@ -0,0 +1,20 @@
//
// TNSWidgets.h
// TNSWidgets
//
// Created by Panayot Cankov on 4/27/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for TNSWidgets.
FOUNDATION_EXPORT double TNSWidgetsVersionNumber;
//! Project version string for TNSWidgets.
FOUNDATION_EXPORT const unsigned char TNSWidgetsVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <TNSWidgets/PublicHeader.h>
#import "UIImage+TNSBlocks.h"

View File

@@ -0,0 +1,15 @@
//
// UIImage+UIImage_Async.h
// TKImageAsync
//
// Created by Panayot Cankov on 4/18/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
@interface UIImage (TNSBlocks)
+ (void) tns_imageNamed: (NSString*) name completion: (void (^) (UIImage*))callback;
@end

View File

@@ -0,0 +1,37 @@
//
// UIImage+UIImage_Async.m
// TKImageAsync
//
// Created by Panayot Cankov on 4/18/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "UIImage+TNSBlocks.h"
@implementation UIImage (TNSBlocks)
static dispatch_queue_t image_queue;
+ (void) initialize {
image_queue = dispatch_queue_create("org.nativescript.TNSWidgets.image", NULL);
}
- (void) tns_decompressImage {
CGImageRef cgImg = [self CGImage];
// TODO: Do performance tests if actual drawing is necessary
// UIGraphicsBeginImageContext(CGSizeMake(1, 1));
// [self drawAtPoint:CGPointZero];
// UIGraphicsEndImageContext();
}
+ (void) tns_imageNamed: (NSString*) name completion: (void (^) (UIImage*))callback {
dispatch_async(image_queue, ^(void){
UIImage* image = [UIImage imageNamed: name];
[image tns_decompressImage];
dispatch_async(dispatch_get_main_queue(), ^(void) {
callback(image);
});
});
}
@end

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View File

@@ -0,0 +1,39 @@
//
// TNSWidgetsTests.m
// TNSWidgetsTests
//
// Created by Panayot Cankov on 4/27/16.
// Copyright © 2016 Telerik A D. All rights reserved.
//
#import <XCTest/XCTest.h>
@interface TNSWidgetsTests : XCTestCase
@end
@implementation TNSWidgetsTests
- (void)setUp {
[super setUp];
// Put setup code here. This method is called before the invocation of each test method in the class.
}
- (void)tearDown {
// Put teardown code here. This method is called after the invocation of each test method in the class.
[super tearDown];
}
- (void)testExample {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
}
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
// Put the code you want to measure the time of here.
}];
}
@end

16
ios/build.sh Executable file
View File

@@ -0,0 +1,16 @@
echo "Build for iphonesimulator"
xcodebuild -project TNSWidgets/TNSWidgets.xcodeproj -sdk iphonesimulator -target TNSWidgets -configuration Release clean build CONFIGURATION_BUILD_DIR=build/Release-iphonesimulator
echo "Build for iphoneos"
xcodebuild -project TNSWidgets/TNSWidgets.xcodeproj -sdk iphoneos -target TNSWidgets -configuration Release clean build CONFIGURATION_BUILD_DIR=build/Release-iphoneos
echo "Build fat framework at TNSWidgets/build/TNSWidgets.framework"
rm -rf TNSWidgets/build/TNSWidgets.framework
mkdir TNSWidgets/build/TNSWidgets.framework
cp -r TNSWidgets/build/Release-iphoneos/TNSWidgets.framework/Headers TNSWidgets/build/TNSWidgets.framework/Headers
cp -r TNSWidgets/build/Release-iphoneos/TNSWidgets.framework/Modules TNSWidgets/build/TNSWidgets.framework/Modules
cp -r TNSWidgets/build/Release-iphoneos/TNSWidgets.framework/Info.plist TNSWidgets/build/TNSWidgets.framework/Info.plist
lipo -create TNSWidgets/build/Release-iphoneos/TNSWidgets.framework/TNSWidgets TNSWidgets/build/Release-iphonesimulator/TNSWidgets.framework/TNSWidgets -o TNSWidgets/build/TNSWidgets.framework/TNSWidgets
file TNSWidgets/build/TNSWidgets.framework/TNSWidgets

View File

@@ -1,110 +0,0 @@
import groovy.json.JsonSlurper //used to parse package.json
import groovy.json.JsonBuilder
import groovy.json.JsonOutput
def isWinOs = System.properties['os.name'].toLowerCase().contains('windows')
apply plugin: 'com.android.library'
def computeCompuleSdkVersion () {
if(project.hasProperty("compileSdk")) {
return compileSdk
}
else {
return 23
}
}
def computeBuildToolsVersion() {
if(project.hasProperty("buildToolsVersion")) {
return buildToolsVersion
}
else {
return "22.0.1"
}
}
def computeTargetSdkVersion() {
if(project.hasProperty("targetSdk")) {
return targetSdk
}
else {
return 23
}
}
android {
compileSdkVersion computeCompuleSdkVersion()
buildToolsVersion computeBuildToolsVersion()
defaultConfig {
minSdkVersion 17
targetSdkVersion computeTargetSdkVersion()
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:support-v4:+'
}
task cleanDistDir (type: Delete) {
delete "../dist/"
}
task fixVersion << {
if(project.hasProperty("PACKAGE_VERSION")) {
def inputFile = new File("../package.json")
def json = new JsonSlurper().parseText(inputFile.text)
json.version = json.version + "-" + PACKAGE_VERSION
def jb = new JsonBuilder(json);
inputFile.text = JsonOutput.prettyPrint(jb.toString())
}
}
task copyAar << {
copy {
from "../package.json"
into "../dist"
}
copy {
from "build/outputs/aar/widgets-release.aar"
into "../dist/platforms/android/"
}
}
task revertPackageJson (type: Exec) {
if(isWinOs) {
commandLine "cmd", "/c", "git", "checkout", "--", "../package.json"
}
else {
commandLine "git", "checkout", "--", "../package.json"
}
}
task packFramework (type: Exec) {
workingDir "../dist"
if(isWinOs) {
commandLine "cmd", "/c", "npm", "pack"
}
else {
commandLine "npm", "pack"
}
}
assembleRelease.dependsOn(cleanDistDir)
fixVersion.dependsOn(assembleRelease)
copyAar.dependsOn(fixVersion)
revertPackageJson.dependsOn(copyAar)
packFramework.dependsOn(revertPackageJson)