Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-1210

Alloy: Add support for DIST in the Project Configuration File

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Runtime
    • Labels:
    • Environment:

      master

    • Story Points:
      5
    • Sprint:
      2015 Sprint 20 Tooling

      Description

      Recently, in Alloy 1.4.0 DIST_ADHOC and DIST_STORE were added the options for conditional code in controllers.

      I'd like to also have support the same conditions in config.json.

      The use case would be to have different endpoints, keys or other configuration variables for production ad-hoc builds and production store-builds.

      Example:

      {
       "global": {"foo":1},
       "env:development": {"foo":2},
       "env:test":{"foo":3},
       "env:production":{"foo":4},
       "os:ios env:production": {"foo":5},
       "os:ios env:development": {"foo":6},
       "os:ios env:test": {"foo":7},
       "os:android":{"foo":8},
       "os:mobileweb":{"foo":9},
       "os:ios dist:adhoc": {"foo":10},
       "os:ios dist:store": {"foo":10},
       "dependencies": {
        "com.foo.widget":"1.0"
       }
      } 
      

        Issue Links

          Activity

          Hide
          timpoulsen Tim Poulsen added a comment - - edited

          We use different endpoints for AdHoc builds (Installr/TestFlight beta builds) vs our production releases. Currently, we have to manually copy & paste the contents of the config.json file to support such builds. This has resulted in mistakes. While we can use external tooling, like a grunt script, to manipulate the files, it would be best if Alloy itself supported something like:

          {
              "env:development": {"url":"https://dev.example.com"},
              "env:test":{"url":"https://test.example.com"},
              "env:production":{"url":"https://production.example.com"},
              "dist:adhoc":{"url":"https://adhoc.example.com"},
              "dist:store":{"url":"https://production.example.com"},
          }
          

          Given that we need this support for both iOS and Android, the key can't be env:adhoc or something iOS-specific. In the above proposal, dist:adhoc and dist:store would need to override env:production.

          And yes, I realize that natively Android doesn't have a notion of "adhoc" builds. But, I need a signed APK (with our company certificate) that points to our testing endpoints for Installr beta releases...that's exactly what I need for iOS (for Testflight/Installr builds).

          Show
          timpoulsen Tim Poulsen added a comment - - edited We use different endpoints for AdHoc builds (Installr/TestFlight beta builds) vs our production releases. Currently, we have to manually copy & paste the contents of the config.json file to support such builds. This has resulted in mistakes. While we can use external tooling, like a grunt script, to manipulate the files, it would be best if Alloy itself supported something like: { "env:development": {"url":"https://dev.example.com"}, "env:test":{"url":"https://test.example.com"}, "env:production":{"url":"https://production.example.com"}, "dist:adhoc":{"url":"https://adhoc.example.com"}, "dist:store":{"url":"https://production.example.com"}, } Given that we need this support for both iOS and Android, the key can't be env:adhoc or something iOS-specific. In the above proposal, dist:adhoc and dist:store would need to override env:production . And yes, I realize that natively Android doesn't have a notion of "adhoc" builds. But, I need a signed APK (with our company certificate) that points to our testing endpoints for Installr beta releases...that's exactly what I need for iOS (for Testflight/Installr builds).
          Hide
          fmiao Feon Sua Xin Miao added a comment -

          https://github.com/appcelerator/alloy/pull/721

          config.json now supports dist:adhoc & dist:store key.

          {
              "env:development": {"url":"https://dev.example.com"},
              "env:test":{"url":"https://test.example.com"},
              "env:production":{"url":"https://production.example.com"},
              "dist:adhoc":{"url":"https://adhoc.example.com"},
              "dist:store":{"url":"https://production.example.com"},
          }
          

          Show
          fmiao Feon Sua Xin Miao added a comment - https://github.com/appcelerator/alloy/pull/721 config.json now supports dist:adhoc & dist:store key. { "env:development": {"url":"https://dev.example.com"}, "env:test":{"url":"https://test.example.com"}, "env:production":{"url":"https://production.example.com"}, "dist:adhoc":{"url":"https://adhoc.example.com"}, "dist:store":{"url":"https://production.example.com"}, }
          Hide
          fmiao Feon Sua Xin Miao added a comment -

          PR merged.

          Show
          fmiao Feon Sua Xin Miao added a comment - PR merged.
          Hide
          fokkezb Fokke Zandbergen added a comment -

          Feon Sua Xin Miao Looking at https://github.com/appcelerator/alloy/blob/8d32fa1aa0629473ec0eb7ea5c0ca0be32da58da/Alloy/commands/compile/compilerUtils.js#L867-L868 it will only work for os:ios dist:adhoc and not dist:adhoc os:ios. And env is not involved at all. We might have to refactor parseConfig() this way:

          • Loop through the config.json keys
          • Split on space
          • When all <type>:<value> conditions are true, extend the config object with it

          This means that the order of the keys in config.json determine what overwrites what instead of our code. This makes perfect sense I think, although we might want to force global to always come first.

          Let me know if you need new ticket or can change this PR still.

          Show
          fokkezb Fokke Zandbergen added a comment - Feon Sua Xin Miao Looking at https://github.com/appcelerator/alloy/blob/8d32fa1aa0629473ec0eb7ea5c0ca0be32da58da/Alloy/commands/compile/compilerUtils.js#L867-L868 it will only work for os:ios dist:adhoc and not dist:adhoc os:ios . And env is not involved at all. We might have to refactor parseConfig() this way: Loop through the config.json keys Split on space When all <type>:<value> conditions are true, extend the config object with it This means that the order of the keys in config.json determine what overwrites what instead of our code. This makes perfect sense I think, although we might want to force global to always come first. Let me know if you need new ticket or can change this PR still.

            People

            • Assignee:
              fmiao Feon Sua Xin Miao
              Reporter:
              fokkezb Fokke Zandbergen
              Reviewer:
              Eric Merriman
            • Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development

                  Agile

                    Poker Sessions

                    This issue is currently not assigned to any Poker Session.

                      Git Source Code