From 02e79ad595330931cf94994248935482bada5c87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Fri, 21 Feb 2020 17:57:22 +0100 Subject: [PATCH 01/29] [apps/code] Do not refresh the print if the sandbox is displayed Otherwise the first responder becomes the console edit line, and events (such as Toolbox) are not intercepted by the sandbox anymore. --- apps/code/console_controller.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/code/console_controller.cpp b/apps/code/console_controller.cpp index 697872131..b920fd714 100644 --- a/apps/code/console_controller.cpp +++ b/apps/code/console_controller.cpp @@ -399,6 +399,9 @@ void ConsoleController::resetSandbox() { } void ConsoleController::refreshPrintOutput() { + if (sandboxIsDisplayed()) { + return; + } m_selectableTableView.reloadData(); m_selectableTableView.selectCellAtLocation(0, m_consoleStore.numberOfLines()); if (m_preventEdition) { From 1e81a944e3be75eca8a774f50ce2bc2beaea10b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 10 Feb 2020 16:26:57 +0100 Subject: [PATCH 02/29] [build] Web: enable to build target simulator.official.zip and epsilon.official.js --- build/targets.simulator.web.mak | 5 +++-- build/toolchain.emscripten.mak | 2 +- ion/src/simulator/web/Makefile | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build/targets.simulator.web.mak b/build/targets.simulator.web.mak index 65abe11f7..f5b1158e0 100644 --- a/build/targets.simulator.web.mak +++ b/build/targets.simulator.web.mak @@ -1,13 +1,14 @@ -$(BUILD_DIR)/epsilon.js: EMSCRIPTEN_INIT_FILE = 1 +$(BUILD_DIR)/epsilon%packed.js: EMSCRIPTEN_INIT_FILE = 0 $(BUILD_DIR)/test.headless.js: EMSCRIPTEN_MODULARIZE = 0 $(BUILD_DIR)/epsilon.packed.js: $(call object_for,$(epsilon_src)) +$(BUILD_DIR)/epsilon.official.packed.js: $(call object_for,$(epsilon_official_src)) .PHONY: workshop_python_emulator workshop_python_emulator: $(MAKE) PLATFORM=simulator TARGET=web clean_for_apps_selection - $(MAKE) PLATFORM=simulator TARGET=web EPSILON_APPS=code + $(MAKE) PLATFORM=simulator TARGET=web EPSILON_APPS=code epsilon.official.js $(MAKE) PLATFORM=simulator TARGET=web clean_for_apps_selection .PHONY: clean_for_apps_selection diff --git a/build/toolchain.emscripten.mak b/build/toolchain.emscripten.mak index a773fd190..10f39df5c 100644 --- a/build/toolchain.emscripten.mak +++ b/build/toolchain.emscripten.mak @@ -129,7 +129,7 @@ EMFLAGS += -s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0 # Configure LDFLAGS EMSCRIPTEN_MODULARIZE ?= 1 LDFLAGS += -s MODULARIZE=$(EMSCRIPTEN_MODULARIZE) -s 'EXPORT_NAME="Epsilon"' -EMSCRIPTEN_INIT_FILE ?= 0 +EMSCRIPTEN_INIT_FILE ?= 1 LDFLAGS += --memory-init-file $(EMSCRIPTEN_INIT_FILE) SFLAGS += $(EMFLAGS) diff --git a/ion/src/simulator/web/Makefile b/ion/src/simulator/web/Makefile index ada734ed7..08177b0ac 100644 --- a/ion/src/simulator/web/Makefile +++ b/ion/src/simulator/web/Makefile @@ -26,10 +26,10 @@ endif DEFAULT = $(BUILD_DIR)/simulator.zip -$(BUILD_DIR)/simulator.zip: $(BUILD_DIR)/epsilon.packed.js +$(BUILD_DIR)/simulator%zip: $(BUILD_DIR)/epsilon%packed.js @rm -rf $(basename $@) @mkdir -p $(basename $@) - @cp $^ $(basename $@)/epsilon.js + @cp $^ $(basename $@)/epsilon.official.packed.js @cp ion/src/simulator/assets/background.jpg $(basename $@)/ @cp ion/src/simulator/web/simulator.html $(basename $@)/ $(call rule_label,ZIP) From 6693102d5f3fa83a196618c09141d02f2c3158ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 10 Feb 2020 16:27:55 +0100 Subject: [PATCH 03/29] [build] binpack: fix name change build --> output --- build/targets.device.n0110.mak | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build/targets.device.n0110.mak b/build/targets.device.n0110.mak index 8f56063df..082adac82 100644 --- a/build/targets.device.n0110.mak +++ b/build/targets.device.n0110.mak @@ -31,19 +31,19 @@ $(BUILD_DIR)/test.external_flash.write.$(EXE): $(BUILD_DIR)/quiz/src/test_ion_ex .PHONY: binpack binpack: - rm -rf build/binpack - mkdir -p build/binpack + rm -rf output/binpack + mkdir -p output/binpack ${MAKE} clean ${MAKE} $(BUILD_DIR)/flasher.light.bin - cp $(BUILD_DIR)/flasher.light.bin build/binpack + cp $(BUILD_DIR)/flasher.light.bin output/binpack ${MAKE} clean ${MAKE} $(BUILD_DIR)/bench.flash.bin ${MAKE} $(BUILD_DIR)/bench.ram.bin - cp $(BUILD_DIR)/bench.ram.bin $(BUILD_DIR)/bench.flash.bin build/binpack + cp $(BUILD_DIR)/bench.ram.bin $(BUILD_DIR)/bench.flash.bin output/binpack ${MAKE} clean ${MAKE} epsilon.onboarding.update.two_binaries - cp $(BUILD_DIR)/epsilon.onboarding.update.internal.bin $(BUILD_DIR)/epsilon.onboarding.update.external.bin build/binpack + cp $(BUILD_DIR)/epsilon.onboarding.update.internal.bin $(BUILD_DIR)/epsilon.onboarding.update.external.bin output/binpack ${MAKE} clean - cd build && for binary in flasher.light.bin bench.flash.bin bench.ram.bin epsilon.onboarding.internal.bin epsilon.onboarding.external.bin; do shasum -a 256 -b binpack/$${binary} > binpack/$${binary}.sha256;done - cd build && tar cvfz binpack-`git rev-parse HEAD | head -c 7`.tgz binpack - rm -rf build/binpack + cd output && for binary in flasher.light.bin bench.flash.bin bench.ram.bin epsilon.onboarding.internal.bin epsilon.onboarding.external.bin; do shasum -a 256 -b binpack/$${binary} > binpack/$${binary}.sha256;done + cd output && tar cvfz binpack-`git rev-parse HEAD | head -c 7`.tgz binpack + rm -rf output/binpack From 2351b03fb7c2d929634763d9adb5ba519b516011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 10 Feb 2020 17:28:10 +0100 Subject: [PATCH 04/29] [build] Fix binpack target --- build/targets.device.n0110.mak | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build/targets.device.n0110.mak b/build/targets.device.n0110.mak index 082adac82..556bae335 100644 --- a/build/targets.device.n0110.mak +++ b/build/targets.device.n0110.mak @@ -26,8 +26,8 @@ $(BUILD_DIR)/test.external_flash.write.$(EXE): $(BUILD_DIR)/quiz/src/test_ion_ex $(Q) $(OBJCOPY) -O binary -j .text.external -j .rodata.external -j .exam_mode_buffer $(BUILD_DIR)/$< $(BUILD_DIR)/$(basename $<).external.bin $(Q) $(OBJCOPY) -O binary -R .text.external -R .rodata.external -R .exam_mode_buffer $(BUILD_DIR)/$< $(BUILD_DIR)/$(basename $<).internal.bin @echo "Padding $(basename $<).external.bin and $(basename $<).internal.bin" - $(Q) printf "\xFF\xFF\xFF\xFF" >> $(basename $<).external.bin - $(Q) printf "\xFF\xFF\xFF\xFF" >> $(basename $<).internal.bin + $(Q) printf "\xFF\xFF\xFF\xFF" >> $(BUILD_DIR)/$(basename $<).external.bin + $(Q) printf "\xFF\xFF\xFF\xFF" >> $(BUILD_DIR)/$(basename $<).internal.bin .PHONY: binpack binpack: @@ -36,14 +36,12 @@ binpack: ${MAKE} clean ${MAKE} $(BUILD_DIR)/flasher.light.bin cp $(BUILD_DIR)/flasher.light.bin output/binpack - ${MAKE} clean ${MAKE} $(BUILD_DIR)/bench.flash.bin ${MAKE} $(BUILD_DIR)/bench.ram.bin cp $(BUILD_DIR)/bench.ram.bin $(BUILD_DIR)/bench.flash.bin output/binpack + ${MAKE} epsilon.official.onboarding.update.two_binaries + cp $(BUILD_DIR)/epsilon.official.onboarding.update.internal.bin $(BUILD_DIR)/epsilon.official.onboarding.update.external.bin output/binpack ${MAKE} clean - ${MAKE} epsilon.onboarding.update.two_binaries - cp $(BUILD_DIR)/epsilon.onboarding.update.internal.bin $(BUILD_DIR)/epsilon.onboarding.update.external.bin output/binpack - ${MAKE} clean - cd output && for binary in flasher.light.bin bench.flash.bin bench.ram.bin epsilon.onboarding.internal.bin epsilon.onboarding.external.bin; do shasum -a 256 -b binpack/$${binary} > binpack/$${binary}.sha256;done + cd output && for binary in flasher.light.bin bench.flash.bin bench.ram.bin epsilon.official.onboarding.update.internal.bin epsilon.official.onboarding.update.external.bin; do shasum -a 256 -b binpack/$${binary} > binpack/$${binary}.sha256;done cd output && tar cvfz binpack-`git rev-parse HEAD | head -c 7`.tgz binpack rm -rf output/binpack From b85f19c99c0c151f8e0211931e402344b82b2c7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 10 Feb 2020 17:28:28 +0100 Subject: [PATCH 05/29] [build] Remove useless and wrong workshop_python_emulator (GET_OPT option is missing, which also forces a real clean) --- build/targets.simulator.web.mak | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build/targets.simulator.web.mak b/build/targets.simulator.web.mak index f5b1158e0..0a8b41169 100644 --- a/build/targets.simulator.web.mak +++ b/build/targets.simulator.web.mak @@ -5,12 +5,6 @@ $(BUILD_DIR)/test.headless.js: EMSCRIPTEN_MODULARIZE = 0 $(BUILD_DIR)/epsilon.packed.js: $(call object_for,$(epsilon_src)) $(BUILD_DIR)/epsilon.official.packed.js: $(call object_for,$(epsilon_official_src)) -.PHONY: workshop_python_emulator -workshop_python_emulator: - $(MAKE) PLATFORM=simulator TARGET=web clean_for_apps_selection - $(MAKE) PLATFORM=simulator TARGET=web EPSILON_APPS=code epsilon.official.js - $(MAKE) PLATFORM=simulator TARGET=web clean_for_apps_selection - .PHONY: clean_for_apps_selection clean_for_apps_selection: @echo "CLEAN BEFORE CHANGING EPSILON_APPS" From 06202aac49ff3508941bb6a918de851f1792acbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 11 Feb 2020 11:12:20 +0100 Subject: [PATCH 06/29] [build] Remove useless clean_for_apps_selection target --- build/targets.simulator.web.mak | 6 ------ 1 file changed, 6 deletions(-) diff --git a/build/targets.simulator.web.mak b/build/targets.simulator.web.mak index 0a8b41169..a1774a34a 100644 --- a/build/targets.simulator.web.mak +++ b/build/targets.simulator.web.mak @@ -4,9 +4,3 @@ $(BUILD_DIR)/test.headless.js: EMSCRIPTEN_MODULARIZE = 0 $(BUILD_DIR)/epsilon.packed.js: $(call object_for,$(epsilon_src)) $(BUILD_DIR)/epsilon.official.packed.js: $(call object_for,$(epsilon_official_src)) - -.PHONY: clean_for_apps_selection -clean_for_apps_selection: - @echo "CLEAN BEFORE CHANGING EPSILON_APPS" - $(Q) rm -f $(BUILD_DIR)/apps/apps_container_storage.o - $(Q) rm -f $(BUILD_DIR)/apps/i18n.* From be0b2787b4a8a111286a9e5c92813cfd158bf100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 11 Feb 2020 11:18:21 +0100 Subject: [PATCH 07/29] [ion] Web Makefile: simulator.html expects a epsilon.js file and not a epsilon.official.js file --- ion/src/simulator/web/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ion/src/simulator/web/Makefile b/ion/src/simulator/web/Makefile index 08177b0ac..b31be6f0b 100644 --- a/ion/src/simulator/web/Makefile +++ b/ion/src/simulator/web/Makefile @@ -29,7 +29,7 @@ DEFAULT = $(BUILD_DIR)/simulator.zip $(BUILD_DIR)/simulator%zip: $(BUILD_DIR)/epsilon%packed.js @rm -rf $(basename $@) @mkdir -p $(basename $@) - @cp $^ $(basename $@)/epsilon.official.packed.js + @cp $^ $(basename $@)/epsilon.js @cp ion/src/simulator/assets/background.jpg $(basename $@)/ @cp ion/src/simulator/web/simulator.html $(basename $@)/ $(call rule_label,ZIP) From 4aace23362b6dfb3e96cddcbf8ceb8db740fb2a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 11 Feb 2020 15:11:41 +0100 Subject: [PATCH 08/29] [ion] Makefile of android: enable to build epsilon.apk and epsilon.official.apk --- ion/src/simulator/android/Makefile | 33 ++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/ion/src/simulator/android/Makefile b/ion/src/simulator/android/Makefile index ec4cb714a..ae968c811 100644 --- a/ion/src/simulator/android/Makefile +++ b/ion/src/simulator/android/Makefile @@ -38,10 +38,15 @@ $(BUILD_DIR)/app/res/%.xml: ion/src/simulator/android/src/res/%.xml | $$(@D)/. .PHONY: force_remake -$(BUILD_DIR)/app/libs/%/libepsilon.so: force_remake $$(@D)/. - $(Q) echo "MAKE NDK_ABI=$*" - $(Q) $(MAKE) NDK_ABI=$* epsilon.so - $(Q) cp $(BUILD_DIR)/$*/epsilon.so $@ +define rule_for_libepsilon +$$(BUILD_DIR)/app/libs/%/lib$(1): force_remake $$$$(@D)/. + $(Q) echo "MAKE NDK_ABI=$$*" + $(Q) $$(MAKE) NDK_ABI=$$* $(1) + $(Q) cp $$(BUILD_DIR)/$$*/$(1) $@ +endef + +$(eval $(call rule_for_libepsilon,epsilon.so)) +$(eval $(call rule_for_libepsilon,epsilon.official.so)) # If NDK_ABI is not defined, we will re-trigger a build for each avaialble ABI. # This is used to build APKs, which needs to embbed a binary for each ABI. @@ -50,22 +55,28 @@ ifndef NDK_ABI NDK_ABIS = armeabi-v7a arm64-v8a x86 x86_64 -epsilon_apk_deps = $(patsubst %,$(BUILD_DIR)/app/libs/%/libepsilon.so,$(NDK_ABIS)) -epsilon_apk_deps += $(subst ion/src/simulator/android/src/res,$(BUILD_DIR)/app/res,$(wildcard ion/src/simulator/android/src/res/*/*)) +epsilon_apk_deps = $(subst ion/src/simulator/android/src/res,$(BUILD_DIR)/app/res,$(wildcard ion/src/simulator/android/src/res/*/*)) epsilon_apk_deps += $(addprefix $(BUILD_DIR)/app/res/,mipmap/ic_launcher.png mipmap-v26/ic_launcher_foreground.png) -.PHONY: gradle_% -gradle_%: $(epsilon_apk_deps) +define rule_for_gradle +.PHONY: gradle_$1_$2 +gradle_$1_$2: $$(epsilon_apk_deps) $$(patsubst %,$$(BUILD_DIR)/app/libs/%/libepsilon$2so,$(NDK_ABIS)) @echo "GRADLE ion/src/simulator/android/build.gradle" - $(Q) ANDROID_HOME=$(ANDROID_HOME) EPSILON_VERSION=$(EPSILON_VERSION) BUILD_DIR=$(BUILD_DIR) ion/src/simulator/android/gradlew -b ion/src/simulator/android/build.gradle $* + $(Q) ANDROID_HOME=$(ANDROID_HOME) EPSILON_VERSION=$(EPSILON_VERSION) BUILD_DIR=$(BUILD_DIR) ion/src/simulator/android/gradlew -b ion/src/simulator/android/build.gradle $1 +endef + +$(eval $(call rule_for_gradle,assembleCodesigned,.)) +$(eval $(call rule_for_gradle,assembleRelease,.)) +$(eval $(call rule_for_gradle,assembleCodesigned,.official.)) +$(eval $(call rule_for_gradle,assembleRelease,.official.)) DEFAULT = epsilon.apk .PHONY: epsilon.apk ifdef ANDROID_SIGNING_STORE_FILE -epsilon.apk: gradle_assembleCodesigned +epsilon%apk: gradle_assembleCodesigned_% else -epsilon.apk: gradle_assembleRelease +epsilon%apk: gradle_assembleRelease_% $(warning Building without code signing. Define ANDROID_SIGNING_STORE_FILE, ANDROID_SIGNING_STORE_PASSWORD, ANDROID_SIGNING_KEY_ALIAS and ANDROID_SIGNING_KEY_PASSWORD for a signed build.) endif From 92a3e07643612be56257ac7f9fe478182bc6c0ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Wed, 12 Feb 2020 17:19:25 +0100 Subject: [PATCH 09/29] [ion] Enable to build official and unofficial softwares for ios and macos platform --- ion/src/simulator/ios/Makefile | 29 ++++++++++--------- ion/src/simulator/macos/Makefile | 17 ++++++++--- ion/src/simulator/shared/apple/Makefile | 38 ++++++++++++++++--------- 3 files changed, 52 insertions(+), 32 deletions(-) diff --git a/ion/src/simulator/ios/Makefile b/ion/src/simulator/ios/Makefile index 876963d03..58dea89ba 100644 --- a/ion/src/simulator/ios/Makefile +++ b/ion/src/simulator/ios/Makefile @@ -35,7 +35,7 @@ SIMULATOR_ICONSET = $(SIMULATOR_ASSETS_PATH)/AppIcon.appiconset include ion/src/simulator/shared/apple/Makefile -$(call simulator_app_plist,Info.plist): ion/src/simulator/ios/Info.plist $(call simulator_app_resource,Assets.car) +$(call simulator_app_plist,%,Info.plist): ion/src/simulator/ios/Info.plist $(call simulator_app_resource,%,Assets.car) $(call rule_label,PLUTIL) $(Q) cp $< $@ $(Q) plutil -insert "BuildMachineOSBuild" -string "$(IOS_BUILD_MACHINE_OS_BUILD)" $@ @@ -54,22 +54,23 @@ $(call simulator_app_plist,Info.plist): ion/src/simulator/ios/Info.plist $(call $(Q) plutil -replace CFBundleIcons -json `plutil -extract CFBundleIcons json -o - $(BUILD_DIR)/app/assets/partial.plist` $@ $(Q) plutil -replace CFBundleIcons~ipad -json `plutil -extract CFBundleIcons~ipad json -o - $(BUILD_DIR)/app/assets/partial.plist` $@ -$(call simulator_app_resource,launch.storyboardc): ion/src/simulator/ios/launch.storyboard | $$(@D)/. +$(call simulator_app_resource,%,launch.storyboardc): ion/src/simulator/ios/launch.storyboard | $$(@D)/. $(call rule_label,IBTOOL) $(Q) $(IBTOOL) --minimum-deployment-target $(APPLE_PLATFORM_MIN_VERSION) --compile $@ $^ ifdef IOS_PROVISIONNING_PROFILE -$(call simulator_app_resource,embedded.mobileprovision): $(IOS_PROVISIONNING_PROFILE) | $$(@D)/. +$(call simulator_app_resource,%,embedded.mobileprovision): $(IOS_PROVISIONNING_PROFILE) | $$(@D)/. $(call rule_label,COPY) $(Q) cp $^ $@ -$(BUILD_DIR)/app/entitlements.plist: $(call simulator_app_resource,embedded.mobileprovision) +$(BUILD_DIR)/app/entitlements.plist: $(IOS_PROVISIONNING_PROFILE) $(call rule_label,SCMS) $(Q) security cms -D -i $(IOS_PROVISIONNING_PROFILE) | plutil -extract Entitlements xml1 - -o $@ -SIMULATOR_APP_DEPS += $(BUILD_DIR)/app/entitlements.plist +simulator_app_deps += $(BUILD_DIR)/app/entitlements.plist +simulator_app_deps += $(call simulator_app_resource,$1,embedded.mobileprovision) else -$(call simulator_app_resource,embedded.mobileprovision): +$(call simulator_app_resource,%,embedded.mobileprovision): $(warning Building without a provisionning profile. Please define IOS_PROVISIONNING_PROFILE to point to the .mobileprovision file you want to use.) endif @@ -77,19 +78,19 @@ $(SIMULATOR_ICONSET)/Contents.json: ion/src/simulator/ios/icon_assets.json $(SIM $(call rule_label,COPY) $(Q) cp $< $@ -$(call simulator_app_resource,Assets.car): $(SIMULATOR_ICONSET)/Contents.json | $$(@D)/. +$(call simulator_app_resource,%,Assets.car): $(SIMULATOR_ICONSET)/Contents.json | $$(@D)/. $(call rule_label,ACTOOL) - $(Q) $(ACTOOL) --compile $(BUILD_DIR)/app/Payload/Epsilon.app --minimum-deployment-target $(APPLE_PLATFORM_MIN_VERSION) --platform $(APPLE_SDK) --app-icon AppIcon --output-partial-info-plist $(BUILD_DIR)/app/assets/partial.plist $(SIMULATOR_ASSETS_PATH) > /dev/null + $(Q) $(ACTOOL) --compile $(BUILD_DIR)/app/Payload/$*.app --minimum-deployment-target $(APPLE_PLATFORM_MIN_VERSION) --platform $(APPLE_SDK) --app-icon AppIcon --output-partial-info-plist $(BUILD_DIR)/app/assets/partial.plist $(SIMULATOR_ASSETS_PATH) > /dev/null -SIMULATOR_APP_DEPS += $(call simulator_app_resource,\ +simulator_app_deps += $(call simulator_app_resource,$(1), \ Assets.car \ launch.storyboardc \ ) -$(BUILD_DIR)/app/epsilon.ipa: $(SIMULATOR_APP_DEPS) +$(BUILD_DIR)/app/epsilon%ipa: $(subst ..,.,$(call simulator_app_deps,Epsilon$*)) ifdef IOS_PROVISIONNING_PROFILE $(call rule_label,SIGN) - $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "iPhone Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon.app + $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "iPhone Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon$*app endif $(call rule_label,ZIP) $(Q) cd $(dir $@) ; zip -qr9 $(notdir $@) Payload @@ -99,7 +100,7 @@ DEFAULT := $(BUILD_DIR)/app/epsilon.ipa endif ifeq ($(APPLE_PLATFORM),ios-simulator) -.PHONY: epsilon_run -epsilon_run: $(SIMULATOR_APP_DEPS) - xcrun simctl install booted $(BUILD_DIR)/app/Payload/Epsilon.app +.PHONY: epsilon%run +epsilon%run: $(subst _.,.,$(call simulator_app_deps,Epsilon$*)) + xcrun simctl install booted $(BUILD_DIR)/app/Payload/Epsilon$(subst _,.,$*)app endif diff --git a/ion/src/simulator/macos/Makefile b/ion/src/simulator/macos/Makefile index ae25b03f3..0f27650df 100644 --- a/ion/src/simulator/macos/Makefile +++ b/ion/src/simulator/macos/Makefile @@ -22,7 +22,7 @@ SIMULATOR_ICONSET = $(BUILD_DIR)/app/assets/app.iconset include ion/src/simulator/shared/apple/Makefile -$(call simulator_app_plist,Info.plist): ion/src/simulator/macos/Info.plist +$(call simulator_app_plist,%,Info.plist): ion/src/simulator/macos/Info.plist $(call rule_label,PLUTIL) $(Q) cp $< $@ $(Q) plutil -insert "LSMinimumSystemVersion" -string "$(MACOS_MIN_VERSION)" $@ @@ -31,12 +31,21 @@ $(call simulator_app_plist,Info.plist): ion/src/simulator/macos/Info.plist # macOS uses icns files -$(call simulator_app_resource,app.icns): $(SIMULATOR_ICONS) | $$(@D)/. +.SECONDARY: $(SIMULATOR_ICONS) | $$(@D)/. + +$(call simulator_app_resource,%,app.icns): $(SIMULATOR_ICONS) | $$(@D)/. $(call rule_label,ICNUTIL) $(Q) iconutil --convert icns --output $@ $(SIMULATOR_ICONSET) -SIMULATOR_APP_DEPS += $(call simulator_app_resource,app.icns) +simulator_app_deps += $(call simulator_app_resource,$(1),app.icns) + +simulator_app_deps_unofficial = $(call simulator_app_deps,Epsilon) +simulator_app_deps_official = $(call simulator_app_deps,Epsilon.official) + +.PHONY: Epsilon.app Epsilon.official.app +Epsilon.app: $(simulator_app_deps_unofficial) +Epsilon.official.app: $(simulator_app_deps_official) ifndef ARCH -DEFAULT := $(SIMULATOR_APP_DEPS) +DEFAULT := Epsilon.app endif diff --git a/ion/src/simulator/shared/apple/Makefile b/ion/src/simulator/shared/apple/Makefile index f5b1c77fe..22faf47d7 100644 --- a/ion/src/simulator/shared/apple/Makefile +++ b/ion/src/simulator/shared/apple/Makefile @@ -2,27 +2,37 @@ # The only things that have to be customized per platform are the icons and the # Info.plist. -SIMULATOR_APP_PATH = $(BUILD_DIR)/app/Payload/Epsilon.app +SIMULATOR_APP_PATH = $(BUILD_DIR)/app/Payload -simulator_app_binary = $(addprefix $(SIMULATOR_APP_PATH)/$(SIMULATOR_APP_BINARY_PATH),$(1)) -simulator_app_resource = $(addprefix $(SIMULATOR_APP_PATH)/$(SIMULATOR_APP_RESOURCE_PATH),$(1)) -simulator_app_plist = $(addprefix $(SIMULATOR_APP_PATH)/$(SIMULATOR_APP_PLIST_PATH),$(1)) +simulator_app_binary = $(addprefix $(SIMULATOR_APP_PATH)/$(1).app/$(SIMULATOR_APP_BINARY_PATH),$(2)) +simulator_app_resource = $(addprefix $(SIMULATOR_APP_PATH)/$(1).app/$(SIMULATOR_APP_RESOURCE_PATH),$(2)) +simulator_app_plist = $(addprefix $(SIMULATOR_APP_PATH)/$(1).app/$(SIMULATOR_APP_PLIST_PATH),$(2)) # Epsilon binary .PHONY: force_remake -$(BUILD_DIR)/%/epsilon.bin: force_remake - $(Q) echo "MAKE ARCH=$*" - $(Q) $(MAKE) ARCH=$* +define rule_for_epsilon +$$(BUILD_DIR)/%/$(1): force_remake + $(Q) echo "MAKE ARCH=$$*" + $(Q) $$(MAKE) ARCH=$$* $(1) +endef -$(call simulator_app_binary,Epsilon): $(patsubst %,$(BUILD_DIR)/%/epsilon.bin,$(ARCHS)) | $$(@D)/. - $(call rule_label,LIPO) - $(Q) $(LIPO) -create $^ -output $@ +$(eval $(call rule_for_epsilon,epsilon.bin)) +$(eval $(call rule_for_epsilon,epsilon.official.bin)) + +define rule_for_lipo +$$(call simulator_app_binary,$1,Epsilon): $$(patsubst %,$(BUILD_DIR)/%/$2.bin,$$(ARCHS)) | $$$$(@D)/. + $$(call rule_label,LIPO) + $(Q) $$(LIPO) -create $$^ -output $$@ +endef + +$(eval $(call rule_for_lipo,Epsilon,epsilon)) +$(eval $(call rule_for_lipo,Epsilon.official,epsilon.official)) # Background image -$(call simulator_app_resource,background.jpg): ion/src/simulator/assets/background.jpg | $$(@D)/. +$(call simulator_app_resource,%,background.jpg): ion/src/simulator/assets/background.jpg | $$(@D)/. $(call rule_label,COPY) $(Q) cp $^ $@ @@ -44,6 +54,6 @@ $(addprefix $(SIMULATOR_ICONSET)/,icon_%.png): ion/src/simulator/assets/logo.svg # Export simulator app dependencies -SIMULATOR_APP_DEPS += $(call simulator_app_binary,Epsilon) -SIMULATOR_APP_DEPS += $(call simulator_app_plist,Info.plist) -SIMULATOR_APP_DEPS += $(call simulator_app_resource,background.jpg) +simulator_app_deps += $(call simulator_app_binary,$(1),Epsilon) +simulator_app_deps += $(call simulator_app_plist,$(1),Info.plist) +simulator_app_deps += $(call simulator_app_resource,$(1),background.jpg) From 558e2734f0d3f1961b0f47e1be5411c1f326fbc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 17 Feb 2020 09:32:54 +0100 Subject: [PATCH 10/29] [ion] Android Makefile: fix rule for libepsilon --- ion/src/simulator/android/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ion/src/simulator/android/Makefile b/ion/src/simulator/android/Makefile index ae968c811..0d6789477 100644 --- a/ion/src/simulator/android/Makefile +++ b/ion/src/simulator/android/Makefile @@ -42,7 +42,7 @@ define rule_for_libepsilon $$(BUILD_DIR)/app/libs/%/lib$(1): force_remake $$$$(@D)/. $(Q) echo "MAKE NDK_ABI=$$*" $(Q) $$(MAKE) NDK_ABI=$$* $(1) - $(Q) cp $$(BUILD_DIR)/$$*/$(1) $@ + $(Q) cp $$(BUILD_DIR)/$$*/$(1) $$@ endef $(eval $(call rule_for_libepsilon,epsilon.so)) From d6504a6c6ad5c1af6c858c8d80fad4e94441e084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 17 Feb 2020 14:01:51 +0100 Subject: [PATCH 11/29] [build] Make a target stable_release which build every executable needed for a stable release --- build/targets.mak | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/build/targets.mak b/build/targets.mak index 68ce3de04..c770b34bf 100644 --- a/build/targets.mak +++ b/build/targets.mak @@ -41,3 +41,58 @@ endef -include build/targets.$(PLATFORM).mak $(foreach extension,$(HANDY_TARGETS_EXTENSIONS),$(foreach executable,$(HANDY_TARGETS),$(eval $(call handy_target_rule,$(executable),$(extension))))) + +define source_emsdk +source ~/emsdk/emsdk_env.sh > /dev/null +endef + +ANDROID_GRADLE_KEYSTORE:= $(wildcard ~/.gradle/google-play-upload.keystore) +ANDROID_GRADLE_PROPERTIES:= $(wildcard ~/.gradle/gradle.properties) +IOS_MOBILE_PROVISION:= $(wildcard ~/Downloads/NumWorks_Graphing_Calculator_Distribution.mobileprovision) + +MISSING_FILES=1 + +ifneq "$(and $(ANDROID_GRADLE_KEYSTORE),$(ANDROID_GRADLE_PROPERTIES))" "" +ifneq "$(IOS_MOBILE_PROVISION)" "" + MISSING_FILES=0 +endif +endif + +.PHONY: stable_release +ifeq ($(MISSING_FILES),1) +stable_release: + @echo "Some required files for app signing are missing among: ~/.gradle/google-play-upload.keystore, ~/.gradle/gradle.properties or ~/Downloads/NumWorks_Graphing_Calculator_Distribution.mobileprovision." +else +stable_release: + $(Q) rm -rf output/stable_release + $(Q) mkdir -p output/stable_release + $(Q) echo "BUILD_FIRMWARE DEVICE N0110" + $(Q) make clean + $(Q) make -j8 epsilon.official.onboarding.dfu + $(Q) cp output/release/device/n0110/epsilon.official.onboarding.dfu output/stable_release/epsilon.device.n0110.dfu + $(Q) echo "BUILD_FIRMWARE DEVICE N0100" + $(Q) make MODEL=n0100 clean + $(Q) make -j8 MODEL=n0100 epsilon.official.onboarding.dfu + $(Q) cp output/release/device/n0100/epsilon.official.onboarding.dfu output/stable_release/epsilon.device.n0100.dfu + $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB ZIP" + $(Q) make -j8 DEBUG=0 PLATFORM=simulator TARGET=web clean + $(Q) $(call source_emsdk); make -j8 DEBUG=0 PLATFORM=simulator TARGET=web output/release/simulator/web/simulator.official.zip + $(Q) cp output/release/simulator/web/simulator.official.zip output/stable_release/simulator.web.zip + $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB JS" + $(Q) $(call source_emsdk); make -j8 DEBUG=0 PLATFORM=simulator TARGET=web epsilon.official.js + $(Q) cp output/release/simulator/web/epsilon.official.js output/stable_release/epsilon.js + $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB PYTHON JS" + $(Q) make -j8 DEBUG=0 PLATFORM=simulator TARGET=web clean + $(Q) $(call source_emsdk); make -j8 DEBUG=0 PLATFORM=simulator TARGET=web EPSILON_GETOPT=1 EPSILON_APPS=code epsilon.official.js + $(Q) cp output/release/simulator/web/epsilon.official.js output/stable_release/epsilon.python.js + $(Q) echo "BUILD_FIRMWARE SIMULATOR ANDROID" + $(Q) make -j8 PLATFORM=simulator TARGET=android clean + $(Q) make -j8 PLATFORM=simulator TARGET=android epsilon.official.apk +#TODO: what are the files made by gradle? +# $(Q) cp output/release/simulator/android/epsilon.official.apk output/stable_release/epsilon.apk + $(Q) echo "BUILD_FIRMWARE SIMULATOR IOS" + $(Q) make -j8 PLATFORM=simulator TARGET=ios clean + $(Q) make -j8 PLATFORM=simulator TARGET=ios IOS_PROVISIONNING_PROFILE="~/Downloads/NumWorks_Graphing_Calculator_Distribution.mobileprovision" output/release/simulator/ios/app/epsilon.official.ipa +#TODO: which files are generated by codesign? +# $(Q) cp output/release/simulator/ios/app/epsilon.official.ipa output/stable_release/epsilon.ipa +endif From a7c26ce3a8ef35ae88a6ee15d2c66c6dc8b94a87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 17 Feb 2020 14:56:33 +0100 Subject: [PATCH 12/29] [ion] ios Makefile: fix codesigning --- ion/src/simulator/ios/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ion/src/simulator/ios/Makefile b/ion/src/simulator/ios/Makefile index 58dea89ba..b5f94f39d 100644 --- a/ion/src/simulator/ios/Makefile +++ b/ion/src/simulator/ios/Makefile @@ -90,7 +90,7 @@ simulator_app_deps += $(call simulator_app_resource,$(1), \ $(BUILD_DIR)/app/epsilon%ipa: $(subst ..,.,$(call simulator_app_deps,Epsilon$*)) ifdef IOS_PROVISIONNING_PROFILE $(call rule_label,SIGN) - $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "iPhone Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon$*app + $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "iPhone Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon.app endif $(call rule_label,ZIP) $(Q) cd $(dir $@) ; zip -qr9 $(notdir $@) Payload From ac6d6f4d5c2816778c77758a0a0293ad3c1dba04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 17 Feb 2020 14:57:53 +0100 Subject: [PATCH 13/29] [build] Complete stable_release target --- build/targets.mak | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build/targets.mak b/build/targets.mak index c770b34bf..80ba16aa1 100644 --- a/build/targets.mak +++ b/build/targets.mak @@ -88,11 +88,9 @@ stable_release: $(Q) echo "BUILD_FIRMWARE SIMULATOR ANDROID" $(Q) make -j8 PLATFORM=simulator TARGET=android clean $(Q) make -j8 PLATFORM=simulator TARGET=android epsilon.official.apk -#TODO: what are the files made by gradle? -# $(Q) cp output/release/simulator/android/epsilon.official.apk output/stable_release/epsilon.apk + $(Q) cp output/release/simulator/android/app/outputs/apk/release/android-release-unsigned.apk output/stable_release/epsilon.apk $(Q) echo "BUILD_FIRMWARE SIMULATOR IOS" $(Q) make -j8 PLATFORM=simulator TARGET=ios clean $(Q) make -j8 PLATFORM=simulator TARGET=ios IOS_PROVISIONNING_PROFILE="~/Downloads/NumWorks_Graphing_Calculator_Distribution.mobileprovision" output/release/simulator/ios/app/epsilon.official.ipa -#TODO: which files are generated by codesign? -# $(Q) cp output/release/simulator/ios/app/epsilon.official.ipa output/stable_release/epsilon.ipa + $(Q) cp output/release/simulator/ios/app/epsilon.official.ipa output/stable_release/epsilon.ipa endif From a92ee368c511bb7704154b00b55806ae58cf407f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Mon, 17 Feb 2020 17:23:13 +0100 Subject: [PATCH 14/29] [ion] ios Makefile: fix code-signing with new certificates --- ion/src/simulator/ios/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ion/src/simulator/ios/Makefile b/ion/src/simulator/ios/Makefile index b5f94f39d..c19966b28 100644 --- a/ion/src/simulator/ios/Makefile +++ b/ion/src/simulator/ios/Makefile @@ -90,7 +90,7 @@ simulator_app_deps += $(call simulator_app_resource,$(1), \ $(BUILD_DIR)/app/epsilon%ipa: $(subst ..,.,$(call simulator_app_deps,Epsilon$*)) ifdef IOS_PROVISIONNING_PROFILE $(call rule_label,SIGN) - $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "iPhone Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon.app + $(Q) codesign --force --entitlements $(BUILD_DIR)/app/entitlements.plist --sign "Apple Distribution: NumWorks" $(BUILD_DIR)/app/Payload/Epsilon.app endif $(call rule_label,ZIP) $(Q) cd $(dir $@) ; zip -qr9 $(notdir $@) Payload From ef62c70913c3113d0527e21c7f97c57d13fe6c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 18 Feb 2020 10:01:27 +0100 Subject: [PATCH 15/29] [build] Target: clean epsilon targets dependencies --- build/targets.mak | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/build/targets.mak b/build/targets.mak index 80ba16aa1..0f1d0bc16 100644 --- a/build/targets.mak +++ b/build/targets.mak @@ -1,23 +1,14 @@ # Define standard Epsilon targets base_src = $(liba_src) $(kandinsky_src) $(escher_src) $(libaxx_src) $(poincare_src) $(python_src) -epsilon_src = $(base_src) $(ion_default_src) $(apps_default_src) -epsilon_official_src = $(base_src) $(ion_default_src) $(apps_official_default_src) -epsilon_onboarding_src = $(base_src) $(ion_default_src) $(apps_onboarding_src) -epsilon_official_onboarding_src = $(base_src) $(ion_default_src) $(apps_official_onboarding_src) -epsilon_onboarding_update_src = $(base_src) $(ion_default_src) $(apps_onboarding_update_src) -epsilon_official_onboarding_update_src = $(base_src) $(ion_default_src) $(apps_official_onboarding_update_src) -epsilon_onboarding_beta_src = $(base_src) $(ion_default_src) $(apps_onboarding_beta_src) -epsilon_official_onboarding_beta_src = $(base_src) $(ion_default_src) $(apps_official_onboarding_beta_src) - -$(BUILD_DIR)/epsilon.$(EXE): $(call object_for,$(epsilon_src)) -$(BUILD_DIR)/epsilon.official.$(EXE): $(call object_for,$(epsilon_official_src)) -$(BUILD_DIR)/epsilon.onboarding.$(EXE): $(call object_for,$(epsilon_onboarding_src)) -$(BUILD_DIR)/epsilon.official.onboarding.$(EXE): $(call object_for,$(epsilon_official_onboarding_src)) -$(BUILD_DIR)/epsilon.onboarding.update.$(EXE): $(call object_for,$(epsilon_onboarding_update_src)) -$(BUILD_DIR)/epsilon.official.onboarding.update.$(EXE): $(call object_for,$(epsilon_official_onboarding_update_src)) -$(BUILD_DIR)/epsilon.onboarding.beta.$(EXE): $(call object_for,$(epsilon_onboarding_beta_src)) -$(BUILD_DIR)/epsilon.official.onboarding.beta.$(EXE): $(call object_for,$(epsilon_official_onboarding_beta_src)) +$(BUILD_DIR)/epsilon.$(EXE): $(call object_for,$(base_src) $(ion_default_src) $(apps_default_src)) +$(BUILD_DIR)/epsilon.official.$(EXE): $(call object_for,$(base_src) $(ion_default_src) $(apps_official_default_src)) +$(BUILD_DIR)/epsilon.onboarding.$(EXE): $(call object_for, $(base_src) $(ion_default_src) $(apps_onboarding_src)) +$(BUILD_DIR)/epsilon.official.onboarding.$(EXE): $(call object_for,$(base_src) $(ion_default_src) $(apps_official_onboarding_src)) +$(BUILD_DIR)/epsilon.onboarding.update.$(EXE): $(call object_for, $(base_src) $(ion_default_src) $(apps_onboarding_update_src)) +$(BUILD_DIR)/epsilon.official.onboarding.update.$(EXE): $(call object_for,$(base_src) $(ion_default_src) $(apps_official_onboarding_update_src)) +$(BUILD_DIR)/epsilon.onboarding.beta.$(EXE): $(call object_for, $(base_src) $(ion_default_src) $(apps_onboarding_beta_src)) +$(BUILD_DIR)/epsilon.official.onboarding.beta.$(EXE): $(call object_for,$(base_src) $(ion_default_src) $(apps_official_onboarding_beta_src)) test_base_src = $(base_src) $(apps_tests_src) $(runner_src) $(tests_src) From 6c0bb3cdde4259544c41c16fa32b2792e1c7b8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 18 Feb 2020 11:54:35 +0100 Subject: [PATCH 16/29] [build] Replace make by $(MAKE) in Makefiles --- build/scenario/Makefile | 4 ++-- build/targets.mak | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/build/scenario/Makefile b/build/scenario/Makefile index aafb398e8..64f65e8bf 100644 --- a/build/scenario/Makefile +++ b/build/scenario/Makefile @@ -1,11 +1,11 @@ .PHONY: scenario_logger scenario_logger: - $(Q) make -j8 PLATFORM=simulator clean && make -j8 DEBUG=1 ARCH=x86_64 PLATFORM=simulator epsilon.headless.bin + $(Q) $(MAKE) PLATFORM=simulator clean && $(MAKE) DEBUG=1 ARCH=x86_64 PLATFORM=simulator epsilon.headless.bin $(Q) cp output/debug/simulator/macos/x86_64/epsilon.headless.bin epsilon_scenario_logger.bin @echo "Run ./epsilon_scenario_logger.bin --logAfter 0 < scenario.esc to log a scenario" .PHONY: scenario_creator scenario_creator: - $(Q) make -j8 PLATFORM=simulator clean && make -j8 DEBUG=1 ESCHER_LOG_EVENTS_BINARY=1 PLATFORM=simulator + $(Q) $(MAKE) PLATFORM=simulator clean && $(MAKE) DEBUG=1 ESCHER_LOG_EVENTS_BINARY=1 PLATFORM=simulator $(Q) cp -R output/debug/simulator/macos/app/Payload/Epsilon.app epsilon_scenario_creator.app @echo "Run lldb epsilon_scenario_creator.app then process launch -o scenario.esc to create a scenario" diff --git a/build/targets.mak b/build/targets.mak index 0f1d0bc16..cdc58c3e4 100644 --- a/build/targets.mak +++ b/build/targets.mak @@ -58,30 +58,30 @@ stable_release: $(Q) rm -rf output/stable_release $(Q) mkdir -p output/stable_release $(Q) echo "BUILD_FIRMWARE DEVICE N0110" - $(Q) make clean - $(Q) make -j8 epsilon.official.onboarding.dfu + $(Q) $(MAKE) clean + $(Q) $(MAKE) epsilon.official.onboarding.dfu $(Q) cp output/release/device/n0110/epsilon.official.onboarding.dfu output/stable_release/epsilon.device.n0110.dfu $(Q) echo "BUILD_FIRMWARE DEVICE N0100" - $(Q) make MODEL=n0100 clean - $(Q) make -j8 MODEL=n0100 epsilon.official.onboarding.dfu + $(Q) $(MAKE) MODEL=n0100 clean + $(Q) $(MAKE) MODEL=n0100 epsilon.official.onboarding.dfu $(Q) cp output/release/device/n0100/epsilon.official.onboarding.dfu output/stable_release/epsilon.device.n0100.dfu $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB ZIP" - $(Q) make -j8 DEBUG=0 PLATFORM=simulator TARGET=web clean - $(Q) $(call source_emsdk); make -j8 DEBUG=0 PLATFORM=simulator TARGET=web output/release/simulator/web/simulator.official.zip + $(Q) $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web clean + $(Q) $(call source_emsdk); $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web output/release/simulator/web/simulator.official.zip $(Q) cp output/release/simulator/web/simulator.official.zip output/stable_release/simulator.web.zip $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB JS" - $(Q) $(call source_emsdk); make -j8 DEBUG=0 PLATFORM=simulator TARGET=web epsilon.official.js + $(Q) $(call source_emsdk); $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web epsilon.official.js $(Q) cp output/release/simulator/web/epsilon.official.js output/stable_release/epsilon.js $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB PYTHON JS" - $(Q) make -j8 DEBUG=0 PLATFORM=simulator TARGET=web clean - $(Q) $(call source_emsdk); make -j8 DEBUG=0 PLATFORM=simulator TARGET=web EPSILON_GETOPT=1 EPSILON_APPS=code epsilon.official.js + $(Q) $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web clean + $(Q) $(call source_emsdk); $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web EPSILON_GETOPT=1 EPSILON_APPS=code epsilon.official.js $(Q) cp output/release/simulator/web/epsilon.official.js output/stable_release/epsilon.python.js $(Q) echo "BUILD_FIRMWARE SIMULATOR ANDROID" - $(Q) make -j8 PLATFORM=simulator TARGET=android clean - $(Q) make -j8 PLATFORM=simulator TARGET=android epsilon.official.apk + $(Q) $(MAKE) PLATFORM=simulator TARGET=android clean + $(Q) $(MAKE) PLATFORM=simulator TARGET=android epsilon.official.apk $(Q) cp output/release/simulator/android/app/outputs/apk/release/android-release-unsigned.apk output/stable_release/epsilon.apk $(Q) echo "BUILD_FIRMWARE SIMULATOR IOS" - $(Q) make -j8 PLATFORM=simulator TARGET=ios clean - $(Q) make -j8 PLATFORM=simulator TARGET=ios IOS_PROVISIONNING_PROFILE="~/Downloads/NumWorks_Graphing_Calculator_Distribution.mobileprovision" output/release/simulator/ios/app/epsilon.official.ipa + $(Q) $(MAKE) PLATFORM=simulator TARGET=ios clean + $(Q) $(MAKE) PLATFORM=simulator TARGET=ios IOS_PROVISIONNING_PROFILE="~/Downloads/NumWorks_Graphing_Calculator_Distribution.mobileprovision" output/release/simulator/ios/app/epsilon.official.ipa $(Q) cp output/release/simulator/ios/app/epsilon.official.ipa output/stable_release/epsilon.ipa endif From 38d02663b420caa208ecbee4bfa55934ebc6eafb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 18 Feb 2020 13:50:59 +0100 Subject: [PATCH 17/29] [build] epsilon_src & epsilon_official_src have to be defined because they're used by target.simulator.web.mak --- Makefile | 2 +- apps/Makefile | 2 +- build/targets.mak | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 8594beee0..46acaaa5a 100644 --- a/Makefile +++ b/Makefile @@ -102,7 +102,7 @@ include build/struct_layout/Makefile include build/scenario/Makefile include quiz/Makefile # Quiz needs to be included at the end -all_src = $(apps_all_src) $(escher_src) $(ion_all_src) $(kandinsky_src) $(liba_src) $(libaxx_src) $(poincare_src) $(python_src) $(epsilon_src) $(runner_src) $(ion_target_device_flasher_light_src) $(ion_target_device_flasher_verbose_src) $(ion_target_device_bench_src) $(tests_src) +all_src = $(apps_all_src) $(escher_src) $(ion_all_src) $(kandinsky_src) $(liba_src) $(libaxx_src) $(poincare_src) $(python_src) $(runner_src) $(ion_target_device_flasher_light_src) $(ion_target_device_flasher_verbose_src) $(ion_target_device_bench_src) $(tests_src) all_objs = $(call object_for,$(all_src)) .SECONDARY: $(all_objs) diff --git a/apps/Makefile b/apps/Makefile index a61605344..c3af54608 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -89,7 +89,7 @@ $(BUILD_DIR)/apps/i18n.h: $(BUILD_DIR)/apps/i18n.cpp $(eval $(call depends_on_image,apps/title_bar_view.cpp,apps/exam_icon.png)) -all_app_src = $(app_src) $(epsilon_src) $(apps_launch_on_boarding_src) $(apps_launch_default_src) $(apps_prompt_none_src) $(apps_prompt_update_src) $(apps_prompt_beta_src) $(apps_official) $(apps_non_official) $(tests_src) +all_app_src = $(app_src)(apps_launch_on_boarding_src) $(apps_launch_default_src) $(apps_prompt_none_src) $(apps_prompt_update_src) $(apps_prompt_beta_src) $(apps_official) $(apps_non_official) $(tests_src) $(call object_for,$(all_app_src)): $(BUILD_DIR)/apps/i18n.h $(call object_for,$(all_app_src)): $(BUILD_DIR)/python/port/genhdr/qstrdefs.generated.h diff --git a/build/targets.mak b/build/targets.mak index cdc58c3e4..4f28bd056 100644 --- a/build/targets.mak +++ b/build/targets.mak @@ -1,8 +1,11 @@ # Define standard Epsilon targets base_src = $(liba_src) $(kandinsky_src) $(escher_src) $(libaxx_src) $(poincare_src) $(python_src) -$(BUILD_DIR)/epsilon.$(EXE): $(call object_for,$(base_src) $(ion_default_src) $(apps_default_src)) -$(BUILD_DIR)/epsilon.official.$(EXE): $(call object_for,$(base_src) $(ion_default_src) $(apps_official_default_src)) +epsilon_src = $(base_src) $(ion_default_src) $(apps_default_src) +epsilon_official_src = $(base_src) $(ion_default_src) $(apps_official_default_src) + +$(BUILD_DIR)/epsilon.$(EXE): $(call object_for,$(epsilon_src)) +$(BUILD_DIR)/epsilon.official.$(EXE): $(call object_for,$(epsilon_official_src)) $(BUILD_DIR)/epsilon.onboarding.$(EXE): $(call object_for, $(base_src) $(ion_default_src) $(apps_onboarding_src)) $(BUILD_DIR)/epsilon.official.onboarding.$(EXE): $(call object_for,$(base_src) $(ion_default_src) $(apps_official_onboarding_src)) $(BUILD_DIR)/epsilon.onboarding.update.$(EXE): $(call object_for, $(base_src) $(ion_default_src) $(apps_onboarding_update_src)) From c8cbd9475d15074d4bef43cf72b19935c87b87a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 18 Feb 2020 14:05:18 +0100 Subject: [PATCH 18/29] [ion] android Makefile: declare targets as PHONY --- ion/src/simulator/android/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ion/src/simulator/android/Makefile b/ion/src/simulator/android/Makefile index 0d6789477..44771b25e 100644 --- a/ion/src/simulator/android/Makefile +++ b/ion/src/simulator/android/Makefile @@ -72,7 +72,7 @@ $(eval $(call rule_for_gradle,assembleRelease,.official.)) DEFAULT = epsilon.apk -.PHONY: epsilon.apk +.PHONY: epsilon%apk ifdef ANDROID_SIGNING_STORE_FILE epsilon%apk: gradle_assembleCodesigned_% else From 3aeb4b9ea96b5cc79013f0d45b2d96a1a6f603eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Tue, 18 Feb 2020 16:44:07 +0100 Subject: [PATCH 19/29] [build] Coding style --- build/targets.device.n0110.mak | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/targets.device.n0110.mak b/build/targets.device.n0110.mak index 556bae335..5b5078ac5 100644 --- a/build/targets.device.n0110.mak +++ b/build/targets.device.n0110.mak @@ -33,15 +33,15 @@ $(BUILD_DIR)/test.external_flash.write.$(EXE): $(BUILD_DIR)/quiz/src/test_ion_ex binpack: rm -rf output/binpack mkdir -p output/binpack - ${MAKE} clean - ${MAKE} $(BUILD_DIR)/flasher.light.bin + $(MAKE) clean + $(MAKE) $(BUILD_DIR)/flasher.light.bin cp $(BUILD_DIR)/flasher.light.bin output/binpack - ${MAKE} $(BUILD_DIR)/bench.flash.bin - ${MAKE} $(BUILD_DIR)/bench.ram.bin + $(MAKE) $(BUILD_DIR)/bench.flash.bin + $(MAKE) $(BUILD_DIR)/bench.ram.bin cp $(BUILD_DIR)/bench.ram.bin $(BUILD_DIR)/bench.flash.bin output/binpack - ${MAKE} epsilon.official.onboarding.update.two_binaries + $(MAKE) epsilon.official.onboarding.update.two_binaries cp $(BUILD_DIR)/epsilon.official.onboarding.update.internal.bin $(BUILD_DIR)/epsilon.official.onboarding.update.external.bin output/binpack - ${MAKE} clean + $(MAKE) clean cd output && for binary in flasher.light.bin bench.flash.bin bench.ram.bin epsilon.official.onboarding.update.internal.bin epsilon.official.onboarding.update.external.bin; do shasum -a 256 -b binpack/$${binary} > binpack/$${binary}.sha256;done cd output && tar cvfz binpack-`git rev-parse HEAD | head -c 7`.tgz binpack rm -rf output/binpack From d2e9d5fbea4db6a9739129c1e23b378c751b2046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 20 Feb 2020 11:58:14 +0100 Subject: [PATCH 20/29] [build] Split stable_release target from target.mak, change name to all_official --- build/targets.all.mak | 60 +++++++++++++++++++++++++++++++++++++++++++ build/targets.mak | 53 +------------------------------------- 2 files changed, 61 insertions(+), 52 deletions(-) create mode 100644 build/targets.all.mak diff --git a/build/targets.all.mak b/build/targets.all.mak new file mode 100644 index 000000000..989c4fb7b --- /dev/null +++ b/build/targets.all.mak @@ -0,0 +1,60 @@ +ANDROID_GRADLE_KEYSTORE ?= ~/.gradle/google-play-upload.keystore +ANDROID_GRADLE_PROPERTIES ?= ~/.gradle/gradle.properties +IOS_MOBILE_PROVISION ?= build/artifacts/NumWorks_Graphing_Calculator_Distribution.mobileprovision +EMCC ?= emcc + +define source_emsdk +source ~/emsdk/emsdk_env.sh > /dev/null +endef + +define file_check +@ if test ! -f $(1); \ + then \ + echo "Missing file: $(1)"; \ + exit 1; \ +fi +endef + +define command_check +@ if ! command -v $(1) > /dev/null; \ + then \ + echo "Missing command: $(1), did you forget to source?"; \ + exit 1; \ +fi +endef + +.PHONY: all_official +all_official: + $(call file_check,$(ANDROID_GRADLE_KEYSTORE)) + $(call file_check,$(ANDROID_GRADLE_PROPERTIES)) + $(call file_check,$(IOS_MOBILE_PROVISION)) + $(call command_check,$(EMCC)) + $(Q) rm -rf output/stable_release + $(Q) mkdir -p output/stable_release + $(Q) echo "BUILD_FIRMWARE DEVICE N0110" + $(Q) $(MAKE) clean + $(Q) $(MAKE) epsilon.official.onboarding.dfu + $(Q) cp output/release/device/n0110/epsilon.official.onboarding.dfu output/stable_release/epsilon.device.n0110.dfu + $(Q) echo "BUILD_FIRMWARE DEVICE N0100" + $(Q) $(MAKE) MODEL=n0100 clean + $(Q) $(MAKE) MODEL=n0100 epsilon.official.onboarding.dfu + $(Q) cp output/release/device/n0100/epsilon.official.onboarding.dfu output/stable_release/epsilon.device.n0100.dfu + $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB ZIP" + $(Q) $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web clean + $(Q) $(call source_emsdk); $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web output/release/simulator/web/simulator.official.zip + $(Q) cp output/release/simulator/web/simulator.official.zip output/stable_release/simulator.web.zip + $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB JS" + $(Q) $(call source_emsdk); $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web epsilon.official.js + $(Q) cp output/release/simulator/web/epsilon.official.js output/stable_release/epsilon.js + $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB PYTHON JS" + $(Q) $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web clean + $(Q) $(call source_emsdk); $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web EPSILON_GETOPT=1 EPSILON_APPS=code epsilon.official.js + $(Q) cp output/release/simulator/web/epsilon.official.js output/stable_release/epsilon.python.js + $(Q) echo "BUILD_FIRMWARE SIMULATOR ANDROID" + $(Q) $(MAKE) PLATFORM=simulator TARGET=android clean + $(Q) $(MAKE) PLATFORM=simulator TARGET=android epsilon.official.apk + $(Q) cp output/release/simulator/android/app/outputs/apk/release/android-release-unsigned.apk output/stable_release/epsilon.apk + $(Q) echo "BUILD_FIRMWARE SIMULATOR IOS" + $(Q) $(MAKE) PLATFORM=simulator TARGET=ios clean + $(Q) $(MAKE) PLATFORM=simulator TARGET=ios IOS_PROVISIONNING_PROFILE="~/Downloads/NumWorks_Graphing_Calculator_Distribution.mobileprovision" output/release/simulator/ios/app/epsilon.official.ipa + $(Q) cp output/release/simulator/ios/app/epsilon.official.ipa output/stable_release/epsilon.ipa diff --git a/build/targets.mak b/build/targets.mak index 4f28bd056..ca7b9d97c 100644 --- a/build/targets.mak +++ b/build/targets.mak @@ -36,55 +36,4 @@ endef $(foreach extension,$(HANDY_TARGETS_EXTENSIONS),$(foreach executable,$(HANDY_TARGETS),$(eval $(call handy_target_rule,$(executable),$(extension))))) -define source_emsdk -source ~/emsdk/emsdk_env.sh > /dev/null -endef - -ANDROID_GRADLE_KEYSTORE:= $(wildcard ~/.gradle/google-play-upload.keystore) -ANDROID_GRADLE_PROPERTIES:= $(wildcard ~/.gradle/gradle.properties) -IOS_MOBILE_PROVISION:= $(wildcard ~/Downloads/NumWorks_Graphing_Calculator_Distribution.mobileprovision) - -MISSING_FILES=1 - -ifneq "$(and $(ANDROID_GRADLE_KEYSTORE),$(ANDROID_GRADLE_PROPERTIES))" "" -ifneq "$(IOS_MOBILE_PROVISION)" "" - MISSING_FILES=0 -endif -endif - -.PHONY: stable_release -ifeq ($(MISSING_FILES),1) -stable_release: - @echo "Some required files for app signing are missing among: ~/.gradle/google-play-upload.keystore, ~/.gradle/gradle.properties or ~/Downloads/NumWorks_Graphing_Calculator_Distribution.mobileprovision." -else -stable_release: - $(Q) rm -rf output/stable_release - $(Q) mkdir -p output/stable_release - $(Q) echo "BUILD_FIRMWARE DEVICE N0110" - $(Q) $(MAKE) clean - $(Q) $(MAKE) epsilon.official.onboarding.dfu - $(Q) cp output/release/device/n0110/epsilon.official.onboarding.dfu output/stable_release/epsilon.device.n0110.dfu - $(Q) echo "BUILD_FIRMWARE DEVICE N0100" - $(Q) $(MAKE) MODEL=n0100 clean - $(Q) $(MAKE) MODEL=n0100 epsilon.official.onboarding.dfu - $(Q) cp output/release/device/n0100/epsilon.official.onboarding.dfu output/stable_release/epsilon.device.n0100.dfu - $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB ZIP" - $(Q) $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web clean - $(Q) $(call source_emsdk); $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web output/release/simulator/web/simulator.official.zip - $(Q) cp output/release/simulator/web/simulator.official.zip output/stable_release/simulator.web.zip - $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB JS" - $(Q) $(call source_emsdk); $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web epsilon.official.js - $(Q) cp output/release/simulator/web/epsilon.official.js output/stable_release/epsilon.js - $(Q) echo "BUILD_FIRMWARE SIMULATOR WEB PYTHON JS" - $(Q) $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web clean - $(Q) $(call source_emsdk); $(MAKE) DEBUG=0 PLATFORM=simulator TARGET=web EPSILON_GETOPT=1 EPSILON_APPS=code epsilon.official.js - $(Q) cp output/release/simulator/web/epsilon.official.js output/stable_release/epsilon.python.js - $(Q) echo "BUILD_FIRMWARE SIMULATOR ANDROID" - $(Q) $(MAKE) PLATFORM=simulator TARGET=android clean - $(Q) $(MAKE) PLATFORM=simulator TARGET=android epsilon.official.apk - $(Q) cp output/release/simulator/android/app/outputs/apk/release/android-release-unsigned.apk output/stable_release/epsilon.apk - $(Q) echo "BUILD_FIRMWARE SIMULATOR IOS" - $(Q) $(MAKE) PLATFORM=simulator TARGET=ios clean - $(Q) $(MAKE) PLATFORM=simulator TARGET=ios IOS_PROVISIONNING_PROFILE="~/Downloads/NumWorks_Graphing_Calculator_Distribution.mobileprovision" output/release/simulator/ios/app/epsilon.official.ipa - $(Q) cp output/release/simulator/ios/app/epsilon.official.ipa output/stable_release/epsilon.ipa -endif +include build/targets.all.mak From 8075468568e5ffc7726f61da72ed809c36500a75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milie=20Feral?= Date: Thu, 20 Feb 2020 12:02:37 +0100 Subject: [PATCH 21/29] .gitignore: add build/artefacts --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a43c2d871..b69802123 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /output/ +/build/artifacts/ build/device/**/*.pyc From 7b00072ccf5fcca70f044f160236c58efeebca67 Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Tue, 25 Feb 2020 10:29:13 +0100 Subject: [PATCH 22/29] [apps/regression/graph_controller] Factor m_roundCursorView.setColor in setRoundCrossCursorView --- apps/regression/graph_controller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index 78f8ea350..3e23236ca 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -88,14 +88,12 @@ void GraphController::viewWillAppear() { setRoundCrossCursorView(false); } else { setRoundCrossCursorView(true); - m_roundCursorView.setColor(Palette::DataColor[*m_selectedSeriesIndex]); } } void GraphController::selectRegressionCurve() { *m_selectedDotIndex = -1; setRoundCrossCursorView(true); - m_roundCursorView.setColor(Palette::DataColor[*m_selectedSeriesIndex]); } // Private @@ -405,7 +403,12 @@ InteractiveCurveViewRangeDelegate::Range GraphController::computeYRange(Interact } void GraphController::setRoundCrossCursorView(bool round) { + if (round) { + // Set the color although the cursor view stays round + m_roundCursorView.setColor(Palette::DataColor[*m_selectedSeriesIndex]); + } CursorView * nextCursorView = round ? static_cast(&m_roundCursorView) : static_cast(&m_crossCursorView); + // Escape if the cursor view stays the same if (m_view.cursorView() == nextCursorView) { return; } From d13c2438763459188f2acb78dba8aa9da688c278 Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Tue, 25 Feb 2020 10:30:48 +0100 Subject: [PATCH 23/29] [apps/regression/graph_controller] Simplify viewWillAppear --- apps/regression/graph_controller.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index 3e23236ca..dd1442568 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -84,11 +84,7 @@ void GraphController::viewWillAppear() { /* Since *m_selectedDotIndex is altered by initCursorParameters(), * the following must absolutely come at the end. */ - if (*m_selectedDotIndex >= 0) { - setRoundCrossCursorView(false); - } else { - setRoundCrossCursorView(true); - } + setRoundCrossCursorView(*m_selectedDotIndex < 0); } void GraphController::selectRegressionCurve() { From 7e6a601af0f92d115dce52ac354072f4cbff38ec Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Tue, 25 Feb 2020 13:59:18 +0100 Subject: [PATCH 24/29] [apps/regression/graph_controller] Inline selectRegressionCurve in moveCursorVertically In the graph controller, selectRegressionCurve is only called at one place (in moveCursorVertically). In general, setRoundCrossCursorView is called and *m_selectedDotIndex is updated. There is no reason at all to do things differently. Though selectRegressionCurve is called from GoToParameterController. --- apps/regression/graph_controller.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index dd1442568..fa11d95ff 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -321,7 +321,8 @@ bool GraphController::moveCursorVertically(int direction) { if (validRegression) { // Select the regression *m_selectedSeriesIndex = closestRegressionSeries; - selectRegressionCurve(); + *m_selectedDotIndex = -1; + setRoundCrossCursorView(true); m_cursor->moveTo(x, x, yValue(*m_selectedSeriesIndex, x, context)); return true; } From 436b934f7644e0ab6a35268172e7061748cf6b9b Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Tue, 25 Feb 2020 14:01:47 +0100 Subject: [PATCH 25/29] [apps/regression/graph_controller] selectRegressionCurve does not update the cursor view selectRegressionCurve is only called from GoToParameterController and is part of the GraphController's API for updating the model. It should not update the view. viewWillAppear does. --- apps/regression/graph_controller.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index fa11d95ff..7209e37e0 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -89,7 +89,6 @@ void GraphController::viewWillAppear() { void GraphController::selectRegressionCurve() { *m_selectedDotIndex = -1; - setRoundCrossCursorView(true); } // Private From 4f279f15da539c648bc2c2812d554c5912e6a1fc Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Tue, 25 Feb 2020 14:43:10 +0100 Subject: [PATCH 26/29] [apps/regression/graph_controller] Inline selectRegressionCurve in header --- apps/regression/graph_controller.cpp | 4 ---- apps/regression/graph_controller.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index 7209e37e0..4be142546 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -87,10 +87,6 @@ void GraphController::viewWillAppear() { setRoundCrossCursorView(*m_selectedDotIndex < 0); } -void GraphController::selectRegressionCurve() { - *m_selectedDotIndex = -1; -} - // Private Poincare::Context * GraphController::globalContext() { diff --git a/apps/regression/graph_controller.h b/apps/regression/graph_controller.h index 0c35ad9ab..2011c9735 100644 --- a/apps/regression/graph_controller.h +++ b/apps/regression/graph_controller.h @@ -21,7 +21,7 @@ public: bool isEmpty() const override; I18n::Message emptyMessage() override; void viewWillAppear() override; - void selectRegressionCurve(); + void selectRegressionCurve() { *m_selectedDotIndex = -1; } int selectedSeriesIndex() const { return *m_selectedSeriesIndex; } // moveCursorHorizontally and Vertically are public to be used in tests From b8b6e4b5b8398f6d2f3a064232fd120150575cf7 Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Tue, 25 Feb 2020 16:31:37 +0100 Subject: [PATCH 27/29] [apps/regression/graph_controller] Update model before setting cursor view --- apps/regression/graph_controller.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index 4be142546..cec30642f 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -313,6 +313,8 @@ bool GraphController::moveCursorVertically(int direction) { assert(!validDot || !validRegression); + /* The model should be up to date before setting the cursor view. */ + if (validRegression) { // Select the regression *m_selectedSeriesIndex = closestRegressionSeries; @@ -324,9 +326,9 @@ bool GraphController::moveCursorVertically(int direction) { if (validDot) { // Select the dot - setRoundCrossCursorView(false); *m_selectedSeriesIndex = closestDotSeries; *m_selectedDotIndex = dotSelected; + setRoundCrossCursorView(false); if (dotSelected == m_store->numberOfPairsOfSeries(*m_selectedSeriesIndex)) { // Select the mean dot double x = m_store->meanOfColumn(*m_selectedSeriesIndex, 0); @@ -395,6 +397,8 @@ InteractiveCurveViewRangeDelegate::Range GraphController::computeYRange(Interact } void GraphController::setRoundCrossCursorView(bool round) { + /* At this point, the model (selected series and dot indices) should be up + * to date. */ if (round) { // Set the color although the cursor view stays round m_roundCursorView.setColor(Palette::DataColor[*m_selectedSeriesIndex]); From bdb29b9bf91e32084cdbf18dd8913404bac36af2 Mon Sep 17 00:00:00 2001 From: Ruben Dashyan Date: Tue, 25 Feb 2020 16:35:22 +0100 Subject: [PATCH 28/29] [apps/regression/graph_controller] Remove setRoundCrossCursorView's parameter Get it directly from model --- apps/regression/graph_controller.cpp | 9 +++++---- apps/regression/graph_controller.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index cec30642f..b59809bca 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -84,7 +84,7 @@ void GraphController::viewWillAppear() { /* Since *m_selectedDotIndex is altered by initCursorParameters(), * the following must absolutely come at the end. */ - setRoundCrossCursorView(*m_selectedDotIndex < 0); + setRoundCrossCursorView(); } // Private @@ -319,7 +319,7 @@ bool GraphController::moveCursorVertically(int direction) { // Select the regression *m_selectedSeriesIndex = closestRegressionSeries; *m_selectedDotIndex = -1; - setRoundCrossCursorView(true); + setRoundCrossCursorView(); m_cursor->moveTo(x, x, yValue(*m_selectedSeriesIndex, x, context)); return true; } @@ -328,7 +328,7 @@ bool GraphController::moveCursorVertically(int direction) { // Select the dot *m_selectedSeriesIndex = closestDotSeries; *m_selectedDotIndex = dotSelected; - setRoundCrossCursorView(false); + setRoundCrossCursorView(); if (dotSelected == m_store->numberOfPairsOfSeries(*m_selectedSeriesIndex)) { // Select the mean dot double x = m_store->meanOfColumn(*m_selectedSeriesIndex, 0); @@ -396,9 +396,10 @@ InteractiveCurveViewRangeDelegate::Range GraphController::computeYRange(Interact return range; } -void GraphController::setRoundCrossCursorView(bool round) { +void GraphController::setRoundCrossCursorView() { /* At this point, the model (selected series and dot indices) should be up * to date. */ + bool round = *m_selectedDotIndex < 0; if (round) { // Set the color although the cursor view stays round m_roundCursorView.setColor(Palette::DataColor[*m_selectedSeriesIndex]); diff --git a/apps/regression/graph_controller.h b/apps/regression/graph_controller.h index 2011c9735..f1c257a12 100644 --- a/apps/regression/graph_controller.h +++ b/apps/regression/graph_controller.h @@ -55,7 +55,7 @@ private: // InteractiveCurveViewRangeDelegate Shared::InteractiveCurveViewRangeDelegate::Range computeYRange(Shared::InteractiveCurveViewRange * interactiveCurveViewRange) override; - void setRoundCrossCursorView(bool round); + void setRoundCrossCursorView(); Shared::CursorView m_crossCursorView; Shared::RoundCursorView m_roundCursorView; BannerView m_bannerView; From f74ed8ecd7f67bf36b9532b65eb3df1d4551a36f Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Sat, 22 Feb 2020 11:05:38 +0000 Subject: [PATCH 29/29] [ion] Fix error check in the USB stack The return type of the function receiveSomeData needs to be wider so the -1 error value could fit. Fixes #1335 --- ion/src/device/shared/usb/stack/endpoint0.cpp | 2 +- ion/src/device/shared/usb/stack/endpoint0.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ion/src/device/shared/usb/stack/endpoint0.cpp b/ion/src/device/shared/usb/stack/endpoint0.cpp index 14478a086..4e1d4e980 100644 --- a/ion/src/device/shared/usb/stack/endpoint0.cpp +++ b/ion/src/device/shared/usb/stack/endpoint0.cpp @@ -259,7 +259,7 @@ void Endpoint0::clearForOutTransactions(uint16_t wLength) { setOutNAK(false); } -uint16_t Endpoint0::receiveSomeData() { +int Endpoint0::receiveSomeData() { // If it is the first chunk of data to be received, m_transferBufferLength is 0. uint16_t packetSize = MIN(k_maxPacketSize, m_request.wLength() - m_transferBufferLength); uint16_t sizeOfPacketRead = readPacket(m_largeBuffer + m_transferBufferLength, packetSize); diff --git a/ion/src/device/shared/usb/stack/endpoint0.h b/ion/src/device/shared/usb/stack/endpoint0.h index ca6809bfb..a0ef41686 100644 --- a/ion/src/device/shared/usb/stack/endpoint0.h +++ b/ion/src/device/shared/usb/stack/endpoint0.h @@ -57,7 +57,7 @@ public: void clearForOutTransactions(uint16_t wLength); private: - uint16_t receiveSomeData(); + int receiveSomeData(); uint16_t readPacket(void * buffer, uint16_t length); uint16_t writePacket(const void * buffer, uint16_t length);