[build] rework scripts to new build system

This commit is contained in:
tobrun
2019-10-09 14:19:03 +02:00
committed by Tobrun
parent 83acc3ad3e
commit 7acfd3a243
12 changed files with 92 additions and 38 deletions

5
.gitignore vendored
View File

@@ -32,4 +32,7 @@ MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/acti
MapboxGLAndroidSDKTestApp/src/main/assets/integration/
# Local AS configuration file
gradle.properties
gradle.properties
# Node modules
node_modules

View File

@@ -64,7 +64,7 @@ make aproj
#### linux
run `make android-configuration` in the root folder of the project and open the Android Studio project in `/platform/android`.
run `make android-configuration` in the root folder of the project and open in Android Studio.
If you are using Arch Linux, install [ncurses5-compat-libs](https://aur.archlinux.org/packages/ncurses5-compat-libs).
@@ -88,7 +88,7 @@ With the first gradle invocation, gradle will take the value of the `MAPBOX_ACCE
Run the configuration for the `MapboxGLAndroidSDKTestApp` module and select a device or emulator to deploy on. Based on the selected device, the c++ code will be compiled for the related processor architecture. You can see the project compiling in the `View > Tool Windows > Gradle Console`.
More information about building and distributing this project in [DISTRIBUTE.md](https://github.com/mapbox/mapbox-gl-native/blob/master/platform/android/DISTRIBUTE.md).
More information about building and distributing this project in [DISTRIBUTE.md](DISTRIBUTE.md).
### Additional resources

View File

@@ -51,7 +51,7 @@ private def verifyVendorSubmodulePin(def dir, def prefix, def version) {
throw new IllegalStateException("${dir} vendor repository is not checked out on the consumed binary's tag.\n" +
"Expected commit: " + expectedCommit + "(${prefix + version} tag).\n" +
"Actual commit: " + actualCommit + ".\n" +
"If you've updated the version in the dependencies.gradle file, make sure to bump the submodule pin in the platform/android/vendor/ directory to match the release tag.\n" +
"If you've updated the version in the dependencies.gradle file, make sure to bump the submodule pin in the /vendor directory to match the release tag.\n" +
"If you've bumped the pin, make sure to verify the version tag prefix in the android-nitpick.gradle file.")
}
output.close()

26
package-lock.json generated Normal file
View File

@@ -0,0 +1,26 @@
{
"name": "@mapbox/mapbox-gl-native-android",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"ejs": {
"version": "2.7.1",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-2.7.1.tgz",
"integrity": "sha512-kS/gEPzZs3Y1rRsbGX4UOSjtP/CeJP0CxSNZHYxGfVM/VgLcv0ZqM7C45YyTj2DI2g7+P9Dd24C+IMIg6D0nYQ==",
"dev": true
},
"esm": {
"version": "3.0.84",
"resolved": "https://registry.npmjs.org/esm/-/esm-3.0.84.tgz",
"integrity": "sha512-SzSGoZc17S7P+12R9cg21Bdb7eybX25RnIeRZ80xZs+VZ3kdQKzqTp2k4hZJjR7p9l0186TTXSgrxzlMDBktlw==",
"dev": true
},
"lodash": {
"version": "4.17.15",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==",
"dev": true
}
}
}

25
package.json Normal file
View File

@@ -0,0 +1,25 @@
{
"name": "@mapbox/mapbox-gl-native-android",
"version": "1.0.0",
"description": "Renders map tiles with the Mapbox Maps SDK for Android",
"keywords": [
"mapbox",
"gl"
],
"repository": {
"type": "git",
"url": "git@github.com:mapbox/mapbox-gl-native-android.git"
},
"license": "BSD-2-Clause",
"dependencies": {},
"devDependencies": {
"ejs": "^2.5.7",
"esm": "~3.0.84",
"lodash": "^4.16.4",
"pixelmatch": "^4.0.2"
},
"engines": {
"node": ">=6"
},
"scripts": {}
}

View File

@@ -3,11 +3,11 @@
import os
import json
path = os.getcwd() + "/platform/android/"
with open(path + "LICENSE.md", 'w') as licenseFile:
path = os.getcwd()
with open(path + "/LICENSE.md", 'w') as licenseFile:
licenseFile.write("<!-- This file was generated. Use `make android-license` to update. --> \n")
licenseFile.write("## Additional Mapbox GL licenses \n")
with open(path + "MapboxGLAndroidSDK/build/reports/licenses/licenseReleaseReport.json", 'r') as dataFile:
with open(path + "/MapboxGLAndroidSDK/build/reports/licenses/licenseReleaseReport.json", 'r') as dataFile:
data = json.load(dataFile)
gradleLicensePlugin ="""

View File

@@ -3,7 +3,7 @@
const fs = require('fs');
const ejs = require('ejs');
const spec = require('../../../scripts/style-spec');
const spec = require('../vendor/mapbox-gl-native/scripts/style-spec');
const _ = require('lodash');
// FIXME: https://github.com/mapbox/mapbox-gl-native/issues/15008
@@ -11,7 +11,7 @@ delete spec.layout_circle["circle-sort-key"]
delete spec.layout_line["line-sort-key"]
delete spec.layout_fill["fill-sort-key"]
require('../../../scripts/style-code');
require('../vendor/mapbox-gl-native/scripts/style-code');
// Specification parsing //
const lightProperties = Object.keys(spec[`light`]).reduce((memo, name) => {
@@ -361,34 +361,34 @@ global.supportsPropertyFunction = function (property) {
// Template processing //
// Java + JNI Light (Peer model)
const lightJava = ejs.compile(fs.readFileSync('platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/light.java.ejs', 'utf8'), {strict: true});
const lightJavaUnitTests = ejs.compile(fs.readFileSync('platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs', 'utf8'), {strict: true});
writeIfModified(`platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java`, lightJava({properties: lightProperties}));
writeIfModified(`platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LightTest.java`, lightJavaUnitTests({properties: lightProperties}));
const lightJava = ejs.compile(fs.readFileSync('MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/light.java.ejs', 'utf8'), {strict: true});
const lightJavaUnitTests = ejs.compile(fs.readFileSync('MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/light.junit.ejs', 'utf8'), {strict: true});
writeIfModified(`MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/light/Light.java`, lightJava({properties: lightProperties}));
writeIfModified(`MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LightTest.java`, lightJavaUnitTests({properties: lightProperties}));
// Java + JNI Layers (Peer model)
const layerHpp = ejs.compile(fs.readFileSync('platform/android/src/style/layers/layer.hpp.ejs', 'utf8'), {strict: true});
const layerCpp = ejs.compile(fs.readFileSync('platform/android/src/style/layers/layer.cpp.ejs', 'utf8'), {strict: true});
const layerJava = ejs.compile(fs.readFileSync('platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs', 'utf8'), {strict: true});
const layerJavaUnitTests = ejs.compile(fs.readFileSync('platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs', 'utf8'), {strict: true});
const layerHpp = ejs.compile(fs.readFileSync('src/style/layers/layer.hpp.ejs', 'utf8'), {strict: true});
const layerCpp = ejs.compile(fs.readFileSync('src/style/layers/layer.cpp.ejs', 'utf8'), {strict: true});
const layerJava = ejs.compile(fs.readFileSync('MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs', 'utf8'), {strict: true});
const layerJavaUnitTests = ejs.compile(fs.readFileSync('MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs', 'utf8'), {strict: true});
for (const layer of layers) {
writeIfModified(`platform/android/src/style/layers/${layer.type.replace('-', '_')}_layer.hpp`, layerHpp(layer));
writeIfModified(`platform/android/src/style/layers/${layer.type.replace('-', '_')}_layer.cpp`, layerCpp(layer));
writeIfModified(`platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/${camelize(layer.type)}Layer.java`, layerJava(layer));
writeIfModified(`platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/${camelize(layer.type)}LayerTest.java`, layerJavaUnitTests(layer));
writeIfModified(`src/style/layers/${layer.type.replace('-', '_')}_layer.hpp`, layerHpp(layer));
writeIfModified(`src/style/layers/${layer.type.replace('-', '_')}_layer.cpp`, layerCpp(layer));
writeIfModified(`MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/${camelize(layer.type)}Layer.java`, layerJava(layer));
writeIfModified(`MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/${camelize(layer.type)}LayerTest.java`, layerJavaUnitTests(layer));
}
// Java PropertyFactory
const propertiesTemplate = ejs.compile(fs.readFileSync('platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs', 'utf8'), {strict: true});
const propertiesTemplate = ejs.compile(fs.readFileSync('MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property_factory.java.ejs', 'utf8'), {strict: true});
writeIfModified(
`platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java`,
`MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/PropertyFactory.java`,
propertiesTemplate({layoutProperties: layoutProperties, paintProperties: paintProperties})
);
// Java Property
const enumPropertyJavaTemplate = ejs.compile(fs.readFileSync('platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs', 'utf8'), {strict: true});
const enumPropertyJavaTemplate = ejs.compile(fs.readFileSync('MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/property.java.ejs', 'utf8'), {strict: true});
writeIfModified(
`platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java`,
`MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Property.java`,
enumPropertyJavaTemplate({properties: enumProperties})
);

View File

@@ -13,11 +13,11 @@ global.camelize = function (str) {
});
}
const excludeClasses = JSON.parse(fs.readFileSync('platform/android/scripts/exclude-activity-gen.json', 'utf8'));
const appBasePath = 'platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity';
const testBasePath = 'platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/gen';
const excludeClasses = JSON.parse(fs.readFileSync('scripts/exclude-activity-gen.json', 'utf8'));
const appBasePath = 'MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity';
const testBasePath = 'MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/gen';
const subPackages = fs.readdirSync(appBasePath);
const ejsConversionTask = ejs.compile(fs.readFileSync('platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs', 'utf8'), {strict: true});
const ejsConversionTask = ejs.compile(fs.readFileSync('MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/activity.junit.ejs', 'utf8'), {strict: true});
if (!fs.existsSync(testBasePath)){
fs.mkdirSync(testBasePath);

View File

@@ -4,13 +4,13 @@ set -e
set -o pipefail
# Track individual architectures
scripts/check_binary_size.js "platform/android/MapboxGLAndroidSDK/build/intermediates/intermediate-jars/release/jni/armeabi-v7a/libmapbox-gl.so" "Android arm-v7"
scripts/check_binary_size.js "platform/android/MapboxGLAndroidSDK/build/intermediates/intermediate-jars/release/jni/arm64-v8a/libmapbox-gl.so" "Android arm-v8"
scripts/check_binary_size.js "platform/android/MapboxGLAndroidSDK/build/intermediates/intermediate-jars/release/jni/x86/libmapbox-gl.so" "Android x86"
scripts/check_binary_size.js "platform/android/MapboxGLAndroidSDK/build/intermediates/intermediate-jars/release/jni/x86_64/libmapbox-gl.so" "Android x86_64"
scripts/check_binary_size.js "MapboxGLAndroidSDK/build/intermediates/intermediate-jars/release/jni/armeabi-v7a/libmapbox-gl.so" "Android arm-v7"
scripts/check_binary_size.js "MapboxGLAndroidSDK/build/intermediates/intermediate-jars/release/jni/arm64-v8a/libmapbox-gl.so" "Android arm-v8"
scripts/check_binary_size.js "MapboxGLAndroidSDK/build/intermediates/intermediate-jars/release/jni/x86/libmapbox-gl.so" "Android x86"
scripts/check_binary_size.js "MapboxGLAndroidSDK/build/intermediates/intermediate-jars/release/jni/x86_64/libmapbox-gl.so" "Android x86_64"
# Track overall library size
scripts/check_binary_size.js "platform/android/MapboxGLAndroidSDK/build/outputs/aar/MapboxGLAndroidSDK-release.aar" "Android AAR"
scripts/check_binary_size.js "MapboxGLAndroidSDK/build/outputs/aar/MapboxGLAndroidSDK-release.aar" "Android AAR"
if [[ $CIRCLE_BRANCH == master ]]; then
# Build source data for http://mapbox.github.io/mapbox-gl-native/metrics/binary-size/

View File

@@ -4,7 +4,7 @@ import os
import re
from io import open
reportPath = os.getcwd() + "/platform/android/MapboxGLAndroidSDK/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
reportPath = os.getcwd() + "/MapboxGLAndroidSDK/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml"
with open(reportPath, 'r', encoding='utf-8') as jacocoReport:
line = jacocoReport.readline().strip()

View File

@@ -3,13 +3,13 @@
import os
import shutil
catPath = os.getcwd() + "/platform/android/build/render-test/"
catPath = os.getcwd() + "/build/render-test/"
failCounter = 0
testCounter = 0
for cat in os.listdir(catPath):
testPath = catPath + cat + "/"
for test in os.listdir(testPath):
inputPath = os.getcwd() + "/mapbox-gl-js/test/integration/render-tests/" + cat + "/" + test
inputPath = os.getcwd() + "vendor/mapbox-gl-native/mapbox-gl-js/test/integration/render-tests/" + cat + "/" + test
outputPath = testPath + test
expected = outputPath + "/expected.png"

View File

@@ -10,7 +10,7 @@ call('cd ../../ && make android-license', shell=True)
## Git diff changes
p = Popen(['git', 'diff', '--name-only', 'LICENSE.md'], stdin=PIPE, stdout=PIPE, stderr=PIPE)
output, err = p.communicate(b"input data that is passed to subprocess' stdin")
if b"platform/android/LICENSE.md" in output:
if b"LICENSE.md" in output:
raise ValueError("""An error ocurred while validating the license generation.
Changes were detected to the license generation output
but weren't commited. Run make android-license and