When I run pub build, pub puts the compiled app into build/web. Is it possible to configure my pubspec.yaml file to change the default output directory to, say, prod?
EDIT: I'm trying to avoid having to use the --output switch each time.
You can use pub build --output=someOtherDir
See also pub help build
Related
I am now trying to use WireGuardKit, where it asks to create an "External Build System" and fill in the Directory with ${BUILD_DIR}/... /... /SourcePackages/checkouts/wireguard/Sources/WireGuardKitGo (this path has been modified and I guarantee that this path will allow me to pass the compilation).
However, when I execute archive, Xcode reports an error unable to spawn process '/usr/bin/make' (No such file or directory).
I suspect that $(BUILD_DIR) doesn't have a value when the compilation is executed, or I can't use this environment variable at this stage. Because when I don't use relative paths and use absolute paths to assign values to Directory, the project is able to archive successfully.
So my question is, when I execute the archive, how do I get the path of the package I inherited using SPM? Or can I use $(BUILD_DIR) environment variable when I execute archive? Why is it different from when compiling?
UPDATE:
I learned that $(BUILD_DIR) uses $() within it and when I try to use $() directly, it still reports an error, I also tried variables like $(BUILD_PATH), $(BUILD_ROOT), $(BUILT_PRODUCTS_DIR), but none of them work.
So could it be a problem with $(), an environment variable that has no value when the archive is executed?
How do I get the SPM directory when executing the archive?
I was able to solve this issue with an alternative configuration for External Build System
Here is a tutorial (see section "Manual Xcode steps")
The main idea is to use build_wireguard_go_bridge.sh script in your External Build System configuration:
Build Tool: $(PROJECT_DIR)/Scripts/build_wireguard_go_bridge.sh
Arguments: $(ACTION)
Directory: <empty>
is it possible to compile two versions when building?
I would like to have a build/ which is the production release for end users and a buildDev/ with less restrictive dart2js flags. Something like that.
The idea is to be able to access a page with some security token that forces the page use the dart2js debug version.
This is not possible to do in a single build command. webdev build --no-release will use the dev_options instead of release_options, so to get both flavors of build you'll need to run two commands, webdev build; webdev build --no-release -o buildDev.
For my release process I need several different "modes." However, if I use the --mode option for pub build and set it to any value other than release, it forces un-minified javascript.
I know I can configure the dart2js transformer in my pubspec.yaml, but if I set minify: true under the $dart2js heading in my pubspec.yaml I am then forcing them to be minified, and then cannot produce un-minified debug builds.
What I'm really looking for is a way to configure arbitrary dart2js options (minified, checked, etc.) in pub build via the CLI (so that I don't have to hardcode in pubspec.yaml), or, failing that, to be able to specify additional arbitrary flags from the pub build CLI so that I can reserve --mode for debug and release. The asPlugin() transformer constructor takes a BarbackSettings object, but I can't see how to see arbitrary params in that via the command line.
I have never seen anything like that mentioned (for example in any of the bug reports) and I'm pretty sure this is not supported. I suggest to just create a feature request at http://dartbug.com.
One way I can think of is to create a script which manipulates the pubspec.yaml file before executing pub build. This should be easy using the https://pub.dartlang.org/packages/yaml package.
With Dart's "pub" tool and its "deploy" command, you can create a deployable version of your Dart web application. The output is written to the "deploy" directory. I want to know if there's a way to specify a different output directory?
I searched the internet for a command-line option, but found no mention of it. Running "pub help deploy" shows no options for the deploy command.
If "pub deploy" has no output directory option, I want to find the pub.dart source code. I'll create a customized version that accepts an output directory option. Unfortunately, I can't find pub.dart in the SDK. I found the pub shell script. It calls pub.dart.snapshot, which is 100 thousand lines of unintelligible Dart bytecode. Is there a human readable pub.dart file? Is it in the SDK?
Your help is appreciated.
For now, this is not configurable. The source folder is always /web and the output folder is always /deploy.
The source is available at http://code.google.com/p/dart/source/browse/trunk/dart/sdk/lib/_internal/pub/lib/src/command/deploy.dart#33 .
A simple workaround is just to rename deploy once generated.
I am writing a script to automate my iOS building. It will be run outside of Xcode, either via Terminal or from build automating software. Is there any way to have access to Xcode environment variables in my script, so I don't have to try and derive them myself?
For example, can I get access to PROJECT_DIR instead of assuming I'm in the current directory and running pwd?
I am currently hardcoding the product names for my different build configurations. (I'm also hard coding the build configs, but I could parse them them from xcodebuild -list.) Is there a way to get the app if you know the build config name?
(I saw this related question but it doesn't have an answer for me.)
The Xcode environment variables are only defined for child processes of the xcodebuildcommand-line tool.
One solution I used is to have a very simple script as part of my build process (Project->New Build Phase->Add Run Script Build Phase). All this script does is export the necessary variables and call a script in my path somewhere.
That script could be generated by your build script before calling xcodebuild and voilĂ ! you have an external script that has access to Xcode build variables.