Skip to content

Commit 77585ad

Browse files
committed
feat: commonGradleProperties
1 parent 501f884 commit 77585ad

File tree

19 files changed

+127
-101
lines changed

19 files changed

+127
-101
lines changed

RUNTIME.iml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
99
<excludeFolder url="file://$MODULE_DIR$/build" />
1010
</content>
11-
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
11+
<orderEntry type="jdk" jdkName="11" jdkType="JavaSDK" />
1212
<orderEntry type="sourceFolder" forTests="false" />
1313
</component>
1414
</module>

build-artifacts/project-template-gradle/app/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<activity
2222
android:name="com.tns.NativeScriptActivity"
2323
android:label="@string/title_activity_kimera"
24+
android:exported="true"
2425
android:configChanges="keyboardHidden|orientation|screenSize">
2526

2627
<intent-filter>
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<color name="ns_accent">#3d5afe</color>
3+
<color name="ns_accent">#65adf1</color>
44
</resources>

build-artifacts/project-template-gradle/app/src/main/res/values/colors.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
<resources>
33
<color name="ns_primary">#F5F5F5</color>
44
<color name="ns_primaryDark">#757575</color>
5-
<color name="ns_accent">#33B5E5</color>
5+
<color name="ns_accent">#65adf1</color>
66
</resources>

build-artifacts/project-template-gradle/gradle.properties

+2-25
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,5 @@ org.gradle.jvmargs=-Xmx16384M
1919
android.enableJetifier=true
2020
android.useAndroidX=true
2121

22-
23-
BUILD_TOOLS_VERSION=31.0.0
24-
COMPILE_SDK_VERSION=31
25-
MIN_SDK_VERSION=19
26-
ANDRIOD_BUILD_TOOLS_VERSION = 7.0.2
27-
28-
gson_version = 2.8.6
29-
bcel_version = 6.2
30-
junit_version = 4.13.2
31-
mockito_core_version = 3.0.0
32-
kotlin_version = 1.5.21
33-
kotlinx_metadata_jvm_version = 0.3.0
34-
android_x_app_compat_version = 1.3.1
35-
android_x_material_version = 1.4.0
36-
android_x_exif_interface_version = 1.3.2
37-
android_x_view_pager_version = 1.0.0
38-
android_x_fragment_version = 1.3.6
39-
android_x_transition_version = 1.4.1
40-
android_x_multidex_version = 2.0.1
41-
commons_io_version = 2.6
42-
spotbugs_version = 3.1.12
43-
google_java_format_version = 1.6
44-
json_version = 20180813
45-
asm_util_version = 7.0
46-
asm_version = 7.0
22+
# Load common gradle properties
23+
commonPropertiesPath=common.gradle.properties

build.gradle

+5
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ task copyFilesToProjectTemeplate {
299299
from "$TEST_APP_PATH/build.gradle"
300300
into "$DIST_FRAMEWORK_PATH"
301301
}
302+
copy {
303+
from "$rootDir/gradle.properties"
304+
into "$DIST_FRAMEWORK_PATH"
305+
rename "gradle.properties", "common.gradle.properties"
306+
}
302307
copy {
303308
from "$TEST_APP_PATH/gradle-helpers/paths.gradle"
304309
into "$DIST_FRAMEWORK_PATH/gradle-helpers"

gradle.properties

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Common gradle properties
2+
3+
BUILD_TOOLS_VERSION=31.0.0
4+
COMPILE_SDK_VERSION=31
5+
MIN_SDK_VERSION=17
6+
ANDRIOD_BUILD_TOOLS_VERSION=7.1.2
7+
8+
gson_version = 2.9.0
9+
bcel_version = 6.5.0
10+
junit_version = 4.13.2
11+
mockito_core_version = 3.0.0
12+
kotlinx_metadata_jvm_version = 0.4.2
13+
kotlin_version = 1.6.0
14+
android_x_app_compat_version = 1.4.1
15+
android_x_material_version = 1.5.0
16+
android_x_exif_interface_version = 1.3.3
17+
android_x_view_pager_version = 1.0.0
18+
android_x_fragment_version = 1.4.1
19+
android_x_transition_version = 1.4.1
20+
android_x_multidex_version = 2.0.1
21+
commons_io_version = 2.6
22+
spotbugs_version = 3.1.12
23+
google_java_format_version = 1.6
24+
json_version = 20180813
25+
asm_util_version = 7.0
26+
asm_version = 7.0

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip

package.json

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
{
22
"name": "@nativescript/android",
33
"description": "NativeScript Runtime for Android",
4-
"version": "7.0.1",
4+
"version": "8.2.0-dev.0",
55
"repository": {
66
"type": "git",
77
"url": "https://github.com/NativeScript/android-runtime.git"
88
},
99
"files": [
1010
"**/*"
1111
],
12-
"gradle": {
13-
"version": "6.4",
14-
"android": "3.6.4"
12+
"version_info":{
13+
"v8": "8.3.110.9",
14+
"gradle": "7.4",
15+
"gradleAndroid": "7.1.2",
16+
"ndk": "r21",
17+
"ndkApiLevel": "122",
18+
"minSdk": "17",
19+
"compileSdk": "31",
20+
"buildTools":"31.0.0",
21+
"kotlin":"1.6.0"
1522
},
16-
"android_ndk_version": "21b",
17-
"publishConfig": {"tag":"next", "access": "public"}
23+
"publishConfig": {"tag":"alpha", "access": "public"}
1824
}

test-app/app/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ repositories {
302302
}
303303

304304
dependencies {
305+
// println "\t ~ [DEBUG][app] build.gradle - android_x_app_compat_version = ${android_x_app_compat_version}..."
305306

306307
def androidXAppCompatVersion = "${android_x_app_compat_version}"
307308
if (project.hasProperty("androidXAppCompat")) {

test-app/build-tools/android-metadata-generator/build.gradle

+11-8
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ apply plugin: 'kotlin'
44
sourceCompatibility = JavaVersion.VERSION_1_8
55
targetCompatibility = JavaVersion.VERSION_1_8
66

7-
if(!project.hasProperty("loadedProjectDeps")){
8-
Properties projectDeps = new Properties()
9-
projectDeps.load(new FileInputStream("$project.rootDir/gradle.properties"))
10-
projectDeps.each { prop ->
11-
project.ext.set(prop.key, prop.value)
12-
}
13-
project.ext.loadedProjectDeps = true
14-
}
7+
// todo: check if still needed
8+
// if(!project.hasProperty("loadedProjectDeps")){
9+
// Properties projectDeps = new Properties()
10+
// projectDeps.load(new FileInputStream("$project.rootDir/gradle.properties"))
11+
// projectDeps.each { prop ->
12+
// project.ext.set(prop.key, prop.value)
13+
// }
14+
// project.ext.loadedProjectDeps = true
15+
// }
1516

1617
buildscript {
1718
repositories {
@@ -52,6 +53,8 @@ repositories {
5253
}
5354

5455
dependencies {
56+
// println "\t ~ [DEBUG][android-metadata-generator] build.gradle - bcel_version = ${bcel_version}..."
57+
5558
api "org.apache.bcel:bcel:${bcel_version}"
5659
api "com.google.code.gson:gson:${gson_version}"
5760
api group: 'org.jetbrains.kotlinx', name: 'kotlinx-metadata-jvm', version: "${kotlinx_metadata_jvm_version}"

test-app/build-tools/static-binding-generator/build.gradle

+9-8
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ apply plugin: 'java-library'
33
sourceCompatibility = JavaVersion.VERSION_1_8
44
targetCompatibility = JavaVersion.VERSION_1_8
55

6-
if(!project.hasProperty("loadedProjectDeps")){
7-
Properties projectDeps = new Properties()
8-
projectDeps.load(new FileInputStream("$project.rootDir/gradle.properties"))
9-
projectDeps.each { prop ->
10-
project.ext.set(prop.key, prop.value)
11-
}
12-
project.ext.loadedProjectDeps = true
13-
}
6+
// todo: check if still needed
7+
// if(!project.hasProperty("loadedProjectDeps")){
8+
// Properties projectDeps = new Properties()
9+
// projectDeps.load(new FileInputStream("$project.rootDir/gradle.properties"))
10+
// projectDeps.each { prop ->
11+
// project.ext.set(prop.key, prop.value)
12+
// }
13+
// project.ext.loadedProjectDeps = true
14+
// }
1415

1516
repositories {
1617
google()

test-app/build-tools/static-binding-generator/runtests.gradle

+11-10
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ import java.nio.file.StandardCopyOption
44
apply plugin: 'application'
55
apply plugin: 'java-library'
66

7-
8-
if(!project.hasProperty("loadedProjectDeps")){
9-
Properties projectDeps = new Properties()
10-
projectDeps.load(new FileInputStream("$project.rootDir/gradle.properties"))
11-
projectDeps.each { prop ->
12-
project.ext.set(prop.key, prop.value)
13-
}
14-
project.ext.loadedProjectDeps = true
15-
}
16-
7+
// todo: check if still needed
8+
// if(!project.hasProperty("loadedProjectDeps")){
9+
// Properties projectDeps = new Properties()
10+
// projectDeps.load(new FileInputStream("$project.rootDir/gradle.properties"))
11+
// projectDeps.each { prop ->
12+
// project.ext.set(prop.key, prop.value)
13+
// }
14+
// project.ext.loadedProjectDeps = true
15+
// }
1716

1817
defaultTasks 'runSbg'
1918

@@ -23,6 +22,8 @@ repositories {
2322
}
2423

2524
dependencies {
25+
// println "\t ~ [DEBUG][static-binding-generator] runtests.gradle - asm_version = ${asm_version}..."
26+
2627
api "org.ow2.asm:asm:${asm_version}"
2728
api "org.ow2.asm:asm-util:${asm_util_version}"
2829
api "org.apache.bcel:bcel:${bcel_version}"

test-app/build.gradle

+27-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,33 @@ import static org.gradle.internal.logging.text.StyledTextOutput.Style
1111
buildscript {
1212

1313
def initialize = { ->
14+
// set up our logger
15+
project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
16+
17+
try {
18+
// Load common properties if there's a commonPropertiesPath set
19+
if(project.hasProperty("loadedCommonProperties")) {
20+
logger.info "\t + common gradle properties already loaded. SKIPPING"
21+
}
22+
23+
if(project.hasProperty("commonPropertiesPath") && !project.hasProperty("loadedCommonProperties")) {
24+
def commonPropertiesPathFull = Paths.get("$rootDir").resolve("$commonPropertiesPath").toRealPath()
25+
logger.info "\t + trying to load common gradle properties from \"$commonPropertiesPath\" (resolved to: \"$commonPropertiesPathFull\")"
26+
27+
Properties commonProperties = new Properties()
28+
commonProperties.load(new FileInputStream("$commonPropertiesPathFull"))
29+
commonProperties.each { prop ->
30+
logger.info "\t + [common properties] setting ${prop.key} = ${prop.value}"
31+
project.ext.set(prop.key, prop.value)
32+
}
33+
project.ext.loadedCommonProperties = true
34+
35+
outLogger.withStyle(Style.SuccessHeader).println "\t + loaded common gradle properties from \"$commonPropertiesPath\" (resolved to: \"$commonPropertiesPathFull\")"
36+
}
37+
} catch(Exception ex) {
38+
logger.warn "\t + failed to load common gradle properties. Error is: ${ex.getMessage()}"
39+
}
40+
1441
def userDir = "${rootProject.projectDir}/../.."
1542
apply from: "$rootDir/gradle-helpers/user_properties_reader.gradle"
1643
apply from: "$rootDir/gradle-helpers/paths.gradle"
@@ -43,10 +70,6 @@ version of the {N} CLI install a previous version of the runtime package - 'tns
4370
project.ext.PLATFORMS_ANDROID = "platforms/android"
4471
project.ext.USER_PROJECT_ROOT = "$rootDir/../.."
4572

46-
47-
48-
project.ext.outLogger = services.get(StyledTextOutputFactory).create("colouredOutputLogger")
49-
5073
project.ext.getAppPath = { ->
5174
def relativePathToApp = "app"
5275
def nsConfigFile = file("$USER_PROJECT_ROOT/nsconfig.json")

test-app/gradle.properties

+2-27
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,13 @@ org.gradle.jvmargs=-Xmx1536m
1919
# Uncomment the following line in order to enable Gradle debugging.
2020
# org.gradle.debug=true
2121

22-
23-
24-
2522
android.enableJetifier=true
2623
android.useAndroidX=true
2724
useKotlin=true
2825
gatherAnalyticsData=true
2926

30-
BUILD_TOOLS_VERSION=31.0.0
31-
COMPILE_SDK_VERSION=31
32-
MIN_SDK_VERSION=17
33-
ANDRIOD_BUILD_TOOLS_VERSION=7.1.0
34-
35-
gson_version = 2.8.6
36-
bcel_version = 6.5.0
37-
junit_version = 4.13.2
38-
mockito_core_version = 3.0.0
39-
kotlinx_metadata_jvm_version = 0.3.0
40-
kotlin_version = 1.6.0
41-
android_x_app_compat_version = 1.3.1
42-
android_x_material_version = 1.4.0
43-
android_x_exif_interface_version = 1.3.2
44-
android_x_view_pager_version = 1.0.0
45-
android_x_fragment_version = 1.3.6
46-
android_x_transition_version = 1.4.1
47-
android_x_multidex_version = 2.0.1
48-
commons_io_version = 2.6
49-
spotbugs_version = 3.1.12
50-
google_java_format_version = 1.6
51-
json_version = 20180813
52-
asm_util_version = 7.0
53-
asm_version = 7.0
27+
# Load common properties from root
28+
commonPropertiesPath=../gradle.properties
5429

5530
# When configured, Gradle will run in incubating parallel mode.
5631
# This option should only be used with decoupled projects. More details, visit
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue May 12 21:42:57 CEST 2020
1+
#Sat Mar 05 12:37:00 CET 2022
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
apply plugin: 'java-library'
22

33
dependencies {
4-
testImplementation 'junit:junit:4.13.2'
4+
// println "\t ~ [DEBUG][runtime-binding-generator] build.gradle - junit_version = ${junit_version}..."
5+
6+
testImplementation "junit:junit:${junit_version}"
57
}
68

79
sourceCompatibility = JavaVersion.VERSION_1_7
8-
targetCompatibility = JavaVersion.VERSION_1_7
10+
targetCompatibility = JavaVersion.VERSION_1_7
11+
12+
// Disable compilation tasks as these are compiled *with* the runtime and not separately
13+
compileJava.enabled = false
14+
compileTestJava.enabled = false

test-app/runtime/build.gradle

+5-4
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ if(!hasNdkDirectory){
4848
}
4949
println "Runtime using NDK_PATH: " + NDK_PATH
5050

51-
52-
5351
android {
5452

5553
compileSdkVersion COMPILE_SDK_VERSION as int
@@ -139,13 +137,16 @@ allprojects {
139137
}
140138

141139
dependencies {
140+
// println "\t ~ [DEBUG][runtime] build.gradle - junit_version = ${junit_version}..."
141+
142142
implementation fileTree(include: ['*.jar'], dir: 'libs')
143-
testImplementation 'junit:junit:4.13.2'
144-
testImplementation 'org.mockito:mockito-core:3.0.0'
143+
testImplementation "junit:junit:${junit_version}"
144+
testImplementation "org.mockito:mockito-core:${mockito_core_version}"
145145
}
146146

147147
tasks.whenTaskAdded { task ->
148148
def taskName = task.getName()
149+
// println "\t ~ [DEBUG][runtime] build.gradle whenTaskAdded taskName = ${taskName}"
149150
if (taskName.contains("externalNativeBuildRelease")) {
150151
setRuntimeCommit.dependsOn(setPackageVersion)
151152
task.dependsOn(setRuntimeCommit)

0 commit comments

Comments
 (0)